/* ============================================================
   STAR VAULT — Neon Starfighter | css/style.css
   ============================================================ */
:root {
  --cyan: #00f0ff;
  --pink: #ff2d95;
  --purple: #8a2be2;
  --gold: #ffd23f;
  --green: #39ff88;
  --red: #ff3b5c;
  --bg0: #05030f;
  --bg1: #0d0a1f;
  --panel: rgba(13, 10, 31, 0.92);
  --panel-border: rgba(0, 240, 255, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg0);
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  color: #e8f6ff;
  user-select: none;
  touch-action: none;
}

#game-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  background: radial-gradient(ellipse at 50% 30%, #141033 0%, #05030f 70%);
}

.hidden { display: none !important; }

/* ============================================================
   GRAPHICS POLISH LAYER — pure visual upgrades, no layout changes
   ============================================================ */

/* ---- global vignette (fixed, never intercepts input) ---- */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 125% 110% at 50% 42%, transparent 62%, rgba(0, 0, 5, 0.38) 100%);
  z-index: 5;
}

/* ---- animated film grain (SVG turbulence) ---- */
body::before {
  content: "";
  position: fixed; inset: -50%;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  z-index: 5;
  opacity: 0.55;
  animation: grainShift 0.9s steps(4) infinite;
}
@keyframes grainShift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-1.2%, 0.8%); }
  50% { transform: translate(0.8%, -1.2%); }
  75% { transform: translate(-0.6%, -0.6%); }
  100% { transform: translate(0, 0); }
}

/* ---- rainbow gradient logo text (keeps glow shadows) ---- */
.logo-big {
  background: linear-gradient(100deg, #7ef7ff 0%, #d9a9ff 35%, #ff8ec6 68%, #fff3b0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-big span {
  background: linear-gradient(100deg, #ff5db1 0%, #ff9ecf 55%, #ffd9ec 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* gradient text mutes the old text-shadow glow — re-add a soft drop glow */
.logo-big, .logo-big span { filter: drop-shadow(0 0 22px rgba(0, 240, 255, 0.35)) drop-shadow(0 0 60px rgba(138, 43, 226, 0.28)); }
.logo-big span { filter: drop-shadow(0 0 22px rgba(255, 45, 149, 0.4)); }

/* ---- liquid sheen sweep on buttons ---- */
.btn { position: relative; overflow: hidden; }
.btn::before {
  content: "";
  position: absolute;
  top: 0; left: -150%;
  width: 60%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  transform: skewX(-18deg);
  transition: left 0.55s ease;
  pointer-events: none;
}
.btn:hover::before { left: 170%; }

/* ---- glassmorphism: panels & shop ---- */
.panel,
.shop-panel {
  background: linear-gradient(155deg, rgba(18, 13, 42, 0.88) 0%, rgba(8, 6, 22, 0.93) 100%);
  backdrop-filter: blur(14px) saturate(1.25);
  border: 1px solid rgba(0, 240, 255, 0.28);
  box-shadow:
    0 0 40px rgba(0, 240, 255, 0.13),
    0 0 90px rgba(138, 43, 226, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 0 32px rgba(0, 240, 255, 0.045);
}

/* top accent line on panels */
.panel::before,
.shop-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 8%; right: 8%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--pink), transparent);
  opacity: 0.75;
}
.panel, .shop-panel { position: relative; }

/* ---- stat pills: glass chips with inner sheen ---- */
.stat-pill {
  background: linear-gradient(160deg, rgba(0, 40, 70, 0.55), rgba(0, 12, 24, 0.72));
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 240, 255, 0.3);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ---- HUD bars: softer glass + animated sheen ---- */
.hud-shield, .hud-boost, .boss-bar {
  backdrop-filter: blur(6px);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.hud-shield-fill, .hud-boost-fill, .boss-fill, .loadbar-fill, .mission-fill {
  position: relative;
}
.hud-shield-fill::after,
.hud-boost-fill::after,
.boss-fill::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 20%, rgba(255, 255, 255, 0.45) 50%, transparent 80%);
  background-size: 220% 100%;
  animation: barSheen 2.2s linear infinite;
  pointer-events: none;
}
@keyframes barSheen {
  0% { background-position: 200% 0; }
  100% { background-position: -60% 0; }
}

