/* ============================================================
   VOID RUNNER — visual system
   ============================================================ */
:root {
  --bg: #04050a;
  --panel: rgba(9, 13, 23, 0.82);
  --line: rgba(120, 200, 255, 0.22);
  --line-hi: rgba(140, 230, 255, 0.55);
  --cyan: #55f6ff;
  --cyan-dim: #2ba8bd;
  --magenta: #ff4d8d;
  --gold: #ffd166;
  --red: #ff4757;
  --text: #cfe6f5;
  --dim: #5b7a8f;
  --font-ui: "Rajdhani", "Chakra Petch", "Bahnschrift", "DIN Alternate", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--font-ui);
  color: var(--text);
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: none;
}

#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

body.playing #app { cursor: none; }
body.playing #hud button, body.touch #app { cursor: default; }

.hidden { display: none !important; }

/* One-time supporter profile frames: presentation only, no gameplay effect. */
body.supporter-pro #pilot-line { box-shadow: inset 0 0 0 1px rgba(125, 243, 255, 0.28); }
body.supporter-founder #pilot-line { box-shadow: inset 0 0 0 1px rgba(255, 159, 67, 0.5), 0 0 14px rgba(255, 138, 91, 0.12); }

button {
  font-family: inherit;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
}
button:focus-visible { outline: 1px solid var(--cyan); outline-offset: 3px; }

/* ============================================================
   HUD
   ============================================================ */
#hud {
  position: absolute; inset: 0;
  pointer-events: none;
  font-size: 14px;
  z-index: 5;
}

#hud-tl {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  left: calc(18px + env(safe-area-inset-left));
  width: min(240px, 38vw);
  display: flex; flex-direction: column; gap: 7px;
}
.vital-label {
  display: flex; justify-content: space-between;
  font-size: 12px; letter-spacing: 0.28em; color: var(--dim);
  margin-bottom: 3px; font-weight: 600;
}
.vital-label span:last-child { font-family: var(--font-mono); letter-spacing: 0; color: var(--text); }
.bar {
  position: relative;
  height: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  overflow: hidden;
}
.bar > div {
  position: absolute; inset: 0;
  transform-origin: left center;
  transform: scaleX(1);
}
.hp-bar { height: 12px; }
.hp-bar > div { background: linear-gradient(90deg, #ff5a76, #ff8465); }
.hp-bar #hp-ghost { background: rgba(255, 200, 180, 0.45); transition: transform 0.7s cubic-bezier(.2,.7,.3,1) 0.25s; }
.shield-bar { height: 7px; }
.shield-bar > div { background: linear-gradient(90deg, #2fd4e8, #8df3ff); }

#hud-tc {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%; transform: translateX(-50%);
  text-align: center;
}
#timer {
  font-family: var(--font-mono);
  font-size: clamp(22px, 3.4vw, 30px);
  letter-spacing: 0.14em;
  color: #eaf7ff;
  text-shadow: 0 0 18px rgba(85, 246, 255, 0.35);
  font-variant-numeric: tabular-nums;
}
#level-chip {
  display: inline-block;
  margin-top: 2px;
  font-size: 12px; letter-spacing: 0.4em; font-weight: 700;
  color: var(--cyan);
  border: 1px solid rgba(85, 246, 255, 0.3);
  padding: 2px 10px 2px 13px;
  background: rgba(85, 246, 255, 0.06);
}
#curse-chip {
  display: inline-block;
  margin-top: 3px;
  font-size: 12px; letter-spacing: 0.32em; font-weight: 700;
  color: #ff8a9b;
  border: 1px solid rgba(255, 59, 85, 0.45);
  padding: 1px 8px 1px 11px;
  background: rgba(255, 59, 85, 0.1);
  animation: cursePulse 1.4s ease-in-out infinite;
}
#curse-chip.hidden { display: none; }
@keyframes cursePulse { 0%, 100% { opacity: 0.65; } 50% { opacity: 1; } }
/* V3: run-condition mutator chips (HUD, top-center under level chip) */
#mutbar {
  margin-top: 4px;
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
#mutbar:empty { display: none; }
.mutchip {
  font-size: 12px;
  letter-spacing: 0.18em;
  font-weight: 700;
  border: 1px solid rgba(125, 243, 255, 0.35);
  padding: 1px 7px 1px 9px;
  background: rgba(8, 14, 26, 0.55);
  white-space: nowrap;
}
/* V3: objective tracker chip (HUD, under mutator chips) */
#objbar { margin-top: 5px; display: flex; justify-content: center; }
#objbar:empty { display: none; }
.objchip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid rgba(255, 209, 102, 0.4);
  background: rgba(8, 14, 26, 0.6);
  padding: 2px 9px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.16em;
}
.obj-goal { color: #dff4ff; }
.obj-bar {
  width: 64px; height: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.obj-bar i { display: block; height: 100%; }
#bossbar {
  margin-top: 10px;
  width: min(480px, 62vw);
}
#boss-name {
  font-size: 12px; letter-spacing: 0.42em; font-weight: 700;
  color: #ffb3c8;
  text-align: center;
  margin-bottom: 4px;
  text-shadow: 0 0 12px rgba(255, 77, 141, 0.6);
}
.boss-hp { height: 8px; border-color: rgba(255, 100, 150, 0.35); }
.boss-hp > div { background: linear-gradient(90deg, #ff4d8d, #ff8a5c); box-shadow: 0 0 14px rgba(255, 77, 141, 0.55); }

#hud-tr {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: calc(18px + env(safe-area-inset-right));
  display: flex; align-items: center; gap: 14px;
  pointer-events: none;
}
#kill-wrap {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 19px; color: #dff4ff;
}
.kicon { width: 17px; height: 17px; color: var(--cyan-dim); filter: drop-shadow(0 0 6px rgba(85,246,255,.5)); }
#combo {
  font-family: var(--font-mono); font-weight: 700;
  font-size: 15px; color: var(--magenta);
  text-shadow: 0 0 10px rgba(255, 77, 141, 0.7);
}
#combo.pop { animation: comboPop 0.25s ease-out; }
@keyframes comboPop { 0% { transform: scale(1.7); } 100% { transform: scale(1); } }

#dash-wrap {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid; place-items: center;
}
#dash-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(85, 246, 255, 0.35);
  background: conic-gradient(rgba(85, 246, 255, 0.75) 0deg, rgba(85, 246, 255, 0.06) 0deg);
}
#dash-ring.ready { box-shadow: 0 0 14px rgba(85, 246, 255, 0.45); border-color: rgba(160, 250, 255, 0.9); }
#dash-key {
  position: relative;
  font-size: 12px; letter-spacing: 0.14em; font-weight: 700;
  color: #bfeefc; z-index: 1;
}
#btn-pause {
  pointer-events: auto;
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  background: rgba(10, 16, 26, 0.5);
  display: grid; place-items: center;
  gap: 0; grid-template-columns: 1fr 1fr;
  transition: border-color 0.15s, background 0.15s;
}
#btn-pause span {
  display: block;
  width: 3.5px; height: 13px;
  background: var(--text);
  margin: 0 3px;
}
#btn-pause:hover { border-color: var(--line-hi); background: rgba(30, 48, 66, 0.6); }

#minimap {
  position: absolute;
  bottom: calc(56px + env(safe-area-inset-bottom));
  right: calc(14px + env(safe-area-inset-right));
  width: 168px; height: 168px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
  box-shadow: 0 0 18px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(120,200,255,0.18);
  border-radius: 12px;
}
body.playing #minimap { opacity: 0.96; }
@media (max-width: 760px) {
  #minimap { width: 104px; height: 104px; }
}

