/* The Room — cards between stages, the translation, the argument, sources. */

/* ---------- Overlay cards ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  padding: 1rem;
  background: rgba(246, 242, 235, 0.9);
  animation: fade 0.2s ease both;
}
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.card {
  width: min(660px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: clamp(1.4rem, 3.5vw, 2.3rem);
  background: var(--surface);
  border: 1px solid var(--soft-line);
  border-radius: 20px;
  box-shadow: 0 24px 60px -30px rgba(40, 30, 10, 0.45);
  animation: rise 0.28s var(--ease) both;
}
.card:focus { outline: none; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.card-eyebrow {
  margin: 0 0 0.6rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--blue);
}
.card-eyebrow.is-caught { color: var(--amber); }
.card h2 {
  margin: 0 0 0.9rem; font-size: clamp(1.45rem, 3vw, 1.95rem); font-weight: 700;
  line-height: 1.12; letter-spacing: -0.03em;
}
:where(.card) p { margin: 0 0 0.85rem; font-size: 1rem; line-height: 1.6; color: #3a3a3c; }
.card .card-small { font-size: 0.82rem; color: var(--muted); }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1.3rem; }
.card-art { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto 1rem; }

/* chain of predictions */
.chain { list-style: none; margin: 0.4rem 0 1.1rem; padding: 0; display: grid; gap: 0.4rem; }
.chain li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.55rem;
  padding: 0.5rem 0.7rem; border-radius: 12px; background: #fbf8f2; border: 1px solid #eee5d6;
  font-size: 0.86rem; color: var(--warm-muted);
}
.chain .glyph { width: 30px; height: 30px; color: var(--glyph-ink); }
.chain-arrow { color: var(--muted); }
.chain-end { font-weight: 600; color: var(--glyph-ink); font-size: 0.8rem; }
.chain-why { flex: 1 1 12rem; }
.chain-why strong { color: var(--glyph-ink); font-weight: 600; }
.chain-why .miss { color: #8e3b12; font-weight: 600; }

/* compare panels in insight cards */
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.6rem; margin: 0.4rem 0 1.1rem; }
.compare-item { padding: 0.75rem 0.9rem; border-radius: 14px; background: #fbf8f2; border: 1px solid #eee5d6; color: var(--glyph-ink); }
.compare-label { display: block; margin-bottom: 0.35rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--warm-muted); }
.compare-item .glyph { width: 28px; height: 28px; }
.compare-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.compare-arrow { color: var(--muted); font-size: 0.85rem; }
.score-chip {
  display: inline-flex; align-items: baseline; gap: 0.3rem;
  margin-left: auto; padding: 0.2rem 0.6rem; border-radius: 999px;
  background: var(--amber-soft); color: var(--amber); font-size: 0.82rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* checklist */
.checklist { list-style: none; margin: 0.2rem 0 1rem; padding: 0; display: grid; gap: 0.45rem; }
.checklist li {
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr); gap: 0.6rem; align-items: baseline;
  padding: 0.65rem 0.85rem; border-radius: 12px; background: #fbf8f2; border: 1px solid #eee5d6;
  font-size: 0.95rem; line-height: 1.45;
}
.checklist-pts { font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }
.checklist .is-missing { background: transparent; border-style: dashed; color: var(--muted); }

