/* ==========================================================================
   ConceptForge War Room — dark boardroom aesthetic, zero build step.
   Grid layout, glassmorphism, CSS-only card flip and hourglass.
   ========================================================================== */

:root {
  --bg-0: #05070d;
  --bg-1: #080c16;
  --bg-2: #0d1424;
  --panel: rgba(18, 26, 44, 0.66);
  --panel-strong: rgba(13, 20, 36, 0.92);
  --stroke: rgba(150, 178, 230, 0.14);
  --stroke-strong: rgba(180, 205, 255, 0.28);
  --text: #e9eefb;
  --muted: #93a1c0;
  --faint: #667599;
  --gold: #e8b64c;
  --gold-soft: rgba(232, 182, 76, 0.16);
  --cyan: #4fd1c5;
  --violet: #8b7cff;
  --rose: #ff7a90;
  --ok: #4ad7a0;
  --danger: #ff6b6b;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  --seat-radius: 168px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, monospace;
  /* Viewport budget for the sticky Deliberation column.  main.js measures the
     real (possibly wrapped) topbar height into --stream-top; the 96px fallback
     = sticky topbar (10px offset + ~70px box) + the 16px stage gap. */
  --stream-top: 96px;
  --stream-bottom: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(139, 124, 255, 0.16), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, rgba(79, 209, 197, 0.12), transparent 55%),
    radial-gradient(900px 900px at 50% 120%, rgba(232, 182, 76, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }
p { margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

.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;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--gold); color: #131313; padding: 10px 16px; border-radius: 0 0 10px 0;
}
.skip-link:focus { left: 0; }

