html, body { margin: 0; padding: 0; overflow: hidden; background: #000; height: 100%; }
canvas { display: block; }
.hidden { display: none !important; }

:root {
  --hud-bg: rgba(12, 8, 24, .68);
  --hud-border: rgba(255, 255, 255, .16);
  --hud-shadow: 0 5px 18px rgba(0, 0, 0, .28);
}

/* ---------- In-run HUD (SCORE + coins top-right; SPD/ALT/RING bottom-left) ---------- */
/* Icons share a baseline with the numbers next to them. */
.mfi { vertical-align: -0.16em; }

#stats {
  position: fixed; bottom: 16px; left: 16px; color: #fff;
  display: flex; align-items: center; gap: 14px; padding: 8px 12px;
  border: 1px solid var(--hud-border); border-radius: 9px;
  background: var(--hud-bg); box-shadow: var(--hud-shadow);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  font-family: 'Consolas', monospace; font-size: 13px; letter-spacing: .3px;
  text-shadow: 0 1px 4px rgba(0,0,0,.7); user-select: none; pointer-events: none;
}
#stats span { display: inline-block; min-width: 0; }
#stats span + span { padding-left: 14px; border-left: 1px solid rgba(255,255,255,.16); }
#ringDist { color: #7fefff; }

#score {
  position: fixed; top: 16px; right: 18px; text-align: right; padding: 8px 11px 7px;
  border: 1px solid var(--hud-border); border-radius: 9px;
  background: var(--hud-bg); box-shadow: var(--hud-shadow);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  font-family: 'Consolas', monospace; color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.7); user-select: none; pointer-events: none;
}
#score .big { font-size: 22px; color: #ffd166; letter-spacing: 1px; }
#score #coinVal { font-size: 15px; color: #ffcf3a; opacity: .95; margin-top: 3px; }

/* ---------- Fuel bar (top center, in-run) ---------- */
#fuel {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  width: 240px; max-width: 46vw; height: 12px; z-index: 7;
  border: 1px solid rgba(255,255,255,.35); border-radius: 7px;
  background: rgba(0,0,0,.4); pointer-events: none;
  box-shadow: 0 1px 6px rgba(0,0,0,.6);
}
#fuel i {
  display: block; height: 100%; width: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #33e0a0, #66f0c0);
  transition: width .12s linear, background .3s;
}
#fuelIcon {
  position: absolute; left: -21px; top: 50%; transform: translateY(-50%);
  color: #66f0c0; line-height: 0; filter: drop-shadow(0 1px 3px rgba(0,0,0,.7));
}
#fuel.low i { background: linear-gradient(90deg, #ff3b3b, #ff7a4d); animation: fpulse .6s ease-in-out infinite; }
#fuel.low #fuelIcon { color: #ff6a4d; }
@keyframes fpulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* ---------- Radar ---------- */
#radar {
  position: fixed; right: 18px; bottom: 18px;
  width: 168px; height: 168px; border-radius: 50%;
  box-shadow: 0 0 14px rgba(255, 46, 166, .55), inset 0 0 18px rgba(0, 0, 0, .6);
  border: 3px solid #ff2ea6;
  background: #140a26;
}

/* ---------- Loader ---------- */
#loader {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: #14141c; color: #eee; font-family: 'Segoe UI', system-ui, sans-serif;
  z-index: 10; transition: opacity .6s;
}
#loader .spin {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid #444; border-top-color: #e8a37c;
  animation: r 1s linear infinite;
}
@keyframes r { to { transform: rotate(360deg); } }
#loader .msg { font-size: 15px; opacity: .9; }
#loader .sub { font-size: 12px; opacity: .55; }
#loader.error .spin { display: none; }

/* ---------- Start / Pause / Results / Shop overlays ---------- */
#start, #pause, #results, #shop {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background: rgba(12, 8, 24, .82); color: #fff; z-index: 9;
  font-family: 'Segoe UI', system-ui, sans-serif; text-align: center;
  overflow-y: auto; padding: 24px 16px; box-sizing: border-box;
}
#start {
  background:
    radial-gradient(circle at 50% 45%, rgba(42, 20, 62, .42), rgba(12, 8, 24, .76) 62%),
    linear-gradient(180deg, rgba(12, 8, 24, .58), rgba(12, 8, 24, .78));
}
#results, #shop { z-index: 10; }
#start h1 { font-size: 34px; letter-spacing: 6px; margin: 0; color: #ff2ea6;
  text-shadow: 0 0 18px rgba(255,46,166,.8); }
