/* =========================================================
   NEON PULSE — STYLESHEET
   Modern dark neon theme, glassmorphism, CSS variables,
   keyframe animations, fully responsive (mobile + desktop).
   ========================================================= */

:root {
  /* ---- Color Palette (edit these to re-theme the whole game) ---- */
  --bg-void: #05050f;
  --bg-primary: #0a0a1f;
  --bg-secondary: #12122a;

  --neon-cyan: #00f0ff;
  --neon-pink: #ff2ec4;
  --neon-purple: #9d4dff;
  --neon-yellow: #ffe14d;
  --neon-green: #39ff9d;
  --neon-red: #ff3b5c;

  --gradient-main: linear-gradient(135deg, var(--neon-purple), var(--neon-pink) 50%, var(--neon-cyan));
  --gradient-btn: linear-gradient(135deg, #00f0ff, #9d4dff);
  --gradient-danger: linear-gradient(135deg, #ff2ec4, #ff3b5c);

  --glass-bg: rgba(18, 18, 42, 0.55);
  --glass-border: rgba(255, 255, 255, 0.12);

  --text-main: #f2f2ff;
  --text-dim: #9a9ac0;

  --radius-lg: 24px;
  --radius-md: 14px;
  --radius-sm: 8px;

  --shadow-neon-cyan: 0 0 8px var(--neon-cyan), 0 0 24px rgba(0, 240, 255, 0.4);
  --shadow-neon-pink: 0 0 8px var(--neon-pink), 0 0 24px rgba(255, 46, 196, 0.4);
}

/* ---------------------------- RESET ---------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-void);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
  overscroll-behavior: none;
  touch-action: none;
}

body {
  background:
    radial-gradient(circle at 20% 20%, rgba(157, 77, 255, 0.15), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(0, 240, 255, 0.15), transparent 40%),
    var(--bg-void);
  position: relative;
}

/* ---------------------------- CANVAS ---------------------------- */
#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
}

/* ---------------------------- SCREENS ---------------------------- */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
  background: rgba(5, 5, 15, 0.55);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.35s ease;
}

.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------------------------- GLASS PANEL ---------------------------- */
.glass-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: panelPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes panelPop {
  from { transform: scale(0.85) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ---------------------------- TITLES ---------------------------- */
.game-title {
  font-size: clamp(2rem, 8vw, 3.2rem);
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--text-main);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

.game-title span {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(157, 77, 255, 0.6));
}

.tagline {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.pause-title, .gameover-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.gameover-title {
  background: var(--gradient-danger);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 10px rgba(255, 46, 196, 0.5));
}

/* ---------------------------- STAT CHIPS ---------------------------- */
.stat-chip-row {
  display: flex;
  gap: 12px;
  margin: 8px 0;
}

.stat-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 10px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--neon-yellow);
  text-shadow: 0 0 10px rgba(255, 225, 77, 0.5);
}

/* ---------------------------- BUTTONS ---------------------------- */
.btn {
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  position: relative;
  overflow: hidden;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--gradient-btn);
  color: #05050f;
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.45), 0 4px 14px rgba(0,0,0,0.35);
}

.btn-primary:hover { filter: brightness(1.12); box-shadow: 0 0 28px rgba(0, 240, 255, 0.65); }

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
}

.btn-secondary:hover { background: rgba(255, 255, 255, 0.12); }

.sound-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.sound-toggle:active { transform: scale(0.9); }

.start-panel { position: relative; }

/* ---------------------------- MODALS ---------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  padding: 20px;
}

.modal-panel { max-width: 460px; text-align: left; align-items: stretch; }
.modal-panel h2 { text-align: center; margin-bottom: 6px; letter-spacing: 1px; }

.howto-list { list-style: none; display: flex; flex-direction: column; gap: 12px; margin: 10px 0; }
.howto-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}
.howto-icon { font-size: 1.2rem; flex-shrink: 0; }
.howto-list b { color: var(--text-main); }

.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
  max-height: 50vh;
  overflow-y: auto;
}

.achievement-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  opacity: 0.45;
  filter: grayscale(0.7);
}

.achievement-item.unlocked {
  opacity: 1;
  filter: none;
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.15);
}

.achievement-icon { font-size: 1.5rem; }
.achievement-info { display: flex; flex-direction: column; gap: 2px; }
.achievement-info strong { font-size: 0.9rem; }
.achievement-info span { font-size: 0.75rem; color: var(--text-dim); }

/* ---------------------------- LOADING SCREEN ---------------------------- */
#loading-screen { background: var(--bg-void); flex-direction: column; z-index: 100; }