/* ---- gradient score ---- */
.hud-score {
  background: linear-gradient(180deg, #ffffff 55%, #9be8ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 14px rgba(0, 240, 255, 0.45));
}

/* ---- shop cards: glossy sheen + depth ---- */
.shop-item {
  background: linear-gradient(165deg, rgba(0, 26, 52, 0.72), rgba(0, 8, 20, 0.82));
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.shop-item:hover {
  transform: translateY(-3px) scale(1.015);
  box-shadow: 0 8px 28px rgba(0, 240, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

/* ---- improved scrollbar grip ---- */
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.5), rgba(138, 43, 226, 0.5));
}

/* ---- keep effects off mobile for battery + perf ---- */
@media (max-width: 620px) {
  body::before { display: none; }
  .panel, .shop-panel, .stat-pill, .hud-shield, .hud-boost, .boss-bar, .shop-item { backdrop-filter: none; }
}

/* ---------- Screens ---------- */
.screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  background: rgba(4, 2, 12, 0.72);
  backdrop-filter: blur(3px);
  z-index: 20;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Logo ---------- */
.logo-big {
  font-size: clamp(44px, 9vw, 92px);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #fff;
  text-shadow: 0 0 12px var(--cyan), 0 0 42px var(--cyan), 0 0 90px var(--purple);
  line-height: 1;
}
.logo-big span {
  color: var(--pink);
  text-shadow: 0 0 12px var(--pink), 0 0 42px var(--pink), 0 0 90px var(--purple);
}
.sub-logo {
  margin-top: 8px;
  letter-spacing: 0.55em;
  font-size: clamp(10px, 1.6vw, 15px);
  color: rgba(232, 246, 255, 0.7);
  text-transform: uppercase;
  margin-bottom: 26px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  border: 2px solid var(--cyan);
  background: rgba(0, 240, 255, 0.08);
  color: #e8f6ff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 13px 30px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.7);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.18), inset 0 0 12px rgba(0, 240, 255, 0.08);
}
.btn:hover { transform: translateY(-2px) scale(1.03); background: rgba(0, 240, 255, 0.18); box-shadow: 0 0 26px rgba(0, 240, 255, 0.45); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  border-color: var(--green);
  background: rgba(57, 255, 136, 0.12);
  text-shadow: 0 0 8px rgba(57, 255, 136, 0.8);
  box-shadow: 0 0 14px rgba(57, 255, 136, 0.25);
  font-size: 21px; padding: 16px 46px;
}
.btn-primary:hover { background: rgba(57, 255, 136, 0.22); box-shadow: 0 0 30px rgba(57, 255, 136, 0.5); }

.btn-secondary { border-color: var(--purple); box-shadow: 0 0 14px rgba(138, 43, 226, 0.3); text-shadow: 0 0 8px var(--purple); }
.btn-secondary:hover { background: rgba(138, 43, 226, 0.2); box-shadow: 0 0 26px rgba(138, 43, 226, 0.55); }

.btn-shop { border-color: var(--gold); text-shadow: 0 0 8px var(--gold); box-shadow: 0 0 14px rgba(255, 210, 63, 0.25); }
.btn-shop:hover { background: rgba(255, 210, 63, 0.15); box-shadow: 0 0 26px rgba(255, 210, 63, 0.5); }

.btn-ad {
  border-color: var(--red);
  color: #ffe9ee;
  background: rgba(255, 59, 92, 0.12);
  text-shadow: 0 0 8px var(--red);
  box-shadow: 0 0 14px rgba(255, 59, 92, 0.3);
  animation: adPulse 1.8s ease-in-out infinite;
}
.btn-ad:hover { background: rgba(255, 59, 92, 0.28); box-shadow: 0 0 30px rgba(255, 59, 92, 0.6); }
@keyframes adPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 59, 92, 0.25); }
  50% { box-shadow: 0 0 26px rgba(255, 59, 92, 0.65); }
}
.btn-ad-big { font-size: 19px; padding: 15px 38px; }