#start .tag { margin: 0 0 4px; opacity: .65; font-size: 13px; letter-spacing: 2px; }
.btnRow.titleBtns { align-items: center; margin-top: 18px; }
/* Keyboard help — lives in the pause overlay now (removed from the title). */
.keys { opacity: .6; font-size: 13px; line-height: 1.7; margin-top: 14px; }
.keys .row { font-size: 13px; }
#pause .pauseHint { opacity: .6; margin: 2px 0 0; }
#results h2, #shop h2 {
  font-size: 26px; letter-spacing: 4px; margin: 0 0 4px; color: #ff2ea6;
  text-shadow: 0 0 14px rgba(255,46,166,.7);
}

/* Shared overlay buttons (FLY / SHOP / results / shop). */
.btnRow { display: flex; gap: 12px; margin-top: 14px; justify-content: center; }
.btnRow.wrap { flex-wrap: wrap; max-width: 520px; }
#start button, #pause button, #results button, #shop button, #startBtn {
  padding: 11px 26px; font-size: 15px; letter-spacing: 2px;
  color: #0ff; background: transparent; border: 2px solid #00e5ff; border-radius: 8px;
  cursor: pointer; text-shadow: 0 0 10px rgba(0,229,255,.8);
  box-shadow: 0 0 14px rgba(0,229,255,.35);
  font-family: inherit; transition: background .15s, opacity .15s;
}
#start button:hover, #pause button:hover, #results button:hover, #shop button:hover { background: rgba(0,229,255,.12); }
button:focus-visible, .planeCard:focus-visible {
  outline: 3px solid #fff; outline-offset: 4px;
  box-shadow: 0 0 0 6px rgba(0, 229, 255, .38);
}
button.ghost {
  color: #cbb6ff; border-color: rgba(160,120,255,.7);
  text-shadow: none; box-shadow: none;
}
button.ghost:hover { background: rgba(160,120,255,.12); }
button.ad {
  color: #101018; background: #ffd166; border-color: #ffd166;
  text-shadow: none; box-shadow: 0 0 16px rgba(255,209,102,.5); font-weight: 700;
}
button.ad:hover { background: #ffdd85; }
button.disabled, #start button:disabled, #results button:disabled, #shop button:disabled {
  opacity: .4; cursor: not-allowed; box-shadow: none;
}
button.used { color: #7bd389; border-color: #7bd389; text-shadow: none; box-shadow: none; }

/* Title FLY — the single focal action: filled, larger, gently pulsing. */
#start button.primary {
  color: #04212a; background: #00e5ff; border-color: #00e5ff; font-weight: 700;
  padding: 14px 42px; font-size: 18px; text-shadow: none;
  box-shadow: 0 0 22px rgba(0,229,255,.55);
}
#start button.primary:hover { background: #4df0ff; }
#start button.flyPulse { animation: flyPulse 1.9s ease-in-out infinite; }
@keyframes flyPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(0,229,255,.4); }
  50%      { box-shadow: 0 0 30px rgba(0,229,255,.85); }
}

/* Title SHOP — secondary, but carries the next-desire hook (progress underbar
   + a "N◉" hint when close, green READY when affordable). */
#start button.shopCta { position: relative; overflow: hidden; }
.shopHint { margin-left: 8px; font-size: 12px; color: #ffcf3a; display: inline-flex;
  align-items: center; gap: 3px; }
.shopBar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: rgba(255,255,255,.12); display: block; }
.shopBar i { display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #a06bff, #ff2ea6); transition: width .3s; }
#start button.shopCta.ready {
  color: #7bd389; border-color: rgba(123,211,137,.8);
  box-shadow: 0 0 14px rgba(123,211,137,.4); animation: readyPulse 1.4s ease-in-out infinite;
}
#start button.shopCta.ready .shopHint { color: #7bd389; font-weight: 700; }
#start button.shopCta.ready .shopBar i { background: linear-gradient(90deg, #33e0a0, #7bd389); }

#pause h2 { font-size: 28px; letter-spacing: 5px; margin: 0; }
#pause p { opacity: .6; }
#pause #resumeBtn {
  margin-top: 12px; color: #04212a; background: #00e5ff; border-color: #00e5ff;
  font-weight: 800; text-shadow: none; box-shadow: 0 0 22px rgba(0,229,255,.45);
}

