:root {
  color-scheme: only light;
  --line: rgba(255, 232, 180, 0.24);
  --panel: rgba(18, 30, 34, 0.7);
  --shadow: rgba(8, 15, 18, 0.45);
  --text: #f9f1d6;
  --text-dim: rgba(249, 241, 214, 0.82);
  --heat: linear-gradient(90deg, #f0c66a 0%, #ef7c37 55%, #d63a2f 100%);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #152126;
  font-family: "Trebuchet MS", "Lucida Sans Unicode", sans-serif;
  color: var(--text);
}

body {
  letter-spacing: 0.02em;
}

#app,
#game-shell {
  position: fixed;
  inset: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(255, 217, 128, 0.18), transparent 36%),
    linear-gradient(180deg, rgba(5, 8, 10, 0.12), rgba(5, 8, 10, 0.48));
  z-index: 3;
}

.panel {
  width: min(560px, 100%);
  padding: 28px 28px 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(31, 46, 52, 0.85), rgba(19, 31, 35, 0.9)),
    linear-gradient(135deg, rgba(255, 226, 164, 0.12), transparent 55%);
  box-shadow: 0 30px 70px var(--shadow);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 8px;
  color: #f0cf8d;
  font-size: 0.75rem;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.6rem, 7vw, 4.8rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 0.95;
}

.lead {
  margin: 16px 0 20px;
  max-width: 38ch;
  color: var(--text-dim);
  line-height: 1.45;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #25170d;
  background: linear-gradient(135deg, #ffd991, #ff8f50);
  box-shadow: 0 10px 30px rgba(255, 143, 80, 0.38);
  cursor: pointer;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.controls span {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 244, 215, 0.08);
  border: 1px solid rgba(255, 244, 215, 0.1);
}

.hud {
  position: fixed;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
  pointer-events: none;
  z-index: 2;
}

.hud-card {
  min-width: 112px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 244, 215, 0.14);
  background: rgba(12, 22, 26, 0.52);
  box-shadow: 0 12px 24px rgba(6, 11, 14, 0.2);
  backdrop-filter: blur(10px);
}

.label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.hud strong {
  font-size: 1.1rem;
}

.heat-card {
  min-width: 168px;
}

.heat-bar {
  overflow: hidden;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

#heat-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--heat);
  transition: width 0.08s linear;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(26, 11, 9, 0.82);
  border: 1px solid rgba(255, 120, 84, 0.35);
  color: #ffd0b4;
  box-shadow: 0 20px 30px rgba(15, 4, 4, 0.35);
  z-index: 2;
}

.hidden {
  display: none;
}

.trick-popup {
  position: fixed;
  top: 28%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  text-transform: uppercase;
  color: #ffe066;
  text-shadow:
    0 0 20px rgba(255, 200, 50, 0.8),
    0 0 40px rgba(255, 140, 20, 0.5),
    0 4px 8px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.08em;
  pointer-events: none;
  z-index: 4;
  white-space: nowrap;
  animation: trick-in 0.12s ease-out;
}

.trick-sub {
  display: block;
  font-size: 0.5em;
  color: rgba(255, 230, 160, 0.7);
  text-shadow: none;
  margin-top: 2px;
  letter-spacing: 0.12em;
}

@keyframes trick-in {
  from { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.speed-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 35%,
    rgba(255, 240, 200, 0.04) 65%,
    rgba(255, 220, 160, 0.1) 100%
  );
  transition: opacity 0.3s;
}

@media (max-width: 720px) {
  .panel {
    padding: 22px 18px 20px;
  }

  .hud {
    top: auto;
    bottom: 16px;
    left: 16px;
    right: 16px;
  }

  .hud-card {
    flex: 1 1 140px;
  }
}
