/* ── Game-specific styles ──────────────────────────────────── */
/* Used only by game/index.html                                 */

/* ── Layout Foundation (Phase 1) ──────────────────────────── */
.game-dashboard {
  display: grid;
  grid-template-areas:
    "header header header"
    "left center right"
    "hand hand hand";
  /* Side columns size to their panels (44px rail when collapsed, 260px open)
     so a collapsed panel never reserves a dead 1fr column. */
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: var(--gap-md);
  padding: var(--gap-md);
  max-width: none;
  box-sizing: border-box;
}

/* Collapsible header */
.header-bar {
  grid-area: header;
  transition: transform var(--transition-medium);
  z-index: var(--z-header);
}

.header-bar.collapsed {
  transform: translateY(-100%);
}

/* Left AI panel */
.ai-side-panel.left {
  grid-area: left;
}

/* Center board */
.board-col {
  grid-area: center;
  min-height: 0;
}

/* Right column (AI panel + log) */
.right-col {
  grid-area: right;
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
  min-height: 0;
}

/* Hand strip */
.hand-strip {
  grid-area: hand;
}

/* Viewport fill for game screen — anchored BELOW the sticky site header so
   the top-bar HUD (quarter track, decks, phase, scores) is never buried
   behind it. dvh keeps mobile browser chrome from clipping the hand. */
#game-screen {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  height: auto;
  min-height: 0;
  display: grid; /* Use grid layout, hidden by default via .hidden class */
  overflow: hidden;
}

#game-screen.hidden {
  display: none;
}

/* Remove max-width constraints */
#game-screen .container {
  max-width: none;
  width: 100%;
  padding: 0;
}

/* ── Responsive breakpoints ────────────────────────────────── */
@media (max-width: 768px) {
  /* On small screens the game becomes a normal scrolling page with a
     sticky hand dock: header row, score strip, board, log — hand pinned
     to the bottom of the viewport. */
  body.game-active { overflow: auto; }

  #game-screen {
    position: static;
    height: auto;
    min-height: calc(100dvh - 68px);
    overflow: visible;
  }

  .game-dashboard {
    grid-template-areas:
      "header"
      "center"
      "right"
      "hand";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    gap: var(--gap-sm);
    padding: var(--gap-sm);
    height: auto;
  }

  /* Hide side panels on mobile by default */
  .ai-side-panel.left,
  .ai-side-panel.right {
    display: none;
  }
}

/* ── Loading spinner ───────────────────────────────────────── */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: var(--space-4);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ── Top bar (game HUD) ────────────────────────────────────── */
.top-bar {
  grid-area: header;
  padding: 8px var(--space-6);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--bg-elev)) 0%, var(--bg-elev) 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(10, 6, 2, 0.35);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px 20px;
  flex-shrink: 0;
}
.hud-zone { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hud-status { gap: 10px; }

.quarter-track { display: flex; align-items: center; gap: 8px; }
.quarter-label {
  font-size: var(--text-xs); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.2px; font-weight: 600;
}
.quarter-now {
  font-family: var(--font-display);
  font-size: 1.05rem; font-weight: 700; color: var(--accent-bright);
  line-height: 1;
}
.quarter-of { color: var(--text-muted); font-size: 0.8em; font-weight: 500; }
.q-dots { display: flex; gap: 4px; align-items: center; }
.q-chip {
  width: 22px; height: 22px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
}
.q-chip.q-done { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-bright); border-color: transparent; }
.q-chip.q-current {
  background: var(--accent-bright);
  color: var(--accent-contrast);
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-bright) 22%, transparent);
  transform: translateY(-1px);
}

/* ── Turn phase indicator ─────────────────────────────────── */
.phase-indicator {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
}
.phase-group {
  display: flex; align-items: center; gap: 2px;
}
.phase-divider {
  width: 1px; height: 16px;
  background: var(--border-strong);
  margin: 0 6px;
}
.phase-step {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 500;
  transition: color var(--dur-fast), background var(--dur-fast), opacity var(--dur-fast);
  white-space: nowrap;
  opacity: 0.5;
}
.phase-step.active {
  background: var(--accent-bright);
  color: var(--accent-contrast);
  font-weight: 700;
  opacity: 1;
}
.phase-step.done {
  color: var(--text-secondary);
  opacity: 0.8;
}
.phase-sep {
  color: var(--border);
  font-size: 0.55rem;
}
.phase-ai-label {
  font-size: 0.55rem;
  color: var(--text-muted);
  font-style: italic;
  margin-left: 6px;
  animation: phasePulse 1.2s ease-in-out infinite;
}
@keyframes phasePulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.scores { display: flex; gap: 6px; flex-wrap: wrap; }
.score-chip {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 4px 10px 4px 6px;
  display: flex; align-items: center; gap: 8px;
  font-size: var(--text-xs);
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.score-chip.human {
  border-color: color-mix(in srgb, var(--accent-bright) 55%, transparent);
  background: var(--accent-soft);
}
.score-chip.leader { box-shadow: 0 0 0 1px color-mix(in srgb, var(--stat-value) 40%, transparent); }
.score-rank {
  width: 18px; height: 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: 0.62rem; font-weight: 700;
  background: var(--film-2); color: var(--text-muted);
}
.score-chip.leader .score-rank { background: transparent; color: var(--stat-value); font-size: 0.82rem; }
.score-name { color: var(--text-secondary); font-weight: 500; }
.score-chip.human .score-name { color: var(--text-primary); }
.score-val { font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.score-chip.leader .score-val { color: var(--stat-value); }

/* ── Lock game page to viewport when game is active ──────────── */
/* shared.css uses min-height:100vh which allows body growth;     */
/* .game-active is set on body when gameplay starts, removed on   */
/* new-game/reset so the setup screen stays scrollable.           */
body.game-active { overflow: hidden; }

/* ── Ensure flex chain: body → main → game-screen ─────────── */
main#main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Hide footer on game page — full-viewport layout */
footer.site-footer {
  display: none;
}

/* ── Game screen — fill viewport ──────────────────────────── */
/* Layout is handled by .game-dashboard grid (lines 5-18) and #game-screen (lines 57-65) */

/* ── Game layout — 3-column ───────────────────────────────── */
.game-layout {
  display: flex;
  gap: 0;
  padding: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
/* The single scroll region between the pinned HUD and the pinned hand. Nothing
   inside .board may scroll on its own — nested scrollers hide content behind
   a scrollbar nobody can see. */
.board-col {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 12px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--film-2) transparent;
}
.board-col::-webkit-scrollbar { width: 4px; }
.board-col::-webkit-scrollbar-track { background: transparent; }
.board-col::-webkit-scrollbar-thumb { background: var(--film-2); border-radius: 2px; }
.right-col {
  width: clamp(240px, 18vw, 300px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-subtle);
  overflow: hidden;
}

/* ── AI side panels ───────────────────────────────────────── */
.ai-side-panel {
  position: relative;
  transition: width 0.3s ease;
  overflow: hidden;
  border-right: 1px solid var(--border-subtle);
  background: var(--surface-1);
}
.ai-side-panel.right {
  border-right: none;
  border-bottom: 1px solid var(--border-subtle);
}
.ai-side-panel.collapsed .ai-side-content { display: none; }
.ai-side-panel.left { width: 44px; border-right: 1px solid var(--border-subtle); }
.ai-side-panel.left:not(.collapsed) { width: 260px; }
.ai-side-panel.right.collapsed .ai-side-content { display: none; }

/* Hover-expand: the collapsed rail previews its content as an OVERLAY so
   the board never reflows underneath the pointer. */
@media (hover: hover) and (min-width: 769px) {
  .ai-side-panel.left.collapsed:hover {
    overflow: visible;
    z-index: var(--z-panel);
  }
  .ai-side-panel.left.collapsed:hover .ai-side-content {
    display: block;
    position: absolute;
    top: 36px;
    left: 0;
    width: 260px;
    max-height: min(70vh, 560px);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    box-shadow: 0 12px 32px rgba(10, 6, 2, .55);
  }
  .right-col:hover .ai-side-panel.right.collapsed .ai-side-content {
    display: block;
  }
}

.ai-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 36px;
  background: var(--surface-2);
  border: none; border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background var(--dur-fast);
}
.ai-toggle-btn:hover { background: var(--surface-1); color: var(--text-secondary); }
.ai-toggle-btn.left::after { content: '\25B6'; }
.ai-side-panel.left:not(.collapsed) .ai-toggle-btn.left::after { content: '\25C0 Opponents'; }
.ai-toggle-btn.right::after { content: 'Opponents \25BC'; }
.ai-side-panel.right:not(.collapsed) .ai-toggle-btn.right::after { content: '\25B2 Hide'; }

.ai-side-content {
  padding: 8px;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
}

.ai-summary-block {
  margin-bottom: 12px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.ai-summary-header {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
}
.ai-summary-name { font-size: var(--text-sm); font-weight: 600; margin-right: auto; }
.ai-summary-rep { font-size: var(--text-sm); font-weight: 700; color: var(--stat-reward); }
.ai-summary-stats {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 0.65rem; color: var(--text-muted);
  margin-bottom: 6px;
}
.ai-summary-projects { margin-bottom: 6px; }
.ai-mini-proj {
  padding: 4px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.ai-mini-proj.done { opacity: 0.5; }
.ai-proj-name { font-size: 0.65rem; font-weight: 600; display: block; }
.ai-proj-info { font-size: 0.6rem; color: var(--text-muted); }
.ai-proj-bar {
  height: 3px; background: var(--film-2); border-radius: 2px;
  overflow: hidden; margin-top: 2px;
}
.ai-proj-bar-fill { height: 100%; background: var(--type-project); border-radius: 2px; transition: width 0.3s ease; }
.ai-summary-people { display: flex; flex-wrap: wrap; gap: 3px; }
.ai-person-tag {
  font-size: 0.55rem; padding: 1px 5px; border-radius: 6px;
  background: var(--surface-1); border: 1px solid var(--border);
  color: var(--text-muted);
}
.ai-person-tag.busy { border-color: color-mix(in srgb, var(--type-talent) 30%, transparent); color: var(--type-talent); }

/* ── Board ─────────────────────────────────────────────────── */
/* Capped and centered so ultrawide screens read as a game table,
   not a stretched document. */
/* Content-sized, never viewport-sized. The board is allowed to be taller than
   the screen — .board-col is the one scroll region and the hand stays docked
   below it. An earlier `flex: 1` here forced the panel to absorb slack, which
   collapsed the project columns to nothing the moment the graph appeared. */
.board {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding-bottom: var(--space-4);
}

.player-panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}
.player-panel.human-panel { border-color: color-mix(in srgb, var(--accent-bright) 40%, transparent); }
.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.panel-name { font-weight: 600; font-size: var(--text-sm); }
.panel-rep { font-size: var(--text-sm); color: var(--stat-reward); font-weight: 700; }
.panel-section { margin-bottom: 6px; }
.panel-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}
.empty-msg { font-size: var(--text-xs); color: var(--text-muted); font-style: italic; }

/* ── Board card view toggle ──────────────────────────────── */
.board-view-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 8px;
  line-height: 1.2;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.board-view-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent-bright);
}

