:root {
  /* Brand: green (logo kit v3, 2026-11-20; was Slate & Sky, ankipilot-logo/kit). Green carries buttons and the logo; the mint accent is used (the logo's dots, focus, progress, links in a darker shade).
     Sky on white is only 2.8:1, so it is never used for body text or white-on-Sky buttons. */
  --brand-slate: #2b3a4a;
  --brand-sky: #1fa38d;
  --brand-mist: #dcf2ee;

  /* Neutrals: cool slate greys (was warm paper & ink) */
  --paper: #f6f8fa;
  --surface: #ffffff;
  --ink-950: #17222d;
  --ink-800: #2b3a4a;
  --ink-600: #4a5a6a;
  --ink-500: #5d6b79;
  --ink-400: #9aa6b2; /* decorative only: borders/icons/carets. Never text. */
  --line: #e3e8ee;
  --line-strong: #cdd5de;

  /* Accent ramp built from Sky. 600/700 are the darker shades used for link and active text. */
  --accent-50: #eef8f6;
  --accent-100: #dcf2ee;
  --accent-300: #9bd8cc;
  --accent-400: #5fc0ae;
  --accent-500: #1fa38d;
  --accent-600: #0d7a6b;
  --accent-700: #0a5f53;
  --accent-900: #063b34;

  /* Filled buttons: Slate with white text in light mode, Sky with dark text in dark mode. */
  --button-bg: #0d7a6b;
  --button-bg-hover: #0b6559;
  --button-text: #ffffff;

  /* Color: semantic status */
  --success-text: #166534;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --error-text: #991b1b;
  --error-bg: #fef2f2;
  --error-border: #fecaca;

  --radius-control: 8px;
  --radius-surface: 12px;
  --radius-tag: 6px;

  --shadow-flashcard: 0 1px 2px rgba(23, 34, 45, .06);
  --shadow-overlay: 0 24px 60px -10px rgba(23, 34, 45, .35);
  --shadow-float: 0 8px 24px rgba(23, 34, 45, .18);

  /* Spacing: 8px scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;

  /* Type scale */
  --text-2xs: 12px;
  --text-xs: 13px;
  --text-sm: 14px;
  --text-base: 15px;
  --text-md: 16px;
  --text-lg: 20px;
  --text-xl: 26px;
  --text-2xl: 34px;

  /* Two voices: a geometric display face for headings (echoes the monoline wordmark) and Inter
     for functional UI. The token keeps its old name (--font-serif) so existing rules still work. */
  --font-sans: 'Inter', Arial, sans-serif;
  --font-serif: 'Outfit', 'Inter', Arial, sans-serif;

  --font-normal: 400;
  --font-semibold: 600;
  --font-bold: 700;
  --font-black: 800;

  --focus-ring: 0 0 0 3px rgba(13, 122, 107, .6);
  --accent-glow: rgba(13, 122, 107, .22);

  color-scheme: light;
}

/* Dark mode: OS preference (unless the toggle chose light), or the toggle's explicit dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111920;
    --surface: #18232d;
    --ink-950: #eef3f7;
    --ink-800: #d3dde6;
    --ink-600: #a6b4c1;
    --ink-500: #8f9eac;
    --ink-400: #4c5b69;
    --line: #24313c;
    --line-strong: #334350;

    --accent-50: #0f2a26;
    --accent-100: #14352f;
    --accent-300: #2f8575;
    --accent-400: #3cc2ad;
    --accent-500: #3cc2ad;
    --accent-600: #5ad1be;
    --accent-700: #8fe3d4;
    --accent-900: #06201b;

    --button-bg: #3cc2ad;
    --button-bg-hover: #5ad1be;
    --button-text: #06201b;

    --success-text: #4ade80;
    --success-bg: #0f2318;
    --success-border: #1f4d33;
    --error-text: #f87171;
    --error-bg: #2a1414;
    --error-border: #5c2626;

    --shadow-flashcard: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-overlay: 0 24px 60px -10px rgba(0, 0, 0, .6);
    --shadow-float: 0 8px 24px rgba(0, 0, 0, .45);
    --focus-ring: 0 0 0 3px rgba(90, 209, 190, .45);
    --accent-glow: rgba(60, 194, 173, .3);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #111920;
  --surface: #18232d;
  --ink-950: #eef3f7;
  --ink-800: #d3dde6;
  --ink-600: #a6b4c1;
  --ink-500: #8f9eac;
  --ink-400: #4c5b69;
  --line: #24313c;
  --line-strong: #334350;

  --accent-50: #0f2a26;
  --accent-100: #14352f;
  --accent-300: #2f8575;
  --accent-400: #3cc2ad;
  --accent-500: #3cc2ad;
  --accent-600: #5ad1be;
  --accent-700: #8fe3d4;
  --accent-900: #06201b;

  --button-bg: #3cc2ad;
  --button-bg-hover: #5ad1be;
  --button-text: #06201b;

  --success-text: #4ade80;
  --success-bg: #0f2318;
  --success-border: #1f4d33;
  --error-text: #f87171;
  --error-bg: #2a1414;
  --error-border: #5c2626;

  --shadow-flashcard: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-overlay: 0 24px 60px -10px rgba(0, 0, 0, .6);
  --shadow-float: 0 8px 24px rgba(0, 0, 0, .45);
  --focus-ring: 0 0 0 3px rgba(90, 209, 190, .45);
  --accent-glow: rgba(60, 194, 173, .3);

  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink-800);
  min-height: 100vh;
}

/* Consistent, visible keyboard focus on every interactive element */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.page-shell { width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 20px 96px; }

