:root {
  --bg: #f6f4ef; --surface: #ffffff; --text: #1d1f23; --muted: #5b6069;
  --accent: #2f6f5e; --accent-text: #ffffff; --border: #d9d5cc;
  --them: #ece8df; --you: #dcebe5; --warn-bg: #fff3d6; --warn-text: #5c4300;
  --bad: #8a2c1f; --good: #24604f;
  --tap: 44px; --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181c; --surface: #1f2228; --text: #eceae4; --muted: #a7abb3;
    --accent: #6fbfa7; --accent-text: #0e1a16; --border: #343841;
    --them: #2a2d34; --you: #20372f; --warn-bg: #3a3016; --warn-text: #f3dd9d;
    --bad: #f0a093; --good: #8fd6c0;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  /* -apple-system-body respects iOS Dynamic Type; rem sizes scale from it */
  font: -apple-system-body; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.45;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
main { max-width: 40rem; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
h1 { font-size: 1.15rem; margin: 0; text-align: center; flex: 1; }
h1:focus { outline: none; }
h2 { font-size: 1.3rem; margin: .25rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
.bar { display: flex; align-items: center; gap: 8px; min-height: 56px; position: sticky; top: 0; background: var(--bg); z-index: 2; }
.spacer { min-width: var(--tap); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.eyebrow { color: var(--muted); font-size: .85rem; margin: 0; }
.fineprint { color: var(--muted); font-size: .85rem; }
.notice { background: var(--warn-bg); color: var(--warn-text); border-radius: 10px; padding: 10px 12px; }
button { font: inherit; min-height: var(--tap); min-width: var(--tap); border-radius: 12px; cursor: pointer; touch-action: manipulation; }
button:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); color: var(--accent-text); border: 0; padding: 12px 18px; width: 100%; margin-top: 16px; font-weight: 600; }
.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 10px 16px; flex: 1; }
.ghost { background: none; border: 0; color: var(--accent); padding: 8px; }
.danger { background: none; border: 1px solid var(--bad); color: var(--bad); padding: 10px 16px; width: 100%; }
.transcript { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.bubble { padding: 10px 14px; border-radius: 16px; max-width: 85%; overflow-wrap: anywhere; }
.bubble.counterpart { background: var(--them); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.user { background: var(--you); align-self: flex-end; border-bottom-right-radius: 4px; }
.choices { border: 0; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 10px; }
.choices legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.choice { text-align: left; background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 12px 14px; }
.actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; gap: 10px;
  padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--bg); border-top: 1px solid var(--border);
}
.eval { background: var(--surface); border: 1px solid var(--border); border-left-width: 6px; border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.eval h3 { margin-top: 0; font-weight: 500; }
.band-solid { border-left-color: var(--good); }
.band-developing { border-left-color: var(--accent); }
.band-needs-work { border-left-color: var(--bad); }
.gate { color: var(--bad); font-weight: 600; }
.evidence { background: var(--them); border-radius: 6px; padding: 0 4px; }
.inference { color: var(--muted); font-size: .9rem; font-style: italic; }
.outcome.good { color: var(--good); font-weight: 600; }
table { border-collapse: collapse; width: 100%; margin-top: 8px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); font-weight: normal; }
thead th { font-weight: 600; }
summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