#hud-bottom {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(680px, 86vw);
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
}
#ability-row {
  display: flex; justify-content: center; gap: 8px;
  min-height: 40px;
}
.abil {
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  background: rgba(10, 16, 26, 0.62);
  position: relative;
  display: grid; place-items: center;
  animation: abilIn 0.35s cubic-bezier(.2, 1.4, .4, 1);
}
.abil.evo { border-color: rgba(255, 209, 102, 0.65); box-shadow: 0 0 12px rgba(255, 209, 102, 0.25); }
.abil .lv {
  position: absolute; right: -1px; bottom: -1px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  background: rgba(85, 246, 255, 0.9); color: #04121a;
  padding: 0 4px; line-height: 13px;
}
.abil.evo .lv { background: var(--gold); }
@keyframes abilIn { from { transform: scale(0.3); opacity: 0; } }

#xp-wrap { width: 100%; }
.xp-labels {
  display: flex; justify-content: space-between;
  font-size: 12px; letter-spacing: 0.3em; color: var(--dim);
  margin-bottom: 3px; font-weight: 600;
}
.xp-labels span:last-child { font-family: var(--font-mono); letter-spacing: 0.05em; }
.xp-bar { height: 8px; }
.xp-bar > div {
  background: linear-gradient(90deg, #1ec8e0, #7df0ff);
  box-shadow: 0 0 12px rgba(85, 246, 255, 0.4);
}
.xp-bar > div::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.5) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: sheen 2.6s linear infinite;
  mix-blend-mode: overlay;
}
@keyframes sheen { from { background-position: 130% 0; } to { background-position: -70% 0; } }

/* overlays inside hud */
#vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 140px 60px rgba(255, 30, 60, 0.55);
  opacity: 0;
  transition: opacity 0.3s;
}
#vignette.pulse { animation: vpulse 1s ease-in-out infinite; }
@keyframes vpulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.95; } }

#hurt-flash {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255, 40, 70, 0) 40%, rgba(255, 40, 70, 0.4) 100%);
  opacity: 0;
}
#hurt-flash.on { transition: none; opacity: 1; }
#hurt-flash.off { transition: opacity 0.45s ease-out; opacity: 0; }

#fps-counter {
  position: absolute; left: 10px; top: 10px;
  font: 700 12px ui-monospace, monospace; color: #7df3ff;
  text-shadow: 0 0 8px rgba(125, 243, 255, 0.6);
  pointer-events: none; z-index: 30;
}

/* center announcements */
#announce {
  position: absolute;
  top: 22%; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  pointer-events: none;
  width: 100%;
}
.ann {
  font-weight: 700;
  text-align: center;
  animation: annIn 0.4s cubic-bezier(.2, 1.3, .4, 1);
  white-space: nowrap;
}
.ann.out { transition: opacity 0.5s, transform 0.5s; opacity: 0; transform: translateY(-14px); }
.ann.info {
  font-size: 20px; letter-spacing: 0.5em;
  color: #bff3ff;
  text-shadow: 0 0 22px rgba(85, 246, 255, 0.6);
}
.ann.sub { font-size: 12px; letter-spacing: 0.4em; color: var(--dim); font-weight: 400; }
.ann.warn {
  font-size: clamp(26px, 5vw, 44px);
  letter-spacing: 0.55em;
  color: #ff4d6b;
  text-shadow: 0 0 30px rgba(255, 60, 90, 0.8);
  animation: annIn 0.4s cubic-bezier(.2, 1.3, .4, 1), warnShake 0.09s linear infinite alternate;
}
@keyframes annIn { from { opacity: 0; transform: scale(1.25); letter-spacing: 0.9em; } }
@keyframes warnShake { from { transform: translateX(-1.5px); } to { transform: translateX(1.5px); } }

/* ============================================================
   TOUCH CONTROLS
   ============================================================ */
#touch-ui { position: absolute; inset: 0; pointer-events: none; }
#joy-base {
  position: absolute;
  width: 124px; height: 124px;
  border-radius: 50%;
  border: 1px solid rgba(85, 246, 255, 0.35);
  background: rgba(85, 246, 255, 0.05);
  display: none;
  transform: translate(-50%, -50%);
}
#joy-stick {
  position: absolute; left: 50%; top: 50%;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(190, 250, 255, 0.95), rgba(43, 168, 189, 0.75));
  box-shadow: 0 0 18px rgba(85, 246, 255, 0.55);
  transform: translate(-50%, -50%);
}
#dash-btn {
  position: absolute;
  right: calc(26px + env(safe-area-inset-right));
  bottom: calc(96px + env(safe-area-inset-bottom));
  width: 88px; height: 88px;
  border-radius: 50%;
  border: 1px solid rgba(255, 209, 102, 0.5);
  background: rgba(255, 209, 102, 0.08);
  color: var(--gold);
  font-size: 13px; font-weight: 700; letter-spacing: 0.2em;
  display: grid; place-items: center;
  pointer-events: auto;
  opacity: 0.85;
}
#dash-btn.ready { box-shadow: 0 0 22px rgba(255, 209, 102, 0.35), inset 0 0 18px rgba(255, 209, 102, 0.12); }
#dash-btn.cool { opacity: 0.35; }
body.touch #joy-base.live { display: block; }
body.touch #dash-key { display: none; }

/* ============================================================
   SCREENS
   ============================================================ */
.screen {
  position: fixed; inset: 0;
  z-index: 20;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.35s ease-out;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
@keyframes fadeIn { from { opacity: 0; } }

.scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.025) 0px,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
  animation: flicker 6s infinite;
}
@keyframes flicker {
  0%, 100% { opacity: 0.6; } 48% { opacity: 0.5; } 50% { opacity: 0.75; } 52% { opacity: 0.5; }
}

/* ---------- main menu ---------- */
#menu {
  background: linear-gradient(180deg, rgba(3, 5, 10, 0.25) 0%, rgba(3, 5, 10, 0.05) 40%, rgba(3, 5, 10, 0.78) 100%);
  flex-direction: column;
}
.menu-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 42px;
  padding: 24px;
}
.title-block { text-align: center; animation: riseIn 0.8s cubic-bezier(.2, .9, .3, 1); }
@keyframes riseIn { from { opacity: 0; transform: translateY(26px); } }
.pretitle {
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.3em;
  color: var(--dim);
  margin-bottom: 14px;
}
.game-title {
  position: relative;
  font-size: clamp(54px, 11vw, 118px);
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 0.95;
  font-style: italic;
  color: transparent;
  background: linear-gradient(180deg, #ffffff 20%, #9beeff 55%, #29b8cf 90%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 28px rgba(85, 246, 255, 0.35));
}
.game-title::before, .game-title::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
}
.game-title::before {
  animation: glitchA 5s infinite steps(1);
  text-shadow: -3px 0 rgba(255, 77, 141, 0.8);
}
.game-title::after {
  animation: glitchB 5s infinite steps(1);
  text-shadow: 3px 0 rgba(85, 246, 255, 0.9);
}
@keyframes glitchA {
  0%, 91%, 94.5%, 100% { opacity: 0; transform: translate(0); clip-path: inset(0 0 0 0); }
  92% { opacity: 0.9; transform: translate(-5px, 2px); clip-path: inset(12% 0 58% 0); }
  93.5% { opacity: 0.9; transform: translate(4px, -1px); clip-path: inset(62% 0 8% 0); }
}
@keyframes glitchB {
  0%, 91%, 94.5%, 100% { opacity: 0; transform: translate(0); clip-path: inset(0 0 0 0); }
  92.5% { opacity: 0.9; transform: translate(5px, -2px); clip-path: inset(40% 0 30% 0); }
  93.8% { opacity: 0.9; transform: translate(-4px, 1px); clip-path: inset(4% 0 80% 0); }
}
.subtitle {
  margin-top: 16px;
  font-size: clamp(12px, 2vw, 15px);
  font-weight: 600;
  letter-spacing: 0.62em;
  text-indent: 0.62em;
  color: #ffb3c8;
  display: flex; align-items: center; justify-content: center; gap: 18px;
}
.subtitle::before, .subtitle::after {
  content: "";
  width: 54px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 77, 141, 0.7));
}
.subtitle::after { transform: scaleX(-1); }