/* tally animation in the stage II card */
.tally-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0.4rem; margin: 0.3rem 0 1rem; }
.tally-cell { display: flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.5rem; border-radius: 10px; background: #fbf8f2; color: var(--glyph-ink); }
.tally-cell .glyph { width: 22px; height: 22px; flex: none; }
.tally-cell .tally { height: 14px; }

/* ---------- Reading pages (stages IV and V) ---------- */
.page {
  min-height: 0; overflow-y: auto;
  background: var(--surface);
}
.page[hidden] { display: none; }
.page:focus { outline: none; }
.page-inner { max-width: 860px; margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem) 4rem; }
.page-eyebrow { margin: 0 0 0.6rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--blue); }
.page h2 { margin: 0 0 0.8rem; font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 700; line-height: 1.08; letter-spacing: -0.035em; max-width: 22ch; }
.page h3 { margin: 2.6rem 0 0.7rem; font-size: clamp(1.25rem, 2.6vw, 1.55rem); font-weight: 600; line-height: 1.2; letter-spacing: -0.025em; }
:where(.page) p { margin: 0 0 0.95rem; font-size: 1.04rem; line-height: 1.65; color: #3a3a3c; max-width: 66ch; }
:where(.page) .lede { font-size: 1.15rem; color: var(--muted); }

/* probes */
.probe { margin: 1.6rem 0 0; padding: 1.2rem; border-radius: var(--radius); background: var(--paper) var(--grain); border: 1px solid var(--paper-edge); }
.probe-q { margin: 0 0 0.8rem; font-size: 1.05rem; color: var(--glyph-ink); }
.probe-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 60px)); gap: 0.45rem; }
.probe-grid .tile { cursor: pointer; }
.probe-grid .tile[aria-pressed="true"].is-right { border-color: #2e7d4f; box-shadow: 0 0 0 3px rgba(46, 125, 79, 0.18); }
.probe-grid .tile[aria-pressed="true"].is-wrong { border-color: #b84a1a; box-shadow: 0 0 0 3px rgba(184, 74, 26, 0.15); }
.probe-grid .tile.is-answer { border-color: #2e7d4f; box-shadow: 0 0 0 3px rgba(46, 125, 79, 0.18); }
.probe-result { display: flex; gap: 0.7rem; align-items: center; margin: 0.9rem 0 0; font-size: 0.95rem; line-height: 1.5; color: var(--glyph-ink); }
.probe-result .glyph { width: 34px; height: 34px; flex: none; }
.probe-result:focus { outline: none; }
.probe-result:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 8px; }

/* transcript */
.transcript { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; gap: 0.9rem; }
.exchange {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.9rem;
  padding: 1rem; border-radius: var(--radius); border: 1px solid var(--soft-line);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s var(--ease);
}
.exchange.is-shown { opacity: 1; transform: none; }
.side { display: grid; gap: 0.35rem; align-content: start; }
.side-who { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.side .glyph-row .glyph { width: 26px; height: 26px; color: var(--glyph-ink); }
.side-en { margin: 0; font-size: 1.02rem; line-height: 1.45; color: var(--ink); font-weight: 500; }
.side-gloss { margin: 0; font-size: 0.8rem; color: var(--muted); }
.side--you { padding-left: 0.9rem; border-left: 2px solid #eee5d6; }
.side--you .side-en { color: #3a3a3c; }
.flag {
  justify-self: start; margin-top: 0.2rem; padding: 0.2rem 0.6rem; border-radius: 999px;
  background: var(--amber-soft); color: var(--amber); font-size: 0.78rem; font-weight: 600;
}
.exchange .score-chip { margin-left: 0; justify-self: start; background: var(--alt); color: var(--muted); }

/* where a reply came from, and whether it answered */
.vias { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.via {
  padding: 0.12rem 0.5rem; border-radius: 999px; border: 1px solid var(--line);
  font-size: 0.72rem; font-weight: 600; color: var(--muted); background: var(--surface);
}
.via--ledger { border-color: rgba(211, 138, 31, 0.6); background: #fffaf0; color: var(--amber); }
.via--repeat { border-color: rgba(184, 74, 26, 0.45); background: rgba(184, 74, 26, 0.06); color: #8e3b12; }
.via--rulebook { border-color: rgba(0, 94, 162, 0.3); background: var(--blue-soft); color: var(--blue); }
.side-marks { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.side-marks .score-chip { justify-self: auto; }
.answer-mark { padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.answer-mark.is-yes { background: rgba(46, 125, 79, 0.1); color: #22663f; }
.answer-mark.is-no { background: rgba(184, 74, 26, 0.08); color: #8e3b12; }
.side-shortcut {
  margin: 0.25rem 0 0; padding: 0.5rem 0.7rem; border-radius: 10px;
  background: #fbf8f2; border: 1px dashed #e2d6c2;
  font-size: 0.84rem; line-height: 1.45; color: var(--warm-muted);
}

/* the judge's score beside the thing it never checked */
.versus { width: 100%; margin: 1.6rem 0 0.6rem; border-collapse: separate; border-spacing: 0; }
.versus th, .versus td { background: var(--alt); }
.versus thead tr > :first-child { border-top-left-radius: var(--radius); }
.versus thead tr > :last-child { border-top-right-radius: var(--radius); }
.versus tbody tr:last-child > :first-child { border-bottom-left-radius: var(--radius); }
.versus tbody tr:last-child > :last-child { border-bottom-right-radius: var(--radius); }
.versus caption { caption-side: top; text-align: left; padding: 0 0 0.6rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--warm-muted); }
.versus th, .versus td { padding: 0.75rem 1rem; text-align: left; vertical-align: middle; }
.versus thead th { font-size: 0.78rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--soft-line); }
.versus tbody th { font-size: 0.9rem; font-weight: 600; color: var(--ink); width: 40%; }
.versus tbody tr + tr > * { border-top: 1px solid var(--soft-line); }
.versus .stat-num { font-size: 1.6rem; }

/* where to go next */
.next { margin-top: 2.4rem; }
.next h3 { margin-top: 0; }
.next-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.8rem; }
.next-card {
  display: grid; gap: 0.35rem; height: 100%; padding: 1.1rem 1.2rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  color: var(--ink); text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.next-card:hover { border-color: var(--blue); background: var(--blue-soft); }
.next-title { font-size: 1.05rem; font-weight: 600; color: var(--blue); }
.next-text { font-size: 0.92rem; line-height: 1.5; color: #3a3a3c; }

.final-note {
  margin: 1.8rem 0 0; padding: 1.4rem; border-radius: var(--radius);
  background: var(--paper) var(--grain); border: 1px solid var(--paper-edge); color: var(--glyph-ink);
}
.final-note .glyph { width: 34px; height: 34px; }
.final-kicker { margin: 0 0 0.6rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--amber); }
.final-en { margin: 0.7rem 0 0; font-size: 1.3rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.35; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.6rem; margin: 1.6rem 0; }
.stat { padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--alt); }
.stat-num { display: block; font-size: 2rem; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.84rem; color: var(--muted); line-height: 1.4; }

/* argument */
.reply-cards { display: grid; gap: 0.8rem; margin-top: 1rem; }
.reply-card { border: 1px solid var(--soft-line); border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.reply-card h4 { margin: 0 0 0.7rem; font-size: 1.08rem; font-weight: 600; letter-spacing: -0.015em; }
.reply-card dl { margin: 0; display: grid; gap: 0.65rem; }
.reply-card dt { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--blue); }
.reply-card dd { margin: 0.15rem 0 0; font-size: 0.98rem; line-height: 1.55; color: #3a3a3c; }

.vote { margin-top: 1.4rem; padding: 1.3rem; border-radius: var(--radius); background: var(--alt); }
.vote h4 { margin: 0 0 0.8rem; font-size: 1.08rem; font-weight: 600; }
.vote-options { display: grid; gap: 0.45rem; }
.vote-option {
  display: block; width: 100%; padding: 0.75rem 1rem; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  font-size: 0.96rem; line-height: 1.4; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.vote-option:hover { border-color: var(--blue); }
.vote-option[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); font-weight: 600; }
.vote-follow { margin: 1rem 0 0; padding: 1rem 1.1rem; border-radius: 12px; background: var(--surface); border-left: 3px solid var(--blue); font-size: 1rem; line-height: 1.55; }
.vote-follow[hidden] { display: none; }
.vote-saved { margin: 0.6rem 0 0; font-size: 0.78rem; color: var(--muted); }

.today { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.8rem; margin-top: 1rem; }
.today-card { padding: 1.2rem 1.3rem; border-radius: var(--radius); border: 1px solid var(--soft-line); }
.today-card:last-child { background: var(--alt); border-color: transparent; }
.today-kicker { margin: 0 0 0.3rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--blue); }
.today-card h4 { margin: 0 0 0.6rem; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.015em; }
.today-card p { font-size: 0.94rem; line-height: 1.55; }

.closing {
  margin: 3rem 0 0; padding: clamp(1.4rem, 4vw, 2.4rem);
  border-radius: 20px; background: var(--paper) var(--grain); border: 1px solid var(--paper-edge);
}
.closing-kicker { margin: 0 0 0.8rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--amber); }
.closing-text { margin: 0; font-size: clamp(1.2rem, 2.6vw, 1.55rem); font-weight: 600; line-height: 1.4; letter-spacing: -0.02em; color: var(--glyph-ink); max-width: none; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.6rem; }

/* ---------- Sources drawer ---------- */
.drawer-scrim { position: absolute; inset: 0; z-index: 25; background: rgba(0, 0, 0, 0.18); }
.drawer-scrim[hidden] { display: none; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 26;
  width: min(440px, 100%); overflow-y: auto;
  padding: 1.5rem 1.4rem 2rem;
  background: var(--surface); box-shadow: -20px 0 50px -30px rgba(0, 0, 0, 0.45);
  animation: drawer-in 0.25s var(--ease) both;
}
.drawer[hidden] { display: none; }
.drawer:focus { outline: none; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.drawer-head h2 { margin: 0; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.source-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.source-list a { color: var(--blue); font-weight: 500; font-size: 0.92rem; line-height: 1.45; text-decoration: none; }
.source-list a:hover { text-decoration: underline; }
.source-note { display: block; margin-top: 0.2rem; font-size: 0.82rem; color: var(--muted); line-height: 1.45; }
.drawer-note { margin: 1.3rem 0 0; padding-top: 1rem; border-top: 1px solid var(--soft-line); font-size: 0.82rem; line-height: 1.5; color: var(--muted); }

@media (max-width: 860px) {
  .probe-grid { gap: 0.3rem; grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .versus th, .versus td { padding: 0.6rem 0.65rem; }
  .versus tbody th { font-size: 0.82rem; }
  .versus .stat-num { font-size: 1.25rem; }
  .exchange { grid-template-columns: 1fr; }
  .side--you { padding-left: 0; padding-top: 0.7rem; border-left: 0; border-top: 1px solid #eee5d6; }
  :where(.card) p { font-size: 0.95rem; }
}
