:root {
  color-scheme: dark;
  --ink: #fff3e0;
  --muted: #c9a173;
  --panel: #241609;
  --line: #3d2a17;
  --accent: #ff8c42;
  --accent-ink: #1c1006;
  --gold: #ffd77a;
  --hot: #e2372b;
  --green: #42b34f;
  --blue: #61b4ff;
  --road: #2b2420;
  --display: "Baloo 2", "Avenir Next Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% 0%, rgb(255 140 66 / 0.1), transparent 30rem),
    linear-gradient(135deg, #170d06, #241609 48%, #170d06);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 12px;
}

.shell {
  width: min(100%, 480px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 24px);
}

/* ─── HUD ─── */

.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: inset 0 -1px 0 rgb(255 243 224 / 0.04);
}

.label {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-score {
  flex: 1;
  min-width: 0;
}

.hud-score strong {
  display: block;
  margin-top: 2px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.05rem, 4.6vw, 1.4rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hud-fuel {
  flex: 1.4;
  min-width: 0;
}

.fuel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.fuel-num {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.fuel-track {
  margin-top: 5px;
  height: 9px;
  border-radius: 99px;
  background: rgb(255 243 224 / 0.1);
  overflow: hidden;
}

.fuel-fill {
  width: 100%;
  height: 100%;
  border-radius: 99px;
  background: var(--green);
  transition: width 0.15s linear;
}

.hud-level {
  flex-shrink: 0;
  text-align: right;
}

.tip-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 3px;
}

.tip-chip {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 0.78rem;
  padding: 1px 8px;
  border-radius: 99px;
  line-height: 1.3;
}

/* ─── Game Frame ─── */

.game-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--road);
  box-shadow: 0 24px 56px rgb(0 0 0 / 0.38), 0 0 0 1px rgb(255 243 224 / 0.04) inset;
  touch-action: none;
}

.game-frame::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: repeating-linear-gradient(
    to bottom,
    rgb(255 243 224 / 0.03) 0,
    rgb(255 243 224 / 0.03) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: soft-light;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 7 / 12;
  max-height: calc(100vh - 154px);
  background: var(--road);
}

.pause-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 42px;
  height: 34px;
  border: 1px solid rgb(255 243 224 / 0.16);
  color: var(--ink);
  background: rgb(23 13 6 / 0.58);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.92rem;
}

/* ─── Overlay ─── */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px 20px;
  text-align: center;
  background: linear-gradient(rgb(23 13 6 / 0.9), rgb(23 13 6 / 0.64));
  backdrop-filter: blur(3px);
  overflow-y: auto;
}

.overlay.hidden {
  display: none;
}

.overlay-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 340px;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.2rem, 12vw, 4rem);
  font-weight: 800;
  line-height: 0.95;
}

