/* ═══ ORP Ganzenbord — Rotterdamse editorial ═══ */

:root {
  --g-50:  #f3f8f1;
  --g-100: #e8f0e4;
  --g-200: #c8e0c0;
  --g-300: #a8cea0;
  --g-400: #7cb342;
  --g-500: #4a9b3c;
  --g-600: #2e7d32;
  --g-700: #1b5e20;
  --g-800: #0d4715;
  --g-900: #07320f;

  --gold-400: #f9a825;
  --gold-500: #e68a00;

  --cream: #f8f6ef;
  --paper: #fdfbf5;
  --ink: #1a1f1a;
  --ink-mute: #5b655a;
  --line: rgba(13, 71, 21, 0.14);
  --line-strong: rgba(13, 71, 21, 0.28);

  --serif: 'Fraunces', 'Georgia', ui-serif, serif;
  --sans: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; overflow: hidden; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
}
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; }
p { line-height: 1.55; }

/* ═══ App layout ═══ */
.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--cream);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 6px;
  background: var(--g-700); color: #fff;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 18px; font-weight: 700;
  letter-spacing: -0.05em;
}
.brand-eyebrow { font-size: 9px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-mute); font-weight: 600; line-height: 1.1; }
.brand-name { font-family: var(--serif); font-size: 15px; color: var(--g-800); font-weight: 600; line-height: 1.1; }

.topbar-proj { text-align: center; font-family: var(--serif); font-size: 14px; color: var(--g-700); font-style: italic; }
.tp-icon { margin-right: 6px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }

.score {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--paper);
  font-family: var(--serif); font-size: 13px;
}
.score-star { color: var(--gold-400); font-size: 14px; }
.score-val { font-weight: 700; color: var(--g-800); }
.score-sub { font-size: 10px; color: var(--ink-mute); font-weight: 500; font-family: var(--mono); }
.score .score-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute); font-family: var(--sans); font-weight: 600; margin-left: 3px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--g-50); color: var(--g-700);
  display: grid; place-items: center; font-size: 14px;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--g-100); }