/* ---------- Title status strip (coin / rep / rank chips) ---------- */
.statusStrip {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  flex-wrap: wrap; font-family: 'Consolas', monospace; margin: 8px 0 2px;
}
.statusStrip .chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.05);
  font-size: 14px; letter-spacing: .5px;
}
.statusStrip .chip b { font-weight: 700; }
.statusStrip .chipCoin { color: #ffcf3a; }
.statusStrip .chipRep { color: #ffd166; }
.statusStrip .chipRank { color: #cbb6ff; letter-spacing: 2px; font-size: 12px; }

/* ---------- Plane cards (shop) ---------- */
.planeCard {
  width: 150px; padding: 14px 16px; text-align: left; cursor: pointer;
  border: 2px solid rgba(255,255,255,.22); border-radius: 10px;
  background: rgba(255,255,255,.04); transition: border-color .15s, box-shadow .15s;
}
.planeCard:hover { border-color: rgba(0,229,255,.5); }
.planeCard.sel {
  border-color: #00e5ff; background: rgba(0,229,255,.08);
  box-shadow: 0 0 14px rgba(0,229,255,.35);
}
.pname { font-size: 15px; letter-spacing: 2px; color: #ffd166; }
.pdesc { font-size: 11px; opacity: .6; margin: 4px 0 10px; min-height: 26px; }
.pstat { display: flex; align-items: center; gap: 7px; font-size: 10px; margin-top: 5px; }
.pstat span { width: 32px; opacity: .65; font-family: 'Consolas', monospace; }
.pbar { flex: 1; height: 5px; background: rgba(255,255,255,.14); border-radius: 3px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: #ff2ea6; border-radius: 3px; }
.pbar.big { height: 9px; border-radius: 5px; }
.pbar.big i { background: linear-gradient(90deg, #ff2ea6, #ffd166); }

.planeCard.locked { opacity: .72; border-color: rgba(255,255,255,.14); }
.planeCard.locked:hover { border-color: rgba(255,209,102,.5); }
.planeCard .lock { font-size: 12px; }
.planeCard .price {
  margin-top: 8px; font-family: 'Consolas', monospace; font-size: 13px;
  color: #ffcf3a; letter-spacing: 1px;
}

/* ---------- Results screen ---------- */
/* (1) coins earned is the hero number. */
.rStats { margin: 6px 0 2px; }
.rBig { font-size: 40px; color: #ffcf3a; font-family: 'Consolas', monospace; letter-spacing: 1px;
  display: inline-flex; align-items: center; gap: 8px; }
.rBig span { text-shadow: 0 0 16px rgba(255,207,58,.6); }
.rBig .mfi { vertical-align: baseline; }
/* (4) CAREER line: chevron + rank arc + thin bar + small run stats. */
.rRank { margin: 12px 0 2px; width: 340px; max-width: 82vw; }
.rRankHead {
  font-family: 'Consolas', monospace; font-size: 12px; letter-spacing: 3px;
  opacity: .55; margin-bottom: 6px;
}
.rRankName { font-size: 14px; letter-spacing: 2px; color: #cbb6ff; margin-bottom: 6px;
  display: inline-flex; align-items: center; gap: 6px; }
.rRankStats {
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
  font-family: 'Consolas', monospace; font-size: 12px; opacity: .8; margin-top: 7px;
}

/* (5) FLY AGAIN is the primary next-desire action — larger + green glow so it
   wins the eye. CONTINUE / ×2 / SHOP drop to a quieter secondary row below. */
#results button.primary {
  color: #0c1a10; background: #7bd389; border-color: #7bd389; font-weight: 700;
  padding: 14px 40px; font-size: 18px;
  text-shadow: none; box-shadow: 0 0 22px rgba(123,211,137,.7);
}
#results button.primary:hover { background: #93e0a0; }
#results .btnRow.secondary { margin-top: 8px; opacity: .92; }
#results .btnRow.secondary button { padding: 9px 20px; font-size: 13px; }
#results button.ad { box-shadow: 0 0 8px rgba(255,209,102,.3); font-weight: 600; }

/* ---------- Shop ---------- */
.shopCoins { font-family: 'Consolas', monospace; font-size: 20px; color: #ffcf3a; margin-bottom: 6px; }
.shopSection { font-size: 12px; letter-spacing: 3px; opacity: .55; margin: 10px 0 2px; }
.shopGrid {
  display: grid; grid-template-columns: repeat(3, 150px); gap: 12px;
  justify-content: center;
}
.shopPlanes { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 2px; }
.upCard {
  padding: 12px 14px; text-align: left; border-radius: 10px;
  border: 2px solid rgba(255,255,255,.18); background: rgba(255,255,255,.04);
}
/* Nearest-affordable upgrade — subtle "READY" glow (mirrors results/title). */
.upCard.ready {
  border-color: rgba(123,211,137,.75); background: rgba(123,211,137,.08);
  box-shadow: 0 0 14px rgba(123,211,137,.4); animation: readyPulse 1.4s ease-in-out infinite;
}
.upName { font-size: 13px; letter-spacing: 1.5px; color: #ffd166; }
.upDesc { font-size: 11px; opacity: .6; margin: 4px 0 8px; min-height: 28px; }
.pips { font-size: 13px; letter-spacing: 3px; color: #ff2ea6; margin-bottom: 9px; }
.buyBtn {
  width: 100%; padding: 8px 10px; font-size: 13px; letter-spacing: 1px;
  font-family: 'Consolas', monospace; cursor: pointer; border-radius: 7px;
  color: #0ff; background: transparent; border: 2px solid #00e5ff;
  transition: background .15s, opacity .15s;
}
.buyBtn:hover { background: rgba(0,229,255,.12); }
.buyBtn.disabled, .buyBtn:disabled { opacity: .4; cursor: not-allowed; }
.buyBtn.owned { color: #7bd389; border-color: #7bd389; }
.buyBtn.ad {
  margin-top: 7px; color: #101018; background: #ffd166; border-color: #ffd166; font-weight: 700;
}
.buyBtn.ad:hover { background: #ffdd85; }
.shopPlane { width: 150px; }
.shopPlane .buyBtn { margin-top: 8px; }
/* Focused (previewed) but not the selected plane — e.g. eyeing a locked one. */
.planeCard.focus:not(.sel) { border-color: #ffd166; box-shadow: 0 0 12px rgba(255,209,102,.35); }

/* "UPGRADES FOR: X" note when the focused plane is locked. */
.shopNote { font-size: 11px; opacity: .7; color: #cbb6ff; margin: 0 0 6px; letter-spacing: .5px; }
/* Locked plane's upgrade grid reads as inert until it's unlocked. */
.shopGrid.locked { opacity: .6; }
.shopSection .lock { font-size: 12px; }

/* ---------- 3D aircraft preview (js/preview.js) ---------- */
.shopPreviewWrap { display: flex; justify-content: center; margin: 4px 0 10px; }
.shopPreview {
  width: 260px; height: 200px; max-width: 82vw; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: radial-gradient(ellipse at 50% 62%, rgba(255,150,90,.12), rgba(12,8,24,0) 70%);
}
.shopPreview .previewCanvas {
  width: 100% !important; height: 100% !important; display: block; border-radius: 14px;
}

@media (max-width: 560px) {
  .shopGrid { grid-template-columns: repeat(2, 44vw); }
  .shopPreview { width: 220px; height: 168px; }
}

/* ---------- Effects ---------- */
#flash {
  position: fixed; inset: 0; pointer-events: none; z-index: 8;
  background: radial-gradient(ellipse at center, rgba(255,60,30,.55), rgba(120,0,0,.75));
  opacity: 0; transition: opacity .8s;
}
#flash.on { opacity: 1; transition: opacity .05s; }

#msg {
  position: fixed; top: 26%; left: 50%; transform: translateX(-50%);
  font-family: 'Consolas', monospace; font-size: 26px; color: #ffd166;
  text-shadow: 0 0 12px rgba(255,209,102,.8); pointer-events: none; z-index: 8;
  opacity: 0; transition: opacity .5s;
}
#msg.on { opacity: 1; transition: opacity .05s; }

/* ---------- Run-boundary stinger (SHIFT START / SHIFT OVER / LOW FUEL) ---------- */
/* Big, centered, felt: pops in with a quick scale + fades. One element, three
   variants (start = cyan, over = amber, warn = red). */
#stinger {
  position: fixed; top: 44%; left: 50%; z-index: 9; pointer-events: none;
  font-family: 'Segoe UI', system-ui, sans-serif; font-weight: 800;
  font-size: 54px; letter-spacing: 6px; text-align: center; white-space: nowrap;
  opacity: 0; transform: translate(-50%, -50%) scale(.82);
  transition: opacity .5s ease, transform .5s ease;
}
#stinger.on { opacity: 1; transform: translate(-50%, -50%) scale(1); transition: opacity .12s ease, transform .18s cubic-bezier(.2,1.3,.5,1); }
#stinger.start { color: #7fefff; text-shadow: 0 0 22px rgba(0,229,255,.85), 0 2px 8px rgba(0,0,0,.7); }
#stinger.over  { color: #ffd27a; text-shadow: 0 0 24px rgba(255,166,46,.85), 0 2px 8px rgba(0,0,0,.7); }
#stinger.warn  { color: #ff6a4d; font-size: 40px; letter-spacing: 4px;
  text-shadow: 0 0 20px rgba(255,60,40,.85), 0 2px 8px rgba(0,0,0,.75); }

/* ---------- Guided-tutorial instruction banner (persistent) ---------- */
#banner {
  position: fixed; top: 58px; left: 50%; transform: translateX(-50%);
  font-family: 'Segoe UI', system-ui, sans-serif; font-size: 16px; font-weight: 800;
  letter-spacing: 1.5px; color: #fff; text-align: center; max-width: min(90vw, 680px);
  padding: 9px 16px; border-radius: 999px; box-sizing: border-box;
  background: rgba(12, 8, 24, .76); border: 1px solid rgba(0, 229, 255, .72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  text-shadow: 0 0 9px rgba(0, 229, 255, .55);
  pointer-events: none; z-index: 8; opacity: 0; transition: opacity .3s;
}
#banner.on { opacity: 1; animation: bpulse 1.7s ease-in-out infinite; }
@keyframes bpulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 229, 255, .3); }
  50%      { box-shadow: 0 0 30px rgba(0, 229, 255, .6); }
}

/* ---------- Screen-edge ring arrow ---------- */
#ringArrow {
  position: fixed; left: 0; top: 0; z-index: 8; pointer-events: none;
  font-size: 34px; line-height: 1; color: #00e5ff;
  text-shadow: 0 0 10px rgba(0, 229, 255, .9), 0 0 4px rgba(0, 0, 0, .85);
  will-change: left, top, transform;
}

/* ---------- Fuel-bar attention pulse (tutorial FUEL step) ---------- */
#fuel.pulse { border-color: #ffd166; animation: fuelPulse .7s ease-in-out infinite; }
@keyframes fuelPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 209, 102, .5); }
  50%      { box-shadow: 0 0 22px rgba(255, 209, 102, .95); }
}

/* ---------- Touch controls (js/touch.js) ---------- */
/* Added to the game canvas + touch UI only when touch.js activates
   (pointer: coarse / ontouchstart) — never present on desktop. */
.touch-canvas { touch-action: none; }

#touchLayer, #touchTop {
  position: fixed; inset: 0; z-index: 6;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
#touchTop { inset: auto; top: 12px; right: 12px; display: flex; gap: 8px; }
#touchTop button {
  width: 48px; height: 48px; min-width: 44px; min-height: 44px; padding: 0;
  border-radius: 50%; border: 2px solid rgba(255,255,255,.4);
  background: rgba(20,10,30,.55); color: #fff; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
#touchTop button:active { background: rgba(0,229,255,.35); }

/* Left-half touch capture zone for the floating joystick (invisible). */
#joyZone { position: absolute; left: 0; top: 0; width: 50%; height: 100%; }

/* Joystick base + knob spawn under the finger on touchstart, hidden otherwise. */
#joyBase {
  position: fixed; width: 96px; height: 96px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.35);
  opacity: 0; pointer-events: none; transition: opacity .04s linear;
  contain: layout paint;
}
#joyBase.on { opacity: 1; }
#joyKnob {
  position: absolute; left: 24px; top: 24px; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(0,229,255,.35); border: 2px solid rgba(0,229,255,.85);
  pointer-events: none; transform: translate3d(0,0,0); will-change: transform;
}

