/* ClassCards: restrained tabletop aesthetic. All text/background pairs meet WCAG 2.2 AA (4.5:1). */
:root {
  --table: #1c2626;
  --table-2: #233131;
  --chalk: #e9e4d8;
  --chalk-dim: #a9b3ad;
  --chalk-faint: #93a09a;
  --card: #f6f1e6;
  --card-2: #ece5d6;
  --paper: #fffdf8;
  --line: #ddd3bf;
  --ink: #1f1d1a;
  --ink-2: #4c4840;
  --ink-3: #665f53;

  /* Card categories (spec palette) */
  --evidence: #1f6f6b;    /* teal / green */
  --mechanism: #2f5fa7;   /* blue: scientific concepts & mechanisms */
  --condition: #4f5f70;   /* neutral slate */
  --outcome: #6a5a48;     /* warm stone */
  --alt: #6b4a9e;         /* violet: alternative models */
  --prediction: #975a0c;  /* amber: challenges */
  --change: #84480a;      /* deep amber: the challenge card */

  --good: #4fae6a;  --good-bg: #e3f1e4; --good-ink: #24622f;
  --part: #d6a03a;  --part-bg: #f8edd3; --part-ink: #7a5512;
  --bad: #c65a4a;   --bad-bg: #f6e0db;  --bad-ink: #8a2f22;

  --gold: #e2b65a;
  --focus: var(--gold);
  --radius: 12px;
  --shadow-card: 0 1px 0 rgba(255,255,255,.6) inset, 0 2px 4px rgba(0,0,0,.22), 0 8px 18px rgba(0,0,0,.22);
  --shadow-lift: 0 1px 0 rgba(255,255,255,.6) inset, 0 6px 10px rgba(0,0,0,.25), 0 16px 28px rgba(0,0,0,.3);
  --ease: cubic-bezier(.2,.7,.2,1);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* Keep focused elements clear of the sticky header and fixed action bar (WCAG 2.4.11). */
html { scroll-padding-top: 76px; scroll-padding-bottom: 100px; }
body {
  min-height: 100vh;
  font-family: var(--sans); color: var(--chalk);
  background: radial-gradient(1200px 700px at 50% 30%, var(--table-2), var(--table) 70%) fixed, var(--table);
  -webkit-font-smoothing: antialiased; line-height: 1.45; overflow-x: hidden;
}
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { text-wrap: balance; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
/* Light surfaces get a blue focus ring so it stays visible against cream. */
.write, .reveal, .modal, .response, .coach { --focus: var(--mechanism); }
/* Card and panel rings sit on the dark table, so they stay gold and get a dark halo. */
button.card:focus-visible, .phenom:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; box-shadow: var(--shadow-lift), 0 0 0 6px rgba(0,0,0,.55); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed !important; left: 12px; top: 12px; width: auto; height: auto; clip: auto; z-index: 99; background: var(--gold); color: var(--ink); padding: 10px 14px; border-radius: 8px; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: center;
  padding: 8px 20px; min-height: 58px;
  background: rgba(20,28,28,.94); backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 600; font-size: 20px; letter-spacing: .2px; }
.brand-mark { width: 26px; height: 26px; position: relative; flex: none; }
.brand-mark i { position: absolute; width: 16px; height: 22px; border-radius: 3px; border: 1.5px solid var(--chalk); background: var(--table); }
.brand-mark i:first-child { left: 0; top: 2px; transform: rotate(-10deg); }
.brand-mark i:last-child { left: 8px; top: 1px; transform: rotate(8deg); background: var(--gold); border-color: var(--gold); }

.where { display: flex; align-items: center; gap: 16px; min-width: 0; justify-content: center; }
.where-now { margin: 0; display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 14px; }
.where-step { color: var(--gold); font-weight: 700; white-space: nowrap; display: none; }
.where-name { color: var(--chalk); font-family: var(--serif); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-track { display: flex; gap: 4px; margin: 0; padding: 0; }
.session-track li { list-style: none; font-size: 12px; color: var(--chalk-faint); padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.session-track li.done { color: var(--chalk-dim); }
.session-track li.done::before { content: "✓ "; color: var(--good); }
.session-track li.current { color: var(--ink); background: var(--chalk); font-weight: 600; }

.top-actions { display: flex; align-items: center; gap: 10px; }
.score-chip { position: relative; display: flex; align-items: baseline; gap: 6px; padding: 6px 14px; border-radius: 99px; background: rgba(255,255,255,.07); font-variant-numeric: tabular-nums; transition: transform .2s var(--ease); }
.score-chip b { font-family: var(--serif); font-size: 19px; color: var(--gold); }
.score-chip small { color: var(--chalk-faint); font-size: 12px; }
.score-chip.bump { transform: scale(1.08); }
.icon-btn { min-height: 44px; background: transparent; border: 1px solid rgba(255,255,255,.18); border-radius: 99px; padding: 0 16px; font-size: 13.5px; color: var(--chalk-dim); cursor: pointer; white-space: nowrap; }
.icon-btn:hover { color: var(--chalk); border-color: rgba(255,255,255,.35); }
.score-pop { position: absolute; right: 4px; top: -6px; color: var(--gold); font-weight: 700; font-size: 14px; animation: pop 1.1s var(--ease) forwards; pointer-events: none; }
@keyframes pop { 0% { opacity: 0; transform: translateY(6px);} 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-18px);} }

/* ---------- Layout ---------- */
.app { max-width: 1240px; margin: 0 auto; padding: 18px 20px 130px; }
.app:focus { outline: none; }
.play { display: grid; grid-template-columns: minmax(270px, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }

/* Action stepper */
.stepper { display: flex; margin: 0 0 12px; padding: 0; counter-reset: s; }
.stepper li { list-style: none; flex: 1; position: relative; padding: 8px 10px 8px 36px; font-size: 13px; color: var(--chalk-faint); border-bottom: 3px solid rgba(255,255,255,.08); transition: border-color .3s, color .3s; }
.stepper li::before { counter-increment: s; content: counter(s); position: absolute; left: 6px; top: 9px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; border: 1.5px solid currentColor; }
.stepper li b { display: block; letter-spacing: .12em; font-size: 11px; }
.stepper li > span { font-size: 12px; }
.stepper li.done { color: var(--chalk-dim); border-color: var(--good); }
.stepper li.done::before { content: "✓"; background: var(--good); border-color: var(--good); color: var(--table); }
.stepper li.current { color: var(--chalk); border-color: var(--gold); }
.stepper li.current::before { background: var(--gold); border-color: var(--gold); color: var(--table); }
.stepper li.locked { opacity: .45; }

/* Phenomenon panel */
.phenom {
  position: sticky; top: 74px;
  background: var(--card); color: var(--ink);
  border-radius: 16px; box-shadow: var(--shadow-card);
  overflow: hidden auto; max-height: calc(100vh - 160px); scrollbar-width: thin;
}
.phenom-head { padding: 12px 16px 8px; border-bottom: 1px solid var(--line); }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.eyebrow.on-dark { color: var(--chalk-faint); }
.phenom h2 { font-family: var(--serif); font-weight: 600; font-size: 21px; margin: 2px 0 0; line-height: 1.15; }
.phenom-body { padding: 12px 16px 16px; font-size: 14px; color: var(--ink-2); }
.phenom-body p { margin: 0 0 10px; }
.focus-q { margin: 0 0 12px !important; padding: 10px 12px; border-left: 3px solid var(--gold); background: #fbf6ea; font-family: var(--serif); font-size: 16px; line-height: 1.3; color: var(--ink); }
.art { display: block; width: 100%; height: auto; background: #efe8d8; border-bottom: 1px solid var(--line); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 5px 6px; text-align: right; border-bottom: 1px solid #e6dece; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { font-size: 11px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.table-cap { caption-side: top; text-align: left; font-size: 12px; color: var(--ink-3); padding-bottom: 2px; }
.assume { font-size: 12.5px; color: var(--ink-3); }
.alt-model { margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--alt); background: #f1ebf7; border-radius: 0 8px 8px 0; font-size: 14px; color: var(--ink); }
.alt-model .eyebrow { color: var(--alt); margin-bottom: 2px; }

/* Board */
.board { min-width: 0; }
.prompt-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.phase-title { font-family: var(--serif); font-weight: 500; font-size: 24px; margin: 0; white-space: nowrap; }
.phase-title:focus { outline: none; }
.prompt-row p { margin: 0; color: var(--chalk-dim); font-size: 14.5px; text-align: right; }

.coach {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start;
  background: #fdf8ec; color: var(--ink); border-radius: 12px; padding: 12px 8px 12px 14px; margin: 0 0 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); border-left: 4px solid var(--gold);
  animation: rise .35s var(--ease);
}
.coach-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); display: grid; place-items: center; font-family: var(--serif); font-weight: 700; color: var(--ink); }
.coach p { margin: 6px 0 0; font-size: 14px; }
.link-btn { min-height: 44px; background: none; border: 0; color: var(--ink-3); text-decoration: underline; cursor: pointer; font-size: 12.5px; padding: 0 8px; }

.felt {
  background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.06);
  border-radius: 18px; padding: 18px; box-shadow: inset 0 2px 10px rgba(0,0,0,.25);
}
.felt-single .slot-wrap { max-width: 340px; margin: 0 auto; }
.evidence-strip { font-size: 13.5px; color: var(--chalk-dim); margin: -4px 2px 16px; padding-left: 10px; border-left: 3px solid var(--evidence); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.evidence-strip .eyebrow { color: #7fc6c1; margin-right: 6px; }
.evidence-strip b { color: var(--chalk); font-weight: 600; }
.chain { display: grid; grid-template-columns: minmax(0,1fr) 26px minmax(0,1fr) 26px minmax(0,1fr); align-items: stretch; }
.chain .arrow { display: grid; place-items: center; color: var(--chalk-faint); font-size: 20px; }
.test-q { margin: 0 0 14px; font-family: var(--serif); font-size: 18px; color: var(--chalk); }
.test-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }

.slot {
  min-height: 168px; border-radius: var(--radius);
  border: 2px dashed rgba(255,255,255,.2);
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  position: relative; transition: border-color .2s, background .2s;
}
.slot-label { position: absolute; top: -10px; left: 12px; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; background: var(--table); padding: 0 6px; border-radius: 4px; z-index: 2; color: var(--chalk-dim); }
.slot-empty { text-align: center; color: var(--chalk-faint); font-size: 13px; padding: 16px; display: grid; gap: 6px; justify-items: center; }
.slot-glyph { font-size: 20px; opacity: .6; }
.slot:not(.filled) { min-height: 124px; }
.slot.filled { border-color: transparent; }
.slot.filled .slot-label { display: none; }
.slot.target { border-color: rgba(226,182,90,.75); background: rgba(226,182,90,.06); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { border-color: rgba(226,182,90,.35); } }
.slot[data-type="evidence"] .slot-label { color: #7fc6c1; }
.slot[data-type="condition"] .slot-label { color: #b9c5d2; }
.slot[data-type="mechanism"] .slot-label { color: #9fbdf0; }
.slot[data-type="outcome"] .slot-label { color: #d6c3ad; }
.slot[data-type="prediction"] .slot-label { color: #f0c27e; }

.explain-line { margin: 14px 2px 0; font-family: var(--serif); font-size: 16px; color: var(--chalk); }
.explain-line em { color: var(--gold); font-style: normal; }

/* ---------- Cards ---------- */
.card {
  position: relative; display: flex; flex-direction: column; text-align: left;
  width: 100%; min-height: 168px; height: 100%;
  background: var(--card); color: var(--ink);
  border: 0; border-radius: var(--radius); padding: 0; overflow: hidden;
  box-shadow: var(--shadow-card); cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), opacity .2s;
}
button.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
button.card:active { transform: translateY(-1px) scale(.99); }
.card.static { cursor: default; }
.card-band { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.card-band > span:first-child { flex: none; }
.card-band .glyph { font-size: 13px; letter-spacing: 0; }
.card-band .sub { opacity: .9; font-weight: 600; letter-spacing: .06em; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-family: var(--serif); font-weight: 600; font-size: 16.5px; line-height: 1.2; }
.card-text { font-size: 13.5px; color: var(--ink-2); line-height: 1.4; }
.card-foot { margin-top: auto; padding-top: 4px; font-size: 11px; font-weight: 600; color: var(--ink-3); letter-spacing: .05em; text-transform: uppercase; display: flex; align-items: center; gap: 5px; }
.card-foot.proposed::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--ink-3); }
.card.swap .card-foot { color: var(--prediction); }
.card.swap .card-foot::before { display: none; }

.t-evidence .card-band { background: var(--evidence); }
.t-condition .card-band { background: var(--condition); }
.t-mechanism .card-band { background: var(--mechanism); }
.t-outcome .card-band { background: var(--outcome); }
.t-prediction .card-band { background: var(--prediction); }
.t-change .card-band { background: repeating-linear-gradient(135deg, var(--change) 0 10px, #7a420a 10px 20px); }
.t-evidence { box-shadow: var(--shadow-card), inset 0 -3px 0 var(--evidence); }
.t-condition { box-shadow: var(--shadow-card), inset 0 -3px 0 var(--condition); }
.t-mechanism { box-shadow: var(--shadow-card), inset 0 -3px 0 var(--mechanism); }
.t-outcome { box-shadow: var(--shadow-card), inset 0 -3px 0 var(--outcome); }
.t-prediction { box-shadow: var(--shadow-card), inset 0 -3px 0 var(--prediction); }
.t-change { box-shadow: var(--shadow-card), inset 0 -3px 0 var(--change); }
.t-change .card-title { font-size: 17px; }

.card.enter { animation: deal .32s var(--ease); }
@keyframes deal { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Verdicts (text badge + outline, never color alone) */
.verdict { align-self: flex-start; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 99px; letter-spacing: .03em; animation: rise .3s var(--ease); }
.card.v-good { outline: 3px solid var(--good); outline-offset: 2px; }
.card.v-part { outline: 3px solid var(--part); outline-offset: 2px; }
.card.v-bad { outline: 3px solid var(--bad); outline-offset: 2px; }
.v-good .verdict { background: var(--good-bg); color: var(--good-ink); }
.v-part .verdict { background: var(--part-bg); color: var(--part-ink); }
.v-bad .verdict { background: var(--bad-bg); color: var(--bad-ink); }
.card-feedback { margin: 10px 0 0; padding: 9px 11px; border-radius: 10px; font-size: 13.5px; line-height: 1.4; background: rgba(255,255,255,.07); color: var(--chalk); animation: rise .3s var(--ease); }
.card-feedback.good { border-left: 3px solid var(--good); }
.card-feedback.part { border-left: 3px solid var(--part); }
.card-feedback.bad { border-left: 3px solid var(--bad); }
.slot-wrap { display: flex; flex-direction: column; min-width: 0; }
.more-feedback { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 0 14px; font-size: 13.5px; }
.more-feedback summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--chalk); font-weight: 600; }
.more-feedback p { margin: 0 0 12px; color: var(--chalk-dim); }
.more-feedback b { color: var(--chalk); }
.mini-verdict { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; margin: 0 4px; white-space: nowrap; }
.mini-verdict.good { background: var(--good-bg); color: var(--good-ink); }
.mini-verdict.part { background: var(--part-bg); color: var(--part-ink); }
.mini-verdict.bad { background: var(--bad-bg); color: var(--bad-ink); }

/* Hand */
.hand-wrap { margin-top: 20px; }
.hand-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--chalk-faint); margin: 0 4px 10px; }
.hand-label span:last-child { letter-spacing: 0; text-transform: none; font-weight: 500; font-size: 12.5px; text-align: right; }
.hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }
.hand .card { min-height: 150px; }
.hand-empty { color: var(--chalk-faint); font-size: 14px; padding: 18px; text-align: center; border: 1px dashed rgba(255,255,255,.14); border-radius: 12px; }

/* ---------- Writing ---------- */
.write { background: var(--card); color: var(--ink); border-radius: 14px; padding: 16px; box-shadow: var(--shadow-card); margin-top: 16px; }
.write label { display: block; font-family: var(--serif); font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.write-compact label { font-size: 15px; }
.help { font-size: 13px; color: var(--ink-3); margin: 0 0 10px; }
textarea {
  display: block; width: 100%; min-height: 110px; resize: vertical;
  font: 15px/1.5 var(--sans); color: var(--ink);
  background: var(--paper); border: 1px solid #cfc4ad; border-radius: 10px; padding: 10px 12px;
}
.write-compact textarea { min-height: 60px; }
textarea:focus-visible { outline: 3px solid var(--mechanism); outline-offset: 1px; border-color: transparent; }
.write .meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.submitted { white-space: pre-wrap; word-break: break-word; font: 15px/1.5 var(--sans); color: var(--ink); background: var(--paper); border: 1px solid #e3d9c4; border-left: 3px solid var(--ink-3); border-radius: 10px; padding: 10px 12px; margin: 0; }
.submitted-tag { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 6px; }
.rev { margin-top: 12px; }

/* ---------- Reveal / reflect ---------- */
.reveal { background: var(--card); color: var(--ink); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-card); margin-top: 16px; animation: rise .35s var(--ease); }
.reveal-h { font-family: var(--serif); font-size: 18px; font-weight: 600; margin: 2px 0 8px; }
.reveal-h:focus { outline: none; }
.reveal p { margin: 0 0 10px; font-size: 14.5px; color: var(--ink-2); }
.reveal .sci { border-left: 3px solid var(--mechanism); padding-left: 12px; color: var(--ink); font-size: 15px; margin: 0; }
.reveal-sci .eyebrow { color: var(--mechanism); }
.checklist { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 4px; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; padding: 4px 0; }
.checklist input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--mechanism); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.muted { color: var(--ink-3); font-size: 13px; font-style: italic; margin: 8px 0 0; }
.alt-judge { border: 0; padding: 0; margin: 8px 0 12px; }
.alt-judge legend { font-weight: 600; font-size: 14.5px; margin-bottom: 8px; padding: 0; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { min-height: 44px; display: flex; gap: 8px; align-items: center; font-size: 14px; padding: 0 14px; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; background: var(--paper); }
.pill:has(input:checked) { border-color: var(--alt); background: #f1ebf7; font-weight: 600; }
.pill input { accent-color: var(--alt); width: 18px; height: 18px; margin: 0; }
.revise { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.revise label { display: block; font-family: var(--serif); font-weight: 600; font-size: 16px; margin: 0 0 4px; }
.revise .opt { font-family: var(--sans); font-weight: 400; font-size: 13px; color: var(--ink-3); }
.revise textarea { min-height: 84px; }
.revise-row { display: flex; justify-content: flex-end; margin-top: 8px; }
.discuss { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: rgba(226,182,90,.1); border: 1px solid rgba(226,182,90,.35); animation: rise .4s var(--ease); }
.discuss-icon { width: 36px; height: 36px; border-radius: 50%; background: rgba(226,182,90,.2); display: grid; place-items: center; }
.discuss .eyebrow { color: var(--gold); }
.discuss p { margin: 4px 0 0; font-family: var(--serif); font-size: 16.5px; line-height: 1.35; color: var(--chalk); }

/* Transfer choices */
.xchoices { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.xchoices legend { padding: 0; }
.xchoice { min-height: 48px; display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12); cursor: pointer; transition: background .15s, border-color .15s; }
.xchoice:hover { border-color: rgba(255,255,255,.3); }
.xchoice.on { background: rgba(226,182,90,.14); border-color: var(--gold); }
.xchoice input { accent-color: var(--gold); width: 20px; height: 20px; margin: 0; flex: none; }

/* ---------- Action bar ---------- */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: rgba(16,22,22,.97); border-top: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(6px); }
.actionbar:empty { display: none; }
.actionbar-inner { max-width: 1240px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; }
.status { flex: 1; font-size: 14px; color: var(--chalk-dim); min-height: 20px; }
.status .good { color: var(--good); font-weight: 700; }
.status .part { color: var(--part); font-weight: 700; }
.status .bad { color: #e98676; font-weight: 700; }
.status .dim { color: var(--chalk-faint); }
.flash.warn { color: #f3c879; font-weight: 600; }
.flash.warn::before { content: "⚠ "; }
.btn {
  min-height: 48px; border: 0; border-radius: 99px; padding: 0 26px; font-weight: 700; font-size: 15px; cursor: pointer;
  background: var(--gold); color: #1d1a12; box-shadow: 0 4px 14px rgba(226,182,90,.25);
  transition: transform .12s, filter .15s, opacity .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; box-shadow: none; filter: none; transform: none; }
.btn.ghost { background: transparent; color: var(--chalk); border: 1px solid rgba(255,255,255,.3); box-shadow: none; }
.btn.small { min-height: 44px; padding: 0 18px; font-size: 14px; }
.btn.danger { color: #f0a597; border-color: rgba(233,134,118,.5); }
.btn.danger-fill { background: #b44c3d; color: #fff; box-shadow: none; }
.reveal .btn.ghost, .write .btn.ghost, .modal .btn.ghost { color: var(--ink); border-color: #bfb49d; }
.btn.nudge { animation: nudge .35s; }
@keyframes nudge { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* ---------- Screens (title / summary) ---------- */
.screen { max-width: 780px; margin: 28px auto 0; animation: rise .4s var(--ease); }
.screen.wide { max-width: 920px; }
.screen h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(34px, 6vw, 54px); line-height: 1.05; margin: 4px 0 10px; }
.screen h1:focus { outline: none; }
.screen .lede { font-size: 18px; color: var(--chalk-dim); margin: 0 0 24px; max-width: 60ch; }
.loop-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0 0 26px; padding: 0; list-style: none; }
.loop-cards .card { min-height: 140px; }
.screen-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.small-actions { margin-top: 14px; }
.fine { font-size: 13.5px; color: var(--chalk-faint); margin: 18px 0 0; max-width: 70ch; }
.device-note { display: grid; grid-template-columns: 26px 1fr; gap: 10px; margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); }
.device-note p { margin: 0; font-size: 13.5px; color: var(--chalk-dim); }
.device-note b { color: var(--chalk); }

.sum-h { font-family: var(--serif); font-weight: 500; font-size: 24px; margin: 26px 0 12px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.sum-h span { font-family: var(--sans); font-size: 13px; color: var(--chalk-faint); letter-spacing: .04em; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0 0 16px; }
.stat { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09); border-radius: 14px; padding: 14px; }
.stat .eyebrow { color: var(--chalk-faint); }
.stat b { display: block; font-family: var(--serif); font-size: 28px; color: var(--chalk); margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat b span { font-size: 16px; color: var(--chalk-faint); }
.stat small { color: var(--chalk-faint); font-size: 12px; }
.meter { height: 6px; border-radius: 99px; background: rgba(255,255,255,.1); margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.note { background: rgba(226,182,90,.08); border: 1px solid rgba(226,182,90,.3); color: var(--chalk); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin: 0 0 8px; }
.responses { display: grid; gap: 14px; margin-bottom: 24px; }
.response { background: var(--card); color: var(--ink); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-card); }
.response h3 { margin: 0 0 8px; font-family: var(--serif); font-size: 17px; }
.response .muted:first-of-type { margin-top: 0; margin-bottom: 8px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8,12,12,.62); display: grid; place-items: center; z-index: 40; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--card); color: var(--ink); border-radius: 16px; max-width: 520px; width: 100%; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: rise .25s var(--ease); }
.modal h2 { font-family: var(--serif); margin: 0 0 8px; font-size: 22px; }
.modal p { color: var(--ink-2); font-size: 14.5px; }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1279px) {
  .topbar nav { display: none; }
  .where { justify-content: flex-start; }
  .where-step { display: inline; }
}
@media (max-width: 1100px) {
  .play { grid-template-columns: minmax(250px, 300px) minmax(0, 1fr); gap: 18px; }
  .hand { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 900px) {
  .play { grid-template-columns: 1fr; }
  .phenom { position: static; max-height: none; display: grid; grid-template-columns: minmax(0, 260px) 1fr; }
  .phenom .art { grid-row: span 2; height: 100%; object-fit: cover; border-bottom: 0; border-right: 1px solid var(--line); }
  .where-name { font-size: 14px; }
}
@media (max-width: 720px) {
  .app { padding: 12px 16px 140px; }
  .topbar { padding: 6px 16px; gap: 10px; min-height: 54px; }
  .brand { font-size: 17px; }
  .brand > span:last-child { display: none; }
  .where-now { flex-direction: column; gap: 0; }
  .where-step { font-size: 12px; }
  .where-name { font-size: 13px; }
  .phenom { display: block; }
  .phenom .art { height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .chain { grid-template-columns: 1fr; gap: 18px; }
  .chain .arrow { transform: rotate(90deg); height: 12px; }
  .test-row { grid-template-columns: 1fr; }
  .stepper li { padding: 32px 2px 6px; text-align: center; }
  .stepper li::before { left: 50%; top: 5px; transform: translateX(-50%); }
  .stepper li b { font-size: 9.5px; letter-spacing: .06em; }
  .stepper li > span { display: none; }
  .slot, .card, .hand .card { min-height: 0; }
  .slot-empty { padding: 26px 16px; }
  .prompt-row { flex-direction: column; gap: 2px; }
  .prompt-row p { text-align: left; }
  .loop-cards, .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .hand { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hand-label { flex-direction: column; gap: 2px; }
  .hand-label span:last-child { text-align: left; }
  .card-title { font-size: 15px; }
  .card-text { font-size: 13px; }
  .actionbar-inner { padding: 8px 16px; gap: 10px; }
  .status { font-size: 13px; }
  .btn { padding: 0 18px; }
  .score-chip { padding: 6px 10px; }
  .score-chip small { display: none; }
}
@media (max-width: 480px) {
  .hand { grid-template-columns: 1fr; }
  .top-actions .icon-btn.optional { display: none; }
  .actionbar-inner { flex-direction: column; align-items: stretch; }
  .actionbar-inner .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print {
  body { background: #fff; color: #000; }
  .topbar, .actionbar, .screen-actions, .device-note { display: none !important; }
  .app { padding: 0; max-width: none; }
  .stat, .note { border-color: #999; color: #000; }
  .stat b, .stat .eyebrow, .sum-h, .sum-h span, .screen h1, .eyebrow.on-dark, .note { color: #000; }
  .response, .stat { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; }
}