/* Site header: wordmark (home link) on the left, page links, then Account / Log in + Sign up and
   the theme toggle on the right. Wraps to two rows on narrow screens (links move under the logo). */
.site-header { margin-bottom: var(--space-8); border-bottom: 1px solid var(--line); }
.site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-6); min-height: 64px; padding-bottom: var(--space-2); }
.site-logo { display: inline-flex; align-items: center; color: var(--ink-950); text-decoration: none; border-radius: var(--radius-control); padding: 4px 2px; margin-right: var(--space-2); }
.site-logo-svg { display: block; height: 34px; width: auto; }
/* Wordmark colour set directly (not only through currentColor) so a browser that mis-resolves it still draws it
   readable: slate on light, near-white on dark. The two Sky dots keep their own fill. */
.site-logo-svg > g { fill: var(--ink-950, #17222d); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .site-logo-svg > g { fill: #eef3f7; } }
:root[data-theme="dark"] .site-logo-svg > g { fill: #eef3f7; }
.site-nav-links { display: flex; align-items: center; gap: var(--space-5); }
.site-nav-end { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.site-nav-link,
.site-nav-account {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--ink-600);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.site-nav-link:hover, .site-nav-account:hover { color: var(--ink-950); }
.site-nav-link.is-active, .site-nav-account.is-active { color: var(--ink-950); border-bottom-color: var(--brand-sky); }
.site-nav-account {
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  min-height: 40px;
  background: var(--surface);
}
.site-nav-account.is-active { border-color: var(--brand-sky); }
.site-nav-cta {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px;
  border-radius: 999px; background: var(--button-bg); color: var(--button-text);
  font-size: var(--text-sm); font-weight: var(--font-bold); text-decoration: none;
}
.site-nav-cta:hover { background: var(--button-bg-hover); }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-600);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink-950); border-color: var(--brand-sky); }

.theme-icon-sun { display: none; }
.theme-icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-icon-moon { display: none; }
}
:root[data-theme="dark"] .theme-icon-sun { display: block; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }

@media (max-width: 640px) {
  .site-nav { gap: 0 var(--space-4); padding-top: var(--space-2); }
  .site-nav-links { order: 3; width: 100%; gap: var(--space-4); overflow-x: auto; }
  .site-nav-end { gap: var(--space-2); }
  .site-logo-svg { height: 26px; }
  .site-nav-account span { display: none; }       /* icon only on phones; the link keeps its accessible name */
  .site-nav-account { padding: 0 10px; }
}

.brand { margin-bottom: 40px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.brand h1 { margin: 0; font-family: var(--font-serif); font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.015em; color: var(--ink-950); }
.brand p { margin: 5px 0 0; font-size: var(--text-md); color: var(--ink-500); }

.progress-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--ink-400);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.progress-label span.is-current { color: var(--accent-600); }
.progress-label span.is-done { color: var(--ink-600); }
.progress-sep { color: var(--line-strong); }
.progress-track { height: 3px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 50%; background: var(--accent-500); transition: width .3s ease; }
.progress-fill.is-full { width: 100%; }

.panel { background: transparent; border: none; box-shadow: none; padding: 0; }

.account-plan-row { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: var(--space-6); }
.account-plan-name { margin: 2px 0 0; font-family: var(--font-serif); font-size: var(--text-xl); font-weight: 600; color: var(--ink-950); }
.account-usage { margin-bottom: var(--space-6); }
.account-usage-track { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.account-usage-fill { height: 100%; background: var(--accent-500); border-radius: 999px; transition: width .3s ease; }
.account-usage-fill.is-full { background: var(--ink-600); }

.section { margin-bottom: 36px; padding-bottom: 36px; border-bottom: 1px solid var(--line); }
.section:last-of-type { border-bottom: none; margin-bottom: 28px; padding-bottom: 0; }
/* Scoped, not a global .section change: the gap here read as too large
   specifically between the deck/type/count fields and "Study material" --
   other section boundaries on this page are unaffected. */
.section--tight { margin-bottom: 20px; padding-bottom: 20px; }
.section-title { font-family: var(--font-serif); font-size: var(--text-md); font-weight: 600; color: var(--ink-950); margin: 0 0 16px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

label { display: block; font-size: var(--text-sm); font-weight: var(--font-semibold); margin-bottom: 8px; color: var(--ink-600); }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  padding: 12px 13px;
  font-size: var(--text-base);
  font-family: var(--font-sans);
  background: var(--surface);
  color: var(--ink-950);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent-500);
  box-shadow: var(--focus-ring);
}
textarea { resize: vertical; min-height: 180px; line-height: 1.6; }

.select-wrap { position: relative; }
.select-wrap select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink-400);
  border-bottom: 2px solid var(--ink-400);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

/* Deliberately a touch shorter than the plain inputs/selects beside it in
   the same grid row -- two extra button segments already give it more
   visual mass than a single select, so matching or exceeding their height
   made it read as the dominant control in the row rather than a peer. */
.stepper { display: flex; align-items: stretch; min-height: 38px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); overflow: hidden; background: var(--surface); }
.stepper input {
  border: none;
  border-left: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
  border-radius: 0;
  text-align: center;
  padding: 8px 6px;
  -moz-appearance: textfield;
}
.stepper input:focus { box-shadow: none; }
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.stepper-btn {
  flex: 0 0 36px;
  width: 36px;
  border: none;
  background: transparent;
  color: var(--accent-600);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.stepper-btn:hover { background: var(--accent-50); }
.stepper-btn:disabled { cursor: not-allowed; opacity: .35; }
.stepper-btn:disabled:hover { background: transparent; }
.stepper.is-disabled { opacity: .55; }

.count-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.auto-count-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-2xs);
  color: var(--ink-500);
  cursor: pointer;
  white-space: nowrap;
}
.auto-count-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-600);
  cursor: pointer;
}

