@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --bg: #0a0a12;
  --text: #e8e0d0;
  --accent: #ff6b6b;
  --gold: #ffd700;
  --gold-dim: #b8960f;
  --purple: #8b5cf6;
  --cyan: #22d3ee;
  --trail: rgba(255, 107, 107, 0.15);
  --card-bg: rgba(139, 92, 246, 0.15);
  --glass: rgba(255, 255, 255, 0.05);
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: 'Orbitron', sans-serif;
  color: var(--text);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0; left: 0;
}

#ui-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
}

#ui-overlay button, #ui-overlay .screen:not(.hidden) { pointer-events: auto; }

.hidden { display: none !important; }

.screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

/* Menu Screen */
#menu-screen { background: rgba(10, 10, 18, 0.85); }
#menu-bg-demo {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
  opacity: 0.3;
}
.menu-content {
  text-align: center;
  position: relative;
}
.game-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(3rem, 12vw, 7rem);
  line-height: 1;
  letter-spacing: 0.15em;
  text-shadow: 0 0 40px var(--accent), 0 0 80px var(--accent), 0 0 120px rgba(255, 107, 107, 0.3);
  animation: titlePulse 3s ease-in-out infinite;
}
.title-line { display: block; }
.title-line.accent {
  color: var(--accent);
  font-style: italic;
  text-shadow: 0 0 40px var(--accent), 0 0 80px var(--gold), 0 0 120px rgba(255, 215, 0, 0.3);
  animation: titleGlow 2s ease-in-out infinite alternate;
}
.subtitle {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(0.8rem, 2.5vw, 1.2rem);
  color: var(--gold-dim);
  letter-spacing: 0.3em;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
  opacity: 0.8;
}

@keyframes titlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}
@keyframes titleGlow {
  0% { text-shadow: 0 0 40px var(--accent), 0 0 80px var(--gold), 0 0 120px rgba(255, 215, 0, 0.2); }
  100% { text-shadow: 0 0 60px var(--accent), 0 0 120px var(--gold), 0 0 180px rgba(255, 215, 0, 0.4); }
}

.menu-nav { display: flex; flex-direction: column; gap: 0.6rem; align-items: center; }

.menu-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(0.8rem, 2vw, 1rem);
  letter-spacing: 0.2em;
  padding: 0.7rem 2.5rem;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s;
  min-width: 200px;
}
.menu-btn:hover, .menu-btn:focus {
  background: rgba(255, 107, 107, 0.15);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
  outline: none;
}
.menu-btn:active { transform: scale(0.95); }

.menu-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  font-size: 0.7rem;
  opacity: 0.4;
}

#fullscreen-btn, #mute-btn {
  font-size: 1.2rem;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}
#fullscreen-btn:hover, #mute-btn:hover { opacity: 1; }

/* Tutorial Screen */
#tutorial-screen { background: rgba(10, 10, 18, 0.95); }
.tutorial-content {
  max-width: 500px;
  padding: 2rem;
  text-align: center;
}
.tutorial-content h2 {
  letter-spacing: 0.3em;
  margin-bottom: 1.5rem;
  color: var(--accent);
}
.tutorial-step {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  text-align: left;
  font-size: clamp(0.7rem, 1.8vw, 0.85rem);
}
.tutorial-visual { font-size: 1.5rem; min-width: 40px; text-align: center; }
.tutorial-step p { line-height: 1.4; color: rgba(232, 224, 208, 0.8); }
.tutorial-step strong { color: var(--cyan); }
.tutorial-content .menu-btn { margin-top: 1rem; }

/* Leaderboard */
#leaderboard-screen { background: rgba(10, 10, 18, 0.95); }
.leaderboard-content {
  max-width: 450px;
  width: 90%;
  padding: 2rem;
  text-align: center;
}
.leaderboard-content h2 {
  letter-spacing: 0.2em;
  margin-bottom: 1rem;
  color: var(--gold);
  font-size: clamp(0.9rem, 2.5vw, 1.2rem);
}
#leaderboard-list {
  margin-bottom: 1.5rem;
  text-align: left;
}
.lb-entry {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: clamp(0.65rem, 1.6vw, 0.8rem);
  font-family: 'Orbitron', sans-serif;
}
.lb-entry .lb-rank { color: var(--gold-dim); min-width: 30px; }
.lb-entry .lb-name { color: var(--cyan); flex: 1; }
.lb-entry .lb-score { color: var(--text); min-width: 80px; text-align: right; }
.lb-entry .lb-date { color: rgba(255,255,255,0.3); min-width: 70px; text-align: right; font-size: 0.7em; }
.lb-entry.highlight { background: rgba(255, 215, 0, 0.1); }
.lb-entry.highlight .lb-score { color: var(--gold); }