.glass {
  background: linear-gradient(160deg, rgba(28, 38, 62, 0.72), rgba(11, 17, 31, 0.72));
  border: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ layout */
.war-room {
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px clamp(10px, 2vw, 26px) 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
}

.topbar {
  position: sticky; top: 10px; z-index: 40;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 18px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.brand__mark {
  font-size: 26px; width: 46px; height: 46px; display: grid; place-items: center;
  border-radius: 14px; background: var(--gold-soft);
  border: 1px solid rgba(232, 182, 76, 0.35);
  box-shadow: 0 0 24px rgba(232, 182, 76, 0.18) inset;
}
.brand__text h1 { font-size: 19px; }
.brand__text h1 em { color: var(--gold); font-style: normal; }
.brand__mode { font-size: 12px; color: var(--muted); }

.topbar__stats { display: flex; gap: 20px; flex: 1 1 auto; flex-wrap: wrap; align-items: center; }
.stat { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--muted); }
.stat__label { text-transform: uppercase; letter-spacing: 0.09em; font-size: 10px; color: var(--faint); }
.stat__value { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat__sub { font-size: 11px; color: var(--faint); }
.stat--momentum { min-width: 190px; }
.meter {
  width: 110px; height: 7px; border-radius: 99px; overflow: hidden;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--stroke);
}
.meter__fill {
  display: block; height: 100%; width: 50%;
  background: linear-gradient(90deg, var(--rose), var(--gold) 55%, var(--ok));
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.topbar__right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.sessionbar { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sessionbar__picker {
  max-width: 230px; padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--stroke-strong); background: rgba(12, 19, 34, 0.85);
  color: var(--muted); font-size: 12px; cursor: pointer;
}
.sessionbar__picker:hover:not(:disabled) { border-color: var(--gold); }
.sessionbar__picker:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.sessionbar__picker:disabled { opacity: 0.5; cursor: default; }
.btn--new, .btn--leave, .btn--delete { white-space: nowrap; }
.btn--leave[hidden], .btn--delete[hidden] { display: none; }
.btn--delete { color: var(--danger); }
.btn--delete:hover:not(:disabled) { border-color: var(--danger); }
@media (max-width: 900px) {
  .topbar__right { width: 100%; flex-wrap: wrap; }
  .sessionbar { flex: 1 1 auto; min-width: 0; }
  .sessionbar__picker { flex: 1 1 auto; max-width: none; min-width: 0; }
}
.conn {
  display: inline-flex; align-items: center; gap: 7px; font-size: 11px;
  padding: 5px 11px; border-radius: 99px; border: 1px solid var(--stroke);
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em;
}
.conn__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.conn[data-state="online"] { color: var(--ok); border-color: rgba(74, 215, 160, 0.4); }
.conn[data-state="online"] .conn__dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.conn[data-state="connecting"] .conn__dot { background: var(--gold); animation: pulse 1.2s infinite; }
.conn[data-state="offline"] .conn__dot { background: var(--danger); }
.badge {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 99px; border: 1px solid var(--stroke-strong);
  background: rgba(79, 209, 197, 0.12); color: var(--cyan);
}

/* ==========================================================================
   UNIFIED 2-COLUMN TABLETOP
   The old grid declared five named areas but main.stage had six children, so
   #authenticPanel was auto-placed into an implicit third row (computed
   grid-area:auto), leaving two empty columns and mismatched neighbour heights.
   Here main.stage has exactly two explicitly placed children and .tafel has an
   explicit area for every direct child: no auto-placement remains.
   ========================================================================== */
.stage {
  display: grid; gap: 16px; align-items: stretch;
  grid-template-columns: minmax(0, 1.62fr) minmax(330px, 1fr);
  grid-template-areas: "tafel stream";
}
#tafelPanel { grid-area: tafel; }
#streamPanel { grid-area: stream; }
#tafelPanel, #streamPanel { min-width: 0; }

/* -- De Tafel: one glass surface, flat internal regions (no nested glass) -- */
.tafel {
  display: grid; gap: 14px; padding: 16px;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr);
  grid-template-areas:
    "head head"
    "rail rail"
    "table dock"
    "drawer drawer";
}
.tafel__head {
  grid-area: head; display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
}
.tafel__title { font-size: 16px; color: var(--gold); letter-spacing: .04em; }
.tafel__hint { font-size: 11px; color: var(--faint); margin-top: 2px; }
#boardPanel { grid-area: rail; }
#brigadePanel { grid-area: table; min-width: 0; }
#authenticPanel { grid-area: dock; min-width: 0; }
#materialsPanel { grid-area: drawer; }
#boardPanel, #brigadePanel, #authenticPanel, #materialsPanel {
  border-top: 1px solid var(--stroke); padding-top: 12px;
}

/* the single harmonised status / economy block */
.statusstrip { display: flex; align-items: center; gap: 16px 22px; flex-wrap: wrap; }
.statusstrip .stat { display: flex; align-items: baseline; gap: 8px; }
.statusstrip .stat--momentum { min-width: 168px; }

/* -- De Deliberatie: transcript scrolls inside, Jouw Zet stays docked ----- */
/* DIALOGUE SCROLL CONTAINER: the column owns its scroll, never the page. */
/* The whole column is a bounded flex box; it never grows with the dialogue. */
.stream {
  display: flex; flex-direction: column; gap: 14px; padding: 16px; min-width: 0;
  min-height: 0; overflow: hidden;
}
.stream__block { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* Sticky, viewport-bounded right column of the 2-column tabletop.  It stays
   pinned just below the topbar while De Tafel (much taller) scrolls the page,
   so the dialogue and the action dock never leave the screen. */
#streamPanel {
  position: sticky;
  top: var(--stream-top);
  align-self: start;                     /* defeat .stage { align-items: stretch } */
  height: calc(100vh - var(--stream-top) - var(--stream-bottom));
  max-height: calc(100vh - var(--stream-top) - var(--stream-bottom));
  display: flex; flex-direction: column; min-height: 0;
  overflow: hidden;
}
@supports (height: 100dvh) {
  /* dvh tracks the mobile URL bar without leaving a gap at the bottom. */
  #streamPanel {
    height: calc(100dvh - var(--stream-top) - var(--stream-bottom));
    max-height: calc(100dvh - var(--stream-top) - var(--stream-bottom));
  }
}