p {
  max-width: 30ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.coins-earned {
  color: var(--gold);
  font-weight: 700;
  font-size: 1.1rem;
}

button {
  border: 0;
  border-radius: 999px;
  color: var(--accent-ink);
  background: var(--accent);
  font-family: var(--display);
  font-size: inherit;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid rgb(255 215 122 / 0.9);
  outline-offset: 2px;
}

.overlay-main-btn {
  min-width: 200px;
  min-height: 48px;
  padding: 0 24px;
  font-size: 1.05rem;
  margin-top: 6px;
  box-shadow: 0 10px 24px rgb(255 140 66 / 0.3);
}

.mute-btn {
  min-height: 34px;
  padding: 0 18px;
  font-size: 0.8rem;
  color: var(--muted);
  background: rgb(255 243 224 / 0.06);
  border: 1px solid var(--line);
  box-shadow: none;
}

.mute-btn:active {
  background: rgb(255 243 224 / 0.12);
}

.best-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgb(255 243 224 / 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  margin-top: 8px;
}

.best-chip span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.best-chip strong {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ─── Game Over ─── */

.go-score {
  font-family: var(--display);
  font-weight: 800;
  font-size: 2.7rem;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.new-best {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.go-stats {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
}

.go-stat {
  flex: 1;
  background: rgb(255 243 224 / 0.05);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 4px;
  text-align: center;
}

.go-stat strong {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
}

.go-stat strong.stat-accent { color: var(--accent); }
.go-stat strong.stat-gold { color: var(--gold); }

.go-stat span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.go-btn-row {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
}

.go-btn-row .overlay-main-btn {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.go-garage-btn {
  background: rgb(255 243 224 / 0.07);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: none;
}

/* ─── Leaderboard ─── */

.lb-section {
  width: 100%;
  margin-top: 6px;
}

.lb-section h2 {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.lb {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
  max-height: 200px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.lb li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.88rem;
  color: var(--ink);
  border-bottom: 1px solid rgb(255 243 224 / 0.08);
  font-variant-numeric: tabular-nums;
}

.lb li:last-child {
  border-bottom: 0;
}

.lb-gold {
  color: var(--gold) !important;
  font-weight: 700;
}

.lb-empty {
  font-size: 0.85rem;
  color: var(--muted);
}

.lb-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-lvl {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

/* ─── Name Prompt ─── */

.name-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.name-label {
  font-size: 0.9rem;
  color: var(--ink);
}

.name-input {
  width: 100%;
  max-width: 220px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(255 243 224 / 0.06);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  text-align: center;
  outline: none;
}

.name-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgb(255 140 66 / 0.2);
}

.name-submit-btn {
  min-width: 120px;
  min-height: 40px;
  padding: 0 20px;
  font-size: 0.95rem;
}

/* ─── Shop / Garage ─── */

.shop-coins {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgb(255 215 122 / 0.1);
  border: 1px solid rgb(255 215 122 / 0.3);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.9rem;
  color: var(--gold);
  font-weight: 700;
}

.shop-coins strong {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.shop-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: rgb(255 243 224 / 0.05);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: left;
}

.shop-item.shop-maxed {
  opacity: 0.5;
}

.shop-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: rgb(255 140 66 / 0.14);
}

.shop-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.shop-info strong {
  font-size: 0.92rem;
  color: var(--ink);
}

.shop-info span {
  font-size: 0.72rem;
  color: var(--muted);
}

.pips {
  display: flex;
  gap: 4px;
  margin-top: 3px;
}

.pip {
  width: 12px;
  height: 5px;
  border-radius: 2px;
  background: rgb(255 243 224 / 0.12);
}

.pip-on {
  background: var(--accent);
}

.shop-buy {
  flex-shrink: 0;
  min-width: 70px;
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.85rem;
  font-weight: 800;
  border-radius: 999px;
}

.shop-buy:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.shop-hint {
  font-size: 0.75rem;
  color: var(--green);
  font-style: italic;
  opacity: 0.85;
}

.reset-btn {
  min-height: 30px;
  padding: 0 14px;
  font-size: 0.7rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid rgb(255 243 224 / 0.1);
  margin-top: 8px;
  opacity: 0.5;
  box-shadow: none;
}

.reset-btn:hover {
  opacity: 1;
  border-color: var(--hot);
  color: var(--hot);
}

/* ─── Touch Controls ─── */

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.controls button {
  min-height: 54px;
  color: var(--ink);
  background: #2e1d0e;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 2rem;
  line-height: 1;
  box-shadow: none;
}

.controls #boostButton {
  color: #13220f;
  background: var(--green);
}

.controls button:active {
  transform: translateY(1px);
  background: #3d2a17;
}

/* ─── Tilt Mode ─── */

.calibrate-btn {
  display: none;
  width: 100%;
  min-height: 36px;
  font-size: 0.8rem;
  color: var(--muted);
  background: rgb(255 243 224 / 0.06);
  border: 1px solid var(--line);
  box-shadow: none;
}

.calibrate-btn:active {
  background: rgb(255 243 224 / 0.12);
}

.controls.tilt-mode {
  grid-template-columns: 1fr 1fr;
}

.controls.tilt-mode .dir-btn {
  display: none;
}

.controls.tilt-mode ~ .calibrate-btn {
  display: block;
}

/* ─── Multiplayer ─── */

.mp-btn {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 24px rgba(97, 180, 255, 0.2);
}

.mp-join-section {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  max-width: 260px;
  margin-top: 4px;
}

.mp-code-input {
  flex: 1;
  font-size: 1.3rem !important;
  letter-spacing: 0.3em;
  font-weight: 800;
}

.mp-room-code {
  font-family: var(--display);
  font-size: 3rem !important;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.25em;
  max-width: none;
}

.mp-countdown {
  font-family: var(--display);
  font-size: 4rem !important;
  font-weight: 800;
  color: var(--accent);
  max-width: none;
}

.mp-vs {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 8px 0;
}

.mp-vs-label {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--muted);
  flex-shrink: 0;
}

.mp-player-card {
  flex: 1;
  background: rgba(255, 243, 224, 0.05);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
}

.mp-player-card.mp-winner {
  border-color: var(--accent);
  background: rgba(255, 140, 66, 0.08);
  box-shadow: 0 0 20px rgba(255, 140, 66, 0.1);
}

.mp-card-name {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--ink);
  max-width: none;
}

.mp-card-score {
  font-family: var(--display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin: 4px 0;
  max-width: none;
}

.mp-winner .mp-card-score {
  color: var(--gold);
}

.mp-card-lvl {
  font-size: 0.72rem;
  color: var(--muted);
  max-width: none;
}

/* MP Error inline */
.mp-error {
  width: 100%;
  max-width: 260px;
  background: rgba(226,55,43,0.12);
  border: 1px solid rgba(226,55,43,0.4);
  color: #ff9d8f;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 12px;
  text-align: center;
  margin-top: 8px;
}

/* Share button */
.mp-share-btn {
  width: 100%;
  max-width: 280px;
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.72rem;
  color: var(--accent);
  background: rgba(255,140,66,0.08);
  border: 1px solid rgba(255,140,66,0.3);
  word-break: break-all;
  box-shadow: none;
}

/* ─── Daily Challenge Card ─── */

.daily-card {
  width: 100%;
  background: linear-gradient(120deg, #2e1d0e, #3a2413);
  border: 1px solid #5c3a1e;
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(255, 215, 122, 0.12);
}

.daily-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 215, 122, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.daily-card-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.daily-card-title {
  color: var(--gold);
  font-family: var(--display);
  font-weight: 800;
  font-size: 16px;
  line-height: 1.1;
}

.daily-card-sub {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
}

.daily-card-chevron {
  color: var(--gold);
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
}

/* Daily eyebrow */
.daily-eyebrow {
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.daily-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
  color: var(--ink);
  max-width: none;
  margin-top: 6px;
}

/* Modifier chip */
.modifier-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(226, 55, 43, 0.12);
  border: 1px solid rgba(226, 55, 43, 0.4);
  border-radius: 999px;
  padding: 7px 16px;
  color: #ff9d8f;
  font-size: 12px;
  font-weight: 800;
  margin-top: 14px;
}

/* Daily board card */
.daily-board-card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 14px 8px;
  margin-top: 18px;
}

.daily-board-title {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
}

.daily-board-list {
  margin-top: 6px;
}

.daily-board-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255, 243, 224, 0.08);
  font-size: 12px;
  color: var(--ink);
}

