/* ============================================================
   Blurred Vision — Neon Arcade Game Styles
   ============================================================ */

/* ---------- Variables ---------- */
:root {
  --bg-deep:        #06070f;
  --bg-surface:     #0c0e1f;
  --bg-card:        rgba(255, 255, 255, 0.04);
  --border-subtle:  rgba(255, 255, 255, 0.08);

  /* Neon palette */
  --neon-green:     #32ff00;
  --neon-cyan:      #00ffff;
  --neon-purple:    #bf00ff;
  --neon-pink:      #ff007f;
  --neon-yellow:    #ffe033;
  --neon-red:       #ff2d55;
  --neon-blue:      #00d4ff;

  /* Timer-status border colors */
  --border-safe:    #32ff00;
  --border-warn:    #ffe033;
  --border-danger:  #ff2d55;

  /* Text */
  --text-primary:   #e8eeff;
  --text-muted:     #7888aa;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: Inter, system-ui, -apple-system, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Animated moving gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(191, 0, 255, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 60% 80% at 80% 90%, rgba(0, 255, 255, 0.05) 0%, transparent 70%),
    radial-gradient(ellipse at 50% 50%, #0a0d1f 0%, var(--bg-deep) 100%);
  animation: bgPulse 8s ease-in-out infinite alternate;
  z-index: 0;
  pointer-events: none;
}

@keyframes bgPulse {
  0%   { opacity: 0.7; }
  100% { opacity: 1;   }
}

/* ---------- Screen layout ---------- */
.screen {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  padding: 1rem 1rem 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  min-height: calc(100vh - 56px);
}

.hidden { display: none !important; }

/* ---------- Welcome Screen ---------- */
.welcome-hero {
  text-align: center;
  margin-top: 2rem;
}

.welcome-icon {
  font-size: 5rem;
  line-height: 1;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 0 20px rgba(191, 0, 255, 0.5));
  animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {
  0%, 100% { transform: translateY(0);    }
  50%       { transform: translateY(-8px); }
}

.game-title {
  font-size: clamp(2.2rem, 7vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.game-tagline {
  font-size: 1rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Setup card */
.setup-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  padding: 1.5rem;
  backdrop-filter: blur(8px);
}

.setup-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--neon-cyan);
  margin-bottom: 1rem;
  text-shadow: 0 0 12px rgba(0, 255, 255, 0.4);
}

/* Name input */
.name-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.6rem;
  color: var(--text-primary);
  font-size: 1.05rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 0.75rem;
}

.name-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.15);
}

.name-input::placeholder { color: var(--text-muted); }

/* Rounds selector */
.rounds-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.rounds-selector select {
  flex: 1;
  padding: 0.6rem 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.6rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.rounds-selector select:focus { border-color: var(--neon-cyan); }

/* How to play card */
.how-to-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: 0.875rem;
  padding: 1.25rem 1.5rem;
}

.how-to-card h3 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
}

.how-to-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.how-to-list li {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  line-height: 1.4;
}

.how-to-list li span:first-child { flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: none;
  cursor: pointer;
  border-radius: 0.75rem;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s, opacity 0.18s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  transition: transform 0.08s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  width: 100%;
  padding: 0.9rem 1.5rem;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-pink));
  color: #fff;
  box-shadow: 0 0 20px rgba(191, 0, 255, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 30px rgba(191, 0, 255, 0.6), 0 6px 20px rgba(0, 0, 0, 0.4);
}

.btn-secondary {
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* ---------- HUD (in-game header) ---------- */
.hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.hud-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hud-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ---------- Progress Bar ---------- */
.progress-bar-wrap {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--neon-green), var(--neon-cyan));
  transition: width 0.5s linear, background 0.8s ease;
  box-shadow: 0 0 8px rgba(50, 255, 0, 0.5);
}

/* ---------- Image Frame ---------- */
.image-frame-wrap {
  width: 100%;
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  /* Border color is set dynamically via CSS variable */
  border: 3px solid var(--frame-border-color, var(--border-safe));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 0 30px var(--frame-glow-color, rgba(50, 255, 0, 0.25)),
    0 8px 32px rgba(0, 0, 0, 0.5);
  transition: border-color 0.6s ease, box-shadow 0.6s ease;
  aspect-ratio: 4 / 3;
  background: #0a0a0a;
}

.game-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.7s ease;
  /* filter is set in JS */
}

/* Category badge */
.category-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Timer overlay on image */
.timer-overlay {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid var(--frame-border-color, var(--border-safe));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--frame-border-color, var(--border-safe));
  text-shadow: 0 0 8px currentColor;
  transition: border-color 0.6s ease, color 0.6s ease;
}

