/* ========================================================================
   VocalRep — Masterclass shell palette (editorial, both themes).
   Mirrors mobile/lib/theme.ts. Light default, dark via prefers-color-scheme
   with explicit [data-theme] overrides. Fraunces display + SF Pro body
   + JetBrains Mono for data. See the "reward" tokens for celebratory
   moments (score reveals, drill completions) that stay saturated in
   both modes.
   ======================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Anton&family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* Shell palette — LIGHT default (Masterclass cream + crimson) */
  --bg:          #f5efe4;
  --surface:     #ffffff;
  --surface-2:   #ebe4d6;
  --sidebar-bg:  #ebe4d6;
  --border:      #d4c9b4;

  --text:        #121212;
  --text-muted:  #5a5447;
  --text-dim:    #8b8370;

  --accent:      #c81d25;
  --accent-h:    #a81720;
  --accent-2:    #e63a42;   /* lighter crimson — brand gradient second stop (NOT amber) */

  /* Reward palette (identical both modes — meant to pop) */
  --reward-good:  #10b981;
  --reward-on:    #f59e0b;
  --reward-focus: #ef4444;
  --reward-wow:   #8b5cf6;

  --success: #10b981;
  --good:    #10b981;
  --warn:    #f59e0b;
  --danger:  #ef4444;
  --bad:     #ef4444;

  --sidebar-w: 220px;
  --radius: 14px;
  --maxw: 880px;

  --serif:   'Fraunces', ui-serif, Georgia, 'Times New Roman', serif;
  --sans:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, system-ui, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, Menlo, 'SF Mono', monospace;
  /* Masterclass-style display face — condensed, uppercase, cinematic.
     Used on sales-page hero only; interior / app pages stay Fraunces. */
  --display: 'Anton', 'Impact', 'Arial Narrow Bold', sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:         #121212;
    --surface:    #1c1c1c;
    --surface-2:  #242424;
    --sidebar-bg: #0f0f0f;
    --border:     #333333;
    --text:       #f5efe4;
    --text-muted: #a09887;
    --text-dim:   #6b6554;
    --accent:     #e63a42;
    --accent-h:   #f04a52;
    --accent-2:   #f04a52;  /* lighter crimson for dark bg gradients (NOT amber) */
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:         #121212;
  --surface:    #1c1c1c;
  --surface-2:  #242424;
  --sidebar-bg: #0f0f0f;
  --border:     #333333;
  --text:       #f5efe4;
  --text-muted: #a09887;
  --text-dim:   #6b6554;
  --accent:     #e63a42;
  --accent-h:   #f04a52;
  --accent-2:   #f04a52;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }

.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 17px;
}
/* margin on the icon (not gap on the parent) so .ai stays tight to VocalRep */
.brand img {
  width: 28px;
  height: 28px;
  display: block;
  flex-shrink: 0;
  margin-right: 9px;
}
.brand span { color: var(--accent); }
.nav a { margin-left: 18px; color: var(--text-dim); font-size: 14px; }
.nav a:hover { color: var(--text); }

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 8px;
}

h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 16px;
  font-variation-settings: "opsz" 96, "SOFT" 30;
  text-wrap: balance;
}

h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  font-variation-settings: "opsz" 48;
}

h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  font-variation-settings: "opsz" 36;
}

/* ----- Hero display type (Masterclass-style landing pages only) ----- */
.hero-display {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(44px, 8.5vw, 104px);
  line-height: 0.92;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--text);
  margin: 0 0 20px;
  font-variation-settings: normal;
}
.hero-rule {
  display: block;
  width: 48px;
  height: 3px;
  background: var(--accent);
  margin: 0 0 24px;
  border: 0;
}
.hero-split {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 56px;
  align-items: center;
}
.hero-split .hero-text { text-align: left; }
.hero-split .hero-portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 2px;
}
.hero-split .hero-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  filter: grayscale(100%) contrast(1.08);
}
.hero-split .hero-portrait::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.4));
  pointer-events: none;
}
@media (max-width: 768px) {
  .hero-split { grid-template-columns: 1fr; gap: 32px; }
  .hero-split .hero-portrait { max-width: 320px; margin: 0 auto; }
}

/* Data numerals — audit score, timers, deltas — use mono tabular. */
.index, .value, #timer, .delta-pill, [data-numeric] {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums lining-nums;
}

