:root {
  --bg: #161239;
  --bg-2: #251b57;
  --panel: rgba(30, 24, 74, 0.76);
  --panel-strong: rgba(28, 21, 66, 0.9);
  --panel-soft: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 196, 132, 0.2);
  --border-strong: rgba(255, 196, 132, 0.34);
  --text: #f8f8ff;
  --muted: #d7d3ef;
  --accent: #ff9b71;
  --accent-2: #76e5c6;
  --accent-3: #b08cff;
  --success: #85ebc7;
  --warning: #ffd66e;
  --danger: #ff9ca8;
  --shadow: 0 24px 70px rgba(12, 8, 35, 0.34);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 164, 107, 0.16), transparent 22%),
    radial-gradient(circle at 84% 16%, rgba(118, 229, 198, 0.12), transparent 20%),
    radial-gradient(circle at 78% 78%, rgba(176, 140, 255, 0.14), transparent 24%),
    linear-gradient(rgba(18, 12, 50, 0.78), rgba(14, 11, 39, 0.86)),
    url('formatify.png') center center / cover fixed no-repeat;
}

a { color: inherit; }

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.35;
  pointer-events: none;
}

.orb-1 {
  width: 280px;
  height: 280px;
  background: rgba(255, 155, 113, 0.34);
  top: 20px;
  left: -60px;
}

.orb-2 {
  width: 340px;
  height: 340px;
  background: rgba(118, 229, 198, 0.22);
  bottom: -80px;
  right: -50px;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.hero-card,
.card {
  background: linear-gradient(180deg, rgba(37, 28, 89, 0.8), rgba(22, 17, 56, 0.9));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 28px;
  padding: 28px;
  border-radius: 30px;
  margin-bottom: 20px;
}

.brand-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.35rem;
  color: #081537;
  background: linear-gradient(135deg, #ffae78, #76e5c6 58%, #b08cff);
  box-shadow: 0 10px 24px rgba(255, 155, 113, 0.24);
}

.eyebrow,
.section-kicker {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 800;
}

.hero-copy h1 {
  margin: 6px 0 0;
  font-size: clamp(2rem, 4vw, 3.35rem);
  line-height: 1.02;
  max-width: 680px;
}

.hero-text {
  margin: 18px 0 0;
  color: var(--muted);
  max-width: 700px;
  font-size: 1.04rem;
  line-height: 1.7;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.hero-pills span,
.status-badge {
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(135deg, rgba(255,171,118,0.1), rgba(118,229,198,0.08), rgba(255,255,255,0.06));
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.status-badge.idle { color: var(--muted); }
.status-badge.ready,
.status-badge.success { color: var(--success); }
.status-badge.busy { color: var(--warning); }
.status-badge.error { color: var(--danger); }

.hero-art {
  position: relative;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-art img {
  width: 100%;
  max-width: 460px;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 18px 44px rgba(0,0,0,0.25);
  opacity: 0.95;
}

.hero-glass-card {
  position: absolute;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(34, 26, 82, 0.7);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.2);
}

.hero-glass-card strong {
  display: block;
  font-size: 0.96rem;
  margin-bottom: 4px;
}

.hero-glass-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.top-card { top: 24px; left: -8px; }
.bottom-card { bottom: 26px; right: -6px; }

.workspace-grid,
.results-grid {
  display: grid;
  gap: 20px;
}

.workspace-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
  margin-bottom: 20px;
}

.results-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
}

.card {
  border-radius: 26px;
  padding: 24px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.section-heading.compact { margin-bottom: 16px; }
.section-heading h2 {
  margin: 6px 0 0;
  font-size: 1.35rem;
}

.upload-panel { margin-bottom: 18px; }

.upload-box {
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 170px;
  padding: 24px;
  border-radius: 22px;
  border: 1px dashed rgba(255, 183, 123, 0.42);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03)),
    rgba(255,255,255,0.02);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.upload-box:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 183, 123, 0.62);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
}

.upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,155,113,0.28), rgba(118,229,198,0.2), rgba(176,140,255,0.18));
  font-size: 1.4rem;
  margin-bottom: 12px;
}

.upload-title {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
}

.upload-subtitle {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.quick-info-row,
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.quick-info-row { margin-bottom: 16px; }

.mini-info-card,
.field,
.pill-toggle {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.035));
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 18px;
}

.mini-info-card {
  padding: 14px;
}

.mini-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}

label {
  font-size: 0.94rem;
  font-weight: 700;
}

small,
.muted {
  color: var(--muted);
}

input[readonly],
select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 190, 136, 0.18);
  background: rgba(27, 20, 64, 0.96);
  color: var(--text);
  outline: none;
}

input[readonly] { color: var(--muted); }

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.pill-toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
}

.pill-toggle.full-span { grid-column: 1 / -1; }

.checkbox input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.checkbox strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.checkbox small {
  display: block;
  line-height: 1.5;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

button {
  appearance: none;
  border: none;
  border-radius: 16px;
  padding: 14px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease, background .15s ease, border-color .15s ease;
}

button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: 0.6; cursor: wait; transform: none; }

#convertBtn {
  background: linear-gradient(135deg, #ffab76, #ffd66e 36%, #76e5c6 78%, #b08cff);
  color: #20153f;
  box-shadow: 0 12px 28px rgba(255, 171, 118, 0.28);
}

button.secondary {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
}

.preview-box,
.result-box {
  min-height: 360px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.1);
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.028));
  padding: 16px;
  overflow: auto;
}

