:root {
  --bg: #0b1220;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #f97316;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at 40% 0%, rgba(249, 115, 22, 0.2), transparent 50%),
    linear-gradient(180deg, #0b1220, #111827 60%, #1c1917);
  user-select: none;
  touch-action: manipulation;
}

.header {
  text-align: center;
  padding: 1.15rem 1rem 0.3rem;
}

.header h1 {
  margin: 0.25rem 0;
  color: var(--accent);
}

.header p {
  margin: 0;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
}

.back {
  color: var(--muted);
  text-decoration: none;
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
}

.hud {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: system-ui, sans-serif;
  color: var(--muted);
  margin: 0.6rem 1rem;
  font-size: 0.9rem;
}

.hud strong {
  color: #fdba74;
  font-variant-numeric: tabular-nums;
}

.stage {
  position: relative;
  width: min(800px, 96vw);
  margin: 0.35rem auto 0.75rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 2px #44403c, 0 16px 36px rgba(0, 0, 0, 0.4);
  background: #14532d;
}

#game {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 1.2rem;
  text-align: center;
  background: rgba(12, 10, 9, 0.82);
  backdrop-filter: blur(4px);
  z-index: 5;
}

.overlay.hidden {
  display: none;
}

#overlay-title {
  margin: 0;
  font-size: 1.55rem;
  color: var(--accent);
}

.hint {
  margin: 0;
  max-width: 28rem;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.45;
}

.diff-picker {
  margin-top: 0.35rem;
  font-family: system-ui, sans-serif;
}

.diff-label {
  margin: 0 0 0.45rem;
  color: #e7e5e4;
  font-weight: 700;
  font-size: 0.9rem;
}

.diff-btns {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: center;
}

.diff {
  background: #292524;
  color: #e7e5e4;
  border: 2px solid #57534e;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: system-ui, sans-serif;
}

.diff.selected {
  background: var(--accent);
  color: #1c1917;
  border-color: #fb923c;
}

.overlay-actions {
  margin-top: 0.35rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

button#start,
button.secondary {
  font-family: system-ui, sans-serif;
  font-weight: 800;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
}

button#start {
  background: var(--accent);
  color: #1c1917;
}

button.secondary {
  background: #44403c;
  color: #fafaf9;
}

.controls {
  text-align: center;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  margin: 0 1rem 1rem;
}

.mobile-pad {
  display: none;
  max-width: 800px;
  margin: 0 auto 1.25rem;
  padding: 0 1rem;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-end;
}

.mobile-pad button {
  font-family: system-ui, sans-serif;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  background: #292524;
  color: #fafaf9;
  padding: 0.85rem 1rem;
  min-width: 64px;
  min-height: 54px;
  cursor: pointer;
}

#btn-gas {
  background: #16a34a;
  color: #052e16;
}

#btn-drift {
  background: #ea580c;
  color: #1c1917;
}

.pad-steer,
.pad-drive {
  display: flex;
  gap: 0.5rem;
}

.shop {
  max-width: 800px;
  margin: 0 auto 2.5rem;
  padding: 0 1rem;
}

.shop h2 {
  text-align: center;
  margin: 0 0 0.35rem;
}

.shop-note {
  text-align: center;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.85rem;
}

.car-card {
  background: #1c1917;
  border: 1px solid #44403c;
  border-radius: 12px;
  padding: 0.85rem 0.7rem;
  text-align: center;
  font-family: system-ui, sans-serif;
}

.car-card.equipped {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.35);
}

.car-preview {
  width: 56px;
  height: 28px;
  margin: 0 auto 0.5rem;
  border-radius: 4px;
  border: 2px solid #fff;
  box-shadow: 0 0 10px currentColor;
}

.car-card h3 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
}

.car-card .price,
.car-card .blurb,
.car-card .stats {
  margin: 0.12rem 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.car-card .price {
  color: #fdba74;
}

.car-btn {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.45rem;
  font-size: 0.85rem;
  font-family: system-ui, sans-serif;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: var(--accent);
  color: #1c1917;
}

.car-btn:disabled {
  opacity: 0.65;
  cursor: default;
}

.car-btn.owned {
  background: #38bdf8;
  color: #0f172a;
}

.car-btn.equipped-btn {
  background: #57534e;
  color: #e7e5e4;
}

@media (max-width: 820px), (pointer: coarse) {
  .mobile-pad {
    display: flex;
  }
  .controls {
    display: none;
  }
}