/* ── Board card grid (card view mode) ────────────────────── */
.board-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.board-card-wrap {
  cursor: pointer;
  transition: transform var(--dur-fast);
  position: relative;
}
.board-card-wrap:hover {
  transform: translateY(-4px) scale(1.04);
  z-index: 2;
}
.board-card-wrap { --rc-size: 96px; }
.board-card-status {
  font-size: 0.5rem;
  text-align: center;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

/* ── Markets (compact strips) ─────────────────────────────── */
.markets-row {
  display: flex; gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.market-panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
  flex: 1;
  min-width: 180px;
}
/* Compact stays a stack of rows; card view is a wrapping shelf. */
.market-cards--compact { display: flex; flex-direction: column; gap: 3px; }
.market-cards--cards { display: flex; flex-wrap: wrap; gap: 8px; }

.market-strip { cursor: pointer; }
.market-strip--compact {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur-fast), background var(--dur-fast);
  font-size: var(--text-xs);
  line-height: 1.2;
}

/* Card view: the wrapper is just a positioning context and a hover target. */
.market-strip--card {
  --rc-size: 108px;
  position: relative;
  border-radius: var(--radius-md);
  transition: transform var(--dur) var(--ease-out), filter var(--dur);
}
.market-strip--card:hover { transform: translateY(-4px); }
.market-strip--card:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
.market-strip--card .ms-synergy {
  position: absolute;
  top: 4px; right: 4px;
  z-index: 2;
}
.market-strip--compact:hover {
  border-color: var(--accent-bright);
  background: var(--accent-soft);
}
.market-strip--compact:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}
.market-strip-pip {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.market-strip-name {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.market-strip-stats {
  display: flex; gap: 6px;
  color: var(--text-muted);
  font-size: 0.6rem;
  flex-shrink: 0;
}
.market-strip-stats span {
  background: var(--film-2);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ── Deck stats bar (above game log) — labeled draw-pile counts ── */
.deck-stats-bar {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  padding: 8px 12px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.deck-count {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  flex: 1;
}
.dc-label { font-size: 0.55rem; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); }
.dc-val { font-size: var(--text-base); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.log-section.log-collapsed .deck-stats-bar { display: none; }

/* Deck stat colors — match card type palette */
.dc-main .dc-label { color: var(--accent-bright); }
.dc-main .dc-val { color: var(--accent-bright); }
.dc-events .dc-label { color: var(--type-team); }
.dc-events .dc-val { color: var(--type-team); }
.dc-rushq .dc-label { color: var(--type-quarter-event); }
.dc-rushq .dc-val { color: var(--type-quarter-event); }
.dc-layoffs .dc-label { color: var(--type-layoff); }
.dc-layoffs .dc-val { color: var(--type-layoff); }
.dc-discard .dc-label { color: var(--text-muted); }
.dc-discard .dc-val { color: var(--text-secondary); }

/* ── Log section (right column) ──────────────────────────── */
.log-section {
  /* Takes remaining height in right-col flex column.          */
  /* min-height:0 is critical — allows flex item to shrink     */
  /* below its content size so game-log can scroll properly.   */
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.log-header {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 6px 10px 6px 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-1);
}
/* Collapse button inside log-header */
.log-collapse-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 8px;
  padding: 0;
  transition: color 0.15s, border-color 0.15s, transform 0.2s ease;
  flex-shrink: 0;
}
.log-collapse-btn:hover { color: var(--text-primary); border-color: var(--border); }
/* Rotate arrow when log is collapsed */
.log-section.log-collapsed .log-collapse-btn { transform: rotate(180deg); }

/* game-log: fixed-height scrolling container.               */
/* flex:1 fills remaining log-section height after header.   */
/* min-height:0 prevents the container from growing with     */
/* content — forces overflow-y:auto to actually scroll.      */
.game-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.6;
  padding: 6px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--film-2) transparent;
}
.game-log::-webkit-scrollbar { width: 4px; }
.game-log::-webkit-scrollbar-track { background: transparent; }
.game-log::-webkit-scrollbar-thumb { background: var(--film-2); border-radius: 2px; }

/* Collapsed state: hide the scrollable log area.            */
/* The log-header (with toggle button) stays visible.        */
.log-section.log-collapsed .game-log { display: none; }
.log-section.log-collapsed #player-score-bar { display: none; }

.log-entry { padding: 2px 0; }
.log-q {
  color: var(--accent-bright);
  font-weight: 600;
  margin-right: 6px;
}

/* ── Board 2-col layout for projects + team ─────────────── */
.board-columns {
  display: flex;
  gap: 8px;
}
.board-columns > .panel-section {
  flex: 1;
  min-width: 0;
}

/* ── Project rows (compact line items) ─────────────────────── */
.project-rows { display: flex; flex-direction: column; gap: 3px; }
.proj-row {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
  font-size: var(--text-xs);
  line-height: 1.2;
}
.proj-row:hover {
  border-color: var(--card-accent);
  background: var(--accent-soft);
}
.proj-row.done { border-color: color-mix(in srgb, var(--stat-reward) 30%, transparent); }
.proj-row.late { border-color: color-mix(in srgb, var(--type-quarter-event) 30%, transparent); }

.pr-pip {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pr-name {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.pr-progress {
  width: 48px; height: 4px;
  background: var(--film-2);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.pr-progress-fill { height: 100%; border-radius: 2px; transition: width 0.3s ease; }
.pr-stats {
  display: flex; gap: 4px;
  color: var(--text-muted);
  font-size: 0.6rem;
  flex-shrink: 0;
}
.pr-stats span {
  background: var(--film-2);
  padding: 1px 4px;
  border-radius: 3px;
}
.pr-reward { color: var(--stat-reward) !important; background: color-mix(in srgb, var(--stat-reward) 10%, transparent) !important; }

/* People slots (inline emoji dots in project row) */
.pr-slots {
  display: flex; gap: 2px;
  flex-shrink: 0;
}
.pr-slot {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem;
  transition: transform var(--dur-fast);
}
.pr-slot.filled {
  background: color-mix(in srgb, var(--type-talent) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--type-talent) 50%, transparent);
  cursor: pointer;
}
.pr-slot.filled:hover { transform: scale(1.2); border-color: var(--type-talent); }
.pr-slot.empty {
  background: var(--film-1);
  border: 1px dashed var(--film-2);
}

.pr-badge {
  font-size: 0.5rem;
  padding: 1px 5px;
  border-radius: 6px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  white-space: nowrap;
}
.pr-badge.done { background: color-mix(in srgb, var(--stat-reward) 20%, transparent); color: var(--stat-reward); }
.pr-badge.active { background: var(--film-2); color: var(--text-muted); }
.pr-badge.late { background: color-mix(in srgb, var(--type-quarter-event) 20%, transparent); color: var(--type-quarter-event); }

.pr-forecast {
  font-size: 0.5rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.pr-forecast.on-track { color: var(--stat-reward); background: color-mix(in srgb, var(--stat-reward) 12%, transparent); }
.pr-forecast.needs-more { color: var(--type-project); background: color-mix(in srgb, var(--type-project) 12%, transparent); }
.pr-forecast.at-risk { color: var(--type-quarter-event); background: color-mix(in srgb, var(--type-quarter-event) 12%, transparent); }
.pr-forecast.urgent { color: var(--type-quarter-event); background: color-mix(in srgb, var(--type-quarter-event) 15%, transparent); animation: pulse-urgent 1.2s ease infinite; }
@keyframes pulse-urgent { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Tutorial hint */
.tutorial-hint {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; margin-bottom: 10px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  font-size: var(--text-sm); line-height: 1.5;
  animation: fadeIn 0.4s ease;
}
.tutorial-hint strong { color: var(--text-primary); }
.tutorial-dismiss {
  margin-left: auto; padding: 4px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: var(--radius-sm);
  background: transparent; color: var(--accent-bright);
  cursor: pointer; font-size: var(--text-xs); white-space: nowrap;
}
.tutorial-dismiss:hover { background: var(--accent-soft); }

/* Drag-over state for project rows / drop zones */
.proj-row.drag-over,
.board-card-wrap.drag-over,
.proj-card.drag-over {
  border-color: var(--accent) !important;
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-soft), 0 0 14px color-mix(in srgb, var(--accent) 35%, transparent);
  outline: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: -3px;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

/* ── Project detail section (inside card detail modal) ───── */
.proj-detail-section { margin-top: 16px; border-top: 1px solid var(--border-subtle); padding-top: 14px; }
.proj-banner {
  padding: 8px 14px; border-radius: var(--radius-sm); font-size: var(--text-sm);
  font-weight: 600; text-align: center; margin-bottom: 12px;
}
.proj-banner-done { background: color-mix(in srgb, var(--stat-reward) 15%, transparent); color: var(--stat-reward); border: 1px solid color-mix(in srgb, var(--stat-reward) 30%, transparent); }
.proj-banner-ok { background: color-mix(in srgb, var(--accent-bright) 12%, transparent); color: var(--accent-bright); border: 1px solid color-mix(in srgb, var(--accent-bright) 25%, transparent); }
.proj-banner-warn { background: color-mix(in srgb, var(--type-project) 12%, transparent); color: var(--type-project); border: 1px solid color-mix(in srgb, var(--type-project) 25%, transparent); }
.proj-banner-fail { background: color-mix(in srgb, var(--type-quarter-event) 12%, transparent); color: var(--type-quarter-event); border: 1px solid color-mix(in srgb, var(--type-quarter-event) 25%, transparent); }

.proj-detail-progress { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.proj-detail-bar { display: flex; align-items: center; gap: 8px; }
.proj-detail-bar-label { font-size: var(--text-xs); color: var(--text-muted); width: 36px; text-align: right; }
.proj-detail-bar-track { flex: 1; height: 6px; background: var(--film-2); border-radius: 3px; overflow: hidden; }
.proj-detail-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.proj-detail-bar-val { font-size: var(--text-xs); color: var(--text-secondary); font-weight: 600; width: 40px; }

.proj-detail-team-label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.proj-detail-team { display: flex; flex-direction: column; gap: 6px; }
.proj-detail-person {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: border-color var(--dur-fast);
}
.proj-detail-person:hover { border-color: var(--type-talent); }
.proj-detail-person img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.proj-detail-person-info { display: flex; flex-direction: column; }
.proj-detail-person-name { font-size: var(--text-sm); font-weight: 600; }
.proj-detail-person-role { font-size: var(--text-xs); color: var(--text-muted); }

/* ── People rows (compact line items) ─────────────────────── */
.people-rows { display: flex; flex-direction: column; gap: 3px; }
.person-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
  font-size: var(--text-xs);
  line-height: 1.2;
}
.person-row:hover {
  border-color: var(--type-talent);
  background: color-mix(in srgb, var(--type-talent) 8%, transparent);
}
.person-row[draggable="true"],
.board-card-wrap[draggable="true"] { cursor: grab; }
.person-row.dragging,
.board-card-wrap.dragging {
  opacity: 0.4;
  cursor: grabbing;
  outline: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent);
  transition: opacity var(--dur-fast) var(--ease-out);
}

.psr-emoji {
  font-size: 0.85rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.psr-name {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.psr-type {
  font-size: 0.6rem;
  font-weight: 500;
  flex-shrink: 0;
}
.psr-val {
  font-size: 0.6rem;
  color: var(--stat-value);
  font-weight: 600;
  flex-shrink: 0;
  background: var(--film-2);
  padding: 1px 4px;
  border-radius: 3px;
}


/* ── Hand strip (actions + cards unified bar) ────────────── */
.hand-strip {
  display: flex;
  align-items: flex-end;
  border-top: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  flex-shrink: 0;
  position: relative;
  background: linear-gradient(to top, var(--bg) 0%, color-mix(in srgb, var(--accent) 5%, transparent) 100%);
  padding-top: 8px;
  box-shadow: 0 -4px 20px rgba(10, 6, 2, 0.4);
}

/* ── Hand cards (card images) ─────────────────────────────── */
.hand {
  flex: 1;
  min-width: 0;
  padding: 4px 12px 8px;
  background: transparent;
  position: relative;
}
.hand-label {
  /* Parked in the bottom-left corner so the full strip height belongs to
     the cards; pointer-events off keeps the fan hoverable through it. */
  position: absolute;
  left: 2px;
  bottom: 0;
  right: 8px;
  z-index: 3;
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: var(--text-xs);
  margin: 0;
  /* The row is inert; only the guidance inside it takes the pointer. */
  pointer-events: none;
}
.hl-count {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-shrink: 0;
}

/* ── Turn guidance ─────────────────────────────────────────────
   A lingering thought rather than a panel: it sits on the hand label line,
   dimmed enough to ignore while you are deciding, and resolves to full
   contrast when you look at it. Costs no layout of its own. */
.turn-guide {
  pointer-events: auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  line-height: 1.4;
  color: color-mix(in oklab, var(--guide-ink, var(--text-muted)) 55%, transparent);
  cursor: default;
  transition: color var(--dur-slow) var(--ease-out);
}
.turn-guide:hover,
.turn-guide:focus-visible {
  color: var(--guide-ink, var(--text-secondary));
  outline: none;
}
.turn-guide b { font-weight: 700; color: inherit; }
.turn-guide-urgent { --guide-ink: var(--neg-ink); }
.turn-guide-act    { --guide-ink: var(--accent-ink); }
.turn-guide-done   { --guide-ink: var(--text-secondary); }

/* Urgent guidance breathes so it is noticed without a box or a colour block. */
@media (prefers-reduced-motion: no-preference) {
  .turn-guide-urgent { animation: guidePulse 3.6s var(--ease-inout) infinite; }
  .turn-guide-urgent:hover { animation: none; }
}
@keyframes guidePulse {
  0%, 100% { color: color-mix(in oklab, var(--guide-ink) 45%, transparent); }
  50%      { color: color-mix(in oklab, var(--guide-ink) 88%, transparent); }
}


.hand-cards {
  display: flex;
  justify-content: safe center;
  align-items: flex-end;
  perspective: 800px;
  /* Bottom padding absorbs the fan's outer-card droop so card corners
     are never clipped by the viewport edge. */
  padding: 14px 30px 20px;
  position: relative;
  /* T4A: Horizontal scrolling support */
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--film-2) transparent;
}
.hand-cards::-webkit-scrollbar {
  height: 4px;
}
.hand-cards::-webkit-scrollbar-track {
  background: transparent;
}
.hand-cards::-webkit-scrollbar-thumb {
  background: var(--film-2);
  border-radius: 2px;
}
.hand-card {
  flex-shrink: 0;
  --rc-size: 156px;
  width: var(--rc-size);
  margin: 0 -12px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transform: rotate(var(--fan-angle, 0deg)) translateY(var(--fan-y, 0px));
  /* Distant origin = shallow, readable arc instead of a steep casino fan. */
  transform-origin: center 760px;
  transition: transform 0.3s var(--ease-snap), z-index 0s;
  position: relative;
  overflow: visible;
  /* T4A: Scroll snap for smooth horizontal scrolling */
  scroll-snap-align: center;
}

.hand-card:hover {
  transform: translateY(-10px) rotate(0deg) scale(1.05);
  z-index: 12 !important;
}
.hand-card:hover .rush-card {
  border-color: var(--card-accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--card-accent) 20%, transparent);
}
.hand-card.selected {
  transform: translateY(-12px) rotate(0deg) scale(1.06);
  z-index: 11 !important;
}
.hand-card.selected .rush-card {
  border-color: var(--card-accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--card-accent) 26%, transparent);
}
/* ── Hover preview ────────────────────────────────────────── */
/* Sits ABOVE the hand divider and all board chrome (above toast/modal    */
/* layers) so the enlarged card is never clipped by the hand strip line.  */
.card-hover-preview {
  position: fixed;
  z-index: calc(var(--z-toast) + 50);
  --rc-size: var(--rc-inspect);
  width: fit-content;
  pointer-events: none;
  filter: drop-shadow(0 18px 36px rgba(10, 6, 2, .65));
  opacity: 1;
  transform: translateY(0) scale(1);
  transform-origin: bottom center;
  transition: opacity 0.16s var(--ease-out), transform 0.22s var(--ease-snap);
}
.card-hover-preview.hidden {
  opacity: 0;
  transform: translateY(18px) scale(0.92);
  pointer-events: none;
}
.card-hover-preview img {
  width: 100%; display: block;
  border-radius: var(--radius-md);
}

/* ── Actions ───────────────────────────────────────────────── */
.actions {
  padding: 8px 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border-subtle);
  position: relative;
  z-index: 20;
}
.action-bar { display: flex; flex-direction: column; gap: 5px; }
.action-bar .btn { font-size: 0.7rem; padding: 5px 12px; white-space: nowrap; }
.action-bar kbd {
  font-family: inherit;
  font-size: 0.55rem;
  padding: 0 3px;
  border-radius: 3px;
  background: var(--film-2);
  color: var(--text-muted);
  margin-left: 4px;
}
.action-animating {
  font-size: 0.7rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px; padding: 4px 0;
  animation: pulse-opacity 1s ease-in-out infinite;
}
@keyframes pulse-opacity { 0%, 100% { opacity: .5 } 50% { opacity: 1 } }

.btn-assign { background: color-mix(in srgb, var(--type-talent) 13%, transparent); color: var(--type-talent); border: 1px solid color-mix(in srgb, var(--type-talent) 26%, transparent); }
.btn-assign:hover { background: color-mix(in srgb, var(--type-talent) 20%, transparent); }
.btn-trade { background: color-mix(in srgb, var(--type-project) 13%, transparent); color: var(--type-project); border: 1px solid color-mix(in srgb, var(--type-project) 26%, transparent); }
.btn-trade:hover { background: color-mix(in srgb, var(--type-project) 20%, transparent); }
.btn-end { background: var(--film-2); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-end:hover { background: var(--film-2); color: var(--text-primary); }
.btn-reset {
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem; line-height: 1; border-radius: 8px;
}
.btn-reset:hover {
  color: var(--type-quarter-event);
  border-color: color-mix(in srgb, var(--type-quarter-event) 40%, transparent);
  background: color-mix(in srgb, var(--type-quarter-event) 10%, transparent);
}
#recover-btn { width: auto; padding: 0 12px; font-size: var(--text-xs); }
.btn-log { background: var(--film-2); color: var(--text-muted); border: 1px solid var(--border-subtle); }
.btn-log:hover { color: var(--text-secondary); background: var(--film-2); }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.modal-header h3 { font-size: var(--text-lg); }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.5rem; cursor: pointer; padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }

/* Assign modal */
.assign-grid { display: flex; flex-direction: column; gap: 14px; }
.assign-person {
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}
.assign-project {
  padding: 10px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.ap-name { font-size: var(--text-sm); font-weight: 600; margin-bottom: 8px; }
.assign-project .btn-sm {
  margin-right: 6px;
  margin-bottom: 4px;
  background: color-mix(in srgb, var(--type-talent) 13%, transparent);
  color: var(--type-talent);
  border: 1px solid color-mix(in srgb, var(--type-talent) 26%, transparent);
}
.assign-project .btn-sm:hover { background: color-mix(in srgb, var(--type-talent) 26%, transparent); }

/* Trade modal — two-column: target card (left) + payable cards (right) */
.modal-content.trade-modal {
  background: var(--bg-elev);
  box-shadow: var(--shadow-soft);
  max-width: 880px;
  width: min(92vw, 880px);
}
.trade-body {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.trade-target {
  flex-shrink: 0;
  width: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.trade-target-img {
  text-align: center; margin-bottom: 12px; width: 100%;
}
.trade-info {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: center;
}
.trade-info strong { color: var(--accent-bright); }
.trade-select-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.trade-select-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.trade-cards { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.trade-card-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.trade-card-option:hover { border-color: var(--border-strong); background: var(--surface-2); }
.trade-card-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.trade-card-option input { accent-color: var(--accent); }
.tv { margin-left: auto; color: var(--text-muted); font-size: var(--text-xs); }
.trade-footer {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}
#trade-total {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 600;
  transition: color var(--dur-fast) var(--ease-out);
}
#trade-total.ready { color: var(--stat-reward); }

/* Confirm button: dimmed until cost met, then full amber accent */
#trade-confirm {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: not-allowed;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
#trade-confirm.ready {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--accent-soft), 0 4px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}
#trade-confirm.ready:hover { background: var(--accent-bright); border-color: var(--accent-bright); }

@media (max-width: 640px) {
  .trade-body { flex-direction: column; gap: 16px; }
  .trade-target { width: 100%; }
}

/* Game over */
.game-over-content { text-align: center; }
.game-over-hero { margin-bottom: 22px; }
.game-over-content h2 {
  font-family: var(--font-display);
  font-size: 1.9rem; margin-bottom: 6px; letter-spacing: -0.01em;
}
.game-over-content.is-victory h2 {
  background: linear-gradient(120deg, var(--accent-bright), var(--stat-value));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.game-over-sub { color: var(--text-muted); font-size: var(--text-sm); }

.standings { margin-bottom: 24px; display: flex; flex-direction: column; gap: 4px; }
.standing-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: var(--text-base);
}
.standing-row.winner {
  background: linear-gradient(90deg, color-mix(in srgb, var(--stat-value) 14%, transparent), transparent);
  border-color: color-mix(in srgb, var(--stat-value) 30%, transparent);
}
.standing-medal { font-size: 1.3rem; width: 30px; flex-shrink: 0; }
.standing-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; text-align: left; }
.standing-name { font-weight: 600; }
.standing-bar {
  height: 5px; border-radius: 3px;
  background: var(--film-2); overflow: hidden;
}
.standing-bar-fill {
  display: block; height: 100%; border-radius: 3px;
  background: color-mix(in srgb, var(--text-muted) 60%, transparent);
  transition: width 0.6s var(--ease-out);
}
.standing-row.winner .standing-bar-fill { background: linear-gradient(90deg, var(--accent-bright), var(--stat-value)); }
.standing-row.is-human .standing-bar-fill { background: var(--accent-bright); }
.standing-rep { font-weight: 700; color: var(--stat-reward); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.standing-rep-unit { font-size: 0.7em; color: var(--text-muted); font-weight: 500; }
.game-over-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }

/* ── Accessibility ───────────────────────────────────────────── */
.hand-card:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

/* ── Card detail modal ─────────────────────────────────────── */
.card-detail-modal {
  display: flex; gap: 20px;
}
.card-detail-left { flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.card-detail-img {
  width: 180px; border-radius: 8px; display: block;
}
.card-detail-right { flex: 1; min-width: 0; }
.card-detail-type-badge {
  display: inline-block;
  font-size: var(--text-xs); padding: 3px 12px;
  border-radius: 12px; font-weight: 600;
}
.card-detail-skill {
  font-size: var(--text-sm); color: var(--text-secondary);
  line-height: 1.7; margin: 12px 0; white-space: pre-wrap;
}
.card-detail-flavor {
  font-size: var(--text-sm); color: var(--text-muted);
  font-style: italic; margin-bottom: 16px;
}
.card-detail-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px;
}
.card-detail-stat {
  background: var(--surface-2); padding: 6px 10px;
  border-radius: var(--radius-sm); font-size: var(--text-xs);
}
.card-detail-stat .label { color: var(--text-muted); }
.card-detail-stat .val { font-weight: 600; margin-left: 4px; }

/* ── Card play stage (center-rise animation) ─────────────── */
.card-play-stage {
  position: fixed;
  z-index: 460;
  width: 200px;
  pointer-events: none;
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 0 30px color-mix(in srgb, var(--card-accent) 30%, transparent);
  overflow: visible;
  animation: cardPlayAnimation 1.7s ease-out forwards;
  /* Base anchored at viewport centre; motion is transform-only (compositor-friendly). */
  left: 50vw;
  top: 50vh;
  will-change: transform, opacity;
}
/* Transform/opacity-only keyframes — no per-frame layout from animating left/top.
   translateX uses -50% (element-width-independent) so centring holds at any card width. */
@keyframes cardPlayAnimation {
  0% {
    transform: translate(calc(-50% + var(--start-x, 50vw) - 50vw), calc(var(--start-y, 80vh) - 50vh)) scale(var(--start-scale, 0.7)) rotate(var(--start-rotation, 0deg));
    opacity: 1;
  }
  30% {
    transform: translate(-50%, -200px) scale(0.9) rotate(0deg);
    opacity: 1;
  }
  60% {
    transform: translate(-50%, -140px) scale(1.3) rotate(0deg);
    opacity: 1;
  }
  85% {
    transform: translate(-50%, -140px) scale(1.3) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -140px) scale(0.8) rotate(0deg);
    opacity: 0;
  }
}

/* ── Rush Q reveal ────────────────────────────────────────── */
.rush-q-reveal {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,.95);
  display: flex; align-items: center; justify-content: center;
  animation: rushFadeIn 0.4s ease;
  border: 4px solid var(--type-quarter-event);
  box-shadow: 0 0 100px rgba(239,68,68,.5), inset 0 0 100px rgba(239,68,68,.1);
}
@keyframes rushFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.rush-q-card {
  width: 320px;
  text-align: center;
  animation: rushCardFlip 0.8s ease-out;
}
@keyframes rushCardFlip {
  0%   { transform: perspective(800px) rotateY(90deg) scale(0.6); opacity: 0; }
  25%  { transform: perspective(800px) rotateY(-15deg) scale(1.1); opacity: 0.8; }
  50%  { transform: perspective(800px) rotateY(10deg) scale(1.05); opacity: 1; }
  75%  { transform: perspective(800px) rotateY(-5deg) scale(1.02); }
  100% { transform: perspective(800px) rotateY(0) scale(1); }
}
.rq-card-img {
  width: 100%; border-radius: 12px; margin-bottom: 16px;
  box-shadow: 0 0 80px rgba(239,68,68,.4);
}
.rq-title { font-size: var(--text-xl); font-weight: 700; color: var(--type-quarter-event); margin-bottom: 8px; }
.rq-skill { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px; }
.rq-effect-type { font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 16px; }
.rq-warning {
  font-size: var(--text-lg); font-weight: 800; color: var(--type-quarter-event);
  animation: pulse 1.2s infinite; margin-bottom: 12px;
}
.rq-all-players {
  font-size: var(--text-lg); font-weight: 700; color: var(--type-bonus-project);
  animation: flash 0.8s infinite alternate; margin-bottom: 16px;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}
@keyframes flash {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}
.rq-btn { margin-top: 8px; }

/* ── Effect dialog ────────────────────────────────────────── */
.effect-card-img {
  text-align: center; margin-bottom: 12px;
}
.effect-dialog .effect-desc {
  font-size: var(--text-sm); color: var(--text-secondary);
  line-height: 1.7; margin-bottom: 16px; white-space: pre-wrap;
}
.effect-dialog .effect-result {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
  font-size: var(--text-sm); margin-bottom: 16px;
}
.effect-dialog .effect-result .effect-outcome {
  color: var(--text-primary); font-weight: 600; margin-bottom: 4px;
}
.effect-dialog .effect-result .effect-detail {
  color: var(--text-muted); font-size: var(--text-xs);
}
.effect-dialog .effect-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}

/* ── Reaction window ──────────────────────────────────────────
   Same modal as every other choice, but a targeted attack resolving against
   you must not read like a routine prompt — the left rule and the stake line
   are the only signals that this one is being done TO you. */
.effect-dialog--reaction {
  border-left: 3px solid var(--stat-penalty);
}
.effect-dialog--reaction .modal-header h3 {
  color: var(--stat-penalty);
}
.choice-stake {
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
  padding: 8px 12px; margin-bottom: 12px;
  font-size: var(--text-sm); font-weight: 600;
  color: var(--warn-ink);
}

/* ── Project complete modal ───────────────────────────────── */
.complete-modal-reward {
  text-align: center; margin-bottom: 16px;
}
.complete-proj-img {
  width: 140px; border-radius: 8px; margin-bottom: 8px;
}
.complete-modal-reward .reward-amount {
  font-size: var(--text-2xl); font-weight: 700; color: var(--stat-reward);
}
.complete-modal-people {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px;
}
.complete-person-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2); border: 2px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: border-color var(--dur), background var(--dur);
}
.complete-person-option:hover {
  border-color: var(--type-talent); background: color-mix(in srgb, var(--type-talent) 8%, transparent);
}
.complete-person-option.selected {
  border-color: var(--type-talent); background: color-mix(in srgb, var(--type-talent) 15%, transparent);
}
.complete-person-name { font-size: var(--text-sm); font-weight: 600; }
.complete-person-role { font-size: var(--text-xs); color: var(--text-muted); }