.field-hint { margin: 6px 0 0; font-size: var(--text-2xs); color: var(--ink-500); }
.field-hint a { color: var(--accent-600); font-weight: var(--font-semibold); text-decoration: underline; }
.field-hint a:hover { color: var(--accent-700); }
.field-hint.is-hidden { display: none; }
/* The sign-up detail boxes ("Tell us what", "Where?") are .field.is-hidden until their option is chosen; without this rule they were always visible (found 2026-11-19). */
.field.is-hidden { display: none; }

/* Connection-state indicator: a small status dot in front of the existing
   .field-hint copy (text unchanged) so "connected" / "still checking" /
   "needs attention" read as a system state at a glance instead of only
   through the sentence itself. Deliberately reuses the same success/error
   tokens already contrast-checked for this palette elsewhere -- no new
   colors introduced. */
.field-hint[data-status] { display: flex; align-items: flex-start; gap: 7px; }
.field-hint[data-status]::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--ink-400);
}
.field-hint[data-status="connecting"]::before { background: var(--accent-400); }
.field-hint[data-status="action"]::before { background: var(--accent-500); }
.field-hint[data-status="success"]::before { background: var(--success-text); }
.field-hint[data-status="success"] { color: var(--success-text); }
.field-hint[data-status="error"]::before { background: var(--error-text); }

.connect-button { margin: 8px 0 0; padding: 7px 14px; border: 1px solid var(--accent-600); border-radius: var(--radius-control); background: transparent; color: var(--accent-600); font-size: var(--text-2xs); font-weight: var(--font-bold); cursor: pointer; }
.connect-button:hover { background: var(--button-bg); color: var(--button-text); }
.connect-button:disabled { cursor: not-allowed; opacity: .6; }
.connect-button.is-hidden { display: none; }

.field-error { margin: -8px 0 16px; font-size: var(--text-xs); color: var(--error-text); }
#no-cards-error, #send-anki-error { margin: 16px 0 0; }
.field-error.is-hidden { display: none; }

.empty-state { padding: 32px 0; text-align: center; }
.empty-state-title { margin: 0 0 8px; font-family: var(--font-serif); font-size: var(--text-lg); font-weight: 600; color: var(--ink-950); }
.empty-state-body { margin: 0; font-size: var(--text-sm); color: var(--ink-500); max-width: 46ch; margin-left: auto; margin-right: auto; line-height: 1.6; }

.tabs {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  /* Five source tabs no longer reliably fit one row under ~420px --
     scroll horizontally instead of wrapping (which would break the
     underline-indicator layout) or shrinking text to illegibility. */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: flex-end;
  min-height: 44px;
  border: none;
  background: transparent;
  padding: 10px 2px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--ink-500);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.tab.is-active { color: var(--accent-600); border-bottom-color: var(--accent-500); }

.input-card { border: none; border-radius: 0; padding: 0; background: transparent; }
.input-card.is-hidden { display: none; }
.input-card h3 { margin: 0 0 8px; font-size: var(--text-md); color: var(--ink-950); }
.input-card p { margin: 0 0 14px; color: var(--ink-500); font-size: var(--text-sm); line-height: 1.5; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  padding: 32px 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-surface);
  background: var(--paper);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover { border-color: var(--accent-400); background: var(--accent-50); }
.dropzone.is-dragover { border-color: var(--accent-600); background: var(--accent-100); border-style: solid; }
.dropzone.has-file { border-style: solid; border-color: var(--accent-500); background: var(--accent-50); }
.dropzone-icon { color: var(--accent-500); }
.dropzone-title { font-size: var(--text-base); font-weight: var(--font-bold); color: var(--ink-950); }
.dropzone-sub { font-size: var(--text-xs); color: var(--ink-500); }
.dropzone-filename { margin-top: 6px; font-size: var(--text-xs); font-weight: var(--font-bold); color: var(--accent-700); word-break: break-all; }
.dropzone-filename:empty { display: none; }

/* Unified upload target: one drop zone for PDF / PPTX / images, with the
   accepted formats shown inside it so no type has to be picked first. */
.dropzone--lg { padding: 40px 20px; gap: 8px; }
.dropzone-formats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.fmt-pill {
  font-size: var(--text-2xs);
  font-weight: var(--font-semibold);
  letter-spacing: .02em;
  color: var(--ink-600);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-tag);
  padding: 3px 8px;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* The file input is visually hidden but still keyboard-focusable via its
   <label>; show the focus ring on the visible dropzone instead. */
.dropzone:has(+ .file-input:focus-visible) { box-shadow: var(--focus-ring); }

.primary-button {
  text-decoration: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-control);
  padding: 16px 20px;
  font-size: var(--text-md);
  font-weight: var(--font-bold);
  cursor: pointer;
  background: var(--button-bg);
  color: var(--button-text);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.primary-button:hover { background: var(--button-bg-hover); transform: translateY(-1px); box-shadow: 0 10px 24px var(--accent-glow); }
.primary-button:disabled { cursor: not-allowed; opacity: .7; transform: none; }
.primary-button .arrow { transition: transform .15s ease; }
.primary-button:hover .arrow { transform: translateX(3px); }

.preview-header { margin-bottom: 22px; }
.preview-header h2 { margin: 0; font-family: var(--font-serif); font-weight: 600; font-size: var(--text-xl); color: var(--ink-950); }
.preview-header p { margin: 8px 0 0; color: var(--ink-500); }

