/* cliptowords: "Quiet Tool" (docs/design/design-direction.md, direction B).
   Tokens first, then components using only tokens. Mobile first. */

:root {
  color-scheme: light;

  /* colour */
  --paper: #ffffff;
  --surface: #ffffff;
  --sunken: #f5f7fa;          /* ink 16.6:1, ink-2 5.84:1, accent 6.03:1 */
  --ink: #0f172a;             /* 17.9:1 on white */
  --ink-2: #566173;           /* 6.26:1 on white, 5.0:1 on --line */
  --line: #e4e7ec;            /* hairlines (decorative); also the disabled-button fill */
  --line-strong: #7e8798;     /* UI borders: 3.62:1 on white, 3.37:1 on sunken */
  --accent: #2251d8;          /* as text 6.49:1; white on it 6.49:1 */
  --accent-hover: #1a41b3;    /* white on it 8.57:1 */
  --accent-soft: #edf2ff;     /* accent on it 5.79:1 */
  --on-accent: #ffffff;
  --danger: #c4291c;          /* white on it 5.70:1 */
  --danger-soft: #fdeeec;     /* ink on it 15.9:1, danger on it 5.06:1 */
  --danger-line: #f0c2bc;     /* decorative edge only */
  --on-danger: #ffffff;
  --scrim: rgb(15 23 42 / 0.55);

  /* type */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.1875rem;
  --text-2xl: 1.4375rem;
  --text-h1: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);

  /* space (4 px base) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px;
  --gutter: 16px;

  /* shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --shadow-1: 0 1px 3px rgb(15 23 42 / 0.08);
  --shadow-2: 0 8px 24px -8px rgb(15 23 42 / 0.14);
  --shadow-3: 0 24px 64px -16px rgb(15 23 42 / 0.35);

  /* layout */
  --w-stage: 720px;
  --w-text: 68ch;
  --w-wide: 1040px;

  /* motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --fast: 150ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0c1016;
    --surface: #151a22;
    --sunken: #11161d;
    --ink: #e7ecf3;           /* 16.1:1 on bg, 14.7:1 on surface */
    --ink-2: #9aa5b4;         /* 7.64:1 on bg, 7.0:1 on surface */
    --line: #232a35;
    --line-strong: #5f6a7b;   /* 3.48:1 on bg, 3.19:1 on surface */
    --accent: #7aa2ff;        /* 7.66:1 as text */
    --accent-hover: #9bb9ff;
    --accent-soft: #18233d;   /* accent on it 6.27:1 */
    --on-accent: #08122b;     /* 7.46:1 on accent */
    --danger: #ff8a80;        /* 8.35:1 on bg */
    --danger-soft: #3a1c1c;   /* danger on it 6.75:1 */
    --danger-line: #5c2b2b;
    --on-danger: #0c1016;
    --scrim: rgb(0 0 0 / 0.7);
    --shadow-1: 0 1px 3px rgb(0 0 0 / 0.5);
    --shadow-2: 0 8px 24px -8px rgb(0 0 0 / 0.6);
    --shadow-3: 0 24px 64px -16px rgb(0 0 0 / 0.8);
  }
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; }
html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--text-md)/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hidden { display: none !important; }
.icon { width: 1.25em; height: 1.25em; flex: none; }

.skip-link {
  position: absolute; left: var(--s4); top: -100px; z-index: 10;
  padding: var(--s3) var(--s4); border-radius: var(--r-md);
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--s3); }

/* ---- buttons ---- */
button { font: inherit; color: inherit; cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 48px; padding: var(--s3) var(--s5);
  border: 1px solid transparent; border-radius: var(--r-md);
  font: 600 var(--text-md)/1.25 var(--font-sans); text-align: center; text-decoration: none;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { color: var(--ink); border-color: var(--accent); }
.btn:disabled { cursor: progress; opacity: 0.7; }

/* ---- header / nav ---- */
.site-header { border-bottom: 1px solid var(--line); }
.site-nav {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--s4);
  width: min(100% - 2 * var(--gutter), var(--w-wide)); margin-inline: auto;
  min-height: 60px;
}
.brand {
  display: inline-flex; align-items: center; gap: var(--s2); min-height: 48px; margin-right: auto;
  color: var(--ink); text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-mark { flex: none; }
.wordmark { font: 650 1.1875rem/1 var(--font-sans); letter-spacing: -0.02em; }
.wordmark-to { font-weight: 400; color: var(--ink-2); }

.nav-links { display: flex; flex-wrap: wrap; margin-inline: calc(-1 * var(--s2)); }
.nav-links a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s2);
  color: var(--ink-2); font-size: var(--text-sm); text-decoration: none;
}
.nav-links a:hover { color: var(--ink); text-decoration: underline; }

