:root {
  --cobalt: #1a2bd8; --deep: #0b1466; --night: #070c3f; --paper: #f7f8fc; --mist: #dfe3ff; --signal: #ffd21f; --alarm: #ff5a4f; --amber: #ffa53d;
  --ink: #0b1466; --ink-2: #4a5290; --on: #ffffff; --on-2: #c9d0ff;
  --display: 'Bricolage Grotesque', 'Arial Narrow', sans-serif; --text: 'Instrument Sans', system-ui, sans-serif;
  --dock: 84px; --left: 44vw;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--cobalt); color: var(--on); font: 400 17px/1.5 var(--text); overflow: hidden; -webkit-font-smoothing: antialiased; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }

.bar { position: fixed; z-index: 6; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 22px 40px; font-size: 15px; pointer-events: none; }
.bar > * { pointer-events: auto; }
.who { font-weight: 600; text-decoration: none; }
.link { color: var(--on); text-decoration: underline; text-underline-offset: 4px; }
.link[hidden] { display: none; }

#story { position: fixed; z-index: 3; top: 0; left: 0; bottom: var(--dock); width: var(--left); padding: 92px 24px 24px 40px; overflow-y: auto; outline: none; display: flex; flex-direction: column; justify-content: center; scrollbar-width: none; }
#story > * { flex-shrink: 0; }
h1 { font: 800 clamp(2.4rem, 4.5vw, 4.5rem)/.98 var(--display); font-variation-settings: 'opsz' 96; letter-spacing: -.035em; margin: 0 0 20px; text-wrap: balance; }
.body { margin: 0 0 22px; max-width: 34em; color: var(--on); }
.body + .body { margin-top: -10px; }
.small { font-size: 14px; color: var(--on-2); max-width: 38em; margin: 0 0 14px; }

.deck { background: var(--deep); padding: 20px 22px; border-radius: 18px; max-width: 520px; }
.ctl { margin-bottom: 16px; }
.ctl:last-child { margin-bottom: 0; }
.ctl label { display: flex; justify-content: space-between; gap: 16px; font-size: 15px; margin-bottom: 6px; }
.ctl b { font: 700 18px var(--display); font-variant-numeric: tabular-nums; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: none; margin: 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: var(--on-2); border-radius: 2px; }
input[type=range]::-moz-range-track { height: 4px; background: var(--on-2); border-radius: 2px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; background: var(--signal); border-radius: 50%; border: 0; }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; background: var(--signal); border-radius: 50%; border: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chips:last-child { margin-bottom: 0; }
.chip { padding: 8px 15px; border-radius: 999px; font-size: 15px; font-weight: 500; box-shadow: inset 0 0 0 1.5px var(--on-2); transition: background .15s, color .15s; }
.chip:hover { box-shadow: inset 0 0 0 1.5px var(--on); }
.chip[aria-pressed=true] { background: var(--signal); color: var(--deep); box-shadow: none; }
.say { margin: 14px 0 0; font-weight: 500; }

#overlay { position: fixed; z-index: 2; left: var(--left); right: 0; top: 0; bottom: var(--dock); pointer-events: none; }
.stat { position: absolute; left: 3%; bottom: 3%; display: flex; gap: 44px; flex-wrap: wrap; }
.stat b { display: block; font: 800 clamp(2.4rem, 5vw, 5rem)/1 var(--display); font-variation-settings: 'opsz' 96; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 15px; color: var(--on-2); }
.stat .hot b { color: var(--signal); }
.stat .bad b { color: var(--alarm); }
.solo { position: absolute; inset: 0 4% 0 3%; display: flex; flex-direction: column; justify-content: center; }
.solo b { font: 800 clamp(5rem, 14vw, 13rem)/.9 var(--display); font-variation-settings: 'opsz' 96; letter-spacing: -.05em; color: var(--signal); font-variant-numeric: tabular-nums; }
.solo span { font-size: clamp(1.1rem, 2vw, 1.6rem); margin-top: 14px; max-width: 24em; }