/* The dialogue band yields exactly the space the dock does not need. */
.stream__block--dialogue {
  flex: 1 1 auto; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
.stream__block--dialogue > .panel__head { flex: 0 0 auto; }
/* The dock never shrinks away; it scrolls internally only when the viewport
   is genuinely too short to show all of its controls. */
.stream__block--actions {
  flex: 0 0 auto; min-height: 0; max-height: 55vh; overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--stroke); padding-top: 14px;
}
#actionPanel { flex: 0 0 auto; }
/* The transcript is the one and only scroll container of the column. */
.stream__block--dialogue .transcript {
  flex: 1 1 auto; min-height: 0; max-height: none;
  overflow-y: auto; overflow-x: hidden;
}
.stream__block .panel__head h2 { font-size: 12px; color: var(--muted); letter-spacing: .12em; }

/* the speaking / newest line is the reading focus of the stream */
.line[data-live="true"] {
  border-color: rgba(232, 182, 76, .5);
  background: linear-gradient(160deg, rgba(232, 182, 76, .1), rgba(8, 13, 24, .6));
  /* Newest-first: the fresh turn arrives at the very top, so the live bubble
     drops inward from above.  Only this one bubble animates per push. */
  animation: lineInTop 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.line[data-live="true"] .line__text { color: var(--text); }

/* economy drawer: closed by default; the verbose ledger hides inside */
.tafel__drawer { display: block; }
.drawer__summary {
  cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 10px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--faint);
}
.drawer__summary::-webkit-details-marker { display: none; }
.drawer__summary::after { content: "\25B8"; margin-left: auto; }
.tafel__drawer[open] .drawer__summary::after { content: "\25BE"; }
.drawer__title { color: var(--muted); font-weight: 600; }
.drawer__hint { text-transform: none; letter-spacing: 0; }
.tafel__drawer[open] .tokens { margin-top: 12px; }
.panel { padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.panel__head h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--gold); }
.panel__hint { font-size: 11px; color: var(--faint); text-align: right; }