.sub {
  color: var(--text-dim);
  font-size: 17px;
  margin: 0 0 32px;
}

.audit-hero { margin-bottom: 32px; }

.audit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.card-step + .card-step {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.paragraph {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  margin: 0 0 14px;
  padding: 18px 20px;
  border-radius: 8px;
  font-size: 17px;
  line-height: 1.65;
  font-style: normal;
}

.pause-marker {
  display: inline-block;
  margin: 0 6px;
  padding: 2px 12px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px dashed rgba(245, 158, 11, 0.5);
  color: var(--accent-2);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.hint { color: var(--text-dim); font-size: 14px; margin: 0; }

.recorder { margin-top: 4px; }

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: 999px;
  padding: 12px 22px;
  transition: transform 80ms ease, background 120ms ease, color 120ms ease;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: #ff7378; }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border); }

.btn-record {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 14px 22px;
}
.btn-record:hover:not(:disabled) { border-color: var(--border); }
.btn-record .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
}
.btn-record.recording { border-color: var(--accent); }
.btn-record.recording .dot {
  animation: pulse 1.1s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

.meter {
  margin-top: 14px;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.meter-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 80ms ease;
}

.rec-status {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--text-dim);
}
.rec-status #timer { color: var(--text); font-weight: 600; }

.rec-actions { margin-top: 18px; display: flex; gap: 12px; }

audio { width: 100%; margin-top: 14px; }

.spinner {
  margin: 24px 0 0;
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footnote {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin: 24px 0 0;
}

/* ---- results page ---- */
.scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin: 24px 0;
}
.score-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.score-card .label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.score-card .value {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 4px;
}
.score-card .bar {
  margin-top: 10px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}
.score-card .bar > i {
  display: block;
  height: 100%;
  background: var(--good);
}
.score-card.low .bar > i { background: var(--bad); }
.score-card.mid .bar > i { background: var(--warn); }

.headline-card {
  background: linear-gradient(135deg, rgba(200,29,37,0.12), rgba(245,158,11,0.06));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 0 0 24px;
}
.headline-card .index {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.headline-card .index small {
  font-size: 16px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0;
}
.headline-card .headline { margin: 14px 0 0; font-size: 17px; }
.headline-card .comparison-meta {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}
.delta-pill {
  display: inline-block;
  margin-left: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.delta-up   { background: rgba(74,222,128,0.15); color: var(--good); }
.delta-down { background: rgba(248,113,113,0.15); color: var(--bad);  }
.delta-flat { background: rgba(154,163,173,0.15); color: var(--text-dim); }

.score-card .prev-line {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.score-card .prev-line strong {
  color: var(--text);
  font-weight: 600;
}
.score-card .prev-line .delta-up,
.score-card .prev-line .delta-down,
.score-card .prev-line .delta-flat {
  background: none;
  margin-left: 4px;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
}

.email-gate {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 28px;
}
.email-gate h2 { margin-bottom: 6px; }
.email-gate p.sub { font-size: 15px; margin-bottom: 16px; }
.email-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.email-form input {
  flex: 1 1 240px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 999px;
  font: inherit;
}
.email-form input:focus { outline: none; border-color: var(--accent); }

.plan { margin-top: 28px; }
.plan h2 { margin-bottom: 16px; }
.drill-list { display: grid; gap: 12px; }
.drill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.drill .module {
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.drill .name { font-size: 17px; font-weight: 600; margin: 2px 0 6px; }
.drill .why, .drill .how { font-size: 14px; color: var(--text-dim); margin: 2px 0; }
.drill .how { color: var(--text); }

a.drill, a.drill:hover {
  text-decoration: none;
  color: var(--text);
}
a.drill {
  display: block;
  transition: transform 80ms ease, border-color 120ms ease, background 120ms ease;
}
a.drill:hover {
  border-color: var(--border);
  background: var(--surface);
  transform: translateY(-1px);
}
.drill .drill-cta {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-2);
  letter-spacing: 0.02em;
}

/* Pro teaser cards in the plan — visually distinct + labeled */
.pro-picks { margin-top: 36px; }
.pro-picks .hint { color: var(--text-dim); margin: 4px 0 14px; max-width: 540px; }
.pro-pick-list { display: grid; gap: 12px; }
.drill.drill-pro {
  border-color: rgba(200, 29, 37, 0.35);
  background: linear-gradient(180deg, rgba(200, 29, 37, 0.06), transparent);
}
.drill.drill-pro:hover {
  border-color: rgba(200, 29, 37, 0.55);
  background: linear-gradient(180deg, rgba(200, 29, 37, 0.1), transparent);
}
.pro-badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.12em;
  background: rgba(200, 29, 37, 0.18);
  color: var(--accent, #ff5a5f);
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
  font-weight: 700;
}

a.day-cell {
  text-decoration: none;
  display: block;
  transition: border-color 120ms ease, background 120ms ease;
}
a.day-cell:hover {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

/* ---- tier gating ---- */
.pro-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  vertical-align: 2px;
}
.drill-card-pro {
  position: relative;
  /* Locked state — readable so users see what they're missing, but visibly
     inaccessible. Hover surfaces the unlock CTA. */
}
.drill-card-pro .dr-name,
.drill-card-pro .dr-summary {
  opacity: 0.55;
}
.drill-card-pro::after {
  content: "🔒  Upgrade to unlock";
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(200, 29, 37, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(200, 29, 37, 0.3);
}
.drill-card-pro:hover { border-color: rgba(200, 29, 37, 0.5); }

.quota-line {
  margin: 0 0 16px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 13px;
}
.quota-line.quota-walled {
  background: rgba(200, 29, 37, 0.08);
  border-color: rgba(200, 29, 37, 0.3);
  color: var(--text);
}

.paywall {
  background: linear-gradient(135deg, rgba(200, 29, 37, 0.10), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(200, 29, 37, 0.25);
  border-radius: 12px;
  padding: 24px 26px;
}
.paywall .kicker { color: var(--accent); }

.upgrade-cta {
  display: block;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.12s;
}
.upgrade-cta:hover { opacity: 0.92; color: #fff; }

/* ---- coach chat ---- */
.coach-page main { max-width: 760px; }
.coach-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}
.chat-thread {
  min-height: 240px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-thread:empty::before {
  content: "Your conversation will appear here. Pick a starter below or type a message.";
  color: var(--text-dim);
  font-size: 14px;
  display: block;
  text-align: center;
  padding: 32px 12px;
}
.chat-msg {
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.55;
  max-width: 85%;
  word-wrap: break-word;
}
.chat-msg p { margin: 0 0 8px; }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-msg-user {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.chat-msg-user a { color: #fff; }
.chat-msg-assistant {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
}
.chat-typing .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  display: inline-block;
  animation: chat-bounce 1.2s infinite;
}
.chat-typing .dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-bounce {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
.ref-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(200, 29, 37, 0.18);
  border: 1px solid rgba(200, 29, 37, 0.4);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-decoration: none;
  margin: 0 2px;
  vertical-align: 1px;
  white-space: nowrap;
}
.ref-pill:hover {
  background: rgba(200, 29, 37, 0.3);
  color: #fff;
}
.chat-msg-user .ref-pill {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}
.starter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.starter-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
  font-family: inherit;
}
.starter-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}
.chat-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.chat-form textarea {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  font: inherit;
  resize: none;
  min-height: 48px;
  line-height: 1.5;
}
.chat-form textarea:focus { outline: none; border-color: var(--accent); }
.chat-form button { align-self: flex-end; }

/* ---- prescribed warm-up card on dashboard ---- */
.prescribed-card {
  display: block;
  background: linear-gradient(135deg, rgba(200, 29, 37, 0.10), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(200, 29, 37, 0.25);
  border-radius: 14px;
  padding: 20px 22px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.1s;
}
.prescribed-card:hover {
  border-color: rgba(200, 29, 37, 0.55);
  transform: translateY(-1px);
  color: var(--text);
}
.prescribed-card .prescribed-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.prescribed-card .prescribed-dur {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.prescribed-card .prescribed-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.prescribed-card .prescribed-summary {
  font-size: 15px;
  color: var(--text);
  margin: 0 0 10px;
  line-height: 1.5;
}
.prescribed-card .prescribed-reason {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

/* ---- warm-ups ---- */
.warmup-target {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(200, 29, 37, 0.15);
  color: var(--accent);
  border: 1px solid rgba(200, 29, 37, 0.3);
}
.warmup-steps {
  margin: 0 0 12px;
  padding-left: 22px;
  display: grid;
  gap: 6px;
}
.warmup-steps li {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}
.warmup-progress {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 16px;
}
.warmup-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s linear;
}
.warmup-step-counter {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.warmup-timer {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  text-align: center;
  margin: 24px 0 16px;
}

/* ---- topic list (unscripted drill prompts) ---- */
.topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.topic-list li {
  background: var(--surface-2);
  border-left: 3px solid var(--accent-2);
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.55;
}

/* ============================================================
   MOBILE — phones (≤640px). Tightens padding, lowers type
   sizes, ensures buttons hit the 44px touch-target minimum.
   ============================================================ */
@media (max-width: 640px) {
  :root { --maxw: 100%; }
  body { font-size: 15px; }

  main { padding: 24px 16px 64px; }

  .hdr { padding: 14px 16px; }
  .brand { font-size: 16px; }
  .nav a { margin-left: 12px; font-size: 13px; }

  h1 { font-size: 26px; line-height: 1.15; }
  h2 { font-size: 17px; }

  .audit-hero { margin-bottom: 20px; }
  .audit-card { padding: 18px; border-radius: 12px; }
  .card-step + .card-step { margin-top: 20px; padding-top: 20px; }
  .paragraph { padding: 14px 16px; font-size: 16px; }

  .btn { padding: 14px 22px; min-height: 48px; }
  .btn-record { padding: 16px 22px; }
  .rec-actions { flex-direction: column; }
  .rec-actions .btn { width: 100%; }

  /* Dashboard tightening */
  .dash-hero h1 { font-size: 26px; }
  .stat-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 28px; }
  .stat-card .label { font-size: 11px; }
  .reaudit-banner { padding: 14px 16px; }
  .reaudit-banner strong { font-size: 16px; }
  .reaudit-banner .btn { width: 100%; }

  .dash-block-head { gap: 8px; }
  .dash-block-head .btn { width: 100%; }

  /* Drill cards: full width on phone */
  .drill-grid { grid-template-columns: 1fr; gap: 10px; }
  .drill-card { padding: 14px 16px; }
  .drill-card .dr-name { font-size: 16px; }
  .drill-card .dr-summary { font-size: 13px; }

  /* Score cards: 2 per row, slightly tighter */
  .scoreboard { grid-template-columns: 1fr 1fr; gap: 10px; }
  .score-card { padding: 12px; }
  .score-card .value { font-size: 26px; }
  .score-card .label { font-size: 11px; }
  .score-card .prev-line { font-size: 11px; }

  /* Headline (results page) */
  .headline-card { padding: 18px 20px; }
  .headline-card .index { font-size: 44px; gap: 6px; flex-wrap: wrap; }
  .headline-card .index small { font-size: 14px; }
  .delta-pill { margin-left: 8px; font-size: 12px; padding: 3px 9px; }

  /* Email gate */
  .email-gate { padding: 18px; }
  .email-form { flex-direction: column; gap: 8px; }
  .email-form input,
  .email-form .btn { width: 100%; }

  /* Plan rendering */
  .drill { padding: 14px 16px; }
  .drill .name { font-size: 16px; }
  .week-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .day-cell { padding: 8px 6px; font-size: 11px; }

  /* Result panel on drill page */
  .result-row { gap: 16px; }
  .result-num span { font-size: 48px; }
  .result-note { padding: 14px 16px; font-size: 14px; }

  /* Auth pages */
  .auth-card { padding: 22px; }
  .auth-card h1 { font-size: 24px; }
  .field input { padding: 13px 14px; min-height: 48px; }

  /* Footer */
  .site-footer { padding: 24px 16px 36px; flex-direction: column; align-items: flex-start; }
  .site-footer nav a { margin-left: 0; margin-right: 14px; }

  /* Pause marker fits better on small text */
  .pause-marker { font-size: 11px; padding: 2px 9px; }

  /* Topic list */
  .topic-list li { padding: 12px 14px; font-size: 15px; }
}

/* Very small (≤380px, like iPhone SE) */
@media (max-width: 380px) {
  .stat-row { grid-template-columns: 1fr; }
  .scoreboard { grid-template-columns: 1fr 1fr; }
  .week-grid { grid-template-columns: repeat(2, 1fr); }
  .nav a { margin-left: 10px; font-size: 12px; }
}

/* ============================================================
   APP SHELL — sidebar + main, used on authenticated pages.
   Modeled directly after PLAI's hub.html structure.
   ============================================================ */

body.app-shell {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
}

#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  color: var(--text);
  text-decoration: none;
}
.sidebar-brand:hover { opacity: 0.9; color: var(--text); }

/* Brand mark — the SVG carries its own gradient + rounded-square frame, so
   this class is just a sizing wrapper. Used inline as <img class="brand-mark"
   src="/logo-icon.svg"> or inside <span class="brand-mark"><img …/></span>. */
.brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: block;
}
img.brand-mark { object-fit: contain; }
.brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 12px 10px 6px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  line-height: 1.3;
  margin-bottom: 1px;
}
.nav-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav-btn.active {
  background: rgba(200, 29, 37, 0.15);
  color: var(--text);
}
.nav-btn.active .nav-icon {
  color: var(--accent);
}
.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-btn:hover .nav-icon { color: var(--text-muted); }

.sidebar-footer {
  padding: 10px 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.account-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 4px 4px 6px;
}

.account-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.account-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 2px;
  word-break: break-word;
}
.account-meta {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
  word-break: break-word;
  margin-bottom: 2px;
}
.account-tier-pill {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(200, 29, 37, 0.15);
  border: 1px solid rgba(200, 29, 37, 0.3);
  color: var(--accent);
}
.sign-out-btn {
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.sign-out-btn:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--text-dim);
}

/* App-shell main area */
.app-main {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--sidebar-bg);
  flex-shrink: 0;
  gap: 12px;
}
.app-topbar-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Hide old header on app-shell pages — sidebar replaces it. */
body.app-shell .hdr { display: none; }
/* Footer is also redundant inside the app shell. */
body.app-shell .site-footer { display: none; }

/* Main content area inside app-shell uses normal main padding. */
body.app-shell main {
  padding: 32px 28px 56px;
  max-width: var(--maxw);
}
body.app-shell.wide-page main { max-width: 1200px; }

/* Sidebar toggle (hamburger) — only visible on mobile */
.sidebar-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}
.sidebar-toggle:hover { background: var(--surface); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9;
}
.sidebar-overlay.open { display: block; }

@media (max-width: 768px) {
  body.app-shell { flex-direction: column; }
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 100;
    border-right: 1px solid var(--border);
  }
  #sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }
  .app-topbar { padding: 12px 16px; }
  body.app-shell main { padding: 20px 16px 56px; }
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 18px;
}
.day-cell {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  text-align: center;
}
.day-cell .d { color: var(--text-dim); font-size: 11px; }
.day-cell .f { font-weight: 600; margin-top: 4px; }
.day-cell .m { color: var(--text-dim); font-size: 11px; margin-top: 2px; }

