/* ====================================================
   NEON RUNNER — style.css
   Aesthetic: Retro-Arcade / Dark Neon
   ==================================================== */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --clr-bg:        #050810;
  --clr-bg2:       #0a1020;
  --clr-lane:      #111828;
  --clr-neon:      #00f5ff;
  --clr-neon2:     #ff2d78;
  --clr-neon3:     #aaff00;
  --clr-accent:    #f0c040;
  --clr-text:      #e0eaff;
  --clr-muted:     #4a6080;
  --clr-overlay:   rgba(4,8,18,0.88);

  --font-display:  'Orbitron', sans-serif;
  --font-mono:     'Share Tech Mono', monospace;

  --lane-w:        420px;   /* canvas width reference */
  --canvas-h:      520px;

  --radius:        6px;
  --transition:    0.18s ease;
}

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

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

/* ---------- Screens ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 10;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
}
.screen.overlay {
  background: var(--clr-overlay);
  backdrop-filter: blur(6px);
  z-index: 30;
}
#screen-game {
  flex-direction: column;
  background: var(--clr-bg);
  z-index: 5;
}
#screen-game.active { opacity: 1; pointer-events: all; }

/* ---------- Start Screen ---------- */
.screen-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px 32px;
  width: min(480px, 94vw);
}

.logo-wrapper { text-align: center; }
.logo-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 6px;
  color: var(--clr-neon);
  opacity: 0.8;
  margin-bottom: 6px;
}
.logo {
  font-family: var(--font-display);
  font-size: clamp(32px, 8vw, 52px);
  font-weight: 900;
  letter-spacing: 4px;
  color: #fff;
  text-shadow:
    0 0 12px var(--clr-neon),
    0 0 40px var(--clr-neon),
    0 0 80px rgba(0,245,255,0.3);
  animation: logoFlicker 4s infinite;
}
.logo-line {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--clr-neon), transparent);
  margin-top: 10px;
}

@keyframes logoFlicker {
  0%,100% { opacity: 1; }
  92%      { opacity: 1; }
  93%      { opacity: 0.4; }
  94%      { opacity: 1; }
  97%      { opacity: 0.6; }
  98%      { opacity: 1; }
}

/* Controls Info */
.controls-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 16px 20px;
  border: 1px solid rgba(0,245,255,0.15);
  border-radius: var(--radius);
  background: rgba(0,245,255,0.04);
}
.ctrl-row {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--clr-muted);
}
.ctrl-row span:last-child { color: var(--clr-text); }
.kbd {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--clr-muted);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--clr-neon);
  min-width: 64px;
  text-align: center;
}
.mobile-hint { opacity: 0.6; }

.hs-display {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--clr-muted);
}
.hs-display span { color: var(--clr-accent); }

/* ---------- Buttons ---------- */
.btn-primary, .btn-secondary {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 3px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  padding: 14px 24px;
  text-align: center;
}
.btn-primary {
  background: var(--clr-neon);
  color: #000;
  box-shadow: 0 0 20px rgba(0,245,255,0.5), 0 0 60px rgba(0,245,255,0.15);
}
.btn-primary:hover {
  background: #fff;
  box-shadow: 0 0 30px rgba(0,245,255,0.8), 0 0 80px rgba(0,245,255,0.3);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: transparent;
  color: var(--clr-muted);
  border: 1px solid var(--clr-muted);
}
.btn-secondary:hover {
  color: var(--clr-text);
  border-color: var(--clr-text);
  background: rgba(255,255,255,0.05);
}

/* ---------- HUD ---------- */
#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(var(--lane-w), 100vw);
  padding: 10px 16px;
  background: rgba(10,16,32,0.9);
  border-bottom: 1px solid rgba(0,245,255,0.1);
  z-index: 20;
  flex-shrink: 0;
}
.hud-block { display: flex; flex-direction: column; align-items: flex-start; }
.hud-block.center { align-items: center; }
.hud-block.right  { align-items: flex-end; }
.hud-label {
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--clr-muted);
  font-family: var(--font-mono);
}
.hud-value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--clr-neon);
  text-shadow: 0 0 10px var(--clr-neon);
  min-width: 60px;
}
.hud-block.center .hud-value { text-align: center; }
.hud-block.right .hud-value  { text-align: right; }

/* ---------- Canvas ---------- */
#game-canvas {
  display: block;
  width: min(var(--lane-w), 100vw);
  /* height managed by JS */
  flex-shrink: 0;
}

/* ---------- Pause Button ---------- */
.btn-pause {
  position: absolute;
  top: 52px;
  right: calc(50% - min(var(--lane-w),100vw)/2 + 8px);
  background: transparent;
  border: 1px solid var(--clr-muted);
  color: var(--clr-muted);
  font-size: 16px;
  padding: 4px 9px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  z-index: 25;
  display: none; /* shown only on mobile via JS */
}
.btn-pause:hover { color: var(--clr-text); border-color: var(--clr-text); }

/* ---------- Overlay Screens ---------- */
.overlay-title {
  font-family: var(--font-display);
  font-size: clamp(28px,7vw,44px);
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--clr-neon);
  text-shadow: 0 0 20px var(--clr-neon), 0 0 60px rgba(0,245,255,0.4);
}
.gameover-title {
  color: var(--clr-neon2);
  text-shadow: 0 0 20px var(--clr-neon2), 0 0 60px rgba(255,45,120,0.4);
}

.result-grid {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid rgba(0,245,255,0.12);
  border-radius: var(--radius);
  overflow: hidden;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(0,245,255,0.03);
}
.result-row.highlight {
  background: rgba(240,192,64,0.08);
  border-top: 1px solid rgba(240,192,64,0.2);
}
.r-label {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--clr-muted);
}
.r-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--clr-text);
}
.result-row.highlight .r-value { color: var(--clr-accent); }

.new-record {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--clr-accent);
  text-shadow: 0 0 12px var(--clr-accent);
  animation: recordPulse 1s ease-in-out infinite alternate;
}
.new-record.hidden { display: none; }

@keyframes recordPulse {
  from { opacity: 0.7; transform: scale(0.97); }
  to   { opacity: 1;   transform: scale(1.03); }
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  :root { --lane-w: 100vw; }
  .logo { font-size: 28px; }
  .hud-value { font-size: 15px; }
  .btn-pause { display: block; }
}

@media (max-height: 600px) {
  :root { --canvas-h: 380px; }
  .screen-content { gap: 14px; padding: 20px 16px; }
}

/* ---------- Scanline Overlay ---------- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
  z-index: 9999;
}