/* BOOST hold button — bottom-right, above the radar with a safe margin. */
#boostBtn {
  position: fixed; right: 75px; bottom: 224px; width: 76px; height: 76px;
  border-radius: 50%; background: rgba(255,46,166,.18); border: 3px solid #ff2ea6;
  color: #fff; font-family: 'Segoe UI', system-ui, sans-serif; font-size: 13px;
  font-weight: 700; letter-spacing: 1px; display: flex; align-items: center;
  justify-content: center; text-align: center;
  -webkit-tap-highlight-color: transparent; box-shadow: 0 0 14px rgba(255,46,166,.4);
}
#boostBtn.active { background: rgba(255,46,166,.55); box-shadow: 0 0 22px rgba(255,46,166,.8); }

/* ---------- Touch-device HUD adjustments ---------- */
body.touch .keys { display: none; }
body.touch #score { top: 68px; }

/* Desktop control legend: keeps the essential actions discoverable without
   pulling attention away from the flight path. Touch has dedicated controls. */
#runHints {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 7;
  display: flex; align-items: center; gap: 14px; padding: 6px 8px 6px 13px;
  border: 1px solid var(--hud-border); border-radius: 999px; background: var(--hud-bg);
  box-shadow: var(--hud-shadow); color: rgba(255,255,255,.76);
  font: 11px/1 'Consolas', monospace; letter-spacing: .5px; user-select: none;
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}
#runHints .legendLabel { color: #7fefff; font-weight: 800; letter-spacing: 1.5px; }
#runHints kbd {
  display: inline-block; padding: 3px 5px; border: 1px solid rgba(255,255,255,.25);
  border-radius: 5px; background: rgba(255,255,255,.08); color: #fff;
  font: 700 10px/1 'Consolas', monospace; box-shadow: inset 0 -1px rgba(0,0,0,.28);
}
#runHints button {
  min-height: 30px; padding: 6px 11px; border: 1px solid rgba(0,229,255,.55);
  border-radius: 999px; background: rgba(0,229,255,.08); color: #9af4ff;
  font: inherit; letter-spacing: inherit; cursor: pointer;
}
#runHints button:hover { background: rgba(0,229,255,.2); color: #fff; }
body.touch #runHints { display: none !important; }

