* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0a0a12;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
canvas {
  display: block;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

#ui-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
}
#ui-overlay > * { pointer-events: auto; }
.hidden { display: none !important; }
.screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

/* Main Menu */
#title-container {
  text-align: center;
  margin-bottom: 2rem;
}
#game-title {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: clamp(2.5rem, 10vw, 5rem);
  color: #e8dcc8;
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.3), 0 0 60px rgba(0, 240, 255, 0.1);
  letter-spacing: 0.15em;
  position: relative;
}
#game-title::after {
  content: attr(data-text);
  position: absolute;
  left: 0; top: 0;
  color: #00f0ff;
  opacity: 0.15;
  transform: translate(2px, 2px);
  filter: blur(1px);
}
#game-subtitle {
  font-family: 'Special Elite', monospace;
  font-size: clamp(1rem, 4vw, 2rem);
  color: #b8963a;
  letter-spacing: 0.3em;
  margin-top: -0.3rem;
}
#game-tagline {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  color: #d4a89a;
  font-size: clamp(0.8rem, 2vw, 1.1rem);
  margin-top: 0.5rem;
  opacity: 0.7;
}
#menu-items {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: center;
}
.menu-btn {
  font-family: 'Special Elite', monospace;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: #e8dcc8;
  background: transparent;
  border: 1px solid rgba(0, 240, 255, 0.3);
  padding: 0.6rem 2rem;
  cursor: pointer;
  letter-spacing: 0.15em;
  transition: all 0.2s;
  min-width: 200px;
  text-align: center;
}
.menu-btn:hover, .menu-btn:focus {
  background: rgba(0, 240, 255, 0.1);
  border-color: #00f0ff;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}
.menu-btn:active {
  background: rgba(0, 240, 255, 0.2);
}
#menu-footer {
  position: absolute;
  bottom: 1rem;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  font-family: 'Special Elite', monospace;
  font-size: 0.75rem;
  color: #555;
}
#fullscreen-btn, #mute-btn {
  background: transparent;
  border: 1px solid #555;
  color: #888;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}
#fullscreen-btn:hover, #mute-btn:hover {
  color: #e8dcc8;
  border-color: #e8dcc8;
}
#demo-hint {
  position: absolute;
  bottom: 4rem;
  font-family: 'Crimson Text', serif;
  font-style: italic;
  color: #00f0ff;
  animation: pulse 2s ease-in-out infinite;
  font-size: clamp(0.8rem, 2vw, 1rem);
}
@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* Tutorial */
#tutorial-screen {
  background: rgba(10, 10, 18, 0.92);
  z-index: 30;
}
#tutorial-content {
  max-width: 500px;
  padding: 2rem;
  border: 1px solid rgba(0, 240, 255, 0.2);
  background: rgba(10, 10, 18, 0.95);
}
#tutorial-content h2 {
  font-family: 'Special Elite', monospace;
  color: #b8963a;
  font-size: 1.2rem;
  letter-spacing: 0.2em;
  margin-bottom: 1.5rem;
  text-align: center;
}
.tutorial-step p {
  font-family: 'Crimson Text', serif;
  color: #e8dcc8;
  font-size: 1.1rem;
  line-height: 1.6;
  text-align: center;
}
#tutorial-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
}
#tutorial-skip, #tutorial-next {
  font-family: 'Special Elite', monospace;
  font-size: 0.9rem;
  padding: 0.5rem 1.5rem;
  cursor: pointer;
  border: 1px solid #555;
  color: #e8dcc8;
  background: transparent;
  transition: all 0.2s;
}
#tutorial-next {
  border-color: rgba(0, 240, 255, 0.3);
  color: #00f0ff;
}
#tutorial-next:hover {
  background: rgba(0, 240, 255, 0.1);
}