/* ------------------------------------------------------------- 1. het bord */
.track { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.station {
  position: relative; padding: 10px 8px 9px; border-radius: var(--radius-md);
  border: 1px solid var(--stroke); background: rgba(10, 16, 29, 0.6);
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  transition: transform 0.35s ease, border-color 0.35s ease, background 0.35s ease;
}
.station::after {
  content: "→"; position: absolute; right: -8px; top: 50%; transform: translateY(-50%);
  color: var(--faint); font-size: 11px; z-index: 2;
}
.station:last-child::after { display: none; }
.station__icon { font-size: 18px; line-height: 1; }
.station__name { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.station__index { font-size: 9px; color: var(--faint); letter-spacing: 0.1em; }
.station__bar { height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.station__bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  transition: width 0.5s ease;
}
.station__stake { font-size: 9.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.station[data-status="active"] {
  border-color: rgba(232, 182, 76, 0.6); background: linear-gradient(180deg, rgba(232, 182, 76, 0.14), rgba(10, 16, 29, 0.7));
  box-shadow: 0 0 0 1px rgba(232, 182, 76, 0.2), 0 10px 30px rgba(232, 182, 76, 0.12);
  animation: stationPulse 2.6s ease-in-out infinite;
}
.station[data-status="completed"] { border-color: rgba(74, 215, 160, 0.4); }
.station[data-status="completed"] .station__bar i { background: linear-gradient(90deg, var(--ok), var(--cyan)); width: 100% !important; }
.station[data-status="completed"] .station__icon { filter: drop-shadow(0 0 8px rgba(74, 215, 160, 0.6)); }
.station[data-status="pending"] { opacity: 0.62; }
.station[data-fork="true"] .station__index::after { content: " ⑂"; color: var(--violet); }

.deck, .hourglass {
  border: 1px solid var(--stroke); border-radius: var(--radius-md);
  background: rgba(9, 14, 26, 0.6); padding: 12px; display: flex; flex-direction: column; gap: 10px;
}
.deck__title, .hourglass__title, .materials__sub {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.13em; color: var(--faint); font-weight: 600;
}
.deck__stage { display: grid; place-items: center; perspective: 900px; min-height: 178px; }
.card3d {
  position: relative; width: 150px; height: 178px;
  transform-style: preserve-3d; transition: transform 0.85s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.deck[data-flip="true"] .card3d { transform: rotateY(180deg); }
.card3d__face {
  position: absolute; inset: 0; border-radius: 12px; padding: 12px;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  display: flex; flex-direction: column; gap: 8px; overflow: hidden;
}
.card3d__face--back {
  background: repeating-linear-gradient(135deg, #1a2540 0 12px, #16203a 12px 24px);
  border: 1px solid var(--stroke-strong); align-items: center; justify-content: center;
  color: var(--muted); text-align: center;
}
.card3d__pips { color: var(--gold); letter-spacing: 6px; font-size: 12px; }
.card3d__face--front {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, rgba(255, 107, 107, 0.22), rgba(20, 14, 26, 0.95));
  border: 1px solid rgba(255, 122, 144, 0.5); color: var(--text);
}
.card3d__sev {
  align-self: flex-start; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  background: rgba(255, 107, 107, 0.2); border: 1px solid rgba(255, 122, 144, 0.4);
  padding: 2px 8px; border-radius: 99px; color: #ffd9de;
}
.card3d__face--front p { font-size: 11.5px; line-height: 1.4; overflow: auto; }
.card3d__def { margin-top: auto; font-size: 10px; color: var(--gold); font-family: var(--mono); }
.deck[data-primed="true"] {
  border-color: rgba(255, 122, 144, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 122, 144, 0.25), 0 12px 34px rgba(255, 107, 107, 0.16);
  animation: stationPulse 2.4s ease-in-out infinite;
}
.deck__meta { font-size: 10.5px; color: var(--faint); }

.hourglass__visual { display: grid; place-items: center; gap: 6px; }
.hourglass__svg { width: 92px; height: 110px; }
.hourglass__glass { fill: none; stroke: rgba(180, 205, 255, 0.4); stroke-width: 3; stroke-linecap: round; }
.hourglass__sand { transition: height 0.9s linear, y 0.9s linear, opacity 0.6s; rx: 3px; }
.hourglass[data-running="false"] .hourglass__sand { opacity: 0.35; }
.hourglass__time { font-family: var(--mono); font-size: 21px; letter-spacing: 0.06em; color: var(--gold); font-variant-numeric: tabular-nums; }
.hourglass[data-low="true"] .hourglass__time { color: var(--danger); animation: pulse 1s infinite; }
.hourglass__station { font-size: 11px; color: var(--muted); text-align: center; }

/* ------------------------------------------------------------ 2. de brigade */
.roundtable {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  max-width: 460px; margin: 0 auto; --seat-radius: 158px;
}
.roundtable__hub {
  position: absolute; inset: 26%; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; padding: 10px;
  background: radial-gradient(circle at 50% 30%, rgba(232, 182, 76, 0.2), rgba(10, 16, 29, 0.9) 70%);
  border: 1px solid rgba(232, 182, 76, 0.35);
  box-shadow: 0 0 60px rgba(232, 182, 76, 0.12) inset, 0 10px 40px rgba(0, 0, 0, 0.5);
}
.roundtable__eyebrow { font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); }
.roundtable__idea {
  font-size: 11.5px; color: var(--text); max-height: 4.2em; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.roundtable__station { font-size: 9.5px; color: var(--gold); font-family: var(--mono); }
.roundtable__ring { position: absolute; inset: 0; border-radius: 50%; border: 1px dashed rgba(150, 178, 230, 0.16); }

.seat {
  position: absolute; top: 50%; left: 50%; width: 104px; margin: 0;
  transform: translate(-50%, -50%) rotate(var(--angle)) translateY(calc(-1 * var(--seat-radius))) rotate(calc(-1 * var(--angle)));
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: transform 0.4s ease;
}
.seat__avatar {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font-size: 20px; background: var(--panel-strong);
  border: 2px solid var(--stroke-strong); position: relative;
}
.seat__name { font-size: 11px; font-weight: 650; text-align: center; line-height: 1.15; }
.seat__role { font-size: 9px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; text-align: center; }
.seat__human {
  position: absolute; right: -4px; top: -4px; font-size: 9px; background: var(--cyan);
  color: #04211d; border-radius: 99px; padding: 1px 5px; font-weight: 700;
}
.seat[data-speaking="true"] .seat__avatar {
  border-color: var(--gold); box-shadow: 0 0 0 4px rgba(232, 182, 76, 0.16), 0 0 26px rgba(232, 182, 76, 0.4);
  animation: speakPulse 2.2s ease-in-out infinite;
}
.seat[data-speaking="true"] .seat__name { color: var(--gold); }
.seat[data-awaiting="true"] .seat__avatar {
  border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(79, 209, 197, 0.18), 0 0 26px rgba(79, 209, 197, 0.4);
}
.seat__bubble {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: 158px; padding: 7px 9px; border-radius: 10px; font-size: 10.5px; line-height: 1.35;
  background: var(--panel-strong); border: 1px solid var(--stroke-strong);
  color: var(--muted); opacity: 0; transition: opacity 0.3s ease; pointer-events: none;
  max-height: 76px; overflow: hidden; z-index: 6;
}
.seat[data-half="bottom"] .seat__bubble { top: calc(100% + 6px); }
.seat[data-half="top"] .seat__bubble { bottom: calc(100% + 6px); }
.seat[data-speaking="true"] .seat__bubble { opacity: 1; border-color: rgba(232, 182, 76, 0.45); color: var(--text); }

/* --------------------------------------------------------- 3. spel materiaal */
.tokens { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.token {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--stroke); background: rgba(10, 16, 29, 0.55);
}
.token__icon { font-size: 19px; }
.token__count { font-size: 19px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.token__label { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; }
.token[data-flash="spend"] { animation: flashSpend 0.9s ease; }
.token[data-flash="gain"] { animation: flashGain 0.9s ease; }
.conservation { display: flex; flex-direction: column; gap: 5px; }
.conservation__bar { height: 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; border: 1px solid var(--stroke); }
.conservation__bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width 0.6s ease; }
.conservation__label { font-size: 10px; color: var(--faint); }
.materials__sub { margin-top: 2px; }
.ledger { display: flex; flex-direction: column; gap: 5px; max-height: 168px; overflow: auto; }
.ledger li {
  display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: var(--muted);
  padding: 5px 8px; border-radius: 7px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--stroke);
}
.ledger li b { font-family: var(--mono); }
.ledger li[data-delta^="-"] b { color: var(--rose); }
.ledger li[data-delta]:not([data-delta^="-"]) b { color: var(--ok); }
.ledger__empty { justify-content: center !important; color: var(--faint) !important; font-style: italic; }

/* ---------------------------------------------------------------- 4. dialoog */
/* NEWEST-FIRST TRANSCRIPT.  render.js reverses the server's oldest -> newest
   list before projection, so the FIRST .line child is the newest turn: the
   live edge is the top of this list and scrollTop 0 shows it fully.  A normal
   column (not column-reverse) keeps scrollTop 0 == newest, which is what makes
   the default/initial position land on the latest turn. */
.transcript {
  display: flex; flex-direction: column; justify-content: flex-start;
  gap: 10px; min-height: 0; max-height: 340px; overflow-y: auto; overflow-x: hidden;
  padding-right: 4px; scroll-behavior: smooth; overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.line {
  flex: 0 0 auto;
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--stroke); background: rgba(8, 13, 24, 0.55);
  /* The transcript is rebuilt newest-first on every turn; a blanket entrance
     animation would flash the whole history.  Only the live (topmost) line
     animates inward, from above. */
  animation: none;
}
.line__avatar {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  font-size: 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--stroke);
}
.line__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px; margin-bottom: 3px; }
.line__who { font-size: 11px; font-weight: 650; }
.line__station { font-size: 9px; color: var(--faint); font-family: var(--mono); }
.line__kind { font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); border: 1px solid var(--stroke); border-radius: 99px; padding: 1px 6px; }
.line__text { font-size: 12px; color: #cdd8ef; white-space: pre-wrap; word-break: break-word; }
.line__text strong { color: var(--text); }
.line__card {
  margin-top: 7px; font-size: 10.5px; padding: 7px 9px; border-radius: 8px;
  border: 1px solid rgba(255, 122, 144, 0.4); background: rgba(255, 107, 107, 0.1); color: #ffd9de;
}
.line[data-seat="spelleider"] { border-left: 3px solid var(--gold); }
.line[data-seat="inspecteur"] { border-left: 3px solid var(--rose); }
.line[data-seat="strateeg"] { border-left: 3px solid var(--violet); }
.line[data-seat="gast"], .line[data-seat="bouwer"], .line[data-seat="financier"] { border-left: 3px solid var(--cyan); }
.line[data-kind="finale"] { border-color: rgba(232, 182, 76, 0.5); background: linear-gradient(160deg, rgba(232, 182, 76, 0.12), rgba(8, 13, 24, 0.6)); }
.line[data-player="true"] { border-left: 3px solid var(--ok); background: rgba(74, 215, 160, 0.07); }

/* ------------------------------------------------------------ 5. actiepaneel */
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  flex: 1 1 150px; text-align: left; cursor: pointer;
  padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--stroke-strong); background: rgba(12, 19, 34, 0.8);
  display: flex; flex-direction: column; gap: 3px;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.choice:hover { transform: translateY(-2px); border-color: var(--gold); background: rgba(232, 182, 76, 0.1); }