.btn-small { font-size: 13px; padding: 9px 16px; border-width: 1px; border-radius: 8px; }
.btn-platform { border-color: var(--cyan); }
.btn-pause { min-width: 46px; }

.menu-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

/* ---------- Stat pills ---------- */
.stat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0, 20, 35, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 15px; font-weight: 700;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.12);
}

/* ---------- Loading ---------- */
#loading-screen { background: var(--bg0); z-index: 100; }
.loadbar {
  width: min(420px, 70vw); height: 14px;
  border: 2px solid var(--panel-border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 30px;
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.25);
}
.loadbar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  box-shadow: 0 0 14px var(--cyan);
  transition: width 0.2s ease;
}
.load-tip { margin-top: 12px; font-size: 13px; color: rgba(232, 246, 255, 0.55); letter-spacing: 0.1em; }
.loading-adslot { margin-top: 26px; }

/* ---------- Menu ---------- */
#menu-screen { background: linear-gradient(100deg, rgba(4,2,12,0.82) 0%, rgba(4,2,12,0.45) 46%, rgba(4,2,12,0.05) 75%); justify-content: flex-start; }
.menu-inner { display: flex; flex-direction: column; align-items: center; gap: 16px; }
@media (min-width: 861px) {
  #menu-screen { align-items: flex-start; padding-left: 7vw; }
  #menu-screen .menu-inner { align-items: flex-start; }
  #menu-screen .menu-stats { justify-content: flex-start; }
  #menu-screen .menu-buttons { align-items: flex-start; }
  #menu-screen .menu-row { justify-content: flex-start; }
  #menu-screen .menu-foot { text-align: left; }
  #menu-screen .logo-big, #menu-screen .sub-logo { text-align: left; }
  #menu-screen .sub-logo { margin-left: 0.4em; }
}
.menu-stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 4px; }
.menu-buttons { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 6px; }
.menu-foot { margin-top: 18px; font-size: 12px; color: rgba(232, 246, 255, 0.4); letter-spacing: 0.08em; }