.closing-note {
  margin-top: 24px;
  font-style: italic;
  color: var(--text-dim);
  text-align: center;
}

/* ---- landing ---- */
.landing-hero {
  padding-top: 24px;
  padding-bottom: 32px;
}
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.feature-list {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.feature-list li {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
}

/* ---- auth pages (login, signup) — PLAI-style centered card ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
  text-align: center;
}
.auth-brand .brand-mark {
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
}
.auth-brand .brand-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.auth-card h1 { font-size: 24px; margin: 4px 0 6px; text-align: center; }
.auth-card .sub { font-size: 14px; margin-bottom: 22px; text-align: center; }

.stacked-form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field span { color: var(--text-dim); font-size: 13px; font-weight: 500; }
.field span small { color: var(--text-dim); font-weight: 400; opacity: 0.7; }
.field input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font: inherit;
}
.field input:focus { outline: none; border-color: var(--accent); }

.form-error {
  color: var(--bad);
  font-size: 14px;
  margin: 0;
  padding: 10px 12px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: 8px;
}

.stacked-form .btn-primary { margin-top: 4px; }

/* ---- dashboard ---- */
.dashboard { padding-bottom: 64px; }
.dash-hero { margin-bottom: 24px; }
.dash-hero h1 { font-size: 32px; margin: 6px 0 8px; }
.dash-hero .sub { font-size: 16px; margin-bottom: 0; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.stat-card .label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.stat-card .value {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 8px 0 6px;
}
.stat-card .value small {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0;
  margin-left: 6px;
}
.stat-card .sub-label { color: var(--text-dim); font-size: 12px; }

.reaudit-banner, .sub-banner {
  background: linear-gradient(135deg, rgba(200,29,37,0.10), rgba(245,158,11,0.05));
  border: 1px solid rgba(200,29,37,0.25);
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.sub-banner strong {
  display: block;
  font-size: 18px;
}
.reaudit-banner strong {
  display: block;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-top: 4px;
}

.dash-block { margin-bottom: 32px; }
.dash-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}
.dash-block h2 { margin: 0; }

.callout-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  color: var(--text-dim);
}
.callout-card p { margin: 0; }

.history-list { display: grid; gap: 6px; }
.history-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
}
.history-row .hist-date { color: var(--text-dim); }
.history-row .hist-index { font-weight: 700; font-variant-numeric: tabular-nums; }
.history-row .hist-label { color: var(--text-dim); font-size: 12px; }