/* ── Pending effects ───────────────────────────────────────── */
/* ── Effect rails ──────────────────────────────────────────────
   Left: what is working for you. Right: what rivals and the company are doing
   to you. They sit inside .board, so they inherit its max-width and can never
   steal width from the board — they are the board. */
.effect-rails {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
@media (max-width: 900px) { .effect-rails { grid-template-columns: 1fr; } }

.rail {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--surface-1);
}
.rail-label {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--rail-hue);
}
.rail-buffs   { --rail-hue: var(--pos-ink); }
.rail-threats { --rail-hue: var(--neg-ink); }
.rail-empty { font-size: var(--text-xs); color: var(--text-faint); }
.rail-more { font-size: .66rem; color: var(--text-muted); padding-left: 2px; }

.rail-card {
  --rc-size: 46px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--rail-hue) 26%, var(--border-subtle));
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.rail-card-face { flex-shrink: 0; line-height: 0; }
/* Systemic effects (Innovation Tax, Appropriated Glory) have no card in the
   deck, so the face falls back to a plain plate rather than nothing. */
.rail-card-stub {
  display: grid;
  place-items: center;
  width: 46px;
  height: 64px;
  padding: 4px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-xs);
  font-size: .52rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-faint);
}
.rail-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rail-card-title { font-size: var(--text-xs); font-weight: 700; color: var(--text-primary); }
.rail-card-sub { font-size: .68rem; line-height: 1.4; color: var(--text-secondary); }
.rail-card-meta {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--rail-hue);
}

