:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --accent: #14b8a6;
  --line: rgba(15, 23, 42, 0.12);
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.08);
  --font: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(37, 99, 235, 0.12), transparent 60%),
    radial-gradient(700px 380px at 100% 0%, rgba(20, 184, 166, 0.12), transparent 55%),
    var(--bg);
  min-height: 100vh;
}

img, video, canvas { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #1d4ed8; }
.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 8px 12px;
  z-index: 20;
}
.skip:focus { left: 8px; top: 8px; }

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 251, 0.88);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}
.brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.nav a:hover { color: var(--primary); }

.hero {
  padding: 32px 0 16px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}
.hero h1, .page-head h1 {
  margin: 0 0 12px;
  font-size: 36px;
  line-height: 1.2;
  letter-spacing: -0.03em;
  max-width: 22ch;
}
.lede {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 18px;
  max-width: 60ch;
}
.tool-shell {
  margin-top: 8px;
}

.crumbs {
  padding: 16px 0 0;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.crumbs a { color: var(--muted); text-decoration: none; font-weight: 600; }
.crumbs a:hover { color: var(--primary); }
.crumbs-sep { opacity: 0.5; }

.related-label {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}
.tool-links {
  margin: 0;
  padding-left: 20px;
  max-width: 70ch;
}
.tool-links li { margin-bottom: 8px; color: var(--muted); }
.section p { color: var(--muted); max-width: 70ch; }

.section {
  padding: 48px 0;
  border-top: 1px solid var(--line);
}
.section h2 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.section-lead {
  margin: 0 0 24px;
  color: var(--muted);
  max-width: 70ch;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}
@media (min-width: 800px) {
  .steps { grid-template-columns: repeat(3, 1fr); gap: 24px; }
}
.steps li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-1);
}
.steps h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.2;
}
.steps p { margin: 0; color: var(--muted); font-size: 14px; }

.use-list {
  margin: 0;
  padding-left: 20px;
  max-width: 70ch;
}
.use-list li { margin-bottom: 12px; color: var(--muted); }
.use-list strong { color: var(--text); }

.faq-list { display: grid; gap: 12px; max-width: 70ch; }
.faq-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-1);
}
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p {
  margin: 12px 0 0;
  color: var(--muted);
}

.page { padding: 32px 0 64px; }
.page-head { margin-bottom: 24px; }
.prose {
  max-width: 70ch;
}
.prose h2 {
  margin: 32px 0 12px;
  font-size: 22px;
  line-height: 1.2;
}
.prose h3 {
  margin: 24px 0 8px;
  font-size: 18px;
}
.prose p, .prose li { color: var(--muted); }
.prose ul { padding-left: 20px; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 48px;
  margin-top: 32px;
  background: rgba(255, 255, 255, 0.55);
}
.footer-inner { display: grid; gap: 12px; }
.footer-brand { margin: 0; font-weight: 600; }
.footer-links {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.footer-links a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
.footer-links a:hover { color: var(--primary); }
.footer-note { margin: 0; color: var(--muted); font-size: 12px; }

@media (max-width: 640px) {
  .hero h1, .page-head h1 { font-size: 28px; max-width: none; }
  .header-inner { flex-direction: column; align-items: flex-start; padding: 12px 0; }
  .lede { font-size: 16px; }
  .section { padding: 32px 0; }
}


/* ---- credits, pricing, account, AI blocks ---- */
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px;
  border: 0; border-radius: 10px;
  background: var(--primary); color: #fff;
  font: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}
