/* Hill Dash: a full-window road with the controls over its corners. */

.hd { background: #12202E; }
.hd::before, .hd::after { display: none; }

.hd-stage {
  position: relative;
  height: calc(100dvh - 52px);
  min-height: 200px;
  overflow: hidden;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ------------------------------------------------------------- the HUD */
.hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start;
  padding: 10px 12px; pointer-events: none;
}
.hud-left { display: grid; gap: 6px; justify-items: start; }
.fuel { display: flex; align-items: center; gap: 6px; }
.fuel.low .fuelbar i { background: linear-gradient(90deg, #FF3B30, #FF8A3C); animation: hd-blink .5s steps(2) infinite; }
@keyframes hd-blink { 50% { opacity: .35; } }
.can {
  width: 20px; height: 24px; border-radius: 4px; background: #E8423F; border: 2px solid #1A1420; position: relative;
}
.can::after { content: ""; position: absolute; left: 4px; top: -6px; width: 8px; height: 5px; background: #1A1420; border-radius: 2px; }
.fuelbar { width: clamp(90px, 22vw, 180px); height: 16px; border-radius: 8px; background: rgba(20, 16, 26, .55); border: 2px solid #1A1420; overflow: hidden; }
.fuelbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #7DDB3A, #C5F05A); transition: width .2s linear; }
.purse, .wallet { display: inline-flex; align-items: center; gap: 6px; font: 900 1.15rem/1 system-ui, sans-serif; color: #FFF; -webkit-text-stroke: 4px #1A1420; paint-order: stroke fill; }
.coin-ico { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #FFF1A8, #FFC93C 45%, #D99A00); border: 2px solid #8A5A00; flex: none; }
.hud-mid { text-align: center; color: #FFF; -webkit-text-stroke: 5px #1A1420; paint-order: stroke fill; }
.hud-mid strong { display: block; font: 900 clamp(1.4rem, 5vw, 2rem)/1 system-ui, sans-serif; }
.hud-mid small { display: block; font: 800 .8rem/1.4 system-ui, sans-serif; -webkit-text-stroke: 3px #1A1420; }
.hud-btn {
  justify-self: end; pointer-events: auto;
  width: 44px; height: 44px; border-radius: 12px; border: 3px solid #1A1420;
  background: rgba(255, 255, 255, .85); font: 900 1rem/1 system-ui, sans-serif; color: #1A1420; cursor: pointer;
}

/* ----------------------------------------------------------- the pedals */
.pedal {
  position: absolute; bottom: max(12px, env(safe-area-inset-bottom)); width: clamp(84px, 17vw, 132px); height: clamp(100px, 22vh, 150px);
  border-radius: 14px; border: 3px solid #1A1420; cursor: pointer; touch-action: none;
  background:
    radial-gradient(circle, #1A1420 18%, transparent 20%) 0 0 / 22px 22px,
    linear-gradient(180deg, #E4E7ED, #9CA3B0);
  box-shadow: 0 6px 0 #1A1420, inset 0 2px 0 rgba(255, 255, 255, .7);
  transition: transform .05s ease, box-shadow .05s ease;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px;
}
.pedal span { font: 900 .9rem/1 system-ui, sans-serif; color: #1A1420; background: rgba(255, 255, 255, .85); padding: 3px 7px; border-radius: 6px; letter-spacing: .06em; }
.pedal.brake { left: max(12px, env(safe-area-inset-left)); }
.pedal.gas { right: max(12px, env(safe-area-inset-right)); }
.pedal.down { transform: translateY(5px) perspective(300px) rotateX(14deg); box-shadow: 0 1px 0 #1A1420, inset 0 2px 0 rgba(255, 255, 255, .7); }
.pedal.gas.down { background: radial-gradient(circle, #1A1420 18%, transparent 20%) 0 0 / 22px 22px, linear-gradient(180deg, #C8F59A, #6FC23A); }
.pedal.brake.down { background: radial-gradient(circle, #1A1420 18%, transparent 20%) 0 0 / 22px 22px, linear-gradient(180deg, #FFB0A8, #E8423F); }

/* ----------------------------------------------------------- the panels */
.panel {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 10px;
  padding: 14px; overflow-y: auto;
  background: linear-gradient(180deg, rgba(10, 16, 30, .25), rgba(10, 16, 30, .7));
  color: #FFF;
}
.logo {
  margin: 0; font: 900 clamp(2rem, 7vw, 3.2rem)/1 system-ui, sans-serif; letter-spacing: .04em; color: #FFD54A;
  -webkit-text-stroke: 7px #1A1420; paint-order: stroke fill; text-shadow: 0 5px 0 #1A1420; transform: rotate(-3deg);
}
.logo span { color: #FF8A3C; }
.g-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: min(100%, 980px); }
.wallet { background: rgba(20, 16, 26, .6); padding: 8px 14px; border-radius: 999px; border: 2px solid rgba(255, 255, 255, .25); -webkit-text-stroke: 0; }
.g-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: min(100%, 980px); }
@media (max-width: 760px) and (min-height: 521px) { .g-grid { grid-template-columns: 1fr 1fr; } .g-card.ups { grid-column: 1 / -1; } }
@media (max-width: 460px) { .g-grid { grid-template-columns: 1fr; } }
.g-card {
  background: rgba(255, 248, 230, .95); color: #1A1420; border: 3px solid #1A1420; border-radius: 16px;
  box-shadow: 0 6px 0 rgba(26, 20, 32, .8); padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0;
}
.g-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; }
.g-head h2 { margin: 0; font: 900 1.05rem/1.1 system-ui, sans-serif; text-align: center; flex: 1; }
.arrow { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 3px solid #1A1420; background: #FFD54A; font: 900 1.4rem/1 system-ui, sans-serif; cursor: pointer; color: #1A1420; }
.v-preview, .s-preview { width: 100%; height: 110px; border-radius: 10px; display: block; }
.g-best { margin: 0; font: 800 .85rem/1.2 system-ui, sans-serif; color: #5A4A3A; min-height: 1.2em; text-align: center; }
.buy {
  width: 100%; min-height: 40px; border: 3px solid #1A1420; border-radius: 10px; cursor: pointer;
  background: linear-gradient(180deg, #8CE06A, #4DAF2E); color: #10230A; font: 900 .95rem/1 system-ui, sans-serif;
}
.buy:disabled { background: #CFC6B5; color: #6B6255; cursor: default; }
.ups { justify-content: center; }
.ups h3 { margin: 0; font: 900 1rem/1 system-ui, sans-serif; }
.up { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; width: 100%; align-items: center; }
.up-name { font: 900 .85rem/1.1 system-ui, sans-serif; }
.up-pips { grid-column: 1; display: flex; gap: 2px; }
.up-pips i { flex: 1; height: 7px; border-radius: 2px; background: #D8CDB8; }
.up-pips i.on { background: linear-gradient(180deg, #FFD54A, #FF8A3C); }
.up button {
  grid-row: 1 / 3; grid-column: 2; min-width: 82px; min-height: 36px; border: 2px solid #1A1420; border-radius: 8px; cursor: pointer;
  background: #FFD54A; font: 900 .8rem/1 system-ui, sans-serif; color: #1A1420; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.up button .coin-ico { width: 13px; height: 13px; border-width: 1.5px; }
.up button:disabled { background: #E3DACA; color: #8B826F; cursor: default; }
.go {
  min-width: 220px; min-height: 60px; border: 4px solid #1A1420; border-radius: 16px; cursor: pointer;
  background: linear-gradient(180deg, #9BEA5E, #4DAF2E); color: #FFF; box-shadow: 0 6px 0 #1A1420;
  font: 900 1.6rem/1 system-ui, sans-serif; letter-spacing: .08em; -webkit-text-stroke: 5px #1A1420; paint-order: stroke fill;
  animation: hd-pulse 1.6s ease-in-out infinite;
}
.go.small { min-width: 160px; min-height: 52px; font-size: 1.3rem; }
.go:active { transform: translateY(4px); box-shadow: 0 2px 0 #1A1420; }
.go:disabled { background: linear-gradient(180deg, #C9C2B4, #9A9285); animation: none; cursor: default; transform: none; }
@keyframes hd-pulse { 50% { transform: scale(1.04); } }
.ghost { min-width: 140px; min-height: 48px; border: 3px solid #1A1420; border-radius: 14px; background: #FFF8E6; color: #1A1420; font: 900 1rem/1 system-ui, sans-serif; cursor: pointer; box-shadow: 0 5px 0 #1A1420; }
.g-hint { margin: 0; font: 700 .8rem/1.3 system-ui, sans-serif; color: rgba(255, 255, 255, .85); text-align: center; text-shadow: 0 1px 2px #000; }

.result h2, .paused h2 { margin: 0; font: 900 clamp(1.8rem, 6vw, 2.6rem)/1 system-ui, sans-serif; color: #FFD54A; -webkit-text-stroke: 6px #1A1420; paint-order: stroke fill; }
.r-dist { margin: 0; font: 900 clamp(2.4rem, 9vw, 3.6rem)/1 system-ui, sans-serif; color: #FFF; -webkit-text-stroke: 7px #1A1420; paint-order: stroke fill; }
.r-best { margin: 0; font: 900 1rem/1 system-ui, sans-serif; color: #9BEA5E; -webkit-text-stroke: 4px #1A1420; paint-order: stroke fill; min-height: 1em; }
.r-best.new { color: #FFD54A; animation: hd-pulse .8s ease-in-out infinite; }
.r-list { list-style: none; margin: 0; padding: 10px 16px; background: rgba(255, 248, 230, .95); color: #1A1420; border: 3px solid #1A1420; border-radius: 14px; min-width: 240px; display: grid; gap: 4px; font: 800 .95rem/1.3 system-ui, sans-serif; }
.r-list li { display: flex; justify-content: space-between; gap: 18px; }
.r-list li.total { border-top: 2px dashed #1A1420; padding-top: 6px; font-weight: 900; font-size: 1.1rem; }
.r-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.turn-hint { position: absolute; left: 50%; top: 58px; transform: translateX(-50%); margin: 0; padding: 6px 12px; border-radius: 999px; background: rgba(20, 16, 26, .7); color: #FFF; font: 800 .8rem/1.2 system-ui, sans-serif; pointer-events: none; white-space: nowrap; }

.hd-info { max-width: 760px; }
.hd-h { margin: 6px 0 0; text-align: center; color: #FFF; font: 900 1.1rem/1.2 system-ui, sans-serif; }
.hd .small { color: #C9D6E6; }
.hd .more-games h2 { color: #FFF; }

/* Short screens (a phone on its side): a tighter garage so START fits. */
@media (max-height: 520px) {
  .panel { gap: 6px; padding: 8px 12px; justify-content: flex-start; }
  .logo { font-size: 1.6rem; -webkit-text-stroke-width: 5px; text-shadow: 0 3px 0 #1A1420; }
  .wallet { padding: 4px 10px; font-size: .95rem; }
  .g-grid { gap: 8px; }
  .g-card { padding: 6px 8px; gap: 3px; border-radius: 12px; }
  .g-head h2 { font-size: .9rem; }
  .arrow { width: 30px; height: 30px; font-size: 1.1rem; }
  .v-preview, .s-preview { height: 64px; }
  .g-best { font-size: .72rem; }
  .ups h3 { font-size: .82rem; }
  .up button { min-height: 28px; min-width: 70px; }
  .up-name { font-size: .75rem; }
  .go { min-height: 46px; font-size: 1.25rem; }
  .g-hint { display: none; }
  .r-list { padding: 6px 12px; font-size: .85rem; }
}

/* ------------------------------------------------------ garage additions */
.g-quick { display: flex; gap: 6px; }
.qb {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 58px; padding: 5px 6px 4px; border: 3px solid #1A1420; border-radius: 12px; cursor: pointer;
  background: #FFF8E6; color: #1A1420; box-shadow: 0 4px 0 #1A1420; font: 900 .68rem/1 system-ui, sans-serif;
}
.qb span { font-size: 1.25rem; line-height: 1; }
.qb:active { transform: translateY(3px); box-shadow: 0 1px 0 #1A1420; }
.dot { position: absolute; top: -5px; right: -5px; width: 13px; height: 13px; border-radius: 50%; background: #FF3B30; border: 2px solid #1A1420; }
.dot.hot { top: -7px; right: -7px; width: 17px; height: 17px; animation: hd-pulse .9s ease-in-out infinite; }
.medals { display: flex; gap: 6px; justify-content: center; font-size: 1.05rem; line-height: 1; }
.medals i { font-style: normal; filter: grayscale(1) opacity(.35); }
.medals i.on { filter: none; animation: pop-in .4s ease; }
@media (max-width: 640px) { .g-quick small { display: none; } .qb { min-width: 40px; } }

/* --------------------------------------------------------------- sheets */
.sheetp { z-index: 8; background: rgba(10, 16, 30, .62); justify-content: center; }
.sheet {
  width: min(96%, 520px); max-height: 100%; overflow-y: auto; display: grid; gap: 8px;
  background: #FFF8E6; color: #1A1420; border: 3px solid #1A1420; border-radius: 16px; box-shadow: 0 6px 0 #1A1420;
  padding: 12px 14px; animation: pop-in .25s ease;
}
.sheet.wide { width: min(98%, 760px); }
.sh-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sh-head h2 { margin: 0; font: 900 1.3rem/1 system-ui, sans-serif; }
.x { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #1A1420; background: #FFD54A; font: 900 1rem/1 system-ui; cursor: pointer; color: #1A1420; }
.sh-sub, .sh-note { margin: 0; font: 800 .8rem/1.35 system-ui, sans-serif; color: #5A4A3A; }

.mlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.mlist li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: #fff; border: 2px solid #1A1420; }
.mlist .mt { font: 900 .9rem/1.2 system-ui, sans-serif; }
.mlist .mr { display: inline-flex; align-items: center; gap: 4px; font: 900 .9rem/1 system-ui; }
.mlist .mr .coin-ico { width: 15px; height: 15px; }
.mlist .bar { grid-column: 1; height: 8px; border-radius: 4px; background: #E3DACA; overflow: hidden; }
.mlist .bar i { display: block; height: 100%; background: linear-gradient(90deg, #FFD54A, #FF8A3C); }
.mlist .swap { grid-column: 2; grid-row: 2; min-height: 28px; padding: 0 8px; border: 2px solid #1A1420; border-radius: 8px; background: #E9F6FF; font: 900 .72rem/1 system-ui; cursor: pointer; }
.mlist .swap:disabled { opacity: .45; cursor: default; }

.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.days div { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; border: 2px solid #1A1420; background: #fff; font: 900 .7rem/1 system-ui, sans-serif; }
.days div b { font-size: .82rem; }
.days div.got { background: #C8F59A; }
.days div.today { background: #FFD54A; animation: hd-pulse 1.2s ease-in-out infinite; }
.days div.big { border-color: #C77DFF; }
.claim { min-height: 46px; font-size: 1.05rem; }
.chal { display: grid; gap: 6px; padding: 10px; border-radius: 12px; border: 2px dashed #1A1420; background: #FFF1C9; }
.chal h3 { margin: 0; font: 900 1rem/1.1 system-ui, sans-serif; }
.chal p { margin: 0; font: 800 .82rem/1.35 system-ui, sans-serif; }
.chal .tags { display: flex; gap: 5px; flex-wrap: wrap; }
.chal .tags span { padding: 4px 8px; border-radius: 999px; background: #fff; border: 2px solid #1A1420; font: 900 .72rem/1 system-ui; }
.chal .go { min-width: 0; width: 100%; min-height: 48px; font-size: 1.2rem; animation: none; }

.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.rec-grid div { padding: 7px 9px; border-radius: 10px; border: 2px solid #1A1420; background: #fff; font: 800 .78rem/1.35 system-ui; }
.rec-grid b { display: block; font-size: .86rem; }
.rec-grid .locked { opacity: .5; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); column-gap: 18px; font: 800 .82rem/1.6 system-ui, sans-serif; }
.stats div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid #E3DACA; padding: 0 4px; }
.stats b { font-weight: 900; }

.p-preview { width: 100%; height: 110px; border-radius: 10px; display: block; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.swatches button { display: grid; justify-items: center; gap: 3px; padding: 6px 2px; border: 2px solid #1A1420; border-radius: 10px; background: #fff; cursor: pointer; font: 900 .68rem/1.1 system-ui; color: #1A1420; }
.swatches button i { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #1A1420; }
.swatches button.on { background: #FFD54A; }
.swatches button small { font-weight: 800; color: #5A4A3A; }

/* ------------------------------------------------------------ driving */
.mtrack {
  display: grid; gap: 3px; padding: 4px 9px 5px; border-radius: 10px; max-width: min(34vw, 280px);
  background: rgba(20, 16, 26, .62); border: 2px solid rgba(255, 255, 255, .2);
  font: 800 .72rem/1.2 system-ui, sans-serif; color: #FFF;
}
.mtrack span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-bar { display: block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.mt-bar b { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #FFD54A, #FF8A3C); transition: width .2s linear; }
.mtrack.done { color: #9BEA5E; }
.mtrack.done .mt-bar b { background: #7DDB3A; }
.combo { margin-top: 4px; font: 900 1.1rem/1 system-ui, sans-serif; color: #FF8A3C; -webkit-text-stroke: 4px #1A1420; paint-order: stroke fill; animation: pop-in .2s ease; }
.nitro-btn {
  position: absolute; right: calc(max(12px, env(safe-area-inset-right)) + clamp(84px, 17vw, 132px) + 10px); bottom: max(14px, env(safe-area-inset-bottom));
  width: 66px; height: 66px; border-radius: 50%; border: 3px solid #1A1420; cursor: pointer; touch-action: none;
  background: radial-gradient(circle at 35% 30%, #9ADBFF, #1E88E5 60%, #0B4A90); box-shadow: 0 5px 0 #1A1420;
  display: grid; place-items: center;
}
.nitro-btn .n-ico { width: 18px; height: 30px; background: #FFE066; clip-path: polygon(60% 0, 0 55%, 42% 55%, 30% 100%, 100% 38%, 58% 38%); }
.nitro-btn b { position: absolute; top: -8px; right: -8px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; background: #FFF; border: 2px solid #1A1420; font: 900 .85rem/20px system-ui; color: #1A1420; }
.nitro-btn.empty { filter: grayscale(.85) brightness(.8); }
.nitro-btn.ready { animation: hd-pulse 1s ease-in-out infinite; }
.nitro-btn.down { transform: translateY(4px); box-shadow: 0 1px 0 #1A1420; }
.hint {
  position: absolute; left: 50%; top: 32%; transform: translateX(-50%); margin: 0; z-index: 3; max-width: 80%;
  padding: 8px 14px; border-radius: 14px; background: rgba(20, 16, 26, .78); color: #FFF; text-align: center;
  font: 900 1rem/1.3 system-ui, sans-serif; pointer-events: none; animation: pop-in .3s ease;
}
.r-tip { margin: 0; font: 800 .85rem/1.3 system-ui, sans-serif; color: #FFE7A3; text-shadow: 0 1px 2px #000; text-align: center; max-width: 520px; }
.r-list li.m { color: #1B6B2C; }
.r-list li.medal { color: #8A5A00; }
.paused .tog { display: flex; align-items: center; gap: 8px; font: 800 .9rem system-ui; color: #FFF; }
.paused .tog input { width: 20px; height: 20px; accent-color: #FFC93C; }

@media (max-height: 520px) {
  .qb { padding: 3px 4px; min-width: 46px; }
  .qb span { font-size: 1rem; }
  .qb small { font-size: .6rem; }
  .sheet { padding: 8px 10px; gap: 6px; }
  .sh-head h2 { font-size: 1.05rem; }
  .medals { font-size: .9rem; }
  .p-preview { height: 70px; }
  .nitro-btn { width: 56px; height: 56px; }
}

/* ---------------------------------------------------------------- races */
.race-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.race-grid button {
  display: grid; gap: 2px; justify-items: center; padding: 7px 4px; border: 2px solid #1A1420; border-radius: 12px; cursor: pointer;
  background: #fff; color: #1A1420; font: 800 .72rem/1.15 system-ui, sans-serif; box-shadow: 0 3px 0 #1A1420;
}
.race-grid button b { font: 900 1.05rem/1 system-ui, sans-serif; }
.race-grid button .st { color: #E0A800; letter-spacing: -.05em; }
.race-grid button.next { background: #FFD54A; animation: hd-pulse 1.4s ease-in-out infinite; }
.race-grid button:disabled { opacity: .45; cursor: default; box-shadow: none; }
.racebar { position: relative; width: clamp(140px, 30vw, 260px); height: 12px; margin: 4px auto 0; border-radius: 6px; background: rgba(20, 16, 26, .55); border: 2px solid #1A1420; -webkit-text-stroke: 0; }
.racebar i { position: absolute; top: -4px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; border: 2px solid #1A1420; transition: left .2s linear; }
.racebar .rb-you { background: #FFD54A; z-index: 2; }
.racebar .rb-rival { background: #8A8FA8; }
.racebar span { position: absolute; right: -22px; top: -6px; font-size: .9rem; }
.count {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 4; pointer-events: none;
  font: 900 clamp(3.5rem, 14vw, 6rem)/1 system-ui, sans-serif; color: #FFD54A; -webkit-text-stroke: 8px #1A1420; paint-order: stroke fill;
  animation: hd-count .9s ease-out;
}
.count small { display: block; font-size: .3em; color: #FFF; -webkit-text-stroke: 4px #1A1420; text-align: center; margin-top: 6px; }
@keyframes hd-count { from { transform: translate(-50%, -50%) scale(1.8); opacity: 0; } 30% { opacity: 1; } }
.r-stars { display: flex; gap: 6px; font-size: 2rem; line-height: 1; }
.r-stars b { color: #D9CFC0; -webkit-text-stroke: 2px #1A1420; }
.r-stars b.on { color: #FFB800; animation: pop-in .4s ease both; }

/* Narrow phones held upright: logo and wallet on top, the five buttons below. */
.g-top { flex-wrap: wrap; }
@media (max-width: 560px) {
  .g-quick { order: 3; width: 100%; justify-content: space-between; }
  .qb { flex: 1; }
}

/* ------------------------------------------------------------- UI polish */
/* LOW FUEL beside the gauge. */
.lowfuel { white-space: nowrap; padding: 3px 7px; border-radius: 6px; background: #FF3B30; border: 2px solid #1A1420; color: #FFF; font: 900 .7rem/1 system-ui, sans-serif; letter-spacing: .04em; animation: hd-blink .6s steps(2) infinite; }

/* The vehicle's numbers: now (solid) and fully tuned (pale). */
.vstats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; width: 100%; }
.vstat { display: grid; grid-template-columns: 4.3em 1fr; align-items: center; gap: 4px; font: 900 .64rem/1 system-ui, sans-serif; color: #5A4A3A; text-transform: uppercase; letter-spacing: .02em; }
.vstat em { font-style: normal; }
.vstat i { position: relative; height: 7px; border-radius: 4px; background: #E3DACA; overflow: hidden; }
.vstat s, .vstat b { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; transition: width .35s ease; }
.vstat s { background: #F5D9A6; }
.vstat b { background: linear-gradient(90deg, #4DAF2E, #9BEA5E); }

/* START stays in reach when the garage scrolls (a phone held upright). */
.garage > .go, .g-go { position: sticky; bottom: 10px; z-index: 2; flex: none; }
.g-go { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.g-go .go { min-width: 180px; }
.go.levels { background: linear-gradient(180deg, #FFE27A, #FFB300); }
@media (max-width: 560px) { .g-go .go { min-width: 0; flex: 1; padding: 0 8px; font-size: 1.15rem; -webkit-text-stroke: 4px #1A1420; } }

/* --------------------------------------------------------------- levels */
.lv-total { margin-left: auto; margin-right: 8px; font: 900 .95rem/1 system-ui, sans-serif; color: #E0A800; -webkit-text-stroke: 0; }
.lv-worlds { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; flex: none; min-height: max-content; }
@media (max-height: 520px) {
  .lv-worlds button { grid-auto-flow: column; align-items: center; gap: 5px; min-width: 0; padding: 4px 8px; }
  .lv-worlds button span { font-size: 1rem; }
}
.lv-worlds button {
  flex: none; display: grid; justify-items: center; gap: 2px; min-width: 84px; padding: 6px 8px; border: 2px solid #1A1420; border-radius: 12px; cursor: pointer;
  background: #FFF8E6; color: #1A1420; font: 900 .7rem/1.1 system-ui, sans-serif; box-shadow: 0 3px 0 #1A1420;
}
.lv-worlds button span { font-size: 1.3rem; line-height: 1; }
.lv-worlds button em { font-style: normal; color: #E0A800; }
.lv-worlds button[aria-selected="true"] { background: #FFD54A; }
.lv-worlds button.locked { opacity: .55; }
.lv-grid button .tod { font-size: .95rem; }
.lv-grid button .par { color: #5A4A3A; font-weight: 800; }
.lv-grid button.done { background: #F1FBE8; }
.lv-locked { display: grid; gap: 8px; justify-items: center; padding: 18px 8px; text-align: center; font: 800 .9rem/1.35 system-ui, sans-serif; color: #5A4A3A; }

/* A buy button you can afford calls for attention. */
.buy.afford { animation: hd-pulse 1.3s ease-in-out infinite; }

/* Results: the run on the left, the coins on the right when there is room. */
.result { background: linear-gradient(180deg, rgba(10, 16, 30, .5), rgba(10, 16, 30, .76)); }
.r-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.r-main, .r-side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.r-next { display: grid; gap: 5px; width: min(100%, 300px); text-align: center; font: 900 .82rem/1.2 system-ui, sans-serif; color: #FFF; -webkit-text-stroke: 3px #1A1420; paint-order: stroke fill; }
.r-next-bar { display: block; height: 11px; border-radius: 6px; background: rgba(20, 16, 26, .6); border: 2px solid #1A1420; overflow: hidden; }
.r-next-bar b { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #FFD54A, #FF8A3C); transition: width 1s cubic-bezier(.2, .8, .2, 1) .3s; }
.r-wallet { margin: 0; display: inline-flex; align-items: center; gap: 6px; font: 900 .95rem/1 system-ui, sans-serif; color: #FFF; -webkit-text-stroke: 4px #1A1420; paint-order: stroke fill; }
.r-wallet .coin-ico { -webkit-text-stroke: 0; }
@media (orientation: landscape) and (min-width: 600px) {
  .r-wrap { flex-direction: row; align-items: center; gap: clamp(16px, 4vw, 40px); }
}

/* Pause: the missions, live. */
.paused { background: rgba(10, 16, 30, .66); }
.p-missions { list-style: none; margin: 0; padding: 8px 12px; display: grid; gap: 7px; width: min(100%, 420px); background: rgba(255, 248, 230, .95); color: #1A1420; border: 3px solid #1A1420; border-radius: 14px; }
.p-missions li { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: center; font: 800 .82rem/1.2 system-ui, sans-serif; }
.p-missions li i { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: #E3DACA; overflow: hidden; }
.p-missions li i b { display: block; height: 100%; background: linear-gradient(90deg, #FFD54A, #FF8A3C); }
.p-missions li em { font-style: normal; font-weight: 900; }
.p-missions li.done { color: #1B6B2C; }
.p-missions li.done i b { background: #6FC23A; }
.p-missions li.off { color: #8B826F; }

/* Daily: the streak and the challenge side by side on a phone held sideways. */
.daily-sheet .d-left { display: grid; gap: 8px; align-content: start; }
@media (orientation: landscape) and (max-height: 620px) and (min-width: 600px) {
  .daily-sheet { width: min(98%, 820px); grid-template-columns: 1fr 1fr; align-items: start; column-gap: 12px; }
  .daily-sheet .sh-head { grid-column: 1 / -1; }
}

@media (max-height: 520px) {
  .buy { min-height: 32px; font-size: .82rem; }
  .vstat { font-size: .58rem; }
  .vstats { gap: 3px 8px; }
  .r-next { font-size: .74rem; }
  .p-missions { padding: 6px 10px; gap: 5px; }
  .p-missions li { font-size: .74rem; }
  .days div { padding: 4px 2px; }
  .chal { padding: 8px; gap: 4px; }
  .chal .go { min-height: 40px; font-size: 1.05rem; }
  .claim { min-height: 38px; font-size: .95rem; }
  .rec-grid div { padding: 4px 8px; }
  .stats { line-height: 1.45; }
}
/* A phone on its side: missions and paints in one row, so the sheets fit without scrolling. */
@media (orientation: landscape) and (max-height: 520px) {
  #missions .sheet { width: min(98%, 760px); }
  .mlist { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mlist li { align-content: space-between; }
  .swatches { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
/* Sharing is how friends find the game: the share button stands out. */
#share { background: #25D366; color: #06341A; }
