/* ====================================================
   BURST — Neon Color Chain Reaction Game
   Dark cyberpunk theme with neon glow effects
   ==================================================== */

*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

:root {
  --bg:        #060614;
  --surface:   #0d0d2b;
  --c1:        #FF3060;
  --c2:        #9B59F0;
  --c3:        #00D4FF;
  --c4:        #FF8C00;
  --c5:        #00E676;
  --gold:      #FFD700;
  --text:      #E8E8FF;
  --text-dim:  #5560A0;
  --radius:    14px;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: 'SF Pro Display', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---- SCREENS ---- */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
  overflow: hidden;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
}

/* ============ START SCREEN ============ */
#screen-start {
  justify-content: center;
  gap: 24px;
  padding: 20px;
}

.start-bg-glow {
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(123,92,240,.25) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -60%);
  pointer-events: none;
}

.logo-wrap {
  text-align: center;
  z-index: 1;
}

.logo {
  font-size: clamp(64px, 18vw, 96px);
  font-weight: 900;
  letter-spacing: 10px;
  line-height: 1;
  background: linear-gradient(135deg, var(--c3) 0%, var(--c2) 50%, var(--c1) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(0,212,255,.6));
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { filter: drop-shadow(0 0 30px rgba(0,212,255,.6)); }
  50%       { filter: drop-shadow(0 0 50px rgba(155,89,240,.8)); }
}

.tagline {
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 6px;
}

.hs-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 12px 32px;
  z-index: 1;
}
.hs-label { font-size: 11px; letter-spacing: 3px; color: var(--text-dim); }
.hs-value { font-size: 32px; font-weight: 800; color: var(--gold);
  text-shadow: 0 0 20px rgba(255,215,0,.5); }

.how-to {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  z-index: 1;
}
.how-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-dim);
}
.dot-example {
  width: 20px; height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 10px currentColor;
}

.version {
  font-size: 12px;
  color: var(--text-dim);
  z-index: 1;
}

/* ============ BUTTONS ============ */
.btn-primary {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 3px;
  padding: 16px 48px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--c3), var(--c2));
  color: #fff;
  cursor: pointer;
  z-index: 1;
  box-shadow: 0 4px 30px rgba(0,212,255,.4);
  transition: transform .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.btn-primary:active { transform: scale(.95); box-shadow: 0 2px 15px rgba(0,212,255,.3); }

.btn-secondary {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 14px 28px;
  border: 2px solid rgba(255,255,255,.15);
  border-radius: 50px;
  background: rgba(255,255,255,.05);
  color: var(--text);
  cursor: pointer;
  transition: transform .15s, background .15s;
  -webkit-appearance: none;
}
.btn-secondary:active { transform: scale(.95); background: rgba(255,255,255,.1); }

.pulse-btn {
  animation: pulseShadow 2s ease-in-out infinite;
}
@keyframes pulseShadow {
  0%,100% { box-shadow: 0 4px 30px rgba(0,212,255,.4); }
  50%      { box-shadow: 0 4px 60px rgba(155,89,240,.7); }
}

/* ============ GAME SCREEN ============ */
#screen-game {
  justify-content: flex-start;
}

/* HUD */
.hud {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 4px;
  background: rgba(6,6,20,.9);
  backdrop-filter: blur(10px);
  z-index: 10;
  flex-shrink: 0;
}

.hud-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 90px;
}
.hud-right { align-items: flex-end; }

.hud-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.hud-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.score-val {
  color: var(--c3);
  text-shadow: 0 0 15px rgba(0,212,255,.5);
}

/* Time circle */
.hud-center { flex: 1; display: flex; justify-content: center; }
#time-circle-wrap {
  position: relative;
  width: 56px; height: 56px;
}
#time-svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.time-bg-ring { stroke: rgba(255,255,255,.06); stroke-width: 5; fill: none; }
.time-ring {
  stroke: var(--c3);
  stroke-width: 5;
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset .9s linear, stroke .3s;
}
.time-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

/* Canvas */
#game-canvas {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  cursor: pointer;
  display: block;
}

/* Combo overlay */
.combo-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  pointer-events: none;
  text-align: center;
}
.combo-label {
  font-size: clamp(28px, 8vw, 42px);
  font-weight: 900;
  letter-spacing: 4px;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--gold), var(--c1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(255,215,0,.7));
  animation: comboPop .35s cubic-bezier(.17,.67,.35,1.4);
}
@keyframes comboPop {
  0%   { opacity: 0; transform: scale(.4); }
  60%  { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

.combo-overlay.hidden { display: none; }

/* Special hint */
.special-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(0,0,0,.5);
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
}
.special-hint.hidden { display: none; }

/* ============ END SCREEN ============ */
#screen-end {
  justify-content: center;
  gap: 20px;
  padding: 20px;
}

.end-glow {
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,48,96,.15) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.end-title {
  font-size: clamp(22px, 6vw, 32px);
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--c3);
  text-shadow: 0 0 20px rgba(0,212,255,.5);
  z-index: 1;
}

.end-score-wrap {
  text-align: center;
  z-index: 1;
}
.end-score-label {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.end-score {
  font-size: clamp(56px, 16vw, 80px);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--c3), var(--c2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(0,212,255,.4));
}
.end-record-msg {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 15px rgba(255,215,0,.5);
  margin-top: 4px;
  min-height: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  z-index: 1;
}
.stat-box {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}
.stat-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--c2);
}
.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.end-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 280px;
  z-index: 1;
}

.near-miss {
  font-size: 14px;
  color: var(--c1);
  text-align: center;
  min-height: 20px;
  z-index: 1;
  font-weight: 600;
}

/* ============ SCORE POP ANIMATION (DOM elements) ============ */
.score-pop {
  position: fixed;
  pointer-events: none;
  font-weight: 900;
  z-index: 50;
  animation: scoreFly .9s ease-out forwards;
  text-shadow: 0 0 10px currentColor;
}
@keyframes scoreFly {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) scale(.7); }
}

/* ============ RECORD FLASH ============ */
.new-record-flash {
  position: fixed;
  inset: 0;
  background: rgba(255,215,0,.08);
  pointer-events: none;
  z-index: 100;
  animation: recordFlash .6s ease-out forwards;
}
@keyframes recordFlash {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}
