/* ═══════════════════════════════════════════════════════════
   KIRO'S GHOST RUNNER — Stylesheet
   Theme: Dark cloud/space with neon cyan & purple accents
   ════════════════════════════════════════════════════════ */

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

:root {
  /* Palette */
  --bg-deep:       #080c14;
  --bg-panel:      #0d1424;
  --bg-overlay:    rgba(8, 12, 20, 0.88);
  --neon-cyan:     #00f5ff;
  --neon-purple:   #b44fff;
  --neon-yellow:   #ffe066;
  --neon-red:      #ff4f6d;
  --text-primary:  #e8eaf6;
  --text-muted:    #5a6a8a;
  --text-accent:   #00f5ff;
  --border-glow:   rgba(0, 245, 255, 0.25);

  /* Typography */
  --font-mono: 'Courier New', 'Consolas', monospace;
  --font-ui:   'Segoe UI', system-ui, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-ui);
  overflow: hidden;
  user-select: none;
}

/* ─── Game Wrapper ───────────────────────────────────────── */
#game-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ─── Canvas ─────────────────────────────────────────────── */
#game-canvas {
  display: block;
  /* Size is set by JS to maintain 16:9 within viewport */
  image-rendering: pixelated;
  border: 1px solid var(--border-glow);
  box-shadow:
    0 0 30px rgba(0, 245, 255, 0.12),
    0 0 80px rgba(180, 79, 255, 0.06);
}

/* ─── HUD ────────────────────────────────────────────────── */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 10px 20px;
  z-index: 10;
  pointer-events: none;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.hud-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: bold;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 245, 255, 0.7);
  transition: color 0.2s;
  min-width: 60px;
  text-align: center;
}

/* Score bump animation triggered by JS */
.hud-value.bump {
  animation: scoreBump 0.2s ease-out;
}

@keyframes scoreBump {
  0%   { transform: scale(1);    color: var(--neon-yellow); }
  50%  { transform: scale(1.25); color: var(--neon-yellow); text-shadow: 0 0 14px rgba(255, 224, 102, 0.9); }
  100% { transform: scale(1);    color: var(--neon-cyan); }
}

/* ─── Overlays (Start / Game Over) ──────────────────────── */
.overlay {
  position: absolute;
  inset: 0;
  display: none;               /* hidden by default */
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  z-index: 20;
  animation: fadeIn 0.3s ease;
}

.overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

.screen-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 48px;
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  box-shadow:
    0 0 40px rgba(0, 245, 255, 0.08),
    inset 0 1px 0 rgba(255,255,255,0.04);
  max-width: 420px;
  width: 90%;
  text-align: center;
}

/* ─── Ghost Logo ─────────────────────────────────────────── */
.ghost-logo {
  /* SVG sizes itself via width/height attributes — no font-size needed */
  font-size: 0;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ghostFloat 2.5s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(0, 245, 255, 0.55));
}

.ghost-logo.crashed {
  animation: ghostShake 0.5s ease-in-out 1;
  filter: drop-shadow(0 0 10px rgba(255, 79, 109, 0.55))
          sepia(1) saturate(4) hue-rotate(300deg) brightness(1.1);
}

@keyframes ghostFloat {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-10px); }
}

@keyframes ghostShake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px) rotate(-5deg); }
  40%       { transform: translateX(8px) rotate(5deg); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

/* ─── Title & Typography ─────────────────────────────────── */
.game-title {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 2px;
  color: var(--text-primary);
  text-transform: uppercase;
}

.game-title .accent {
  color: var(--neon-cyan);
  text-shadow: 0 0 16px rgba(0, 245, 255, 0.6);
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.key-hint {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

kbd {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(0, 245, 255, 0.08);
  border: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--neon-cyan);
  letter-spacing: 1px;
}

.gameover-title {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--neon-red);
  text-shadow: 0 0 14px rgba(255, 79, 109, 0.6);
  text-transform: uppercase;
}

.gameover-reason {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 1px;
}

.version-tag {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  opacity: 0.6;
}

/* ─── Score Summary (Game Over) ──────────────────────────── */
.score-summary {
  width: 100%;
  background: rgba(0, 245, 255, 0.03);
  border: 1px solid var(--border-glow);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-muted);
}

.score-row span:last-child {
  font-size: 18px;
  color: var(--text-primary);
  font-weight: bold;
}

.score-row.highlight {
  color: var(--neon-yellow);
}

.score-row.highlight span:last-child {
  color: var(--neon-yellow);
  text-shadow: 0 0 10px rgba(255, 224, 102, 0.6);
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 13px 24px;
  background: transparent;
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  box-shadow: 0 0 12px rgba(0, 245, 255, 0.15), inset 0 0 12px rgba(0, 245, 255, 0.04);
}

.btn-primary:hover {
  background: rgba(0, 245, 255, 0.1);
  box-shadow: 0 0 24px rgba(0, 245, 255, 0.3), inset 0 0 18px rgba(0, 245, 255, 0.08);
}

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

.btn-secondary {
  width: 100%;
  padding: 10px 24px;
  background: transparent;
  border: 1px solid rgba(180, 79, 255, 0.4);
  border-radius: 8px;
  color: var(--neon-purple);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-secondary:hover {
  background: rgba(180, 79, 255, 0.1);
  box-shadow: 0 0 16px rgba(180, 79, 255, 0.2);
}

/* ─── Responsive scaling hint for canvas wrapper ────────── */
@media (max-width: 600px) {
  .screen-content {
    padding: 28px 24px;
    gap: 12px;
  }

  .game-title { font-size: 22px; }
  .ghost-logo svg { width: 56px; height: 66px; }  /* scale SVG on small screens */

  .hud-value  { font-size: 18px; }
  .hud-label  { font-size: 9px; }
}

/* ─── Author Credit ──────────────────────────────────────────────── */
.dev-credit {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.dev-credit strong {
  color: var(--neon-cyan);
  font-weight: 600;
}

.dev-credit .muted {
  opacity: 0.6;
}

/* HUD center watermark */
.hud-center-credit {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(90, 106, 138, 0.55);
  align-self: center;
  pointer-events: none;
}