/* ---- drills ---- */
.drill-module { margin-bottom: 36px; }
.drill-module h2 { margin-bottom: 14px; }

/* Pages with grid catalogs (drills) get a wider container so we get 3 cards
   across instead of 2 with awkward empty tracks. */
body.wide-page main { max-width: 1080px; }

.drill-grid {
  display: grid;
  /* auto-fit collapses empty tracks so single-drill modules don't leave
     dead space. With 3-up at desktop and graceful collapse to 1-up on phone. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 14px;
}
.drill-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  transition: transform 80ms ease, border-color 120ms ease, background 120ms ease;
}
.drill-card:hover {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text);
  transform: translateY(-1px);
}
.drill-card.completed {
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.04);
}
.drill-card .module-tag {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.drill-card .dr-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 6px 0 6px;
}
.drill-card .dr-summary {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 12px;
  flex-grow: 1;
}
.drill-card .dr-meta {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.done-badge {
  display: inline-block;
  background: rgba(74, 222, 128, 0.15);
  color: var(--good);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* drill page result panel */
.result-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: start;
  margin: 8px 0 20px;
}
.result-num {
  text-align: center;
  min-width: 130px;
}
.result-num span {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.result-num small {
  display: block;
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 4px;
}
.trend {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
}
.trend-first { background: rgba(154,163,173,0.15); color: var(--text-dim); }
.trend-up    { background: rgba(74,222,128,0.15);  color: var(--good);     }
.trend-flat  { background: rgba(250,204,21,0.15);  color: var(--warn);     }
.trend-down  { background: rgba(248,113,113,0.15); color: var(--bad);      }

.result-note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
}

