:root {
  --ink: #132033;
  --muted: #667085;
  --line: #d9e2ef;
  --paper: #f5f7fb;
  --panel: #ffffff;
  --blue: #2563eb;
  --green: #15803d;
  --red: #dc2626;
  --amber: #b45309;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Arial, Helvetica, sans-serif; line-height: 1.45; }
a { color: var(--blue); text-decoration: none; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; background: #10243f; color: white; }
.topbar a { color: white; }
.topbar nav { display: flex; align-items: center; gap: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; margin: 0; }
.topbar-actions button, .topbar-actions a { border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.08); color: white; border-radius: 6px; padding: 5px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.topbar-join { max-width: 520px; color: rgba(255,255,255,.86); font-size: 12px; line-height: 1.25; }
.brand { font-weight: 800; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 24px auto 56px; }
.hero { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 24px; align-items: center; min-height: 70vh; }
.hero h1 { font-size: clamp(36px, 5vw, 72px); line-height: 1; margin: 0 0 18px; max-width: 800px; }
.hero-copy > p { font-size: 20px; max-width: 760px; color: var(--muted); }
.intro-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px; }
.intro-cards article { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.intro-cards h2 { margin: 0 0 8px; font-size: 18px; }
.intro-cards p, .join-form p { margin: 0 0 14px; color: var(--muted); }
.join-form .rejoin-link { margin: 2px 0 0; text-align: center; font-size: 13px; }
.eyebrow { color: var(--blue); text-transform: uppercase; font-size: 12px; font-weight: 800; letter-spacing: 0; }
.panel, .product-card, .status-card, .leader-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 28px rgba(16,36,63,.06); }
.panel { padding: 20px; }
.narrow { max-width: 520px; margin: 50px auto; }
.register-panel { max-width: 940px; margin: 34px auto; }
.centered { max-width: 620px; margin: 50px auto; text-align: center; }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 6px; font-weight: 700; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: white; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 14px; border-radius: 6px; border: 1px solid var(--line); font-weight: 800; cursor: pointer; background: white; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: var(--blue); color: white; border-color: var(--blue); }
.button.ghost { background: white; color: var(--ink); }
.button.warn { background: #fff7ed; color: var(--amber); border-color: #fed7aa; }
.alert { padding: 12px 14px; border-radius: 6px; margin: 10px 0; font-weight: 700; }
.alert.danger, .bad { background: #fef2f2; color: var(--red); border-color: #fecaca; }
.alert.good, .good { background: #f0fdf4; color: var(--green); border-color: #bbf7d0; }
.alert.amber, .amber { background: #fffbeb; color: var(--amber); border-color: #fde68a; }
.gold { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.alert.info { background: #eff6ff; color: #1d4ed8; }
.access-code { font-size: 42px; font-weight: 900; padding: 16px; background: #eff6ff; border-radius: 8px; }
.dashboard-head, .admin-head, .leaderboard-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 20px; }
.status-card { padding: 16px; font-weight: 900; }
.coach-panel { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: stretch; margin-bottom: 16px; }
.coach-panel > div, .coach-panel > aside, .explain-card { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.coach-panel h2 { margin: 0 0 8px; font-size: 24px; line-height: 1.2; }
.coach-panel p { margin: 0; color: var(--muted); }
.coach-panel aside { display: flex; align-items: center; font-weight: 800; background: #fff7ed; color: var(--amber); }
.lesson-rail { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.lesson-rail div { display: flex; align-items: center; gap: 8px; padding: 10px; background: white; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); }
.lesson-rail strong { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e2e8f0; color: var(--ink); }
.lesson-rail .current { border-color: var(--blue); color: var(--ink); box-shadow: 0 0 0 2px #dbeafe; }
.lesson-rail .current strong { background: var(--blue); color: white; }
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mode-liquidity .product-grid, .mode-capital .product-grid, .mode-decision .product-grid { grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 8px; }
.stack > .product-grid { order: 3; }
.stack > #cashWarning { order: 2; }
.stack > .explain-grid { order: 4; }
.stack > .analytics { order: 10; }
.stack > .bars { order: 1; }
.stack > .teaching-panels { order: 20; }
.stack > .decision-checklist { order: 1; }
.product-card { padding: 16px; display: grid; gap: 12px; }
.product-card[data-product-type="lending"] { border-left: 5px solid var(--blue); }
.product-card[data-product-type="savings"] { border-left: 5px solid var(--green); }
.mode-liquidity .product-card, .mode-capital .product-card, .mode-decision .product-card { gap: 8px; padding: 10px; }
.mode-liquidity .product-card, .mode-capital .product-card, .mode-decision .product-card { min-width: 0; overflow: hidden; }
.product-card[data-product-type="savings"] { order: 1; }
.product-card[data-product-type="lending"] { order: 2; }
.mode-liquidity .product-card p, .mode-capital .product-card p, .mode-decision .product-card p, .mode-decision .teaching-note { display: none; }
.mode-liquidity .product-title, .mode-capital .product-title, .mode-decision .product-title { display: block; }
.mode-liquidity .product-title h2, .mode-capital .product-title h2, .mode-decision .product-title h2 { font-size: 14px; min-height: 36px; }
.mode-liquidity .pill, .mode-capital .pill, .mode-decision .pill { display: none; }
.mode-liquidity input, .mode-capital input, .mode-decision input { padding: 7px 8px; }
.mode-liquidity input[type="number"], .mode-capital input[type="number"], .mode-decision input[type="number"] { width: 100%; min-width: 0; max-width: 100%; }
.mode-liquidity label, .mode-capital label, .mode-decision label { min-width: 0; }
.mode-liquidity .mini-metrics, .mode-capital .mini-metrics, .mode-decision .mini-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; }
.mode-liquidity .mini-metrics div, .mode-capital .mini-metrics div, .mode-decision .mini-metrics div { min-width: 0; overflow: hidden; }
.mini-metrics { grid-template-columns: repeat(2, 1fr); }
.product-card.offline { opacity: .52; filter: grayscale(.2); }
.product-card.offline p, .product-card.offline label, .product-card.offline .mini-metrics { display: none; }
.product-title { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.product-title h2, .panel h2 { margin: 0; font-size: 20px; }
.teaching-note { padding: 10px; border-radius: 6px; background: #f8fafc; color: var(--muted); }
.pill, .badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; background: #eef2ff; color: #3730a3; font-size: 12px; font-weight: 800; }
.badge.bad { background: #fee2e2; color: var(--red); }
.badge.good { background: #dcfce7; color: var(--green); }
.badge.gold { background: #fef3c7; color: #92400e; }
.bank-token { display: inline-flex; align-items: center; gap: 8px; }
.bank-token .token-emoji, .leader-icon { font-size: 28px; line-height: 1; }
.token-chooser h2 { margin: 0 0 6px; }
.token-chooser p { margin: 0 0 14px; color: var(--muted); }
.token-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.token-card { position: relative; display: grid; gap: 6px; align-content: start; min-height: 154px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #ffffff; cursor: pointer; box-shadow: 0 8px 20px rgba(16,36,63,.04); }
.token-card input { position: absolute; inset: 10px auto auto 10px; width: auto; }
.token-card .token-emoji { font-size: 38px; margin-left: 24px; }
.token-card strong { font-size: 14px; }
.token-card small { color: var(--muted); line-height: 1.3; }
.token-card:has(input:checked), .token-card.selected { border-color: var(--blue); box-shadow: 0 0 0 3px #dbeafe, 0 12px 24px rgba(37,99,235,.12); }
.playful-message { margin: 0; padding: 10px 12px; border-radius: 6px; background: #f8fafc; color: var(--muted); font-weight: 800; }
.toggle { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.toggle input { width: auto; }
.mini-metrics, .metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.mini-metrics div, .metrics div { padding: 10px; background: #f8fafc; border-radius: 6px; }
dt, .metrics span { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); font-weight: 400; }
dd { margin: 0; font-weight: 900; }
.analytics { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.explain-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.explain-card h2 { margin: 0 0 8px; font-size: 18px; }
.explain-card p { margin: 0; color: var(--muted); }
.explainer-stack { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.explainer-stack article { background: #f8fafc; border-radius: 6px; padding: 12px; }
.explainer-stack h2 { margin: 0 0 8px; font-size: 16px; }
.explainer-stack p { margin: 0; color: var(--muted); }
.profit-formula { display: grid; gap: 4px; margin-top: 12px; font-weight: 800; }
.profit-formula span { padding: 6px 8px; background: #f8fafc; border-radius: 6px; }
.decision-checklist { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: white; }
.decision-checklist h2 { margin: 0 0 8px; font-size: 18px; }
.checklist-items { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.checklist-items li { padding: 8px 10px; border-radius: 6px; background: #f8fafc; color: var(--muted); }
.checklist-items li.bad { color: var(--red); background: #fef2f2; }
.result-summary { display: grid; gap: 12px; margin-bottom: 16px; }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.summary-strip div { border: 1px solid; border-radius: 8px; padding: 12px; }
.teaching-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.liquidity-panel { grid-column: 1; }
.capital-panel { grid-column: 2; }
.teaching-panel.minimised { opacity: .55; }
.teaching-panel.minimised table { display: none; }
.marketing-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.radio-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; }
.radio-card span { grid-column: 2; color: var(--muted); font-size: 13px; }
canvas { width: 100%; height: 320px; }
.chart-caption { margin: 8px 0 0; font-weight: 800; color: var(--muted); }
table { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #edf2f7; cursor: pointer; }
.bars { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; order: 1; }
.bars .requirement:only-child { grid-column: 1 / -1; }
.submit-button { order: 0; }
.requirement { border: 1px solid; border-radius: 8px; padding: 16px; display: grid; gap: 6px; }
.inline-form, .control-strip, .sorts { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 18px; }
.screen-safe-controls { margin-top: -8px; }
.screen-safe-controls .button { min-height: 32px; padding: 5px 10px; font-size: 13px; font-weight: 700; }
.screen-safe-controls .button.primary { background: white; color: var(--blue); }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.admin-bank-editor .editor-year summary { cursor: pointer; font-size: 20px; font-weight: 900; }
.admin-bank-editor .editor-year h3 { margin: 20px 0 10px; }
.admin-bank-editor table input[type="number"] { min-width: 105px; padding: 7px; }
.admin-bank-editor table input[type="checkbox"] { width: auto; }
.editor-fields { margin-top: 16px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions form { margin: 0; }
.link-button { border: 0; background: transparent; color: var(--blue); padding: 0; font: inherit; cursor: pointer; }
.leaderboard { display: grid; gap: 12px; }
.leader-card { display: grid; grid-template-columns: 54px 46px 1.35fr repeat(3, minmax(135px, auto)) auto; gap: 14px; align-items: center; padding: 18px; color: var(--ink); }
.leader-bank { display: grid; gap: 2px; }
.leader-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.leaderboard-table th { white-space: nowrap; }
.leaderboard-table td { vertical-align: middle; }
.leader-bank-link { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); min-width: 220px; }
.warning-mark { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px #fee2e2; }
.struck-bank strong { text-decoration: line-through; text-decoration-thickness: 2px; }
.ineligible-row { background: #fffafa; }
.badge-explainer { margin-bottom: 14px; padding: 12px 16px; }
.badge-explainer summary { cursor: pointer; font-weight: 900; }
.badge-guide { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 18px; margin-top: 12px; }
.badge-guide span { color: var(--muted); }
.badge-guide strong { color: var(--ink); display: block; }
.rank { font-size: 28px; font-weight: 900; color: var(--blue); }
.countdown { position: sticky; top: 0; z-index: 2; padding: 14px; background: #f97316; color: white; text-align: center; font-weight: 900; border-radius: 0 0 8px 8px; }
.late-join-banner { position: sticky; top: 0; z-index: 2; padding: 10px 14px; margin-bottom: 16px; border-radius: 8px; background: #10243f; color: white; }
.facilitator-instructions p { font-size: 20px; }
.facilitator-overlays { position: fixed; right: 24px; top: 86px; z-index: 8; display: grid; justify-items: end; gap: 10px; width: min(860px, calc(100vw - 48px)); pointer-events: none; }
.player-overlays { position: fixed; right: 24px; top: 86px; z-index: 8; display: grid; justify-items: end; gap: 10px; width: min(860px, calc(100vw - 48px)); pointer-events: none; }
.player-basics-overlay { top: 140px; }
.overlay-slide { pointer-events: auto; background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 45px rgba(16,36,63,.18); overflow: hidden; }
.overlay-slide:not([open]) { width: 190px; }
.overlay-slide summary { cursor: pointer; padding: 10px 12px; font-weight: 900; background: #10243f; color: white; }
.overlay-slide[open] { width: min(680px, calc(100vw - 48px)); height: auto; max-height: none; }
.overlay-slide div { padding: 14px; display: grid; gap: 10px; }
.overlay-slide h2, .overlay-slide p { margin: 0; }
.overlay-slide h2 { font-size: 32px; line-height: 1.1; }
.overlay-slide p { color: var(--muted); font-size: 18px; line-height: 1.4; }
.liquidity-slide summary { background: #047857; }
.capital-slide summary { background: #1d4ed8; }
.welcome-slide summary { background: #10243f; }
.basics-slide summary { background: #4f46e5; }
.overlay-slide .explainer-stack h3 { margin: 0 0 8px; font-size: 18px; }
.overlay-slide .explainer-stack p { font-size: 16px; }
.facilitator-overlays .overlay-slide[open] > .overlay-deck,
.player-overlays .overlay-slide[open] > .overlay-deck {
  display: block !important;
  height: min(430px, calc(100vh - 210px)) !important;
  min-height: 160px;
  padding: 0 !important;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  touch-action: pan-y;
  pointer-events: auto;
}
.deck-slide { display: none; gap: 16px; align-content: start; padding: 20px; }
.overlay-slide[open] .deck-slide.active { display: grid; height: auto; min-height: 0; overflow: visible; }
.overlay-deck::-webkit-scrollbar { width: 14px; }
.overlay-deck::-webkit-scrollbar-track { background: #eef2f7; }
.overlay-deck::-webkit-scrollbar-thumb { background: #94a3b8; border: 3px solid #eef2f7; border-radius: 8px; }
.deck-controls { display: flex !important; justify-content: flex-end; gap: 10px; padding: 14px 26px 22px !important; }
.deck-controls button { border: 1px solid var(--line); background: white; border-radius: 6px; padding: 9px 14px; font-weight: 800; cursor: pointer; }
.hidden { display: none; }
@media (max-width: 900px) {
  .hero, .product-grid, .analytics, .bars, .coach-panel, .explain-grid, .explainer-stack, .teaching-panels, .intro-cards, .summary-strip { grid-template-columns: 1fr; }
  .mode-liquidity .product-grid, .mode-capital .product-grid, .mode-decision .product-grid { grid-template-columns: repeat(2, 1fr); }
  .lesson-rail { grid-template-columns: 1fr 1fr; }
  .grid-form { grid-template-columns: 1fr; }
  .dashboard-head, .admin-head, .leaderboard-head { align-items: stretch; flex-direction: column; }
  .leader-card { grid-template-columns: 42px 1fr; }
  .token-grid { grid-template-columns: repeat(2, 1fr); }
  .leaderboard-table th:nth-child(5), .leaderboard-table td:nth-child(5),
  .leaderboard-table th:nth-child(7), .leaderboard-table td:nth-child(7) { display: none; }
  table { display: block; overflow-x: auto; }
}
