/* ============================================================
   ECHO REALM — MASTER STYLESHEET
   ============================================================ */

:root {
  --primary: #00f5ff;
  --primary-dim: #00c8d4;
  --accent: #ff00ff;
  --accent2: #ff6b00;
  --echo: #a855f7;
  --echo-bright: #d946ef;
  --bg-deep: #010409;
  --bg-panel: rgba(0, 245, 255, 0.04);
  --bg-panel-border: rgba(0, 245, 255, 0.15);
  --text-bright: #e0f7fa;
  --text-mid: #80cbc4;
  --danger: #ff3d6b;
  --health-green: #00e676;
  --health-yellow: #ffea00;
  --health-red: #ff3d6b;
  --font-game: 'Orbitron', monospace;
  --font-body: 'Inter', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  font-family: var(--font-body);
  color: var(--text-bright);
}

/* ── SCREENS ── */
.screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 10;
}
.screen.active {
  opacity: 1; pointer-events: all;
}

/* ── TITLE SCREEN ── */
#titleScreen {
  overflow: hidden;
}
#titleCanvas {
  position: absolute; inset: 0;
  z-index: 0;
}
.title-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%,
    rgba(0,245,255,0.08) 0%,
    rgba(168,85,247,0.06) 40%,
    transparent 70%);
  z-index: 1;
}
.title-content {
  position: relative; z-index: 10;
  display: flex; flex-direction: column;
  align-items: center; gap: 28px;
  text-align: center;
}

.logo-container {
  position: relative;
}
.logo-glow {
  position: absolute;
  inset: -60px;
  background: radial-gradient(ellipse,
    rgba(0,245,255,0.25) 0%,
    rgba(168,85,247,0.15) 40%,
    transparent 70%);
  filter: blur(20px);
  animation: logoPulse 3s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.logo-text {
  font-family: var(--font-game);
  font-size: clamp(56px, 10vw, 120px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -2px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--echo-bright) 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(0,245,255,0.5));
  animation: textShimmer 4s ease-in-out infinite;
}
@keyframes textShimmer {
  0%, 100% { filter: drop-shadow(0 0 30px rgba(0,245,255,0.5)); }
  50% { filter: drop-shadow(0 0 60px rgba(0,245,255,0.9)) drop-shadow(0 0 80px rgba(217,70,239,0.4)); }
}

.logo-sub {
  font-size: 0.7em;
  letter-spacing: 12px;
  background: linear-gradient(135deg, var(--echo-bright) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-tagline {
  font-family: var(--font-game);
  font-size: clamp(10px, 1.5vw, 14px);
  letter-spacing: 4px;
  color: var(--text-mid);
  margin-top: 12px;
  opacity: 0.8;
}

.title-features {
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
}
.feature-pill {
  font-family: var(--font-game);
  font-size: 10px;
  letter-spacing: 2px;
  padding: 6px 14px;
  border: 1px solid rgba(0,245,255,0.3);
  border-radius: 20px;
  background: rgba(0,245,255,0.05);
  color: var(--primary);
  backdrop-filter: blur(10px);
}

.title-controls {
  display: flex; gap: 20px; flex-wrap: wrap; justify-content: center;
}
.control-hint {
  font-size: 12px;
  color: var(--text-mid);
  display: flex; align-items: center; gap: 6px;
}
kbd {
  font-family: var(--font-game);
  font-size: 10px;
  padding: 3px 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  color: var(--text-bright);
}

/* ── BUTTONS ── */
.btn-primary {
  font-family: var(--font-game);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 16px 44px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--echo-bright));
  color: #000;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 30px rgba(0,245,255,0.4), 0 0 60px rgba(0,245,255,0.2);
  display: flex; align-items: center; gap: 10px;
}
.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 50px rgba(0,245,255,0.6), 0 0 100px rgba(0,245,255,0.3);
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary::before {
  content: '';
  position: absolute; top: -50%; left: -60%;
  width: 40%; height: 200%;
  background: rgba(255,255,255,0.3);
  transform: skewX(-20deg);
  transition: left 0.5s;
}
.btn-primary:hover::before { left: 130%; }

.btn-secondary {
  font-family: var(--font-game);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  padding: 14px 36px;
  border: 1px solid var(--bg-panel-border);
  border-radius: 4px;
  cursor: pointer;
  background: rgba(0,245,255,0.06);
  color: var(--primary);
  transition: all 0.2s;
  backdrop-filter: blur(10px);
  display: flex; align-items: center; gap: 8px;
}
.btn-secondary:hover {
  background: rgba(0,245,255,0.12);
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(0,245,255,0.2);
}

.pulse-btn {
  animation: pulseShadow 2s ease-in-out infinite;
}
@keyframes pulseShadow {
  0%, 100% { box-shadow: 0 0 30px rgba(0,245,255,0.4), 0 0 60px rgba(0,245,255,0.2); }
  50% { box-shadow: 0 0 60px rgba(0,245,255,0.7), 0 0 120px rgba(0,245,255,0.4), 0 0 180px rgba(217,70,239,0.2); }
}

.btn-icon { font-size: 18px; }

.high-score-display {
  font-family: var(--font-game);
  font-size: 12px;
  color: #ffd700;
  letter-spacing: 2px;
  min-height: 20px;
}

/* ── GAME SCREEN ── */
#gameScreen {
  background: #000;
}
#gameCanvas {
  position: absolute; inset: 0;
  display: block; width: 100%; height: 100%;
}

/* ── HUD ── */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 80px;
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
  z-index: 20;
  pointer-events: none;
}