/* An active effect should read as live. The sweep is a conic gradient rotated
   through a registered custom property — a plain background-position animation
   cannot rotate a conic. */
@property --rail-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
.rail-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--rail-angle),
    transparent 0deg 250deg,
    color-mix(in srgb, var(--rail-hue) 85%, transparent) 320deg,
    transparent 360deg);
  /* Ring, not fill: mask out the interior so only the border lights up. */
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: railSweep 3.4s linear infinite;
  pointer-events: none;
}
@keyframes railSweep { to { --rail-angle: 360deg; } }

@media (prefers-reduced-motion: reduce) {
  .rail-card::before {
    animation: none;
    background: color-mix(in srgb, var(--rail-hue) 55%, transparent);
  }
}
.budget-pool {
  display: flex; align-items: center; gap: 6px;
}
.budget-label {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  white-space: nowrap;
}
.budget-track {
  width: 60px; height: 6px;
  background: var(--film-2);
  border-radius: 3px;
  overflow: hidden;
}
.budget-fill {
  height: 100%; border-radius: 3px;
  transition: width 0.3s ease;
}
.budget-fill-cap { background: var(--type-project); }
.budget-fill-op { background: var(--type-soft); }
.budget-val {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ── Budget cost badge (on hand cards) ───────────────────── */
.budget-cost-badge {
  position: absolute;
  top: 4px; right: 4px;
  font-size: 0.5rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--type-soft) 20%, transparent);
  color: var(--type-soft);
  border: 1px solid color-mix(in srgb, var(--type-soft) 40%, transparent);
  z-index: 10;
  pointer-events: none;
}
.budget-cost-badge.insufficient {
  background: color-mix(in srgb, var(--type-quarter-event) 20%, transparent);
  color: var(--type-quarter-event);
  border-color: color-mix(in srgb, var(--type-quarter-event) 40%, transparent);
}

