:root {
  --ink: #f4f1ea;
  --muted: #b9b3a6;
  --panel: rgba(24, 22, 19, 0.78);
  --line: rgba(255, 255, 255, 0.12);
  --accent: #f2a43a;
  --danger: #e5604f;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1c1a17; color: var(--ink);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#hud[hidden] { display: none; }
.stats, .next { position: absolute; top: 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; backdrop-filter: blur(6px); }
.stats { left: 16px; min-width: 150px; }
.height { font-size: 40px; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.height small { font-size: 16px; margin-left: 3px; color: var(--muted); }
.row { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); }
.row b { color: var(--ink); font-variant-numeric: tabular-nums; }
#lives { color: var(--danger); letter-spacing: 2px; }

.next { right: 16px; width: 190px; text-align: center; }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.label.up { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); text-align: left; }
#cur-thumb { width: 110px; height: 110px; object-fit: contain; }
.name { font-weight: 600; }
.meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.next-row { display: flex; gap: 8px; align-items: center; text-align: left; margin-top: 4px; }
#next-thumb { width: 44px; height: 44px; object-fit: contain; }

.controls { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px;
  pointer-events: auto; }
.controls button, #start { font: inherit; font-weight: 600; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; cursor: pointer; min-width: 52px; }
.controls button:hover { border-color: var(--accent); }
.controls .drop, #start { background: var(--accent); color: #1c1a17; border-color: var(--accent); }

#toast { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); font-size: 28px; font-weight: 700;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); opacity: 0; transition: opacity 0.3s; white-space: nowrap; }
#toast.show { opacity: 1; }
#toast.bad { color: var(--danger); }

#overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(15, 14, 12, 0.55);
  padding: 16px; }
#overlay[hidden] { display: none; }
.card { max-width: 440px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px 26px; backdrop-filter: blur(8px); }
.card h1 { margin: 0 0 8px; font-size: 30px; }
.card p { color: var(--muted); margin: 0 0 12px; }
.help { margin: 0 0 18px; padding-left: 18px; color: var(--muted); }
.help b { color: var(--ink); }
#start { width: 100%; padding: 12px; font-size: 16px; }
#start:disabled { opacity: 0.6; cursor: wait; }

footer { position: fixed; bottom: 8px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted);
  pointer-events: auto; padding: 0 16px; }
footer a { color: var(--muted); }

/* Warehouse mode */
.gauges { text-align: left; }
.lift-bar { position: relative; height: 90px; width: 14px; margin: 8px 0 6px; border: 1px solid var(--line);
  border-radius: 4px; background: rgba(255, 255, 255, 0.05); }
#lift-fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); border-radius: 3px; }
.lift-bar .mark { position: absolute; left: -4px; width: 22px; height: 2px; background: #f2e230; }
.gauges #hint { margin-top: 2px; }
.controls.drive { flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 32px); }
.controls.drive button { touch-action: none; user-select: none; }
.switch { margin: 12px 0 0; text-align: center; }
.switch a { color: var(--accent); }

@media (max-width: 640px) {
  .stats { left: 8px; top: 8px; min-width: 0; padding: 8px 10px; }
  .height { font-size: 28px; }
  .next { right: 8px; top: 8px; width: 132px; padding: 8px; }
  #cur-thumb { width: 64px; height: 64px; }
  #next-meta { display: none; }
  .controls { bottom: 64px; }
}