.choice:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.choice__name { font-size: 12px; font-weight: 650; }
.choice__label { font-size: 10.5px; color: var(--muted); }
.choice[data-action="defend"] { border-color: rgba(79, 209, 197, 0.45); }
.choice[data-action="pivot"] { border-color: rgba(139, 124, 255, 0.45); }
.choice[data-action="absorb"] { border-color: rgba(255, 122, 144, 0.4); }
.choice[data-recommended="true"]::after { content: "★ aanbevolen"; font-size: 9px; color: var(--gold); }
.actions__empty { font-size: 11.5px; color: var(--faint); font-style: italic; }
.custom { display: flex; gap: 8px; }
.custom input {
  flex: 1; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--stroke); background: rgba(6, 10, 18, 0.8);
}
.custom input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.actions__footer { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  cursor: pointer; border-radius: var(--radius-sm); padding: 9px 15px;
  border: 1px solid var(--stroke-strong); background: rgba(12, 19, 34, 0.85);
  font-size: 12px; font-weight: 600; transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--gold); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--primary { background: linear-gradient(160deg, var(--gold), #c9902f); color: #1b1405; border-color: transparent; }
.btn--ghost { color: var(--muted); }
.btn--icon { padding: 6px 11px; }

/* ------------------------------------------------------------------- modal */
.modal {
  border: 1px solid var(--stroke-strong); color: var(--text);
  width: min(880px, 94vw); max-height: 88vh; padding: 0;
  background: linear-gradient(160deg, rgba(20, 29, 49, 0.97), rgba(7, 11, 20, 0.97));
  border-radius: var(--radius-lg);
}
.modal::backdrop { background: rgba(2, 4, 9, 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--stroke); }
.modal__head h2 { font-size: 16px; }
.modal__meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.modal__body { padding: 16px 18px; overflow: auto; max-height: 60vh; }
.modal__foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--stroke); }
.lobby { display: flex; flex-direction: column; gap: 9px; padding: 18px; }
.lobby label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); }
.lobby textarea, .lobby select {
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--stroke); background: rgba(6, 10, 18, 0.85); resize: vertical;
}
.lobby .btn { margin-top: 6px; }