/* ═══ Main grid ═══ */
.main {
  display: grid;
  grid-template-columns: 210px 1fr 300px;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

/* ═══ Phase rail ═══ */
.rail {
  border-right: 1px solid var(--line);
  padding: 14px 14px;
  background: var(--paper);
  overflow-y: auto;
}
.rail-head { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.rail-eyebrow { font-size: 9px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--g-600); font-weight: 700; margin-bottom: 2px; }
.rail-title { font-size: 18px; color: var(--g-800); line-height: 1.1; }
.rail-lede { display: none; }

.phase-list { list-style: none; display: flex; flex-direction: column; gap: 0; }
.phase-item {
  display: grid;
  grid-template-columns: 3px 1fr;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  transition: all 0.2s;
  opacity: 0.55;
}
.phase-item.on { opacity: 1; }
.phase-item.on .phase-num { background: var(--g-800); color: #fff; }
.phase-item.on .phase-name { color: var(--g-800); }
.phase-item.done { opacity: 0.85; }
.phase-item.done .phase-num { background: var(--g-500); color: #fff; }
.phase-bar { border-radius: 2px; }
.phase-item.on .phase-bar, .phase-item.done .phase-bar { box-shadow: 0 0 0 1px rgba(0,0,0,0.05); }
.phase-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.phase-num {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 3px;
  background: var(--g-100); color: var(--g-700);
  letter-spacing: 0.02em;
}
.phase-name { font-family: var(--serif); font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.phase-doc {
  font-size: 9px; padding: 1px 5px; border-radius: 3px;
  background: var(--g-700); color: #fff; font-weight: 600;
  margin-left: auto; letter-spacing: 0.02em;
}
.phase-mini { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.phase-dots { display: inline-flex; gap: 3px; }
.phase-dots .cd {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--line-strong);
  transition: background 0.25s, transform 0.25s;
}
.phase-dots .cd.on { background: var(--g-600); }
.phase-item.on .phase-dots .cd.on { background: var(--gold-400); }
.phase-count { font-family: var(--mono); font-size: 9px; color: var(--ink-mute); }
.phase-item.on .phase-count { color: var(--g-700); font-weight: 700; }
.phase-desc { display: none; }

/* ═══ Stage (board + timeline) ═══ */
.stage {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 0;
  position: relative;
  background:
    radial-gradient(ellipse at top right, rgba(124, 179, 66, 0.06), transparent 60%),
    var(--cream);
}

.orp-board {
  position: relative;
  overflow: hidden;
  padding: 8px;
}
.orp-path {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.orp-tile {
  position: absolute;
  border-radius: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 4px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  font-size: 10px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  text-align: center;
  overflow: hidden;
}
.orp-tile:hover { transform: translateY(-1px); border-color: var(--g-400); box-shadow: 0 4px 10px rgba(27, 94, 32, 0.12); z-index: 5; }
.tile-num {
  position: absolute; top: 3px; left: 5px;
  font-family: var(--mono); font-size: 8px;
  color: var(--ink-mute); opacity: 0.5;
  letter-spacing: 0.02em;
}
.tile-icon { font-size: 20px; line-height: 1; }
.tile-caption { font-size: 8px; color: var(--ink-mute); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }

.tile-phase { background: #1b5e20; color: #fff; border-color: #0d4715; }
.tile-phase .tile-num { color: rgba(255,255,255,0.5); }
.tile-phase .tile-caption { color: rgba(255,255,255,0.8); }
.tile-phase-badge {
  position: absolute; top: 3px; right: 5px;
  font-size: 8px; font-weight: 700; font-family: var(--mono);
  padding: 1px 4px; border-radius: 3px; color: #fff;
  background: rgba(0,0,0,0.3);
}

.tile-goose { background: var(--g-100); border-color: var(--g-400); }
.tile-finish { background: linear-gradient(135deg, var(--gold-400), var(--gold-500)); border-color: var(--gold-500); color: #fff; }
.tile-finish .tile-num { color: rgba(255,255,255,0.7); }

.tile-wiki { background: #fffdf7; border-color: rgba(249, 168, 37, 0.3); }
.tile-quiz { background: #f3e8f5; border-color: #9c27b0; }
.tile-quiz .tile-icon { color: #6a1b9a; font-family: var(--serif); font-weight: 700; }
.tile-scenario { background: #fff1e0; border-color: #ef6c00; }
.tile-scenario .tile-icon { color: #e65100; font-family: var(--serif); font-weight: 700; }
.tile-hazard { background: #fde8e6; border-color: #c62828; }

.orp-tile.active {
  border-color: var(--gold-400) !important;
  box-shadow: 0 0 0 3px rgba(249, 168, 37, 0.28), 0 6px 16px rgba(0,0,0,0.12);
  transform: scale(1.08);
  z-index: 10;
}
.orp-tile.past { opacity: 0.82; }

.orp-pawn {
  position: absolute;
  width: 36px; height: 36px;
  top: 0; left: 0;
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 50;
  display: grid; place-items: center;
}
.pawn-shell {
  width: 32px; height: 32px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, var(--gold-400));
  border: 2px solid #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25), 0 0 0 1px var(--gold-500);
  display: grid; place-items: center;
  font-size: 16px;
  animation: pawn-bob 1.6s ease-in-out infinite;
}
@keyframes pawn-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* ═══ Timeline ═══ */
.timeline {
  position: relative;
  padding: 8px 16px 10px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.tl-track { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.tl-seg { position: relative; }
.tl-seg-bar {
  height: 5px; border-radius: 3px;
  background: var(--col);
  opacity: 0.35;
  transition: opacity 0.2s;
}
.tl-seg.past .tl-seg-bar { opacity: 1; }
.tl-seg.on .tl-seg-bar {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--dark), 0 0 12px var(--col);
}
.tl-seg-label {
  display: flex; align-items: baseline; gap: 4px;
  margin-top: 3px;
}
.tl-seg-num {
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  color: var(--g-700);
}
.tl-seg-name { font-size: 10px; color: var(--ink-mute); }
.tl-seg.on .tl-seg-name { color: var(--ink); font-weight: 600; }

.tl-progress {
  position: absolute; left: 16px; top: 11px;
  height: 2px; background: var(--g-800);
  transition: width 0.4s ease;
  max-width: calc(100% - 32px);
}
.tl-pawn {
  position: absolute; top: 2px; color: var(--g-800);
  font-size: 9px;
  transform: translateX(-50%);
  transition: left 0.4s ease;
}

/* ═══ Panel (right side) ═══ */
.panel {
  border-left: 1px solid var(--line);
  background: var(--paper);
  padding: 14px 16px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.panel-intro { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.panel-eyebrow { font-size: 9px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--g-600); font-weight: 700; margin-bottom: 2px; }
.panel-title { font-size: 18px; color: var(--g-800); line-height: 1.15; margin-bottom: 8px; }
.panel-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.panel-lede { font-family: var(--serif); font-size: 13.5px; line-height: 1.5; color: var(--ink-mute); }
.chip {
  font-size: 10px; padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px; color: var(--ink-mute);
  background: var(--cream);
}

/* ═══ Chapter card — the primary learning surface ═══ */
.chapter {
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper) 60%, var(--cream) 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 16px 14px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
  position: relative;
  overflow: hidden;
}
.chapter::before {
  content: '';
  position: absolute; inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--ph-col), var(--ph-dark));
}
.chapter-rule {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 10px;
  padding-top: 4px;
}
.ch-num { color: var(--ph-dark); font-weight: 700; }
.ch-dots { display: inline-flex; gap: 4px; }
.cdot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line-strong);
}
.cdot.past { background: var(--ph-col); }
.cdot.on { background: var(--ph-dark); box-shadow: 0 0 0 2px rgba(0,0,0,0.06); }

.ch-q {
  font-family: var(--serif); font-style: italic;
  font-size: 13px; color: var(--ink-mute);
  margin-bottom: 3px;
}
.ch-title {
  font-family: var(--serif); font-size: 30px;
  color: var(--g-800); line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.ch-one {
  font-size: 13px; color: var(--ink);
  line-height: 1.4; margin-bottom: 14px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 12px;
  text-wrap: pretty;
}

.ch-concepts { margin-bottom: 12px; }
.ch-c-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 7px;
}
.ch-c-label {
  font-family: var(--mono); font-size: 9px;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-mute); font-weight: 700;
}
.ch-c-count {
  font-family: var(--mono); font-size: 10px;
  color: var(--ph-dark); font-weight: 700;
}
.ch-c-grid {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.cchip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px 4px 7px;
  font-size: 11.5px;
  border-radius: 999px;
  background: var(--cream);
  border: 1px solid var(--line);
  color: var(--ink-mute);
  font-weight: 500;
  transition: all 0.3s;
}
.cchip-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line-strong);
  transition: background 0.3s, transform 0.3s;
}
.cchip.on {
  background: #fff;
  border-color: var(--ph-dark);
  color: var(--ph-dark);
  font-weight: 600;
}
.cchip.on .cchip-dot {
  background: var(--ph-dark);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.06);
}
.cchip.flash {
  animation: chipFlash 1.6s ease;
}
@keyframes chipFlash {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(249, 168, 37, 0.5); }
  15% { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(249, 168, 37, 0.35); background: #fff8e1; }
  60% { transform: scale(1); box-shadow: 0 0 0 2px rgba(249, 168, 37, 0); }
  100% { box-shadow: 0 0 0 0 rgba(249, 168, 37, 0); }
}

.ch-doc { margin-bottom: 12px; }
.ch-doc-box {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--cream);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  transition: all 0.25s;
}
.ch-doc-box.on {
  background: var(--g-50);
  border: 1px solid var(--ph-dark);
  border-left: 3px solid var(--ph-dark);
}
.ch-doc-ic {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: #fff; color: var(--ink-mute);
  border: 1px solid var(--line-strong);
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.ch-doc-box.on .ch-doc-ic {
  background: var(--ph-dark); color: #fff; border-color: var(--ph-dark);
}
.ch-doc-label {
  font-family: var(--mono); font-size: 9px;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-mute);
  margin-bottom: 1px;
}
.ch-doc-box.on .ch-doc-label { color: var(--ph-dark); font-weight: 700; }
.ch-doc-name {
  font-family: var(--serif); font-size: 14px;
  color: var(--g-800); font-weight: 600;
  line-height: 1.2;
}

.ch-story {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.ch-story-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 6px;
}
.ch-story-label {
  font-family: var(--mono); font-size: 9px;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-mute); font-weight: 700;
}
.ch-story-proj {
  font-family: var(--serif); font-style: italic;
  font-size: 11px; color: var(--ink-mute);
}
.ch-story-body {
  font-family: var(--serif); font-size: 13.5px;
  line-height: 1.5; color: var(--ink);
  text-wrap: pretty;
}

/* ═══ Event card ═══ */
.event {
  background: var(--paper);
  border: 2px solid var(--g-700);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px rgba(27, 94, 32, 0.12), 0 1px 0 rgba(255,255,255,0.8) inset;
  position: relative;
  animation: evIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes evIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.event-kind {
  display: inline-block;
  font-family: var(--mono); font-size: 9px;
  text-transform: uppercase; letter-spacing: 0.14em;
  padding: 3px 8px; border-radius: 999px;
  margin-bottom: 8px;
  background: var(--g-800); color: #fff;
  font-weight: 700;
}
.event-quiz { border-color: #9c27b0; }
.event-quiz .event-kind { background: #6a1b9a; }
.event-scenario { border-color: #ef6c00; }
.event-scenario .event-kind { background: #e65100; }
.event-hazard { border-color: #c62828; }
.event-hazard .event-kind { background: #c62828; }
.event-reward { border-color: var(--gold-500); }
.event-reward .event-kind { background: var(--gold-500); }
.event-phase .event-kind { background: var(--g-700); }
.event-wiki { border-color: var(--g-500); }
.event-wiki .event-kind { background: var(--g-600); }

.event-title {
  font-family: var(--serif); font-size: 18px;
  color: var(--g-800); margin-bottom: 6px;
  line-height: 1.2; text-wrap: balance;
}
.event-body {
  font-size: 13px; color: var(--ink);
  line-height: 1.5; margin-bottom: 12px;
  text-wrap: pretty;
}

.event-choices { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.choice {
  display: grid; grid-template-columns: 22px 1fr; gap: 10px;
  align-items: center;
  padding: 9px 11px; border-radius: 8px;
  background: var(--cream);
  border: 1px solid var(--line-strong);
  text-align: left;
  font-size: 12.5px; color: var(--ink);
  line-height: 1.4;
  transition: all 0.15s;
}
.choice:hover:not(:disabled) {
  background: #fff;
  border-color: var(--g-600);
  transform: translateX(2px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.choice:disabled { cursor: default; }
.choice-letter {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--paper); color: var(--ink-mute);
  border: 1px solid var(--line-strong);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 11px; font-weight: 700;
  transition: all 0.15s;
}
.choice:hover:not(:disabled) .choice-letter { background: var(--g-700); color: #fff; border-color: var(--g-700); }
.choice.ok { background: #e8f5e9; border-color: var(--g-600); }
.choice.ok .choice-letter { background: var(--g-600); color: #fff; border-color: var(--g-600); }
.choice.nok { background: #fde8e6; border-color: #c62828; }
.choice.nok .choice-letter { background: #c62828; color: #fff; border-color: #c62828; }
.choice.off { opacity: 0.4; }

.event-feedback {
  margin-top: 10px; padding: 12px 14px;
  border-radius: 10px;
  display: grid; grid-template-columns: 28px 1fr; gap: 12px;
  align-items: flex-start;
  border-left: 3px solid var(--g-600);
  background: #e8f5e9;
  animation: fbIn 0.3s ease;
}
@keyframes fbIn { from { opacity: 0; transform: translateY(4px); } }
.event-feedback.nok { border-left-color: #c62828; background: #fde8e6; }
.fb-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--g-600); color: #fff;
  display: grid; place-items: center;
  font-size: 16px; font-weight: 700;
  font-family: var(--serif);
  flex-shrink: 0;
}
.event-feedback.nok .fb-icon { background: #c62828; }
.fb-text {
  font-size: 12.5px; line-height: 1.5;
  color: var(--g-900);
  text-wrap: pretty;
}
.event-feedback.nok .fb-text { color: #5a1212; }

.event-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  gap: 8px;
}
.event-foot:has(.event-cta:only-child) { justify-content: flex-end; }
.wiki-link {
  font-family: var(--serif); font-size: 12.5px;
  color: var(--g-700); font-style: italic;
  text-decoration: underline; text-underline-offset: 3px;
}
.wiki-link:hover { color: var(--g-800); }

.event-cta {
  padding: 8px 16px !important;
  font-size: 13px !important;
  box-shadow: 0 2px 0 var(--g-800) !important;
}

/* ═══ Footer ═══ */
.footerbar {
  display: flex; align-items: center;
  padding: 8px 18px; gap: 14px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.turn-info {
  flex: 1; font-family: var(--serif); font-style: italic;
  font-size: 13px; color: var(--ink-mute);
}
.dice-group { display: flex; align-items: center; gap: 10px; }
.dice {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--paper);
  border: 2px solid var(--g-700);
  display: grid; place-items: center;
  font-size: 28px; color: var(--g-800);
  line-height: 1;
  box-shadow: inset 0 -3px 0 var(--g-700);
}
.dice.rolling { animation: diceShake 0.1s infinite alternate; }
@keyframes diceShake {
  0% { transform: rotate(-6deg); }
  100% { transform: rotate(6deg); }
}
.btn-roll, .btn-primary {
  padding: 9px 18px;
  background: var(--g-700); color: #fff;
  border-radius: 7px;
  font-family: var(--sans); font-weight: 600; font-size: 13px;
  letter-spacing: 0.01em;
  box-shadow: 0 3px 0 var(--g-800);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn-roll:hover:not(:disabled), .btn-primary:hover:not(:disabled) { background: var(--g-600); }
.btn-roll:active:not(:disabled), .btn-primary:active:not(:disabled) {
  transform: translateY(2px); box-shadow: 0 1px 0 var(--g-800);
}
.btn-roll:disabled, .btn-primary:disabled {
  background: #a8b0a6; box-shadow: 0 2px 0 #8a9089; cursor: not-allowed;
}
.btn-primary.big { padding: 14px 28px; font-size: 15px; }
.btn-ghost {
  padding: 12px 18px; border-radius: 8px;
  color: var(--g-700); font-weight: 600;
  border: 1px solid var(--line-strong);
  background: var(--paper);
}
.btn-ghost:hover { background: var(--g-50); }

/* ═══ Start screen ═══ */
.start-screen {
  position: relative; height: 100%;
  overflow-y: auto;
  background: var(--cream);
}
.start-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at top left, rgba(124, 179, 66, 0.12), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(249, 168, 37, 0.08), transparent 50%);
  pointer-events: none;
}
.start-inner {
  position: relative;
  max-width: 1020px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}
.start-hdr { margin-bottom: 40px; max-width: 720px; }
.start-eyebrow { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--g-600); margin-bottom: 16px; }
.start-title {
  font-size: 72px; line-height: 0.95;
  color: var(--g-800); margin-bottom: 20px;
  letter-spacing: -0.02em;
}
.start-lede {
  font-family: var(--serif); font-size: 19px;
  color: var(--ink-mute); max-width: 580px; line-height: 1.45;
  text-wrap: pretty;
}

.start-section { margin-bottom: 36px; }
.start-h {
  font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--g-700); font-family: var(--sans); font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}

.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.proj-card {
  display: flex; gap: 14px; padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  transition: all 0.18s;
  position: relative;
}
.proj-card:hover { border-color: var(--g-500); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(27, 94, 32, 0.08); }
.proj-card.on {
  border-color: var(--g-700);
  background: linear-gradient(to bottom, var(--paper), var(--g-50));
  box-shadow: 0 0 0 2px var(--g-700);
}
.proj-card.on::after {
  content: '✓';
  position: absolute; top: 14px; right: 14px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--g-700); color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.proj-icon { font-size: 32px; flex-shrink: 0; line-height: 1; }
.proj-body { flex: 1; min-width: 0; }
.proj-tag { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--g-600); margin-bottom: 4px; }
.proj-name { font-family: var(--serif); font-size: 17px; color: var(--g-800); margin-bottom: 6px; font-weight: 600; line-height: 1.2; }
.proj-desc { font-size: 12.5px; color: var(--ink-mute); line-height: 1.5; margin-bottom: 10px; }
.proj-meta { display: flex; gap: 10px; font-size: 11px; color: var(--ink-mute); }

.roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.role-card {
  padding: 16px 12px; text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: all 0.15s;
}
.role-card:hover { border-color: var(--g-500); transform: translateY(-2px); }
.role-card.on {
  border-color: var(--g-700); background: var(--g-50);
  box-shadow: 0 0 0 2px var(--g-700);
}
.role-icon { font-size: 28px; margin-bottom: 6px; }
.role-name { font-family: var(--serif); font-size: 14px; font-weight: 600; color: var(--g-800); margin-bottom: 3px; }
.role-bonus { font-size: 11px; color: var(--ink-mute); line-height: 1.35; }

.start-cta { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.start-hint { font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--ink-mute); }

/* ═══ Overlay / Wiki ═══ */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(7, 50, 15, 0.45);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } }
.wiki-panel {
  background: var(--paper);
  max-width: 620px; width: 100%; max-height: 90vh;
  border-radius: 16px;
  overflow: hidden;
  display: grid; grid-template-rows: auto auto 1fr;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.wiki-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  background: var(--g-800); color: #fff;
}
.wiki-head .wiki-eyebrow { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; opacity: 0.7; margin-bottom: 2px; }
.wiki-title { font-size: 22px; }
.wiki-head .icon-btn { background: rgba(255,255,255,0.15); color: #fff; }
.wiki-head .icon-btn:hover { background: rgba(255,255,255,0.25); }

.wiki-tabs {
  display: flex; border-bottom: 1px solid var(--line);
  background: var(--cream);
}
.wiki-tab {
  flex: 1; padding: 12px 8px;
  font-size: 12px; font-weight: 600;
  color: var(--ink-mute);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.wiki-tab:hover { color: var(--g-700); }
.wiki-tab.on { color: var(--g-800); border-bottom-color: var(--g-700); background: var(--paper); }

.wiki-body { overflow-y: auto; padding: 16px 20px; }
.wiki-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--cream);
}
.wiki-item.open { background: var(--paper); border-color: var(--g-300); }
.wiki-item-head {
  width: 100%; padding: 12px 14px;
  display: grid; grid-template-columns: 22px 1fr auto 22px; gap: 10px;
  align-items: center; text-align: left;
}
.wi-ic { font-size: 16px; }
.wi-ti { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--g-800); }
.wi-fu { grid-column: 2; font-size: 11px; color: var(--ink-mute); font-style: italic; }
.wi-tag {
  font-family: var(--mono); font-size: 10px;
  padding: 2px 6px; border-radius: 3px;
  background: var(--g-100); color: var(--g-700);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.wi-chev { font-size: 16px; color: var(--g-700); font-weight: 600; }
.wiki-item-body { padding: 4px 14px 14px; font-size: 13px; color: var(--ink); line-height: 1.55; }
.wiki-item-body p + p { margin-top: 6px; }
.wiki-prose { padding: 12px 4px; font-size: 14px; line-height: 1.65; color: var(--ink); }
.wiki-prose p { margin-bottom: 8px; }
.wiki-prose strong { color: var(--g-800); }

/* ═══ Win screen ═══ */
.win-panel {
  background: var(--paper);
  max-width: 520px; width: 100%;
  border-radius: 16px; padding: 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: winIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-top: 6px solid var(--g-700);
}
@keyframes winIn { from { transform: scale(0.85); opacity: 0; } }
.win-ribbon {
  display: inline-block;
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--g-700);
  padding: 4px 14px;
  border: 1px solid var(--g-300);
  border-radius: 999px;
  margin-bottom: 20px;
}
.win-emblem { font-size: 72px; margin-bottom: 6px; line-height: 1; }
.win-title { font-size: 36px; color: var(--g-800); margin-bottom: 8px; letter-spacing: -0.02em; }
.win-sub { font-family: var(--serif); font-style: italic; color: var(--ink-mute); font-size: 14px; margin-bottom: 4px; }
.win-proj { font-family: var(--serif); font-size: 17px; color: var(--g-800); font-weight: 600; margin-bottom: 24px; }

.win-score {
  background: var(--g-800); color: #fff;
  padding: 20px; border-radius: 12px;
  margin-bottom: 20px;
}
.score-big { font-family: var(--serif); font-size: 56px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.score-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; opacity: 0.7; margin-top: 4px; }

.win-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.stat { padding: 12px; background: var(--cream); border-radius: 10px; border: 1px solid var(--line); }
.stat-n { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--g-800); }
.stat-l { font-size: 11px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.08em; }

.win-phases { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 24px; }
.win-ph {
  padding: 8px 4px; border-radius: 6px;
  display: flex; flex-direction: column; gap: 2px;
  font-family: var(--mono); font-size: 9px;
  font-weight: 700; line-height: 1;
}
.win-ph span:last-child { font-family: var(--sans); font-size: 10px; font-weight: 600; }

.win-actions { display: flex; gap: 10px; justify-content: center; }

/* ═══ Notification ═══ */
.notif {
  position: fixed; top: 32%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--g-800); color: #fff;
  padding: 14px 26px;
  border-radius: 999px;
  font-family: var(--serif); font-size: 16px; font-weight: 600;
  z-index: 200;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  animation: notifIn 0.25s ease;
}
@keyframes notifIn { from { transform: translate(-50%, -30%); opacity: 0; } }

/* ═══ Responsive ═══ */
@media (max-width: 1280px) {
  .main { grid-template-columns: 230px 1fr 300px; }
  .rail-title { font-size: 22px; }
  .rail { padding: 20px 16px; }
  .panel { padding: 20px 16px; }
  .projects { grid-template-columns: 1fr 1fr; }
  .start-title { font-size: 56px; }
}
@media (max-width: 1040px) {
  .main { grid-template-columns: 1fr 320px; }
  .rail { display: none; }
}
@media (max-width: 820px) {
  .main { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .rail { display: none; }
  .panel { border-left: none; border-top: 1px solid var(--line); max-height: 45vh; }
  .topbar { grid-template-columns: 1fr auto; padding: 10px 14px; }
  .topbar-proj { display: none; }
  .stage { min-height: 50vh; }
  .projects { grid-template-columns: 1fr; }
  .roles { grid-template-columns: repeat(2, 1fr); }
  .start-title { font-size: 44px; }
  .start-inner { padding: 32px 20px 60px; }
}