.loader-content { display: flex; flex-direction: column; align-items: center; gap: 18px; }

.loader-orb {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--gradient-main);
  box-shadow: 0 0 30px rgba(157, 77, 255, 0.7), 0 0 60px rgba(0, 240, 255, 0.4);
  animation: orbPulse 1.1s ease-in-out infinite;
}

@keyframes orbPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

.loader-title {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--text-main);
}
.loader-title span {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.loader-bar-track {
  width: 220px;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  overflow: hidden;
}
.loader-bar-fill {
  width: 0%;
  height: 100%;
  background: var(--gradient-btn);
  box-shadow: var(--shadow-neon-cyan);
  transition: width 0.15s ease;
}
.loader-text { font-size: 0.8rem; color: var(--text-dim); letter-spacing: 1px; }

/* ---------------------------- HUD ---------------------------- */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 14px 0 14px;
  pointer-events: none;
}

.hud-top {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.hud-chip {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.hud-icon { font-size: 1rem; }

.combo-chip {
  color: var(--neon-yellow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.combo-chip.combo-hot {
  box-shadow: 0 0 16px rgba(255, 225, 77, 0.6);
  animation: comboPulse 0.4s ease infinite alternate;
}
@keyframes comboPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

.hud-lives { display: flex; gap: 4px; margin-left: auto; }
.life-heart {
  font-size: 1.1rem;
  filter: drop-shadow(0 0 6px rgba(255, 59, 92, 0.6));
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.life-heart.lost { opacity: 0.2; transform: scale(0.7); filter: none; }

.icon-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}
.icon-btn:active { transform: scale(0.9); }

.powerup-bar {
  display: flex;
  gap: 8px;
  pointer-events: none;
}
.powerup-badge {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  animation: fadeIn 0.2s ease;
}

/* ---------------------------- EVENT BANNER ---------------------------- */
#event-banner {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translate(-50%, -20px);
  z-index: 40;
  background: var(--gradient-danger);
  padding: 10px 26px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 2px;
  font-size: 1rem;
  box-shadow: 0 0 30px rgba(255, 46, 196, 0.6);
  pointer-events: none;
  animation: bannerIn 0.4s ease forwards;
}
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, -40px) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  85% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(0.9); }
}

/* ---------------------------- TOASTS ---------------------------- */
#toast-container {
  position: fixed;
  top: max(80px, calc(env(safe-area-inset-top) + 70px));
  right: 14px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--glass-bg);
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  backdrop-filter: blur(12px);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 200px;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}
.toast strong { font-size: 0.85rem; }
.toast span.sub { font-size: 0.72rem; color: var(--text-dim); display: block; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ---------------------------- GAME OVER STATS ---------------------------- */
.gameover-stats { width: 100%; display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 0.9rem;
}
.stat-row span:last-child { font-weight: 800; color: var(--neon-cyan); }
.stat-row.highlight span:last-child { color: var(--neon-yellow); }

#new-highscore-badge {
  background: var(--gradient-btn);
  color: #05050f;
  font-weight: 900;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.6);
  animation: comboPulse 0.5s ease infinite alternate;
}

/* ---------------------------- SCREEN SHAKE ---------------------------- */
.shake { animation: shakeAnim 0.35s ease; }
@keyframes shakeAnim {
  10%, 90% { transform: translate(-2px, 1px); }
  20%, 80% { transform: translate(4px, -2px); }
  30%, 50%, 70% { transform: translate(-6px, 3px); }
  40%, 60% { transform: translate(6px, -3px); }
}

/* ---------------------------- SCROLLBAR ---------------------------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

/* ---------------------------- RESPONSIVE ---------------------------- */
@media (max-width: 480px) {
  .glass-panel { padding: 26px 20px; border-radius: var(--radius-md); }
  .hud-chip { padding: 6px 10px; font-size: 0.82rem; }
  .icon-btn { width: 34px; height: 34px; }
  #event-banner { font-size: 0.82rem; padding: 8px 18px; }
}

@media (min-width: 900px) {
  .glass-panel { padding: 46px 44px; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .glass-panel { padding: 16px 24px; gap: 8px; }
  .game-title { font-size: 1.6rem; }
  .howto-list, .achievements-list { max-height: 30vh; }
}

