/* ============================================================
   style.css – TypGame
   Donker ruimtethema  |  Cyan/rood accenten  |  Mobiel-ready
   ============================================================ */

/* ── Reset & basis ──────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cyan:       #00ffff;
  --red:        #ff4444;
  --gold:       #ffcc00;
  --bg:         #000510;
  --hud-h:      48px;
  --kb-h:       168px;         /* hoogte mobiel toetsenbord */
  --font:       'Courier New', Courier, monospace;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: #fff;
  font-family: var(--font);
}

/* ── Canvas ─────────────────────────────────────────────── */
#game-canvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
}

/* ── HUD ─────────────────────────────────────────────────── */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hud-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background: rgba(0, 5, 16, 0.82);
  border-bottom: 1px solid rgba(0, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  z-index: 50;
  font-size: 1rem;
  color: #99bbdd;
  pointer-events: none;
  user-select: none;
}

#hud.hidden { display: none; }

#score-display span,
#level-display span {
  color: var(--cyan);
  font-weight: 700;
}

#lives-display {
  display: flex;
  gap: 0.35rem;
}

#lives-display .life {
  font-size: 1.3rem;
  color: var(--red);
  transition: color 0.3s, text-shadow 0.3s;
  text-shadow: 0 0 8px var(--red);
}

#lives-display .life.lost {
  color: #2a1010;
  text-shadow: none;
}

/* ── Schermen (start / game-over) ───────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 5, 16, 0.93);
  backdrop-filter: blur(6px);
  z-index: 100;
  transition: opacity 0.3s;
}

.screen.hidden {
  display: none;
}

.screen-content {
  text-align: center;
  padding: 2rem 1.5rem;
  max-width: 480px;
  width: 100%;
}

/* Titel */
.game-title {
  font-size: clamp(2.4rem, 8vw, 4.5rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  text-shadow: 0 0 18px var(--cyan), 0 0 40px var(--cyan);
  line-height: 1;
}

.game-title span {
  color: var(--red);
  text-shadow: 0 0 18px var(--red), 0 0 40px var(--red);
}

.subtitle {
  margin: 1rem 0 2rem;
  color: #7799bb;
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  line-height: 1.5;
}

/* Knop */
.btn {
  display: inline-block;
  background: transparent;
  border: 2px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font);
  font-size: clamp(0.95rem, 3vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.75rem 2.5rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  border-radius: 2px;
}

.btn:hover,
.btn:focus-visible {
  background: var(--cyan);
  color: var(--bg);
  box-shadow: 0 0 20px var(--cyan);
  outline: none;
}

.btn:active {
  transform: scale(0.97);
}

/* Instructies (startscherm) */
.instructions {
  margin-top: 2rem;
  list-style: none;
  color: #445566;
  font-size: clamp(0.72rem, 2vw, 0.85rem);
  line-height: 2;
}

.instructions em {
  color: #7799bb;
  font-style: normal;
}

/* Score / high score (game-over scherm) */
.score-line {
  font-size: clamp(1.4rem, 5vw, 2rem);
  color: var(--cyan);
  margin: 1rem 0 0.4rem;
  text-shadow: 0 0 12px var(--cyan);
}

.score-line span,
.hs-line span {
  font-weight: 700;
}

.hs-line {
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  color: #6688aa;
  margin-bottom: 2rem;
}

/* ── Mobiel toetsenbord ─────────────────────────────────── */
#mobile-keyboard {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--kb-h);
  background: rgba(0, 8, 18, 0.97);
  border-top: 1px solid rgba(0, 255, 255, 0.15);
  padding: 6px 4px 8px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

#mobile-keyboard.hidden {
  display: none;
}

.kb-row {
  display: flex;
  gap: 4px;
}

.kb-key {
  background: rgba(0, 255, 255, 0.07);
  border: 1px solid rgba(0, 255, 255, 0.2);
  color: #aaccee;
  font-family: var(--font);
  font-size: clamp(0.7rem, 2.5vw, 0.9rem);
  font-weight: 600;
  width: clamp(26px, 8.5vw, 36px);
  height: clamp(26px, 8.5vw, 36px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.08s, border-color 0.08s, color 0.08s;
  text-transform: uppercase;
  touch-action: manipulation;
}

.kb-key:active,
.kb-key.pressed {
  background: rgba(0, 255, 255, 0.35);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}

/* ── Hulpklassen ────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsief fijn-afstemmen ──────────────────────────── */
@media (max-width: 400px) {
  :root { --kb-h: 150px; }

  .kb-key {
    width: 26px;
    height: 26px;
    font-size: 0.65rem;
    gap: 3px;
  }

  .kb-row { gap: 3px; }
}
