:root {
  --bg: #07090e;
  --panel: rgba(10, 13, 20, 0.92);
  --ink: #cdd6e4;
  --dim: #5a6577;
  --gold: #ffc843;
  --red: #ff4f6d;
  --cyan: #53e0ff;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Courier New", ui-monospace, monospace;
  overflow: hidden;
}

#frame {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  max-width: 100vw;
  max-height: 100vh;
  aspect-ratio: 960 / 600;
  background: var(--bg);
  cursor: crosshair;
  touch-action: none;   /* taps fire; the browser doesn't get to scroll */
}

.hidden { display: none !important; }

/* ---- HUD ---- */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 26px;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.9);
}

#hearts { font-size: 22px; color: var(--red); letter-spacing: 4px; }

#ammo { margin-top: 8px; display: flex; gap: 5px; }

#ammo .pip {
  width: 9px; height: 20px;
  border-radius: 2px;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}
#ammo .pip.empty {
  background: transparent;
  border: 1px solid var(--dim);
  box-shadow: none;
}

#hud-right { text-align: right; }
#score { font-size: 30px; color: var(--ink); font-weight: bold; }
#combo { font-size: 16px; color: var(--gold); min-height: 20px; }
#wave  { font-size: 14px; color: var(--dim); letter-spacing: 2px; }

/* ---- Screens ---- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--panel);
  text-align: center;
  padding: 20px;
  overflow-y: auto;
}

.screen h1 {
  font-size: 64px;
  letter-spacing: 12px;
  color: var(--ink);
  text-shadow: 0 0 24px rgba(83, 224, 255, 0.35);
}
.screen h1 span { color: var(--gold); }

.tag { color: var(--gold); font-size: 18px; letter-spacing: 3px; }

.rules {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
.rules b { color: var(--cyan); }

.controls { color: var(--dim); font-size: 13px; }
kbd {
  border: 1px solid var(--dim);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 12px;
}

/* ---- difficulty buttons ---- */
#diffs {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: min(640px, 92%);
}

#diffs button {
  font-family: inherit;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 9px 16px;
  background: rgba(83, 224, 255, 0.04);
  border: 1px solid var(--dim);
  border-radius: 4px;
  color: var(--ink);
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 3px;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}

#diffs button span {
  font-weight: normal;
  letter-spacing: 0;
  font-size: 12px;
  color: var(--dim);
  text-align: right;
}

#diffs button:hover {
  border-color: var(--cyan);
  background: rgba(83, 224, 255, 0.12);
}
#diffs button:hover span { color: var(--ink); }

#diffs button[data-diff="hard"]:hover,
#diffs button[data-diff="suicidal"]:hover {
  border-color: var(--red);
  background: rgba(255, 79, 109, 0.12);
}

/* ---- hiscore board + initials entry ---- */
#entry { display: flex; flex-direction: column; align-items: center; gap: 8px; }

#initials {
  font-family: inherit;
  width: 120px;
  padding: 8px 0;
  text-align: center;
  font-size: 30px;
  font-weight: bold;
  letter-spacing: 12px;
  text-indent: 12px;       /* visually recenters the letter-spaced text */
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(255, 200, 67, 0.06);
  border: 1px solid var(--gold);
  border-radius: 4px;
  outline: none;
  caret-color: var(--gold);
}
#initials::placeholder { color: rgba(255, 200, 67, 0.25); }

#board {
  list-style: none;
  counter-reset: rank;
  width: min(360px, 90%);
  font-size: 14px;
}

#board li {
  counter-increment: rank;
  display: flex;
  gap: 14px;
  padding: 2px 10px;
}
#board li::before {
  content: counter(rank, decimal-leading-zero);
  color: var(--dim);
}
#board li .ini { color: var(--gold); font-weight: bold; min-width: 42px; text-align: left; }
#board li .pts { flex: 1; text-align: right; }
#board li .dif { color: var(--dim); min-width: 70px; text-align: right; }
#board li.fresh { background: rgba(255, 200, 67, 0.12); border-radius: 3px; }

.go {
  margin-top: 10px;
  color: var(--cyan);
  font-size: 18px;
  letter-spacing: 4px;
  animation: pulse 1.2s ease-in-out infinite;
}

.best { color: var(--dim); font-size: 14px; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