.hud-left, .hud-right {
  display: flex; gap: 24px; align-items: center;
  flex: 1;
}
.hud-right { justify-content: flex-end; }
.hud-center {
  flex: 1.5;
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
}

.hud-stat {
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
}
.hud-label {
  font-family: var(--font-game);
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--text-mid);
  opacity: 0.7;
}
.hud-value {
  font-family: var(--font-game);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 0 10px var(--primary);
  transition: all 0.2s;
}
.echo-count { color: var(--echo-bright); text-shadow: 0 0 10px var(--echo-bright); }
.combo-val { color: var(--accent2); text-shadow: 0 0 10px var(--accent2); }

/* Health Bar */
.health-bar-container {
  width: 260px;
  display: flex; flex-direction: column; gap: 4px;
}
.health-bar-label, .echo-bar-label {
  font-family: var(--font-game);
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--text-mid);
  text-align: center;
}
.health-bar-track, .echo-bar-track {
  position: relative;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}
.health-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--health-green), #69ff82);
  border-radius: 4px;
  transition: width 0.3s ease, background 0.5s ease;
  box-shadow: 0 0 8px var(--health-green);
}
.health-bar-shine {
  position: absolute; top: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}
.health-text {
  font-family: var(--font-game);
  font-size: 10px;
  color: var(--health-green);
  text-align: center;
  text-shadow: 0 0 8px var(--health-green);
}
.echo-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--echo), var(--echo-bright));
  border-radius: 4px;
  transition: width 0.2s ease;
  box-shadow: 0 0 8px var(--echo-bright);
}
.echo-charge-container {
  width: 260px;
  display: flex; flex-direction: column; gap: 4px;
}

/* Dash Pips */
.dash-pips {
  display: flex; gap: 5px;
}
.dash-pip {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  transition: all 0.3s;
}
.dash-pip.active {
  background: var(--accent2);
  box-shadow: 0 0 8px var(--accent2);
  border-color: var(--accent2);
}

/* ── WAVE ANNOUNCE ── */
.wave-announce {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.7) 0%, transparent 70%);
  pointer-events: none;
}
.wave-announce.hidden { display: none; }
.wave-announce-inner {
  text-align: center;
  animation: waveSlide 0.5s ease-out;
}
@keyframes waveSlide {
  from { opacity: 0; transform: scale(0.8) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.wave-sub {
  font-family: var(--font-game);
  font-size: 12px;
  letter-spacing: 6px;
  color: var(--text-mid);
  margin-bottom: 8px;
}
.wave-title {
  font-family: var(--font-game);
  font-size: clamp(40px, 8vw, 80px);
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--echo-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 20px rgba(0,245,255,0.6));
}
.wave-desc {
  font-family: var(--font-game);
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--accent2);
  margin-top: 8px;
  text-shadow: 0 0 10px var(--accent2);
}

/* ── ECHO POPUP ── */
.echo-popup {
  position: absolute;
  top: 100px; left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  font-family: var(--font-game);
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--echo-bright);
  background: rgba(168,85,247,0.15);
  border: 1px solid rgba(217,70,239,0.4);
  padding: 8px 20px;
  border-radius: 4px;
  backdrop-filter: blur(10px);
  text-shadow: 0 0 10px var(--echo-bright);
  animation: echoFade 1.5s ease-out forwards;
  pointer-events: none;
}
.echo-popup.hidden { display: none; }
@keyframes echoFade {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  20% { opacity: 1; transform: translateX(-50%) translateY(0); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* ── GAME OVER SCREEN ── */
#gameOverScreen {
  background: var(--bg-deep);
  overflow: hidden;
}
#goCanvas {
  position: absolute; inset: 0; z-index: 0;
}
.go-content {
  position: relative; z-index: 10;
  display: flex; flex-direction: column;
  align-items: center; gap: 32px;
  text-align: center;
}
.go-title-wrap {}
.go-title {
  font-family: var(--font-game);
  font-size: clamp(36px, 7vw, 72px);
  font-weight: 900;
  color: var(--danger);
  text-shadow: 0 0 40px rgba(255,61,107,0.8), 0 0 80px rgba(255,61,107,0.4);
  animation: titleFlicker 3s ease-in-out infinite;
}
@keyframes titleFlicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.4; }
  94% { opacity: 1; }
  96% { opacity: 0.6; }
  97% { opacity: 1; }
}
.go-subtitle {
  font-family: var(--font-game);
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--text-mid);
  margin-top: 8px;
}
.go-stats {
  display: flex; flex-direction: column;
  gap: 0;
  background: var(--bg-panel);
  border: 1px solid var(--bg-panel-border);
  border-radius: 8px;
  overflow: hidden;
  min-width: 320px;
  backdrop-filter: blur(20px);
}
.go-stat-row {
  display: flex; justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(0,245,255,0.08);
}
.go-stat-row:last-child { border-bottom: none; }
.highlight-row {
  background: rgba(255, 215, 0, 0.06);
  border-top: 1px solid rgba(255,215,0,0.2) !important;
}
.go-stat-label {
  font-family: var(--font-game);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-mid);
}
.go-stat-val {
  font-family: var(--font-game);
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}
.go-stat-val.gold { color: #ffd700; text-shadow: 0 0 15px rgba(255,215,0,0.6); }

.go-buttons {
  display: flex; gap: 16px;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  #hud { height: 60px; padding: 0 12px; }
  .hud-center { display: none; }
  .go-stats { min-width: 280px; }
}