.menu-buttons {
  display: flex; flex-direction: column; gap: 12px;
  width: min(320px, 80vw);
  animation: riseIn 0.8s cubic-bezier(.2, .9, .3, 1) 0.12s backwards;
}
.mbtn {
  position: relative;
  padding: 14px 20px;
  border: 1px solid var(--line);
  background: rgba(10, 18, 30, 0.6);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  text-transform: uppercase;
  transition: all 0.18s ease;
  backdrop-filter: blur(4px);
}
.mbtn::before, .mbtn::after {
  content: "";
  position: absolute;
  width: 9px; height: 9px;
  border-color: var(--cyan-dim);
  border-style: solid;
  transition: all 0.18s ease;
}
.mbtn::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.mbtn::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
.mbtn:hover, .mbtn:focus-visible {
  border-color: var(--line-hi);
  background: rgba(28, 52, 74, 0.65);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(85, 246, 255, 0.12);
}
.mbtn:hover::before, .mbtn:hover::after { border-color: var(--cyan); width: 14px; height: 14px; }
.mbtn.primary {
  background: linear-gradient(180deg, rgba(85, 246, 255, 0.16), rgba(85, 246, 255, 0.07));
  border-color: rgba(85, 246, 255, 0.55);
  color: #d9fbff;
  font-weight: 700;
  box-shadow: 0 0 24px rgba(85, 246, 255, 0.14), inset 0 0 22px rgba(85, 246, 255, 0.06);
}
.mbtn.primary:hover {
  background: linear-gradient(180deg, rgba(85, 246, 255, 0.3), rgba(85, 246, 255, 0.12));
  box-shadow: 0 0 34px rgba(85, 246, 255, 0.3);
}
.mbtn.danger { border-color: rgba(255, 71, 87, 0.4); color: #ffc4cb; }
.mbtn.danger:hover { border-color: rgba(255, 71, 87, 0.8); background: rgba(70, 16, 24, 0.6); box-shadow: 0 6px 24px rgba(255, 71, 87, 0.15); }
.mbtn.small { padding: 9px 20px; font-size: 12px; }
.mbtn.back { align-self: flex-start; margin-top: 26px; }
.menu-footer {
  display: flex; gap: 14px; align-items: center;
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.12em;
  color: var(--dim);
  animation: riseIn 0.8s cubic-bezier(.2, .9, .3, 1) 0.2s backwards;
}
.menu-footer .sep { opacity: 0.4; }
#best-line { color: var(--gold); text-shadow: 0 0 12px rgba(255, 209, 102, 0.4); }

/* ---------- generic panel screens ---------- */
#howto, #statsscr, #pause, #board, #friends {
  background: rgba(3, 5, 10, 0.62);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
}
.panel {
  position: relative;
  width: min(600px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: clamp(22px, 4vw, 38px);
  background: var(--panel);
  border: 1px solid var(--line);
  animation: riseIn 0.4s cubic-bezier(.2, .9, .3, 1);
  scrollbar-width: none;
}
.panel::-webkit-scrollbar { display: none; }
.panel.slim { width: min(420px, 92vw); overflow: hidden; max-height: none; }
#pause { overflow: hidden; }
.panel::before, .panel::after {
  content: "";
  position: absolute; width: 18px; height: 18px;
  border: 2px solid var(--cyan);
  opacity: 0.7;
}
.panel::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.panel::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
.panel h2 {
  font-size: clamp(20px, 4vw, 27px);
  letter-spacing: 0.4em;
  font-weight: 700;
  color: #eafaff;
  margin-bottom: 22px;
  text-shadow: 0 0 18px rgba(85, 246, 255, 0.3);
}

.howto-grid { display: flex; flex-direction: column; gap: 15px; margin-bottom: 20px; }
.ctrl-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ctrl-row p { flex: 1 1 200px; font-size: 13px; color: #9db8c9; line-height: 1.45; }
.keycap {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  color: #d9f6ff;
  border: 1px solid rgba(140, 220, 255, 0.35);
  background: rgba(85, 246, 255, 0.07);
  padding: 4px 9px;
  box-shadow: inset 0 -2px 0 rgba(85, 246, 255, 0.15);
  white-space: nowrap;
}
.keycap.none { border-style: dashed; color: var(--cyan); }
.or { color: var(--dim); font-size: 12px; }
.tips { list-style: none; display: flex; flex-direction: column; gap: 9px; border-top: 1px solid var(--line); padding-top: 18px; }
.tips li {
  font-size: 13px; color: #9db8c9; line-height: 1.5;
  padding-left: 18px; position: relative;
}
.tips li::before { content: "◆"; position: absolute; left: 0; color: var(--cyan); font-size: 12px; top: 4px; }
.tips b { color: #ffdca8; font-weight: 600; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-cell {
  border: 1px solid rgba(120, 200, 255, 0.12);
  background: rgba(85, 246, 255, 0.03);
  padding: 13px 15px;
}
.stat-cell .s-label { font-size: 12px; letter-spacing: 0.26em; color: var(--dim); font-weight: 600; margin-bottom: 6px; }
.stat-cell .s-value { font-family: var(--font-mono); font-size: 21px; color: #e8fbff; }
.stat-cell.gold .s-value { color: var(--gold); text-shadow: 0 0 14px rgba(255, 209, 102, 0.4); }
.stats-actions { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stats-actions .mbtn.back { margin-top: 0; }
.col-buttons { display: flex; flex-direction: column; gap: 10px; }

.run-mini {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #9dc4d8;
  line-height: 2;
  letter-spacing: 0.06em;
  margin-bottom: 22px;
  border-left: 2px solid rgba(85, 246, 255, 0.4);
  padding-left: 14px;
}
.run-mini b { color: #eafaff; font-weight: 700; }

/* ---------- level up ---------- */
#levelup {
  background: rgba(2, 4, 8, 0.55);
  backdrop-filter: blur(14px) brightness(0.6) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) brightness(0.6) saturate(1.2);
  flex-direction: column;
  gap: 26px;
  padding: 20px;
}
.lu-head { text-align: center; animation: riseIn 0.4s ease-out; }
.lu-kicker { font-size: 12px; letter-spacing: 0.5em; color: var(--cyan); font-weight: 600; margin-bottom: 8px; }
.lu-level {
  font-size: clamp(30px, 6vw, 44px);
  font-weight: 800; font-style: italic;
  letter-spacing: 0.12em;
  color: #f2fcff;
  text-shadow: 0 0 30px rgba(85, 246, 255, 0.45);
}
.lu-level span { color: var(--cyan); }
.lu-hint {
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.24em;
  color: var(--dim);
  animation: riseIn 0.4s ease-out 0.5s backwards;
}
#cards {
  display: flex; gap: clamp(10px, 2vw, 22px);
  align-items: stretch;
  perspective: 900px;
}
.card {
  position: relative;
  width: min(232px, 28vw);
  min-width: 148px;
  padding: 20px 16px 16px;
  background: linear-gradient(180deg, rgba(16, 24, 40, 0.92), rgba(9, 13, 24, 0.94));
  border: 1px solid var(--card-line, rgba(120, 200, 255, 0.25));
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center;
  transition: transform 0.18s cubic-bezier(.2, .9, .3, 1.4), box-shadow 0.18s, border-color 0.18s;
  animation: cardIn 0.45s cubic-bezier(.2, 1.2, .3, 1) backwards;
  box-shadow: 0 0 0 rgba(85, 246, 255, 0);
}
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.15s; }
.card:nth-child(3) { animation-delay: 0.25s; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(46px) rotateX(24deg) scale(0.92); }
}
.card:hover, .card:focus-visible {
  transform: translateY(-10px) scale(1.04);
  border-color: var(--card-line-hi, rgba(140, 230, 255, 0.7));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), 0 0 34px var(--card-glow, rgba(85, 246, 255, 0.18));
}
.card .rarity {
  font-size: 12px; font-weight: 700; letter-spacing: 0.34em;
  color: var(--rar-col, #7fa8bf);
  padding: 2px 8px;
  border: 1px solid currentColor;
  opacity: 0.9;
}
.card .keyhint {
  position: absolute; top: 10px; right: 10px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(140, 220, 255, 0.4);
  border-radius: 4px;
  background: rgba(8, 14, 24, 0.65);
  font-size: 12px; letter-spacing: 0;
  color: #9fd8ff;
}
.card canvas { width: 76px; height: 76px; }
.card .c-name {
  font-size: 17px; font-weight: 700;
  letter-spacing: 0.14em;
  color: #f0fcff;
}
.card .c-desc {
  font-size: 12px; line-height: 1.5;
  color: #93aec0;
  min-height: 54px;
}
.card .pips { display: flex; gap: 5px; margin-top: auto; }
.card .pip { width: 7px; height: 7px; transform: rotate(45deg); border: 1px solid rgba(140, 220, 255, 0.35); }
.card .pip.on { background: var(--rar-col, var(--cyan)); border-color: transparent; box-shadow: 0 0 8px var(--rar-col, var(--cyan)); }
.card.r1 { --rar-col: #7de3ff; --card-line: rgba(125, 227, 255, 0.4); --card-line-hi: rgba(125, 227, 255, 0.85); --card-glow: rgba(125, 227, 255, 0.22); }
.card.r2 { --rar-col: #c792ff; --card-line: rgba(199, 146, 255, 0.45); --card-line-hi: rgba(199, 146, 255, 0.9); --card-glow: rgba(199, 146, 255, 0.25); }
.card.r3 { --rar-col: var(--gold); --card-line: rgba(255, 209, 102, 0.5); --card-line-hi: rgba(255, 209, 102, 0.95); --card-glow: rgba(255, 209, 102, 0.3); }

/* ---------- evolution banner ---------- */
#evolve-banner {
  position: fixed; inset: 0;
  z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255, 209, 102, 0.14), transparent 60%);
  animation: evBg 2.6s ease-out forwards;
}
.ev-kicker { font-size: 12px; letter-spacing: 0.6em; color: var(--gold); font-weight: 600; animation: riseIn 0.4s ease-out 0.1s backwards; }
.ev-name {
  font-size: clamp(44px, 9vw, 84px);
  font-weight: 800; font-style: italic;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, #fff8e8, #ffd166 60%, #ff9d4d);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 34px rgba(255, 209, 102, 0.55));
  animation: evName 0.7s cubic-bezier(.2, 1.4, .3, 1) backwards;
}
@keyframes evName { from { transform: scale(2.2); opacity: 0; filter: blur(8px); } }
.ev-desc { font-size: 14px; letter-spacing: 0.2em; color: #ffe9bd; animation: riseIn 0.4s ease-out 0.3s backwards; }
@keyframes evBg { 0% { opacity: 0; } 12% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- game over ---------- */
#gameover {
  flex-direction: column;
  justify-content: flex-start;
  background: radial-gradient(ellipse at center, rgba(30, 4, 12, 0.55), rgba(2, 3, 7, 0.88) 75%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.go-inner {
  flex-shrink: 0; width: min(760px, 100%); margin-block: auto;
  display: flex; flex-direction: column; align-items: center;
  gap: 12px;
  padding: 24px;
  animation: riseIn 0.7s cubic-bezier(.2, .9, .3, 1);
}
.go-title {
  font-size: clamp(42px, 8vw, 76px);
  font-weight: 800; font-style: italic;
  letter-spacing: 0.14em;
  background: linear-gradient(180deg, #ffdfe5, #ff4757 70%, #b31f3a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(255, 71, 87, 0.4));
}
.go-score { font: 600 14px/1.5 var(--font-mono); color: #ffeef1; letter-spacing: .1em; }
.go-score:empty { display: none; }
.go-sub { font-size: 12px; letter-spacing: 0.5em; color: var(--dim); margin-top: -10px; }
#new-best {
  font-size: 15px; font-weight: 700;
  letter-spacing: 0.4em; color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 209, 102, 0.7);
  animation: bestPulse 1.1s ease-in-out infinite;
}
@keyframes bestPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  width: min(560px, 90vw);
}
.res-cell {
  border: 1px solid rgba(255, 120, 140, 0.14);
  background: rgba(255, 80, 110, 0.04);
  padding: 12px 14px;
  text-align: center;
}
.res-cell .r-label { font-size: 12px; letter-spacing: 0.28em; color: var(--dim); font-weight: 600; margin-bottom: 5px; }
.res-cell .r-value { font-family: var(--font-mono); font-size: 20px; color: #ffeef1; }
.res-cell.gold .r-value { color: var(--gold); text-shadow: 0 0 12px rgba(255, 209, 102, 0.4); }
#gameover .run-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 8px; margin: 4px 0; }
#gameover .run-actions .mbtn { min-width: 0; min-height: 44px; padding: 10px 8px; font-size: 12px; letter-spacing: .12em; }
#gameover #g-again { grid-column: 1 / -1; order: -2; font-size: 14px; }
#gameover #g-revive { order: -1; }
.run-details { width: 100%; border-block: 1px solid var(--line); padding: 12px 0; }
.run-details summary { cursor: pointer; font: 600 12px var(--font-mono); letter-spacing: .14em; color: #9db8c9; min-height: 24px; }
.run-details .results { width: 100%; margin-top: 12px; }
#gameover .go-title { font-size: clamp(34px, 7vw, 64px); }
#gameover #post-run-progression { margin: 0; width: 100%; }
#gameover .save-runner { margin: 0; width: 100%; }

/* ---------- fade layer ---------- */
#fade {
  position: fixed; inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 60;
}
#fade.show { opacity: 1; pointer-events: all; }

#loadout .panel { animation: none; }
#loadout .card { animation: none; }
#ld-diff-line {
  font-size: 12px; letter-spacing: 0.18em; color: #ff8a3d;
  cursor: pointer; margin-bottom: 12px; text-align: center;
}
#ld-diff-line:hover { text-decoration: underline; }
#loadout .card canvas.ship-mini { width: 128px; height: 88px; display: block; margin: 0 auto 6px; }
/* skill cooldown overlay on chips */
.abil .cd {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  display: grid; place-items: center;
  font: 700 12px ui-monospace, monospace; color: #ffd166;
  pointer-events: none;
}
.abil .cd.hidden { display: none; }

/* settings rows */
.set-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px; border-bottom: 1px solid rgba(125,200,255,0.08);
  font-size: 12px; letter-spacing: 0.12em; color: #c8dcea;
}
.set-row input[type="range"] { width: 180px; accent-color: #59e6ff; }
.set-row input[type="checkbox"] { accent-color: #59e6ff; width: 16px; height: 16px; cursor: pointer; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 760px) {
  #hud-tl { width: min(190px, 40vw); }
  .card { padding: 14px 10px 12px; gap: 8px; }
  .card canvas { width: 58px; height: 58px; }
  .card .c-name { font-size: 14px; }
  .card .c-desc { font-size: 12px; min-height: 48px; }
  #cards { flex-wrap: wrap; justify-content: center; }
  .card { min-width: 138px; }
  #timer { font-size: 20px; }
  #kill-wrap { font-size: 16px; }
  .menu-footer { flex-direction: column; gap: 6px; }
  .menu-footer .sep { display: none; }
}
@media (max-height: 480px) {
  .lu-head { display: none; }
  .lu-hint { display: none; }
  .card { min-width: 120px; width: 26vw; }
}
/* ---------- landscape mobile (yatay) ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  #hud-tl { top: calc(6px + env(safe-area-inset-top)); width: min(170px, 32vw); gap: 5px; }
  .bar { height: 6px; } .hp-bar { height: 9px; }
  .vital-label { font-size: 12px; margin-bottom: 2px; }
  #hud-tc { top: calc(4px + env(safe-area-inset-top)); }
  #timer { font-size: 17px; letter-spacing: 0.1em; }
  #level-chip { font-size: 12px; padding: 1px 6px 1px 8px; margin-top: 1px; }
  #bossbar { width: min(380px, 48vw); margin-top: 4px; }
  #boss-name { font-size: 12px; margin-bottom: 2px; }
  #hud-tr { top: calc(6px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); gap: 9px; }
  #kill-wrap { font-size: 14px; gap: 6px; }
  .kicon { width: 14px; height: 14px; }
  #combo { font-size: 12px; }
  #dash-wrap { width: 30px; height: 30px; }
  #dash-key { font-size: 12px; }
  #btn-pause { width: 30px; height: 30px; }
  #btn-pause span { width: 3px; height: 10px; margin: 0 2px; }
  #minimap { width: 112px; height: 112px; bottom: calc(38px + env(safe-area-inset-bottom)); right: calc(8px + env(safe-area-inset-right)); }
  #hud-bottom { bottom: calc(4px + env(safe-area-inset-bottom)); width: min(520px, 62vw); gap: 4px; }
  #ability-row { gap: 6px; min-height: 30px; }
  .abil { width: 30px; height: 30px; }
  .xp-bar { height: 6px; }
  .xp-labels { font-size: 12px; margin-bottom: 2px; }
  #announce { top: 16%; }
  .ann.info { font-size: 15px; } .ann.warn { font-size: clamp(20px, 4vw, 32px); }
  /* touch */
  #joy-base { width: 98px; height: 98px; }
  #joy-stick { width: 42px; height: 42px; }
  #dash-btn { width: 68px; height: 68px; right: calc(10px + env(safe-area-inset-right)); bottom: calc(42px + env(safe-area-inset-bottom)); font-size: 12px; }
  /* overlays */
  #levelup { padding: 8px; gap: 12px; }
  #levelup .card { min-width: 132px; width: 27vw; padding: 12px 8px 10px; }
  #levelup .card canvas { width: 48px; height: 48px; }
  #levelup .card .c-name { font-size: 12px; }
  #levelup .card .c-desc { font-size: 12px; min-height: 34px; }
  .panel { padding: 16px; }
  .panel.slim { width: min(360px, 88vw); }
  .go-title { font-size: clamp(32px, 6vw, 52px); }
  .results { gap: 6px; }
  .res-cell { padding: 8px 10px; }
  .res-cell .r-value { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01s !important; animation-iteration-count: 1 !important; }
}

/* ============================================================
   CINEMATIC INTRO
   ============================================================ */
#intro {
  position: fixed; inset: 0;
  background: #000;
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  cursor: default;
}
#intro.hidden { display: none; }
.intro-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.85) 100%);
}
#intro::after {
  /* faint scanlines */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 3px);
}
.intro-line {
  position: relative;
  max-width: min(760px, 84vw);
  text-align: center;
  color: #cfe2f2;
  font: 600 clamp(16px, 2.6vw, 26px)/1.5 var(--font-body, "Segoe UI", system-ui, sans-serif);
  letter-spacing: 0.06em;
  opacity: 0;
  transition: opacity 0.45s ease, transform 0.45s ease, filter 0.45s;
  transform: translateY(8px);
  text-shadow: 0 0 22px rgba(125, 227, 255, 0.25);
  padding: 0 20px;
}
.intro-line.show { opacity: 1; transform: none; }
.intro-line.big {
  font: 800 clamp(24px, 4.4vw, 44px)/1.25 var(--mono);
  letter-spacing: 0.18em;
  color: #eef7ff;
  animation: introGlitch 2.2s steps(1) infinite;
}
.intro-line.accent { color: var(--accent, #7df3ff); text-shadow: 0 0 30px rgba(125, 227, 255, 0.55); }
.intro-line.out { opacity: 0; transform: translateY(-8px); filter: blur(2px); }
@keyframes introGlitch {
  0%, 93%, 100% { text-shadow: 0 0 22px rgba(125,227,255,0.3); transform: translateX(0); }
  94% { text-shadow: -3px 0 #ff3b55, 3px 0 #59e6ff; transform: translateX(1px); }
  96% { text-shadow: 3px 0 #ff3b55, -3px 0 #59e6ff; transform: translateX(-1px); }
  98% { text-shadow: 0 0 22px rgba(125,227,255,0.3); transform: translateX(0); }
}
#intro-skip {
  position: absolute; right: 26px; bottom: 24px;
  background: transparent; border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.55);
  font: 600 12px var(--mono); letter-spacing: 0.24em;
  padding: 8px 18px; border-radius: 6px;
  cursor: pointer; transition: all 0.15s;
  opacity: 0;
}
#intro.seen-ui #intro-skip { opacity: 1; }
#intro-skip:hover { color: #fff; border-color: rgba(255,255,255,0.6); }

/* ---- loadout carousels ---- */
.carousel { display: flex; align-items: stretch; gap: 10px; }
.car-arrow {
  background: rgba(10, 25, 35, 0.4); border: 1px solid #24455a; color: #9db8c9;
  width: 38px; font-size: 22px; line-height: 1; cursor: pointer; border-radius: 8px;
  flex: none; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.car-arrow:hover { border-color: var(--ac, #7df3ff); color: #fff; background: rgba(20, 45, 60, 0.5); }
.car-arrow:active { transform: scale(0.94); }
.car-center {
  flex: 1; text-align: center; padding: 12px 14px 10px; border: 1px solid #1c3a4d;
  border-radius: 10px; background: rgba(8, 20, 30, 0.5); overflow: hidden; min-height: 96px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.car-center.slide-l { animation: carL 0.18s ease; }
.car-center.slide-r { animation: carR 0.18s ease; }
@keyframes carL { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes carR { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.car-name { font-weight: 700; letter-spacing: 0.16em; font-size: 15px; margin-top: 4px; }
.car-sub { font-size: 12px; color: #9db8c9; margin-top: 5px; }
.car-dots { display: flex; justify-content: center; gap: 8px; margin-top: 9px; }
.car-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #24455a; cursor: pointer;
  transition: transform 0.15s, background 0.15s; padding: 0; border: none;
}
.car-dot:hover { background: #3a6a85; }
.car-dot.on { transform: scale(1.3); }

/* V3: progression panel (stats screen) */
#progression-panel { border: 1px solid rgba(125,200,255,0.16); padding: 12px 14px; background: rgba(8,18,30,0.4); }
.pg-offline { font-size: 12px; line-height: 1.8; letter-spacing: 0.1em; color: #9db8c9; text-align: center; padding: 6px 0; }
.pg-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.pg-lv { font-weight: 700; letter-spacing: 0.22em; color: #7df3ff; font-size: 13px; }
.pg-xp { font-size: 12px; letter-spacing: 0.14em; color: #9db8c9; }
.pg-bar { height: 5px; background: rgba(125,243,255,0.1); overflow: hidden; margin-bottom: 10px; }
.pg-bar i { display: block; height: 100%; background: linear-gradient(90deg,#2aa4c9,#7df3ff); }
.pg-title { font-size: 12px; letter-spacing: 0.18em; color: #ffd166; margin-bottom: 8px; }
.pg-unlocks { display: flex; flex-wrap: wrap; gap: 6px; }
.pg-unlock {
  font: 700 12px ui-monospace, monospace; letter-spacing: 0.14em;
  border: 1px solid rgba(125,243,255,0.35); color: #dff4ff;
  background: rgba(10,22,36,0.6); padding: 3px 8px; cursor: pointer;
}
.pg-unlock.cosmetic { border-color: rgba(199,146,255,0.45); }
.pg-unlock.locked { opacity: 0.35; cursor: default; }
.pg-unlock:not(.locked):not(:disabled):hover { background: rgba(125,243,255,0.14); }

/* V3: achievements + challenges panel */
.ach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.ach-cell {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; letter-spacing: 0.12em; font-weight: 700;
  border: 1px solid rgba(125,243,255,0.14); padding: 4px 8px;
  color: #4a6272; background: rgba(8,16,26,0.35);
}
.ach-cell.on { color: #ffd166; border-color: rgba(255,209,102,0.4); }
.ach-cell i { font-style: normal; color: inherit; opacity: 0.8; }
.ch-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid rgba(125,200,255,0.12); padding: 6px 10px; margin-bottom: 5px;
}
.ch-main { flex: 1; min-width: 0; }
.ch-main b { font-size: 12px; letter-spacing: 0.16em; color: #dff4ff; display: block; }
.ch-sub { font-size: 12px; color: #7d95a8; letter-spacing: 0.08em; }
.ch-bar { height: 3px; background: rgba(125,243,255,0.1); margin-top: 4px; overflow: hidden; }
.ch-bar i { display: block; height: 100%; background: linear-gradient(90deg,#2aa4c9,#7df3ff); }
.ch-prog { font-size: 12px; color: #9db8c9; white-space: nowrap; }

/* V3: onboarding hint (HUD bottom-center above xp bar) */
#onb-hint {
  position: absolute;
  left: 50%; bottom: 96px;
  transform: translateX(-50%);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.22em;
  color: #dff4ff;
  background: rgba(8, 18, 30, 0.72);
  border: 1px solid rgba(125, 243, 255, 0.4);
  padding: 7px 16px;
  white-space: nowrap;
  animation: onbPulse 2s ease-in-out infinite;
  z-index: 5;
}
#onb-hint.hidden { display: none; }
@keyframes onbPulse { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
@media (max-width: 700px) {
  #onb-hint { font-size: 12px; padding: 6px 10px; bottom: 84px; }
}

/* V3: critical-hull vignette states (restrained; static under reduced-flash) */
#vignette.crit { box-shadow: inset 0 0 140px rgba(255, 40, 70, 0.35); }
#vignette.crit-pulse { animation: critPulseV 1.1s ease-in-out infinite; }
@keyframes critPulseV {
  0%, 100% { box-shadow: inset 0 0 120px rgba(255, 40, 70, 0.28); }
  50% { box-shadow: inset 0 0 170px rgba(255, 40, 70, 0.5); }
}

/* ============================================================
   V4.4 — GAME FEEL MICRO-ANIMATION POLISH
   Subtle press feedback on menu/panel buttons and cards. Fully
   disabled when the OS prefers reduced motion (the reduce block
   also stills the scanline flicker, card entrances, vignette
   pulses and every other looping animation below). Non-blocking:
   durations stay under 0.2s and never gate input.
   ============================================================ */
.mbtn:active { transform: translateY(1px) scale(0.985); transition-duration: 0.06s; }
.card:active { transform: translateY(-6px) scale(1.01); transition-duration: 0.08s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   V5 — CAREER SPINE
   ============================================================ */

/* main-menu NEXT TARGET card */
.next-target {
  margin: 14px auto 0; max-width: 380px; width: 100%;
  border: 1px solid rgba(125, 200, 255, 0.25); background: rgba(8, 12, 22, 0.72);
  padding: 10px 14px; cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.next-target:hover { border-color: rgba(255, 209, 102, 0.5); box-shadow: 0 0 18px rgba(255, 209, 102, 0.12); }
.next-target.hidden { display: none; }
.nt-top { display: flex; justify-content: space-between; align-items: baseline; }
.nt-label { font: 700 12px ui-monospace, monospace; letter-spacing: 0.28em; }
.nt-level { font: 700 12px ui-monospace, monospace; letter-spacing: 0.18em; color: #9db8c9; }
.nt-main { display: block; font: 700 17px ui-monospace, monospace; letter-spacing: 0.14em; margin: 5px 0 2px; }
.nt-sub { display: block; font: 600 12px ui-monospace, monospace; letter-spacing: 0.14em; color: #9db8c9; }
.nt-bar { display: block; height: 4px; background: rgba(125, 200, 255, 0.1); margin: 7px 0 5px; overflow: hidden; }
.nt-bar i { display: block; height: 100%; transition: width .5s ease; }
.nt-foot { display: block; font: 600 12px ui-monospace, monospace; letter-spacing: 0.2em; color: #5b7a8f; }

/* challenge deep-link banner */
#challenge-banner {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 60;
  display: flex; gap: 12px; align-items: center;
  background: rgba(8, 12, 22, 0.94); border: 1px solid rgba(255, 138, 61, 0.45);
  padding: 10px 14px; max-width: 92vw;
}
#challenge-banner.hidden { display: none; }
.cb-line { font: 600 12px ui-monospace, monospace; letter-spacing: 0.12em; color: #ff9d6b; }
.cb-line b { color: #ffd166; }

/* post-run progression */
#post-run-progression { max-width: 520px; margin: 12px auto 0; text-align: center; }
#post-run-progression .pg-bar { height: 5px; background: rgba(125, 200, 255, 0.1); margin: 6px auto; max-width: 420px; overflow: hidden; }
#post-run-progression .pg-bar i { display: block; height: 100%; background: #7df3ff; transition: width .6s ease; }
.save-runner {
  max-width: 720px; margin: 14px auto 0; padding: 12px 14px;
  border: 1px solid rgba(125, 200, 255, 0.24); background: rgba(8, 12, 22, 0.78);
}
.save-runner.hidden { display: none; }
.save-runner h3 { margin: 0 0 5px; color: #dff4ff; font: 700 14px ui-monospace, monospace; letter-spacing: .22em; }
.save-runner-copy { color: #9db8c9; font: 600 12px/1.5 ui-monospace, monospace; letter-spacing: .08em; }
.save-runner-copy b { color: #7df3ff; }
.save-runner-fields { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr; gap: 6px; margin-top: 8px; }
.save-runner-fields input {
  min-width: 0; background: rgba(10,16,28,.9); border: 1px solid rgba(125,200,255,.3);
  color: #dff4ff; font: 10px ui-monospace,monospace; padding: 7px 8px; letter-spacing: .08em;
}
.save-runner-msg { color: #7df3ff; font: 600 12px ui-monospace,monospace; min-height: 12px; margin-top: 5px; }
.save-runner-actions { display: flex; justify-content: flex-end; gap: 8px; }
.save-runner-actions .mbtn { width: auto; min-width: 128px; padding: 7px 12px; font-size: 12px; }
@media (max-width: 720px) { .save-runner-fields { grid-template-columns: 1fr; } }
.pr-line { font: 700 12px ui-monospace, monospace; letter-spacing: 0.16em; color: #dff4ff; margin: 4px 0; }
.pr-line.muted { color: #9db8c9; font-weight: 600; }
.pr-unlock {
  font: 700 12px ui-monospace, monospace; letter-spacing: 0.16em; color: #ffd166;
  margin: 5px 0; animation: v5UnlockPop .5s ease-out;
}
.pr-unlock span { display: block; font: 600 12px ui-monospace, monospace; color: #9db8c9; letter-spacing: 0.12em; }
.pr-next { font: 600 12px ui-monospace, monospace; letter-spacing: 0.16em; color: #9db8c9; margin: 7px 0 2px; }
@keyframes v5UnlockPop {
  0% { transform: scale(0.85); opacity: 0; }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .pr-unlock { animation: none; } }

/* career screen */
.career-head { margin: 4px 0 14px; }
.ch-lv { font: 700 18px ui-monospace, monospace; letter-spacing: 0.2em; color: #dff4ff; margin-bottom: 6px; }
.ch-lv b { color: #7df3ff; }
.ch-xp { font: 600 12px ui-monospace, monospace; letter-spacing: 0.16em; color: #9db8c9; margin-left: 12px; }
.pg-bar { height: 5px; background: rgba(125, 200, 255, 0.1); overflow: hidden; }
.pg-bar.big { height: 7px; }
.pg-bar i { display: block; height: 100%; background: linear-gradient(90deg, #59e6ff, #7df3ff); transition: width .5s ease; }
.ch-target { font: 600 12px ui-monospace, monospace; letter-spacing: 0.14em; color: #9db8c9; margin-top: 9px; }
.ch-target b { letter-spacing: 0.18em; }
.ch-target span { display: block; margin-top: 6px; color: #9db8c9; line-height: 1.6; }
.career-section { border-top: 1px solid var(--line); padding: 16px 0; margin: 0; }
.cs-label { font: 700 12px ui-monospace, monospace; letter-spacing: 0.18em; color: #9db8c9; margin-bottom: 10px; }
.cs-sub { color: #5b7a8f; font-weight: 600; }
.cs-pro { color: #ffd166; }
.cs-titles { display: flex; gap: 8px; flex-wrap: wrap; }
.pg-unlock.title.sel { border-color: #ffd166; color: #ffd166; }
.cs-track { display: flex; gap: 6px; flex-wrap: wrap; }
.trk { font: 600 12px ui-monospace, monospace; letter-spacing: 0.1em; color: #5b7a8f; border: 1px solid rgba(125, 200, 255, 0.1); padding: 3px 6px; }
.trk.on { color: #dff4ff; border-color: rgba(125, 200, 255, 0.35); }
.cs-hint { font: 600 12px/1.6 ui-monospace, monospace; letter-spacing: 0.08em; color: #9db8c9; margin-top: 8px; }
.cs-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

/* mastery grid */
.mst-ship { display: grid; gap: 8px; margin-bottom: 18px; }
.mst-ship-name { font: 700 12px ui-monospace, monospace; letter-spacing: 0.22em; color: #9db8c9; min-width: 110px; }
.mst-ship-name i { color: #5b7a8f; font-style: normal; }
.mst-goal {
  font: 600 12px ui-monospace, monospace; letter-spacing: 0.08em;
  color: #cfe6f5; background: transparent; border: 1px solid rgba(125, 200, 255, 0.14);
  padding: 12px; min-height: 44px; text-align: left; cursor: pointer; transition: border-color .15s, color .15s;
}
.mst-goal:hover { border-color: rgba(199, 146, 255, 0.6); color: #c792ff; }
.mst-goal.on { color: #69ffa8; border-color: rgba(105, 255, 168, 0.4); }
.mst-goal.pinned { border-color: #c792ff; box-shadow: 0 0 10px rgba(199, 146, 255, 0.25); }
.mst-goal.locked { color: #9db8c9; cursor: not-allowed; border-style: dashed; }
.mst-goal.locked:hover { color: inherit; border-color: rgba(255,255,255,0.16); }
.ach-section summary { cursor: pointer; list-style: none; margin-bottom: 0; }
.ach-section[open] summary { margin-bottom: 8px; }
.ach-section summary::-webkit-details-marker { display: none; }
.ach-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.ach-chip { color: #5b7a8f; border: 1px solid rgba(125,200,255,.1); padding: 5px 7px; font: 600 12px ui-monospace,monospace; letter-spacing: .08em; }
.ach-chip.on { color: #69ffa8; border-color: rgba(105,255,168,.3); }
.streak-line { font: 700 13px ui-monospace, monospace; letter-spacing: 0.16em; color: #ff8a3d; }

/* run history */
.hist-row {
  display: flex; gap: 10px; align-items: baseline; padding: 5px 2px;
  border-bottom: 1px solid rgba(125, 200, 255, 0.06); font: 600 12px ui-monospace, monospace;
}
.hist-row b { color: #7df3ff; min-width: 56px; }
.hist-row span { flex: 1; color: #9db8c9; letter-spacing: 0.08em; }
.hist-row i { color: #5b7a8f; font-style: normal; font-size: 12px; }

/* loadout: saved loadout chips (PRO) */
.ld-chip {
  font: 600 12px ui-monospace, monospace; letter-spacing: 0.1em; color: #dff4ff;
  border: 1px solid rgba(255, 209, 102, 0.35); padding: 4px 8px; cursor: pointer;
  display: inline-flex; gap: 6px; align-items: center;
}
.ld-chip:hover { border-color: #ffd166; }
.ld-chip i { color: #ff8a9b; font-style: normal; cursor: pointer; }

/* V5 loadout lock presentation */
.car-lock {
  margin-top: 6px; font: 700 12px ui-monospace, monospace; letter-spacing: 0.18em;
  color: #ff8a9b;
}
.car-lock span { color: #5b7a8f; font-weight: 600; letter-spacing: 0.1em; }
.car-dot.locked { opacity: 0.35; }

/* Player screens: scroll from a reachable origin, with a clear primary action. */
#menu { justify-content: flex-start; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#menu .menu-inner { flex-shrink: 0; width: min(680px, 100%); margin-block: auto; gap: 18px; padding: 28px 24px; }
#menu .game-title { font-size: clamp(42px, 9vw, 88px); }
#menu .pretitle { font-size: 12px; letter-spacing: .2em; }
#menu .subtitle { font-size: 12px; letter-spacing: .38em; }
#menu .menu-primary, #menu .next-target, .menu-secondary { width: min(440px, 100%); max-width: none; }
#menu .menu-primary .mbtn { min-height: 54px; }
#menu .next-target { margin: 0; color: var(--text); }
#menu .nt-foot { color: #9db8c9; font-size: 12px; letter-spacing: .08em; line-height: 1.5; }
#menu .nt-sub { line-height: 1.6; letter-spacing: .06em; }
#menu .nt-top { gap: 12px; flex-wrap: wrap; }
.menu-secondary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.menu-secondary .mbtn { min-height: 44px; padding: 10px 8px; font-size: 12px; letter-spacing: .1em; background: rgba(4, 8, 16, .55); border-color: rgba(85, 246, 255, .12); }
.menu-secondary #m-career, .menu-secondary #m-hangar { border-color: var(--line-hi); color: #dff4ff; }
#menu .menu-footer { font-size: 12px; letter-spacing: .1em; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mbtn:focus-visible, .next-target:focus-visible, .mst-goal:focus-visible, summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
#loadout .loadout-panel { display: flex; flex-direction: column; width: min(780px, 94vw); height: min(760px, 92dvh); max-height: 92dvh; overflow: hidden; padding: 20px; }
.loadout-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 4px 12px; scrollbar-width: thin; }
.loadout-actions { display: flex; flex-shrink: 0; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.loadout-actions .mbtn { min-height: 48px; }
#career .career-panel { display: flex; flex-direction: column; width: min(680px, 94vw); max-height: 92dvh; overflow: hidden; padding: 24px; }
.career-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 4px; }
.career-actions { flex-shrink: 0; border-top: 1px solid var(--line); padding-top: 12px; }
.career-reward { display: grid; gap: 8px; margin-top: 20px; padding: 16px 0 16px 18px; border-left: 3px solid var(--gold); background: linear-gradient(90deg, rgba(255,209,102,.07), transparent); }
.career-reward .cs-label { margin: 0; }
.career-reward strong { font: 700 clamp(22px, 4vw, 30px) var(--font-mono); letter-spacing: .08em; color: var(--gold); }
.career-reward > span:not(.cs-label), .career-reward > b { font: 600 12px/1.5 var(--font-mono); color: #9db8c9; }
.career-reward > b { color: var(--gold); }
.mst-description { display: block; margin-top: 6px; font: 400 11px/1.6 var(--font-mono); color: #9db8c9; letter-spacing: .02em; }
.unlock-track summary { cursor: pointer; min-height: 24px; }
.unlock-track .cs-track { margin-top: 12px; }
.unlock-track .trk { font-size: 12px; color: #9db8c9; padding: 8px; }
#career .ch-lv { line-height: 1.6; }
#career .ch-xp { display: block; margin: 0; }
#career .ach-chip { font-size: 12px; color: #9db8c9; line-height: 1.5; padding: 8px; }
#career #cr-back { background: #090d17; min-height: 44px; width: 100%; margin: 0; }
@media (max-width: 600px) {
  #menu .menu-inner { padding: 24px 18px; gap: 16px; }
  #menu .game-title { letter-spacing: .06em; }
  #menu .subtitle::before, #menu .subtitle::after { display: none; }
  #menu .nt-main { font-size: 16px; }
  #gameover .go-inner { padding: 20px 16px; }
  #gameover .run-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #gameover .go-sub { letter-spacing: .22em; }
  #career .career-panel { padding: 20px; }
  #career .cs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #career .ch-row { gap: 10px; }
  #loadout .loadout-panel { padding: 14px; }
}
@media (max-height: 520px) {
  #menu .menu-inner { padding-block: 18px; gap: 12px; }
  #menu .game-title { font-size: 48px; }
  #menu .pretitle { display: none; }
  #gameover .go-inner { padding-block: 16px; }
}

/* Approved equipment art: a shared comparison row, stacked on phones. */
.loadout-equipment { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin: 12px 0; }
.loadout-equipment section { min-width: 0; }
.equipment-label { font-size: 12px; font-weight: 400; letter-spacing: .28em; color: var(--muted, #9db8c9); margin: 6px 0 10px; }
#loadout canvas.ship-mini { display: block; width: 148px; height: 148px; max-width: 100%; object-fit: contain; margin: 0 auto 6px; }
.loadout-equipment .car-center { min-height: 242px; padding: 8px 10px 12px; }
.loadout-equipment .car-arrow { width: 32px; }
.loadout-equipment .car-name { letter-spacing: .12em; }
@media (max-width: 600px) {
  .loadout-equipment { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .loadout-equipment .car-center { min-height: 208px; }
  #loadout canvas.ship-mini { width: 128px; height: 128px; }
}
@media (prefers-reduced-motion: reduce) {
  .car-center.slide-l, .car-center.slide-r { animation: none; }
}

/* Supporting copy must remain readable on a phone as well as a monitor. */
.card .c-desc, #levelup .card .c-desc, .tips li, .ctrl-row p,
.set-row, .pg-offline { font-size: 14px; line-height: 1.55; }
.lu-hint, .stat-cell .s-label, .res-cell .r-label,
.nt-foot, .nt-label, .nt-sub, .ch-sub { letter-spacing: .08em; }
#ld-conditions { font-size: 12px; }

/* Compact portrait flight HUD: time/level cannot overlap shield numbers. */
@media (max-width: 600px) and (min-height: 521px) {
  body:not(.practicing) #hud-tl { width: calc(50vw - 28px); }
  body:not(.practicing) #hud-tc { top: calc(88px + env(safe-area-inset-top)); }
}

/* Reward decisions preserve the live world behind a scrollable scrim. */
#altar {flex-direction:column;justify-content:flex-start;gap:20px;padding:32px max(18px,env(safe-area-inset-right)) 28px max(18px,env(safe-area-inset-left));background:rgba(3,5,10,.86);}
#altar .lu-head {display:block;flex:none;margin:0;text-align:center;}
#altar .lu-hint {display:block;flex:none;text-align:center;}
#altar-cards {display:grid;grid-template-columns:repeat(2,minmax(0,260px));gap:18px;width:min(100%,538px);flex:none;}
#altar-cards .card {width:100%;min-width:0!important;max-width:none!important;margin:0;}
#altar-cards .card:hover {transform:translateY(-3px);}
#settings .panel {display:flex;flex-direction:column;overflow:hidden;max-height:88dvh;}
#settings h2 {flex:none;}
.settings-scroll {min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--cyan) transparent;scrollbar-gutter:stable;padding-right:10px;}
.settings-scroll::-webkit-scrollbar {width:5px;display:block;}
.settings-scroll::-webkit-scrollbar-thumb {background:var(--line-hi);border-radius:3px;}
#settings #set-back {flex:none;margin-top:16px;}
#fr-code {min-width:0;}
@media(max-width:560px) {
 #altar {gap:16px;padding-top:24px;}
 #altar-cards {grid-template-columns:minmax(0,1fr);max-width:360px;}
}
@media(max-height:520px) {
 #altar {gap:12px;padding-top:16px;}
 #altar .lu-kicker {font-size:11px;}
 #altar-cards .card {padding:14px;}
}
/* Percentages follow HUD zoom; practice keeps its independent allocation. */
body.touch:not(.practicing) #hud-bottom {left:14px;transform:none;width:calc(100% - 154px);}
body.touch:not(.practicing) #combo-ready {width:100%;max-width:100%;overflow-wrap:anywhere;}
body.touch:not(.practicing) #ability-row {flex-wrap:wrap;}
body.touch:not(.practicing) #minimap {width:80px;height:80px;bottom:calc(204px + env(safe-area-inset-bottom));right:calc(26px + env(safe-area-inset-right));}
body.touch #btn-pause {min-width:55px;min-height:55px;}
body.touch .friend-request {flex-wrap:wrap;gap:8px;}
body.touch .friend-request > span {flex-basis:100%!important;overflow-wrap:anywhere;}
body.touch #friends button,body.touch #fr-code {min-height:44px;min-width:44px;}
@media(pointer:coarse) {
 #btn-pause {min-width:55px;min-height:55px;}
 .friend-request {flex-wrap:wrap;gap:8px;}
 .friend-request > span {flex-basis:100%!important;overflow-wrap:anywhere;}
 #friends button,#fr-code {min-height:44px;min-width:44px;}
}
@media(orientation:landscape) and (max-height:520px) {
 body.touch:not(.practicing) #hud-bottom {left:22%;width:56%;}
 body.touch:not(.practicing) #minimap {width:64px;height:64px;bottom:calc(128px + env(safe-area-inset-bottom));right:calc(12px + env(safe-area-inset-right));}
}

/* Touch already exposes DASH cooldown at the bottom; keep upper vitals clear. */
body.touch #hud-tr #dash-wrap { display:none; }
@media(max-width:600px) and (min-height:521px) {
 body.touch:not(.practicing) #hud-tl { width:calc(50% - 28px); }
 body.touch #hud-tr { display:grid;grid-template-columns:auto auto;gap:4px 10px; }
 body.touch #kill-wrap { grid-column:1;grid-row:1; }
 body.touch #combo { grid-column:1;grid-row:2;justify-self:end; }
 body.touch #btn-pause { grid-column:2;grid-row:1 / span 2; }
}

/* Optional sector decision: existing metal/energy language, clear costs first. */
#contract {cursor:default;background:rgba(3,5,10,.9);overflow-y:auto;padding:24px;}
.contract-panel {width:min(760px,100%);margin:auto;}
.contract-panel h2 {font-size:clamp(22px,4vw,32px);letter-spacing:.13em;line-height:1.25;}
#contract-description {font-size:15px;line-height:1.6;color:#a7bcc8;margin:14px 0 24px;}
#contract-options {display:grid;grid-template-columns:1fr 1fr;gap:16px;}
.contract-option {position:relative;display:flex;flex-direction:column;gap:14px;text-align:left;padding:24px 20px;min-height:240px;color:var(--text);background:var(--panel);border:1px solid var(--line-hi);cursor:pointer;font:inherit;}
.contract-option.breach {border-color:#b47d42;}
.contract-key {font-size:13px;color:#a7bcc8;}
.contract-name {font-size:19px;font-weight:700;color:var(--cyan);letter-spacing:.07em;}
.breach .contract-name {color:#ffd166;}
.contract-risk {font-size:15px;line-height:1.55;}
.contract-reward {font-size:14px;line-height:1.55;color:#a8eac6;margin-top:auto;}
.contract-option:focus-visible {outline:2px solid var(--cyan);outline-offset:4px;}
.contract-option:hover {background:#102432;}
#contract-skip {min-height:48px;margin-top:20px;width:100%;display:flex;justify-content:space-between;gap:12px;letter-spacing:.09em;}
#contract-skip span {font-size:12px;color:#a7bcc8;letter-spacing:.04em;}
@media(max-width:600px) {#contract{padding:20px 16px;}#contract-options{grid-template-columns:1fr;}.contract-option{min-height:180px;padding:18px;gap:10px;}#contract-description{margin-bottom:18px;}}
@media(max-height:520px) {#contract{justify-content:flex-start;padding:16px;}.contract-panel h2{font-size:22px;}#contract-description{margin:8px 0 12px;}.contract-option{min-height:170px;padding:14px;gap:8px;}#contract-skip{margin-top:12px;}}