.btn:hover { background: #1d4ed8; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--line); }
.btn-ghost:hover { background: rgba(37, 99, 235, .07); }
.btn-danger { background: #b42318; }
.btn-danger:hover { background: #912018; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }

.ai-banner {
  display: grid; gap: 10px;
  margin: 24px 0 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-1);
}
.ai-banner p { margin: 0; color: var(--muted); max-width: 66ch; }
.ai-banner .ai-banner-title { color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.ai-banner .btn { justify-self: start; }

.nav-btn {
  border: 1px solid var(--line); background: var(--card);
  color: var(--text); font: inherit; font-size: 14px; font-weight: 600;
  border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
.nav-btn:hover { border-color: var(--primary); color: var(--primary); }
.nav-credits { font-size: 14px; font-weight: 600; color: var(--muted); }
.nav-credits a { color: inherit; text-decoration: none; }
.nav-credits a:hover { color: var(--primary); }

.pay-note {
  margin: 0 0 20px; padding: 12px 16px;
  border-radius: 10px; font-size: 15px; font-weight: 600;
  background: rgba(20, 184, 166, .1);
  border: 1px solid rgba(20, 184, 166, .35);
}

.pack-grid { display: grid; gap: 16px; margin-bottom: 8px; }
@media (min-width: 780px) { .pack-grid { grid-template-columns: repeat(3, 1fr); } }
.pack {
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 20px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.pack-featured { border-color: var(--primary); box-shadow: var(--shadow-2); }
.pack-flag { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.pack-credits { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -.02em; font-weight: 700; font-variant-numeric: tabular-nums; }
.pack-price { margin: 2px 0 0; display: flex; align-items: baseline; gap: 10px; }
.price { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.price-old { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.pack-note { margin: 6px 0 14px; color: var(--muted); font-size: 14px; }
.pack .btn { margin-top: auto; width: 100%; }
.pack-fine { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.acct-guest { padding: 8px 0; max-width: 60ch; }
.acct-guest p { color: var(--muted); }
.acct-cards { display: grid; gap: 16px; margin-bottom: 8px; }
@media (min-width: 780px) { .acct-cards { grid-template-columns: repeat(3, 1fr); } }
.acct-card { padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.acct-label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.acct-value { margin: 6px 0 2px; font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.acct-value-sm { font-size: 18px; }
.acct-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.acct-card .btn { margin-top: 12px; }
.acct-block { padding: 32px 0 0; margin-top: 24px; border-top: 1px solid var(--line); }
.acct-block h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
.acct-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14px; }
.acct-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 8px 8px 0; border-bottom: 1px solid var(--line); }
.acct-table td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.acct-table tbody tr:last-child td { border-bottom: 0; }
.acct-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acct-empty { margin: 14px 0 0; color: var(--muted); font-size: 14px; }

@media (max-width: 640px) {
  .acct-value { font-size: 26px; }
  .pack-credits { font-size: 22px; }
}


/* ---- AI background tool ---- */
.ai-tool {
  display: grid; gap: 14px;
  max-width: 720px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.ai-field { display: grid; gap: 6px; }
.ai-field label { font-size: 14px; font-weight: 600; }
.ai-tool textarea, .ai-tool select {
  width: 100%; font: inherit; font-size: 15px; padding: 10px 12px;
  color: var(--text); background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
}
.ai-tool textarea:focus, .ai-tool select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.ai-hint { margin: 0; color: var(--muted); font-size: 13px; }
.ai-two { display: grid; gap: 14px; }
@media (min-width: 640px) { .ai-two { grid-template-columns: 1fr 1fr; } }
.ai-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ai-balance { margin: 0; color: var(--muted); font-size: 14px; }
.ai-balance strong { color: var(--text); font-variant-numeric: tabular-nums; }
.ai-status { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.ai-status-busy { background: rgba(37, 99, 235, .08); color: #1d4ed8; }
.ai-status-ok { background: rgba(20, 184, 166, .12); color: #0f766e; }
.ai-status-warn { background: rgba(180, 35, 24, .08); color: #b42318; }
.ai-out { display: grid; gap: 14px; }
.ai-result { margin: 0; display: grid; gap: 8px; }
.ai-result img, .ai-result video { width: auto; max-height: 420px; border-radius: var(--radius); border: 1px solid var(--line); }
.ai-result figcaption a { font-size: 14px; font-weight: 600; }


/* ---- nav toggle, type scale, AI strip (review pass) ---- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.nav-toggle {
  display: none;
  flex-direction: column; justify-content: center; gap: 4px;
  width: 42px; height: 42px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); cursor: pointer;
}
.nav-toggle-bar { display: block; height: 2px; background: var(--text); border-radius: 2px; }

@media (max-width: 860px) {
  .header-inner { position: relative; }
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    position: absolute; left: 0; right: 0; top: calc(100% + 6px);
    flex-direction: column; align-items: flex-start; gap: 10px;
    padding: 16px 18px;
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-2);
    z-index: 30;
  }
  .nav.open { display: flex; }
  .nav a, .nav .nav-btn, .nav .nav-credits { font-size: 15px; }
  .nav .nav-btn { width: 100%; text-align: left; }
}

.hero h1 {
  font-size: clamp(1.85rem, 4.4vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
@media (max-width: 640px) {
  .hero h1 { font-size: 1.7rem; line-height: 1.2; }
}
.eyebrow { color: var(--primary); }

.ai-strip {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 20px;
  margin: 36px auto 0;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-1);
}
.ai-strip p { margin: 0; color: var(--muted); font-size: 15px; }
.ai-strip strong { color: var(--text); }
.ai-strip a { font-weight: 600; font-size: 15px; white-space: nowrap; }

.steps { gap: 20px; }
.steps li { padding: 22px; }
.steps h3 { margin-top: 0; }

.tool-shell button { font-weight: 600; min-height: 42px; }
.tool-shell button[type="submit"],
.tool-shell #start,
.tool-shell #run,
.tool-shell .primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.tool-shell button[disabled] { opacity: .5; cursor: not-allowed; }


/* ---- mobile overflow + contrast fixes (review pass 2) ---- */
html, body { max-width: 100%; overflow-x: hidden; }
.header-inner { padding-inline: 0; }
.nav { gap: 10px 24px; }

.tool-shell { max-width: 100%; overflow-x: hidden; }
.tool-shell *, .tool-shell *::before, .tool-shell *::after { min-width: 0; }
.tool-shell input, .tool-shell textarea, .tool-shell select, .tool-shell button {
  max-width: 100%; box-sizing: border-box;
}
@media (max-width: 640px) {
  .tool-shell { width: 100%; }
  .tool-shell input, .tool-shell textarea, .tool-shell select { width: 100%; }
  .tool-shell input + button, .tool-shell textarea + button { width: 100%; margin-top: 10px; }
  .nav-toggle { width: 44px; height: 44px; }
}

.steps li { display: flex; flex-direction: column; min-height: 180px; }
.steps li > * { flex: 0 0 auto; }

.tool-shell button:not([disabled]) {
  color: #0f172a; background: #eef2f7;
  border: 1px solid rgba(15, 23, 42, .22);
  font-weight: 600;
}
.tool-shell button[type="submit"],
.tool-shell #run,
.tool-shell #start,
.tool-shell #btn-run,
.tool-shell .primary,
.tool-shell .btn-primary {
  background: #1d4ed8; color: #fff; border-color: #1d4ed8;
}
