/* =========================================================
   Cul-Text — shared styles
   One stylesheet for every page: tokens, base, components,
   then page-specific sections (landing, auth, app).
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  --bg: #f7f7f3;
  --surface: #ffffff;
  --surface-2: #f1f2ed;
  --ink: #0f1713;
  --ink-2: #2b3530;
  --muted: #66706a;
  --line: #e3e5df;
  --line-2: #d4d8d0;

  /* Brand: the CUL TEXT logo — orange box, black type */
  --brand: #e8803a;
  --brand-hover: #d9702c;
  --brand-text: #a4501a;     /* orange dark enough for small text on light backgrounds */
  --brand-ink: #111111;      /* black from the logo */
  --brand-soft: #fdeee2;
  --brand-ring: rgba(232, 128, 58, 0.22);

  /* Green is kept only to mean "checked, no issues" */
  --ok: #0b7a4b;
  --ok-ink: #063521;
  --ok-soft: #e6f3ec;

  --warn: #a4501a;
  --warn-soft: #fdeee2;
  --danger: #c2410c;
  --danger-soft: #fdebe3;
  --neutral-soft: #eef0ec;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 19, 0.06);
  --shadow: 0 1px 2px rgba(15, 23, 19, 0.05), 0 8px 24px rgba(15, 23, 19, 0.06);
  --shadow-lg: 0 2px 4px rgba(15, 23, 19, 0.04), 0 24px 60px rgba(15, 23, 19, 0.10);

  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* Surfaces that differ between light and dark */
  --danger-ink: #8a2c06;
  --nav-bg: rgba(247, 247, 243, 0.85);
  --mark-bg: #fbe0d2;
  --cite-bg: rgba(255, 255, 255, 0.8);
  --band-bg: #111111;
  --band-border: transparent;
  --note-ink: #6b4510;
  --input-hover: #b9beb5;
  --hover-bg: #fbfbf9;
  color-scheme: light;
}

/* ---------- Dark theme: follows the device unless the user picked light ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e100f;
    --surface: #161917;
    --surface-2: #1e221f;
    --ink: #edf0ec;
    --ink-2: #c9cfca;
    --muted: #8f9892;
    --line: #272c29;
    --line-2: #363c38;

    --brand-hover: #f2934f;
    --brand-text: #f3a46b;
    --brand-soft: rgba(232, 128, 58, 0.15);
    --brand-ring: rgba(232, 128, 58, 0.3);

    --ok: #3dbd85;
    --ok-ink: #8fdcb8;
    --ok-soft: rgba(61, 189, 133, 0.14);

    --warn: #f3a46b;
    --warn-soft: rgba(232, 128, 58, 0.15);
    --danger: #f27d4f;
    --danger-soft: rgba(242, 125, 79, 0.14);
    --danger-ink: #f6a07d;
    --neutral-soft: #222724;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 60px rgba(0, 0, 0, 0.5);

    --nav-bg: rgba(14, 16, 15, 0.82);
    --mark-bg: rgba(242, 125, 79, 0.28);
    --cite-bg: rgba(0, 0, 0, 0.25);
    --band-bg: #1a1d1b;
    --band-border: #2a2f2b;
    --note-ink: #f3c27a;
    --input-hover: #4a514c;
    --hover-bg: #1b1f1c;
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0e100f;
    --surface: #161917;
    --surface-2: #1e221f;
    --ink: #edf0ec;
    --ink-2: #c9cfca;
    --muted: #8f9892;
    --line: #272c29;
    --line-2: #363c38;

    --brand-hover: #f2934f;
    --brand-text: #f3a46b;
    --brand-soft: rgba(232, 128, 58, 0.15);
    --brand-ring: rgba(232, 128, 58, 0.3);

    --ok: #3dbd85;
    --ok-ink: #8fdcb8;
    --ok-soft: rgba(61, 189, 133, 0.14);

    --warn: #f3a46b;
    --warn-soft: rgba(232, 128, 58, 0.15);
    --danger: #f27d4f;
    --danger-soft: rgba(242, 125, 79, 0.14);
    --danger-ink: #f6a07d;
    --neutral-soft: #222724;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 60px rgba(0, 0, 0, 0.5);

    --nav-bg: rgba(14, 16, 15, 0.82);
    --mark-bg: rgba(242, 125, 79, 0.28);
    --cite-bg: rgba(0, 0, 0, 0.25);
    --band-bg: #1a1d1b;
    --band-border: #2a2f2b;
    --note-ink: #f3c27a;
    --input-hover: #4a514c;
    --hover-bg: #1b1f1c;
}

/* Smooth colour change when the toggle is used */
.theme-transition, .theme-transition *, .theme-transition *::before, .theme-transition *::after {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease !important;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; }
p { margin: 0; }
a { color: inherit; }
img, svg { display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand-hover); outline-offset: 2px; }
/* The hidden attribute must win over any component's display style */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--mono); font-size: 0.85em; }