.nav-links a[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* Account: pack balance badge, and a small menu (hover, or click/tap/Enter) */
.account-menu { position: relative; display: flex; }
.nav-balance {
  margin-left: 6px; padding: 1px 7px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent); font-size: 0.75rem; font-weight: 600; line-height: 1.5;
}
.account-menu-list {
  position: absolute; z-index: 30; top: 100%; right: 0; display: none; flex-direction: column;
  min-width: 13rem; padding: var(--s1); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-2);
}
.account-menu.has-menu.open .account-menu-list { display: flex; }
@media (hover: hover) { .account-menu.has-menu:hover .account-menu-list { display: flex; } }
.account-menu.dismissed .account-menu-list { display: none !important; } /* Escape beats :hover */
.account-menu-list a, .account-menu-list button {
  display: flex; align-items: center; min-height: 44px; padding: 0 var(--s3);
  background: none; border: 0; border-radius: var(--r-sm, 8px); font: inherit; font-size: var(--text-sm);
  color: var(--ink); text-align: left; text-decoration: none; cursor: pointer;
}
.nav-links .account-menu-list a { color: var(--ink); padding: 0 var(--s3); justify-content: flex-start; min-width: 0; }
.account-menu-list a:hover, .account-menu-list button:hover,
.account-menu-list a:focus-visible, .account-menu-list button:focus-visible { background: var(--sunken); text-decoration: none; }

@media (max-width: 539px) {
  /* links on a second row, spread edge to edge so five fit at 360 px */
  .nav-links { flex-basis: calc(100% + 2 * var(--s1)); justify-content: space-between; margin-inline: calc(-1 * var(--s1)); }
  .nav-links a { padding-inline: var(--s1); }
}
@media (max-width: 359px) {
  /* 320 px: tighter, but every link stays at least 44 px wide */
  .nav-links { flex-basis: calc(100% + 4px); margin-inline: -2px; }
  .nav-links a { min-width: 44px; justify-content: center; padding-inline: 2px; }
}

/* ---- page layout ---- */
.page { padding-bottom: var(--s8); }
.stage, .content { width: min(100% - 2 * var(--gutter), var(--w-stage)); margin-inline: auto; }

/* ---- hero ---- */
.hero { padding-top: var(--s2); margin-bottom: var(--s6); text-align: center; }
.sub { max-width: 56ch; margin: var(--s3) auto 0; font-size: var(--text-lg); line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.small-page .sub { margin-inline: 0; }
/* pricing page: no tool, so the plans follow the hero closely */
.stage + .packs { margin-top: var(--s5); }
h1 { max-width: 24ch; margin-inline: auto; font-size: var(--text-h1); line-height: 1.15; text-wrap: balance; }

/* ---- tool: text tabs + a "command bar" ---- */
.tabs { display: flex; justify-content: center; gap: var(--s5); margin-bottom: var(--s3); }
.tab {
  flex: none; min-height: 44px; padding: var(--s2) 2px;
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--ink-2); font-size: var(--text-sm); font-weight: 500;
}
.tab:hover { color: var(--ink); }
/* active = underline + weight + colour (never colour alone) */
.tab.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }

.panel { display: flex; flex-direction: column; gap: var(--s2); }
.panel .btn { width: 100%; min-height: 52px; }

.field {
  display: flex; align-items: center; gap: var(--s2);
  min-height: 56px; padding: 0 var(--s3);
  background: var(--sunken); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  color: var(--ink-2);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.field:focus-within { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input {
  flex: 1; min-width: 0; min-height: 50px; padding: 0;
  background: none; border: 0; color: var(--ink); font: inherit; font-size: var(--text-md);
}
.field input:focus, .field input:focus-visible { outline: none; }
.field input::placeholder { color: var(--ink-2); opacity: 1; }
.field-file input { font-size: var(--text-sm); padding: var(--s2) 0; }
.field-file input::file-selector-button {
  margin-right: var(--s3); min-height: 36px; padding: var(--s1) var(--s3);
  background: var(--surface); color: var(--ink); font: 600 var(--text-sm) var(--font-sans);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); cursor: pointer;
}

/* working: status text with a calm progress bar underneath */
.status {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--s2);
  padding-top: var(--s3); color: var(--ink); font-size: var(--text-sm);
}
.progress {
  position: relative; display: block; flex: 1 1 100%; order: 2; height: 4px;
  background: var(--accent-soft); border-radius: var(--r-pill); overflow: hidden;
}
.progress-bar {
  position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
  background: var(--accent); border-radius: var(--r-pill);
  animation: progress 1.6s var(--ease) infinite;
}
@keyframes progress {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}
/* long recordings: the bar fills with real progress (width set by app.js) */
.progress.determinate { height: 6px; }
.progress.determinate .progress-bar { width: 0; animation: none; transition: width 0.6s var(--ease); }