.result-checks { margin-top: 16px; }
.result-checks h3 { font-size: 14px; color: var(--text-dim); margin: 0 0 8px; }
.result-checks ul { list-style: none; margin: 0; padding: 0; }
.result-checks li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.45;
}
.result-checks .check-score { color: var(--accent-2); font-variant-numeric: tabular-nums; }

@media (max-width: 540px) {
  .result-row { grid-template-columns: 1fr; }
  .result-num { text-align: left; min-width: 0; }
}

/* ---- shared site footer ---- */
.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 24px 48px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 12px;
}
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--text); }
.site-footer nav a { margin-left: 16px; }

/* Inline text button (e.g. "Email me a sign-in link" on the login page) */
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent-2);
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:disabled { opacity: 0.6; cursor: default; }

/* ---- imitation drills: pitch shapes ---- */
.contour-svg { display: block; width: 100%; max-width: 640px; height: auto; margin: 0 0 8px; }
.contour-target { fill: none; stroke: var(--accent-2); stroke-width: 3; stroke-dasharray: 6 5; stroke-linejoin: round; }
.contour-actual { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; }
.contour-word { fill: var(--text-dim); font-size: 12px; text-anchor: middle; }
.contour-word.marked { fill: var(--accent); font-weight: 700; }
.live-trace { margin-top: 12px; }
.live-trace canvas {
  width: 100%;
  height: 140px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.result-checks li { flex-wrap: wrap; }
.result-checks li .contour-svg { flex-basis: 100%; order: 3; margin: 8px 0 0; }
.result-checks .contour-key { flex-basis: 100%; order: 4; font-size: 12px; color: var(--text-dim); }