.daily-board-row:last-child { border-bottom: 0; }
.daily-gold { color: var(--gold); font-weight: 800; }

/* Gold CTA */
.gold-btn {
  background: #ffd77a !important;
  color: #1c1006 !important;
  box-shadow: 0 10px 24px rgba(255, 215, 122, 0.3) !important;
}

/* Rank pill */
.rank-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 215, 122, 0.1);
  border: 1px solid rgba(255, 215, 122, 0.3);
  border-radius: 999px;
  padding: 8px 18px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 800;
  margin-top: 10px;
}

/* Daily result card */
.daily-result-card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Replay tutorial button */
.replay-tutorial-btn {
  margin-top: 4px;
  font-size: 0.72rem;
}

/* ─── Garage 2.0 ─── */

.garage-tabs {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-bottom: 4px;
}

.garage-tab {
  flex: 1;
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  border-radius: 999px;
  background: rgba(255, 243, 224, 0.07);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
}

.garage-tab-active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.garage-stage {
  width: 100%;
  background: rgba(255, 243, 224, 0.04);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.garage-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
}

.garage-arrow {
  width: 36px;
  height: 36px;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--muted);
  background: rgba(255, 243, 224, 0.07);
  border: 1px solid var(--line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.garage-arrow:active {
  background: rgba(255, 243, 224, 0.14);
}

.garage-preview {
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
}

.garage-preview.garage-locked {
  filter: grayscale(0.7);
}

.garage-car-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--ink);
  line-height: 1.1;
}

.garage-tradeoffs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.garage-perk-chip {
  display: inline-block;
  background: rgba(66, 179, 79, 0.1);
  border: 1px solid rgba(66, 179, 79, 0.35);
  color: #42b34f;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
}

.garage-drawback-chip {
  display: inline-block;
  background: rgba(226, 55, 43, 0.1);
  border: 1px solid rgba(226, 55, 43, 0.35);
  color: #ff9d8f;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
}

.garage-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.garage-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.garage-stat-label {
  width: 44px;
  text-align: right;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.garage-stat-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 243, 224, 0.1);
  border-radius: 99px;
  overflow: hidden;
}

.garage-stat-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.25s ease-out;
}

.garage-stat-fill.garage-bar-green {
  background: var(--green);
}

.garage-cta {
  min-width: 160px;
  min-height: 38px;
  padding: 0 20px;
  font-size: 0.92rem;
  font-weight: 800;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  cursor: pointer;
  margin-top: 4px;
}

.garage-cta-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.garage-cta-buy {
  background: #ffd77a;
  color: #1c1006;
  box-shadow: 0 8px 20px rgba(255, 215, 122, 0.25);
}

.garage-cta-buy:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.garage-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 4px;
}

.garage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 243, 224, 0.2);
  cursor: pointer;
  transition: all 0.15s;
}

.garage-dot-owned {
  background: #c9a173;
}

.garage-dot-active {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(255, 215, 122, 0.5);
}

.garage-dot-locked {
  background: rgba(255, 243, 224, 0.12);
}

/* Paint Tab */

.garage-paint-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.garage-section-label {
  width: 100%;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
}