/* ── Budget disabled card state ──────────────────────────── */
.hand-card.budget-disabled {
  opacity: 0.5;
  filter: grayscale(0.4);
}

/* ── Convert button ──────────────────────────────────────── */
.btn-convert {
  background: color-mix(in srgb, var(--type-soft) 13%, transparent);
  color: var(--type-soft);
  border: 1px solid color-mix(in srgb, var(--type-soft) 26%, transparent);
}
.btn-convert:hover:not(:disabled) {
  background: color-mix(in srgb, var(--type-soft) 20%, transparent);
}
.btn-retro {
  background: color-mix(in srgb, var(--type-soft) 13%, transparent);
  color: var(--type-soft);
  border: 1px solid color-mix(in srgb, var(--type-soft) 26%, transparent);
}
.btn-retro:hover:not(:disabled) {
  background: color-mix(in srgb, var(--type-soft) 20%, transparent);
}

/* ── Wide screens — scale up hand cards ───────────────────── */
@media (min-width: 1600px) {
  .hand-card { --rc-size: 176px; }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .game-layout { flex-direction: column; overflow: visible; }
  .ai-side-panel.left { width: 100%; border-right: none; border-bottom: 1px solid var(--border-subtle); }
  .ai-side-panel.left:not(.collapsed) { width: 100%; }
  .ai-toggle-btn.left::after { content: 'Opponents \25BC'; }
  .ai-side-panel.left:not(.collapsed) .ai-toggle-btn.left::after { content: 'Opponents \25B2'; }
  .right-col { width: 100%; border-left: none; border-top: 1px solid var(--border-subtle); }
  .board-col { padding: 8px var(--space-4); overflow-y: visible; }
  .board-columns { flex-direction: column; }

  /* Hand dock: pinned to the viewport bottom while the board scrolls,
     so the player's cards and actions are always reachable. */
  .hand-strip {
    flex-direction: column;
    align-items: stretch;
    position: sticky;
    bottom: 0;
    z-index: var(--z-panel);
    background: color-mix(in srgb, var(--bg) 96%, black);
    margin: 0 calc(-1 * var(--gap-sm));
    padding: 4px var(--gap-sm) 0;
  }
  .actions { border-right: none; border-bottom: 1px solid var(--border-subtle); }
  .action-bar { flex-direction: row; flex-wrap: wrap; }
  .action-bar .btn { min-height: 44px; }
  .hand { padding: 4px var(--space-4) 2px; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .hand-cards { /* Flat scroll row — the fan rotation fights scroll-snap on touch */
    justify-content: flex-start;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 20px;
    padding: 6px 8px 10px;
  }
  .hand-card { --rc-size: 128px; width: var(--rc-size); margin: 0 4px; scroll-snap-align: center; transform: none; }
  .hand-card.selected { transform: translateY(-8px); }
  .top-bar { padding: 10px var(--space-4); }
  .markets-row { flex-direction: column; gap: 8px; }
  .market-panel { min-width: 0; }

  /* T4A: Horizontal scroll mode enhancements */
  .hand-strip.horizontal-scroll .hand-cards {
    justify-content: flex-start;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 20px;
  }
  .hand-strip.horizontal-scroll .hand-card {
    margin: 0 4px;
    scroll-snap-align: center;
  }

  /* Phase indicator — compact single-line on tablet */
  .phase-indicator { padding: 3px 8px; }
  .phase-divider { display: none; }
  .phase-step { font-size: 0.55rem; padding: 2px 6px; }
  .phase-sep { font-size: 0.5rem; }

  /* Budget bar — compact on mobile */
  .budget-bar { gap: 8px; padding: 3px 8px; }
  .budget-track { width: 40px; }
  .budget-label { font-size: 0.5rem; }
  .budget-val { font-size: 0.5rem; }

  /* Game log — limit height, collapsible */
  .game-log { max-height: 120px; }
  .log-section.expanded .game-log { max-height: none; }
  .log-toggle-btn {
    display: flex; align-items: center; justify-content: center;
    width: 100%; padding: 6px; border: none;
    background: var(--surface-2); color: var(--text-muted);
    font-size: var(--text-xs); cursor: pointer;
    border-top: 1px solid var(--border-subtle);
  }
  .log-toggle-btn:hover { color: var(--text-secondary); }

  /* Touch targets (WCAG 2.5.5): bump small controls + tappable rows to >=44px */
  .action-bar .btn { min-height: 44px; }
  .hand-toolbar { flex-direction: row; justify-content: center; gap: 8px; padding: 4px; }
  .hand-toolbar-btn { width: 44px; height: 44px; font-size: 15px; }
  .log-collapse-btn { width: 32px; height: 32px; font-size: 11px; }
  .proj-row, .person-row, .market-strip { min-height: 44px; }

  .card-detail-modal { flex-direction: column; }
  .card-detail-img { width: 140px; }
  .card-play-stage { width: 160px; }
  .card-hover-preview { display: none; }
}

@media (max-width: 480px) {
  .setup-card { padding: 24px; margin: 20px auto; }
  .hand-card { --rc-size: 118px; width: var(--rc-size); margin: 0 3px; }
  .market-strip { font-size: 0.6rem; padding: 4px 6px; }
  .pr-name { max-width: 90px; }
  .pr-progress { width: 36px; }
  .q-dot { width: 24px; height: 24px; font-size: 0.65rem; }
  .score-chip { padding: 3px 8px; font-size: 0.65rem; }
  .action-bar .btn { padding: 6px 10px; font-size: 0.65rem; min-height: 44px; }

  /* Phase indicator — even more compact on mobile */
  .phase-indicator { gap: 2px; padding: 2px 6px; }
  .phase-step { font-size: 0.5rem; padding: 1px 4px; }
}

/* ── Right-col: no special collapse styles needed.           */
/* Collapse is handled by .log-section.log-collapsed above.  */

/* ── Player REP bar (right-col) ──────────────────────────── */
.player-score-bar {
  display: flex; flex-direction: column; gap: 7px;
  padding: 8px 10px; border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-1);
}
.psb-rep { display: flex; align-items: center; justify-content: space-between; }
.psb-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.psb-val { font-size: 18px; font-weight: 700; color: var(--accent-bright); }