/* canvas markdown */
.canvas { display: flex; flex-direction: column; gap: 12px; }
.canvas h1 { font-size: 20px; color: var(--gold); }
.canvas h2 { font-size: 15px; margin-top: 6px; color: var(--cyan); }
.canvas h3 { font-size: 13px; margin-top: 4px; }
.canvas p, .canvas li { font-size: 12.5px; color: #cfd9ee; }
.canvas ul { list-style: disc; padding-left: 20px; }
.canvas blockquote { border-left: 3px solid var(--danger); padding: 6px 12px; background: rgba(255, 107, 107, 0.1); border-radius: 0 8px 8px 0; font-size: 12px; }
.canvas table { width: 100%; border-collapse: collapse; font-size: 12px; }
.canvas th, .canvas td { border: 1px solid var(--stroke); padding: 6px 9px; text-align: left; }
.canvas code { font-family: var(--mono); font-size: 11.5px; background: rgba(255, 255, 255, 0.07); padding: 1px 5px; border-radius: 5px; }
.canvas hr { border: 0; border-top: 1px solid var(--stroke); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  padding: 10px 18px; font-size: 12.5px; z-index: 90; border-radius: 99px;
  animation: lineIn 0.25s ease both;
}
.toast[data-kind="error"] { border-color: rgba(255, 107, 107, 0.6); color: #ffd9de; }

/* ---------------------------------------------------------------- animaties */
@keyframes stationPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(232, 182, 76, 0.2), 0 10px 30px rgba(232, 182, 76, 0.10); }
  50% { box-shadow: 0 0 0 1px rgba(232, 182, 76, 0.45), 0 14px 40px rgba(232, 182, 76, 0.22); }
}
@keyframes speakPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes lineIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* Newest-first: fresh turns enter at the TOP, so they drop inward from above. */
@keyframes lineInTop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes flashSpend { 0% { background: rgba(255, 122, 144, 0.35); } 100% { background: rgba(10, 16, 29, 0.55); } }
@keyframes flashGain { 0% { background: rgba(74, 215, 160, 0.35); } 100% { background: rgba(10, 16, 29, 0.55); } }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1400px) {
  /* the Tafel stacks internally so the roundtable keeps its full width */
  .tafel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "rail" "table" "dock" "drawer";
  }
}
@media (max-width: 1080px) {
  .stage { grid-template-columns: minmax(0, 1.25fr) minmax(310px, 1fr); }
}
@media (max-width: 900px) {
  /* single column: Tafel first, Deliberation second */
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-areas: "tafel" "stream"; }
  .topbar { position: static; }
  /* A sticky viewport-height column would swallow the Tafel when the layout
     stacks, so hand the scroll back to a capped internal transcript. */
  #streamPanel {
    position: static; top: auto; height: auto; max-height: none;
    align-self: stretch; overflow: visible;
  }
  .stream__block--dialogue { flex: 0 0 auto; overflow: visible; }
  .stream__block--dialogue .transcript { max-height: min(60vh, 460px); }
}
@media (max-width: 820px) {
  .track { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .station:nth-child(3)::after, .station:nth-child(6)::after { display: none; }
  .roundtable { max-width: 340px; --seat-radius: 118px; }
  .seat { width: 86px; }
  .seat__bubble { width: 132px; max-height: 60px; }
  #brigadePanel { padding-block: 40px 44px; }
}
@media (max-width: 560px) {
  .tafel { padding: 12px; }
  .statusstrip { gap: 12px; }
  .tafel__head { flex-direction: column; align-items: flex-start; }
  .roundtable { aspect-ratio: auto; max-width: none; padding: 8px 0; }
  .roundtable__hub { position: static; inset: auto; margin: 0 0 12px; border-radius: var(--radius-lg); padding: 14px; }
  .roundtable__ring { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .seat { position: static; width: auto; transform: none; flex-direction: row; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--stroke); border-radius: var(--radius-sm); background: rgba(8, 13, 24, 0.5); }
  .seat__bubble { display: none; }
  #brigadePanel { padding-block: 12px; }
  .tokens { grid-template-columns: minmax(0, 1fr); }
  .stream { padding: 12px; }
  .custom { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .card3d { transition: none; }
  /* pinning the newest turn to the live edge must be instant, not animated */
  .transcript { scroll-behavior: auto; }
}

@media print {
  body { background: #fff; color: #111; }
  .war-room > *:not(#canvasModal) { display: none !important; }
  .modal { position: static; width: 100%; max-height: none; border: 0; box-shadow: none; background: #fff; color: #111; }
  .modal__foot, .modal__head .btn { display: none !important; }
  .canvas h1, .canvas h2, .canvas h3, .canvas p, .canvas li, .canvas td, .canvas th { color: #111 !important; }
}

/* --- authentic ideaChef tabletop layer ---------------------------------- */
#authenticPanel { display: flex; flex-direction: column; gap: .6rem; }
.auth, .powerbar, .scoreboard { padding: .5rem .7rem; border-radius: .6rem;
  background: rgba(255,255,255,.03); }
.auth__head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.auth__id { font-weight: 700; color: #e8b64c; }
.auth__tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: #9fd6ff; border: 1px solid currentColor; border-radius: 999px;
  padding: 0 .45rem; }
.auth__station { margin-left: auto; opacity: .7; font-size: .78rem; }
.auth__text { margin: .35rem 0 .2rem; line-height: 1.35; }
.auth__meta, .auth__empty, .power__menu { margin: 0; opacity: .65; font-size: .78rem; }
.powerbar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.power { display: inline-flex; flex-direction: column; gap: .1rem; cursor: pointer;
  border: 1px solid rgba(232,182,76,.4); border-radius: .5rem; padding: .3rem .55rem;
  background: rgba(232,182,76,.08); color: inherit; }
.power:disabled { opacity: .4; cursor: not-allowed; }
.power__cost, .power__flag { font-size: .68rem; opacity: .75; }
.scoreboard__title { margin: .3rem 0 0; font-size: .82rem; opacity: .8; }
.scores { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: .2rem 0; padding: 0; }
.score { display: inline-flex; gap: .35rem; align-items: baseline; }
.score b { color: #e8b64c; }
.score__last { margin: .2rem 0 0; font-size: .78rem; opacity: .8; }

/* ==========================================================================
   Tabletop surface refinements (append after components so they win)
   ========================================================================== */

/* the active Question Card is the hero; everything else in the dock is calm */
.auth--hero {
  background: linear-gradient(160deg, rgba(232, 182, 76, .14), rgba(9, 14, 26, .72));
  border: 1px solid rgba(232, 182, 76, .45);
  border-radius: var(--radius-md); padding: 14px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .35);
}
.auth--hero .auth__text { font-size: 14px; line-height: 1.45; color: var(--text); }
.auth--hero .auth__id { font-size: 13px; }
/* the active station is named in the rail + hub only */
.auth--hero .auth__station { display: none; }

/* flatten the dock: no competing sub-boxes inside the single Tafel surface */
#authenticPanel .hourglass,
#authenticPanel .deck { border: 0; background: transparent; padding: 0; }
#authenticPanel .deck { gap: 6px; }
#authenticPanel .hourglass__svg { width: 64px; height: 76px; }
#authenticPanel .hourglass__time { font-size: 17px; }
#authenticPanel .card3d { width: 122px; height: 146px; }
#authenticPanel .deck__stage { min-height: 150px; }
#authenticPanel .auth:not(.auth--hero),
#authenticPanel .powerbar,
#authenticPanel .scoreboard { background: transparent; padding: 0; }
#authenticPanel > * + * {
  border-top: 1px solid var(--stroke); padding-top: 12px;
}

/* keep the speaking-seat bubble inside its own table region */
#brigadePanel { padding-block: 50px 54px; }
.seat__bubble { max-height: 68px; }