/* ---------- Hangar overlay ---------- */
#hangar-hud { position: fixed; inset: 0; pointer-events: none; z-index: 15; }
#hangar-hud .hangar-top {
  position: absolute; top: 14px; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 16px;
  pointer-events: auto;
}
#hangar-hud .hangar-bottom { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; }
.hangar-advice { font-size: 13px; color: rgba(232, 246, 255, 0.55); letter-spacing: 0.14em; text-transform: uppercase; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud .hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 12px 16px;
}
.hud-left, .hud-right { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.hud-right { align-items: flex-end; }
.hud-score {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 900; color: #fff;
  text-shadow: 0 0 12px var(--cyan), 0 0 30px rgba(0, 240, 255, 0.5);
}
.hud-mult { font-size: 16px; font-weight: 800; color: var(--gold); text-shadow: 0 0 10px var(--gold); }
.hud-objective { font-size: 13px; color: rgba(232, 246, 255, 0.75); max-width: 46vw; }
.hud-wave {
  font-size: 15px; font-weight: 800; letter-spacing: 0.18em;
  color: var(--pink); text-shadow: 0 0 12px var(--pink);
}
.hud-right .btn-pause { pointer-events: auto; }

.hud-bottom {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 16px;
}
.hud-shield {
  position: relative;
  width: min(360px, 60vw); height: 14px;
  border: 1px solid rgba(0, 240, 255, 0.5);
  border-radius: 999px;
  background: rgba(0, 10, 20, 0.55);
  overflow: hidden;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.12);
}
.hud-shield-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #0af, var(--cyan));
  box-shadow: 0 0 14px var(--cyan);
  transition: width 0.15s ease;
}
.hud-shield.low { animation: shieldPanic 0.6s ease-in-out infinite; }
.hud-shield.low .hud-shield-fill {
  background: linear-gradient(90deg, #a00, var(--red));
  box-shadow: 0 0 14px var(--red);
}
@keyframes shieldPanic {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 59, 92, 0.2); }
  50% { box-shadow: 0 0 20px rgba(255, 59, 92, 0.65); }
}
.hud-shield span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px #000;
}
.hud-boost {
  position: relative;
  width: min(280px, 46vw); height: 8px;
  border: 1px solid rgba(57, 255, 136, 0.45);
  border-radius: 999px;
  background: rgba(0, 14, 8, 0.55);
  overflow: hidden;
  box-shadow: 0 0 10px rgba(57, 255, 136, 0.12);
}
.hud-boost-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #0a6, var(--green));
  box-shadow: 0 0 10px var(--green);
  transition: width 0.15s ease;
}
.hud-boost.empty .hud-boost-fill { background: #f33; box-shadow: 0 0 8px #f33; }
.hud-boost.empty { border-color: rgba(255, 60, 60, 0.6); }
.hud-boost.boosting .hud-boost-fill { filter: brightness(1.6); }
.hud-boost-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; letter-spacing: 0.2em;
  color: #dffeea; text-shadow: 0 1px 3px #000;
}
.hud-power { font-size: 14px; font-weight: 700; color: var(--green); text-shadow: 0 0 10px var(--green); min-height: 20px; }

/* ---------- touch controls (mobile) ---------- */
#touch-controls {
  position: fixed; inset: 0; z-index: 60;
  pointer-events: none; /* children re-enable */
}
#touch-controls.hidden { display: none; }

/* left thumb: virtual joystick */
#touch-stick {
  position: absolute; left: 26px; bottom: 30px;
  width: 128px; height: 128px; border-radius: 50%;
  border: 2px solid rgba(0, 240, 255, 0.35);
  background: radial-gradient(circle at 50% 50%, rgba(0, 240, 255, 0.07), rgba(4, 10, 22, 0.35));
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.12), inset 0 0 14px rgba(0, 240, 255, 0.08);
  pointer-events: auto;
  touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#touch-stick-knob {
  position: absolute; left: 50%; top: 50%;
  width: 54px; height: 54px; border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(0, 240, 255, 0.75);
  background: radial-gradient(circle at 50% 38%, rgba(0, 240, 255, 0.35), rgba(6, 18, 34, 0.8));
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.45);
  transition: transform 0.06s linear;
}
#touch-stick.active { border-color: rgba(0, 240, 255, 0.8); }

/* right thumb: BOOST + FIRE */
#touch-actions {
  position: absolute; right: 20px; bottom: 30px;
  display: flex; align-items: flex-end; gap: 14px;
  pointer-events: none;
}
#touch-actions button {
  width: 74px; height: 74px; border-radius: 50%;
  font-size: 30px; line-height: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: none; user-select: none; -webkit-user-select: none;
  pointer-events: auto;
}
#touch-boost {
  width: 62px; height: 62px; font-size: 26px;
  border: 2px solid rgba(57, 255, 136, 0.75);
  background: radial-gradient(circle at 50% 38%, rgba(57, 255, 136, 0.25), rgba(0, 16, 8, 0.6));
  color: #dfffe9; text-shadow: 0 0 12px var(--green);
  box-shadow: 0 0 16px rgba(57, 255, 136, 0.3), inset 0 0 12px rgba(57, 255, 136, 0.18);
}
#touch-fire {
  border: 2px solid rgba(255, 45, 149, 0.75);
  background: radial-gradient(circle at 50% 38%, rgba(255, 45, 149, 0.28), rgba(20, 0, 12, 0.6));
  color: #ffe3f1; text-shadow: 0 0 12px var(--pink);
  box-shadow: 0 0 18px rgba(255, 45, 149, 0.35), inset 0 0 12px rgba(255, 45, 149, 0.2);
}
#touch-actions button:active {
  transform: scale(0.92);
}
#touch-boost:active { box-shadow: 0 0 24px rgba(57, 255, 136, 0.6), inset 0 0 16px rgba(57, 255, 136, 0.35); }
#touch-fire:active { box-shadow: 0 0 26px rgba(255, 45, 149, 0.65), inset 0 0 16px rgba(255, 45, 149, 0.4); }
.hud-combo {
  font-size: 22px; font-weight: 900; color: var(--gold);
  text-shadow: 0 0 14px var(--gold);
  animation: comboPop 0.25s ease;
}
@keyframes comboPop { from { transform: scale(1.5); } to { transform: scale(1); } }

.hud-bossbar {
  position: absolute; top: 74px; left: 50%; transform: translateX(-50%);
  width: min(560px, 80vw); text-align: center;
}
.boss-name { font-size: 14px; font-weight: 800; letter-spacing: 0.2em; color: var(--red); text-shadow: 0 0 12px var(--red); margin-bottom: 6px; }
.boss-bar {
  height: 16px; border: 2px solid rgba(255, 59, 92, 0.6); border-radius: 999px;
  background: rgba(20, 0, 8, 0.7); overflow: hidden;
}
.boss-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #ff3b5c, #ff9d00);
  box-shadow: 0 0 16px var(--red);
  transition: width 0.2s ease;
}

/* ---------- Panels ---------- */
.panel {
  background: var(--panel);
  border: 2px solid var(--panel-border);
  border-radius: 18px;
  padding: 30px 34px;
  width: min(520px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.15), 0 0 90px rgba(138, 43, 226, 0.15);
  text-align: center;
}
.panel h2 { font-size: 26px; letter-spacing: 0.12em; margin-bottom: 18px; text-shadow: 0 0 14px var(--cyan); }
.panel-buttons { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; align-items: stretch; }
.panel-buttons .menu-row { margin-top: 2px; }
.small-note { margin-top: 14px; font-size: 12px; color: rgba(232, 246, 255, 0.5); }

/* ---------- Game over grid ---------- */
.go-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.go-cell {
  display: flex; flex-direction: column; gap: 4px;
  background: rgba(0, 15, 30, 0.6);
  border: 1px solid var(--panel-border); border-radius: 12px;
  padding: 12px;
}
.go-label { font-size: 11px; letter-spacing: 0.2em; color: rgba(232, 246, 255, 0.55); }
.go-val { font-size: 24px; font-weight: 900; color: #fff; text-shadow: 0 0 10px var(--cyan); }
.newbest { margin: 8px 0; font-size: 17px; font-weight: 800; color: var(--gold); text-shadow: 0 0 14px var(--gold); animation: comboPop 0.3s ease; }

/* ---------- Level clear ---------- */
.lc-body p { font-size: 14px; color: rgba(232, 246, 255, 0.8); margin-bottom: 12px; }

/* ---------- Shop ---------- */
.shop-panel {
  width: min(960px, 96vw);
  height: min(92vh, 760px);
  background: var(--panel);
  border: 2px solid var(--panel-border);
  border-radius: 18px;
  display: flex; flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.15), 0 0 90px rgba(138, 43, 226, 0.2);
  overflow: hidden;
}
.shop-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--panel-border);
}
.shop-header h2 { font-size: 20px; letter-spacing: 0.14em; text-shadow: 0 0 12px var(--cyan); flex: 1; text-align: center; }
.shop-banner {
  padding: 8px 18px;
  font-size: 12px; letter-spacing: 0.08em;
  color: var(--gold);
  background: rgba(255, 210, 63, 0.06);
  border-bottom: 1px solid rgba(255, 210, 63, 0.25);
}
.shop-tabs {
  display: flex; gap: 6px; padding: 10px 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--panel-border);
}
.shop-tab {
  background: rgba(0, 20, 40, 0.5);
  border: 1px solid transparent;
  color: rgba(232, 246, 255, 0.7);
  font-size: 13px; font-weight: 700;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  transition: all 0.15s ease;
}
.shop-tab:hover { color: #fff; border-color: var(--panel-border); }
.shop-tab.active {
  color: #fff;
  border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.12);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
}
.shop-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 14px;
  overflow-y: auto;
  align-content: start;
}
.shop-item {
  display: flex; flex-direction: column; gap: 8px;
  background: rgba(0, 15, 32, 0.65);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 14px;
  padding: 12px;
  text-align: left;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.shop-item:hover { transform: translateY(-2px); border-color: var(--cyan); box-shadow: 0 4px 18px rgba(0, 240, 255, 0.2); }
.shop-item.equipped { border-color: var(--green); box-shadow: 0 0 16px rgba(57, 255, 136, 0.3); }
.si-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.si-name { font-size: 15px; font-weight: 800; color: #fff; }
.si-rarity { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; }
.r-common { color: #9fb6c9; border: 1px solid #9fb6c9; }
.r-rare { color: var(--cyan); border: 1px solid var(--cyan); }
.r-epic { color: var(--purple); border: 1px solid var(--purple); text-shadow: 0 0 6px var(--purple); }
.r-legendary { color: var(--gold); border: 1px solid var(--gold); text-shadow: 0 0 6px var(--gold); }
.si-desc { font-size: 12px; color: rgba(232, 246, 255, 0.6); min-height: 32px; }
.si-preview {
  height: 54px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.si-actions { display: flex; flex-direction: column; gap: 6px; }
.si-actions .btn { width: 100%; font-size: 13px; padding: 9px 10px; border-radius: 8px; letter-spacing: 0.05em; }
.si-owned-tag { text-align: center; font-size: 12px; font-weight: 800; color: var(--green); text-shadow: 0 0 8px var(--green); }

/* ---------- Missions / achievements ---------- */
.missions-list { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.mission-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: rgba(0, 15, 30, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 12px 14px;
}
.mission-info { flex: 1; }
.mission-desc { font-size: 14px; font-weight: 700; }
.mission-progress { font-size: 12px; color: rgba(232, 246, 255, 0.55); margin-top: 3px; }
.mission-bar { height: 6px; background: rgba(0, 10, 25, 0.8); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.mission-fill { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--green)); box-shadow: 0 0 8px var(--cyan); }
.mission-done .mission-desc { color: var(--green); }
.mission-claim { font-size: 12px; padding: 8px 14px; }

.achv-row {
  display: flex; align-items: center; gap: 12px;
  background: rgba(0, 15, 30, 0.6);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 12px; padding: 10px 14px;
  opacity: 0.55;
}
.achv-row.unlocked { opacity: 1; border-color: var(--gold); box-shadow: 0 0 12px rgba(255, 210, 63, 0.2); }
.achv-icon { font-size: 24px; }
.achv-name { font-size: 14px; font-weight: 800; }
.achv-desc { font-size: 12px; color: rgba(232, 246, 255, 0.55); }
.achv-status { margin-left: auto; font-size: 12px; font-weight: 800; color: var(--gold); }
.achv-status.locked { color: rgba(232, 246, 255, 0.4); }

.lb-content { font-size: 14px; color: rgba(232, 246, 255, 0.8); padding: 10px 0; text-align: left; white-space: pre-line; }

/* ---------- local high-score table ---------- */
.lb-rows { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px;
  background: rgba(10, 16, 30, 0.55);
  border: 1px solid rgba(0, 240, 255, 0.14);
  border-radius: 8px;
  font-size: 14px;
}
.lb-row.lb-top {
  border-color: rgba(255, 210, 63, 0.55);
  box-shadow: 0 0 12px rgba(255, 210, 63, 0.15);
}
.lb-pos { font-weight: 800; color: var(--cyan); min-width: 42px; text-shadow: 0 0 8px var(--cyan); }
.lb-top .lb-pos { color: var(--gold); text-shadow: 0 0 8px var(--gold); }
.lb-score { font-weight: 800; color: #fff; flex: 1; }
.lb-meta { font-size: 12px; color: rgba(232, 246, 255, 0.6); }
.help-body { text-align: left; font-size: 14px; line-height: 1.7; color: rgba(232, 246, 255, 0.85); }

/* ---------- Ad modal ---------- */
.ad-panel { text-align: center; }
.ad-badge {
  display: inline-block;
  font-size: 11px; font-weight: 900; letter-spacing: 0.25em;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 16px;
  text-shadow: 0 0 8px var(--red);
  animation: adPulse 1.4s ease-in-out infinite;
}
.ad-title { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.ad-sub { font-size: 13px; color: rgba(232, 246, 255, 0.6); }
.ad-dots { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }
.ad-dots span {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: dotBlink 1.2s ease-in-out infinite;
}
.ad-dots span:nth-child(2) { animation-delay: 0.2s; }
.ad-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBlink { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.ad-fallback { margin-top: 18px; font-size: 13px; color: var(--green); }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%; bottom: 9vh;
  transform: translateX(-50%);
  background: rgba(0, 18, 36, 0.95);
  border: 1px solid var(--cyan);
  border-radius: 12px;
  padding: 12px 22px;
  font-size: 15px; font-weight: 700;
  color: #fff;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.3);
  z-index: 60;
  pointer-events: none;
  animation: toastIn 0.25s ease;
  max-width: 86vw;
  text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Damage flash ---------- */
#dmg-flash {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 30, 60, 0.45) 100%);
  opacity: 0; pointer-events: none; z-index: 9;
  transition: opacity 0.4s ease;
}

/* ---------- Warp flash + skip hint ---------- */
#warp-flash {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, rgba(190, 235, 255, 0.95) 0%, rgba(90, 170, 255, 0.55) 45%, rgba(10, 20, 60, 0) 80%);
  opacity: 0; pointer-events: none; z-index: 12;
}
#warp-flash.on { animation: warpFlash 0.9s ease-out; }
@keyframes warpFlash {
  0% { opacity: 0; }
  12% { opacity: 1; }
  100% { opacity: 0; }
}
#warp-skip {
  position: fixed;
  left: 50%; bottom: 12vh; transform: translateX(-50%);
  z-index: 13;
  font-size: 12px; font-weight: 700; letter-spacing: 0.22em;
  color: rgba(190, 235, 255, 0.75);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
  pointer-events: none;
  animation: dotBlink 1.2s ease-in-out infinite;
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, 0.35); border-radius: 999px; }

/* ---------- Small screens ---------- */
@media (max-width: 620px) {
  .panel { padding: 22px 18px; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .hud-objective { display: none; }
  .go-grid { grid-template-columns: 1fr 1fr; }
  .menu-buttons .btn { width: min(300px, 80vw); }
  .hud-score { font-size: 26px; }
  .hud-shield { width: min(240px, 52vw); }
  .hud-boost { width: min(190px, 40vw); }
  #touch-stick { width: 112px; height: 112px; left: 18px; bottom: 22px; }
  #touch-actions { right: 14px; bottom: 22px; gap: 10px; }
  #touch-actions button { width: 64px; height: 64px; font-size: 26px; }
  #touch-boost { width: 54px; height: 54px; font-size: 22px; }
}