/* ---------- Logo ---------- */
.logo {
  display: inline-flex; align-items: stretch; gap: 7px; text-decoration: none;
  font-weight: 600; font-size: 1.05rem; letter-spacing: 0.06em; line-height: 1; text-transform: uppercase;
}
.logo-cul { background: var(--brand); color: var(--brand-ink); padding: 6px 8px 5px; }
.logo-text { color: var(--ink); padding: 6px 0 5px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 500; font-size: 0.95rem; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover { background: var(--ink-2); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: var(--surface); border-color: var(--ink); }
.btn-text { background: none; padding: 8px 12px; color: var(--muted); }
.btn-text:hover { color: var(--ink); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn .spinner { width: 16px; height: 16px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 0;
  display: inline-grid; place-items: center;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 500; line-height: 1.3;
  background: var(--neutral-soft); color: var(--ink-2);
}
.badge-ok { background: var(--ok-soft); color: var(--ok-ink); }
.badge-warn { background: var(--warn-soft); color: var(--brand-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-ink); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- Form fields ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: 0.88rem; font-weight: 500; }
.field .hint { font-size: 0.8rem; color: var(--muted); }
.input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover { border-color: var(--input-hover); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.form-error {
  display: none; padding: 10px 14px; border-radius: 12px;
  background: var(--danger-soft); color: var(--danger-ink); font-size: 0.9rem;
}
.form-error.show { display: block; }

/* ---------- Spinner ---------- */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   LANDING PAGE
   ========================================================= */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: var(--nav-bg);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: 0.95rem; }
.nav-links a:hover { color: var(--ink); }
.nav-actions { display: flex; align-items: center; gap: 8px; }

.hero { padding: 72px 0 96px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 64px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 0.82rem; color: var(--ink-2);
}
.eyebrow .badge { padding: 2px 8px; font-size: 0.72rem; }
.hero h1 { font-size: clamp(2.5rem, 5.4vw, 4.1rem); margin: 22px 0 20px; letter-spacing: -0.04em; }
.hero h1 em { font-style: normal; background: var(--brand); color: var(--brand-ink); padding: 0 0.12em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 520px; }
.hero-cta { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.hero-note { margin-top: 18px; font-size: 0.85rem; color: var(--muted); }

/* Before/after demo card in the hero */
.demo {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 22px; display: grid; gap: 14px;
}
.demo-q { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; color: var(--ink-2); }
.demo-q .avatar { flex: none; }
.demo-block { border-radius: var(--radius); padding: 16px; font-size: 0.93rem; }
.demo-before { background: var(--surface-2); }
.demo-before .demo-text mark { background: var(--mark-bg); color: inherit; border-radius: 4px; padding: 0 3px; }
.demo-after { background: var(--brand-soft); }
.demo-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.demo-after .demo-label { color: var(--brand-text); }
.demo-cites { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.cite {
  font-family: var(--mono); font-size: 0.72rem;
  padding: 3px 8px; border-radius: 6px;
  background: var(--cite-bg); border: 1px solid rgba(232, 128, 58, 0.3); color: var(--brand-text);
}

.section { padding: 96px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { max-width: 640px; margin-bottom: 48px; }
.section-head .kicker { font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand-text); }
.section-head h2 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); margin: 12px 0 14px; }
.section-head p { color: var(--muted); font-size: 1.05rem; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; }
.step-num { font-family: var(--mono); font-size: 0.8rem; color: var(--brand-text); }
.step h3 { font-size: 1.25rem; margin: 14px 0 8px; }
.step p { color: var(--muted); font-size: 0.95rem; }

.cultures { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.culture { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.culture h3 { font-size: 1.35rem; }
.culture p { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }
.categories { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.categories .badge { background: var(--surface); border: 1px solid var(--line); padding: 7px 14px; font-size: 0.85rem; }

.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.principle .icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--brand-soft); color: var(--brand-text);
  display: grid; place-items: center; margin-bottom: 18px;
}
.principle h3 { font-size: 1.15rem; margin-bottom: 8px; }
.principle p { color: var(--muted); font-size: 0.95rem; }

.cta-band {
  background: var(--band-bg); color: #fff; border: 1px solid var(--band-border); border-radius: 28px;
  padding: 64px; display: flex; align-items: center; justify-content: space-between; gap: 32px;
}
.cta-band h2 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); max-width: 520px; }
.cta-band p { color: #aeb8b2; margin-top: 10px; }

.footer { padding: 40px 0 56px; color: var(--muted); font-size: 0.88rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: center; }

/* =========================================================
   AUTH PAGES (sign up / log in)
   ========================================================= */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-aside {
  background: var(--brand-ink); color: #fff;
  padding: 40px 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-aside .logo-text { color: #fff; }
.auth-aside blockquote { margin: 0; font-size: 1.7rem; line-height: 1.3; letter-spacing: -0.02em; font-weight: 500; max-width: 460px; }
.auth-aside .quote-meta { margin-top: 18px; color: rgba(255, 255, 255, 0.6); font-size: 0.92rem; }

.auth-aside .pattern {
  position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 60px rgba(255, 255, 255, 0.03), 0 0 0 120px rgba(255, 255, 255, 0.02);
}
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 2rem; }
.auth-card .sub { color: var(--muted); margin: 8px 0 28px; }
.auth-form { display: grid; gap: 16px; }
.auth-switch { margin-top: 22px; text-align: center; color: var(--muted); font-size: 0.92rem; }
.auth-switch a { color: var(--brand-text); font-weight: 600; text-decoration: none; }
.demo-note {
  margin-top: 24px; padding: 12px 14px; border-radius: 12px;
  background: var(--warn-soft); color: var(--note-ink); font-size: 0.8rem; line-height: 1.5;
}
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 64px; }
.password-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--muted); font-size: 0.82rem; cursor: pointer; padding: 6px 8px;
}