/* ---------- Answer Options ---------- */
.options-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.option-btn {
  position: relative;
  padding: 0.85rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  border: 2px solid transparent;
  border-radius: 0.75rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transition: transform 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: optionPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

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

.option-btn:nth-child(1) { animation-delay: 0.05s; }
.option-btn:nth-child(2) { animation-delay: 0.10s; }
.option-btn:nth-child(3) { animation-delay: 0.15s; }
.option-btn:nth-child(4) { animation-delay: 0.20s; }

.option-btn:hover:not(:disabled) {
  background: rgba(191, 0, 255, 0.15);
  border-color: var(--neon-purple);
  box-shadow: 0 0 12px rgba(191, 0, 255, 0.25);
  transform: translateY(-2px);
}

.option-btn:active:not(:disabled) {
  transform: translateY(0);
  transition: transform 0.06s;
}

.option-btn:disabled { cursor: not-allowed; }

.option-btn.correct {
  background: rgba(50, 255, 0, 0.15);
  border-color: var(--neon-green);
  color: var(--neon-green);
  box-shadow: 0 0 16px rgba(50, 255, 0, 0.35);
}

.option-btn.incorrect {
  background: rgba(255, 45, 85, 0.15);
  border-color: var(--neon-red);
  color: var(--neon-red);
  box-shadow: 0 0 16px rgba(255, 45, 85, 0.35);
}

.option-btn.locked {
  background: rgba(255, 255, 255, 0.02);
  opacity: 0.4;
}

/* Lockout overlay on options */
.lockout-bar {
  width: 100%;
  padding: 0.7rem 1rem;
  background: rgba(255, 45, 85, 0.12);
  border: 1px solid rgba(255, 45, 85, 0.3);
  border-radius: 0.75rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--neon-red);
  letter-spacing: 0.5px;
  animation: lockoutPulse 0.5s ease-in-out infinite alternate;
}

@keyframes lockoutPulse {
  from { opacity: 0.7; }
  to   { opacity: 1;   }
}

/* ---------- Screen Shake Animation ---------- */
@keyframes screenShake {
  0%   { transform: translateX(0);    }
  15%  { transform: translateX(-8px); }
  30%  { transform: translateX(8px);  }
  45%  { transform: translateX(-6px); }
  60%  { transform: translateX(6px);  }
  75%  { transform: translateX(-3px); }
  90%  { transform: translateX(3px);  }
  100% { transform: translateX(0);    }
}

.shake { animation: screenShake 0.45s ease-in-out; }

/* ---------- Score Flash ---------- */
.score-flash {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: none;
  z-index: 100;
  font-size: 2.5rem;
  font-weight: 900;
  opacity: 0;
  transition: none;
  text-shadow: 0 0 20px currentColor;
  letter-spacing: -1px;
}

.score-flash.show {
  animation: scoreFlash 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes scoreFlash {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(0.8); }
  30%  { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  80%  { opacity: 0.9; transform: translate(-50%, -75%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -85%) scale(0.95); }
}

/* ---------- Round Result Screen ---------- */
.result-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
}

.result-verdict {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.result-label {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 0.25rem;
}

.result-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.reveal-image-wrap {
  width: 100%;
  border-radius: 0.75rem;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #0a0a0a;
  margin-bottom: 1rem;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.reveal-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: imageReveal 0.5s ease-out;
}

@keyframes imageReveal {
  from { opacity: 0; transform: scale(1.04); }
  to   { opacity: 1; transform: scale(1);    }
}

.answer-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
}

/* Points earned badge */
.points-badge {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 800;
  margin-top: 0.4rem;
}

.points-badge.positive {
  background: rgba(50, 255, 0, 0.12);
  border: 1px solid rgba(50, 255, 0, 0.3);
  color: var(--neon-green);
}

.points-badge.zero {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
}

/* ---------- Game Over Screen ---------- */
.gameover-hero {
  text-align: center;
  padding-top: 1.5rem;
}

.gameover-emoji {
  font-size: 5rem;
  line-height: 1;
  margin-bottom: 0.5rem;
  animation: iconFloat 3s ease-in-out infinite;
}

.gameover-title {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--neon-yellow), var(--neon-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}

.gameover-score {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
}

.gameover-score-label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.gameover-breakdown {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  overflow: hidden;
}

.gameover-breakdown-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 1rem 0.5rem;
}

.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.88rem;
  gap: 0.5rem;
}

.breakdown-q {
  flex: 1;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breakdown-pts {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.breakdown-pts.pos { color: var(--neon-green); }
.breakdown-pts.neg { color: var(--neon-red); }
.breakdown-pts.zero { color: var(--text-muted); }

/* Leaderboard */
.leaderboard-panel {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  padding: 1.25rem;
}

.leaderboard-panel h3 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--neon-yellow);
  text-shadow: 0 0 10px rgba(255, 224, 51, 0.3);
  margin-bottom: 0.75rem;
  text-align: center;
}

.leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.lb-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.lb-item:hover { background: rgba(255, 255, 255, 0.04); }

.lb-rank {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  width: 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.lb-rank.gold   { color: #ffd700; text-shadow: 0 0 8px rgba(255,215,0,0.5); }
.lb-rank.silver { color: #c0c0c0; text-shadow: 0 0 8px rgba(192,192,192,0.4); }
.lb-rank.bronze { color: #cd7f32; text-shadow: 0 0 8px rgba(205,127,50,0.4); }

.lb-name {
  flex: 1;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--neon-cyan);
}

.lb-empty {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem;
}

/* New high score badge */
.new-hs-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--neon-yellow), var(--neon-pink));
  color: #000;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  animation: hsBadgePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes hsBadgePop {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1);   }
}

/* ---------- Accessibility ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

*:focus-visible {
  outline: 3px solid var(--neon-cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Responsive ---------- */
@media (max-width: 380px) {
  .game-title   { font-size: 1.9rem; }
  .options-grid { grid-template-columns: 1fr; }
  .option-btn   { font-size: 0.95rem; }
}