/* trust list: stacked on phones, one row when there's room */
.trust-list {
  display: grid; gap: var(--s1); width: fit-content; max-width: 100%;
  margin: var(--s4) auto 0; padding: 0; list-style: none;
  font-size: 0.9375rem; font-weight: 500; line-height: 1.45; color: var(--ink);
}
.trust-list li { display: flex; align-items: flex-start; gap: var(--s2); }
.trust-list .icon { width: 1.1em; height: 1.1em; margin-top: 0.15em; color: var(--accent); }

/* "15 free minutes a day": the free rules in a tip on hover, keyboard focus or tap (Escape closes) */
.tip-wrap { position: relative; }
.tip-trigger {
  padding: 11px 0; margin: -11px 0; background: none; border: 0; font: inherit; color: inherit; cursor: help;
  text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.tip {
  position: absolute; z-index: 20; top: calc(100% + var(--s2)); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: min(34ch, 86vw); padding: var(--s2) var(--s3);
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-2); font-size: var(--text-sm); font-weight: 400; line-height: 1.5; text-align: left;
  visibility: hidden; opacity: 0; transition: opacity 0.12s, visibility 0s 0.15s;
}
.tip::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: calc(var(--s2) + 2px); } /* hover bridge */
.tip-trigger:focus-visible + .tip, .tip-wrap.tip-open .tip { visibility: visible; opacity: 1; transition: opacity 0.12s; }
@media (hover: hover) { .tip-wrap:hover .tip { visibility: visible; opacity: 1; transition: opacity 0.12s; } }
.tip-wrap.tip-closed .tip { visibility: hidden; opacity: 0; }

.fine-print { max-width: 60ch; margin: var(--s3) auto 0; font-size: var(--text-sm); line-height: 1.5; color: var(--ink-2); text-align: center; }

.link-btn {
  min-height: 44px; padding: 0; background: none; border: 0;
  color: var(--accent); font-size: var(--text-sm); text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--accent-hover); }

/* errors: tinted box + "!" mark (JS sets textContent) */
.error {
  position: relative; margin-top: var(--s4);
  padding: var(--s3) var(--s4) var(--s3) calc(var(--s4) + 28px);
  background: var(--danger-soft); color: var(--ink);
  border-left: 4px solid var(--danger); border-radius: var(--r-md);
  font-size: 0.9375rem; line-height: 1.5;
}
.error::before {
  content: "!"; position: absolute; left: var(--s3); top: var(--s3);
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--danger); color: var(--on-danger);
  font: 700 13px/20px var(--font-sans); text-align: center;
}
/* free limit / upgrade-needs-a-pack: information, not failure */
.error[data-kind="limit"] { background: var(--accent-soft); border-left-color: var(--accent); }
.error[data-kind="limit"]::before { content: "i"; background: var(--accent); color: var(--on-accent); }