/* =========================================================
   APP (chat + check)
   ========================================================= */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 272px 1fr; }

/* Sidebar */
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.sidebar-top { padding: 18px 16px 12px; display: flex; align-items: center; justify-content: space-between; }
.sidebar .new-chat { margin: 4px 16px 16px; justify-content: flex-start; border-radius: 12px; }
.history-label { padding: 0 20px 8px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.history { flex: 1; overflow-y: auto; padding: 0 10px; }
.history-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 10px; border: 0; background: none;
  text-align: left; cursor: pointer; color: var(--ink-2); font-size: 0.9rem;
}
.history-item:hover { background: var(--surface-2); }
.history-item.active { background: var(--brand-soft); color: var(--ink); }
.history-item .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .kind { flex: none; color: var(--muted); }
.history-empty { padding: 8px 12px; color: var(--muted); font-size: 0.85rem; }
.sidebar-user { border-top: 1px solid var(--line); padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.sidebar-user .who { flex: 1; min-width: 0; }
.sidebar-user .name { font-weight: 500; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .email { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg); font-size: 0.8rem; font-weight: 600;
}
/* The assistant's avatar is the CUL mark from the logo */
.avatar-bot { background: var(--brand); color: var(--brand-ink); border-radius: 6px; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.04em; }

/* Main column */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { height: 64px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--bg); }
.topbar .menu-btn { display: none; }
.segmented { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.segmented button {
  border: 0; background: none; cursor: pointer;
  padding: 7px 16px; border-radius: 999px; font-size: 0.9rem; font-weight: 500; color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px;
}
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.topbar-meta { font-size: 0.82rem; color: var(--muted); }

.thread { flex: 1; overflow-y: auto; }
.thread-inner { max-width: 780px; margin: 0 auto; padding: 32px 24px 24px; display: grid; gap: 28px; }

/* Empty state */
.empty { max-width: 780px; margin: 0 auto; padding: 9vh 24px 24px; }
.empty h1 { font-size: clamp(1.8rem, 3.6vw, 2.5rem); letter-spacing: -0.03em; }
.empty h1 span { color: var(--muted); }
.empty p { color: var(--muted); margin-top: 10px; max-width: 560px; }
.suggestions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 32px; }
.suggestion {
  text-align: left; cursor: pointer;
  padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.suggestion:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.suggestion .s-title { font-weight: 500; font-size: 0.95rem; }
.suggestion .s-sub { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }

/* Messages */
.msg { display: flex; gap: 14px; align-items: flex-start; }
.msg-body { flex: 1; min-width: 0; }
.msg-user .bubble {
  display: inline-block; max-width: 100%;
  background: var(--surface); border: 1px solid var(--line);
  padding: 12px 16px; border-radius: 16px 16px 16px 4px;
  white-space: pre-wrap; word-wrap: break-word;
}
.msg-user .bubble.long { display: block; font-size: 0.93rem; color: var(--ink-2); max-height: 240px; overflow-y: auto; }
.msg-meta { font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; font-weight: 500; }

.answer { font-size: 1rem; line-height: 1.7; }
.answer p + p, .answer ul, .answer ol { margin-top: 12px; }
.answer ul, .answer ol { padding-left: 22px; margin-bottom: 0; }
.answer li + li { margin-top: 4px; }
.answer strong { font-weight: 600; }
.answer h3, .answer h4 { font-size: 1.05rem; margin: 18px 0 6px; }
.answer hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.answer .table-wrap { margin-top: 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.answer table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.answer th, .answer td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.answer th { background: var(--surface-2); font-weight: 600; }
.answer tr:last-child td { border-bottom: 0; }

.msg-actions { display: flex; gap: 4px; margin-top: 10px; }
.msg-actions .btn-text { font-size: 0.82rem; padding: 6px 10px; border-radius: 8px; display: inline-flex; gap: 6px; align-items: center; }
.msg-actions .btn-text:hover { background: var(--surface-2); }

/* Cultural check panel */
.check {
  margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.check-head {
  width: 100%; border: 0; background: none; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
}
.check-head:hover { background: var(--hover-bg); }
.check-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.check-ok .check-icon { background: var(--ok-soft); color: var(--ok); }
.check-warn .check-icon { background: var(--brand-soft); color: var(--brand-text); }
.check-none .check-icon { background: var(--neutral-soft); color: var(--muted); }
.check-title { font-weight: 500; font-size: 0.93rem; }
.check-sub { color: var(--muted); font-size: 0.8rem; }
.check-head .chev { margin-left: auto; color: var(--muted); transition: transform 0.2s; }
.check.open .chev { transform: rotate(180deg); }
.check-body { display: none; border-top: 1px solid var(--line); padding: 18px 16px; gap: 22px; }
.check.open .check-body { display: grid; }
.check-section h4 { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 10px; }
.check-summary { color: var(--ink-2); font-size: 0.93rem; }

.flag { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.flag + .flag { margin-top: 10px; }
.flag-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.flag-quote { font-size: 0.9rem; color: var(--ink-2); border-left: 3px solid #f0b48f; padding-left: 10px; }
.flag-why { font-size: 0.9rem; }

.change { font-size: 0.9rem; display: grid; gap: 2px; }
.change + .change { margin-top: 10px; }
.change .why { color: var(--muted); font-size: 0.85rem; }

.evidence { display: grid; gap: 8px; }
.ev { border-radius: 12px; background: var(--surface-2); padding: 12px 14px; font-size: 0.88rem; }
.ev-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ev-top .sim { margin-left: auto; color: var(--muted); font-size: 0.75rem; font-family: var(--mono); }
.ev-cite { color: var(--muted); font-size: 0.78rem; margin-top: 6px; }
.ev.cited { background: var(--brand-soft); }

.draft { background: var(--surface-2); border-radius: 12px; padding: 14px; font-size: 0.9rem; color: var(--ink-2); }

/* Check-a-text result card */
.result-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.result-head { padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; border-bottom: 1px solid var(--line); }
.result-head h3 { font-size: 1.1rem; }
.result-head p { color: var(--muted); font-size: 0.92rem; margin-top: 4px; }
.result-body { padding: 20px; display: grid; gap: 24px; }
.enhanced { background: var(--brand-soft); border-radius: 14px; padding: 16px; }
.enhanced .answer { font-size: 0.97rem; }

/* Loading */
.thinking { display: grid; gap: 10px; padding-top: 4px; }
.thinking-step { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.92rem; transition: color 0.2s; }
.thinking-step .tick { width: 18px; height: 18px; display: grid; place-items: center; }
.thinking-step.active { color: var(--ink); }
.thinking-step.done { color: var(--ok); }
.thinking-step:not(.active):not(.done) .tick::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }

.error-box { border-radius: 12px; background: var(--danger-soft); color: var(--danger-ink); padding: 12px 14px; font-size: 0.92rem; display: flex; gap: 12px; align-items: center; justify-content: space-between; }

/* Composer */
.composer-wrap { flex: none; padding: 12px 24px 18px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.composer {
  max-width: 780px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px;
  box-shadow: var(--shadow); padding: 10px 10px 10px 18px;
  display: flex; align-items: flex-end; gap: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring), var(--shadow); }
.composer textarea {
  flex: 1; border: 0; resize: none; background: none; outline: none;
  padding: 8px 0; max-height: 240px; line-height: 1.5;
}
.send-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; flex: none;
  background: var(--brand); color: var(--brand-ink); cursor: pointer; display: grid; place-items: center;
}
.send-btn:hover { background: var(--brand-hover); }
.send-btn[disabled] { background: var(--line-2); cursor: not-allowed; }
.composer-foot { max-width: 780px; margin: 8px auto 0; display: flex; justify-content: space-between; gap: 12px; font-size: 0.75rem; color: var(--muted); padding: 0 6px; }
.composer-foot .over { color: var(--danger); }

.backdrop { display: none; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .steps, .principles { grid-template-columns: 1fr; }
  .cultures { grid-template-columns: repeat(2, 1fr); }
  .cta-band { flex-direction: column; align-items: flex-start; padding: 40px 28px; }
  .nav-links { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40;
    transform: translateX(-100%); transition: transform 0.25s ease;
  }
  .app.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .app.sidebar-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 19, 0.3); z-index: 30; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar-meta { display: none; }
  .suggestions { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .hero { padding: 40px 0 64px; }
  .section { padding: 64px 0; }
  .cultures { grid-template-columns: 1fr; }
  .nav-actions .btn-ghost { display: none; }
  .thread-inner, .empty { padding-left: 16px; padding-right: 16px; }
  .composer-wrap { padding: 8px 12px 12px; }
  .segmented button { padding: 7px 12px; font-size: 0.85rem; }
}

/* The form column repeats the logo only when the green side panel is hidden */
.auth-card-logo { display: none; margin-bottom: 28px; }
@media (max-width: 960px) { .auth-card-logo { display: inline-flex; } }
.form-success {
  padding: 16px; border-radius: 12px;
  background: var(--ok-soft); color: var(--ok-ink); font-size: 0.95rem; line-height: 1.55;
}

/* History rows: open button + delete button (shown on hover) */
.history-row { display: flex; align-items: center; border-radius: 10px; }
.history-row:hover { background: var(--surface-2); }
.history-row .history-item { flex: 1; min-width: 0; background: none; }
.history-row.active { background: var(--brand-soft); }
.history-row.active .history-item { color: var(--ink); }
.history-delete { width: 30px; height: 30px; flex: none; opacity: 0; margin-right: 4px; }
.history-row:hover .history-delete, .history-delete:focus-visible { opacity: 1; }
.history-delete:hover { color: var(--danger); background: transparent; }
@media (hover: none) { .history-delete { opacity: 1; } }

/* ---------- Rotating proverbs on the log-in / sign-up side panel ---------- */
.quote-rotator { --quote-ms: 7000ms; }
.quote-rotator blockquote { min-height: 4em; }  /* room for 3 lines, so the panel doesn't jump */
.quote-progress { width: 64px; height: 5px; background: rgba(255, 255, 255, 0.14); margin-bottom: 26px; overflow: hidden; }
.quote-progress span { display: block; height: 100%; background: var(--brand); transform: scaleX(0); transform-origin: left; }
.quote-progress.run span { animation: quote-progress var(--quote-ms) linear forwards; }
@keyframes quote-progress { to { transform: scaleX(1); } }

/* Incoming quote: words rise out of a soft blur, one after another */
.quote-word {
  display: inline-block; opacity: 0; transform: translateY(0.45em); filter: blur(6px);
  animation: quote-word-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: calc(var(--i) * 55ms);
}
@keyframes quote-word-in { to { opacity: 1; transform: none; filter: blur(0); } }
.quote-original {
  margin-top: 20px; color: var(--brand); font-size: 1.05rem; font-weight: 500; font-style: italic; letter-spacing: 0.01em;
}
.quote-original::before { content: "“"; }
.quote-original::after { content: "”"; }
.quote-rotator .quote-meta { margin-top: 6px; }
.quote-original.in, .quote-meta.in { opacity: 0; animation: quote-meta-in 0.6s ease forwards; animation-delay: var(--meta-delay, 0.4s); }
@keyframes quote-meta-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Outgoing quote: lifts away and fades */
.quote-rotator blockquote, .quote-rotator .quote-original, .quote-rotator .quote-meta { transition: opacity 0.4s ease, transform 0.4s ease, filter 0.4s ease; }
.quote-rotator.leaving blockquote, .quote-rotator.leaving .quote-original, .quote-rotator.leaving .quote-meta { opacity: 0; transform: translateY(-10px); filter: blur(4px); }

@media (prefers-reduced-motion: reduce) {
  .quote-word, .quote-original.in, .quote-meta.in { animation: none; opacity: 1; transform: none; filter: none; }
  .quote-rotator.leaving blockquote, .quote-rotator.leaving .quote-original, .quote-rotator.leaving .quote-meta { transform: none; filter: none; }
  .quote-progress.run span { animation: none; transform: scaleX(1); }
}

/* ---------- Audit sign at the top of each answer ---------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 6px 12px 6px 10px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 500; line-height: 1.3;
}
.status-pill svg { flex: none; }
.pill-ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill-warn { background: var(--brand-soft); color: var(--brand-text); }
.pill-none { background: var(--neutral-soft); color: var(--muted); }
.pill-checking { background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.pill-checking .spinner { width: 13px; height: 13px; }
.pill-match {
  padding-left: 9px; border-left: 1px solid currentColor;
  font-family: var(--mono); font-size: 0.75rem; opacity: 0.85; cursor: help;
}
.result-match { margin-left: auto; flex: none; font-size: 0.8rem; color: var(--muted); }
.result-match .pill-match { border-left: 0; padding-left: 0; }

/* The details row under an answer is now a quiet link-like row */
.check-head { padding: 10px 16px; }
.check-head .check-title { font-size: 0.88rem; color: var(--ink-2); }

/* Sources as compact chips; full entries behind "Show details" */
.source-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.source-chip {
  font-family: var(--mono); font-size: 0.74rem; padding: 4px 9px; border-radius: 7px;
  background: var(--surface-2); color: var(--ink-2); cursor: help;
}
.source-chip.cited { background: var(--brand-soft); color: var(--brand-text); }
.details-toggle { margin-top: 8px; padding: 4px 0; font-size: 0.82rem; }
.details-toggle + .evidence { margin-top: 10px; }

/* ---------- Landing: use cases across sectors ---------- */
.sectors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.sector { background: var(--surface); padding: 24px; transition: background 0.15s; }
.sector:hover { background: var(--surface-2); }
.sector h3 { font-size: 1.05rem; margin-bottom: 8px; }
.sector h3::before { content: ""; display: block; width: 18px; height: 4px; background: var(--brand); margin-bottom: 14px; }
.sector p { color: var(--muted); font-size: 0.9rem; }
.sectors-note { margin-top: 20px; color: var(--muted); font-size: 0.88rem; max-width: 720px; }
@media (max-width: 960px) { .sectors { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .sectors { grid-template-columns: 1fr; } }

/* ---------- Theme toggle placement ---------- */
.nav-auth { display: flex; align-items: center; gap: 8px; }
.auth-main { position: relative; }
.theme-corner { position: absolute; top: 20px; right: 20px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.details-toggle + .draft { margin-top: 10px; }
.check-section > .details-toggle:first-child { margin-top: 0; }

/* Delete is always visible on the open chat, and on every row on hover */
.history-row.active .history-delete { opacity: 0.7; }
#delete-chat:hover { color: var(--danger); }

/* ---------- Researcher corrections ---------- */
.correct-box {
  margin-top: 12px; padding: 14px; border-radius: var(--radius);
  border: 1px solid var(--brand); background: var(--brand-soft); display: grid; gap: 10px;
}
.correct-box label { font-size: 0.88rem; font-weight: 500; }
.correct-box textarea { resize: vertical; min-height: 76px; }
.correct-actions { display: flex; align-items: center; gap: 8px; }
.correct-actions .btn { padding: 9px 16px; }
.correct-hint { font-size: 0.78rem; color: var(--muted); }
.learned {
  margin-top: 10px; display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border-radius: 12px; background: var(--ok-soft); color: var(--ok-ink); font-size: 0.88rem;
}
.learned svg { flex: none; margin-top: 3px; }
.learned span { flex: 1; }
.learned .btn-text { padding: 2px 6px; font-size: 0.8rem; color: var(--ok-ink); }

/* ---------- Review sources page ---------- */
.review { padding-top: 36px; padding-bottom: 64px; }
.review-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.review-head h1 { font-size: 2rem; }
.review-sub { color: var(--muted); margin-top: 8px; max-width: 640px; }
.review-stats { display: flex; gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: grid; min-width: 150px; }
.stat-num { font-size: 1.6rem; font-weight: 600; }
.stat-num small { font-size: 0.9rem; color: var(--muted); font-weight: 500; }
.stat-label { color: var(--muted); font-size: 0.8rem; }
.review-tools { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 28px 0 18px; }
.review-tools .segmented { flex-wrap: wrap; }
.segmented .count { font-family: var(--mono); font-size: 0.72rem; opacity: 0.7; }
.review-search { max-width: 280px; }
.review-list { display: grid; gap: 14px; }
.review-empty { color: var(--muted); padding: 24px 0; }
.review-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; display: grid; gap: 12px; }
.review-card-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.review-claim { font-size: 0.97rem; }
.review-sources { display: grid; gap: 8px; }
.review-source { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; font-size: 0.85rem; }
.review-source a { color: var(--brand-text); word-break: break-all; }
.review-source .muted, .review-note { color: var(--muted); font-size: 0.82rem; }
.review-source blockquote { margin: 4px 0 0; padding-left: 10px; border-left: 3px solid var(--brand); color: var(--ink-2); }
.review-citation summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.review-citation p { font-size: 0.82rem; color: var(--ink-2); margin-top: 6px; }
.review-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.review-actions .btn { padding: 8px 14px; font-size: 0.88rem; }
.review-note-box { display: grid; gap: 8px; }
.sidebar .review-link { margin: -8px 16px 16px; justify-content: flex-start; border-radius: 12px; }
@media (max-width: 560px) { .review-stats { width: 100%; } .stat { flex: 1; min-width: 0; } .review-search { max-width: none; width: 100%; } }
.review-reason { font-size: 0.88rem; color: var(--ink-2); }
.review-flag { font-size: 0.82rem; color: var(--brand-text); }
.review-evidence { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; font-size: 0.85rem; }
.review-evidence blockquote { margin: 4px 0 0; padding-left: 10px; border-left: 3px solid var(--ok); color: var(--ink-2); }
.review-bulk {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--radius); background: var(--brand-soft); border: 1px solid var(--brand);
}
.review-bulk span { font-size: 0.92rem; }

/* ---------- What it does, labels and limits ---------- */
.abilities { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.ability {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.ability:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand); }
.ability h3 { margin-bottom: 6px; }
.ability p { color: var(--muted); }

.labels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.label-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.label-card .status-pill { margin-bottom: 14px; padding: 6px 12px; }
.label-card p { color: var(--muted); }

.limits { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 40px; }
.limits li { display: flex; gap: 16px; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--line); }
.limits strong { flex: none; font-weight: 600; }
.limits span { color: var(--muted); text-align: right; }
.limits-note { margin-top: 24px; color: var(--muted); }
.limits-note strong { color: var(--ink); }


/* ---------- Transitions and animations ---------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes soft-pulse { 50% { opacity: 0.55; } }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  body { animation: fade-in 0.35s ease both; }

  a, button, .btn, .suggestion, .history-item, .icon-btn, input, select, textarea {
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
      box-shadow 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
  }
  .btn:hover { transform: translateY(-1px); }
  .btn:active, .send-btn:active, .icon-btn:active { transform: scale(0.96); }
  .btn svg { transition: transform 0.18s ease; }
  .btn:hover svg { transform: translateX(3px); }
  .suggestion:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }

  /* Scroll reveal: only hidden once motion.js can show it again */
  .motion .reveal { opacity: 0; transform: translateY(16px); }
  .motion .reveal.in {
    opacity: 1; transform: none;
    transition: opacity 0.55s ease var(--delay, 0ms), transform 0.55s ease var(--delay, 0ms),
      box-shadow 0.2s ease, border-color 0.2s ease;
  }
  .motion .ability.reveal.in:hover { transform: translateY(-3px); transition-delay: 0ms; }

  /* Hero */
  .hero-copy > * { animation: fade-up 0.6s ease both; }
  .hero-copy > :nth-child(2) { animation-delay: 0.08s; }
  .hero-copy > :nth-child(3) { animation-delay: 0.16s; }
  .hero-copy > :nth-child(4) { animation-delay: 0.24s; }
  .demo { animation: fade-up 0.6s ease 0.15s both; }
  .demo-q { animation: fade-in 0.5s ease 0.45s both; }
  .demo-before { animation: fade-up 0.5s ease 0.8s both; }
  .demo-before mark { animation: fade-in 0.5s ease 1.3s both; }
  .demo-after { animation: fade-up 0.5s ease 1.7s both; }

  /* App */
  .empty h1, .empty p { animation: fade-up 0.45s ease both; }
  .empty p { animation-delay: 0.06s; }
  .suggestion { animation: fade-up 0.4s ease both; }
  .suggestion:nth-child(2) { animation-delay: 0.05s; }
  .suggestion:nth-child(3) { animation-delay: 0.1s; }
  .suggestion:nth-child(4) { animation-delay: 0.15s; }
  .msg.enter { animation: fade-up 0.3s ease both; }
  .msg:last-child .status-pill:not(.pill-checking) { animation: pop-in 0.25s ease both; }
  .pill-checking { animation: soft-pulse 1.4s ease-in-out infinite; }
  .sidebar { transition: transform 0.25s ease; }
  .auth-main > * { animation: fade-up 0.45s ease both; }
}

@media (max-width: 860px) {
  .abilities, .labels, .limits { grid-template-columns: 1fr; }
  .cultures { grid-template-columns: repeat(2, 1fr); }
  .limits span { text-align: right; }
}

/* ---------- Files and web sources ---------- */
.composer { padding-left: 10px; }
.attach-btn { flex: none; margin-bottom: 2px; }
.attach-chip {
  max-width: 780px; margin: 0 auto 8px; padding: 8px 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  font-size: 0.85rem; color: var(--ink-2);
}
.attach-chip small { color: var(--muted); }
.attach-chip button { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1; }
.file-tag { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 0.8rem; color: var(--muted); }
.web-sources { margin-top: 14px; display: grid; gap: 2px; }
.web-sources-title { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.web-sources a { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 6px 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.85rem; text-decoration: none; }
.web-sources a:hover { color: var(--brand-text); }
.web-sources small { color: var(--muted); white-space: nowrap; }

/* ---------- Limits ---------- */
.limit-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.limit-group { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; }
.limit-group h3 { margin-bottom: 12px; }
.limit-group ul { list-style: none; margin: 0; padding: 0; }
.limit-group li { padding: 10px 0; border-top: 1px solid var(--line); color: var(--muted); }
@media (max-width: 860px) { .limit-groups { grid-template-columns: 1fr; } }

/* ---------- Privacy page ---------- */
.privacy { max-width: 720px; padding-top: 56px; padding-bottom: 72px; }
.privacy h1 { margin-bottom: 12px; }
.privacy h2 { font-size: 1.15rem; margin: 32px 0 10px; }
.privacy p, .privacy li { color: var(--ink-2); }
.privacy ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.composer-foot a { color: inherit; text-decoration: underline; }

/* ---------- Saved gender ---------- */
.sidebar-gender { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); }
.sidebar-gender select { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; font: inherit; }

/* ---------- Knowledge base review flashcards ---------- */
.validate-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.validate-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; }
.validate-main { flex: 1; width: 100%; max-width: 620px; margin: 0 auto; padding: 8px 16px 32px; display: flex; flex-direction: column; gap: 14px; }
.val-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow); }
.val-card h1 { font-size: clamp(1.5rem, 5vw, 2rem); margin-bottom: 10px; }
.val-lead { color: var(--ink-2); }
.val-note { color: var(--muted); font-size: 0.85rem; margin-top: 10px; }
.val-form { display: grid; gap: 14px; margin-top: 18px; }
.val-form label { display: grid; gap: 6px; font-weight: 500; font-size: 0.92rem; }
.val-form small { color: var(--muted); font-weight: 400; }
.val-form .val-check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.val-check input { margin-top: 4px; accent-color: var(--brand); }
.val-progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.val-progress span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width 0.3s ease; }
.val-count { color: var(--muted); font-size: 0.85rem; text-align: center; }
.val-flash { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; min-height: 240px; }
.val-topic { align-self: flex-start; padding: 4px 10px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-text); font-size: 0.78rem; font-weight: 600; }
.val-claim { font-size: 1.12rem; line-height: 1.55; }
.val-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.val-btn { min-height: 56px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.val-btn:active { transform: scale(0.96); }
.val-true { background: var(--ok-soft); color: var(--ok-ink); border-color: transparent; }
.val-false { background: var(--danger-soft); color: var(--danger-ink); border-color: transparent; }
.val-comment { grid-column: 1 / -1; display: grid; gap: 10px; }
.val-comment label { display: grid; gap: 6px; font-size: 0.92rem; }
.val-foot { display: flex; justify-content: space-between; align-items: center; min-height: 28px; color: var(--muted); font-size: 0.8rem; }
.val-tally { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; text-align: center; }
.val-tally strong { display: block; font-size: 1.8rem; color: var(--brand-text); }
.val-tally span { color: var(--muted); font-size: 0.85rem; }

@keyframes val-back-in { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .val-enter { animation: fade-up 0.3s ease both; }
  .val-back { animation: val-back-in 0.25s ease both; }
  .val-flash { transition: transform 0.24s ease, opacity 0.24s ease; }
  .val-leave-true { transform: translateX(40px) rotate(3deg); opacity: 0; }
  .val-leave-false { transform: translateX(-40px) rotate(-3deg); opacity: 0; }
  .val-leave-not_sure { transform: translateY(24px); opacity: 0; }
}

/* ---------- Shared look: serif accents and textures ---------- */
:root {
  --serif: "Instrument Serif", Georgia, serif;
  --dots: radial-gradient(color-mix(in srgb, var(--ink) 20%, transparent) 1.1px, transparent 1.5px);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .13 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.auth-card h1 em, .review-head h1 em, .privacy h1 em, .val-card h1 em, .empty h1 span {
  font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em;
}
.auth-card h1, .review-head h1, .privacy h1, .val-card h1, .empty h1 { font-weight: 500; letter-spacing: -0.035em; }
.auth-card h1 { font-size: clamp(2.2rem, 4vw, 2.9rem); line-height: 1.04; }
.review-head h1, .privacy h1 { font-size: clamp(2.2rem, 4vw, 3rem); line-height: 1.04; }
.empty h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.04; }
.empty h1 span { color: var(--brand); }

.btn-primary { font-size: 0.86rem; letter-spacing: 0.06em; text-transform: uppercase; }
.val-btn { font-size: 0.95rem; }

/* Grain on surfaces */
.sidebar, .suggestion, .review-card, .val-card, .auth-main {
  background-image: var(--grain); background-size: 180px 180px;
}

/* Halftone behind page headers */
.auth-aside .pattern {
  inset: 0; right: 0; top: 0; width: auto; height: auto; border: 0; border-radius: 0; box-shadow: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.22) 1.1px, transparent 1.5px); background-size: 13px 13px;
  mask-image: radial-gradient(ellipse at 80% 15%, #000 8%, transparent 68%);
  -webkit-mask-image: radial-gradient(ellipse at 80% 15%, #000 8%, transparent 68%);
}
.auth-aside > :not(.pattern) { position: relative; }

.empty { position: relative; text-align: center; }
.empty::before {
  content: ""; position: absolute; left: 50%; top: 0; width: min(900px, 130vw); height: 340px; transform: translateX(-50%);
  background-image: var(--dots); background-size: 13px 13px; pointer-events: none;
  mask-image: radial-gradient(closest-side, #000 15%, transparent 95%);
  -webkit-mask-image: radial-gradient(closest-side, #000 15%, transparent 95%);
}
.empty > * { position: relative; }
.empty p { margin-left: auto; margin-right: auto; }
.suggestion { border-radius: 16px; }

.validate-page, .review, .privacy { position: relative; }
.validate-page::before, .review::before, .privacy::before {
  content: ""; position: absolute; left: 50%; top: 0; width: min(1000px, 130vw); height: 320px; transform: translateX(-50%);
  background-image: var(--dots); background-size: 13px 13px; pointer-events: none; z-index: -1;
  mask-image: radial-gradient(closest-side, #000 10%, transparent 95%);
  -webkit-mask-image: radial-gradient(closest-side, #000 10%, transparent 95%);
}
