:root {
  --bg: #080B18;
  --bg2: #11182B;
  --blue: #35D9FF;
  --purple: #9B5CFF;
  --pink: #FF3D81;
  --target: #FF4D5A;
  --success: #5CFF9D;
  --gold: #FFD84D;
  --text: #E9F3FF;
  --text-dim: #93A2C4;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Rajdhani', system-ui, -apple-system, 'Segoe UI', sans-serif;
  overscroll-behavior: none;
}
body { min-height: 100vh; display: flex; flex-direction: column; }

a { color: var(--blue); }

.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; gap: 12px;
  background: linear-gradient(180deg, #0c1122, #080B18);
  border-bottom: 1px solid rgba(53,217,255,0.15);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: 0.5px; font-size: 20px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 10px var(--blue); }
.brand small { color: var(--text-dim); font-weight: 600; font-size: 12px; }

.ad-slot { min-height: 0; text-align: center; color: var(--text-dim); font-size: 11px; }
.ad-slot.top { padding: 4px 0; }

main.wrap { max-width: 980px; margin: 0 auto; width: 100%; padding: 12px 12px 40px; flex: 1; }

#game-stage {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  aspect-ratio: 3 / 2;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(53,217,255,0.25);
  box-shadow: 0 0 40px rgba(53,217,255,0.08), inset 0 0 60px rgba(0,0,0,0.4);
  background: #05070f;
  touch-action: none;
}
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px;
  pointer-events: none;
  z-index: 5;
}
#hud .row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; line-height: 1.05; }
.stat .k { font-size: 10px; letter-spacing: 1px; color: var(--text-dim); text-transform: uppercase; }
.stat .v { font-size: 18px; font-weight: 800; text-shadow: 0 0 12px rgba(53,217,255,0.5); }
.spacer { flex: 1; }
.icon-btn {
  pointer-events: auto;
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(17,24,43,0.75); border: 1px solid rgba(53,217,255,0.3);
  color: var(--text); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--blue); }
.icon-btn[hidden] { display: none; } /* higher specificity than .icon-btn's display:flex, which otherwise wins the tie against the UA [hidden] rule */
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; } /* same trap one level down: ".icon-btn svg" outranks the UA [hidden] rule on its own, so the two-icon-state swap needs its own explicit override too */

/* Persistent fullscreen toggle: sits above the HUD, screens, and combo
   banner (all <=10) so it stays reachable from the menu and every modal
   screen, not only mid-gameplay.
   It's a sibling of #hud (not a child), positioned independently, so it
   stays visible on the menu screen where #hud is hidden entirely — but
   that independence is exactly why its first version (right: 10px, same
   corner as #hud's mute+pause buttons) sat directly on top of #btn-pause
   during real gameplay, hiding/blocking it. Reserving the mute+pause
   cluster's own width (hud's right padding 12px + pause 34px + gap 14px
   + mute 34px + gap 14px = 108px) puts this button immediately to their
   left instead — beside the group, never covering it — while the fixed
   offset is unaffected by #hud's hidden/visible state either way. */
#btn-fullscreen {
  position: absolute; top: 10px; right: 108px; z-index: 20;
}
/* Two separate rules, not a comma list — some older engines drop an
   entire grouped selector if any one clause in it is unrecognized. */
#game-stage:fullscreen {
  max-width: none; width: 100%; height: 100%;
  aspect-ratio: auto; border-radius: 0; border: none;
}
#game-stage:-webkit-full-screen {
  max-width: none; width: 100%; height: 100%;
  aspect-ratio: auto; border-radius: 0; border: none;
}

#ammo-indicator {
  position: absolute; left: 12px; bottom: 10px; z-index: 5;
  display: flex; align-items: center; gap: 6px;
  background: rgba(8,11,24,0.55); padding: 6px 10px; border-radius: 20px;
  border: 1px solid rgba(53,217,255,0.2);
}
.bullet-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 6px var(--blue); }
.bullet-dot.used { background: #2a3350; box-shadow: none; }
#bounce-indicator {
  position: absolute; right: 12px; bottom: 10px; z-index: 5;
  background: rgba(8,11,24,0.55); padding: 6px 10px; border-radius: 20px;
  border: 1px solid rgba(255,61,129,0.25);
  font-weight: 700; font-size: 13px;
}

