:root {
  --panel: rgba(16, 23, 30, 0.88);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f3f5f7;
  --dim: #aab3bd;
  --accent: #e4ae4f;
  --good: #8ac4a9;
  --bad: #ff6b4a;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #0b0f14; color: var(--text);
  font: 14px/1.35 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: fixed; inset: 0; pointer-events: none; user-select: none; -webkit-user-select: none; }

.panel {
  position: absolute; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 5px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.14);
}
.cap { font-size: 11px; letter-spacing: 0.14em; color: var(--dim); font-weight: 600; }
.big { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }

#panel-rings { top: 14px; left: 14px; min-width: 178px; }
#panel-rings h1 { margin: 0 0 4px; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
#panel-rings .of { font-size: 18px; color: var(--dim); margin-left: 4px; font-weight: 600; }
#pips { display: flex; gap: 6px; margin-top: 8px; }
#pips i { display: block; width: 25px; height: 4px; border-radius: 1px; border: 1px solid rgba(255, 255, 255, 0.28); }
#pips i.next { border-color: var(--accent); background: var(--accent); }
#pips i.done { border-color: var(--good); background: var(--good); }

#panel-time { top: 14px; right: 14px; min-width: 112px; text-align: right; }
#panel-time .best { margin-top: 4px; }
#panel-time .best span { color: var(--text); font-variant-numeric: tabular-nums; }

#panel-controls { left: 14px; bottom: 14px; }
#panel-controls dl { margin: 6px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; align-items: center; }
#panel-controls dt { display: flex; gap: 4px; }
#panel-controls dd { margin: 0; }
kbd {
  display: inline-block; min-width: 26px; padding: 2px 6px; text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.35); border-bottom-width: 2px; border-radius: 5px;
  background: rgba(255, 255, 255, 0.08); color: #fff;
  font: 600 12px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

#panel-telemetry { right: 14px; bottom: 14px; min-width: 196px; }
.tele { display: flex; justify-content: space-between; gap: 16px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tele span { color: var(--dim); }
.tele b { font-weight: 600; }
.tele.ok b { color: var(--good); }
.tele.bad b { color: var(--bad); }

#message {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: max(220px, calc(100vw - 460px));
  padding: 8px 16px; border-radius: 999px; text-align: center; font-weight: 600;
  background: var(--panel); border: 1px solid var(--line);
}
#message.good { border-color: var(--good); color: var(--good); }
#message.warn { border-color: var(--bad); color: #ffd3c8; }

#marker {
  position: absolute; left: 0; top: 0; transform: translate(-999px, -999px);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: #fff; white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 6px rgba(0, 0, 0, 0.6);
}
#marker-label { padding: 3px 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); }
#marker.hidden { visibility: hidden; }
#marker-arrow {
  display: block; width: 0; height: 0;
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 12px solid var(--accent);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

#finish { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(6, 10, 14, 0.35); }
#finish[hidden] { display: none; }
#finish .card { padding: 22px 34px; text-align: center; background: rgba(12, 16, 22, 0.84); border: 1px solid var(--good); border-radius: 14px; }
#finish .big { font-size: 46px; margin: 6px 0; }
#finish .sub { color: var(--dim); }
#finish-best { margin-top: 6px; color: var(--good); font-weight: 700; }
#finish-best[hidden] { display: none; }
#finish .again { margin-top: 12px; font-weight: 600; }

#fatal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; background: #0b0f14; font-size: 16px; }
#fatal[hidden] { display: none; }
