:root {
  /* heyrunnur "Midnight coral" colorway (runform packages/ui/src/theme.css) */
  --bg: #0e1726;
  --panel: #19222f;
  --panel2: #222b39;
  --rule: rgba(160, 165, 170, 0.16);
  --ink: #f2f5f5;
  --ink2: #a0a5aa;
  --mute: #757b83;
  --faint: #3b4554;
  --accent: #3ec6e0;
  --left: #3ec6e0;
  --right: #f1efe9;
  --sans: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); }
.wrap { max-width: 1400px; margin: 0 auto; padding: 16px 20px 12px; display: flex; flex-direction: column; gap: 12px; }

.head { display: flex; gap: 20px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.headtext { flex: 1 1 520px; min-width: 0; }
.kicker { font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
h1 { margin: 8px 0 0; font-size: clamp(18px, 2.3vw, 27px); line-height: 1.15; font-weight: 600; letter-spacing: -.02em; text-wrap: balance; }
.dek { margin: 7px 0 0; color: var(--ink2); font-size: 14px; line-height: 1.45; max-width: 980px; }

.runs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 560px; }
.runs button { background: var(--panel); color: var(--mute); border: 1px solid var(--rule); border-radius: 9px; padding: 6px 10px; cursor: pointer; font: 400 12px/1.25 var(--sans); text-align: left; }
.runs button b { display: block; color: var(--ink2); font-weight: 500; }
.runs button:hover { border-color: var(--faint); color: var(--ink); }
.runs button.on { border-color: var(--accent); background: rgba(62, 198, 224, 0.1); color: var(--ink); }
.runs button.on b { color: var(--ink); }

.card { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.cardhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h2 { margin: 0; font-size: 13px; font-weight: 500; color: var(--ink2); }
.sub { font-size: 12px; color: var(--mute); }
.tools { display: flex; gap: 6px; }
.btn { background: transparent; color: var(--ink2); border: 1px solid var(--rule); border-radius: 8px; padding: 4px 10px; font: 500 12px/1.4 var(--sans); cursor: pointer; }
.btn:hover { border-color: var(--faint); color: var(--ink); }
.btn[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); }

.riverrow { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
.side, .main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 900px) { .riverrow { grid-template-columns: 1fr; } }
.rivercard { display: flex; flex-direction: column; }
#river { width: 100%; height: clamp(200px, 44vh, 380px); display: block; margin-top: 4px; touch-action: none; cursor: crosshair; }
.hint { margin: 4px 0 0; font-size: 12px; color: var(--mute); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 10px; }
.legend button { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid transparent; border-radius: 999px; padding: 3px 9px 3px 7px; color: var(--ink2); font: 400 12px/1.3 var(--sans); cursor: pointer; }
.legend button:hover { border-color: var(--rule); color: var(--ink); }
.legend button i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend button.off { color: var(--faint); }
.legend button.off i { background: transparent !important; outline: 1.5px solid var(--faint); outline-offset: -1.5px; }

.readout { display: flex; flex-direction: column; gap: 8px; }
.ro-kind { font: 500 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
.ro-time { font: 600 22px/1.1 var(--sans); letter-spacing: -.01em; }
.ro-time small { font: 400 13px var(--sans); color: var(--mute); margin-left: 6px; }
.ro-strain { height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.ro-strain i { display: block; height: 100%; background: linear-gradient(90deg, #2c6f80, #3ec6e0); border-radius: 3px; transition: width .15s; }
.ro-list { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 0; padding: 0; list-style: none; }
.ro-list li { display: grid; grid-template-columns: 10px 1fr auto 62px; gap: 8px; align-items: center; font-size: 12.5px; padding: 4px 6px; border-radius: 7px; color: var(--ink2); }
.ro-list li i { width: 10px; height: 10px; border-radius: 3px; }
.ro-list li .v { font-family: var(--mono); font-size: 12px; color: var(--ink); }
.ro-list li .d { font-family: var(--mono); font-size: 12px; text-align: right; color: var(--mute); }
.ro-list li.out { background: var(--panel2); color: var(--ink); }
.ro-list li.out .d { color: var(--ink); font-weight: 600; }
.ro-note { font-size: 12px; color: var(--mute); line-height: 1.45; margin-top: auto; }

#lanes { width: 100%; display: block; margin-top: 6px; cursor: crosshair; }

.tablewrap { max-height: 360px; overflow: auto; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 12px; }
th, td { padding: 4px 8px; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--panel); color: var(--mute); font-weight: 500; }
td:first-child, th:first-child { text-align: left; }
td { font-family: var(--mono); color: var(--ink2); }

footer { color: var(--mute); font-size: 11.5px; line-height: 1.5; white-space: pre-wrap; }
footer .err { color: #ff8a8a; }

.tip { position: fixed; pointer-events: none; background: #222b39; border: 1px solid var(--faint); color: var(--ink); border-radius: 8px; padding: 6px 9px; font-size: 12px; line-height: 1.4; opacity: 0; transition: opacity .1s; z-index: 10; max-width: 280px; }
.tip.on { opacity: 1; }

svg text { font-family: var(--sans); }
.axis text { fill: var(--mute); font-size: 11px; }
.axis line, .axis path { stroke: var(--rule); }
.mono { font-family: var(--mono); }

@media (prefers-reduced-motion: reduce) { .ro-strain i { transition: none; } }

/* small dashboard tiles: the river gets the room, the header shrinks to one line of runs */
@media (max-height: 720px), (max-width: 760px) {
  .wrap { padding: 10px 12px 8px; gap: 8px; }
  .dek { display: none; }
  .head { flex-direction: column; align-items: stretch; gap: 8px; }
  .headtext { flex: none; }
  .runs { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; max-width: none; padding-bottom: 2px; }
  .runs button { flex: 0 0 auto; padding: 4px 8px; }
  .hint { display: none; }
}

/* runner figure */
#runner { width: 100%; height: 300px; display: block; margin-top: 6px; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.seg button { background: transparent; border: 0; color: var(--mute); font: 500 11px/1 var(--mono); padding: 5px 8px; cursor: pointer; }
.seg button.on { background: var(--panel2); color: var(--ink); }
.figkey { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--ink2); margin-top: 6px; align-items: center; }
.figkey span, .figkey label { display: inline-flex; align-items: center; gap: 5px; }
.figkey label { cursor: pointer; }
.figkey input { margin: 0; accent-color: var(--accent); }
.figkey i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.k-left { background: var(--left); } .k-right { background: var(--right); }
.k-ghost { background: rgba(160, 165, 170, 0.5); }
.k-impact { background: #ffb454; height: 8px !important; width: 8px !important; border-radius: 50% !important; }
.k-braking { background: #ff6f61; }
