/* ===== The Beer Game — design system ===== */
:root {
  --bg: #eaeef3;
  --card: #ffffff;
  --ink: #1f2a37;
  --muted: #525d6e;      /* ~7.6:1 vs white — passes WCAG AAA for body text */
  --line: #e3e8ef;
  --blue: #2d7ff9;
  --blue-d: #1c63d4;
  --green: #16a34a;
  --field: #8bc34a;
  --field-d: #689f38;
  --demand: #ef4444;
  --receipt: #14b8a6;
  --ship: #3b82f6;
  --gold: #f59e0b;
  --shadow: 0 6px 20px rgba(20, 30, 50, .10);
  --shadow-lg: 0 18px 48px rgba(20, 30, 50, .22);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Nunito', system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.15; }
a { color: var(--blue); }

/* ===== buttons ===== */
.btn {
  font-family: inherit; font-weight: 800; font-size: 15px;
  border: 0; border-radius: 999px; padding: 12px 22px;
  cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-block;
  transition: transform .08s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(45,127,249,.35); }
.btn-primary:hover { background: var(--blue-d); }
.btn-primary:disabled { background: #b9c4d4; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: #eef2f7; color: var(--blue-d); }
.btn-ghost:hover { background: #e2e8f1; }
.btn-lg { padding: 16px 34px; font-size: 17px; }

/* ===== landing ===== */
.landing { max-width: 880px; margin: 0 auto; padding: 48px 22px 80px; }
.landing-hero { text-align: center; margin-bottom: 34px; }
.hero-badge {
  display: inline-block; background: #fff; color: var(--blue-d); font-weight: 800;
  padding: 7px 16px; border-radius: 999px; box-shadow: var(--shadow); font-size: 14px;
}
.landing-hero h1 { font-size: 56px; font-weight: 800; margin: 18px 0 10px; letter-spacing: -1px; }
.hero-sub { color: var(--muted); font-size: 18px; max-width: 620px; margin: 0 auto; }
.hero-sub strong { color: var(--ink); }

.setup-card {
  background: var(--card); border-radius: 22px; box-shadow: var(--shadow);
  padding: 30px; margin-bottom: 28px;
}
.setup-card h2 { font-size: 24px; margin-bottom: 20px; }
.field { border: 0; margin-bottom: 22px; }
.field legend { font-weight: 800; color: var(--muted); font-size: 13px;
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.field-row { display: flex; gap: 22px; }
.field-row .field { flex: 1; }
select {
  width: 100%; font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff;
}
.scenario-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scenario-option input { position: absolute; opacity: 0; }
.scenario-card {
  display: block; border: 2px solid var(--line); border-radius: 14px;
  padding: 14px 16px; cursor: pointer; height: 100%; transition: border-color .12s, background .12s;
}
.scenario-option input:checked + .scenario-card { border-color: var(--blue); background: #f3f8ff; }
.scenario-name { display: block; font-weight: 800; font-size: 16px; margin-bottom: 4px; }
.scenario-desc { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.setup-card .btn-lg { width: 100%; }

.how-to { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 26px 30px; }
.how-to h3 { margin-bottom: 16px; }
.how-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.how-step { text-align: center; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.how-step b { color: var(--ink); }
.how-icon { font-size: 30px; display: block; margin-bottom: 6px; }
.how-note { margin-top: 18px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ===== play app ===== */
.play-app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; background: #fff; box-shadow: var(--shadow); z-index: 5;
}
.topbar-left { font-weight: 800; font-size: 17px; }
.topbar-left .home { text-decoration: none; color: var(--muted); margin-right: 8px; }
.topbar-center { text-align: center; }
.week-pill { font-weight: 800; font-size: 18px; }
.round-name { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-weight: 800; }
.cost-chip { background: #fef2f2; color: var(--demand); padding: 6px 14px; border-radius: 999px; font-size: 14px; }

/* ===== board / isometric field ===== */
.board {
  flex: 1; position: relative; overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 0%, #a5d36a 0%, var(--field) 45%, var(--field-d) 100%);
}
.board::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.10) 1.5px, transparent 1.6px);
  background-size: 26px 26px; pointer-events: none;
}
.chain {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 0; padding: 30px 26px;
}
.site {
  position: relative; width: 168px; display: flex; flex-direction: column; align-items: center;
  z-index: 2;
}
.site-card {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 12px 12px 14px;
  width: 100%; text-align: center; border: 3px solid transparent; transition: border-color .15s;
}
.site.human .site-card { border-color: var(--blue); }
.site-building { font-size: 54px; line-height: 1; filter: drop-shadow(0 6px 5px rgba(0,0,0,.28)); }
.site-platform {
  width: 96px; height: 22px; margin: -8px auto 4px; border-radius: 50%;
  background: rgba(0,0,0,.16); filter: blur(3px);
}
.site-name { font-weight: 800; font-size: 15px; }
.site-tag { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.site-tag.you { color: var(--blue); }
.site-tag.bot { color: var(--muted); }
.site-stats { display: flex; gap: 6px; margin-top: 8px; }
.site-stat { flex: 1; background: #f3f6fa; border-radius: 9px; padding: 5px 4px; }
.site-stat .v { font-weight: 800; font-size: 16px; }
.site-stat .l { font-size: 10px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.site-stat.bo .v { color: var(--demand); }
.site-hidden { color: var(--muted); font-size: 12px; margin-top: 8px; font-style: italic; }

/* road + trucks */
.road {
  position: relative; width: 78px; height: 16px; flex-shrink: 0;
  background: #555c66; border-radius: 4px; margin-top: 18px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25);
}
.road::before {
  content: ""; position: absolute; top: 50%; left: 4px; right: 4px; height: 2px;
  transform: translateY(-50%);
  background: repeating-linear-gradient(90deg, #f4d35e 0 9px, transparent 9px 18px);
}
.truck {
  position: absolute; top: -16px; font-size: 24px; left: 50%;
  transform: translateX(-50%) scaleX(-1); opacity: 0;
}
.truck.run { animation: truck-run 1.05s ease-in-out; }
@keyframes truck-run {
  0% { left: 92%; opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { left: 8%; opacity: 0; }
}
.endcap { font-size: 30px; margin-top: 14px; opacity: .9; }

/* ===== HUD (bottom) ===== */
.hud {
  background: #fff; box-shadow: 0 -6px 20px rgba(20,30,50,.10);
  padding: 14px 22px; display: flex; gap: 20px; align-items: center; z-index: 5;
}
.role-panel { display: flex; gap: 10px; }
.bigstat {
  background: #f3f6fa; border-radius: 13px; padding: 8px 16px; text-align: center; min-width: 84px;
}
.bigstat .v { font-weight: 800; font-size: 22px; }
.bigstat .l { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.bigstat.bo .v { color: var(--demand); }
.bigstat.cost .v { color: var(--demand); }
.bigstat .sub { font-size: 11px; color: var(--demand); font-weight: 700; margin-top: 2px; }
.order-panel { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.order-panel .prompt { font-weight: 800; font-size: 15px; }
.order-panel .prompt small { display: block; color: var(--muted); font-weight: 700; font-size: 12px; margin-top: 2px; }
.order-panel .order-stepper { justify-content: flex-start; }
.order-panel > .btn { align-self: flex-end; }
.order-input { display: flex; align-items: center; gap: 12px; flex: 1; }
.order-input input[type=range] { flex: 1; accent-color: var(--blue); height: 6px; }
.order-num {
  width: 78px; font-family: inherit; font-weight: 800; font-size: 22px; text-align: center;
  border: 2px solid var(--line); border-radius: 12px; padding: 8px 4px; color: var(--blue-d);
}

/* ===== modal ===== */
.overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: 22px; box-shadow: var(--shadow-lg);
  width: 540px; max-width: 94vw; padding: 26px 28px; transform: translateY(14px) scale(.97);
  transition: transform .22s; max-height: 92vh; overflow-y: auto;
}
.overlay.show .modal { transform: none; }
.modal h2 { text-align: center; font-size: 24px; margin-bottom: 6px; }
.modal .modal-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.flow {
  display: grid; grid-template-columns: 1fr minmax(150px, 200px) 1fr;
  gap: 10px 18px; align-items: center; margin: 8px 0 16px;
}
.flow-mid { grid-column: 2; grid-row: 1 / span 2; text-align: center; display: flex;
  flex-direction: column; align-items: center; gap: 6px; }
.flow-mid .bld { font-size: 46px; filter: drop-shadow(0 5px 4px rgba(0,0,0,.25)); line-height: 1; }
.flow-line.f-demand { grid-column: 1; grid-row: 1; }
.flow-line.f-receipt { grid-column: 3; grid-row: 1; }
.flow-line.f-ship { grid-column: 1; grid-row: 2; }
.flow-spacer { grid-column: 3; grid-row: 2; }
.flow-row { display: contents; }
.flow-line {
  display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px;
  opacity: 0; transform: translateX(var(--from, 0));
}
.flow-line.in { animation: flow-in .45s ease forwards; }
@keyframes flow-in { to { opacity: 1; transform: translateX(0); } }
.flow-line.right { justify-content: flex-end; text-align: right; --from: 22px; }
.flow-line.left { justify-content: flex-start; --from: -22px; }
.flow-line .tag { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 800; }
.flow-line .num { font-size: 19px; }
.n-demand { color: var(--demand); }
.n-receipt { color: var(--receipt); }
.n-ship { color: var(--ship); }
.calc {
  background: #f3f6fa; border-radius: 14px; padding: 14px 16px; text-align: center;
  font-weight: 800; font-size: 16px; margin-bottom: 10px;
}
.calc .res { color: var(--blue-d); }
.calc.cost .res { color: var(--demand); }
.calc small { display: block; font-weight: 700; color: var(--muted); font-size: 12px; margin-top: 3px; }
.modal .btn { width: 100%; margin-top: 8px; }

.met { text-align: center; font-weight: 800; font-size: 13px; margin-bottom: 10px; }
.met.ok { color: var(--green); }
.met.bad { color: var(--demand); }

/* events toast */
.events { margin: 6px 0 14px; }
.event-msg {
  background: #fff7ed; border: 1.5px solid #fed7aa; color: #9a3412;
  border-radius: 12px; padding: 10px 14px; font-weight: 700; font-size: 14px; margin-top: 8px;
}

/* ===== debrief ===== */
.debrief .modal { width: 720px; }
.debrief h2 { margin-bottom: 14px; }
.kpi-row { display: flex; gap: 12px; margin-bottom: 16px; }
.kpi { flex: 1; background: #f3f6fa; border-radius: 14px; padding: 12px; text-align: center; }
.kpi .v { font-weight: 800; font-size: 24px; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 700; }
.kpi.hi .v { color: var(--demand); }
.chart-box { background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; }
.chart-title { font-weight: 800; font-size: 14px; margin-bottom: 4px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; font-weight: 700; margin: 8px 0 2px; }
.chart-legend i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.debrief-actions { display: flex; gap: 12px; margin-top: 18px; }
.debrief-actions .btn { flex: 1; }
.insight { background: #f0f7ff; border-radius: 12px; padding: 12px 16px; font-size: 14px;
  font-weight: 600; margin: 14px 0; color: #1e40af; }

@media (prefers-reduced-motion: reduce) {
  .truck.run, .flow-line.in { animation-duration: .01s; }
}
@media (max-width: 820px) {
  .field-row { flex-direction: column; gap: 0; }
  .scenario-grid { grid-template-columns: 1fr; }
  .how-steps { grid-template-columns: 1fr 1fr; }
  .landing-hero h1 { font-size: 40px; }
  .chain { flex-wrap: wrap; gap: 10px; }
  .road { width: 40px; }
  .site { width: 132px; }
  .hud { flex-direction: column; align-items: stretch; }
}

/* ===== mode picker (landing) ===== */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-option input { position: absolute; opacity: 0; }
.mode-card {
  display: block; border: 2px solid var(--line); border-radius: 14px;
  padding: 14px 16px; cursor: pointer; height: 100%; transition: border-color .12s, background .12s;
}
.mode-option input:checked + .mode-card { border-color: var(--blue); background: #f3f8ff; }
.mode-name { display: block; font-weight: 800; font-size: 16px; margin-bottom: 4px; }
.mode-desc { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.mode-multi .solo-only { display: none; }

.join-card {
  display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap;
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 18px 24px; margin-bottom: 28px; font-weight: 700; color: var(--muted);
}
.landing.narrow { max-width: 520px; }
.code-input {
  width: 100%; font-family: inherit; font-size: 30px; font-weight: 800; letter-spacing: 8px;
  text-align: center; text-transform: uppercase;
  padding: 16px; border: 2px solid var(--line); border-radius: 12px; background: #fff;
}
.form-error { color: var(--demand); font-weight: 700; margin-bottom: 14px; text-align: center; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ===== lobby ===== */
.lobby { max-width: 560px; margin: 0 auto; padding: 44px 22px 80px; }
.lobby-card { position: relative; background: var(--card); border-radius: 22px;
  box-shadow: var(--shadow); padding: 30px; }
.lobby-home { position: absolute; left: 22px; top: 22px; text-decoration: none;
  color: var(--muted); font-size: 22px; font-weight: 800; }
.lobby-head { text-align: center; margin-bottom: 22px; }
.lobby-head h1 { font-size: 30px; margin: 14px 0 6px; }
.lobby-sub { color: var(--muted); font-size: 14.5px; }
.code-box { text-align: center; background: #f3f8ff; border: 2px dashed var(--blue);
  border-radius: 16px; padding: 16px; margin-bottom: 22px; }
.code-label { font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted); }
.code-value { font-size: 40px; font-weight: 800; letter-spacing: 8px; color: var(--blue-d);
  margin: 4px 0 10px; }
.code-box .btn { margin: 0 4px; }
.name-field { margin-bottom: 18px; }
.name-field label { display: block; font-weight: 800; font-size: 13px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.name-field input { width: 100%; font-family: inherit; font-size: 16px; font-weight: 600;
  padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; }
.seat-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.seat { display: flex; align-items: center; gap: 14px; border: 2px solid var(--line);
  border-radius: 14px; padding: 12px 14px; }
.seat.taken { background: #f7f9fc; }
.seat.mine { border-color: var(--blue); background: #f3f8ff; }
.seat-icon { font-size: 30px; }
.seat-info { flex: 1; }
.seat-role { font-weight: 800; font-size: 16px; }
.seat-player { font-size: 14px; color: var(--ink); font-weight: 700; }
.seat-open { color: var(--muted); font-weight: 600; }
.seat-you { color: var(--blue-d); }
.seat-bot { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.lobby-actions { text-align: center; }
.lobby-actions .btn-lg { width: 100%; }
.lobby-note { margin-top: 12px; color: var(--muted); font-size: 13.5px; font-weight: 700; }
.lobby-note.waiting { font-size: 15px; }

/* ===== multiplayer play extras ===== */
.mp-tag { background: #eef2ff; color: var(--blue-d); font-size: 12px; font-weight: 800;
  padding: 3px 10px; border-radius: 999px; margin-left: 10px; }
.site-tag.human { background: #ecfdf3; color: var(--green); }
.seat-status { margin-top: 6px; font-size: 11.5px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; }
.seat-status.ok { color: var(--green); }
.order-panel.waiting-panel, .order-panel.spectate { align-items: center; text-align: center; }
.wait-host { margin-top: 12px; color: var(--muted); font-weight: 700; font-size: 14px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; margin: 10px auto 0;
  border: 3px solid #dbe4ef; border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* ===== instructor dashboard ===== */
.text-input {
  width: 100%; font-family: inherit; font-size: 16px; font-weight: 600;
  padding: 13px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff;
}
.dashboard { max-width: 1080px; margin: 0 auto; padding: 40px 22px 80px; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.dash-head h1 { font-size: 36px; margin-top: 12px; }
.dash-actions { display: flex; gap: 10px; }
.dash-empty { background: var(--card); border-radius: 22px; box-shadow: var(--shadow);
  padding: 48px; text-align: center; }
.dash-empty p { color: var(--muted); font-size: 17px; margin-bottom: 18px; }
.dash-table-wrap { background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dash-table th { text-align: left; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); padding: 14px 14px; border-bottom: 2px solid var(--line); }
.dash-table td { padding: 14px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dash-table tr:last-child td { border-bottom: 0; }
.dash-table .dim { color: var(--muted); font-weight: 600; }
.code-tag { background: #f3f8ff; color: var(--blue-d); font-weight: 800;
  padding: 3px 8px; border-radius: 7px; letter-spacing: 1px; font-size: 13px; }
.status-badge { font-size: 11.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .4px; padding: 4px 10px; border-radius: 999px; }
.status-badge.lobby { background: #fef3c7; color: #92400e; }
.status-badge.playing { background: #dcfce7; color: #166534; }
.status-badge.finished { background: #e5e7eb; color: #374151; }
.dash-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 16px; }
.landing-footer { text-align: center; margin-top: 26px; }
.landing-footer a { color: var(--muted); font-weight: 700; font-size: 13.5px; }

/* ===== chat panel (transparency rounds) ===== */
.chat-panel { position: fixed; right: 20px; bottom: 20px; z-index: 60; font-family: inherit; }
.chat-toggle { background: var(--blue); color: #fff; border: 0; border-radius: 999px;
  padding: 12px 18px; font-weight: 800; font-family: inherit; cursor: pointer;
  box-shadow: 0 8px 20px rgba(45,127,249,.35); display: flex; align-items: center; gap: 8px; }
.chat-toggle .chat-count { background: rgba(255,255,255,.25); border-radius: 999px;
  padding: 1px 8px; font-size: 12px; }
.chat-panel.open .chat-toggle { display: none; }
.chat-body { display: none; width: 320px; max-height: 460px;
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow-lg);
  overflow: hidden; flex-direction: column; }
.chat-panel.open .chat-body { display: flex; }
.chat-head { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-head b { font-size: 15px; }
.chat-close { background: transparent; border: 0; font-size: 24px; line-height: 1;
  cursor: pointer; color: var(--muted); padding: 0 4px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px 16px; }
.chat-empty { color: var(--muted); text-align: center; padding: 24px 0; font-size: 13.5px; }
.chat-msg { background: #f5f8fc; border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; }
.chat-msg.instructor { background: #fef3c7; }
.chat-who { font-weight: 800; font-size: 12px; color: var(--blue-d); margin-bottom: 2px; }
.chat-msg.instructor .chat-who { color: #92400e; }
.chat-week { color: var(--muted); font-weight: 600; font-size: 11px; }
.chat-text { font-size: 13.5px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; font-family: inherit; font-size: 14px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; }
.chat-readonly { padding: 10px; color: var(--muted); font-size: 12px; text-align: center;
  border-top: 1px solid var(--line); }
.mp-tag.transparency { background: #ecfdf3; color: var(--green); }
@media (max-width: 600px) {
  .chat-body { width: calc(100vw - 32px); max-height: 60vh; }
}

/* ===== extended debrief ===== */
.debrief-modal { max-width: 760px; }
.ranking { background: #f8fafc; border-radius: 14px; padding: 14px 18px; margin: 18px 0; }
.ranking-title { font-weight: 800; font-size: 13px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); margin-bottom: 10px; }
.ranking-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ranking-list li { display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: #fff; border-radius: 10px; font-weight: 700; }
.ranking-list li.rank-1 { background: #fef3c7; }
.ranking-list .medal { font-size: 22px; width: 28px; text-align: center; }
.ranking-list .rank-name { flex: 1; }
.ranking-list .rank-cost { font-weight: 800; color: var(--blue-d); }
.kpi-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 14px 0 20px; }
.kpi-table th { text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.kpi-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.kpi-table .dim { color: var(--muted); font-weight: 500; font-size: 12px; }

/* ===== instructor host menu ===== */
.host-menu { position: relative; }
.host-menu-items {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px;
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; display: none; flex-direction: column; gap: 2px; z-index: 30;
}
.host-menu.open .host-menu-items { display: flex; }
.host-menu-items button {
  background: transparent; border: 0; padding: 9px 12px; text-align: left;
  font-family: inherit; font-weight: 700; font-size: 14px; border-radius: 8px;
  cursor: pointer; color: var(--ink);
}
.host-menu-items button:hover { background: #f3f6fa; }
.host-menu-items .menu-link {
  display: block; padding: 9px 12px; text-decoration: none;
  font-weight: 700; font-size: 14px; border-radius: 8px; color: var(--blue-d);
}
.host-menu-items .menu-link:hover { background: #f3f6fa; }
.host-menu-items .menu-sep {
  height: 1px; background: #e5e9f0; margin: 4px 6px;
}
.mp-tag.session-tag { background: #ecfeff; color: #155e75; }
.mp-tag.paused { background: #fef3c7; color: #92400e; }
.order-panel.paused-panel { align-items: center; text-align: center; opacity: .85; }

/* ===== week timer + modal controls + lobby QR ===== */
.week-timer { background: #eef2f7; color: var(--blue-d); padding: 6px 12px;
  border-radius: 999px; font-weight: 800; font-size: 14px; }
.week-timer.low { background: #fef3c7; color: #92400e; }
.week-timer.critical { background: #fee2e2; color: #b91c1c; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .week-timer.critical { animation: none; } }

.modal-controls { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 0 12px; flex-wrap: wrap; }
.modal-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--muted); font-weight: 700; cursor: pointer; }
.modal-toggle input { cursor: pointer; }

/* lobby code/QR split */
.code-box { display: flex; gap: 18px; align-items: center; padding: 16px; }
.code-block { flex: 1; text-align: center; }
.code-buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.qr-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.qr-block svg { display: block; width: 130px; height: 130px; border-radius: 8px; background: #fff; }
.qr-caption { font-size: 11px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; }
@media (max-width: 480px) {
  .code-box { flex-direction: column; }
}

/* ===== live bullwhip meter + par-score + scrubber ===== */
.bullwhip-meter { background: #eef2f7; color: var(--blue-d); padding: 6px 12px;
  border-radius: 999px; font-weight: 800; font-size: 14px; }
.bullwhip-meter.good { background: #ecfdf3; color: var(--green); }
.bullwhip-meter.warn { background: #fef3c7; color: #92400e; }
.bullwhip-meter.bad { background: #fee2e2; color: #b91c1c; }
.kpi.par .v, .kpi.under .v { color: var(--green); }
.kpi.over .v { color: var(--demand); }
.scrubber { background: #f8fafc; border-radius: 14px; padding: 14px 18px; margin: 16px 0; }
.scrubber label { font-weight: 800; font-size: 13px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; display: block; margin-bottom: 6px; }
.scrubber input[type=range] { width: 75%; vertical-align: middle; }
.scrubber output { font-weight: 800; margin-left: 12px; color: var(--blue-d); }
.scrub-table { display: flex; flex-direction: column; font-size: 13px; margin-top: 10px; }
.scrub-row { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr 1.2fr;
  gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--line); align-items: center; }
.scrub-row.scrub-head { font-size: 11px; text-transform: uppercase; color: var(--muted);
  font-weight: 700; border-bottom: 2px solid var(--line); }

/* ===== accessibility ===== */
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.scenario-option input:focus-visible + .scenario-card,
.mode-option input:focus-visible + .mode-card { outline: 3px solid var(--blue); outline-offset: 2px; }
/* Visually-hide but keep available for screen readers */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
@media (prefers-reduced-motion: reduce) {
  .truck.run, .flow-line.in, .overlay, .overlay.show, .chat-panel .chat-body,
  .modal, .modal.in { animation-duration: .01s !important; transition: none !important; }
}

/* ===== marketing landing + app-shell nav ===== */
.public-nav, .public-footer { max-width: 1100px; margin: 0 auto; padding: 18px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.public-nav .brand, .app-nav .brand { font-size: 18px; color: var(--ink); text-decoration: none; }
.public-nav .brand b, .app-nav .brand b { color: var(--blue-d); font-weight: 800; }
.public-nav nav { display: flex; gap: 8px; }
.public-footer { color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); margin-top: 40px; }
.public-footer a { color: var(--muted); }

.public { max-width: 1100px; margin: 0 auto; padding: 24px 22px 0; }
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center;
  margin: 28px 0 60px; }
.hero-text h1 { font-size: 52px; font-weight: 800; line-height: 1.05; letter-spacing: -1px;
  margin: 12px 0 16px; }
.hero-text h1 em { color: var(--blue-d); font-style: normal; }
.hero-sub { color: var(--muted); font-size: 18px; line-height: 1.5; margin-bottom: 24px; }
.hero-sub strong { color: var(--ink); }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.hero-note { color: var(--muted); font-size: 13px; }

.hero-illustration {
  position: relative; height: 280px; border-radius: 24px;
  background: radial-gradient(120% 80% at 50% 0%, #a5d36a 0%, var(--field) 45%, var(--field-d) 100%);
  box-shadow: var(--shadow);
}
.hero-chain { display: flex; align-items: center; justify-content: space-between;
  padding: 60px 20px; height: 100%; }
.hero-bld { font-size: 56px; filter: drop-shadow(0 6px 5px rgba(0,0,0,.25)); }
.hero-road { flex: 1; height: 12px; background: #555c66; border-radius: 4px; margin: 0 6px;
  background-image: repeating-linear-gradient(90deg, #f4d35e 0 8px, #555c66 8px 16px); }
.hero-truck { position: absolute; left: 50%; top: 40%; font-size: 32px;
  animation: hero-truck-run 5s ease-in-out infinite; transform: translateX(-50%) scaleX(-1); }
@keyframes hero-truck-run {
  0%, 100% { left: 90%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  50% { left: 10%; }
}
@media (prefers-reduced-motion: reduce) { .hero-truck { animation: none; left: 50%; } }

.features { padding: 40px 0; }
.features h2, .cta h2 { font-size: 32px; text-align: center; margin-bottom: 24px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature { background: var(--card); border-radius: 18px; padding: 26px; box-shadow: var(--shadow); }
.feature-icon { font-size: 40px; margin-bottom: 12px; }
.feature h3 { font-size: 19px; margin-bottom: 8px; }
.feature p { color: var(--muted); line-height: 1.5; font-size: 14.5px; }

.cta { background: var(--card); border-radius: 22px; box-shadow: var(--shadow);
  padding: 40px; text-align: center; margin-top: 40px; }
.cta p { color: var(--muted); font-size: 16px; margin-bottom: 22px; }
.cta .hero-cta { justify-content: center; }

@media (max-width: 780px) {
  .hero { grid-template-columns: 1fr; }
  .hero-text h1 { font-size: 36px; }
  .feature-grid { grid-template-columns: 1fr; }
  .hero-illustration { height: 200px; }
  .hero-bld { font-size: 38px; }
}

/* ----- app-shell (authenticated pages share a top nav) ----- */
.app-shell { min-height: 100vh; }
.app-nav { background: #fff; padding: 12px 22px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 18px; }
.app-nav .brand { text-decoration: none; font-size: 17px; margin-right: auto; }
.app-nav .brand .dim { color: var(--muted); font-weight: 600; }
.app-nav-links { display: flex; gap: 6px; }
.app-nav-links a { padding: 8px 14px; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-weight: 700; font-size: 14px; }
.app-nav-links a.on { background: #eef2ff; color: var(--blue-d); }
.app-nav-actions { display: flex; gap: 8px; }

/* ===== intro tutorial ===== */
.overlay.tutorial .modal { max-width: 460px; text-align: center; }
.tut-body { color: var(--ink); font-size: 16px; line-height: 1.5; margin: 12px 0 18px; }
.tut-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.tut-dots .dot { width: 9px; height: 9px; border-radius: 50%; background: #d8dee7; }
.tut-dots .dot.on { background: var(--blue); }

/* ===== projector view ===== */
body.projector { font-size: 16px; }
.projector .topbar { padding: 18px 30px; }
.projector .week-pill { font-size: 26px; }
.projector .round-name { font-size: 16px; }
.projector .cost-chip, .projector .mp-tag, .projector .week-timer, .projector .bullwhip-meter {
  font-size: 18px; padding: 8px 16px;
}
.projector .site { width: 210px; }
.projector .site-name { font-size: 20px; }
.projector .site-tag { font-size: 14px; }
.projector .site-building { font-size: 72px; }
.projector .site-stat .v { font-size: 22px; }
.projector .site-stat .l { font-size: 12px; }
.projector .hud { padding: 18px 30px; font-size: 18px; }
.projector .bigstat { padding: 10px 22px; min-width: 110px; }
.projector .bigstat .v { font-size: 28px; }
.projector .endcap { font-size: 38px; }

/* ===== extra mobile polish ===== */
@media (max-width: 600px) {
  .app-nav { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .app-nav .brand { width: 100%; text-align: center; }
  .app-nav-links { width: 100%; justify-content: center; }
  .public-nav { padding: 12px 14px; }
  .public-nav nav { flex-wrap: wrap; justify-content: center; }
  .hud { flex-direction: column; padding: 10px 12px; gap: 10px; }
  .order-panel { width: 100%; }
  .order-input { width: 100%; flex-wrap: wrap; }
  .order-input #rng { flex: 1; min-width: 60%; }
  .scrubber input[type=range] { width: 100%; }
  .topbar-right { flex-wrap: wrap; gap: 8px; }
}

/* ===== week modal — box stack, counterparty labels, help tooltips ===== */
.flow { gap: 6px 18px; }
.flow-line { gap: 12px; }
.flow-body { display: flex; flex-direction: column; line-height: 1.2; }
.flow-line .party { font-style: italic; color: var(--muted); font-size: 11px;
  font-weight: 600; margin: 1px 0 1px; }
.flow-line .num { font-size: 22px; font-weight: 800; }
.flow-line .flow-icon { font-size: 22px; }
.flow-line.f-demand .flow-icon { filter: hue-rotate(-10deg); }
.flow-spacer { min-height: 1px; }

.help-q {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%; font-size: 11px;
  background: #eef2f7; color: var(--blue-d); font-weight: 800; cursor: help;
  margin-left: 4px; font-style: normal;
}
.help-q:hover { background: var(--blue); color: #fff; }
.calc .res { font-weight: 800; }
.calc small { cursor: help; }

.box-stack {
  display: flex; flex-wrap: wrap; gap: 2px; justify-content: center;
  max-width: 160px; margin: 4px auto 0;
}
.box-stack.empty { color: var(--muted); font-size: 13px; font-style: italic; }
.box-stack .box { font-size: 20px; line-height: 1; }
.box-stack .box-more { font-size: 12px; color: var(--muted); font-weight: 800;
  align-self: center; margin-left: 4px; }
.box-back { color: var(--demand); font-weight: 800; font-size: 12.5px;
  text-align: center; margin-top: 6px; }

/* ===== order step (stepper + slider + lead-time chip) ===== */
.lt-chip { display: inline-block; background: #eef2ff; color: var(--blue-d);
  padding: 1px 8px; border-radius: 999px; font-weight: 800; font-size: 12px; }
.order-stepper { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; }
.step-btn { width: 36px; height: 36px; border-radius: 50%; background: #eef2f7;
  color: var(--ink); border: 0; font-size: 20px; font-weight: 800; cursor: pointer;
  font-family: inherit; transition: background .12s; }
.step-btn:hover { background: var(--blue); color: #fff; }
.step-btn:active { transform: scale(.95); }
.order-stepper .order-num { width: 90px; text-align: center; font-size: 22px;
  font-weight: 800; padding: 6px 8px; border: 2px solid var(--line); border-radius: 12px;
  background: #fff; }
.order-stepper .order-num:focus-visible { border-color: var(--blue); outline: none; }
.order-panel input[type=range] { width: 100%; margin: 2px 0 8px; }

/* ===== help button + first-week tip ===== */
.icon-btn { padding: 8px 12px; }
.w1-tip { background: #fefce8; border: 1px solid #fde68a; border-radius: 12px;
  padding: 10px 12px 10px 14px; display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; line-height: 1.4; color: #78350f; margin-bottom: 10px; }
.w1-tip .tip-icon { font-size: 18px; flex-shrink: 0; }
.w1-tip .tip-text { flex: 1; }
.w1-tip .tip-dismiss { background: transparent; border: 0; cursor: pointer;
  font-size: 20px; line-height: 1; color: #92400e; padding: 0 4px; font-weight: 800; }
.w1-tip .tip-dismiss:hover { color: var(--demand); }

/* ===== per-card history popover ===== */
.card-history-btn { background: transparent; border: 0; cursor: pointer;
  font-size: 11px; font-weight: 800; color: var(--blue-d); padding: 4px 0 0;
  width: 100%; text-align: center; font-family: inherit; }
.card-history-btn:hover { color: var(--blue); }
.mini-modal { max-width: 420px; }
.mini-rec { width: 100%; border-collapse: collapse; margin: 8px 0 16px; }
.mini-rec td { padding: 8px 10px; border-bottom: 1px solid var(--line);
  font-size: 14px; }
.mini-rec td:last-child { text-align: right; }
.mini-modal .btn { width: 100%; }

/* ===== scenario categories, get-started checklist, resources row ===== */
.scenario-category { margin-bottom: 22px; }
.scenario-category-title { font-size: 13px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; margin: 4px 0 10px; }
.scenario-emoji { display: inline-block; font-size: 22px; margin-bottom: 4px;
  line-height: 1; }

.get-started { background: var(--card); border-radius: 22px; box-shadow: var(--shadow);
  padding: 30px 32px; margin-bottom: 28px; }
.get-started h2 { font-size: 22px; margin-bottom: 4px; }
.dash-sub { color: var(--muted); margin-bottom: 22px; }
.get-started-grid { list-style: none; padding: 0; display: grid;
  grid-template-columns: repeat(3, 1fr); gap: 18px; }
.get-started-grid li { position: relative; background: #f8fafc; border-radius: 16px;
  padding: 22px 20px 20px; display: flex; flex-direction: column; gap: 8px; }
.gs-num { position: absolute; top: 14px; right: 16px; width: 28px; height: 28px;
  border-radius: 50%; background: var(--blue); color: #fff; font-weight: 800;
  font-size: 13px; display: flex; align-items: center; justify-content: center; }
.get-started-grid h3 { font-size: 16px; margin: 4px 0 2px; }
.get-started-grid p { color: var(--muted); font-size: 13.5px; line-height: 1.45;
  flex: 1; margin-bottom: 6px; }
.get-started-grid .btn { align-self: flex-start; }
@media (max-width: 780px) {
  .get-started-grid { grid-template-columns: 1fr; }
}

.resources { margin-top: 36px; }
.resources h3 { font-size: 14px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 14px; }
.resource-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.resource-card { background: var(--card); border-radius: 14px; padding: 16px;
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px; transition: transform .12s; }
.resource-card:hover { transform: translateY(-2px); }
.resource-icon { font-size: 24px; margin-bottom: 4px; }
.resource-card b { font-size: 14.5px; }
.resource-card .dim { font-size: 12.5px; color: var(--muted); font-weight: 600; line-height: 1.45; }
@media (max-width: 780px) {
  .resource-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== cross-round comparison strip ===== */
.round-strip { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.round-bar { display: flex; flex-direction: column; gap: 4px; }
.round-bar .round-label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.round-bar .round-track { position: relative; background: #f1f5f9; border-radius: 8px;
  height: 26px; overflow: hidden; }
.round-bar .round-fill { height: 100%; background: linear-gradient(90deg, var(--blue) 0%, var(--blue-d) 100%);
  border-radius: 8px; transition: width .4s ease; }
.round-bar .round-val { position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%); font-weight: 800; font-size: 13px; color: var(--ink); }
.round-bar.winner .round-fill { background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%); }
.round-bar.winner .round-label::after { content: ' 🏆'; }
.insight.suggested { background: #ecfdf3; color: var(--green); border-left: 3px solid var(--green); }
@media (prefers-reduced-motion: reduce) {
  .round-bar .round-fill { transition: none; }
}

/* ===== WIP pipeline strip on site cards ===== */
.pipeline-strip { display: flex; align-items: center; gap: 4px; margin: 8px 0 2px;
  justify-content: center; font-family: inherit; }
.pipe-icon { font-size: 14px; }
.pipe-slot { display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px; background: #e0f2fe;
  color: var(--blue-d); border-radius: 6px; font-size: 12px; font-weight: 800; }
.pipe-slot.empty { background: #f1f5f9; color: var(--muted); }

/* ===== toast notifications ===== */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px);
  background: #1f2937; color: #fff; padding: 12px 22px; border-radius: 999px;
  font-weight: 700; font-size: 14px; box-shadow: 0 10px 24px rgba(0,0,0,.22);
  opacity: 0; transition: opacity .22s, transform .22s; z-index: 100;
  max-width: 80vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: opacity .22s; } }

/* ===== marketing showcase ===== */
.showcase { padding: 40px 0 60px; }
.showcase h2 { font-size: 32px; text-align: center; margin-bottom: 8px; }
.showcase-sub { text-align: center; color: var(--muted); margin-bottom: 32px; max-width: 540px;
  margin-left: auto; margin-right: auto; font-size: 15.5px; }

.showcase-video { max-width: 960px; margin: 0 auto 40px; border-radius: 18px;
  overflow: hidden; box-shadow: var(--shadow-lg); background: #000; }
.showcase-video video { width: 100%; height: auto; display: block; }

.showcase-row {
  display: grid; grid-template-columns: 1fr 1.3fr; gap: 36px; align-items: center;
  margin-bottom: 56px;
}
.showcase-row.reverse { grid-template-columns: 1.3fr 1fr; }
.showcase-row.reverse .showcase-text { order: 2; }
.showcase-row.reverse .showcase-img { order: 1; }
.showcase-text h3 { font-size: 24px; margin-bottom: 12px; line-height: 1.2; }
.showcase-text p { color: var(--muted); font-size: 15.5px; line-height: 1.55;
  margin-bottom: 16px; }
.showcase-img { display: block; border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow-lg); transition: transform .18s; }
.showcase-img:hover { transform: translateY(-3px); }
.showcase-img img { width: 100%; height: auto; display: block; }

@media (max-width: 780px) {
  .showcase-row, .showcase-row.reverse { grid-template-columns: 1fr; gap: 18px;
    margin-bottom: 36px; }
  .showcase-row.reverse .showcase-text,
  .showcase-row.reverse .showcase-img { order: initial; }
}
@media (prefers-reduced-motion: reduce) {
  .showcase-img { transition: none; }
  .showcase-video video { /* let user-controls show */ }
}

/* ===== inline brand mark ===== */
.bg-logo { display: inline-block; vertical-align: -6px; }
.public-nav .brand, .app-nav .brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.footer-brand { display: inline-flex; align-items: center; gap: 8px; }
.footer-brand .bg-logo { vertical-align: -4px; }

/* ===== auth forms ===== */
.text-input { width: 100%; font-family: inherit; font-size: 16px; font-weight: 600;
  padding: 13px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; }
.text-input:focus-visible { border-color: var(--blue); outline: none; }
.form-foot { margin-top: 14px; text-align: center; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.form-foot a { color: var(--blue-d); text-decoration: none; }
.form-foot a:hover { text-decoration: underline; }
.form-foot span { margin: 0 6px; }
.consent { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0;
  font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.consent input { margin-top: 3px; }
.flash { padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 700; }
.flash-success { background: #ecfdf3; color: var(--green); }
.flash-error { background: #fef2f2; color: var(--demand); }

/* ===== legal pages ===== */
.legal-page { max-width: 800px; margin: 0 auto; padding: 40px 24px 80px;
  background: var(--card); border-radius: 22px; box-shadow: var(--shadow); margin-top: 30px; margin-bottom: 30px; }
.legal-page h1 { font-size: 32px; margin-bottom: 8px; }
.legal-page h3 { font-size: 17px; margin: 22px 0 6px; color: var(--blue-d); }
.legal-page p, .legal-page li { color: var(--ink); line-height: 1.55; font-size: 14.5px; margin-bottom: 8px; }
.legal-page ul { padding-left: 22px; margin-bottom: 10px; }
.legal-meta { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.legal-back { font-size: 13px; }
.legal-back a { color: var(--muted); }
.legal-page code { background: #f3f6fa; padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.legal-table { width: 100%; border-collapse: collapse; margin: 12px 0 18px;
  font-size: 13.5px; }
.legal-table th, .legal-table td { padding: 8px 10px; border: 1px solid #e5e9f0;
  vertical-align: top; text-align: left; }
.legal-table th { background: #f4f6fb; font-weight: 600; }
.legal-table tbody tr:nth-child(even) { background: #fafbfd; }
.legal-page hr { border: 0; border-top: 1px solid #e5e9f0; margin: 30px 0; }

/* Shared legal footer (last child of public/app shells) */
.legal-footer { padding: 18px 0 30px; text-align: center; font-size: 12px;
  color: var(--muted); opacity: 0.92; }
.legal-footer a { color: var(--muted); text-decoration: none; }
.legal-footer a:hover { color: var(--blue-d); }
.legal-footer-copy { margin-top: 6px; opacity: 0.8; }

/* ===== dashboard mobile cards ===== */
@media (max-width: 700px) {
  .dash-table-wrap { background: transparent; box-shadow: none; }
  .dash-table { display: flex; flex-direction: column; gap: 12px; }
  .dash-table thead { display: none; }
  .dash-table tbody { display: contents; }
  .dash-table tr {
    display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px;
    background: var(--card); border-radius: 14px; padding: 16px; box-shadow: var(--shadow);
  }
  .dash-table td { display: contents; padding: 0; border: 0; }
  .dash-table td::before {
    content: attr(data-label); font-size: 11px; text-transform: uppercase;
    letter-spacing: .4px; color: var(--muted); font-weight: 800;
    align-self: center;
  }
  .dash-table td:first-child::before, .dash-table td:nth-child(2)::before { content: none; }
  .dash-table td:first-child { font-weight: 800; color: var(--muted); grid-column: 1 / -1; }
  .dash-table td:nth-child(2) { grid-column: 1 / -1; font-size: 18px; }
}

/* ===== admin pages ===== */
.app-nav-user { font-weight: 700; color: var(--muted); font-size: 13.5px; margin-right: 6px; }
.inline-form { display: inline-block; margin: 0 2px; }
.admin-note { color: var(--muted); }
.dash-table .seat-you { color: var(--blue-d); font-weight: 800; font-size: 12px; }

/* ===== account page ===== */
.account-page { max-width: 760px; }
.account-card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 24px 28px; margin-bottom: 18px; }
.account-card h2 { font-size: 18px; margin-bottom: 12px; }
.account-card .dim { color: var(--muted); font-size: 14px; line-height: 1.5; margin-bottom: 10px; }
.account-card .btn { margin-top: 4px; }
.account-card.danger { border: 2px solid #fecaca; background: #fff7f7; }
.account-card.danger h2 { color: var(--demand); }
.danger-btn { background: #fee2e2; color: var(--demand); font-weight: 800;
  border: 0; border-radius: 999px; padding: 12px 22px; font-family: inherit;
  font-size: 15px; cursor: pointer; }
.danger-btn:hover { background: var(--demand); color: #fff; }
.app-nav-user.on { color: var(--blue-d); }
.app-nav-user { text-decoration: none; }
.app-nav-user:hover { color: var(--blue); }

/* ===== co-host management ===== */
.cohost-list { list-style: none; padding: 0; margin: 0; }
.cohost-list li { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; background: #f8fafc; border-radius: 10px; margin-bottom: 6px; }

/* ===== quiz / glossary / ranking polish ===== */
.quiz-modal .quiz-progress { font-size: 12px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.quiz-choices { list-style: none; padding: 0; margin: 14px 0 10px; }
.quiz-choices li { margin-bottom: 8px; }
.quiz-choice { width: 100%; text-align: left; padding: 12px 16px; border-radius: 12px;
  border: 2px solid var(--line); background: #fff; font-family: inherit; font-size: 14.5px;
  font-weight: 600; cursor: pointer; color: var(--ink); transition: border-color .12s, background .12s; }
.quiz-choice:hover:not(:disabled) { border-color: var(--blue); background: #f3f8ff; }
.quiz-choice:disabled { cursor: default; opacity: .9; }
.quiz-choice.correct { border-color: var(--green); background: #ecfdf3; color: var(--green); }
.quiz-choice.wrong   { border-color: var(--demand); background: #fef2f2; color: var(--demand); }
.quiz-feedback { background: #f3f6fa; border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.quiz-feedback-line { font-weight: 800; margin-bottom: 6px; }
.quiz-feedback-line.ok  { color: var(--green); }
.quiz-feedback-line.bad { color: var(--demand); }
.quiz-explain { font-size: 13.5px; line-height: 1.5; color: var(--ink); }

.rank-player { color: var(--muted); font-weight: 600; font-size: 13px; }

.glossary-modal { max-width: 540px; }
.glossary { margin: 12px 0 18px; }
.glossary dt { font-weight: 800; color: var(--blue-d); margin-top: 10px; font-size: 14.5px; }
.glossary dd { margin: 2px 0 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ink); }

/* ===== sessions ===== */
.session-share .code-value { font-size: 36px; }
.chain-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.chain-card { background: #f8fafc; border-radius: 14px; padding: 16px 18px; border: 2px solid var(--line); }
.chain-card.playing { border-color: #bbf7d0; }
.chain-card.lobby   { border-color: #fde68a; }
.chain-card.finished { border-color: #cbd5e1; opacity: .8; }
.chain-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.chain-card-id   { font-weight: 800; color: var(--blue-d); }
.chain-card-row  { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; padding: 3px 0; }
.chain-card-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.session-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch; }
.session-broadcast { display: flex; gap: 8px; flex: 1; min-width: 280px; align-items: center; }
.session-broadcast .text-input { flex: 1; min-width: 0; }

/* ===== session leaderboard ===== */
.session-ranking li { background: #f8fafc; }
.session-ranking li.rank-1 { background: #fef3c7; }

/* ===== danger zone / destructive actions ===== */
.danger-zone { margin-top: 18px; padding: 10px 14px; border: 1px solid #fde2e2;
  border-radius: 12px; background: #fff7f7; }
.danger-zone summary { cursor: pointer; font-weight: 700; color: #b91c1c;
  font-size: 14px; }
.danger-zone[open] summary { margin-bottom: 8px; }
.danger-zone p { font-size: 13px; margin: 6px 0 10px; }
.btn-danger { background: #dc2626; color: #fff; border: 0; }
.btn-danger:hover { background: #b91c1c; }

/* ===== scenario preview on session-create ===== */
.scenario-preview { margin-top: 18px; padding: 14px 16px; background: #f8fafc;
  border-radius: 14px; border: 1px solid #e5e9f0; }
.scenario-preview:empty { display: none; }
.scenario-preview-head { font-size: 15px; margin-bottom: 8px; }
.scenario-round { padding: 10px 0; border-top: 1px dashed #e5e9f0; }
.scenario-round:first-of-type { border-top: 0; padding-top: 4px; }
.scenario-round-head { font-size: 14px; }
.scenario-round-meta { color: var(--muted); font-size: 13px; margin: 2px 0 4px; }
.scenario-round-curve { display: flex; align-items: center; gap: 8px; }
.demand-spark { width: 220px; height: 40px; flex-shrink: 0;
  background: #fff; border-radius: 6px; padding: 2px; box-shadow: inset 0 0 0 1px #e5e9f0; }

/* ===== broadcast banner (instructor → player) ===== */
.broadcast-banner {
  position: fixed; left: 50%; top: 20px; transform: translate(-50%, -120%);
  z-index: 60; display: flex; align-items: center; gap: 14px;
  background: #1c63d4; color: #fff; padding: 12px 18px;
  border-radius: 14px; box-shadow: var(--shadow-lg);
  font-size: 15.5px; font-weight: 700;
  max-width: min(680px, 92vw); transition: transform .28s cubic-bezier(.2,.7,.2,1);
}
.broadcast-banner.show { transform: translate(-50%, 0); }
.broadcast-banner .broadcast-icon { font-size: 22px; }
.broadcast-banner .broadcast-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.broadcast-banner .broadcast-from { font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  opacity: 0.88; font-weight: 800; }
.broadcast-banner .broadcast-text { font-weight: 700; line-height: 1.35; }
.broadcast-banner .broadcast-close {
  background: rgba(255,255,255,.15); border: 0; color: #fff;
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  font-size: 17px; line-height: 1; flex-shrink: 0;
}
.broadcast-banner .broadcast-close:hover { background: rgba(255,255,255,.28); }
@media (prefers-reduced-motion: reduce) {
  .broadcast-banner { transition: none; }
}

/* host-menu section label (e.g. "Chat moderation") */
.host-menu-items .menu-section-label {
  padding: 6px 12px 2px; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
}

/* ===== chain comparison chart (session debrief) ===== */
.chain-compare { overflow-x: auto; padding: 8px 0 4px; }
.chain-compare-svg { width: 100%; max-width: 100%; height: auto;
  background: #fff; border-radius: 12px; border: 1px solid #e5e9f0; }
.chain-compare-legend { display: flex; flex-wrap: wrap; gap: 14px;
  font-size: 13px; color: var(--muted); margin-top: 10px; padding: 0 4px; }
.chain-compare-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chain-compare-legend .legend-sw { width: 14px; height: 14px; border-radius: 4px;
  display: inline-block; }

/* ===== session projector view (whole-class display) ===== */
.proj-shell { min-height: 100vh; padding: 28px 36px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%); }
.proj-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.proj-title { display: flex; flex-direction: column; gap: 6px; }
.proj-title .proj-badge { font-size: 14px; font-weight: 800; color: var(--blue-d);
  background: #fff; padding: 4px 12px; border-radius: 999px; box-shadow: var(--shadow);
  align-self: flex-start; }
.proj-title h1 { font-size: 42px; letter-spacing: -1px; margin: 0; }
.proj-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.proj-code { background: #fff; padding: 14px 20px; border-radius: 14px; box-shadow: var(--shadow);
  text-align: right; }
.proj-code-label { display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); font-weight: 800; }
.proj-code-value { display: block; font-size: 38px; font-weight: 800;
  letter-spacing: 2px; color: var(--ink); }
.proj-back { color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; }
.proj-back:hover { color: var(--blue-d); }

.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px; }
.proj-chain { background: #fff; border-radius: 16px; padding: 16px 18px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
  border-left: 6px solid #cbd5e1; transition: transform .2s; }
.proj-chain.status-playing { border-left-color: var(--blue); }
.proj-chain.status-paused { border-left-color: var(--gold); }
.proj-chain.status-finished { border-left-color: var(--green); }
.proj-chain.status-lobby { border-left-color: #cbd5e1; }
.proj-chain.rank-1.status-playing,
.proj-chain.rank-1.status-finished { border-left-color: #fbbf24; background: #fffbeb; }

.proj-chain-head { display: flex; align-items: center; gap: 10px; }
.proj-medal { font-size: 22px; font-weight: 800; min-width: 28px; }
.proj-chain-id { font-weight: 800; font-size: 18px; flex: 1; }
.proj-chain-cost { font-size: 36px; font-weight: 800; color: var(--demand);
  letter-spacing: -.5px; }
.proj-chain-progress { display: flex; align-items: center; gap: 8px; font-size: 13px;
  flex-wrap: wrap; }
.proj-week-bar { flex: 1; height: 8px; background: #e5e9f0; border-radius: 999px;
  overflow: hidden; min-width: 60px; }
.proj-week-fill { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
.proj-week-num { font-weight: 800; font-size: 13px; }
.proj-roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  padding-top: 6px; border-top: 1px solid #e5e9f0; }
.proj-role { text-align: center; padding: 4px 0; }
.proj-role-name { display: block; font-size: 10px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); font-weight: 800; }
.proj-role-cost { display: block; font-size: 15px; font-weight: 800; color: var(--ink); }

.proj-foot { display: flex; gap: 10px; justify-content: center; margin-top: 26px;
  font-size: 13px; }

/* ===== platform status pill (security page) ===== */
.status-pill { display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 12px 16px; border-radius: 10px; border: 1px solid #ddd;
  background: #fafafa; margin: 0 0 22px; font-size: 14px; }
.status-pill .status-dot { width: 12px; height: 12px; border-radius: 50%;
  background: #6e7781; display: inline-block; flex-shrink: 0; }
.status-pill.status-up    .status-dot { background: #1a7f37; }
.status-pill.status-degraded .status-dot { background: #b08800; }
.status-pill.status-down  .status-dot { background: #cf222e; }
.status-pill.status-paused .status-dot { background: #6e7781; }
.status-pill .status-meta { color: var(--muted); }
.status-pill .status-probe { margin-left: auto; font-size: 12px; color: var(--muted);
  text-decoration: none; }
.status-pill .status-probe:hover { color: var(--blue-d); }
