/* ── Intergalactic Raiders — kgames.nl ── */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Exo+2:wght@300;400;600&display=swap');

:root {
  --cyan:   #4cc9f0;
  --gold:   #ffd60a;
  --red:    #ff2d55;
  --green:  #39ff14;
  --bg:     #020210;
  --bg2:    #0a0a1e;
  --panel:  rgba(255,255,255,0.04);
  --border: rgba(76,201,240,0.15);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width:100%; height:100%; overflow:hidden;
  background: var(--bg);
  color: #fff;
  font-family: 'Exo 2', sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body { display: flex; align-items: center; justify-content: center; }

/* ── SCREENS ── */
.screen {
  display: none; position: relative; z-index: 1;
  width: 100%; max-width: 500px;
  align-items: center; flex-direction: column;
  padding: 56px 20px 30px;
  min-height: 100vh; min-height: 100dvh;
  overflow-y: auto;
}
.screen.active { display: flex; }

/* ── LOGO ── */
.logo {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(28px, 9vw, 44px);
  font-weight: 900;
  text-align: center;
  line-height: 1.05;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #4cc9f0, #7b2fff, #ff2d55);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 20px rgba(76,201,240,0.4));
}

/* ── CHALLENGE BANNER ── */
#challenge-banner {
  display: none; font-family:'Orbitron',sans-serif; font-size:11px;
  color: var(--gold); border:1px solid rgba(255,214,10,0.4);
  border-radius:6px; padding:6px 12px; margin-bottom:8px;
  text-align:center;
}
#challenge-banner.visible { display:block; }

/* ── SHIP PREVIEW ── */
#ball-preview {
  width:90px; height:90px; margin:4px auto 8px;
  background: radial-gradient(circle, rgba(76,201,240,0.05) 0%, transparent 70%);
  border-radius:50%;
}

/* ── STATS ROW ── */
.stats-row {
  display: flex; gap: 10px; width: 100%; margin-bottom: 10px;
}
.stat-box {
  flex:1; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 6px; text-align: center;
}
.stat-label {
  font-family:'Orbitron',sans-serif; font-size:7px;
  letter-spacing:2px; color:rgba(255,255,255,0.35); text-transform:uppercase; margin-bottom:3px;
}
.stat-value { font-family:'Orbitron',sans-serif; font-size:18px; font-weight:700; }
.stat-value.gold { color:var(--gold); }

.xp-bar-wrap {
  width:100%; background:rgba(255,255,255,0.05); border-radius:999px;
  height:7px; margin-bottom:4px; overflow:hidden; border:1px solid var(--border);
}
.xp-bar-fill {
  height:100%; border-radius:999px;
  background: linear-gradient(90deg, #4cc9f0, #7b2fff);
  transition: width 0.5s ease;
}
.xp-label {
  font-size:10px; color:rgba(255,255,255,0.3);
  text-align:right; margin-bottom:12px;
}

.best-row {
  display:flex; justify-content:space-between; align-items:center;
  width:100%; background:var(--panel); border:1px solid var(--border);
  border-radius:10px; padding:10px 14px; margin-bottom:14px;
}
.best-label { font-family:'Orbitron',sans-serif; font-size:9px; letter-spacing:2px; color:rgba(255,255,255,0.35); }
.best-value { font-family:'Orbitron',sans-serif; font-size:20px; font-weight:700; color:var(--gold); }

/* ── BUTTONS ── */
.btn {
  width:100%; padding:14px; border-radius:10px; border:none;
  font-family:'Orbitron',sans-serif; font-size:12px; font-weight:700;
  letter-spacing:2px; cursor:pointer; margin-bottom:8px; transition:all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, #7b2fff, #4cc9f0);
  color:#fff; box-shadow: 0 0 24px rgba(123,47,255,0.4);
}
.btn-primary:hover { transform:scale(1.02); box-shadow:0 0 36px rgba(76,201,240,0.5); }
.btn-secondary {
  background: var(--panel); color:rgba(255,255,255,0.7);
  border:1px solid var(--border);
}
.btn-secondary:hover { border-color:var(--cyan); background:rgba(76,201,240,0.07); }
.btn-daily {
  background:linear-gradient(135deg,#2d6a4f,#40916c); color:#fff;
  border:1px solid #52b788; display:none;
}
.btn-daily.visible { display:block; }

#kgames-collection-btn {
  display:block; margin-top:6px; font-size:10px; color:rgba(255,255,255,0.25);
  text-decoration:none; text-align:center;
}
#kgames-collection-btn:hover { color:rgba(255,255,255,0.5); }

/* ── TOP BARS ── */
#top-btn-bar {
  position:fixed; top:12px; right:12px; z-index:1000;
  display:none; align-items:center; gap:6px;
}
#top-btn-bar.visible { display:flex; }
#shop-btn {
  background:linear-gradient(135deg,var(--gold),#ff9f0a); color:#000;
  border:none; padding:7px 13px; border-radius:8px;
  font-family:'Orbitron',sans-serif; font-size:10px; font-weight:700;
  letter-spacing:1px; cursor:pointer; transition:all 0.2s; white-space:nowrap;
}
#shop-btn:hover { transform:scale(1.05); }
#auth-top-btn {
  background:var(--panel); color:var(--cyan);
  border:1px solid rgba(76,201,240,0.4);
  padding:7px 13px; border-radius:8px;
  font-family:'Orbitron',sans-serif; font-size:10px; font-weight:700;
  letter-spacing:1px; cursor:pointer; transition:all 0.2s; white-space:nowrap;
}
#auth-top-btn:hover { background:rgba(76,201,240,0.1); border-color:var(--cyan); }
#auth-top-btn.logged-in { color:rgba(255,255,255,0.5); border-color:var(--border); font-size:9px; }