/* ---------- Small-screen responsive sizing ---------- */
@media (max-width: 760px) {
  #radar { right: 12px; bottom: 12px; width: 120px; height: 120px; }
  #boostBtn { right: 40px; bottom: 154px; }
  #score .big { font-size: 18px; }
  #score #coinVal { font-size: 13px; }
  #fuel { width: 160px; }
  #banner { top: 80px; font-size: 14px; padding: 8px 13px; letter-spacing: .7px; border-radius: 12px; }
  #stats {
    flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 8px 10px; font-size: 12px;
  }
  #stats span + span { padding-left: 0; border-left: 0; }
  #ringArrow { font-size: 28px; }
  #stinger { font-size: 34px; letter-spacing: 3px; }
  #stinger.warn { font-size: 27px; }
  /* Objectives collapse to icon + count only — the short title is dropped. */
  #objectives .obj .ot { display: none; }
}
/* On touch the banner sits below the top controls and fuel bar. */
body.touch #banner { top: 132px; }

@media (max-width: 900px) {
  #runHints span { display: none; }
  #runHints { left: 16px; top: 16px; bottom: auto; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
  #flash, #msg, #banner, #stinger { transition-duration: .001ms !important; }
}

/* ---------- Contracts: in-run objectives (top-left) ---------- */
#objectives {
  position: fixed; top: 18px; left: 16px; z-index: 7;
  font-family: 'Consolas', monospace; color: #fff; pointer-events: none;
  user-select: none; text-shadow: 0 1px 4px rgba(0,0,0,.8);
}
#objectives .obj {
  display: flex; align-items: center; gap: 7px; font-size: 12px; line-height: 1.55;
  opacity: .92; transition: color .2s;
}
#objectives .obj .oi { color: #ffd166; display: inline-flex; align-items: center; line-height: 0; }
#objectives .obj .ot { letter-spacing: 1px; min-width: 58px; opacity: .85; }
#objectives .obj .op { color: #66f0c0; font-weight: 700; }
#objectives .obj.done { color: #7bd389; }
#objectives .obj.done .oi { color: #7bd389; }
#objectives .obj.done .op { color: #7bd389; }
#objectives .obj.tick { animation: objtick .8s ease-out; }
@keyframes objtick {
  0% { transform: scale(1); text-shadow: 0 0 0 rgba(123,211,137,0); }
  30% { transform: scale(1.14); text-shadow: 0 0 14px rgba(123,211,137,.9); }
  100% { transform: scale(1); }
}