#right { position: fixed; z-index: 4; left: calc(var(--left) + 8px); right: 40px; top: 74px; bottom: calc(var(--dock) + 8px); display: flex; align-items: center; pointer-events: none; }
#right:empty { display: none; }
.card { width: 100%; max-height: 100%; overflow-y: auto; background: var(--paper); color: var(--ink); border-radius: 22px; padding: 28px 30px; pointer-events: auto; }
.card h2 { font: 800 1.6rem/1.1 var(--display); letter-spacing: -.02em; margin: 0 0 12px; }
.card .chip { box-shadow: inset 0 0 0 1.5px #b9c0ee; }
.card .chip:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.card .chip[aria-pressed=true] { background: var(--ink); color: var(--paper); }
.sm { font-size: 14px; color: var(--ink-2); }
.mailhead { display: grid; grid-template-columns: 62px 1fr; font-size: 15px; gap: 4px; padding-bottom: 12px; margin-bottom: 12px; box-shadow: 0 1px 0 var(--mist); }
.mailhead span { color: var(--ink-2); }
.mailhead i { font-style: normal; display: inline-flex; align-items: center; gap: 8px; }
.mailhead i::before { content: ''; width: 11px; height: 11px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 2px var(--ink); }
textarea, input[type=text] { width: 100%; font: 400 16px/1.55 var(--text); color: var(--ink); background: #fff; border: 1.5px solid #b9c0ee; border-radius: 12px; padding: 12px 14px; }
textarea { min-height: 236px; resize: vertical; }
.gate { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; padding: 0; font-size: 14px; }
.gate li::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #24b47e; margin-right: 7px; }
.gate li.no { font-weight: 600; }
.gate li.no::before { background: var(--alarm); }
table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 500; font-size: 13px; color: var(--ink-2); padding: 0 12px 8px 0; }
td { padding: 9px 12px 9px 0; box-shadow: 0 -1px 0 var(--mist); vertical-align: top; }
td.hot { color: #d62f25; font-weight: 600; }
.scroll { overflow-x: auto; }
.tag { display: inline-block; background: var(--signal); color: var(--ink); font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; margin-bottom: 12px; }
.opts { display: grid; gap: 8px; }
.opts button { text-align: left; padding: 11px 14px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1.5px #b9c0ee; font-size: 15px; }
.opts button:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.opts button[data-right=true] { background: #dcf7ec; box-shadow: inset 0 0 0 1.5px #24b47e; }
.opts button[data-right=false] { background: #ffe6e4; box-shadow: inset 0 0 0 1.5px var(--alarm); }
.kpi { display: flex; gap: 34px; margin: 4px 0 14px; }
.kpi b { font: 800 2.4rem/1 var(--display); display: block; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 14px; color: var(--ink-2); }
.route { padding: 14px 16px; border-radius: 14px; background: var(--mist); margin-top: 14px; }
.route b { font: 800 1.25rem var(--display); display: block; margin-bottom: 4px; }
.lanes { display: grid; gap: 18px; }
.lanes h3 { font: 800 1.15rem var(--display); margin: 0 0 8px; }
.lanes h3 small { font: 400 14px var(--text); color: var(--ink-2); margin-left: 8px; }
.lanes ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.lanes li { font-size: 14px; padding: 5px 11px; border-radius: 8px; background: var(--mist); }
.lanes li.add { background: var(--signal); }
.plan { white-space: pre-wrap; font: 400 16px/1.6 var(--text); margin: 0 0 18px; }
.cta { display: inline-block; background: var(--signal); color: var(--deep); font: 700 1.05rem var(--text); padding: 13px 24px; border-radius: 999px; text-decoration: none; }
.cta.alt { background: none; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); margin-left: 8px; }
.card .cta { background: var(--ink); color: var(--paper); }
.card .cta.alt { background: none; color: var(--ink); }

.dock { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; height: var(--dock); display: flex; align-items: center; gap: 22px; padding: 0 40px; background: var(--night); }
.back { font-size: 15px; color: var(--on-2); }
.back:hover { color: var(--on); }
#ticks { flex: 1; display: flex; gap: 5px; list-style: none; margin: 0; padding: 0; }
#ticks li { flex: 1; }
#ticks a { display: block; padding: 10px 0; }
#ticks a span { display: block; height: 4px; border-radius: 2px; background: #2a3382; transition: background .2s; }
#ticks a:hover span { background: var(--on-2); }
#ticks li.done span { background: var(--on); }
#ticks li.now span { background: var(--signal); }
.next { background: var(--signal); color: var(--deep); font-weight: 700; padding: 13px 24px; border-radius: 999px; text-decoration: none; white-space: nowrap; transition: transform .15s; }
.next:hover { transform: translateX(3px); }

#drawer { position: fixed; z-index: 8; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--paper); color: var(--ink); padding: 28px 30px; overflow-y: auto; transform: translateX(102%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); visibility: hidden; }
#drawer.open { transform: none; visibility: visible; }
#drawer h2 { font: 800 1.7rem/1.1 var(--display); margin: 0 0 8px; letter-spacing: -.02em; }
#drawer pre { background: var(--deep); color: var(--mist); padding: 16px; border-radius: 12px; overflow-x: auto; font: 13px/1.6 ui-monospace, Menlo, monospace; margin: 12px 0; }
.close { float: right; text-decoration: underline; text-underline-offset: 4px; }

@media (max-width: 900px) {
  :root { --dock: 68px; --left: 100vw; }
  body { overflow: auto; font-size: 16px; }
  #stage { position: absolute; height: 42svh; }
  #overlay { position: absolute; left: 0; right: 0; top: 0; bottom: auto; height: 42svh; }
  .bar { padding: 12px 16px; font-size: 14px; }
  #story { position: relative; top: auto; bottom: auto; width: 100%; margin-top: 42svh; padding: 20px 16px 8px; overflow: visible; display: block; }
  #right { position: relative; left: auto; right: auto; top: auto; bottom: auto; padding: 0 16px calc(var(--dock) + 16px); display: block; }
  #right:empty { display: none; }
  #story:has(+ #right:empty) { padding-bottom: calc(var(--dock) + 16px); }
  h1 { font-size: clamp(2.1rem, 9.5vw, 3rem); margin-bottom: 14px; }
  .stat { left: 16px; right: 16px; bottom: 8px; gap: 12px; flex-wrap: nowrap; }
  .stat > div { flex: 1; min-width: 0; }
  .stat b { font-size: 1.6rem; }
  .stat span { font-size: 12px; line-height: 1.25; display: block; }
  .solo { inset: 34px 16px 0; }
  .solo b { font-size: clamp(4rem, 22vw, 7rem); }
  .solo span { font-size: 1rem; margin-top: 6px; }
  .card { padding: 20px 18px; }
  .dock { padding: 0 16px; gap: 12px; }
  #ticks { display: none; }
  .next { margin-left: auto; padding: 11px 18px; font-size: 15px; }
  .cta.alt { margin: 8px 0 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
