/* style.css — Desert Dash */
:root {
  --bg: #0b1026;
  --fg: #f3ead6;
  --accent: #ffcf5c;
  --accent-2: #ff8a4c;
  --muted: rgba(243, 234, 214, 0.55);
  --panel: rgba(10, 14, 38, 0.88);
  --border: rgba(255, 207, 92, 0.3);
  --shadow: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f6e9d2;
  --fg: #2a2316;
  --muted: rgba(42, 35, 22, 0.55);
  --panel: rgba(255, 250, 240, 0.92);
  --border: rgba(120, 90, 40, 0.35);
  --shadow: rgba(80, 50, 10, 0.25);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Roboto Mono', Consolas, 'Liberation Mono', Menlo, monospace;
}
canvas#game {
  display: block;
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

/* Score HUD */
.hud-score {
  position: fixed; top: 16px; right: 18px;
  display: flex; gap: 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  z-index: 5;
  text-shadow: 0 2px 0 rgba(0,0,0,0.4), 0 0 12px rgba(0,0,0,0.3);
}
.hud-hi { color: var(--muted); }
.hud-cur { color: var(--fg); }

/* Overlay screens */
.overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(8,12,32,0.45), rgba(8,12,32,0.86));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 10;
  transition: opacity 0.3s ease;
}
.overlay.hidden { opacity: 0; pointer-events: none; }
.screen {
  text-align: center;
  padding: 32px 28px;
  max-width: 92vw;
  color: var(--fg);
  animation: screenIn 0.4s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.screen.hidden { display: none; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(255, 207, 92, 0.12);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 16px;
  margin-bottom: 22px;
}
.badge-red {
  color: var(--accent-2);
  background: rgba(255, 138, 76, 0.12);
  border-color: rgba(255, 138, 76, 0.3);
}

.title {
  font-family: 'Arial Black', 'Helvetica Neue', Impact, system-ui, sans-serif;
  font-size: clamp(36px, 9vw, 72px);
  line-height: 1.0;
  margin: 0 0 20px;
  letter-spacing: 0.04em;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--fg);
  text-shadow: 4px 4px 0 rgba(0,0,0,0.6), 0 0 32px rgba(255,207,92,0.2);
}
.title span {
  color: var(--accent);
  text-shadow: 4px 4px 0 rgba(0,0,0,0.6), 0 0 28px rgba(255,207,92,0.45);
}
.title.small { font-size: clamp(28px, 6.5vw, 48px); }

.blurb {
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
  margin: 0 0 28px;
  letter-spacing: 0.1em;
}

.keys {
  display: flex; gap: 16px; justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 30px;
}
.key {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  font-size: 10px; color: var(--muted); letter-spacing: 0.12em;
  text-transform: uppercase;
}
.key kbd {
  display: inline-block;
  min-width: 38px; padding: 9px 12px;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 9px;
  color: var(--fg);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 3px 0 rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
}

.play-btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #1a1408;
  background: linear-gradient(180deg, #ffdf7a, var(--accent));
  border: none;
  padding: 17px 38px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 5px 0 #b88f1f, 0 10px 24px rgba(0,0,0,0.45);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease;
  position: relative;
}
.play-btn:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 7px 0 #b88f1f, 0 12px 28px rgba(0,0,0,0.5); }
.play-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #b88f1f, 0 5px 12px rgba(0,0,0,0.4); }

.result {
  display: flex; gap: 40px; justify-content: center;
  margin: 10px 0 20px;
}
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat label { font-size: 10px; color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; }
.stat b { font-size: 26px; color: var(--fg); font-weight: 800; letter-spacing: 0.05em; }
.newbest {
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.22em;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 20px;
  animation: pulse 0.8s ease-in-out infinite;
  text-shadow: 0 0 16px rgba(255,207,92,0.5);
}
.newbest.hidden { display: none; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.1); }
}

.hint {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--muted); letter-spacing: 0.12em;
  z-index: 4;
}
.hint.hidden { display: none; }

@media (max-width: 480px) {
  .hud-score { font-size: 11px; top: 10px; right: 12px; gap: 10px; }
  .keys { gap: 10px; }
  .result { gap: 26px; }
  .stat b { font-size: 22px; }
  .play-btn { padding: 15px 32px; font-size: 14px; }
  .screen { padding: 24px 20px; }
}