.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.meta-pill { padding: 6px 10px; background: var(--accent-50); border: 1px solid var(--accent-100); border-radius: var(--radius-tag); color: var(--accent-700); font-size: var(--text-xs); font-weight: var(--font-semibold); }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.flashcard {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius-surface);
  padding: 20px;
  box-shadow: var(--shadow-flashcard);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.flashcard:focus-within { border-color: var(--accent-500); box-shadow: 0 0 0 3px var(--accent-100); }
.flashcard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.flashcard-number { display: inline-block; padding: 5px 9px; background: var(--accent-50); color: var(--accent-700); border-radius: var(--radius-tag); font-size: var(--text-2xs); font-weight: var(--font-bold); }
.card-delete-btn { border: none; background: none; padding: 4px 6px; margin: -4px -6px; color: var(--ink-500); font-size: var(--text-2xs); font-weight: var(--font-semibold); cursor: pointer; border-radius: var(--radius-tag); }
.card-delete-btn:hover { color: var(--error-text); background: var(--error-bg); }
.field-group { margin-bottom: 16px; }
.field-group:last-child { margin-bottom: 0; }
.flashcard textarea { min-height: 95px; background: var(--paper); }

.button-row { display: flex; gap: 12px; margin-top: 26px; }
.send-button { flex: 1; border: none; border-radius: var(--radius-control); padding: 14px 18px; font-size: var(--text-base); font-weight: var(--font-bold); cursor: pointer; color: var(--button-text); background: var(--button-bg); }
.send-button:hover { background: var(--button-bg-hover); }
.send-button:disabled { cursor: not-allowed; opacity: .7; }
.send-button.is-hidden { display: none; }
/* Deliberately quieter than .download-button: this is the "leave without
   finishing" action, not an in-flow completion step like Download/Send --
   a visible border made it read as equally weighted, which blurred the
   actual hierarchy of the three actions in this row. */
.back-button { display: flex; align-items: center; justify-content: center; padding: 14px 20px; border: 1px solid transparent; border-radius: var(--radius-control); text-decoration: none; color: var(--ink-500); font-size: var(--text-base); font-weight: var(--font-bold); background: transparent; cursor: pointer; }
.back-button:hover { background: var(--paper); border-color: var(--line); color: var(--ink-600); }
.back-button[aria-disabled="true"] { cursor: not-allowed; opacity: .5; pointer-events: none; }

.download-button { display: flex; align-items: center; justify-content: center; padding: 14px 20px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); color: var(--ink-600); font-size: var(--text-base); font-weight: var(--font-bold); background: var(--surface); cursor: pointer; white-space: nowrap; }
.download-button:hover { background: var(--paper); }
.download-button:disabled { cursor: not-allowed; opacity: .5; }

/* Distinct from .back-button: a meaningful in-flow action (stay on this
   screen, generate more), not a neutral "leave" action -- so it gets an
   accent-tinted treatment instead of a plain outline. */
.accent-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border: 1px solid var(--accent-300);
  border-radius: var(--radius-control);
  color: var(--accent-700);
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  background: var(--accent-50);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.accent-button:hover { background: var(--accent-100); border-color: var(--accent-500); }
.accent-button:disabled { cursor: not-allowed; opacity: .7; }

.message { margin-top: 20px; border-radius: var(--radius-control); padding: 14px 16px; font-size: var(--text-sm); line-height: 1.5; display: flex; align-items: flex-start; gap: 10px; }
.message.is-hidden { display: none; }
.message::before { flex: 0 0 auto; font-weight: var(--font-black); line-height: 1.4; }
.success { color: var(--success-text); background: var(--success-bg); border: 1px solid var(--success-border); }
.success::before { content: "\2713"; }
.error { color: var(--error-text); background: var(--error-bg); border: 1px solid var(--error-border); }
.error::before { content: "!"; }

.trust-line { margin: 22px 0 0; text-align: center; font-size: var(--text-2xs); color: var(--ink-500); }

.loading-overlay { display: none; position: fixed; inset: 0; z-index: 9999; background: rgba(28, 25, 23, .5); backdrop-filter: blur(3px); align-items: center; justify-content: center; }
.loading-overlay.active { display: flex; }
.loading-box { width: calc(100% - 40px); max-width: 420px; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-surface); text-align: center; box-shadow: var(--shadow-overlay); }
.spinner { width: 44px; height: 44px; margin: 0 auto 20px; border: 4px solid var(--line); border-top-color: var(--accent-600); border-radius: 50%; animation: spin .8s linear infinite; }
.loading-title { margin: 0; font-family: var(--font-serif); font-size: var(--text-lg); font-weight: 600; color: var(--ink-950); }
.loading-status { margin: 10px 0 0; font-size: var(--text-sm); color: var(--ink-500); min-height: 21px; }
.loading-dots { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 16px; }
.loading-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); transition: background .2s ease, transform .2s ease; }
.loading-dot.is-active { background: var(--accent-600); transform: scale(1.2); }
.loading-note { margin: 14px 0 0; font-size: var(--text-2xs); color: var(--ink-500); }
.loading-note.is-hidden { display: none; }

/* Generation job page (/generate?job=...). Reuses .spinner, .loading-status and
   .loading-note from the overlay above, but as in-page content, not a modal. */