/* ── Foundation meter (hidden org-health axis) ────────────────── */
.psb-foundation { display: flex; flex-direction: column; gap: 4px; cursor: help; }
.psb-found-head { display: flex; align-items: center; justify-content: space-between; }
.psb-found-band { font-size: 10px; font-weight: 700; letter-spacing: 0.3px; color: var(--found-color); }
.found-meter { height: 6px; border-radius: 3px; background: var(--film-2); overflow: hidden; }
.found-fill {
  height: 100%; border-radius: 3px;
  background: var(--found-color);
  transition: width 0.5s var(--ease-out), background 0.4s var(--ease-out);
}

/* Band colours — shared by the meter and rival panels via --found-color. */
.foundation-solid     { --found-color: var(--pos); }
.foundation-strained  { --found-color: var(--accent-bright); }
.foundation-cracking  { --found-color: var(--type-trait); }
.foundation-crumbling { --found-color: var(--neg); }

.ai-found-band {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.3px;
  color: var(--found-color);
  padding: 1px 6px; border-radius: 6px;
  background: color-mix(in srgb, var(--found-color) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--found-color) 30%, transparent);
}
.foundation-crumbling.psb-foundation .found-meter,
.foundation-cracking.psb-foundation .found-meter { box-shadow: 0 0 0 1px color-mix(in srgb, var(--found-color) 40%, transparent); }

/* ── Rush Q telegraph (incoming quarter-end event) ─────────── */
.psb-next-rushq {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 8px; border-radius: 8px;
  background: color-mix(in srgb, var(--type-quarter-event) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--type-quarter-event) 30%, transparent);
  cursor: help;
}
.psb-next-rushq .psb-label { color: var(--type-quarter-event); display: inline-flex; align-items: center; gap: 4px; }
.psb-next-rushq .nrq-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }

/* ── Action-point meter (dock) ──────────────────────────────── */
.ap-meter {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--film-1);
  border: 1px solid var(--film-2);
  cursor: help;
}
.ap-label {
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.ap-pips { display: inline-flex; gap: 4px; }
.ap-pip {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--film-2);
  transition: background 0.2s var(--ease-out);
}
.ap-pip.on { background: var(--accent-bright); box-shadow: 0 0 6px color-mix(in srgb, var(--accent-bright) 50%, transparent); }
.ap-meter.ap-pressured { border-color: color-mix(in srgb, var(--type-trait) 40%, transparent); }
.ap-meter.ap-pressured .ap-label { color: var(--type-trait); }

/* ── Quarter recap card ─────────────────────────────────────── */
.quarter-recap-overlay {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 4, 10, 0.72);
  backdrop-filter: blur(3px);
}
.quarter-recap {
  width: min(420px, 92vw);
  background: var(--surface-2);
  border: 1px solid var(--film-2);
  border-radius: 14px;
  padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 18px 50px var(--shadow-tint);
  animation: fadeInUp 0.25s var(--ease-out, ease-out);
}
.qr-head {
  font-size: 15px; font-weight: 700; letter-spacing: 0.4px;
  display: flex; align-items: center; gap: 8px;
  color: var(--accent-bright);
}
.qr-section {
  font-size: 13px; display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--film-1);
}
.qr-section.good { color: var(--pos); }
.qr-section.bad { color: var(--type-quarter-event); }
.qr-section.warn { color: var(--accent-bright); }
.qr-section.muted { color: var(--text-muted); }
.qr-foundation.changed { color: var(--type-trait); }
.qr-standings { display: flex; flex-direction: column; gap: 4px; padding: 4px 2px; }
.qr-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px;
  font-size: 12.5px; color: var(--text-secondary);
}
.qr-row.qr-you { color: var(--text-primary); font-weight: 600; }
.qr-delta.good { color: var(--pos); }
.qr-delta.bad { color: var(--type-quarter-event); }
.qr-total { color: var(--text-muted); min-width: 52px; text-align: right; }
.qr-btn { margin-top: 6px; }

/* ── Card type label (above hand card) ───────────────────── */
.card-type-label {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  font-size: 8px; font-weight: 700; padding: 1px 5px; border-radius: 3px;
  border: 1px solid; white-space: nowrap; pointer-events: none;
  letter-spacing: 0.3px; text-transform: uppercase; z-index: 3;
}

/* ── Hover play button ───────────────────────────────────── */
.hand-play-btn {
  position: absolute; bottom: calc(100% - 16px); left: 50%; transform: translateX(-50%);
  background: color-mix(in srgb, var(--brand-violet) 90%, transparent); color: #fff; border: none;
  padding: 5px 12px; border-radius: 12px; font-size: 10px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease 0s; z-index: 20;
}
.hand-cards.play-turn .hand-card:hover .hand-play-btn {
  opacity: 1; pointer-events: auto;
  transition: opacity 0.15s ease 0.6s;
}
.hand-card.selected .hand-play-btn { display: none; }

/* ── Skill text toggle ───────────────────────────────────── */
.hand-skill-text { display: none; } /* deprecated — skill text now shown inside card via .rc-desc */

/* Show .rc-desc inside small cards when skill text toggle is active */
.hand-strip.show-skill .hand-card .rush-card.rc-sm .rc-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.48rem;
  line-height: 1.3;
  padding: 2px 5px 3px;
}

/* ── Compact hand list ───────────────────────────────────── */
.hand-compact-list {
  display: flex; flex-direction: column; gap: 3px; flex: 1;
  overflow-y: auto; max-height: 160px; padding: 4px 8px;
}
.hcl-row {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px;
  border-radius: 6px; border-left: 3px solid var(--card-accent);
  background: var(--surface-2); cursor: pointer; transition: background 0.1s;
}
.hcl-row:hover, .hcl-row.selected { background: var(--surface-2); filter: brightness(1.15); }
.hcl-pip { width: 8px; height: 8px; border-radius: 50%; background: var(--card-accent); flex-shrink: 0; }
.hcl-name { flex: 1; font-size: 11px; font-weight: 500; color: var(--text-primary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hcl-type { font-size: 9px; color: var(--text-muted); white-space: nowrap; }
.hcl-val  { font-size: 9px; color: var(--text-muted); white-space: nowrap; }
.hcl-play { font-size: 10px; padding: 2px 6px; border-radius: 4px; border: none; cursor: pointer; background: var(--accent-bright); color: var(--accent-contrast); font-weight: 600; }
.hcl-view { font-size: 10px; padding: 2px 6px; border-radius: 4px; border: none; cursor: pointer; background: var(--surface-2); color: var(--text-secondary); filter: brightness(1.4); }

/* ── Hand toolbar ────────────────────────────────────────── */
.hand-toolbar {
  display: flex; flex-direction: column; gap: 4px;
  padding: 0 4px; justify-content: center; flex-shrink: 0;
}
.hand-toolbar-btn {
  width: 24px; height: 24px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-muted); font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.hand-toolbar-btn:hover { background: var(--surface-2); filter: brightness(1.3); color: var(--text-primary); }
.hand-strip.compact   #btn-compact-hand,
.hand-strip.show-skill #btn-show-skill,
.hand-strip.horizontal-scroll #btn-horizontal-scroll {
  background: var(--accent-bright);
  color: #000;
  border-color: var(--accent-bright);
}
.hand-strip.compact   #btn-compact-hand,
.hand-strip.show-skill #btn-show-skill {
  background: color-mix(in srgb, var(--accent-bright) 15%, transparent);
  color: var(--accent-bright); border-color: var(--accent-bright);
}

/* ── Post-game debrief modal ──────────────────────────────── */
.debrief-header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.debrief-header h2 {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.debrief-header p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.debrief-questions {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}
.debrief-questions::-webkit-scrollbar {
  width: 6px;
}
.debrief-questions::-webkit-scrollbar-track {
  background: var(--surface-2);
  border-radius: 3px;
}
.debrief-questions::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.debrief-question {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.debrief-question:last-child {
  margin-bottom: 0;
}

.question-header {
  margin-bottom: 12px;
}
.question-category {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-contrast);
  margin-bottom: 8px;
}
.question-text {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
}

.debrief-response {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--text-sm);
  line-height: 1.5;
  resize: vertical;
  transition: border-color var(--dur);
}
.debrief-response:focus {
  outline: none;
  border-color: var(--accent-bright);
}

.question-lesson {
  margin-top: 12px;
  padding: 12px;
  background: color-mix(in srgb, var(--accent-bright) 8%, transparent);
  border-left: 4px solid var(--accent-bright);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.6;
}

.debrief-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Debrief history */
.debrief-history {
  margin-top: 20px;
}
.debrief-history h3 {
  font-size: var(--text-lg);
  margin-bottom: 12px;
  color: var(--text-primary);
}
.history-session {
  margin-bottom: 12px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.session-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.session-insights {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── Timeline and Reputation Graph ─────────────────────────── */

.timeline-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius);
  margin-bottom: 16px;
  gap: 8px;
}

.timeline-quarter {
  flex: 1;
  text-align: center;
  position: relative;
  padding: 8px 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color var(--dur), background var(--dur);
}

.timeline-quarter.completed {
  color: var(--stat-reward);
  background: rgba(52, 211, 153, 0.1);
}

.timeline-quarter.current {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}

.timeline-quarter::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 4px;
  border-radius: 2px;
  opacity: 0;
  transition: opacity var(--dur);
}