/* ---- result ---- */
.result {
  margin-top: var(--s5); padding: var(--s4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  animation: rise 220ms var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.result-head h2 { font-size: var(--text-xl); line-height: 1.3; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.meta { margin-top: var(--s1); font-size: var(--text-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.badge {
  display: inline-flex; align-items: center; gap: var(--s1); margin-top: var(--s2);
  padding: 2px var(--s3) 2px var(--s2); border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent); font-size: 0.8125rem; font-weight: 600;
}
.badge .icon { width: 1em; height: 1em; }

/* "Standard | More accurate" after an upgrade */
.version-switch { display: inline-flex; margin-right: auto; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); }
.version-switch button {
  min-height: 36px; padding: 0 var(--s3); border: 0; border-radius: var(--r-pill);
  background: none; color: var(--ink-2); font: inherit; font-size: var(--text-sm); cursor: pointer;
}
.version-switch button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.version-switch button:not([aria-pressed="true"]):hover { color: var(--ink); background: var(--sunken); }
.result-toolbar {
  display: flex; justify-content: flex-end; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s3);
  border-bottom: 1px solid var(--line);
}

/* switch: native checkbox; state shown by knob position */
.toggle {
  display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px;
  color: var(--ink-2); font-size: var(--text-sm); cursor: pointer;
}
.toggle input {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; margin: 0;
  width: 36px; height: 22px; border-radius: var(--r-pill);
  background: var(--sunken); border: 1px solid var(--line-strong); cursor: pointer;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.toggle input::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--ink-2); transition: transform var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.toggle input:checked { background: var(--accent); border-color: var(--accent); }
.toggle input:checked::before { transform: translateX(14px); background: var(--on-accent); }

.transcript {
  max-height: 60vh; overflow-y: auto; margin: 0 calc(-1 * var(--s4)); padding: var(--s4);
  font: 400 var(--text-lg)/1.65 var(--font-sans); white-space: pre-wrap; overflow-wrap: anywhere;
  /* scroll shadows */
  background:
    linear-gradient(var(--surface) 30%, transparent) top / 100% 32px no-repeat local,
    linear-gradient(transparent, var(--surface) 70%) bottom / 100% 32px no-repeat local,
    radial-gradient(farthest-side at 50% 0, rgb(0 0 0 / 0.1), transparent) top / 100% 10px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgb(0 0 0 / 0.1), transparent) bottom / 100% 10px no-repeat scroll;
  background-color: var(--surface);
}
.transcript:focus-visible { outline-offset: -2px; }
.transcript .seg { margin: 0 0 var(--s2); padding-left: 3.5em; text-indent: -3.5em; }
.transcript .ts {
  display: inline-block; width: 3.5em; text-indent: 0;
  color: var(--accent); font: 400 var(--text-sm)/1 var(--mono); font-variant-numeric: tabular-nums;
}

.actions {
  display: flex; flex-direction: column; gap: var(--s2);
  padding-top: var(--s4); border-top: 1px solid var(--line);
}
.actions #copy { width: 100%; }
.downloads { display: flex; gap: var(--s2); }
.downloads .btn { flex: 1 1 0; padding-inline: var(--s3); font-family: var(--mono); letter-spacing: 0.02em; }
.downloads .icon { width: 1.1em; height: 1.1em; }

.improve {
  display: flex; flex-direction: column; align-items: stretch; gap: var(--s3);
  margin-top: var(--s4); padding: var(--s4);
  background: var(--sunken); border-radius: var(--r-md);
}
.improve-copy strong { display: block; font-size: var(--text-lg); font-weight: 650; line-height: 1.3; }
.improve-copy span { display: block; margin-top: var(--s1); font-size: var(--text-sm); color: var(--ink-2); }
.improve-status { display: flex; align-items: center; gap: var(--s2); font-size: var(--text-sm); color: var(--ink); }
.improve .error { margin-top: 0; }
/* the box: field + button, then a slim row with today's free count and the speaker option */
.tool-box-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 var(--s4); margin-top: var(--s2); padding-inline: var(--s1); font-size: 0.8125rem; color: var(--ink-2); }
.tool-box-foot .speakers-note { flex-basis: 100%; text-align: left; padding-bottom: var(--s2); }
.speakers-toggle { display: flex; justify-content: center; }
.tool-box-foot .toggle { font-size: 0.8125rem; }
.speakers-note { margin: 0; line-height: 1.5; }
.tool-terms { max-width: none; margin-top: var(--s2); font-size: 0.8125rem; }
.free-left { margin: 0; }
.free-left:empty { display: none; }
.seg-speaker { display: block; margin-top: var(--s3); font-weight: 650; }
.improve-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); }
/* the free preview: the first minute, fast model next to the accurate one */
.preview { display: grid; gap: var(--s3); flex-basis: 100%; }
.preview-col { padding: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.preview-col strong { display: block; margin-bottom: var(--s1); font-size: var(--text-sm); }
.preview-col p { margin: 0; font-size: var(--text-sm); line-height: 1.55; color: var(--ink); white-space: pre-line; }
@media (min-width: 720px) { .preview { grid-template-columns: 1fr 1fr; } }
.pulse {
  flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.3; } }