.preview-box.empty,
.center-message {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.preview-box img,
.preview-box canvas {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  display: block;
  margin: 0 auto;
}

.preview-doc {
  width: 100%;
  line-height: 1.6;
  color: var(--text);
}

.preview-doc table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.preview-doc td,
.preview-doc th {
  border: 1px solid rgba(255,255,255,0.1);
  padding: 8px;
}

.page-preview-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.page-preview-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.035));
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 16px;
  padding: 12px;
}

.preview-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-item {
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
}


.result-item h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.result-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.result-links a,
.result-links button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-width: 106px;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(255, 171, 118, 0.14);
  color: var(--text);
  border: 1px solid rgba(255, 171, 118, 0.22);
}

.status {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(125, 228, 197, 0.1);
  color: var(--success);
  border: 1px solid rgba(125, 228, 197, 0.2);
}

.status.error {
  background: rgba(255, 152, 152, 0.1);
  color: var(--danger);
  border-color: rgba(255, 152, 152, 0.22);
}

.support-grid {
  display: grid;
  gap: 14px;
}

.support-item {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
}


.support-item strong {
  display: block;
  margin-bottom: 10px;
}

.support-item ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.note-text {
  margin-top: 14px;
  line-height: 1.6;
}

.is-hidden {
  display: none !important;
}


select:focus,
button:focus-visible,
.upload-box:focus-within {
  box-shadow: 0 0 0 3px rgba(118, 229, 198, 0.16), 0 0 0 1px rgba(255, 171, 118, 0.2);
}

.result-links a:hover,
.result-links button:hover,
button.secondary:hover {
  border-color: rgba(255, 171, 118, 0.34);
  background: rgba(255, 171, 118, 0.18);
}

.support-item strong,
.result-item h3 {
  color: #fff4eb;
}
@media (max-width: 1080px) {
  .hero-card,
  .workspace-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .hero-art {
    min-height: 260px;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 16px 14px 28px;
  }

  .hero-card,
  .card {
    padding: 18px;
    border-radius: 22px;
  }

  .quick-info-row,
  .grid,
  .toggle-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }

  .top-card,
  .bottom-card {
    position: static;
    margin-top: 12px;
  }

  .hero-art {
    display: block;
  }
}

.admin-tools-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.admin-tools-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.ghost-button {
  background: rgba(255,255,255,0.08);
}

.ad-strip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.bottom-strip {
  margin-top: 20px;
}

.ad-slot {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.12);
  background:
    radial-gradient(circle at top right, rgba(255, 194, 92, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(255,255,255,0.09), rgba(255,255,255,0.04));
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
}

.ad-slot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
}

.ad-copy {
  min-width: 0;
}

.ad-label {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  margin-bottom: 10px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #1b1738;
  background: linear-gradient(135deg, #ffd36a, #ff9b71);
}

.ad-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.ad-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.ad-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 14px;
  padding: 12px 16px;
  text-decoration: none;
  font-weight: 800;
  color: #161239;
  background: linear-gradient(135deg, #ffd36a, #76e5c6);
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.ad-empty {
  display: none;
}

.ad-sidebar-slot {
  margin: 16px 0 6px;
}

.ad-sidebar-slot .ad-slot-inner {
  align-items: flex-start;
  flex-direction: column;
}

.admin-dialog {
  width: min(920px, calc(100vw - 24px));
  border: 0;
  padding: 0;
  background: transparent;
}

.admin-dialog::backdrop {
  background: rgba(7, 8, 19, 0.66);
  backdrop-filter: blur(8px);
}

.admin-dialog-card {
  margin: 0;
  padding: 24px;
  border-radius: 28px;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(37, 28, 89, 0.95), rgba(22, 17, 56, 0.98));
  box-shadow: var(--shadow);
}

.admin-dialog-header,
.admin-login-row,
.admin-editor-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.admin-login-row {
  margin-top: 18px;
  align-items: end;
}

.compact-field {
  flex: 1;
}

.icon-button {
  min-width: 48px;
  padding: 10px 14px;
}

.admin-editor-wrap {
  margin-top: 18px;
}

#adsConfigEditor {
  min-height: 360px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 900px) {
  .ad-strip-grid,
  .workspace-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .ad-slot-inner,
  .admin-login-row,
  .admin-editor-actions,
  .admin-dialog-header {
    flex-direction: column;
    align-items: stretch;
  }

  .ad-cta {
    width: 100%;
  }
}


.progress-panel {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.94rem;
}

.progress-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.09);
  position: relative;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  box-shadow: 0 0 18px rgba(255, 155, 113, 0.25);
  transition: width .25s ease;
}

.progress-track.indeterminate .progress-fill {
  width: 35% !important;
  animation: indeterminateSlide 1.15s linear infinite;
}

@keyframes indeterminateSlide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.seo-card {
  margin-top: 20px;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.seo-block {
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}

.seo-block h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.seo-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.faq-block {
  grid-column: span 2;
}

.faq-list {
  display: grid;
  gap: 12px;
}

.faq-list details {
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  padding: 14px 16px;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 700;
}

.faq-list details p {
  margin-top: 10px;
}

@media (max-width: 860px) {
  .seo-grid {
    grid-template-columns: 1fr;
  }

  .faq-block {
    grid-column: span 1;
  }
}
.app-footer {
  text-align: center;
  padding: 18px 12px;
  font-size: 0.85rem;
  color: var(--muted);
  opacity: 0.7;
}
