:root {
  --bg: #0d0d1a;
  --fg: #e8e8f0;
  --accent: #4fe37b;
  --danger: #ff5c5c;
  font-family: "Courier New", Courier, monospace;
}

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

body {
  background: var(--bg) url("assets/space-bg.jpg") center / cover no-repeat;
  color: var(--fg);
  height: 100vh;
  overflow: hidden;
}

#hero {
  width: min(320px, 60vw);
  border-radius: 20px;
  box-shadow: 0 0 30px rgba(79, 227, 123, 0.25);
}

#game {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 1rem;
}

.hidden {
  display: none;
}

h1 {
  font-size: 3rem;
  letter-spacing: 0.3em;
  color: var(--accent);
}

.prompt {
  margin-top: 2rem;
  color: var(--accent);
  animation: blink 1.2s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0.3; }
}

kbd {
  border: 1px solid var(--fg);
  border-radius: 4px;
  padding: 0.1em 0.5em;
}

#play-screen {
  padding: 0;
  justify-content: flex-start;
}

#hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  font-size: 1.25rem;
  border-bottom: 1px solid #2a2a44;
  background: rgba(13, 13, 26, 0.75);
}

#lives {
  color: var(--danger);
  letter-spacing: 0.2em;
}

#progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(13, 13, 26, 0.85);
}

#progress-fill {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--accent), #ffd93d);
  box-shadow: 0 0 8px rgba(79, 227, 123, 0.7);
  transition: transform 0.2s ease-out;
}

#playfield {
  position: relative;
  flex: 1;
  width: 100%;
  overflow: hidden;
  /* Dims the art behind falling letters so they always stand out */
  background: rgba(13, 13, 26, 0.8);
}

.letter {
  position: absolute;
  top: 0;
  font-family: "Comic Sans MS", "Chalkboard SE", "Comic Neue", sans-serif;
  font-size: 2.8rem;
  font-weight: bold;
  color: var(--fg); /* overridden per letter from game.js */
  text-shadow:
    0 0 4px rgba(0, 0, 0, 1),
    0 0 8px rgba(0, 0, 0, 1),
    0 2px 12px rgba(0, 0, 0, 0.9),
    0 0 14px rgba(255, 255, 255, 0.25);
  will-change: transform;
  animation: letter-glow 1.4s ease-in-out infinite;
}

@keyframes letter-glow {
  50% {
    text-shadow:
      0 0 4px rgba(0, 0, 0, 1),
      0 0 8px rgba(0, 0, 0, 1),
      0 2px 12px rgba(0, 0, 0, 0.9),
      0 0 22px rgba(255, 255, 255, 0.55);
  }
}

.letter.cleared {
  transition: opacity 0.15s ease-out, scale 0.15s ease-out;
  opacity: 0;
  scale: 1.6;
}

.highscores {
  list-style: none;
  min-width: 280px;
  font-size: 1.15rem;
}

.highscores li {
  display: flex;
  justify-content: space-between;
  gap: 2.5rem;
  padding: 0.15rem 0;
}

.highscores .hs-initials {
  color: var(--accent);
  letter-spacing: 0.25em;
}

.highscores li:first-child .hs-initials,
.highscores li:first-child {
  color: #ffd93d;
}

.new-high {
  color: #ffd93d;
  font-size: 1.4rem;
  letter-spacing: 0.15em;
  animation: blink 0.8s step-end infinite;
}

#initials-display {
  font-size: 2.2rem;
  letter-spacing: 0.5em;
  color: var(--accent);
}

#mute-btn {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.4rem 0.55rem;
  background: rgba(13, 13, 26, 0.75);
  border: 1px solid #2a2a44;
  border-radius: 10px;
  cursor: pointer;
}

#mute-btn.muted {
  opacity: 0.5;
}

.particle {
  position: absolute;
  top: 0;
  left: 0;
  width: 7px;
  height: 7px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  will-change: transform, opacity;
  pointer-events: none;
}

#playfield.shake {
  animation: shake 0.3s;
}

@keyframes shake {
  20% { transform: translate(-8px, 4px); }
  40% { transform: translate(7px, -3px); }
  60% { transform: translate(-5px, 2px); }
  80% { transform: translate(3px, -1px); }
}

#score {
  display: inline-block;
}

#score.pop {
  animation: score-pop 0.25s ease-out;
}

@keyframes score-pop {
  40% { transform: scale(1.5); color: var(--accent); }
}