.job-panel { text-align: center; max-width: 520px; margin-left: auto; margin-right: auto; padding-top: var(--space-4); }
/* The page-level rule above `.page-generate .panel .section` sets margin: 0 and ties with the line above and comes later in the file, which left this box 70px left of centre. */
.page-generate .panel .section.job-panel { margin-left: auto; margin-right: auto; }
.job-panel .is-hidden { display: none; }
.job-elapsed { margin: var(--space-1) 0 0; font-size: var(--text-xs); color: var(--ink-500); font-variant-numeric: tabular-nums; }
.job-note { margin: 0 0 var(--space-5); padding: var(--space-3) var(--space-4); font-size: var(--text-sm); color: var(--ink-600); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-surface); }
.job-failed-title { margin: 0; font-family: var(--font-serif); font-size: var(--text-lg); font-weight: 600; color: var(--ink-950); }
.job-failed-message { margin: var(--space-3) 0 0; font-size: var(--text-sm); color: var(--ink-600); }
.job-failed-actions { margin: var(--space-5) 0 0; }
.job-retry { display: inline-block; text-decoration: none; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .page-shell { padding-top: 12px; }
  .grid { grid-template-columns: 1fr; }
  .button-row { flex-direction: column; }
  .back-button, .send-button, .download-button { width: 100%; }
  .brand h1 { font-size: var(--text-xl); }
    .cards-grid { grid-template-columns: 1fr; }
  .tabs { gap: 16px; }
  .site-nav { gap: var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
  /* Disable decorative motion, but not the loading spinner -- that's
     essential status feedback, not decoration, and freezing it would
     look broken rather than accessible. */
  *:not(.spinner), *:not(.spinner)::before, *:not(.spinner)::after {
    transition-duration: 0.001ms !important;
  }
  .primary-button:hover { transform: none; }
  .primary-button:hover .arrow { transform: none; }
}

/* Feedback button (every page). Was a faint grey pill that disappeared into the dark background;
   now a filled Slate/Sky pill with an icon, large enough to notice without competing with the page's CTA. */
.feedback-toggle {
  position: fixed; bottom: 20px; right: 20px; z-index: 50;
  min-height: 48px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: none; border-radius: 999px;
  background: var(--button-bg); color: var(--button-text);
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--font-bold);
  cursor: pointer; box-shadow: var(--shadow-float);
}
.feedback-toggle:hover { background: var(--button-bg-hover); }
@media (max-width: 640px) {
  .feedback-toggle { bottom: 14px; right: 14px; min-height: 44px; padding: 10px 14px; }
}

.feedback-panel {
  position: fixed; bottom: 80px; right: 20px; z-index: 50; width: min(320px, calc(100vw - 40px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-surface);
  box-shadow: var(--shadow-overlay); padding: 20px;
}
.feedback-panel.is-hidden { display: none; }
.feedback-panel h3 { margin: 0 0 14px; font-family: var(--font-serif); font-size: var(--text-md); color: var(--ink-950); }
.feedback-panel label { font-size: var(--text-xs); margin-bottom: 4px; }
.feedback-panel select { margin-bottom: 12px; }
.feedback-panel textarea { min-height: 80px; margin-bottom: 12px; resize: vertical; }
.feedback-close {
  position: absolute; top: 12px; right: 14px; border: none; background: none;
  font-size: 20px; line-height: 1; color: var(--ink-500); cursor: pointer;
}
.feedback-submit {
  width: 100%; padding: 10px; border: none; border-radius: var(--radius-control);
  background: var(--button-bg); color: var(--button-text); font-weight: var(--font-bold); cursor: pointer;
}
.feedback-submit:hover { background: var(--button-bg-hover); }
.feedback-submit:disabled { opacity: .6; cursor: not-allowed; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Keyboard-only shortcut past the nav. Off-screen until focused. */
.skip-link {
  position: absolute; left: var(--space-4); top: -48px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--button-bg); color: var(--button-text);
  font-size: var(--text-sm); font-weight: var(--font-semibold);
  text-decoration: none; border-radius: var(--radius-control);
  transition: top .15s ease;
}
.skip-link:focus { top: var(--space-4); outline: none; box-shadow: var(--focus-ring); }

/* Site footer -- internal links + affiliation disclaimer */
.site-footer {
  margin-top: var(--space-9);
  padding-top: var(--space-6);
  border-top: 1px solid var(--line);
}
.site-footer-links {
  display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-4);
}
.site-footer-links a {
  font-size: var(--text-sm); font-weight: var(--font-semibold);
  color: var(--ink-500); text-decoration: none;
}
.site-footer-links a:hover { color: var(--accent-600); text-decoration: underline; }
.site-footer-note { margin: 0; font-size: var(--text-xs); color: var(--ink-500); }

/* Long-form legal/reference pages (Privacy, Terms) */
.prose h2 {
  font-family: var(--font-serif); font-size: var(--text-lg); font-weight: var(--font-semibold);
  color: var(--ink-950); margin: var(--space-7) 0 var(--space-3);
}
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { font-size: var(--text-sm); line-height: 1.65; color: var(--ink-600); }
.prose ul { margin: var(--space-2) 0; padding-left: var(--space-6); }
.prose li { margin-bottom: var(--space-2); }
.prose a { color: var(--accent-600); text-decoration: underline; }
.prose .review-note {
  border-left: 3px solid var(--accent-300);
  background: var(--accent-50);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0;
  font-size: var(--text-xs); color: var(--ink-600);
}
.doc-meta { font-size: var(--text-xs); color: var(--ink-500); margin-top: 0; }

/* ============================================================
   Generate page redesign (2026-08-28)
   Scoped entirely to <body class="page-generate"> -- no other page is
   affected. Ankify-reference-informed: the working area is one contained
   surface module (segmented mode switch -> upload box -> settings row ->
   CTA), sitting in generous outer whitespace, with the internal
   divider-lines removed and spacing tightened. Typography and colour are
   now follow the Slate & Sky brand (2026-11-08 revamp).
   ============================================================ */