.timeline-quarter.current::after {
  background: var(--accent);
  opacity: 1;
  animation: slideUp 0.3s ease-out;
}

/* ── Reputation graph ──────────────────────────────────────────
   Collapsed to a summary bar by default. It answers "am I winning", which is
   worth a glance and not worth 260px of the board on every turn. */
.graph-container {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}

.graph-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 9px var(--space-4);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.graph-toggle:hover { background: var(--film-1); color: var(--text-primary); }

.gt-caret {
  width: 0;
  height: 0;
  flex-shrink: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  opacity: .6;
  transition: transform var(--dur) var(--ease-out);
}
[data-open="true"] .gt-caret { transform: rotate(90deg); }

.gt-title {
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--text-faint);
}
/* The collapsed bar still has to say something useful. */
.gt-summary {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* display, not an animated height: a transitioning height inside the board's
   single scroll region makes the scrollbar jump on every frame. */
[data-open="false"] .graph-body { display: none; }
.graph-body { padding: 0 var(--space-4) var(--space-4); }

/* Capped rather than full-bleed: `width:100%` on a viewBox'd SVG grows the
   height with the container, and a 1000px-wide board gave a 444px chart —
   taller than the 200px version it replaced. Circles stay round because the
   aspect ratio is never forced. */
.rep-graph { display: block; width: 100%; max-width: 600px; height: auto; margin: 0 auto; }
.rep-grid { stroke: var(--border); stroke-width: 1; opacity: .55; }
.rep-axis { fill: var(--text-faint); font-size: 8px; font-family: var(--font); }

/* Every series colour arrives through currentColor on the group, so the SVG
   itself carries no hex and both themes re-skin for free. --series carries the
   same value for the legend swatch, which needs the hue while its label keeps
   reading in --text-secondary. */
.rep-series-0 { --series: var(--series-1); color: var(--series-1); }
.rep-series-1 { --series: var(--series-2); color: var(--series-2); }
.rep-series-2 { --series: var(--series-3); color: var(--series-3); }
.rep-series-3 { --series: var(--series-4); color: var(--series-4); }
.rep-series-4 { --series: var(--series-5); color: var(--series-5); }

.graph-legend {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}
.legend-color {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--series, currentColor);
  flex-shrink: 0;
}

/* ── Mobile Responsiveness ─────────────────────────────────── */
/* The legacy body.compact-mode layout (and its floating toggle) targeted a
   DOM that no longer exists. Mobile layout is now handled directly by the
   768/480px breakpoints above — one layout that works, no mode switch. */

@media (max-width: 768px) {
  /* Bottom-sheet modals with large touch targets */
  .modal-content {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: none;
    max-height: 84dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
  }

  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-content .btn { min-height: 44px; }
}

/* Touch device optimizations */
@media (hover: none) {
  .hand-card {
    cursor: pointer;
  }

  .hand-card:hover {
    transform: none;
    box-shadow: none;
  }

  .hand-card:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 25%, transparent);
  }
}

/* Tap-to-select assignment mode */
.assign-select-mode .person-card {
  cursor: pointer;
  position: relative;
}

.assign-select-mode .person-card.selected::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
}

.assign-select-mode .project-card {
  cursor: pointer;
}

.assign-select-mode .project-card.highlight {
  border-color: var(--accent-bright);
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent-bright) 35%, transparent);
}

/* ── Trait identity: board badge, briefing modal, game-over block ── */
.trait-badge {
  background: color-mix(in srgb, var(--brand-violet) 22%, transparent);
  color: var(--text-primary);
  border: 1px solid color-mix(in srgb, var(--brand-violet) 45%, transparent);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur), border-color var(--dur);
}
.trait-badge:hover {
  background: color-mix(in srgb, var(--brand-violet) 34%, transparent);
  border-color: var(--brand-violet);
}

.trait-briefing { max-width: 460px; }
.trait-briefing .tb-archetype {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--accent-bright);
  font-weight: 700;
}
.trait-briefing .tb-name {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 12px;
}
.trait-briefing .tb-blurb {
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 14px;
}
.trait-briefing .tb-row {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.trait-briefing .tb-strength { background: rgba(52,211,153,.10); border-left: 3px solid var(--pos); }
.trait-briefing .tb-watch    { background: rgba(244,138,154,.10); border-left: 3px solid var(--stat-penalty); }
.trait-briefing .tb-tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: 6px;
  opacity: .85;
}
.trait-briefing .tb-strength .tb-tag { color: var(--pos); }
.trait-briefing .tb-watch .tb-tag { color: var(--stat-penalty); }
.trait-briefing .tb-note {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
  margin: 10px 0 16px;
}

.game-over-trait {
  margin: 16px 0;
  padding: 14px 16px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: left;
}
.game-over-trait .got-archetype { font-weight: 600; color: var(--accent-bright); margin-bottom: 6px; }
.game-over-trait .got-trait-name { color: var(--text-muted); font-weight: 400; }
.game-over-trait .got-blurb { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5; margin-bottom: 8px; }
.game-over-trait .got-reflect { font-size: var(--text-sm); color: var(--text-primary); }
.standing-archetype { font-size: var(--text-xs); color: var(--text-muted); margin-left: 6px; }
.standing-row.is-human { outline: 1px solid color-mix(in srgb, var(--brand-violet) 40%, transparent); border-radius: var(--radius-sm); }

/* ══════════════════════════════════════════════════════════════
   UX OVERHAUL — game-feel polish (2.4)
   Cohesive play-area atmosphere, action dock, segmented toolbar.
   ══════════════════════════════════════════════════════════════ */

/* ── Play-area atmosphere — warm table light from the top ─────── */
.board-col {
  background:
    radial-gradient(130% 90% at 50% -20%, color-mix(in srgb, var(--accent) 5%, transparent) 0%, transparent 55%);
}

/* Board panels read as one felt surface: soft, consistent depth. */
.player-panel,
.market-panel {
  background: linear-gradient(180deg, var(--surface-1), color-mix(in srgb, var(--bg-elev) 60%, transparent));
  box-shadow: 0 1px 0 var(--film-1) inset, 0 4px 16px rgba(10,6,2,.28);
}

/* ── Market strips — subtle lift + accent bar on hover ────────── */
.market-strip--compact { transition: border-color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast); }
.market-strip--compact:hover { transform: translateX(2px); }

/* ── Project / person rows — gentle hover feedback ────────────── */
.proj-row, .person-row, .hcl-row { transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast); }
.proj-row:hover, .person-row:hover { transform: translateX(2px); border-color: var(--border-strong); }

/* ── Action dock — a deliberate control panel, not floating btns ─ */
.actions {
  padding: 12px 10px;
  border-right: none;
  align-items: stretch;
}
.action-bar {
  gap: 6px;
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow-sm);
}

.action-help {
  display: flex;
  gap: 4px;
  margin-top: 2px;
  padding-top: 7px;
  border-top: 1px solid var(--border-subtle);
}
.action-help-btn {
  flex: 1;
  padding: 5px 6px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-faint);
  font-family: var(--font);
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--dur), background var(--dur);
}
.action-help-btn:hover { color: var(--text-primary); background: var(--film-2); }
.action-bar .btn {
  justify-content: flex-start;
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 0.74rem;
  transition: transform var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.action-bar .btn:hover { transform: translateY(-1px); }
.action-bar .btn:active { transform: translateY(0); }
/* Primary calls-to-action glow so the eye lands on the next move. */
.action-bar .btn-play {
  box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 20%, transparent);
}
.action-bar .btn-end {
  background: color-mix(in srgb, var(--brand-violet) 16%, transparent);
  color: var(--text-primary);
  border-color: color-mix(in srgb, var(--brand-violet) 34%, transparent);
}
.action-bar .btn-end:hover { background: color-mix(in srgb, var(--brand-violet) 26%, transparent); }

/* ── Hand toolbar — segmented control ─────────────────────────── */
/* The toolbar keeps a wide flex basis so the fan stays centred, but the
   plate itself only ever wraps its three buttons. */
.hand-toolbar {
  gap: 3px;
  padding: 0;
  background: none;
  border: none;
}
.hand-toolbar-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-1);
  border-radius: 7px;
}
.hand-toolbar-btn:hover { background: var(--surface-2); filter: none; }

/* ── AI panel edge toggle — clearer affordance ────────────────── */
.ai-toggle-btn {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.ai-toggle-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }

/* ── Hand strip — anchor the fan on a defined ledge ───────────── */
.hand-label {
  font-weight: 600;
  color: var(--text-secondary);
}

/* ══════════════════════════════════════════════════════════════
   STORY OF THE YEAR — chronicle recap timeline
   ══════════════════════════════════════════════════════════════ */
.story-content { max-width: 620px; }
.story-thesis {
  font-size: var(--text-sm); color: var(--text-secondary);
  font-style: italic; line-height: 1.5;
  margin: 4px 0 18px; padding-left: 12px;
  border-left: 2px solid var(--accent-soft);
}
.story-timeline { display: flex; flex-direction: column; gap: 4px; }
.story-quarter { display: flex; gap: 12px; align-items: flex-start; }
.story-q-label {
  flex-shrink: 0; width: 34px;
  font-family: var(--font-display); font-weight: 700; font-size: 0.8rem;
  color: var(--accent-bright);
  padding-top: 8px; text-align: right;
}
.story-beats {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 6px;
  padding: 6px 0 10px;
  border-left: 1px solid var(--border-subtle);
  padding-left: 14px; position: relative;
}
.story-beat { display: flex; gap: 8px; align-items: baseline; font-size: var(--text-sm); line-height: 1.45; }
.story-icon { flex-shrink: 0; font-size: 0.8rem; width: 14px; text-align: center; }
.story-text { color: var(--text-secondary); }
.story-milestone .story-icon { color: var(--brand-violet-2); }
.story-milestone .story-text { color: var(--text-primary); font-weight: 500; }
.story-decision .story-icon { color: var(--accent-bright); }
.story-shift .story-icon { color: var(--text-muted); }
.story-shift .story-text { color: var(--text-muted); }
.story-consequence .story-icon { color: var(--type-quarter-event); }
.story-consequence .story-text { color: color-mix(in srgb, var(--type-quarter-event) 75%, var(--text-primary)); }
.story-cause {
  display: inline-block; margin-left: 6px;
  font-size: 0.7rem; color: var(--text-muted); font-style: italic;
}
.story-footer { margin-top: 16px; text-align: center; }
.story-final {
  display: inline-block; font-size: var(--text-sm);
  padding: 6px 14px; border-radius: 10px;
  color: var(--found-color);
  background: color-mix(in srgb, var(--found-color) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--found-color) 30%, transparent);
}
.story-final strong { color: var(--found-color); }

