/* ═══════════════════════════════════════════
   PONG ULTRA — Industry-Level Stylesheet
   ═══════════════════════════════════════════ */

/* ── CSS Theme Variables (updated via body[data-theme]) ── */
:root {
  --primary:       #00fff7;
  --secondary:     #ff00ff;
  --bg-dark:       #050510;
  --glow:          0 0 12px var(--primary), 0 0 30px var(--primary);
  --glow-sm:       0 0 6px var(--primary);
  --glass-bg:      rgba(5, 5, 20, 0.84);
  --glass-border:  rgba(0, 255, 247, 0.22);
  --font:          'Orbitron', monospace;
  --font-sub:      'Rajdhani', sans-serif;
}
body[data-theme="retro"] {
  --primary:      #ff6b35;  --secondary:  #ffd700;
  --bg-dark:      #0d0400;
  --glow:         0 0 12px #ff6b35, 0 0 30px #ff6b35;
  --glow-sm:      0 0 6px  #ff6b35;
  --glass-border: rgba(255,107,53, 0.22);
}
body[data-theme="matrix"] {
  --primary:      #00ff41;  --secondary:  #00cc33;
  --bg-dark:      #000800;
  --glow:         0 0 12px #00ff41, 0 0 30px #00ff41;
  --glow-sm:      0 0 6px  #00ff41;
  --glass-border: rgba(0, 255, 65, 0.22);
}
body[data-theme="gold"] {
  --primary:      #ffd700;  --secondary:  #ff8c00;
  --bg-dark:      #080600;
  --glow:         0 0 12px #ffd700, 0 0 30px #ffd700;
  --glow-sm:      0 0 6px  #ffd700;
  --glass-border: rgba(255,215,0, 0.22);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100vw; height: 100vh;
  overflow: hidden;
  background: var(--bg-dark);
  color: #fff;
  font-family: var(--font);
  user-select: none;
  transition: background 0.5s;
}

button { cursor: pointer; outline: none; font-family: var(--font); }

/* ════════════════════════════════════════════
   SCREENS
   ════════════════════════════════════════════ */
.screen { display: none; width: 100vw; height: 100vh; position: relative; }
.screen.active { display: flex; }

/* ════════════════════════════════════════════
   MAIN MENU
   ════════════════════════════════════════════ */
#menu-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

#menu-bg-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0.3;
  pointer-events: none;
}

.menu-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 18px;
  padding: 28px 16px;
  width: 100%; max-width: 660px;
}

/* ── Logo ── */
.game-logo {
  text-align: center;
  line-height: 1;
  animation: logoEntry 0.7s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes logoEntry {
  from { opacity: 0; transform: scale(0.8) translateY(-20px); }
  to   { opacity: 1; transform: scale(1)   translateY(0);     }
}
.logo-pong {
  display: block;
  font-size: clamp(3.2rem, 10vw, 6.5rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  color: #fff;
  text-shadow: var(--glow);
  animation: logoPulse 3s ease-in-out infinite;
}
.logo-ultra {
  display: block;
  font-size: clamp(0.9rem, 3vw, 1.8rem);
  font-weight: 700;
  letter-spacing: 0.6em;
  color: var(--primary);
  text-shadow: var(--glow-sm);
  margin-top: -4px;
}
.logo-tagline {
  font-family: var(--font-sub);
  font-size: 0.78rem;
  letter-spacing: 0.35em;
  color: rgba(255,255,255,0.38);
  margin-top: 6px;
  text-transform: uppercase;
}
@keyframes logoPulse {
  0%,100% { text-shadow: var(--glow); }
  50%      { text-shadow: 0 0 22px var(--primary), 0 0 60px var(--primary), 0 0 100px var(--secondary); }
}

/* ── Panel ── */
.menu-panel {
  width: 100%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 26px 30px;
  backdrop-filter: blur(20px);
  box-shadow: 0 0 50px rgba(0,0,0,0.6), inset 0 0 30px rgba(0,255,247,0.02);
  display: flex; flex-direction: column; gap: 18px;
  transition: border-color 0.4s;
}

.menu-section { display: flex; flex-direction: column; gap: 7px; }

.menu-label {
  font-size: 0.6rem;
  letter-spacing: 0.32em;
  color: var(--primary);
  opacity: 0.72;
  font-weight: 700;
}

.option-group { display: flex; gap: 7px; flex-wrap: wrap; }

.opt-btn {
  flex: 1; min-width: 64px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 8px;
  color: rgba(255,255,255,0.48);
  font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.08em;
  transition: all 0.16s ease;
}
.opt-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(0,255,247,0.06);
  transform: translateY(-1px);
}
.opt-btn.active {
  background: rgba(0,255,247,0.11);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 10px rgba(0,255,247,0.22), inset 0 0 8px rgba(0,255,247,0.07);
}

/* Play button */
.play-btn {
  width: 100%; padding: 15px;
  margin-top: 4px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none; border-radius: 10px;
  color: #000;
  font-size: 1.05rem; font-weight: 900;
  letter-spacing: 0.22em;
  box-shadow: 0 0 22px rgba(0,255,247,0.38), 0 4px 18px rgba(0,0,0,0.5);
  transition: all 0.2s ease;
  position: relative; overflow: hidden;
}
.play-btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.18));
  pointer-events: none;
}
.play-btn:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 0 36px rgba(0,255,247,0.55), 0 8px 26px rgba(0,0,0,0.6);
}
.play-btn:active { transform: scale(0.98); }