.page-generate .page-shell { max-width: 760px; }

/* Hero: centered eyebrow -> headline -> sub, no divider line under it
   (the module's own border provides separation). */
.page-generate .brand {
  margin-bottom: 30px;
  padding-bottom: 0;
  border-bottom: none;
  text-align: center;
}
.page-generate .brand h1 {
  font-size: clamp(1.85rem, 5vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.page-generate .brand-sub {
  max-width: 46ch;
  margin: 12px auto 0;
  font-size: var(--text-md);
  color: var(--ink-500);
  line-height: 1.55;
}
.page-generate .progress { max-width: 400px; margin: 24px auto 0; }
.page-generate .progress-label { justify-content: center; }

/* The module: one raised surface, one border, even internal spacing. */
.page-generate .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(18px, 4vw, 30px);
  box-shadow: var(--shadow-flashcard);
}
/* Neutralise the divider-line section wrappers inside the module. */
.page-generate .panel .section,
.page-generate .panel .section--tight {
  margin: 0;
  padding: 0;
  border: none;
}
.page-generate .panel .section-title {
  font-family: var(--font-sans);
  font-size: var(--text-2xs);
  font-weight: var(--font-bold);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin: 0 0 10px;
}

/* Segmented mode switch -- reskins the .tabs/.tab markup (JS untouched). */
.page-generate .tabs {
  gap: 4px;
  margin: 0 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  overflow: visible;
}
.page-generate .tab {
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink-500);
  white-space: nowrap;
}
.page-generate .tab svg { width: 15px; height: 15px; flex: 0 0 auto; }
.page-generate .tab:hover { color: var(--ink-800); }
.page-generate .tab.is-active {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-950);
  box-shadow: var(--shadow-flashcard);
}

/* Upload box -- the anchor of the module. */
.page-generate .input-card p { font-size: var(--text-sm); color: var(--ink-500); margin: 0 0 12px; line-height: 1.5; }
.page-generate .dropzone--lg {
  min-height: 236px;
  padding: 44px 24px;
  gap: 12px;
  border-width: 2px;
  border-radius: 13px;
}
.page-generate .dropzone-title { font-size: var(--text-md); }
.page-generate #panel-notes textarea { min-height: 200px; }

/* Settings row -- compact, below the source, small overline labels. */
.page-generate .gen-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  align-items: start;
  margin-top: 22px;
}
.page-generate .gen-controls .field { margin: 0; }
/* Deck name is free text and only appears when "Create a deck" is chosen --
   give it its own full-width row rather than squeezing it between selects. */
.page-generate .gen-controls #new-deck-field { grid-column: 1 / -1; }
.page-generate .gen-controls label {
  font-size: var(--text-2xs);
  font-weight: var(--font-bold);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 7px;
}
.page-generate .gen-controls select,
.page-generate .gen-controls input[type="text"] { min-height: 44px; }
.page-generate .gen-controls .stepper { min-height: 44px; }
.page-generate .gen-controls .count-row { gap: 10px; }

/* CTA -- calmer than the global treatment: no lift, no glow. */
.page-generate .primary-button {
  margin-top: 24px;
  padding: 15px 20px;
  border-radius: 11px;
  box-shadow: none;
}
.page-generate .primary-button:hover {
  transform: none;
  box-shadow: none;
  background: var(--button-bg-hover);
}

/* Preview state on the same module: keep flashcards legible on the
   surface panel by dropping them to the page ground colour. */
.page-generate .panel .flashcard { background: var(--paper); }
.page-generate .panel .flashcard textarea { background: var(--surface); }
.page-generate .preview-header { margin-bottom: 20px; }
.page-generate .trust-line { margin-top: 24px; }

/* Loading overlay: match the module's rounding. */
.page-generate .loading-box { border-radius: 16px; }

@media (max-width: 620px) {
  .page-generate .gen-controls { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .page-generate .tab svg { display: none; }
  .page-generate .tab { font-size: var(--text-xs); padding: 8px 6px; gap: 0; }
}

/* ============================================================
   2026-11-08 revamp additions: secondary/danger buttons and the
   "Are you sure?" log-out dialog (Account page) / page fallback.
   ============================================================ */
.secondary-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  background: var(--surface); color: var(--ink-800);
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--font-bold);
  text-decoration: none; cursor: pointer;
}
.secondary-button:hover { border-color: var(--ink-400); color: var(--ink-950); }
.danger-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid var(--error-text); border-radius: var(--radius-control);
  background: var(--error-text); color: var(--surface);
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--font-bold);
  cursor: pointer;
}
.danger-button:hover { filter: brightness(1.08); }
.account-actions { margin: var(--space-4) 0 0; }

.confirm-dialog {
  width: min(400px, calc(100vw - 32px));
  padding: var(--space-7);
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--ink-800);
  box-shadow: var(--shadow-overlay);
}
.confirm-dialog::backdrop { background: rgba(17, 25, 32, .55); backdrop-filter: blur(2px); }
.confirm-title { margin: 0; font-family: var(--font-serif); font-size: var(--text-lg); font-weight: 600; color: var(--ink-950); }
.confirm-body { margin: var(--space-2) 0 0; font-size: var(--text-sm); color: var(--ink-600); line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-6); }
.confirm-actions--page { justify-content: flex-start; margin-top: 0; }
/* First-login pop-up (2026-11-19): wider than the default dialog, room under the intro, buttons on one line. */
.survey-dialog { width: min(460px, calc(100vw - 32px)); }
.survey-dialog .confirm-body { margin-bottom: var(--space-5); }
.survey-dialog .confirm-actions { align-items: center; }
.survey-dialog .confirm-actions .secondary-button { white-space: nowrap; }
.survey-dialog .auth-form .primary-button { margin-top: 0; white-space: nowrap; }