/* ---------- Title-screen gig strip: up-to-3 one-line chips ---------- */
.gigStrip {
  display: flex; gap: 9px; flex-wrap: wrap; justify-content: center;
  max-width: 620px; margin: 6px 0 2px;
}
.gigStrip .csEmpty {
  font-size: 12px; opacity: .55; color: #cbb6ff; letter-spacing: .5px;
  font-family: 'Consolas', monospace;
}
.gigChip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.05);
}
.gigChip .gcI { color: #ffd166; display: inline-flex; align-items: center; line-height: 0; }
.gigChip .gcT {
  font-family: 'Segoe UI', system-ui, sans-serif; font-size: 12px; font-weight: 700;
  letter-spacing: 1px; color: #f2e9c9; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 170px;
}
.gigChip .gcP { font-family: 'Consolas', monospace; font-size: 12px; color: #66f0c0; font-weight: 700; }
.gigChip.done { border-color: rgba(123,211,137,.5); background: rgba(123,211,137,.1); }
.gigChip.done .gcI, .gigChip.done .gcP, .gigChip.done .gcT { color: #7bd389; }

/* ---------- Results: NEXT UP block (the next-desire hook) ---------- */
.rNext {
  margin: 10px 0 2px; width: 340px; max-width: 82vw; text-align: left;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid rgba(0,229,255,.28); background: rgba(0,229,255,.05);
}
.rNext .rnHead {
  font-family: 'Consolas', monospace; font-size: 12px; letter-spacing: 3px;
  color: #7fe9ff; opacity: .85; margin-bottom: 7px; text-align: center;
}
.rNext .rnRow { margin: 6px 0; }
.rNext .rnLine {
  display: flex; align-items: center; gap: 8px; font-family: 'Consolas', monospace;
  font-size: 12px; margin-bottom: 4px;
}
.rNext .rnIcon { display: inline-flex; align-items: center; line-height: 0; color: #ffcf3a; }
.rNext .rnLabel { color: #fff; letter-spacing: .5px; }
.rNext .rnGap { margin-left: auto; color: #ffcf3a; opacity: .9; display: inline-flex; align-items: center; gap: 3px; }
.rNext .rnReady { margin-left: auto; color: #7bd389; font-weight: 700; letter-spacing: 1px; }
.rNext .rnRow[data-role="rep"] .rnIcon,
.rNext .rnRow[data-role="rank"] .rnIcon { color: #cbb6ff; }
.rNext .rnRow[data-role="rep"] .rnLabel,
.rNext .rnRow[data-role="rank"] .rnLabel { color: #cbb6ff; }
.rNext .rnRow[data-role="rep"] .pbar i,
.rNext .rnRow[data-role="rank"] .pbar i { background: linear-gradient(90deg, #a06bff, #ff2ea6); }
.rNext .rnRow.ready .pbar i { background: linear-gradient(90deg, #33e0a0, #7bd389); }
.rNext .rnChip {
  margin-left: 8px; padding: 3px 12px; font-size: 11px; letter-spacing: 1px;
  font-family: 'Consolas', monospace; cursor: pointer; border-radius: 7px;
  color: #101018; background: #7bd389; border: 2px solid #7bd389; font-weight: 700;
  box-shadow: 0 0 12px rgba(123,211,137,.5); animation: readyPulse 1.4s ease-in-out infinite;
}
.rNext .rnChip:hover { background: #97e2a3; }

/* ---------- Results: GIGS section ---------- */
.rGigs {
  margin: 12px 0 2px; width: 340px; max-width: 82vw; text-align: center;
}
.rGigs .rcHead {
  font-family: 'Consolas', monospace; font-size: 12px; letter-spacing: 3px;
  opacity: .55; margin-bottom: 7px;
}
/* Compact gig rows: [✓ + type icon] TITLE  reward|progress. */
.rGigs .rgRow {
  display: flex; align-items: center; gap: 8px; text-align: left;
  padding: 6px 10px; margin: 5px 0; border-radius: 9px;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.04);
}
.rGigs .rgIcon { display: inline-flex; align-items: center; gap: 3px; color: #ffd166; line-height: 0; }
.rGigs .rgTitle {
  flex: 1; min-width: 0; font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 13px; font-weight: 700; letter-spacing: 1px; color: #f2e9c9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rGigs .rgRew { font-family: 'Consolas', monospace; font-size: 12px; color: #ffcf3a;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.rGigs .rgProg { font-family: 'Consolas', monospace; font-size: 12px; color: #66f0c0; font-weight: 700; }
.rGigs .rgRow.done { border-color: rgba(123,211,137,.5); background: rgba(123,211,137,.1); }
.rGigs .rgRow.done .rgIcon, .rGigs .rgRow.done .rgTitle { color: #7bd389; }
/* Completed gigs may keep ONE dim flavor line; open gigs never show flavor. */
.rGigs .rgFlavor {
  font-family: 'Segoe UI', system-ui, sans-serif; font-size: 11px; font-style: italic;
  opacity: .55; color: #dcd2ff; text-align: left; margin: -2px 0 6px 30px; line-height: 1.3;
}
.rGigs .rcNone { font-size: 12px; opacity: .55; margin: 3px 0; font-family: 'Consolas', monospace; }
.rGigs .rcStars {
  font-size: 15px; color: #ffd166; margin: 9px 0 2px; letter-spacing: 1px;
  font-family: 'Consolas', monospace; display: inline-flex; align-items: center; gap: 5px;
  justify-content: center;
}

@keyframes readyPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(123,211,137,.35); }
  50%      { box-shadow: 0 0 18px rgba(123,211,137,.7); }
}

/* Flavor line is a nicety — drop it on small screens so gig cards stay compact. */
@media (max-width: 560px) { .rGigs .rgFlavor { display: none; } }

/* ---------- Contracts: mid-run toasts (distinct from #msg) ---------- */
#ctToast, #ctUnlock {
  position: fixed; left: 50%; transform: translateX(-50%);
  z-index: 8; pointer-events: none; text-align: center; opacity: 0;
  transition: opacity .3s; font-family: 'Segoe UI', system-ui, sans-serif;
  padding: 10px 20px; border-radius: 12px; box-sizing: border-box; max-width: 92vw;
}
#ctToast { top: 38%; background: rgba(10,26,16,.82); border: 2px solid #7bd389;
  box-shadow: 0 0 18px rgba(123,211,137,.4); }
#ctToast b { display: block; font-size: 13px; letter-spacing: 3px; color: #7bd389; }
#ctToast .ctd { display: block; font-size: 17px; font-weight: 700; margin-top: 4px; color: #fff;
  letter-spacing: 1px; }
#ctToast .ctsub { display: block; font-size: 12px; margin-top: 2px; color: #cfe8d4; opacity: .85;
  font-family: 'Consolas', monospace; }
#ctToast .ctr { display: block; font-size: 13px; margin-top: 3px; color: #ffcf3a;
  font-family: 'Consolas', monospace; }
#ctToast.on, #ctUnlock.on { opacity: 1; transition: opacity .08s; }
#ctUnlock { top: 30%; background: rgba(34,18,4,.85); border: 2px solid #ffa62e;
  box-shadow: 0 0 26px rgba(255,166,46,.55); }
#ctUnlock b { display: inline-block; font-size: 13px; letter-spacing: 3px; color: #ffa62e; }
#ctUnlock .cul { display: block; font-size: 22px; font-weight: 700; letter-spacing: 2px;
  color: #ffd27a; margin-top: 4px; text-shadow: 0 0 14px rgba(255,166,46,.7); }
#ctUnlock.on { animation: ulpulse 1s ease-in-out infinite; }
@keyframes ulpulse {
  0%,100% { box-shadow: 0 0 22px rgba(255,166,46,.4); }
  50% { box-shadow: 0 0 34px rgba(255,166,46,.75); }
}

/* Objectives shift down on touch (keyboard hints row is hidden). */
body.touch #objectives { top: 44px; }
/* Hide the in-run objectives on very small portrait screens (space demands). */
@media (max-width: 560px) and (orientation: portrait) {
  #objectives { display: none; }
}
@media (max-width: 760px) {
  #ctUnlock .cul { font-size: 18px; }
  #ctToast .ctd { font-size: 13px; }
}