.best-score {
  text-align: center;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.32);
  min-height: 16px;
}

/* Controls hint */
.controls-hint {
  display: flex; align-items: center; gap: 16px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 10px 18px;
  width: 100%;
}
.hint-col {
  flex: 1; text-align: center;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
  line-height: 1.65;
}
.hint-title {
  font-family: var(--font);
  font-size: 0.55rem;
  letter-spacing: 0.22em;
  color: var(--primary);
  opacity: 0.75;
  margin-bottom: 3px;
}
.hint-divider {
  width: 1px; height: 38px;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}

/* ════════════════════════════════════════════
   GAME SCREEN
   ════════════════════════════════════════════ */
#game-screen { flex-direction: column; background: var(--bg-dark); }

/* ── HUD Top ── */
#hud-top {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 22px; height: 70px; flex-shrink: 0;
  background: rgba(0,0,0,0.38);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  backdrop-filter: blur(6px);
  position: relative; z-index: 10;
}

.player-hud {
  display: flex; flex-direction: column;
  align-items: flex-start; gap: 2px;
  min-width: 120px;
}
.player-hud.right-hud { align-items: flex-end; }

.player-name {
  font-size: 0.58rem; letter-spacing: 0.28em;
  color: var(--primary); opacity: 0.7; font-weight: 700;
}
.player-score {
  font-size: 2.3rem; font-weight: 900;
  line-height: 1; color: #fff;
  text-shadow: var(--glow-sm);
  transition: transform 0.15s ease;
}
.player-score.bump { animation: scoreBump 0.32s ease; }
@keyframes scoreBump {
  0%   { transform: scale(1);    color: #fff; }
  40%  { transform: scale(1.42); color: var(--primary); }
  100% { transform: scale(1);    color: #fff; }
}

.score-pips { display: flex; gap: 5px; margin-top: 3px; }
.pip {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.16);
  transition: background 0.25s, box-shadow 0.25s;
}
.pip.filled { background: var(--primary); box-shadow: 0 0 5px var(--primary); }

.hud-center {
  display: flex; flex-direction: column;
  align-items: center; gap: 2px; flex: 1;
}
#status-text {
  font-size: clamp(1.1rem, 2.8vw, 2rem);
  font-weight: 900; letter-spacing: 0.12em;
  color: var(--primary); text-shadow: var(--glow);
  min-height: 28px; text-align: center;
}
#fps-counter {
  font-family: var(--font-sub);
  font-size: 0.66rem;
  color: rgba(255,255,255,0.22);
  letter-spacing: 0.1em;
}

/* ── Canvas Container ── */
#canvas-container {
  flex: 1; display: flex;
  align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
#pong {
  display: block;
  max-width: 100%; max-height: 100%;
  border-radius: 6px;
  box-shadow: 0 0 60px rgba(0,0,0,0.85);
}

