/* Critter Exodus — everything here is local to /exodus/; nothing in
   web/style.css is loaded, so none of its shared traps (.volume-slider,
   .overlay-card, #hud) apply. */
:root {
  --bg: #0d1424;
  --panel: rgba(16, 24, 42, 0.94);
  --panel2: #1b2742;
  --line: rgba(160, 200, 255, 0.16);
  --text: #e8eefc;
  --muted: #95a4c4;
  --accent: #7ad35a;
  --accent2: #ffd36a;
  --danger: #ff6a5a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg);
  color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block;
  touch-action: none; image-rendering: pixelated; cursor: crosshair; }
[hidden] { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; }
.primary, .secondary { border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; }
.primary { background: linear-gradient(180deg, #8be06a, #3f9b3a); color: #0b1a09;
  box-shadow: 0 3px 0 #23601f; }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #23601f; }
.secondary { background: var(--panel2); border: 1px solid var(--line); }
.link-btn { background: none; border: 0; color: var(--accent2); text-decoration: underline;
  padding: 6px 8px; }
.back-link { display: block; margin-top: 10px; color: var(--muted); font-size: 13px;
  text-align: center; }

/* ── overlays ─────────────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; display: flex; align-items: flex-start;
  justify-content: center; overflow-y: auto; padding: 18px 12px 28px;
  background: radial-gradient(ellipse at top, rgba(40, 70, 60, 0.55), rgba(5, 8, 16, 0.92));
  z-index: 20; }
.card { width: 100%; max-width: 880px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px 18px 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  position: relative; }
.logo { margin: 4px 0 2px; font-size: 40px; letter-spacing: 3px; font-weight: 900;
  color: #8be06a; text-shadow: 0 3px 0 #1d4d1a, 0 0 22px rgba(122, 211, 90, 0.35); }
.logo span { color: var(--accent2); margin-left: 10px; text-shadow: 0 3px 0 #6b4a10; }
.logo.small { font-size: 30px; text-align: center; }
.tagline { color: var(--muted); margin: 4px 0 12px; font-size: 14px; }
.menu-audio { position: absolute; top: 10px; right: 12px; }

.namebox { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.namebox label { font-size: 12px; color: var(--muted); }
.namebox input, .res-name input { background: #0b1222; border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); padding: 8px 10px; font-size: 15px; max-width: 260px; }
.res-name .row { display: flex; gap: 8px; flex-wrap: wrap; }

.tier-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.tier-tab { flex: 1 1 0; min-width: 72px; border: 1px solid var(--line); background: var(--panel2);
  border-radius: 10px; padding: 7px 8px; font-weight: 700; font-size: 14px; }
.tier-tab small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }
.tier-tab.on { border-color: var(--tier, var(--accent)); box-shadow: inset 0 -3px 0 var(--tier, var(--accent)); }

.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px; margin-bottom: 12px; }
.lv-btn { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 8px 6px 6px;
  background: linear-gradient(180deg, #22304f, #172238); text-align: center; min-height: 74px; }
.lv-btn b { display: block; font-size: 22px; }
.lv-btn span { display: block; font-size: 11px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.lv-btn .st { color: var(--accent2); font-size: 12px; letter-spacing: 1px; }
.lv-btn.sel { border-color: var(--accent2); box-shadow: 0 0 0 2px rgba(255, 211, 106, 0.35); }
.lv-btn.done { background: linear-gradient(180deg, #24432b, #172b1d); }
.lv-btn.locked { opacity: 0.45; }
.lv-btn.locked::after { content: "🔒"; position: absolute; top: 4px; right: 6px; font-size: 12px; }
.lv-btn .tut { position: absolute; top: 4px; left: 6px; font-size: 11px; }

.level-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #121b30; }
.lc-head { display: flex; align-items: center; gap: 10px; }
.lc-head h2 { margin: 0; font-size: 20px; }
.lc-head small { color: var(--muted); }
.lc-num { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  background: var(--panel2); font-weight: 900; font-size: 20px; flex: none; }
.lc-stars { margin-left: auto; color: var(--accent2); font-size: 20px; letter-spacing: 2px; }
.lc-hint { color: #c7d3ee; margin: 8px 0; font-size: 14px; }
.lc-facts { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.lc-facts span { background: var(--panel2); border-radius: 8px; padding: 4px 8px; }
.lc-skills { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.lc-skill { display: flex; align-items: center; gap: 4px; background: #0b1222; border-radius: 8px;
  padding: 3px 7px 3px 3px; font-size: 13px; border: 1px solid var(--line); }
.lc-skill.none { opacity: 0.3; }
.lc-skill canvas { width: 22px; height: 22px; image-rendering: pixelated; }
.lc-best, .lc-record { font-size: 13px; color: var(--muted); margin: 3px 0; }
.lc-record .mg-name-title { margin-left: 4px; }
.lc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.menu-actions { display: flex; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ── HUD ──────────────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
.hud-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center;
  gap: 8px; padding: 6px 8px; background: linear-gradient(180deg, rgba(5, 9, 18, 0.85), rgba(5, 9, 18, 0));
  font-size: 14px; }
.hud-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: rgba(20, 30, 52, 0.9); font-weight: 800; flex: none; }
.hud-level { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.hud-level b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.hud-level small { color: var(--muted); font-size: 11px; }
.hud-stats { display: flex; gap: 10px; margin-left: auto; white-space: nowrap;
  background: rgba(10, 16, 30, 0.75); padding: 5px 10px; border-radius: 9px; border: 1px solid var(--line); }
.hud-stats b { color: var(--accent2); }
.hud-plate { display: flex; align-items: center; gap: 4px; max-width: 26vw; min-width: 0;
  background: rgba(10, 16, 30, 0.75); padding: 4px 8px; border-radius: 9px; border: 1px solid var(--line);
  font-size: 13px; }
.plate-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.hud-plate .mg-name-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-gear { position: relative; flex: none; }
.hud-gear summary { list-style: none; width: 34px; height: 34px; border-radius: 9px; display: grid;
  place-items: center; border: 1px solid var(--line); background: rgba(20, 30, 52, 0.9); cursor: pointer; }
.hud-gear summary::-webkit-details-marker { display: none; }
.hud-gear #hudAudio { position: absolute; right: 0; top: 40px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
#minimap { position: absolute; right: 8px; top: 50px; width: 220px; height: 52px;
  border: 1px solid var(--line); border-radius: 6px; background: rgba(6, 10, 20, 0.8);
  image-rendering: pixelated; touch-action: none; }
.toast { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); pointer-events: none;
  background: rgba(10, 16, 30, 0.85); border: 1px solid var(--line); padding: 6px 14px;
  border-radius: 20px; font-weight: 700; opacity: 0; transition: opacity 0.25s; white-space: nowrap; }
.toast.on { opacity: 1; }

.skill-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 6px; align-items: stretch;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: rgba(6, 10, 20, 0.92);
  border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.skill-bar::-webkit-scrollbar { display: none; }
.rr-group, .ctl-group { display: flex; gap: 4px; flex: none; }
.skills { display: flex; gap: 4px; flex: 1 0 auto; }
.sk-btn { position: relative; min-width: 50px; height: 68px; border-radius: 10px; border: 1px solid var(--line);
  background: linear-gradient(180deg, #24324f, #18233a); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 2px; flex: none; }
.sk-btn canvas { width: 30px; height: 30px; image-rendering: pixelated; }
.sk-btn small { font-size: 10px; color: var(--muted); }
.sk-btn .cnt { position: absolute; top: 2px; right: 4px; font-weight: 900; font-size: 13px; color: var(--accent2); }
.sk-btn.sel { border-color: var(--accent2); background: linear-gradient(180deg, #4a4220, #2b2614);
  box-shadow: 0 0 0 2px rgba(255, 211, 106, 0.4); }
.sk-btn.empty { opacity: 0.35; }
.sk-btn.ctl { font-size: 22px; }
.sk-btn.ctl.on { border-color: var(--accent); background: #24432b; }
.sk-btn.nuke.armed { background: #6b1d17; border-color: var(--danger); animation: pulse 0.6s infinite alternate; }
.rr-btn { font-size: 24px; font-weight: 900; min-width: 40px; }
.rr-box { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 40px; }
.rr-box small { font-size: 10px; color: var(--muted); }
.rr-box b { font-size: 18px; }

/* ── coach ────────────────────────────────────────────────────────── */
/* desktop: over the SKY, not the ground — level 3's cliff edge and the water
   gap sat exactly under a bottom-anchored coach (review 2026-10-13) */
.coach { position: absolute; left: 50%; top: 58px; bottom: auto; transform: translateX(-50%); width: min(560px, calc(100% - 16px));
  background: rgba(14, 30, 22, 0.95); border: 2px solid var(--accent); border-radius: 14px; padding: 8px 12px 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); z-index: 6; }
.coach-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.coach-badge { color: var(--accent); font-weight: 800; }
.coach-skip { margin-left: auto; background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 12px; }
.coach p { margin: 4px 0 2px; font-size: 15px; line-height: 1.35; }
.coach-next { margin-top: 4px; border: 0; border-radius: 8px; padding: 6px 12px; font-weight: 800;
  background: var(--accent); color: #0b1a09; }
.coach-hl { outline: 3px solid var(--accent2) !important; outline-offset: 2px;
  animation: pulse 0.7s infinite alternate; z-index: 7; }
@keyframes pulse { from { filter: brightness(1); } to { filter: brightness(1.45); } }

/* ── results & rules ─────────────────────────────────────────────── */
.res-card { max-width: 620px; text-align: center; }
.res-stars { font-size: 34px; letter-spacing: 6px; color: var(--accent2); min-height: 40px; }
.res-stars .off { color: #3a4562; }
.res-verify { font-size: 14px; color: var(--muted); min-height: 20px; }
.res-verify.ok { color: var(--accent); }
.res-verify.bad { color: var(--danger); }
.res-name { align-items: center; }
.res-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 12px 0 4px; }
#resTable, #resAwards { margin-top: 8px; }
.rules-card { max-width: 640px; }
.rules-card h2 { margin: 0 0 6px; }
.rules-intro { color: #c7d3ee; font-size: 14px; }
.rules-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.rule-skill { display: flex; gap: 10px; align-items: flex-start; background: #121b30; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px; }
.rule-skill canvas { width: 40px; height: 40px; image-rendering: pixelated; flex: none; background: #0b1222; border-radius: 8px; }
.rule-skill b { display: block; }
.rule-skill span { font-size: 13px; color: var(--muted); }
.rules-list { font-size: 14px; color: #c7d3ee; padding-left: 18px; }
.rules-list li { margin: 4px 0; }

/* the shared leaderboard, themed through its five tokens (on the CARD too:
   the Close button is a sibling of the panel) */
.lb-panel, .lb-card { --lb-panel: #121b30; --lb-edge: rgba(160, 200, 255, 0.18);
  --lb-text: #e8eefc; --lb-dim: #95a4c4; --lb-accent: #8be06a; }

/* ── phone ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .logo { font-size: 28px; letter-spacing: 1px; }
  .logo span { margin-left: 6px; }
  .menu-audio { position: static; margin-bottom: 6px; }
  .card { padding: 12px 12px 10px; }
  .level-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .lv-btn { min-height: 62px; padding: 6px 2px 4px; }
  .lv-btn b { font-size: 18px; }
  .hud-top { gap: 5px; padding: 4px 5px; font-size: 12px; flex-wrap: wrap; }
  .hud-level { display: none; }
  .hud-stats { gap: 6px; padding: 4px 6px; margin-left: 0; }
  .hud-plate { max-width: 30vw; }
  .sk-btn { min-width: 44px; height: 60px; }
  .sk-btn canvas { width: 26px; height: 26px; }
  #minimap { width: 150px; height: 36px; top: 92px; right: 6px; }
  .skill-bar { flex-wrap: wrap; justify-content: space-between; row-gap: 6px; overflow-x: visible; }
  .skills { order: 3; flex: 1 1 100%; justify-content: space-between; }
  .skills .sk-btn { flex: 1 1 0; min-width: 0; }
  .coach { top: auto; bottom: 150px; }
  .coach p { font-size: 14px; }
}
@media (max-height: 460px) {
  .sk-btn { height: 52px; }
  .sk-btn small { display: none; }
  #minimap { top: 46px; }
  .coach { top: auto; bottom: 70px; left: 8px; transform: none; width: min(420px, 60vw); }
}