/* Account forms (log in, sign up, forgot / reset password): fields had no spacing between them,
   so "Forgot your password?" sat jammed between the password box and the Log in button. */
.auth-form .field { margin-bottom: var(--space-5); }
.auth-form .field label { margin-bottom: 6px; }
.auth-form .field-hint { margin-top: 8px; }
.auth-form .auth-forgot { text-align: right; }
.auth-form .primary-button { margin-top: var(--space-6); }
.auth-form + .field-hint { margin-top: var(--space-5); }

/* ============================================================
   Flashcard history (2026-11-08): /history list + saved-session review.
   ============================================================ */
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-5); }
.history-session {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: clamp(16px, 3vw, 24px); box-shadow: var(--shadow-flashcard);
}
.history-session-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-3) var(--space-5); margin-bottom: var(--space-4); }
.history-session-title { margin: 0; font-family: var(--font-serif); font-size: var(--text-lg); font-weight: 600; color: var(--ink-950); }
.history-session-meta { margin: 4px 0 0; font-size: var(--text-xs); color: var(--ink-500); }
.history-session-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.history-action {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  background: var(--surface); color: var(--ink-800);
  font-family: var(--font-sans); font-size: var(--text-xs); font-weight: var(--font-bold);
  text-decoration: none; cursor: pointer;
}
.history-action:hover { border-color: var(--ink-400); color: var(--ink-950); }
.history-action--primary { background: var(--button-bg); border-color: var(--button-bg); color: var(--button-text); }
.history-action--primary:hover { background: var(--button-bg-hover); border-color: var(--button-bg-hover); color: var(--button-text); }
.history-action--danger { color: var(--error-text); }
.history-action--danger:hover { border-color: var(--error-text); color: var(--error-text); }

.history-cards { margin: 0; padding-left: 1.6em; display: grid; gap: 6px; color: var(--ink-500); font-size: var(--text-xs); }
.history-card { padding: 8px 10px; border-radius: var(--radius-control); background: var(--paper); border: 1px solid var(--line); color: var(--ink-800); font-size: var(--text-sm); line-height: 1.45; }
.history-card-front { display: block; font-weight: var(--font-semibold); color: var(--ink-950); }
.history-card-back { display: block; margin-top: 2px; color: var(--ink-600); }
.history-card-front, .history-card-back { overflow-wrap: anywhere; white-space: pre-line; }
.cloze-answer { background: var(--accent-100); color: var(--accent-700); border-radius: 4px; padding: 0 3px; }
.history-more { margin-top: var(--space-3); }
.history-more summary { cursor: pointer; font-size: var(--text-xs); font-weight: var(--font-bold); color: var(--accent-600); }
.history-more[open] summary { margin-bottom: var(--space-2); }
.history-pager { display: flex; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-6); }
.history-empty-cta { max-width: 320px; margin: var(--space-6) auto 0; }
.history-no-more { margin: 0; }
.secondary-button--danger { color: var(--error-text); }
.secondary-button--danger:hover { border-color: var(--error-text); color: var(--error-text); }
.preview-header p a { color: var(--accent-600); font-weight: var(--font-semibold); text-decoration: underline; }

/* Logged-out home page: the real Generate form is usable; adding material opens this log-in card. */
.gate-modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: var(--space-4); background: rgba(10, 18, 26, .6);
}
.gate-modal[hidden] { display: none; }
body.gate-open { overflow: hidden; }
.locked-card {
  width: 100%; max-width: 420px; text-align: center; padding: var(--space-6) var(--space-5);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-card, 16px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .25);
}
.locked-card h2 { margin: 0 0 var(--space-2); font-family: var(--font-serif); font-size: var(--text-lg, 1.25rem); color: var(--ink-950); }
.locked-card p { margin: 0 0 var(--space-4); font-size: var(--text-sm); color: var(--ink-600); line-height: 1.55; }
.locked-actions { display: flex; flex-direction: column; gap: var(--space-3); align-items: stretch; }
.locked-actions .primary-button { margin: 0; }
.gate-close { background: none; border: 0; color: var(--ink-500); font: inherit; font-size: var(--text-sm); cursor: pointer; padding: var(--space-2); text-decoration: underline; }
.gate-close:hover { color: var(--ink-950); }
.restored-note { margin: 0 0 var(--space-4); color: var(--accent-600); font-weight: var(--font-semibold); }

