html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1530; }
body { font-family: Nunito, system-ui, sans-serif; color: #f1f5f9; }
canvas { position: fixed; inset: 0; display: block; touch-action: none; cursor: crosshair; }
/* @spec COCKPIT-MOB-001 */
body { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }

/* @spec HOST-012 — a small tab in the top-left corner, clear of the fuel bar below it. */
.stage-badge {
  position: fixed; left: 0; top: 0; z-index: 6; pointer-events: none;
  padding: 2px 10px 3px; border-bottom-right-radius: 10px;
  background: #f59e0b; color: #0b1530; font: 800 11px/1.3 Nunito, system-ui, sans-serif; letter-spacing: 0.12em;
}
.stage-badge[hidden] { display: none; }

.hud { position: fixed; pointer-events: none; }
.label { font-size: 15px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #cbd5e1; }

.speed { left: 0; right: 0; top: 28px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.speed .value { font-size: 64px; font-weight: 800; line-height: 1; color: #fff; }
.speed .unit { font-size: 28px; font-weight: 700; color: #cbd5e1; }
.change { font-size: 26px; font-weight: 800; }
.change.up { color: #4ade80; }
.change.down { color: #f87171; }
.change.flat { color: #94a3b8; }

.fuel { left: 32px; top: 36px; width: 220px; display: flex; flex-direction: column; gap: 8px; }
.bar { height: 18px; border-radius: 9px; background: #1e2a4a; border: 2px solid #334155; overflow: hidden; }
.bar { position: relative; }
.planned { position: absolute; left: 0; top: 0; height: 100%; width: 100%; border-radius: 9px;
  background: repeating-linear-gradient(135deg, rgba(56,189,248,0.45) 0 6px, rgba(56,189,248,0.2) 6px 12px); }
.fill { position: relative; height: 100%; width: 100%; background: #38bdf8; border-radius: 9px; }
.fill.low { background: #ef4444; }

.time { left: 0; right: 0; bottom: 32px; display: flex; justify-content: center; gap: 12px; pointer-events: auto; width: fit-content; margin: 0 auto; }
.time button {
  display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 20px; border-radius: 26px;
  border: 2px solid #334155; background: #16213f; color: #e2e8f0; font: 700 17px Nunito, system-ui, sans-serif; cursor: pointer;
}
.time button.active { border-color: #22d3ee; background: #22d3ee; color: #0b1530; font-weight: 800; }

.help { right: 32px; top: 40px; max-width: 260px; text-align: right; font-size: 14px; line-height: 1.5; color: #cbd5e1; }

.message {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, 90px); pointer-events: none;
  background: rgba(22, 33, 63, 0.92); border: 2px solid #334155; border-radius: 20px;
  padding: 18px 28px; text-align: center; font-size: 22px; font-weight: 700; line-height: 1.4; max-width: 520px;
}
.message .big { display: block; font-size: 40px; font-weight: 800; }

.tuner-toggle {
  position: fixed; right: 20px; bottom: 36px; width: 44px; height: 44px; border-radius: 22px;
  border: 2px solid #334155; background: #16213f; color: #cbd5e1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.tuner {
  position: fixed; right: 20px; bottom: 92px; width: 260px; padding: 14px 16px; border-radius: 16px;
  background: rgba(22, 33, 63, 0.96); border: 2px solid #334155; display: flex; flex-direction: column; gap: 10px;
  font-size: 14px; font-weight: 700; color: #e2e8f0;
}
.tuner[hidden], .tuner-toggle[hidden] { display: none; }
.tuner-title { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: #94a3b8; }
.tuner label { display: grid; grid-template-columns: 56px 1fr 44px; align-items: center; gap: 8px; }
.tuner input { width: 100%; accent-color: #22d3ee; }
.tuner output { text-align: right; font-variant-numeric: tabular-nums; color: #67e8f9; }

/* ---------- getting-started tour ---------- */
.tour-card {
  position: fixed; z-index: 5; width: 340px; box-sizing: border-box; padding: 16px 18px 16px;
  background: rgba(22, 33, 63, 0.97); border: 2px solid #fcd34d; border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45); color: #f1f5f9;
  animation: tour-pop 220ms ease-out;
}
.tour-card[hidden] { display: none; }
@keyframes tour-pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tour-card[data-anchor="hud-speed"] { left: 50%; top: 200px; margin-left: -170px; }
.tour-card[data-anchor="hud-fuel"] { left: 32px; top: 104px; }
.tour-card[data-anchor="hud-time"] { left: 50%; bottom: 112px; margin-left: -170px; }
.tour-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.tour-count { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; color: #fcd34d; }
.tour-skip { background: none; border: none; color: #94a3b8; font: 700 13px Nunito, system-ui, sans-serif; cursor: pointer; padding: 6px 4px; min-height: 32px; }
.tour-skip:hover { color: #e2e8f0; }
.tour-title { margin: 2px 0 6px; font-size: 22px; font-weight: 800; color: #fff; }
.tour-text { margin: 0 0 14px; font-size: 16px; line-height: 1.45; color: #e2e8f0; }
.tour-next {
  height: 44px; padding: 0 22px; border-radius: 22px; border: none; background: #fcd34d; color: #0b1530;
  font: 800 16px Nunito, system-ui, sans-serif; cursor: pointer;
}
.tour-next[hidden], .tour-back[hidden] { display: none; }
.tour-actions { display: flex; gap: 10px; align-items: center; }
.tour-back {
  height: 44px; padding: 0 18px; border-radius: 22px; border: 2px solid #475569; background: transparent; color: #e2e8f0;
  font: 700 16px Nunito, system-ui, sans-serif; cursor: pointer;
}
.tour-back:hover { border-color: #94a3b8; }
.tour-next:disabled { background: #475569; color: #cbd5e1; cursor: default; }
.hud.tour-target { border-radius: 14px; outline: 3px solid #fcd34d; outline-offset: 8px; animation: tour-glow 1.1s ease-in-out infinite alternate; }
@keyframes tour-glow { from { box-shadow: 0 0 10px 4px rgba(252, 211, 77, 0.25); } to { box-shadow: 0 0 28px 10px rgba(252, 211, 77, 0.5); } }
.tour-replay {
  position: fixed; right: 20px; top: 24px; width: 40px; height: 40px; border-radius: 20px; z-index: 3;
  border: 2px solid #334155; background: #16213f; color: #fcd34d; font: 800 20px Nunito, system-ui, sans-serif; cursor: pointer;
}
.help { right: 76px; }
.free-note {
  left: 50%; top: 168px; transform: translateX(-50%); padding: 5px 14px; border-radius: 14px;
  background: rgba(22, 33, 63, 0.85); border: 1px solid #334155; color: #a7f3d0;
  font-size: 13px; font-weight: 800; letter-spacing: 0.04em; white-space: nowrap;
}
.free-note[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .tour-card, .hud.tour-target { animation: none; } }

/* @spec COCKPIT-MOB-003 */
@media (max-width: 600px) {
  .speed { top: 16px; }
  .speed .value { font-size: 40px; }
  .speed .unit { font-size: 18px; }
  .change { font-size: 18px; }
  .label { font-size: 12px; }
  .fuel { left: 16px; top: 20px; width: 110px; gap: 6px; }
  .bar { height: 14px; }
  .help { display: none; }
  .tuner-toggle { right: 12px; bottom: 76px; width: 40px; height: 40px; }
  /* Phones: the tour card docks above the time buttons, full width. */
  .tour-card, .tour-card[data-anchor] { left: 12px !important; right: 12px; top: auto !important; bottom: calc(132px + env(safe-area-inset-bottom, 0px)); width: auto; margin-left: 0; padding: 14px 16px; }
  .tour-title { font-size: 19px; }
  .tour-text { font-size: 15px; margin-bottom: 10px; }
  .tour-replay { right: 12px; top: 16px; width: 36px; height: 36px; font-size: 18px; }
  .free-note { top: 118px; font-size: 11px; }
  .tuner { right: 12px; left: 12px; width: auto; bottom: 124px; }
  .time { bottom: max(16px, env(safe-area-inset-bottom)); gap: 6px; }
  .time button { height: 44px; padding: 0 10px; gap: 5px; font-size: 14px; border-radius: 22px; }
  .time button svg { width: 14px; height: 14px; }
  .message { font-size: 17px; padding: 14px 18px; max-width: calc(100vw - 32px); box-sizing: border-box; width: max-content; }
  .message .big { font-size: 28px; }
}
.message .up { color: #4ade80; }
.message .down { color: #f87171; }