/* ---- content ---- */
.content { margin-top: var(--s8); }
.content h2 { font-size: var(--text-2xl); margin: var(--s7) 0 var(--s3); }
.content > h2:first-child { margin-top: 0; }
.content p { max-width: var(--w-text); margin-bottom: var(--s4); font-size: var(--text-lg); line-height: 1.65; hyphens: auto; }

.steps { list-style: none; counter-reset: step; display: grid; gap: var(--s3); margin: var(--s4) 0 0; padding: 0; }
.steps li {
  counter-increment: step; position: relative;
  padding: var(--s4) var(--s4) var(--s4) 60px; background: var(--sunken); border-radius: var(--r-lg);
  line-height: 1.55; color: var(--ink-2); hyphens: auto;
}
.steps li::before {
  content: counter(step); position: absolute; left: var(--s4); top: var(--s4);
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface); color: var(--accent); box-shadow: var(--shadow-1);
  font: 700 1rem/32px var(--font-sans); text-align: center;
}
.steps strong { display: block; margin-bottom: 2px; color: var(--ink); font-weight: 600; }

/* ---- packs: big cards on a full-width band ---- */
.packs {
  width: min(100% - 2 * var(--gutter), 880px); margin: var(--s8) auto 0;
  padding: var(--s7) 0; background: var(--sunken);
  box-shadow: 0 0 0 100vmax var(--sunken); clip-path: inset(0 -100vmax);
}
.packs h2 { font-size: var(--text-2xl); text-align: center; text-wrap: balance; }

.pack-list { display: grid; gap: var(--s3); margin-top: var(--s5); }
.pack {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name arrow" "price arrow";
  align-items: center; column-gap: var(--s4); row-gap: var(--s1);
  min-height: 96px; padding: var(--s4) var(--s5);
  background: var(--surface); color: var(--ink); text-align: left;
  border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.pack:hover { border-color: var(--accent); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.pack:active { transform: none; }
.pack:focus-visible { outline-offset: 3px; }
.pack:disabled { cursor: progress; opacity: 0.7; transform: none; }
.pack-name { grid-area: name; font-weight: 600; line-height: 1.3; hyphens: auto; }
.pack-price {
  grid-area: price; font-size: 1.75rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums; white-space: nowrap;
}
.pack-arrow {
  grid-area: arrow; width: 40px; height: 40px; padding: 10px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
}
/* neutral emphasis only, no claim; same type sizes */
.pack-featured { border: 2px solid var(--accent); padding: calc(var(--s4) - 1px) calc(var(--s5) - 1px); box-shadow: var(--shadow-2); }
.pack-featured .pack-arrow { background: var(--accent); color: var(--on-accent); }

/* free option (pricing page): an outlined card on the band, no accent; a link, not a buy button */
.pack-free {
  display: flex; flex-direction: column; gap: var(--s1);
  padding: var(--s4) var(--s5); color: var(--ink); text-decoration: none;
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  transition: border-color var(--fast) var(--ease);
}
.pack-free:hover { color: var(--ink); border-color: var(--accent); }
.pack-free:focus-visible { outline-offset: 3px; }
.pack-text { margin-top: var(--s1); font-size: 0.9375rem; line-height: 1.45; color: var(--ink-2); hyphens: auto; }
.pack-cta {
  display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; margin-top: var(--s2);
  color: var(--accent); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.pack-cta::after {
  content: ""; flex: none; width: 7px; height: 7px;
  border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg);
}
.pack-free:hover .pack-cta { color: var(--accent-hover); text-decoration-thickness: 2px; }

/* ---- buy dialog ---- */
.buy-dialog {
  width: min(100% - 2 * var(--s4), 480px); max-width: none;
  max-height: calc(100% - 2 * var(--s4)); overflow-y: auto; overscroll-behavior: contain;
  margin: auto; padding: 0;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
}
.buy-dialog::backdrop { background: var(--scrim); }
.buy-dialog[open] { animation: dialog-in 180ms var(--ease); }
.buy-dialog[open]::backdrop { animation: fade-in 180ms var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* In-page messages (static/dialog.js) instead of the browser's alert/confirm/prompt */
.ui-dialog {
  width: min(100% - 2 * var(--s4), 440px); max-width: none; margin: auto; padding: var(--s5);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
}
.ui-dialog::backdrop { background: var(--scrim); }
.ui-dialog[open] { animation: dialog-in 180ms var(--ease); }
.ui-dialog[open]::backdrop { animation: fade-in 180ms var(--ease); }
.ui-dialog-text { margin: 0; white-space: pre-line; line-height: 1.55; }
.ui-dialog-field { width: 100%; margin-top: var(--s3); }
.ui-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); margin-top: var(--s5); }
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-danger:hover { filter: brightness(0.94); }
@keyframes fade-in { from { opacity: 0; } }

.buy-form { padding: var(--s5) var(--s4) var(--s4); }
.buy-form h2 { font-size: var(--text-xl); }
.buy-summary {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s1) var(--s4);
  margin-top: var(--s4); padding: var(--s4);
  background: var(--sunken); border-radius: var(--r-md);
  font-weight: 600; line-height: 1.3;
}
.buy-summary strong {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums; white-space: nowrap;
}
.buy-info { margin-top: var(--s3); font-size: 0.9375rem; line-height: 1.55; color: var(--ink-2); hyphens: auto; }