/* Leaderboard */
#leaderboard-screen {
  background: rgba(10, 10, 18, 0.92);
  z-index: 25;
}
#leaderboard-screen h2 {
  font-family: 'Special Elite', monospace;
  color: #b8963a;
  font-size: 1.3rem;
  letter-spacing: 0.2em;
  margin-bottom: 1.5rem;
}
#leaderboard-entries {
  width: 90%;
  max-width: 400px;
  margin-bottom: 1.5rem;
}
.lb-entry {
  display: flex;
  justify-content: space-between;
  font-family: 'Special Elite', monospace;
  color: #e8dcc8;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.9rem;
  gap: 1rem;
}
.lb-entry .lb-rank { color: #b8963a; min-width: 2rem; }
.lb-entry .lb-name { flex: 1; }
.lb-entry .lb-score { color: #00f0ff; min-width: 3rem; text-align: right; }
.lb-entry .lb-date { color: #555; min-width: 5rem; text-align: right; font-size: 0.75rem; }
.lb-entry.highlight {
  background: rgba(0, 240, 255, 0.08);
  border-bottom-color: #00f0ff;
}
.lb-empty {
  text-align: center;
  color: #555;
  font-family: 'Crimson Text', serif;
  font-style: italic;
}
#leaderboard-back {
  margin-top: 0.5rem;
}

/* Game Over */
#gameover-screen {
  background: rgba(10, 10, 18, 0.92);
  z-index: 25;
}
#gameover-screen h2 {
  font-family: 'Special Elite', monospace;
  color: #b8963a;
  font-size: 1.8rem;
  letter-spacing: 0.2em;
  margin-bottom: 1rem;
}
#gameover-stats {
  margin-bottom: 1.5rem;
  text-align: center;
}
#gameover-stats p {
  font-family: 'Crimson Text', serif;
  color: #e8dcc8;
  font-size: 1rem;
  line-height: 1.8;
}
#gameover-stats .stat-highlight {
  color: #00f0ff;
  font-size: 1.2rem;
}
#name-entry {
  margin-bottom: 1rem;
  text-align: center;
}
#name-entry p {
  font-family: 'Crimson Text', serif;
  color: #e8dcc8;
  margin-bottom: 0.5rem;
}
#name-input {
  font-family: 'Special Elite', monospace;
  font-size: 1.5rem;
  text-align: center;
  background: transparent;
  border: none;
  border-bottom: 2px solid #00f0ff;
  color: #00f0ff;
  width: 80px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
#name-input:focus {
  outline: none;
  border-bottom-color: #e8dcc8;
}
#gameover-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

/* HUD */
#hud {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.6rem 1rem;
  z-index: 15;
  pointer-events: none;
}
#hud > * { pointer-events: auto; }
#hud-left, #hud-right {
  display: flex;
  gap: 1rem;
  align-items: center;
}
#hud span {
  font-family: 'Special Elite', monospace;
  font-size: 0.8rem;
  color: #e8dcc8;
  text-shadow: 0 0 10px rgba(0,0,0,0.8);
}
#hud-accuracy { color: #b8963a; }
#hud-score { color: #00f0ff; font-size: 1rem; }
#hud-pause-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  font-size: 1rem;
  cursor: pointer;
  color: #888;
  transition: color 0.2s;
}
#hud-pause-btn:hover { color: #e8dcc8; }

/* Pause */
#pause-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(10, 10, 18, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 35;
}
#pause-menu {
  text-align: center;
}
#pause-menu h2 {
  font-family: 'Special Elite', monospace;
  color: #b8963a;
  font-size: 1.5rem;
  letter-spacing: 0.2em;
  margin-bottom: 1.5rem;
}
#pause-menu .menu-btn {
  display: block;
  margin: 0.5rem auto;
}

/* Notification */
#notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'UnifrakturMaguntia', serif;
  font-size: clamp(2rem, 8vw, 4rem);
  color: #00f0ff;
  text-shadow: 0 0 30px rgba(0, 240, 255, 0.5);
  pointer-events: none;
  z-index: 40;
  transition: opacity 0.3s;
  opacity: 0;
}
#notification:not(.hidden) {
  opacity: 1;
}

/* Mobile Controls */
#mobile-controls {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 12;
  pointer-events: none;
}
#mobile-controls > * { pointer-events: auto; }
.mobile-btn {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(0, 240, 255, 0.4);
  background: rgba(0, 240, 255, 0.1);
  color: #00f0ff;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.mobile-btn:active {
  background: rgba(0, 240, 255, 0.3);
}

/* Responsive */
@media (max-width: 480px) {
  .menu-btn { min-width: 160px; padding: 0.5rem 1.5rem; }
  #hud-left, #hud-right { gap: 0.5rem; }
  #hud span { font-size: 0.7rem; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #0a0a12; }
::-webkit-scrollbar-thumb { background: #333; }