#combo-banner {
  position: absolute; top: 46%; left: 50%; transform: translate(-50%, -50%);
  font-size: 34px; font-weight: 900; letter-spacing: 1px;
  color: var(--gold); text-shadow: 0 0 20px var(--gold);
  opacity: 0; pointer-events: none; z-index: 6;
  transition: opacity 0.15s, transform 0.15s;
}
#combo-banner.show { opacity: 1; transform: translate(-50%, -55%); }

.screen {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 16px 24px;
  background: rgba(5,7,15,0.86);
  backdrop-filter: blur(3px);
  overflow-y: auto;
  justify-content: flex-start;
}
.screen.center { justify-content: center; }
.screen[hidden] { display: none; }

.panel {
  width: 100%; max-width: 420px;
  background: linear-gradient(180deg, rgba(17,24,43,0.9), rgba(8,11,24,0.9));
  border: 1px solid rgba(53,217,255,0.25);
  border-radius: 16px;
  padding: 22px 20px;
  text-align: center;
  box-shadow: 0 0 40px rgba(53,217,255,0.08);
  margin: auto;
}
.panel h1, .panel h2 { margin: 0 0 6px; letter-spacing: 0.5px; }
.panel h1 { font-size: 28px; text-shadow: 0 0 16px var(--blue); }
.panel h2 { font-size: 22px; }
.panel p.tagline { color: var(--text-dim); margin: 0 0 18px; font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px 18px; margin-top: 10px;
  border-radius: 10px; border: none; cursor: pointer;
  font-weight: 800; font-size: 15px; letter-spacing: 0.4px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #06101c;
}
.btn.secondary { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid rgba(255,255,255,0.15); }
.btn.ghost { background: transparent; color: var(--text-dim); border: 1px solid rgba(255,255,255,0.1); }
.btn:active { transform: scale(0.98); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.stat-box { background: rgba(255,255,255,0.04); border-radius: 10px; padding: 10px; }
.stat-box .k { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-box .v { font-size: 20px; font-weight: 800; margin-top: 2px; }

input[type=text].nickname {
  width: 100%; padding: 12px 14px; border-radius: 10px; margin-top: 8px;
  border: 1px solid rgba(53,217,255,0.35); background: rgba(255,255,255,0.05);
  color: var(--text); font-size: 15px; text-align: center;
}
.hint { font-size: 11px; color: var(--text-dim); margin-top: 6px; }
.error-text { color: var(--target); font-size: 12px; min-height: 16px; margin-top: 4px; }
.status-text { color: var(--success); font-size: 13px; min-height: 16px; margin-top: 6px; }

.leaderboard-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.leaderboard-tabs button {
  flex: 1; padding: 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04); color: var(--text-dim); cursor: pointer; font-weight: 700;
}
.leaderboard-tabs button.active { color: var(--bg); background: var(--blue); border-color: var(--blue); }
table.lb { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
table.lb th { color: var(--text-dim); font-size: 11px; text-transform: uppercase; padding: 6px 4px; text-align: left; }
table.lb td { padding: 7px 4px; border-top: 1px solid rgba(255,255,255,0.06); }
table.lb tr.me { background: rgba(53,217,255,0.12); }
.rank-1 { color: var(--gold); } .rank-2 { color: #d8dde8; } .rank-3 { color: #e0a15c; }

details.faq { background: rgba(255,255,255,0.03); border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
details.faq summary { cursor: pointer; font-weight: 700; }

.section { margin: 34px auto 0; max-width: 900px; }
.section h2 { font-size: 22px; }
.section h3 { font-size: 15px; color: var(--blue); }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.how-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 14px; }
.how-card .num { color: var(--blue); font-weight: 900; font-size: 18px; }
.related-games { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.related-games a { display: inline-block; padding: 8px 14px; border-radius: 20px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); text-decoration: none; font-size: 13px; }

footer.site-footer { text-align: center; padding: 24px 12px; color: var(--text-dim); font-size: 12px; }

@media (max-width: 600px) {
  #game-stage { aspect-ratio: 3 / 4.2; max-width: 600px; }
  .stat .v { font-size: 15px; }
  .panel h1 { font-size: 22px; }
}
