:root {
  --bg: #f4f7fc;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-2: #2563eb;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --warn: #d97706;
  --err: #dc2626;
  --err-bg: #fef2f2;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
  --radius: 16px;
  --radius-sm: 12px;
  --max: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(180deg, #eef7f6 0%, var(--bg) 220px);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
code {
  background: var(--accent-soft);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.88em;
}

/* ── Header ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  backdrop-filter: blur(12px);
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.brand-wrap { display: flex; flex-direction: column; gap: 0.05rem; }
.brand {
  font-weight: 800;
  font-size: 1.1rem;
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}
.brand-sub { font-size: 0.72rem; color: var(--muted); font-weight: 500; }
.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
}
.main-nav a {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  transition: all 0.15s;
}
.main-nav a:hover,
.main-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
}
.nav-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  font-size: 1.1rem;
}

/* ── Layout ── */
.container { max-width: var(--max); margin: 0 auto; padding: 1.25rem; }
.page-stack { max-width: var(--max); margin: 0 auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1.25rem; }

.hero, .panel, .article, .faq-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero { padding: 1.75rem; }
.hero h1 { margin: 0 0 0.5rem; font-size: clamp(1.6rem, 4vw, 2.15rem); letter-spacing: -0.03em; line-height: 1.2; }
.hero h2 { margin: 0 0 0.75rem; font-size: 1.25rem; letter-spacing: -0.02em; }
.hero p { margin: 0; color: var(--muted); line-height: 1.7; max-width: 72ch; }

.hero-grid, .cards {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}

.hub-card, .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all 0.18s ease;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.hub-card:hover, .card:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.hub-card span, .card span { color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.hub-card strong, .card strong { font-size: 1rem; }

.card-icon, .platform-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.75rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.feature-strip {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.feature-strip span {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

/* ── Tool panel ── */
.panel { padding: 1.5rem; }
.platform-head {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.title { margin: 0; font-size: 1.55rem; letter-spacing: -0.03em; }
.sub { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.95rem; }

.toolbox label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  display: block;
  margin: 0.85rem 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.toolbox input {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.toolbox input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  background: #fff;
}

.actions { display: flex; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }
.tool-actions { align-items: stretch; }
.tool-actions .primary { flex: 1; min-width: 140px; }
.input-row { margin-top: 0.25rem; }

.btn-paste {
  background: #fff;
  color: var(--text);
  border: 1.5px solid var(--line-strong);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.btn-paste:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.btn-download-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 48px;
  font-size: 1rem;
  letter-spacing: 0.02em;
}
.btn-ico { font-size: 1.05rem; line-height: 1; }

.steps {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem 0.85rem 1.35rem;
  background: var(--accent-soft);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  color: #334155;
  line-height: 1.65;
}
.steps li { margin: 0.2rem 0; }
.steps strong { color: var(--accent); }
button {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.15rem;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.92rem;
  transition: all 0.15s;
  font-family: inherit;
}
button:active { transform: scale(0.98); }
button.primary {
  background: linear-gradient(135deg, var(--accent), #3b82f6);
  color: #fff;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}
button.primary:hover { filter: brightness(1.05); }
button.secondary { background: var(--accent-soft); color: var(--accent); border: 1px solid #bfdbfe; }
button.ghost { background: #fff; color: var(--muted); border: 1.5px solid var(--line); }

.status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--line);
}
.status.idle { color: var(--muted); background: var(--surface-2); }
.status.loading { color: var(--accent); background: var(--accent-soft); border-color: #bfdbfe; }
.status.ok { color: var(--ok); background: var(--ok-bg); border-color: #a7f3d0; }
.status.err { color: var(--err); background: var(--err-bg); border-color: #fecaca; }

.result {
  margin-top: 1rem;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem;
  min-height: 100px;
}
.result.empty, .result.loading { color: var(--muted); text-align: center; padding: 2rem 1rem; }
.result.loading .spinner {
  width: 2.2rem;
  height: 2.2rem;
  margin: 0 auto 0.75rem;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-card {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1rem;
  align-items: start;
}
.preview-img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.preview-placeholder {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px dashed var(--line-strong);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
  padding: 0.5rem;
}
.result-card h3 { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.uploader { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.88rem; }
.badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge.ok { border-color: #a7f3d0; color: var(--ok); background: var(--ok-bg); }

.format-tabs { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1rem; }
.format-tabs .tab {
  background: #fff;
  color: var(--muted);
  border: 1.5px solid var(--line);
  padding: 0.5rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 600;
}
.format-tabs .tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.55rem;
  margin-top: 0.85rem;
}
.thumb-opt {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0.4rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}
.thumb-opt img { border-radius: 6px; margin-bottom: 0.3rem; aspect-ratio: 16/9; object-fit: cover; width: 100%; }
.thumb-opt.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }

.media-pick { margin-top: 0.85rem; }
.media-pick select {
  width: 100%;
  background: #fff;
  color: var(--text);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem;
  font-size: 0.9rem;
}

.dl-wrap { margin-top: 1rem; }
.dl-btn {
  width: 100%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 1rem;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.28);
  border-radius: var(--radius-sm);
}
.dl-btn.wide { width: 100%; }
.dl-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.dl-icon { font-size: 1.15rem; }
.note { color: var(--muted); font-size: 0.82rem; margin-top: 0.75rem; line-height: 1.55; }
.muted { color: var(--muted); font-size: 0.9rem; }

/* ── Article & FAQ ── */
.article, .faq-block { padding: 1.75rem; }
.article h2, .faq-block h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  padding-bottom: 0.65rem;
  border-bottom: 2px solid var(--accent-soft);
}
.article h2:not(:first-child), .faq-block h2 { margin-top: 2rem; }
.article p { color: #334155; line-height: 1.8; font-size: 0.97rem; margin: 0 0 1rem; }

.meta-badges { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 1rem; }
.meta-badges .badge {
  text-transform: none;
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
  background: var(--accent-soft);
  border-color: #bfdbfe;
  color: var(--accent);
}

/* Premium FAQ accordion (Google FAQPage friendly) */
.faq-accordion { display: flex; flex-direction: column; gap: 0.55rem; }
.faq-acc {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.faq-acc:hover { border-color: #93c5fd; }
.faq-acc[open] {
  border-color: #3b82f6;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.1);
}
.faq-q {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.15rem;
  padding-right: 2.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.45;
  position: relative;
  user-select: none;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q::after {
  content: '+';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 700;
  transition: transform 0.2s, background 0.2s;
}
.faq-acc[open] .faq-q::after {
  content: '−';
  background: var(--accent);
  color: #fff;
}
.faq-a {
  padding: 0 1.15rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  animation: faqOpen 0.25s ease;
}
.faq-a p { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.7; }
@keyframes faqOpen {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}
.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  background: var(--surface-2);
}
.faq-item h4 { margin: 0; font-size: 0.95rem; color: var(--text); line-height: 1.4; }
.faq-item p { margin: 0.45rem 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.65; }

.crosslinks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
}
.crosslinks a {
  border: 1px solid var(--line);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--text);
  transition: all 0.15s;
}
.crosslinks a:hover { border-color: #93c5fd; box-shadow: var(--shadow-sm); color: var(--accent); }
.crosslinks .card-icon { width: 2rem; height: 2rem; font-size: 0.65rem; }
.crosslinks.legal a { text-align: center; font-weight: 600; font-size: 0.9rem; }

.section-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* ── Ad gate ── */
.ad-gate {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.ad-gate.open { display: flex; }
.ad-gate-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.5rem;
  position: relative;
  box-shadow: var(--shadow-lg);
}
.ad-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.25rem 0.55rem;
  border-radius: 8px;
}
.ad-slot {
  min-height: 90px;
  margin: 1rem 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--surface-2);
}
.ad-placeholder { color: var(--muted); font-size: 0.82rem; text-align: center; padding: 1rem; }
.ad-timer { text-align: center; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.ad-gate-card h3 { margin: 0; font-size: 1.15rem; text-align: center; }

.site-footer { max-width: var(--max); margin: 0 auto 2rem; padding: 0 1.25rem; }
.site-footer .hero { padding: 1.1rem 1.5rem; }
.site-footer p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok);
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid #a7f3d0;
}

pre#adminOut {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: #334155;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; min-width: 44px; min-height: 44px; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 0.75rem 1rem calc(1rem + env(safe-area-inset-bottom));
    flex-direction: column;
    align-items: stretch;
    box-shadow: var(--shadow);
    max-height: min(70vh, 420px);
    overflow-y: auto;
  }
  .main-nav a { width: 100%; padding: 0.65rem 0.85rem; font-size: 0.95rem; }
  .main-nav.open { display: flex; }
  .topbar {
    position: sticky;
    flex-wrap: wrap;
    padding-top: calc(0.75rem + env(safe-area-inset-top));
  }
  .page-stack { padding: 1rem; gap: 1rem; }
  .toolbox { padding: 1.15rem !important; }
  .input-row input { font-size: 16px; min-height: 48px; }
  .tool-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }
  .tool-actions button { width: 100%; min-height: 48px; justify-content: center; }
  .btn-download-main { font-size: 1.05rem; }
  .result-card { grid-template-columns: 80px 1fr; }
  .preview-img, .preview-placeholder { width: 80px; height: 80px; }
  .faq-grid { grid-template-columns: 1fr; }
  .hero { padding: 1.25rem; }
  .platform-head .title { font-size: 1.35rem; }
}