/* consent: full size and contrast, never de-emphasised */
.consent {
  display: flex; gap: var(--s3); align-items: flex-start;
  margin-top: var(--s4); padding: var(--s4) var(--s3);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  color: var(--ink); font-size: var(--text-md); line-height: 1.55; cursor: pointer; hyphens: auto;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.consent:hover { border-color: var(--accent); }
.consent:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.consent input {
  flex: none; width: 22px; height: 22px; margin: 1px 0 0;
  accent-color: var(--accent); cursor: pointer;
}
.buy-form .error { margin-top: var(--s3); }

.buy-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); margin-top: var(--s5); }
.buy-actions .btn { flex: 1 1 auto; }
/* unticked: flat grey fill, unlike Cancel's outline */
.buy-actions .btn-primary:disabled {
  background: var(--line); color: var(--ink-2); border-color: transparent; opacity: 1; cursor: not-allowed;
}
/* ticked and disabled = the checkout is starting */
.buy-dialog:has(#pack-consent:checked) .btn-primary:disabled {
  background: var(--accent); color: var(--on-accent); opacity: 0.7; cursor: progress;
}
/* not signed in: stacked, guest checkout first and full width; the account is the quieter outline */
.buy-actions.buy-choice { flex-direction: column; flex-wrap: nowrap; }
.buy-actions.buy-choice .btn { flex: none; width: 100%; }
.buy-actions.buy-choice .btn-primary { min-height: 52px; }
/* signed in: who the pack goes to */
#buy-for { margin-top: var(--s4); padding-left: var(--s3); border-left: 3px solid var(--accent); color: var(--ink); overflow-wrap: anywhere; }

/* ---- FAQ ---- */
.faq h2 { margin-bottom: var(--s4); }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  min-height: 56px; padding: var(--s3) 0;
  font-weight: 600; line-height: 1.4; list-style: none; cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
/* plus / minus marker */
.faq summary::after {
  content: ""; flex: none; width: 14px; height: 14px;
  background:
    linear-gradient(var(--ink-2), var(--ink-2)) center / 14px 2px no-repeat,
    linear-gradient(var(--ink-2), var(--ink-2)) center / 2px 14px no-repeat;
}
.faq details[open] summary::after { background: linear-gradient(var(--ink-2), var(--ink-2)) center / 14px 2px no-repeat; }
.faq summary:hover { color: var(--accent); }
.faq details p { margin: 0 0 var(--s4); color: var(--ink-2); font-size: var(--text-md); }

/* ---- related links ---- */
.related ul { list-style: none; display: grid; gap: 0 var(--s5); margin: 0; padding: 0; }
.related li { border-bottom: 1px solid var(--line); }
.related a {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  min-height: 52px; padding: var(--s2) 0; color: var(--ink); text-decoration: none; line-height: 1.4;
}
.related a::after {
  content: ""; flex: none; width: 8px; height: 8px;
  border-top: 2px solid var(--accent); border-right: 2px solid var(--accent); transform: rotate(45deg);
}
.related a:hover { color: var(--accent); }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--line); background: var(--sunken); }
.footer-inner {
  display: grid; gap: var(--s3);
  width: min(100% - 2 * var(--gutter), var(--w-wide)); margin-inline: auto;
  padding: var(--s6) 0 var(--s7);
  font-size: var(--text-sm); line-height: 1.55; color: var(--ink-2);
}
.footer-inner a { color: var(--ink); }
.footer-inner a:hover { color: var(--accent); }
.footer-inner p { max-width: 80ch; }
.lang-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s3); }
.lang-switch a { display: inline-flex; align-items: center; min-height: 44px; }
.lang-switch a[aria-current="page"] { font-weight: 600; text-decoration: none; }
.footer-products { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--s3) var(--s5); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.footer-products ul { list-style: none; margin: 0; padding: 0; }
.footer-products a { display: inline-flex; align-items: center; min-height: 44px; font-size: 0.9375rem; }
.footer-heading { font-weight: 600; margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 var(--s5); font-size: 0.9375rem; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; }