/* Pictures on cards (review screen) */
.card-image { margin-top: var(--space-2); }
.card-image-thumb { display: block; max-width: 100%; max-height: 220px; margin: 0 0 var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); }
.card-image-thumb.is-hidden { display: none; }
.card-image-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.card-image-actions .secondary-button { min-height: 36px; padding: 6px 12px; font-size: var(--text-xs); }
.card-image-error { margin: var(--space-2) 0 0; }
.image-crop-dialog { width: min(92vw, 640px); }
.crop-stage { position: relative; display: inline-block; max-width: 100%; margin: var(--space-3) 0; line-height: 0; touch-action: none; user-select: none; cursor: crosshair; }
.crop-stage img { display: block; max-width: 100%; max-height: 55vh; }
.crop-box { position: absolute; border: 2px solid var(--accent-500); background: rgba(31, 163, 141, .18); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); pointer-events: none; }
.card-image .is-hidden { display: none !important; }
.crop-stage img { -webkit-user-drag: none; }
.crop-handle { position: absolute; width: 14px; height: 14px; background: var(--accent-500); border: 2px solid #fff; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.crop-handle[data-h="nw"] { left: -8px; top: -8px; } .crop-handle[data-h="n"] { left: calc(50% - 7px); top: -8px; } .crop-handle[data-h="ne"] { right: -8px; top: -8px; }
.crop-handle[data-h="e"] { right: -8px; top: calc(50% - 7px); } .crop-handle[data-h="se"] { right: -8px; bottom: -8px; } .crop-handle[data-h="s"] { left: calc(50% - 7px); bottom: -8px; }
.crop-handle[data-h="sw"] { left: -8px; bottom: -8px; } .crop-handle[data-h="w"] { left: -8px; top: calc(50% - 7px); }
.crop-box { cursor: move; }

/* ---------- optional instructions box (Generate + home forms) ---------- */
.instr { margin-top: 14px; }
.instr-toggle { border: 0; background: transparent; padding: 6px 2px; font: inherit; font-size: var(--text-sm); font-weight: 600; color: var(--ink-950); display: inline-flex; gap: 8px; align-items: center; cursor: pointer; box-shadow: none; }
.instr-toggle:hover { text-decoration: none; }
.instr-toggle .opt { font-weight: 400; color: var(--ink-500); }
#instr-body { margin-top: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
#instr-body[hidden] { display: none; }
.instr-label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-500); margin-bottom: 5px; }
#instr-in { width: 100%; min-height: 84px; resize: vertical; }
.instr-foot { display: flex; margin-top: 6px; font-size: var(--text-xs); color: var(--ink-500); }
.instr-foot #instr-count { font-variant-numeric: tabular-nums; margin-left: auto; }
.instr-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.instr-chips button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 4px 12px; font: inherit; font-size: var(--text-xs); color: var(--ink-500); cursor: pointer; box-shadow: none; }
.instr-chips button:hover { color: var(--ink-950); border-color: var(--ink-500); }
.instr-chips button[aria-pressed="true"] { color: var(--ink-950); border-color: var(--ink-500); background: var(--paper); }

.crop-stage.is-loading { visibility: hidden; min-height: 200px; min-width: 200px; }

/* ---------- one-tap answers: deck rating card and the "would you pay" question ---------- */
.signal-card { margin: var(--space-4) 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.signal-title { margin: 0 0 4px; font-family: var(--font-serif); font-size: var(--text-md); font-weight: 600; color: var(--ink-950); }
.signal-options { display: grid; gap: 8px; margin: 12px 0; }
.signal-options label { display: flex; gap: 8px; align-items: center; font-size: var(--text-sm); color: var(--ink-950); cursor: pointer; }
.signal-note-label { display: block; margin: 10px 0 4px; font-size: var(--text-xs); color: var(--ink-500); }
.signal-note { width: 100%; min-height: 56px; resize: vertical; }
.rate-card { position: fixed; right: 20px; bottom: 80px; z-index: 40; width: min(340px, calc(100vw - 40px)); max-height: calc(100vh - 110px); overflow-y: auto; padding: 16px 18px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.rate-card.is-hidden { display: none; }
.rate-close { position: absolute; top: 6px; right: 8px; border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--ink-500); cursor: pointer; box-shadow: none; padding: 4px 8px; }
.rate-title { margin: 0 20px 10px 0; font-weight: 600; font-size: var(--text-sm); color: var(--ink-950); }
.rate-stars { display: flex; gap: 8px; }
.rate-stars button { flex: 1; padding: 8px 0; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--paper); color: var(--ink-950); font: inherit; font-weight: 600; cursor: pointer; box-shadow: none; }
.rate-stars button:hover { border-color: var(--ink-500); }
.rate-stars button[aria-pressed="true"] { background: var(--ink-950); color: var(--surface); border-color: var(--ink-950); }
.rate-ends { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; color: var(--ink-500); }
.rate-more { margin-top: 8px; display: grid; gap: 8px; justify-items: start; }
.rate-more.is-hidden { display: none; }
@media (max-width: 600px) { .rate-card { bottom: 140px; } }

/* ---------- sign-up: name row ---------- */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; gap: 0; } }
.rate-q { margin: 6px 0 0; font-size: var(--text-xs); font-weight: 600; color: var(--ink-950); }
.rate-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rate-chips button { border: 1px solid var(--line-strong); background: var(--paper); border-radius: 99px; padding: 4px 11px; font: inherit; font-size: var(--text-xs); color: var(--ink-500); cursor: pointer; box-shadow: none; }
.rate-chips button:hover { color: var(--ink-950); border-color: var(--ink-500); }
.rate-chips button[aria-pressed="true"] { color: var(--ink-950); border-color: var(--ink-950); background: var(--surface); font-weight: 600; }

/* ---------- phones (2026-11-13): bigger tap targets, a smaller Feedback button ---------- */
@media (max-width: 600px) {
  .feedback-toggle { padding: 0; width: 44px; height: 44px; min-height: 44px; justify-content: center; border-radius: 50%; }
  .feedback-toggle span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* room under the last line of every page so the round Feedback button never sits on it (2026-11-23) */
  .site-footer { padding-bottom: 72px; }
  .site-footer-links a { display: inline-block; padding: 9px 4px; }
  .instr-toggle { min-height: 40px; }
  .auto-count-toggle { min-height: 40px; align-items: center; }
  .signal-options label { min-height: 40px; }
  .rate-card { padding: 12px 14px 10px; }
  .rate-card .rate-more { gap: 6px; }
  .rate-chips { gap: 5px; }
  .rate-chips button { min-height: 32px; padding: 3px 10px; }
  .rate-stars button { min-height: 38px; }
  .rate-card .signal-note { min-height: 44px; }
}