#top-left-bar {
  position:fixed; top:12px; left:12px; z-index:1000;
  display:none; align-items:center; gap:6px;
}
#top-left-bar.visible { display:flex; }
.top-left-btn {
  background:var(--panel); color:rgba(255,255,255,0.65);
  border:1px solid var(--border); padding:7px 13px; border-radius:8px;
  font-family:'Orbitron',sans-serif; font-size:10px; font-weight:700;
  letter-spacing:1px; cursor:pointer; transition:all 0.2s; white-space:nowrap;
}
.top-left-btn:hover { border-color:var(--cyan); color:var(--cyan); }

/* ── GAME SCREEN ── */
#game-screen {
  height:100vh; height:100dvh; overflow:hidden;
  align-items:center; background:var(--bg); padding:0;
}
#game-screen > * { max-width:500px; width:100%; }

#hud {
  display:flex; justify-content:space-between; align-items:center;
  padding:7px 14px; background:rgba(0,0,0,0.7);
  border-bottom:1px solid var(--border); flex-shrink:0;
}
.hud-item { text-align:center; }
.hud-label { font-size:7px; letter-spacing:2px; color:rgba(255,255,255,0.35); text-transform:uppercase; }
.hud-value { font-family:'Orbitron',sans-serif; font-size:15px; font-weight:700; color:#fff; }
.hud-value.cyan { color:var(--cyan); }
.hud-value.gold { color:var(--gold); }
.hud-value.red  { color:var(--red);  }

#game-canvas-wrap {
  flex:1; min-height:0; max-width:500px; width:100%;
  position:relative; display:flex; justify-content:center; overflow:hidden;
}
#game-canvas {
  display:block; background:var(--bg);
  touch-action:none; cursor:crosshair; max-height:100%; max-width:100%;
}