/* Power-up bar */
#powerup-bar-wrap {
  position: absolute; bottom: 12px;
  left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column;
  align-items: center; gap: 4px; width: 200px;
}
#powerup-bar-label {
  font-size: 0.55rem; letter-spacing: 0.22em;
  color: var(--secondary);
  text-shadow: 0 0 8px var(--secondary);
  font-weight: 700;
}
#powerup-bar-track {
  width: 100%; height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px; overflow: hidden;
}
#powerup-bar-fill {
  height: 100%;
  background: var(--secondary);
  box-shadow: 0 0 8px var(--secondary);
  border-radius: 2px;
  transition: width 0.12s linear;
  width: 100%;
}

/* ── HUD Bottom ── */
#hud-bottom {
  height: 44px; flex-shrink: 0;
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: rgba(0,0,0,0.38);
  border-top: 1px solid rgba(255,255,255,0.05);
  backdrop-filter: blur(6px);
  position: relative; z-index: 10;
}
#combo-display {
  font-family: var(--font-sub);
  font-size: 0.82rem; letter-spacing: 0.1em;
  color: var(--secondary);
  text-shadow: 0 0 10px var(--secondary);
  min-width: 110px;
}
#achievement-popup {
  font-family: var(--font-sub);
  font-size: 0.78rem; letter-spacing: 0.12em;
  color: #ffd700; text-shadow: 0 0 10px #ffd700;
  flex: 1; text-align: center;
  opacity: 0; transition: opacity 0.35s;
  pointer-events: none;
}
#achievement-popup.visible { opacity: 1; }
.hud-controls { display: flex; gap: 7px; min-width: 110px; justify-content: flex-end; }

.hud-icon-btn {
  width: 30px; height: 30px; border-radius: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.5);
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.hud-icon-btn:hover {
  background: rgba(0,255,247,0.09);
  border-color: var(--primary);
  color: var(--primary);
}

/* ════════════════════════════════════════════
   OVERLAYS
   ════════════════════════════════════════════ */
.game-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 10, 0.76);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fadeIn 0.22s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.overlay-box {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 40px 50px;
  display: flex; flex-direction: column;
  align-items: center; gap: 13px;
  min-width: 290px;
  box-shadow: 0 0 60px rgba(0,0,0,0.7),
              inset 0 0 40px rgba(0,255,247,0.025);
  animation: popIn 0.28s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes popIn {
  from { transform: scale(0.82) translateY(18px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.overlay-title {
  font-size: 1.9rem; font-weight: 900;
  letter-spacing: 0.22em;
  color: var(--primary); text-shadow: var(--glow);
  text-align: center;
}
.gameover-box .overlay-title { font-size: 1.3rem; }

.final-score-display {
  font-size: 3rem; font-weight: 900;
  letter-spacing: 0.18em; color: #fff;
  text-shadow: var(--glow-sm);
  margin: 3px 0;
}
#new-record-badge {
  font-family: var(--font-sub);
  font-size: 0.85rem; letter-spacing: 0.22em;
  color: #ffd700; text-shadow: 0 0 12px #ffd700;
  animation: badgePulse 0.9s ease-in-out infinite;
}
@keyframes badgePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.overlay-btn {
  width: 100%; padding: 11px 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 9px;
  color: rgba(255,255,255,0.65);
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.15em;
  transition: all 0.17s ease;
}
.overlay-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(0,255,247,0.07);
  transform: translateX(3px);
}
.overlay-btn.primary-btn {
  background: rgba(0,255,247,0.11);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 12px rgba(0,255,247,0.18);
}
.overlay-btn.primary-btn:hover {
  background: rgba(0,255,247,0.19);
  box-shadow: 0 0 22px rgba(0,255,247,0.32);
}

/* ════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════ */
@media (max-width: 680px) {
  .menu-panel { padding: 18px 14px; gap: 14px; }
  .controls-hint { flex-direction: column; gap: 5px; }
  .hint-divider { width: 70px; height: 1px; }
  #hud-top { padding: 0 10px; height: 56px; }
  .player-score { font-size: 1.7rem; }
  .overlay-box { padding: 28px 22px; }
  .final-score-display { font-size: 2.2rem; }
}
@media (max-width: 400px) {
  .logo-pong { font-size: 2.8rem; }
  .opt-btn { font-size: 0.58rem; padding: 7px 6px; }
  .play-btn { font-size: 0.88rem; }
}