.garage-swatch-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
}

.garage-swatch {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  min-height: 40px;
}

.garage-swatch-selected {
  border-color: #ffd77a;
  box-shadow: 0 0 12px rgba(255, 215, 122, 0.4);
}

.garage-swatch-price {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-weight: 800;
  color: #ffd77a;
  background: rgba(0, 0, 0, 0.6);
  padding: 1px 6px;
  border-radius: 99px;
  white-space: nowrap;
}

.garage-decal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}

.garage-decal {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: rgba(255, 243, 224, 0.05);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  position: relative;
}

.garage-decal-selected {
  border-color: #ffd77a;
  box-shadow: 0 0 12px rgba(255, 215, 122, 0.4);
}

.garage-decal-emoji {
  font-size: 1.4rem;
}

.garage-decal-price {
  font-size: 0.58rem;
  font-weight: 800;
  color: #ffd77a;
}

.garage-horn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}

.garage-horn {
  flex: 1;
  min-width: 70px;
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(255, 243, 224, 0.07);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.garage-horn-selected {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* Unlock Moment */

.unlock-moment {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  padding: 10px 0 20px;
  width: 100%;
}

.unlock-eyebrow {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.unlock-preview {
  border-radius: 16px;
  background: radial-gradient(circle, rgba(255, 215, 122, 0.15) 0%, transparent 70%);
}

.unlock-car-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.8rem;
  color: var(--ink);
  line-height: 1;
}

.unlock-confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  top: -10px;
  animation: confettiFall 1s ease-in forwards;
  pointer-events: none;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
  100% {
    transform: translateY(280px) rotate(720deg);
    opacity: 0;
  }
}

/* ─── Order Mode ─── */

.go-stat strong.stat-hot { color: #ff9d8f; }

/* ─── Wallet / Driver Screen ─── */

.wallet-card { background: linear-gradient(120deg,#2e1d0e,#3a2413); border: 1px solid #5c3a1e; border-radius: 18px; padding: 18px; width: 100%; }
.wallet-balance { font-family: var(--display); font-weight: 800; font-size: 42px; color: var(--gold); line-height: 1; }
.wallet-split { display: flex; gap: 12px; margin-top: 10px; justify-content: center; }
.wallet-split-item { font-size: 11px; font-weight: 700; }
.wallet-split-divider { width: 1px; background: rgba(255,243,224,0.15); }

/* Ledger */
.ledger { width: 100%; max-height: 180px; overflow-y: auto; }
.ledger-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255,243,224,0.06); font-size: 0.82rem; }
.ledger-desc { color: var(--ink); flex: 1; }
.ledger-amount { font-weight: 800; white-space: nowrap; }
.ledger-positive { color: #42b34f; }
.ledger-negative { color: #ff9d8f; }

/* Inventory grids */
.inv-section-title { color: var(--muted); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; margin: 12px 0 6px; text-align: left; width: 100%; }
.inv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.inv-item { background: rgba(255,243,224,0.05); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; text-align: center; font-size: 0.72rem; cursor: pointer; }
.inv-item.active { border-color: var(--gold); box-shadow: 0 0 12px rgba(255,215,122,0.3); }
.inv-item.locked { opacity: 0.4; border-style: dashed; }
.inv-active-tag { font-size: 0.55rem; color: var(--gold); font-weight: 800; letter-spacing: 0.08em; }

/* Badges */
.badge-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: rgba(255,243,224,0.04); border: 1px solid var(--line); border-radius: 10px; width: 100%; text-align: left; }
.badge-item.hidden { border-style: dashed; opacity: 0.4; }
.badge-emoji { font-size: 1.3rem; flex-shrink: 0; }
.badge-info { flex: 1; }
.badge-name { font-weight: 800; font-size: 0.85rem; color: var(--ink); }
.badge-desc { font-size: 0.68rem; color: var(--muted); }

/* Name edit */
.name-edit-row { display: flex; align-items: center; gap: 8px; justify-content: center; }
.name-edit-btn { background: none; border: none; color: var(--muted); font-size: 1rem; cursor: pointer; padding: 4px; box-shadow: none; }

/* Badge flash */
.badge-flash { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: linear-gradient(120deg,#2e1d0e,#3a2413); border: 1px solid var(--gold); border-radius: 14px; padding: 10px 20px; color: var(--gold); font-weight: 800; font-size: 0.9rem; z-index: 100; pointer-events: none; animation: badgeFlashAnim 2.5s ease-out forwards; }
@keyframes badgeFlashAnim { 0% { opacity: 0; transform: translateX(-50%) translateY(-10px); } 10% { opacity: 1; transform: translateX(-50%) translateY(0); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-10px); } }

@media (min-width: 760px) {
  .controls {
    display: none;
  }
  .calibrate-btn {
    display: none;
  }
}