/* ---- small pages (/paid, /withdraw, /removal) ---- */
.small-page .stage { padding-top: var(--s6); }
.small-page .hero { padding-top: 0; text-align: left; }
.small-page h1 { margin-inline: 0; }
.card {
  margin-top: var(--s5); padding: var(--s5) var(--s4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.card > p + p, .card > p + form { margin-top: var(--s4); }
.success-mark {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-bottom: var(--s3);
  border-radius: 50%; background: var(--accent-soft); color: var(--accent);
}
.callout { padding: var(--s4); border-radius: var(--r-md); background: var(--accent-soft); color: var(--ink); }
.link-field {
  width: 100%; min-height: 52px; margin: var(--s4) 0; padding: 0 var(--s3);
  background: var(--sunken); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  font: 500 var(--text-sm) var(--mono);
}
.card .actions { border-top: 0; padding-top: 0; }
.card .actions .btn { width: 100%; }
.note { margin-top: var(--s4); font-size: var(--text-sm); color: var(--ink-2); }
.back { margin-top: var(--s5); font-size: var(--text-sm); }
.back a { display: inline-flex; align-items: center; min-height: 44px; }

.removal-form { display: flex; flex-direction: column; gap: var(--s4); }
.removal-form label { display: flex; flex-direction: column; gap: var(--s2); font-size: var(--text-sm); font-weight: 500; color: var(--ink); }
.removal-form input, .removal-form select, .removal-form textarea {
  width: 100%; min-height: 48px; padding: var(--s2) var(--s3);
  background: var(--surface); color: var(--ink); font: 400 var(--text-md)/1.5 var(--font-sans);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
}
.removal-form textarea { resize: vertical; }
.removal-form .btn { align-self: stretch; }
.form-status:empty { display: none; }
.form-status { padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--sunken); color: var(--ink); font-size: 0.9375rem; }
/* checkboxes / radios inside forms: keep the .consent row, not the stacked text-field look */
.removal-form .consent { flex-direction: row; gap: var(--s3); margin-top: 0; font-size: var(--text-md); font-weight: 400; }
.removal-form .consent input { width: 22px; height: 22px; min-height: 0; padding: 0; }
.removal-form .consent + .consent { margin-top: calc(var(--s2) - var(--s4)); }
.removal-form .note { margin-top: 0; }
.removal-form label + .note { margin-top: calc(-1 * var(--s2)); }
.removal-form .link-field { margin: 0; background: var(--sunken); font: 500 var(--text-sm) var(--mono); }

/* ---- sign-in and account pages ---- */
.card h2 { font-size: var(--text-xl); line-height: 1.3; letter-spacing: -0.01em; }
.card > h2 + * { margin-top: var(--s3); }
.card > h2 + .note { margin-top: var(--s2); }
.card > * + .actions, .card > * + .btn, .card > * + .acc-list { margin-top: var(--s4); }
.card > .btn { width: 100%; }
.card > p > a:only-child { display: inline-flex; align-items: center; min-height: 44px; }
.card > p:has(> a:only-child) + p:has(> a:only-child) { margin-top: 0; }
#acc-balance { font-size: var(--text-lg); font-weight: 600; }
.acc-list { margin-bottom: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.acc-list li {
  padding: var(--s3) var(--s4); font-size: 0.9375rem; line-height: 1.5;
  font-variant-numeric: tabular-nums lining-nums; overflow-wrap: anywhere;
}
.acc-list li + li { border-top: 1px solid var(--line); }
.acc-list li:nth-child(even) { background: var(--sunken); }
/* delete: a thin red edge and a red-outlined button, no red fill */
.card-danger { border-color: var(--danger-line); box-shadow: inset 0 3px 0 var(--danger), var(--shadow-1); }
.card-danger .btn-secondary { color: var(--danger); border-color: var(--danger); }
.card-danger .btn-secondary:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.card-danger .btn:disabled { cursor: default; }

/* ---- wider screens ---- */
@media (min-width: 640px) {
  :root { --gutter: 32px; }

  /* one box: the button sits inside the field's right end; a slim row underneath */
  .tool-box {
    padding: 6px;
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: 30px;
    transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
  }
  .tool-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-2); }
  .panel { flex-direction: row; gap: 0; }
  .tool-box-foot { margin-top: 6px; padding: var(--s1) var(--s4); border-top: 1px solid var(--line); }
  .panel .field,
  .panel .field:focus-within {
    flex: 1; min-width: 0; min-height: 52px; padding-left: var(--s4);
    border: 0; background: none; box-shadow: none;
  }
  .panel .btn { width: auto; flex: none; min-height: 52px; padding-inline: var(--s6); border-radius: var(--r-pill); }

  .trust-list { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2) var(--s4); width: auto; font-size: var(--text-sm); }

  .result { padding: var(--s5); }
  .transcript { margin-inline: calc(-1 * var(--s5)); padding-inline: var(--s5); }
  .actions { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .actions #copy { width: auto; }
  .downloads .btn { flex: none; }
  .improve { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .improve-copy { flex: 1 1 280px; }
  .improve-status, .improve .error { flex-basis: 100%; }

  .steps { grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
  .steps li { padding: 64px var(--s4) var(--s4); }

  .pack-list { grid-template-columns: repeat(3, 1fr); gap: var(--s4); align-items: stretch; }
  .pack {
    grid-template-columns: 1fr auto; grid-template-areas: "name name" "price arrow";
    align-content: space-between; row-gap: var(--s6); min-height: 176px; padding: var(--s5);
  }
  .pack-featured { padding: calc(var(--s5) - 1px); }
  .pack-price { font-size: clamp(1.5rem, 0.9rem + 1.6vw, 2.125rem); }
  .with-free { grid-template-columns: repeat(2, 1fr); }
  .with-free .pack { min-height: 152px; }
  .pack-free { padding: var(--s5); }
  .pack-free .pack-cta { margin-top: auto; padding-top: var(--s3); }

  .buy-form { padding: var(--s6); }
  .buy-form h2 { font-size: var(--text-2xl); }
  .consent { padding: var(--s4); }
  .buy-actions .btn { flex: 0 1 auto; }

  .related ul { grid-template-columns: 1fr 1fr; }
  .card { padding: var(--s6); }
  .card .actions .btn, .card > .btn { width: auto; }
  .removal-form .btn { align-self: flex-start; }
}

@media (min-width: 900px) {
  .hero { padding-top: var(--s6); margin-bottom: var(--s7); }

  /* result: transcript left with Copy/TXT/SRT/VTT right under it; options in a side column */
  .stage > .result {
    --w-result: min(960px, 100vw - 64px);
    width: var(--w-result); margin-inline: calc((100% - var(--w-result)) / 2);
    display: grid; grid-template-columns: minmax(0, 1fr) 16rem; column-gap: var(--s5);
    grid-template-areas: "head head" "text bar" "text improve" "text ." "actions .";
    grid-template-rows: auto auto auto 1fr auto; align-items: start;
  }
  .result .result-head { grid-area: head; }
  .result .result-toolbar { grid-area: bar; justify-content: flex-start; margin-top: var(--s3); border-bottom: 0; }
  .result .transcript {
    grid-area: text; max-height: 70vh; margin: var(--s4) 0 0; padding: var(--s4) var(--s5);
    border: 1px solid var(--line); border-radius: var(--r-md);
  }
  .result .actions { grid-area: actions; flex-direction: row; flex-wrap: wrap; align-items: center; padding-top: var(--s3); border-top: 0; }
  .result .actions #copy { width: auto; }
  .result .improve { grid-area: improve; flex-direction: column; align-items: stretch; }
  .result .improve-copy { flex: none; }
}

@media (min-width: 1000px) {
  .packs:has(.with-free) { width: min(100% - 2 * var(--gutter), var(--w-wide)); }
  .with-free { grid-template-columns: repeat(4, 1fr); }
  .with-free .pack { min-height: 196px; }
  .with-free .pack-price { font-size: 1.75rem; }
}

/* ---- motion preferences ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .buy-dialog[open], .buy-dialog::backdrop { animation: none !important; }
  .ui-dialog[open], .ui-dialog::backdrop { animation: none !important; }
  .pack:hover { transform: none; }
  .progress-bar { width: 100%; opacity: 0.5; }
}