/* ── POWERUP BAR ── */
#powerup-bar {
  width:100%; max-width:500px;
  display:flex; gap:3px; padding:4px 6px;
  background:rgba(0,0,0,0.7); border-top:1px solid var(--border);
  justify-content:center; align-items:center;
  flex-shrink:0; overflow-x:auto; scrollbar-width:none; flex-wrap:nowrap;
}
#powerup-bar::-webkit-scrollbar { display:none; }
.powerup-slot {
  display:flex; align-items:center; gap:2px;
  background:var(--panel); border:1px solid var(--border);
  border-radius:5px; padding:3px 5px; font-size:10px;
  opacity:0.3; transition:opacity 0.25s; cursor:pointer;
  user-select:none; flex-shrink:0;
}
.powerup-slot.has-items { opacity:1; }
.powerup-slot.has-items:hover { background:rgba(76,201,240,0.1); }
.powerup-slot .pu-icon  { font-size:13px; line-height:1; }
.powerup-slot .pu-count { font-family:'Orbitron',sans-serif; font-size:9px; font-weight:700; color:var(--cyan); min-width:8px; text-align:center; }
.pu-pause, .pu-mute {
  padding:3px 8px; border-radius:5px; border:1px solid var(--border);
  background:var(--panel); color:rgba(255,255,255,0.6); cursor:pointer;
  font-size:12px; transition:all 0.2s; flex-shrink:0;
}
.pu-pause:hover { border-color:var(--cyan); color:#fff; }
.pu-mute:hover  { border-color:var(--gold); color:var(--gold); }
.pu-mute.muted  { color:var(--red); border-color:rgba(255,45,85,0.4); }

/* ── OVERLAYS ── */
.overlay {
  position:fixed; inset:0;
  background:rgba(0,0,0,0.88); backdrop-filter:blur(14px);
  display:none; align-items:center; justify-content:center;
  z-index:500; flex-direction:column; padding:20px;
}
.overlay.active { display:flex; }
.overlay-panel {
  background:var(--bg2); border:1px solid var(--border);
  border-radius:16px; padding:28px 24px;
  width:100%; max-width:420px;
  display:flex; flex-direction:column; align-items:center; gap:6px;
  position:relative;
  max-height:90vh; overflow-y:auto; scrollbar-width:thin;
}
.overlay-title {
  font-family:'Orbitron',sans-serif; font-size:22px; font-weight:900;
  letter-spacing:3px; text-align:center; margin-bottom:4px;
}
.overlay-title.cyan { color:var(--cyan); text-shadow:0 0 20px rgba(76,201,240,0.5); }
.overlay-title.red  { color:var(--red);  text-shadow:0 0 20px rgba(255,45,85,0.5); }
.overlay-title.gold { color:var(--gold); text-shadow:0 0 20px rgba(255,214,10,0.4); }
.overlay-sub  { font-size:12px; color:rgba(255,255,255,0.4); text-align:center; margin-bottom:6px; }
.overlay-score {
  font-family:'Orbitron',sans-serif; font-size:42px; font-weight:900;
  color:var(--cyan); text-shadow:0 0 30px rgba(76,201,240,0.6);
  margin:8px 0;
}
.overlay-level-reached {
  font-family:'Orbitron',sans-serif; font-size:11px;
  color:rgba(255,255,255,0.4); letter-spacing:2px; margin-bottom:8px;
}
.close-btn {
  position:absolute; top:11px; right:11px;
  background:none; border:none; color:rgba(255,255,255,0.4);
  font-size:22px; cursor:pointer; padding:4px 8px; border-radius:6px;
}
.close-btn:hover { color:#fff; background:rgba(255,255,255,0.06); }

/* ── SHOP ── */
#shop-overlay .overlay-panel { max-width:440px; max-height:88vh; overflow-y:auto; }
.shop-tabs {
  display:flex; gap:4px; width:100%; flex-wrap:wrap; margin-bottom:10px;
}
.shop-tab {
  flex:1; min-width:60px; padding:6px 4px; border-radius:7px;
  border:1px solid var(--border); background:var(--panel);
  font-family:'Orbitron',sans-serif; font-size:8px; font-weight:700;
  letter-spacing:1px; cursor:pointer; text-align:center;
  color:rgba(255,255,255,0.5); transition:all 0.2s;
}
.shop-tab:hover { border-color:var(--cyan); color:var(--cyan); }
.shop-tab.active {
  border-color:var(--cyan); color:var(--cyan);
  background:rgba(76,201,240,0.08);
}
.coins-tab { color:var(--gold) !important; border-color:rgba(255,214,10,0.3) !important; }
.coins-tab.active { border-color:var(--gold) !important; background:rgba(255,214,10,0.08) !important; }

.shop-grid {
  display:grid; grid-template-columns:repeat(3,1fr); gap:8px; width:100%;
}
.shop-grid-3 { grid-template-columns:repeat(3,1fr); }
/* Coin packs always 2 columns so 4 packs = 2×2 grid, no scrolling */
.shop-grid.coinpack-grid { grid-template-columns:repeat(2,1fr); }
.shop-item {
  background:var(--panel); border:1px solid var(--border);
  border-radius:11px; padding:10px 6px;
  display:flex; flex-direction:column; align-items:center; gap:3px;
  cursor:pointer; transition:all 0.18s; position:relative;
}
.shop-item:hover { border-color:var(--cyan); background:rgba(76,201,240,0.06); }
.shop-item.selected { border-color:var(--cyan); background:rgba(76,201,240,0.1); }
.si-icon { font-size:22px; line-height:1; }
.si-name { font-family:'Orbitron',sans-serif; font-size:8px; font-weight:700; letter-spacing:1px; text-align:center; }
.si-desc { font-size:8px; color:rgba(255,255,255,0.35); text-align:center; line-height:1.3; }
.si-price { font-family:'Orbitron',sans-serif; font-size:10px; color:var(--gold); display:flex; align-items:center; justify-content:center; gap:2px; }
.si-price.free { color:#52b788; }
.si-price.sel  { color:var(--cyan); }
.si-badge { position:absolute; top:5px; right:5px; background:var(--cyan); color:#000; font-size:7px; font-weight:700; padding:2px 4px; border-radius:3px; font-family:'Orbitron',sans-serif; }

.coinpack-item { transition:transform 0.15s, box-shadow 0.15s; }
.coinpack-item:hover { transform:translateY(-2px); box-shadow:0 4px 20px rgba(76,201,240,0.2); }

/* ── LEADERBOARD ── */
#leaderboard-overlay .overlay-panel { max-width:420px; max-height:88vh; overflow-y:auto; }
.lb-tabs { display:flex; gap:6px; width:100%; margin-bottom:10px; }
.lb-tab {
  flex:1; padding:7px; border-radius:7px; border:1px solid var(--border);
  background:var(--panel); font-family:'Orbitron',sans-serif; font-size:9px;
  font-weight:700; letter-spacing:1px; cursor:pointer; text-align:center;
  color:rgba(255,255,255,0.4); transition:all 0.2s;
}
.lb-tab.active { border-color:var(--gold); color:var(--gold); background:rgba(255,214,10,0.06); }
.lb-entry {
  display:flex; align-items:center; gap:10px; padding:8px 10px;
  border-bottom:1px solid rgba(255,255,255,0.04); width:100%;
}
.lb-entry.top1 { background:rgba(255,214,10,0.06); border-radius:8px; }
.lb-entry.top2 { background:rgba(180,180,180,0.05); }
.lb-entry.top3 { background:rgba(205,127,50,0.05); }
.lb-rank { font-family:'Orbitron',sans-serif; font-size:13px; font-weight:700; min-width:26px; text-align:center; }
.lb-rank.gold { color:var(--gold); }
.lb-name  { flex:1; font-size:13px; }
.lb-score { font-family:'Orbitron',sans-serif; font-size:12px; color:var(--cyan); font-weight:700; }

/* ── ACHIEVEMENTS ── */
#achievements-overlay .overlay-panel { max-width:430px; max-height:88vh; overflow-y:auto; }
.ach-grid { width:100%; display:flex; flex-direction:column; gap:4px; }
.ach-cat-header {
  font-family:'Orbitron',sans-serif; font-size:8px; letter-spacing:2px;
  color:rgba(255,255,255,0.3); text-transform:uppercase;
  padding:8px 4px 2px; border-bottom:1px solid var(--border); margin-top:4px;
}
.ach-item {
  display:flex; align-items:center; gap:10px; padding:8px 10px;
  background:var(--panel); border:1px solid transparent;
  border-radius:9px; opacity:0.4;
}
.ach-item.unlocked { opacity:1; border-color:rgba(76,201,240,0.2); }
.ach-icon  { font-size:20px; min-width:28px; text-align:center; }
.ach-text  { flex:1; }
.ach-name  { font-family:'Orbitron',sans-serif; font-size:10px; font-weight:700; margin-bottom:1px; }
.ach-desc  { font-size:10px; color:rgba(255,255,255,0.4); }
.ach-check { color:var(--cyan); font-size:16px; opacity:0; }
.ach-item.unlocked .ach-check { opacity:1; }

/* ── AUTH ── */
#auth-overlay a { text-decoration:none; }
#auth-overlay a:hover { text-decoration:underline; }

/* ── TOAST ── */
#toast {
  position:fixed; top:72px; left:50%; transform:translateX(-50%) translateY(-10px);
  background:rgba(10,10,30,0.95); border:1px solid var(--border);
  border-radius:20px; padding:9px 18px; font-size:13px;
  color:#fff; z-index:9999; opacity:0; transition:all 0.28s;
  pointer-events:none; white-space:nowrap; max-width:90vw;
}
#toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* ── LEVELUP BANNER ── */
#levelup-banner {
  position:fixed; top:110px; left:50%; transform:translateX(-50%) translateY(-20px);
  font-family:'Orbitron',sans-serif; font-size:13px; font-weight:700;
  color:var(--cyan); letter-spacing:3px; z-index:300;
  opacity:0; transition:all 0.35s; pointer-events:none;
}
#levelup-banner.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* ── PARTICLES ── */
#particle-canvas { position:fixed; inset:0; pointer-events:none; z-index:2; }

/* ── COIN ICON ── */
.coin-icon {
  display:inline-flex; align-items:center; justify-content:center;
  width:15px; height:15px; flex-shrink:0; vertical-align:middle;
}
.coin-icon svg { width:100%; height:100%; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width:3px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }
