@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600;800&family=Rajdhani:wght@500;700&display=swap');

:root {
  --panel-bg:   #050e18;
  --panel-edge: rgba(80,160,200,0.25);
  --accent:     #61dafb;
  --fire:       #ff8f3f;
}

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

html, body {
  margin: 0; width: 100%; height: 100%; overflow: hidden;
  font-family: 'Rajdhani', 'Trebuchet MS', sans-serif;
  color: #eaf7ff;
  background: #030b14;
}

/* ── Layout wrapper ── */
#game-wrap {
  position: fixed; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Single centred column that holds all three UI zones */
.game-frame {
  width: min(480px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── TOP PANEL ─── */
.panel-top {
  width: 100%;
  background: linear-gradient(180deg, #07192a 0%, #0b2236 60%, #091e30 100%);
  border-bottom: 1px solid var(--panel-edge);
  box-shadow: 0 4px 24px rgba(0,80,140,0.35);
  padding: 8px 10px 6px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

/* subtle crosshatch overlay on panel */
.panel-top::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg,  transparent, transparent 3px, rgba(100,180,255,0.04) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(100,180,255,0.04) 4px);
  pointer-events: none;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  position: relative; z-index: 1;
}

.stat {
  background: rgba(6, 22, 40, 0.70);
  border: 1px solid rgba(100,180,230,0.22);
  border-radius: 8px;
  padding: 5px 8px;
  backdrop-filter: blur(6px);
  box-shadow: inset 0 0 12px rgba(80,180,240,0.12), 0 2px 8px rgba(0,0,0,0.5);
}

.stat span {
  display: block;
  font-family: 'Orbitron', monospace;
  font-size: 8px; letter-spacing: 1.5px;
  text-transform: uppercase; opacity: 0.6; color: #7ac8ee;
}

.stat strong {
  font-family: 'Orbitron', monospace;
  font-size: 17px; font-weight: 800;
  display: inline-block;
  color: #d8f6ff;
  text-shadow: 0 0 8px rgba(100,220,255,0.4);
  transition: transform 140ms ease, color 200ms ease;
}

.stat strong.pop { transform: scale(1.15); color: #61dafb; }
#fuel.warn   { color: #ffb030; text-shadow: 0 0 8px rgba(255,160,30,0.5); }
#fuel.danger { color: #ff4444; text-shadow: 0 0 8px rgba(255,60,60,0.6); }

/* Cockpit decoration row */
.panel-top__deco {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; padding: 0 2px;
  position: relative; z-index: 1;
}

.pdeco { display: flex; align-items: center; gap: 5px; }

.pdeco__light {
  width: 7px; height: 7px; border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}
.pdeco__light--g { background: #3ef07a; color: #3ef07a; animation: blink-g 3s infinite; }
.pdeco__light--y { background: #f0c83e; color: #f0c83e; animation: blink-g 4.5s 1.5s infinite; }
.pdeco__light--r { background: #f03e3e; color: #f03e3e; animation: blink-g 6s 0.8s infinite; }

@keyframes blink-g {
  0%,90%,100% { opacity: 1; } 92% { opacity: 0.2; }
}

.pdeco__label {
  font-family: 'Orbitron', monospace;
  font-size: 9px; letter-spacing: 3px;
  color: rgba(150,210,255,0.55);
  text-transform: uppercase;
}

.pdeco__radar {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle, #0e3f1e 40%, #061810 100%);
  border: 1px solid rgba(60,200,100,0.4);
  box-shadow: 0 0 8px rgba(50,200,80,0.3), inset 0 0 6px rgba(0,0,0,0.6);
  position: relative; overflow: hidden;
}
.pdeco__radar::after {
  content: '';
  position: absolute; top: 50%; left: 50%;
  width: 50%; height: 2px;
  background: rgba(60,220,100,0.7);
  transform-origin: 0 50%;
  animation: radar-sweep 2.4s linear infinite;
}
@keyframes radar-sweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Fullscreen button */
.fs-btn {
  background: none; border: 1px solid rgba(100,200,255,0.3); border-radius: 4px;
  color: rgba(150,220,255,0.7); font-size: 14px; cursor: pointer;
  padding: 2px 5px; line-height: 1; margin-left: 4px;
  transition: background 200ms, color 200ms;
}
.fs-btn:hover { background: rgba(80,180,255,0.15); color: #9ff; }


/* ─── GAME CANVAS AREA ─── */
#game-container {
  flex: 1; min-height: 0; width: 100%;
  background: #06131f; /* match Phaser backgroundColor — letterbox invisible */
  overflow: hidden;
  position: relative;
}

#game-container canvas {
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: pixelated;
  max-width: 100%; max-height: 100%;
  filter: drop-shadow(0 0 20px rgba(80,160,255,0.15));
}

/* ─── BOTTOM PANEL ─── */
.panel-bottom {
  width: 100%;
  background: linear-gradient(0deg, #07192a 0%, #0b2236 60%, #091e30 100%);
  border-top: 1px solid var(--panel-edge);
  box-shadow: 0 -4px 24px rgba(0,80,140,0.35);
  padding: max(10px, env(safe-area-inset-bottom)) 14px 12px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.panel-bottom::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg,  transparent, transparent 3px, rgba(100,180,255,0.04) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(100,180,255,0.04) 4px);
  pointer-events: none;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative; z-index: 1;
}

.stick-zone, .fire-btn { pointer-events: auto; }

.stick-zone {
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, #0d2233 40%, #06131f 100%);
  border: 1.5px solid rgba(110,190,240,0.28);
  box-shadow: 0 0 20px rgba(70,160,220,0.12), inset 0 0 12px rgba(0,0,0,0.5);
  position: relative; touch-action: none;
}

.stick {
  width: 52px; height: 52px; border-radius: 50%;
  position: absolute; left: 29px; top: 29px;
  background: radial-gradient(circle at 28% 24%, #8ae8ff, #2560a0 70%);
  box-shadow: 0 0 20px rgba(100,210,255,0.45), 0 0 40px rgba(80,180,255,0.15);
}

/* Central info display */
.panel-bottom__mid {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}

.pb-meter {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.pb-meter__bar-wrap {
  width: 50px; height: 6px;
  background: rgba(255,255,255,0.08); border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
}
.pb-meter__bar {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #3ef07a, #61dafb);
  border-radius: 3px;
  transition: width 0.3s ease, background 0.3s ease;
}
.pb-meter__label {
  font-family: 'Orbitron', monospace;
  font-size: 8px; letter-spacing: 2px;
  color: rgba(130,210,255,0.5);
}

.fire-btn {
  width: 100px; height: 100px; border-radius: 50%;
  border: 2px solid rgba(255, 180, 100, 0.7);
  background: radial-gradient(circle at 30% 28%, #ffcc80, #e05c00 72%);
  color: #2c0a00;
  font-family: 'Orbitron', monospace;
  font-weight: 800; font-size: 14px; letter-spacing: 2px;
  box-shadow:
    0 0 28px rgba(255, 130, 40, 0.55),
    0 0 52px rgba(255, 100, 10, 0.22),
    inset 0 1px 3px rgba(255,220,160,0.3);
  touch-action: manipulation;
  cursor: pointer;
  transition: transform 100ms ease, box-shadow 100ms ease;
}
.fire-btn:active { transform: scale(0.94); box-shadow: 0 0 14px rgba(255,130,40,0.4); }

/* ─── Overlay / Start screen ─── */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center;
  padding: 20px; text-align: center; gap: 10px;
  background:
    repeating-linear-gradient(0deg,  transparent, transparent 3px, rgba(80,160,255,0.025) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(80,160,255,0.025) 4px),
    linear-gradient(to bottom, rgba(3,11,20,0.88), rgba(5,18,32,0.97));
}

.overlay h1 {
  margin: 0;
  font-family: 'Orbitron', monospace;
  font-size: clamp(24px, 7vw, 46px);
  letter-spacing: 3px;
  text-shadow: 0 0 24px rgba(80,220,255,0.6), 0 0 48px rgba(40,140,255,0.3);
  color: #9ff;
}

.overlay p {
  margin: 0; font-size: clamp(13px, 3.5vw, 16px);
  opacity: 0.8; color: #a0c8e0;
}

.overlay button {
  justify-self: center; margin-top: 12px;
  min-width: 150px; padding: 12px 18px;
  border: 0; border-radius: 8px;
  font-family: 'Orbitron', monospace;
  font-size: 17px; font-weight: 800;
  color: #021a10;
  background: linear-gradient(135deg, #80ffce, #40d0ff);
  box-shadow: 0 0 22px rgba(80,230,190,0.45), 0 4px 18px rgba(0,0,0,0.4);
  cursor: pointer; letter-spacing: 2px;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.overlay button:hover { transform: scale(1.05); box-shadow: 0 0 32px rgba(80,230,190,0.6), 0 6px 22px rgba(0,0,0,0.5); }
.overlay button:active { transform: scale(0.97); }

.hidden { display: none !important; }

/* ─── Game Over screen ─── */
#go-section {
  animation: go-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
@keyframes go-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.go-crash {
  font-size: 48px;
  animation: go-crash-anim 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  filter: drop-shadow(0 0 16px rgba(255,120,40,0.9));
}
@keyframes go-crash-anim {
  0%   { transform: scale(0.2) rotate(-30deg); opacity: 0; }
  60%  { transform: scale(1.25) rotate(8deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

#go-title {
  margin: 0;
  font-family: 'Orbitron', monospace;
  font-size: clamp(20px, 6vw, 34px);
  letter-spacing: 4px;
  color: #ff7755;
  text-shadow: 0 0 18px rgba(255,100,60,0.6), 0 0 36px rgba(255,60,20,0.3);
}

.go-score-wrap {
  display: flex; flex-direction: column; align-items: center;
  margin: 4px 0;
}
.go-score-label {
  font-family: 'Orbitron', monospace;
  font-size: 9px; letter-spacing: 3px; color: rgba(180,230,255,0.5);
}
.go-score-value {
  font-family: 'Orbitron', monospace;
  font-size: clamp(30px, 10vw, 48px); font-weight: 800;
  color: #ffe060;
  text-shadow: 0 0 22px rgba(255,220,60,0.65);
  animation: go-score-pop 0.45s 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes go-score-pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.go-board {
  width: 100%; max-width: 240px;
  background: rgba(10,30,50,0.7);
  border: 1px solid rgba(80,160,255,0.2);
  border-radius: 8px;
  overflow: hidden;
  margin: 4px 0;
}
.go-board__title {
  font-family: 'Orbitron', monospace;
  font-size: 9px; letter-spacing: 3px;
  color: rgba(120,200,255,0.5);
  padding: 6px 0 4px;
  text-align: center;
  border-bottom: 1px solid rgba(80,160,255,0.15);
}
.go-board__list {
  list-style: none; margin: 0; padding: 4px 0;
}
.go-board__list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 14px;
  font-family: 'Orbitron', monospace;
  font-size: 12px; font-weight: 700;
  color: #c8e8ff;
  opacity: 0;
  animation: go-row-in 0.35s ease both;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.2s;
}
.go-board__list li:last-child { border-bottom: none; }
.go-board__list li.gold   { color: #ffe060; background: rgba(255,220,60,0.07); }
.go-board__list li.silver { color: #d0e8f8; background: rgba(180,220,255,0.04); }
.go-board__list li.bronze { color: #f0b878; background: rgba(220,160,80,0.04); }
.go-board__list li.new-entry { animation: go-row-in 0.35s ease both, pulse-new 0.5s 0.4s ease; }
@keyframes go-row-in {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulse-new {
  0%,100% { background: rgba(255,220,60,0.07); }
  50%      { background: rgba(255,220,60,0.22); }
}
.go-rank { opacity: 0.55; min-width: 22px; }
.go-pts  { font-size: 14px; }

#go-restart {
  justify-self: center; margin-top: 4px;
  min-width: 160px; padding: 11px 18px;
  border: 0; border-radius: 8px;
  font-family: 'Orbitron', monospace;
  font-size: 14px; font-weight: 800;
  color: #021a10;
  background: linear-gradient(135deg, #80ffce, #40d0ff);
  box-shadow: 0 0 22px rgba(80,230,190,0.45), 0 4px 18px rgba(0,0,0,0.4);
  cursor: pointer; letter-spacing: 2px;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
#go-restart:hover { transform: scale(1.05); box-shadow: 0 0 32px rgba(80,230,190,0.6); }
#go-restart:active { transform: scale(0.97); }



/* Power-up status chip */
.powerup-status {
  font-family: 'Orbitron', monospace;
  font-size: 9px; letter-spacing: 1px;
  color: #ffe060; text-shadow: 0 0 6px rgba(255,220,60,0.6);
  min-height: 14px; text-align: center;
}

/* Intro plane animation */
.overlay__plane {
  font-size: 36px;
  display: block;
  margin-bottom: 4px;
  will-change: transform, opacity;
  filter: drop-shadow(0 0 12px rgba(80,200,255,0.6));
}

/* Version selector */
.ver-select {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin: 10px 0 4px;
}
.ver-select__label {
  font-family: 'Orbitron', monospace;
  font-size: 8px; letter-spacing: 2px; opacity: 0.45; color: #7ac8ee;
}
.ver-select__btns {
  display: flex; gap: 6px;
}
.ver-btn {
  font-family: 'Orbitron', monospace; font-size: 11px; font-weight: 700;
  padding: 6px 14px; border-radius: 20px; cursor: pointer;
  border: 1px solid rgba(100,200,255,0.3);
  background: rgba(6,22,40,0.5); color: rgba(150,210,255,0.6);
  text-decoration: none; transition: all 150ms ease;
  letter-spacing: 0.5px;
}
.ver-btn:hover { background: rgba(80,180,255,0.12); color: #9ff; }
.ver-btn--active {
  background: rgba(80,180,255,0.18);
  border-color: rgba(100,200,255,0.7);
  color: #d8f6ff;
  box-shadow: 0 0 10px rgba(80,200,255,0.2);
  cursor: default;
}