/* Settings */
#settings-screen { background: rgba(10, 10, 18, 0.95); }
.settings-content { text-align: center; padding: 2rem; }
.settings-content h2 { letter-spacing: 0.2em; margin-bottom: 1.5rem; color: var(--cyan); }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  max-width: 300px;
}
.setting-row label { font-size: 0.8rem; letter-spacing: 0.1em; min-width: 120px; }
.setting-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}
.settings-content .menu-btn { margin-top: 1rem; }

/* Game HUD */
#game-hud {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 15;
  pointer-events: none;
}
#score-display {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  letter-spacing: 0.1em;
}
#prophecy-progress {
  font-size: clamp(0.6rem, 1.5vw, 0.8rem);
  color: var(--text);
  opacity: 0.7;
  letter-spacing: 0.2em;
}
#cards-hit { color: var(--accent); font-weight: 700; }
#combo-display {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 30px var(--accent), 0 0 60px rgba(255, 107, 107, 0.3);
  pointer-events: none;
  animation: comboPop 0.8s ease-out forwards;
}
@keyframes comboPop {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  30% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* Pause */
#pause-overlay { background: rgba(10, 10, 18, 0.8); }
.pause-content { text-align: center; }
.pause-content h2 { letter-spacing: 0.3em; margin-bottom: 1.5rem; color: var(--cyan); }
.pause-content .menu-btn { margin-bottom: 0.5rem; }

/* Game Over */
#gameover-screen { background: rgba(10, 10, 18, 0.92); }
.gameover-content { text-align: center; max-width: 450px; width: 90%; padding: 2rem; }
.gameover-content h2 {
  font-size: clamp(1rem, 3vw, 1.5rem);
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.prophecy-reveal {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(0.7rem, 1.8vw, 0.9rem);
  color: var(--purple);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  min-height: 3em;
  opacity: 0.9;
}
.final-score {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}
.score-label { font-size: 0.6rem; letter-spacing: 0.2em; opacity: 0.5; }
.score-value {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}
#high-score-notice {
  color: var(--gold);
  font-size: clamp(0.8rem, 2vw, 1rem);
  letter-spacing: 0.3em;
  animation: blink 0.5s ease-in-out infinite alternate;
  margin-bottom: 1rem;
}
@keyframes blink {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

.name-entry { margin-bottom: 1rem; }
.name-entry p { font-size: 0.6rem; letter-spacing: 0.2em; opacity: 0.6; margin-bottom: 0.5rem; }
#initials-input {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.initial-char {
  width: 1.5em;
  height: 1.5em;
  line-height: 1.5em;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.3);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.initial-char:hover, .initial-char:focus { border-color: var(--cyan); background: rgba(34, 211, 238, 0.1); }
.initials-nav { display: flex; gap: 0.5rem; justify-content: center; }
.initials-nav button {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  padding: 0.3rem 0.8rem;
  background: var(--glass);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}
.initials-nav button:hover { border-color: var(--cyan); color: var(--cyan); }

.gameover-content .menu-btn { margin-top: 0.5rem; }

/* Mobile control overlay */
#mobile-controls {
  position: fixed;
  bottom: 0; left: 0;
  width: 100%;
  height: 50%;
  pointer-events: none;
  z-index: 12;
}
#mobile-controls .flipper-zone {
  position: absolute;
  bottom: 5%;
  width: 45%;
  height: 40%;
  pointer-events: auto;
  border-radius: 20px;
}
.flipper-zone.left { left: 2%; }
.flipper-zone.right { right: 2%; }
.flipper-zone:active { background: rgba(255, 255, 255, 0.05); }

/* Fade effect for long-exposure aesthetic */
#vignette {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 5;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(10, 10, 18, 0.6) 100%);
}

/* Scrollbar hidden */
::-webkit-scrollbar { display: none; }