/* ══════════════════════════════════════════════════════════════
   PLAY PROMPT — floating action popup for the selected card
   ══════════════════════════════════════════════════════════════ */
.play-prompt {
  /* Centered inspector: the selected card + its options sit dead-centre of the
     board region (viewport minus the hand strip) — where the eye already is. */
  position: fixed;
  z-index: calc(var(--z-toast) + 40);
  left: 50%;
  /* Centre of the free board area: below the header (~84px), above the hand. */
  top: calc(84px + (100vh - 84px - var(--hand-strip-height, 240px)) / 2);
  transform: translate(-50%, -50%);
  width: 336px; max-width: calc(100vw - 28px);
  max-height: calc(100vh - var(--hand-strip-height, 240px) - 108px);
  display: flex;
  transition: opacity 0.16s var(--ease-out), transform 0.22s var(--ease-snap);
}
.play-prompt.hidden { opacity: 0; transform: translate(-50%, -46%) scale(0.97); pointer-events: none; }
/* The card art scrolls if space runs out; the Play action stays pinned. */
.play-prompt .pp-inner { display: flex; flex-direction: column; min-height: 0; width: 100%; }
.pp-card {
  display: flex; justify-content: center; margin: 10px 0 12px;
  overflow-y: auto; min-height: 0; flex: 1;
  scrollbar-width: thin;
}
.pp-card { --rc-size: var(--rc-inspect); }
.pp-card .rush-card.rc-md { flex-shrink: 0; height: fit-content; }
@media (max-width: 768px) {
  .play-prompt { right: 8px; left: 8px; top: auto; bottom: 8px; width: auto; max-height: 70vh; transform: none; }
  .play-prompt.hidden { transform: translateY(20px); }
}
.pp-inner {
  background: linear-gradient(180deg, var(--bg-elev), color-mix(in srgb, var(--bg-elev) 80%, #000));
  border: 1px solid color-mix(in srgb, var(--card-accent) 55%, var(--border));
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(10,6,2,.6), 0 0 0 1px color-mix(in srgb, var(--card-accent) 20%, transparent);
  padding: 12px 14px;
}
.pp-head { display: flex; align-items: center; gap: 8px; }
.pp-pip { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pp-name { font-weight: 700; font-size: var(--text-sm); color: var(--text-primary); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-type { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; flex-shrink: 0; }
.pp-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 2px; flex-shrink: 0;
}
.pp-close:hover { color: var(--text-primary); }
.pp-effect { font-size: var(--text-xs); color: var(--text-secondary); line-height: 1.45; margin: 8px 0 10px; }
.pp-play {
  width: 100%; justify-content: center; font-size: 0.82rem; padding: 9px 12px;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 22%, transparent);
}
.pp-blocked {
  font-size: var(--text-xs); color: var(--type-quarter-event);
  background: color-mix(in srgb, var(--type-quarter-event) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--type-quarter-event) 30%, transparent);
  border-radius: var(--radius-sm); padding: 8px 10px; line-height: 1.4;
}
.pp-hint { font-size: 0.62rem; color: var(--text-muted); margin-top: 8px; text-align: center; }
.pp-link { background: none; border: none; color: var(--accent-bright); cursor: pointer; font-size: inherit; padding: 0; text-decoration: underline; }

/* ── Center the hand fan on the viewport (desktop) ────────────── */
/* Give the dock (left) and toolbar (right) equal-width, in-flow gutters so the
   fan sits dead-centre on the board — no overlap, so both stay clickable. */
@media (min-width: 769px) {
  .actions { order: 1; flex: 0 0 232px; align-items: flex-start; border-right: none; }
  .hand { order: 2; flex: 1; min-width: 0; }
  .hand-toolbar {
    order: 3; flex: 0 0 232px;
    flex-direction: row; align-items: center; justify-content: flex-end;
    align-self: flex-end;
    padding: 0 12px 16px 0;
  }
  /* Slightly tighter overlap keeps a 7-card fan within the centre track.
     The horizontal-scroll layout overrides this with its own flat spacing. */
  .hand-card { margin: 0 -32px; }
}

/* ── Story of the Year: export actions + print sheet ─────────── */
.story-actions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
@media print {
  /* _printStory() stamps body.printing-story so only the story timeline prints —
     it doubles as the workshop debrief sheet. */
  body.printing-story header.header-bar,
  body.printing-story #game-screen,
  body.printing-story #setup-screen,
  body.printing-story #game-over-modal,
  body.printing-story #play-prompt,
  body.printing-story #card-hover-preview,
  body.printing-story footer.site-footer,
  body.printing-story .story-actions,
  body.printing-story .modal-close { display: none !important; }
  body.printing-story { background: #fff; overflow: visible; }
  body.printing-story #modal { position: static; display: block; background: #fff; padding: 0; backdrop-filter: none; }
  body.printing-story #modal .modal-content {
    max-width: none; max-height: none; overflow: visible;
    background: #fff; border: none; box-shadow: none; color: #111;
  }
  body.printing-story .story-content h3 { color: #111; }
  body.printing-story .story-thesis { color: #333; border-left-color: var(--stat-value); }
  body.printing-story .story-text { color: #222; }
  body.printing-story .story-milestone .story-text { color: #111; }
  body.printing-story .story-shift .story-text,
  body.printing-story .story-cause { color: #555; }
  body.printing-story .story-consequence .story-text { color: var(--neg); }
  body.printing-story .story-q-label { color: var(--accent-bright); }
  body.printing-story .story-beats { border-left-color: #ccc; }
  body.printing-story .story-final { color: #333; background: none; border-color: #bbb; }
  body.printing-story .story-final strong { color: #111; }
}

/* ── Legibility layer: whispers, foresight, synergy hints ────── */
.story-whisper .story-icon { color: var(--text-muted); }
.story-whisper .story-text { color: var(--text-muted); font-style: italic; }

.foresight-panel {
  margin: 0 0 20px;
  padding: 12px 16px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: left;
}
.fp-title {
  font-size: var(--text-xs); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600;
  margin-bottom: 8px;
}
.fp-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--text-sm); }
.fp-stat { color: var(--text-secondary); }
.fp-stat.good { color: var(--stat-reward); }
.fp-stat.bad { color: var(--type-quarter-event); }

.pp-synergy {
  font-size: var(--text-xs); color: var(--type-project-queue);
  background: color-mix(in srgb, var(--type-project-queue) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--type-project-queue) 25%, transparent);
  border-radius: var(--radius-sm);
  padding: 6px 10px; margin-bottom: 10px; line-height: 1.4;
}
.pp-synergy b { color: var(--stat-reward); }

.ms-synergy {
  flex-shrink: 0;
  font-size: 0.72rem; line-height: 1;
  color: var(--type-project-queue);
  cursor: help;
}

.setup-starter-note { font-size: var(--text-xs); color: var(--text-muted); margin-top: 10px; text-align: center; }
.setup-starter-note a { color: var(--accent-bright); }

/* ── Prediction beat: setup forecast + game-over comparison ──── */
.setup-forecast {
  margin-top: 14px; padding: 12px 14px;
  background: var(--surface-1); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); text-align: left;
}
.setup-forecast-title {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.8px;
  font-weight: 700; color: var(--accent-bright); margin-bottom: 2px;
}
.setup-forecast-hint { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: 8px; }

.forecast-panel {
  margin: 0 0 20px; padding: 12px 16px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius-md); text-align: left;
}
.fc-rows { display: flex; flex-direction: column; gap: 6px; }
.fc-row { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); }
.fc-label { flex: 0 0 110px; color: var(--text-muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.5px; }
.fc-called { color: var(--text-secondary); }
.fc-arrow { color: var(--text-muted); }
.fc-actual { font-weight: 600; }
.fc-mark { margin-left: auto; font-weight: 700; }
.fc-row.hit .fc-mark, .fc-row.hit .fc-actual { color: var(--stat-reward); }
.fc-row.miss .fc-mark { color: var(--type-quarter-event); }

/* ── Sprinter teaching contrast ──────────────────────────────── */
.ai-profile-chip {
  font-size: 0.58rem; font-weight: 700; letter-spacing: 0.4px;
  color: var(--type-quarter-event);
  background: color-mix(in srgb, var(--type-quarter-event) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--type-quarter-event) 30%, transparent);
  border-radius: 6px; padding: 1px 6px; cursor: help; flex-shrink: 0;
}
.ai-profile-chip.ai-profile-rival {
  color: var(--type-power);
  background: color-mix(in srgb, var(--type-power) 12%, transparent);
  border-color: color-mix(in srgb, var(--type-power) 30%, transparent);
}
.story-contrast {
  margin-top: 14px; padding: 10px 14px;
  font-size: var(--text-sm); line-height: 1.5; color: var(--text-secondary);
  background: color-mix(in srgb, var(--type-quarter-event) 7%, transparent);
  border-left: 2px solid color-mix(in srgb, var(--type-quarter-event) 45%, transparent);
  border-radius: var(--radius-sm);
}
