/* ============================================================
   Kierrätyskissa — bright, playful "sticker" theme.
   Palette sampled from the park tug-of-war artwork:
   sky blue, grass green, sunny yellow, orange, red, teal.
   ============================================================ */

:root {
  /* core palette */
  --sky:        #bfe9fb;
  --sky-deep:   #7fc9e8;
  --grass:      #86cf4e;
  --grass-deep: #4ea32e;
  --sun:        #ffd23f;
  --orange:     #ff9442;
  --red:        #ff5d6c;
  --teal:       #2ec4b6;
  --blue:       #3d9be9;
  --purple:     #9b7ede;

  --ink:        #2c3e2a;      /* dark leafy green for text on light */
  --cloud:      #ffffff;

  --stroke:     3px solid #ffffff;          /* sticker outline */
  --shadow:     0 6px 0 rgba(0,0,0,.14), 0 10px 18px rgba(0,0,0,.18);
  --shadow-sm:  0 3px 0 rgba(0,0,0,.14), 0 6px 12px rgba(0,0,0,.16);

  font-family: "Fredoka", "Baloo 2", "Segoe UI Rounded", "Comic Sans MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  /* cheerful sky → grass backdrop behind any letterboxing */
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-deep) 55%, var(--grass) 100%);
  color: var(--ink);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

#app { width: 100%; height: 100%; }

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage {
  position: relative;
  border-radius: 18px;
  box-shadow: var(--shadow);
  touch-action: none;
  overflow: hidden;
}
/* Fullscreen play area on mobile: no rounded frame or shadow. */
.stage.cover { border-radius: 0; box-shadow: none; }
.stage.cover .level-tint,
.stage.cover .danger-vignette { border-radius: 0; }

/* The world that holds the artwork + game objects. The camera scales and
   translates this (from the top-left) to follow the cat when zoomed in. */
.world {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
  background-size: cover;
  background-position: center;
  will-change: transform;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  cursor: pointer;
  border: var(--stroke);
  border-radius: 999px;
  padding: 14px 30px;
  font-family: inherit;
  font-size: clamp(17px, 4.5vw, 22px);
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, var(--grass) 0%, var(--grass-deep) 100%);
  text-shadow: 0 2px 0 rgba(0,0,0,.18);
  box-shadow: var(--shadow);
  transition: transform .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.07) saturate(1.05); }
.btn:active { transform: translateY(3px) scale(.97); box-shadow: var(--shadow-sm); }
.btn.secondary { background: linear-gradient(180deg, var(--blue) 0%, #2b7fc7 100%); }
.btn.accent    { background: linear-gradient(180deg, var(--orange) 0%, #ef6f2a 100%); }

/* ============================================================
   Overlays (menu / game over)
   ============================================================ */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;   /* centred via auto margins; scrolls when tall */
  gap: clamp(10px, 2.2vh, 20px);
  text-align: center;
  padding: calc(clamp(14px, 3.5vh, 24px) + env(safe-area-inset-top, 0px)) 20px calc(clamp(14px, 3.5vh, 24px) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, rgba(127,201,232,.55), rgba(78,163,46,.55));
  backdrop-filter: blur(2px);
  animation: popIn .35s ease;
}
/* Centre the content block when it fits, but let it scroll from the top when it
   is taller than the screen (robust cross-browser flex centering + scroll). */
.overlay > :first-child { margin-top: auto; }
.overlay > :last-child { margin-bottom: auto; }
.overlay h1 {
  margin: 0;
  font-size: clamp(34px, 9vw, 68px);
  font-weight: 700;
  color: #fff;
  /* multi-layer outline + drop for a fun cartoon title */
  text-shadow:
    -2px -2px 0 var(--grass-deep), 2px -2px 0 var(--grass-deep),
    -2px  2px 0 var(--grass-deep), 2px  2px 0 var(--grass-deep),
     0 8px 0 rgba(0,0,0,.18);
}
.overlay p {
  margin: 0;
  font-size: clamp(15px, 4vw, 21px);
  font-weight: 600;
  color: #fff;
  max-width: 30ch;
  text-shadow: 0 2px 4px rgba(0,0,0,.35);
}
.overlay .mascot {
  width: auto;
  max-width: clamp(96px, 22vw, 200px);
  max-height: 26vh;                 /* never eats the whole short screen */
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.35));
  animation: bobble 2.4s ease-in-out infinite;
}

/* Shorter screens (landscape phones / small portraits): shrink the big bits. */
@media (max-height: 680px) {
  .overlay h1 { font-size: clamp(24px, 6vw, 40px); }
  .overlay .mascot { max-height: 20vh; }
  .star { font-size: clamp(30px, 8vw, 48px) !important; }
}

/* Mobile: shrink the top HUD chips (time / score / coins / fares) so the four
   meters take up less of the screen. */
@media (max-width: 640px) {
  .hud { padding: 8px 8px; gap: 5px; }
  .hud--stack { gap: 5px; }
  .chip { padding: 4px 10px; font-size: 12px; gap: 4px; border-radius: 999px; }
}

/* Narrow phones: tighten a touch more so nothing overflows. */
@media (max-width: 380px) {
  .chip { padding: 3px 8px; font-size: 11px; }
}

/* ============================================================
   HUD
   ============================================================ */
.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  /* Keep the chips clear of a notch / rounded corner on mobile. */
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px calc(14px + env(safe-area-inset-left, 0px));
  pointer-events: none;
  z-index: 30;
}
/* Stacked variant: all meters in a tidy column in the top-left corner. */
.hud--stack {
  right: auto;                 /* hug the left edge instead of spanning */
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  width: auto;
}
.hud--stack .hud-row { display: flex; gap: 8px; }
.chip {
  font-family: inherit;
  border: var(--stroke);
  border-radius: 999px;
  padding: 7px 15px;
  font-weight: 700;
  font-size: clamp(14px, 3.8vw, 19px);
  color: #fff;
  text-shadow: 0 2px 2px rgba(0,0,0,.25);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.chip--score    { background: linear-gradient(180deg, var(--sun), #f5b800); color: #5a3e00; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.chip--progress { background: linear-gradient(180deg, var(--blue), #2b7fc7); }
.chip--coins    { background: linear-gradient(180deg, #ffcf3f, #e0a000); color: #5a3e00; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.chip--lives    { background: linear-gradient(180deg, var(--red), #e23a4c); }
/* Licence / reputation ("maine"): green while healthy, reds out as it runs down,
   blinks once the shift is nearly lost. See PlayScene._repChange. */
.chip--rep      { background: linear-gradient(180deg, var(--grass, #86cf4e), var(--grass-deep, #4e9b2e)); }
.chip--rep.danger { background: linear-gradient(180deg, #ff9442, #e2621f); }
.chip--rep.crit   { background: linear-gradient(180deg, var(--red), #e23a4c); animation: pilePulse .5s ease-in-out infinite; }
.chip--mute     { background: linear-gradient(180deg, var(--teal), #1fa99c); cursor: pointer; }
.chip--mute:active { transform: translateY(2px); }

/* ---- "Carrying" banner ---- */
.carry {
  position: absolute;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px)); left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: linear-gradient(180deg, var(--sun), var(--orange));
  border: var(--stroke);
  color: #5a3e00;
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: clamp(13px, 3.6vw, 18px);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 30;
}
.carry.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Passenger patience gauge — a mood face + a wide bar. Pinned to the top-centre
   while a rider is in the cab (below the rush-banner slot, above the combo bar). */
.patience {
  position: absolute;
  top: calc(106px + env(safe-area-inset-top, 0px)); left: 50%;
  transform: translateX(-50%) translateY(-8px);
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 9px;
  background: linear-gradient(180deg, rgba(22,22,30,.85), rgba(22,22,30,.72));
  border: var(--stroke); border-radius: 999px;
  box-shadow: var(--shadow-sm);
  z-index: 31; pointer-events: none;
  opacity: 0; transition: opacity .2s ease, transform .2s ease;
}
.patience.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.patience-face {
  font-size: clamp(24px, 6.5vw, 34px); line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.55));
}
.patience-track {
  position: relative;
  width: min(62vw, 320px); height: clamp(16px, 3.6vh, 24px);
  background: rgba(0,0,0,.5); border-radius: 999px; overflow: hidden;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.55);
}
.patience-track > i {
  display: block; height: 100%; width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3fca63, #86cf4e);
  box-shadow: 0 0 10px rgba(120,220,110,.5);
  transition: width .1s linear, background .25s ease, box-shadow .25s ease;
}
.patience.warn .patience-track > i { background: linear-gradient(90deg, #ffbf2e, #ff8c1a); box-shadow: 0 0 10px rgba(255,160,40,.55); }
.patience.crit .patience-track > i { background: linear-gradient(90deg, #ff6b78, #cf4949); box-shadow: 0 0 12px rgba(255,80,90,.7); }
.patience.crit { animation: patPulse .5s ease-in-out infinite; }
@keyframes patPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50%      { transform: translateX(-50%) scale(1.06); }
}

/* Rush-hour banner — bold pill at the top-centre while a rush is on. */
.rush-banner {
  position: absolute;
  top: calc(58px + env(safe-area-inset-top, 0px)); left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 8px 20px;
  background: linear-gradient(180deg, #ff5d6c, #d0343f);
  border: var(--stroke); border-radius: 999px;
  color: #fff; font-weight: 800; white-space: nowrap;
  font-size: clamp(15px, 4vw, 22px);
  text-shadow: 0 2px 3px rgba(0,0,0,.45);
  box-shadow: 0 6px 16px rgba(208,52,63,.5), var(--shadow-sm);
  z-index: 32; pointer-events: none;
  opacity: 0; transition: opacity .2s ease, transform .2s ease;
}
.rush-banner.show { opacity: 1; transform: translateX(-50%) translateY(0); animation: rushPulse .8s ease-in-out infinite; }
@keyframes rushPulse {
  0%, 100% { transform: translateX(-50%) scale(1);    box-shadow: 0 6px 16px rgba(208,52,63,.5), var(--shadow-sm); }
  50%      { transform: translateX(-50%) scale(1.05); box-shadow: 0 6px 24px rgba(255,93,108,.8), var(--shadow-sm); }
}
/* Coin hunt banner — gold variant of the rush banner. */
.coinrush-banner { background: linear-gradient(180deg, #ffd23f, #f5a800); color: #1a1a1a; text-shadow: 0 1px 0 rgba(255,255,255,.4); }
.coinrush-banner.show { animation: coinRushPulse .8s ease-in-out infinite; }
@keyframes coinRushPulse {
  0%, 100% { transform: translateX(-50%) scale(1);    box-shadow: 0 6px 16px rgba(245,168,0,.5), var(--shadow-sm); }
  50%      { transform: translateX(-50%) scale(1.05); box-shadow: 0 6px 24px rgba(255,210,63,.85), var(--shadow-sm); }
}
/* Phones (either orientation — the map is landscape, so a phone held sideways is
   WIDE; match on short height too so the rule still fires): the thumb covers the
   bottom, so pin the "carrying" banner to the very TOP-centre and push the chip
   stack (and the combo/power timers, see below) down to make room. */
@media (max-width: 640px), (max-height: 600px) {
  .carry {
    top: calc(12px + env(safe-area-inset-top, 0px));
    bottom: auto;
    transform: translateX(-50%) translateY(-10px);
    max-width: calc(100vw - 16px);
    white-space: normal;   /* wrap instead of overflowing off a narrow screen */
    text-align: center;
  }
  .carry.show { transform: translateX(-50%) translateY(0); }
  /* The patience pill sits top-centre in the same vertical band as the top-left
     chip stack; cap its width so its left edge always clears those chips
     (~90px wide) in portrait. Landscape is wide, so this never bites there. */
  .patience-track { width: min(320px, calc(100vw - 280px)); }
}

/* ============================================================
   Bins
   ============================================================ */
/* A stop is an invisible drop zone; only the ACTIVE destination is shown, as a
   colour-coded beacon (glow + radar pings + a bouncing marker). The box itself
   is transparent — the fixed size just keeps every hit area equal. */
.bin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: clamp(63px, 17.25vw, 97.5px);
  height: clamp(52.5px, 14.25vw, 82.5px);
  display: flex; align-items: center; justify-content: center;
  user-select: none;
  pointer-events: none;
  z-index: 10;
}
/* Soft colour glow that breathes on the ground. */
.bin-glow {
  position: absolute; left: 50%; top: 50%;
  width: 105%; height: 105%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  filter: blur(3px);
  animation: binGlow 1.5s ease-in-out infinite;
}
@keyframes binGlow {
  0%, 100% { opacity: .3;  transform: translate(-50%, -50%) scale(.8); }
  50%      { opacity: .65; transform: translate(-50%, -50%) scale(1.05); }
}
/* Radar pings: rings expanding outward and fading, staggered. */
.bin-ring {
  position: absolute; left: 50%; top: 50%;
  width: 46%; height: 46%;
  margin: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 3px solid #fff;
  opacity: 0;
  pointer-events: none;
  animation: binPing 1.8s ease-out infinite;
}
.bin-ring--2 { animation-delay: .9s; }
@keyframes binPing {
  0%   { transform: translate(-50%, -50%) scale(.5);  opacity: .85; }
  100% { transform: translate(-50%, -50%) scale(2.4); opacity: 0; }
}
/* Bouncing diamond marking the exact drop spot. */
.bin-pin {
  position: absolute; left: 50%; top: 50%;
  width: clamp(14px, 4vw, 20px); height: clamp(14px, 4vw, 20px);
  border: 3px solid #fff;
  border-radius: 3px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .4);
  animation: binPin 1s ease-in-out infinite;
}
@keyframes binPin {
  0%, 100% { transform: translate(-50%, -70%) rotate(45deg) scale(1);    }
  50%      { transform: translate(-50%, -42%) rotate(45deg) scale(1.08); }
}

/* ============================================================
   Trash + cat
   ============================================================ */
.trash {
  position: absolute;
  transform: translate(-50%, -50%);
  width: var(--trash-size, 90px);
  height: var(--trash-size, 90px);
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.45));
  z-index: 20;
}
.trash img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.trash.pickup { animation: pop .35s ease; }
/* Customers (taxi passengers) are people sprites — a taller box than square
   trash so they aren't letterboxed down to nothing. */
.trash.customer { height: calc(var(--trash-size, 90px) * 1.7); }

/* Pedestrians walking the roads. Below the car (.avatar, z-index 15) so it
   reads as driving past them, and they bob while they walk. */
.npc { z-index: 13; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); }
.npc img { animation: npcWalk .46s ease-in-out infinite; }
.npc.resting img { animation: none; }
@keyframes npcWalk { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8%) rotate(2deg); } }

/* Launched by the car: Npc.js drives the arc, tumble and lift inline. Fly over
   everything, and hard-shadow the peak of the arc so the height reads. */
.npc.flying {
  z-index: 22;
  animation: none;
  filter: drop-shadow(0 14px 9px rgba(0,0,0,.5));
}
.npc.flying img { animation: none; }

/* Landed: lie there and fade out, then Npc.js walks a fresh one in. */
.npc.down { z-index: 12; }
.npc.down img { animation: npcDown var(--npc-fade, .9s) ease forwards; }
@keyframes npcDown {
  0%   { transform: scaleY(1)   scaleX(1);    opacity: 1; }
  18%  { transform: scaleY(.62) scaleX(1.18); opacity: 1; }  /* squash on impact */
  40%  { transform: scaleY(.78) scaleX(1.08); opacity: 1; }
  100% { transform: scaleY(.7)  scaleX(1.1);  opacity: 0; }
}

.avatar {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 15;
  filter: drop-shadow(0 5px 8px rgba(0,0,0,.45));
  will-change: left, top, transform;
}
/* Glow the player while a timed power-up is active. */
.avatar.pw-nitro  { filter: drop-shadow(0 5px 8px rgba(0,0,0,.45)) drop-shadow(0 0 12px #7cf6ff); }
.avatar.pw-fare   { filter: drop-shadow(0 5px 8px rgba(0,0,0,.45)) drop-shadow(0 0 10px #ffd23f); }
.avatar.pw-coffee { filter: drop-shadow(0 5px 8px rgba(0,0,0,.45)) drop-shadow(0 0 10px #b98a5a); }
.avatar.pw-ghost  { filter: drop-shadow(0 5px 8px rgba(0,0,0,.45)) drop-shadow(0 0 12px #c9b6ff); opacity: .55; }
/* Drift glow while sliding, warm flash while the boost surge is active. */
.avatar.drifting  { filter: drop-shadow(0 5px 8px rgba(0,0,0,.45)) drop-shadow(0 0 9px #59c1ff); }
.avatar.boosting  { filter: drop-shadow(0 5px 8px rgba(0,0,0,.45)) drop-shadow(0 0 15px #ffd23f) drop-shadow(0 0 7px #fff); }

/* ---- Collectible power-ups -------------------------------------------- */
.powerup {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 16;
  font-size: 15px;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.4));
  animation: pwFloat 1.4s ease-in-out infinite;
}
.powerup img {                    /* image power-ups (e.g. 🧨 dynamite) */
  width: 26px; height: 26px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.powerup::after {                 /* soft halo so it reads as "collect me" */
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 150%; height: 150%; transform: translate(-50%, -50%);
  border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(255,255,255,.55), rgba(255,255,255,0) 70%);
  animation: pwHalo 1.4s ease-in-out infinite;
}
.powerup.leaving { animation: pwFloat 1.4s ease-in-out infinite, pwBlink .4s steps(2) infinite; }
@keyframes pwFloat { 0%,100% { transform: translate(-50%, -50%)      scale(1); } 50% { transform: translate(-50%, -60%) scale(1.08); } }
@keyframes pwHalo  { 0%,100% { opacity: .5; } 50% { opacity: .9; } }
@keyframes pwBlink { 0% { opacity: 1; } 100% { opacity: .35; } }

/* Trash mid-flight to the player's hand (pulled by the magnet). */
.trash.magnetized { filter: drop-shadow(0 0 8px #59c1ff); z-index: 14; }

/* Collectible gold coins on the coin lines (drive over to grab). */
.game-coin {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 16;
  opacity: 0;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.45)) drop-shadow(0 0 6px rgba(255,208,60,.55));
  animation: coinBob 1.3s ease-in-out infinite, coinIn .3s ease forwards;
}
@keyframes coinBob { 0%, 100% { transform: translate(-50%, -50%); } 50% { transform: translate(-50%, -60%); } }
@keyframes coinIn  { from { opacity: 0; } to { opacity: 1; } }
.game-coin.leaving { animation: coinBob 1.3s ease-in-out infinite, coinBlink .4s steps(2) infinite; }
@keyframes coinBlink { 0% { opacity: 1; } 100% { opacity: .35; } }

/* Coin-hunt coins: pop in, then hold still. coinBob is `infinite`, and the hunt
   lays ~150 coins at once (a normal spawn is ~30) — every one of them animating
   forever halves the frame rate on a phone. Measured on a CPU-throttled Pixel 5
   mid-hunt: 28 FPS bobbing vs 52 still. The two drop-shadows are NOT the cost
   (28 vs 29 FPS with them removed), so the coins keep their glow. */
.game-coin--still { animation: coinIn .3s ease forwards; }

/* Passenger hopping out of the taxi at the destination, then fading away. */
.trash.dropped { z-index: 14; pointer-events: none; animation: custDrop .8s ease-out forwards; }
@keyframes custDrop {
  0%   { transform: translate(-50%, -50%)  scale(.6);  opacity: 0; }
  25%  { transform: translate(-50%, -85%)  scale(1.15); opacity: 1; }
  60%  { transform: translate(-50%, -105%) scale(1);    opacity: 1; }
  100% { transform: translate(-50%, -155%) scale(.85);  opacity: 0; }
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes pop   { 0%{transform:translate(-50%,-50%) scale(1)} 50%{transform:translate(-50%,-50%) scale(1.25)} 100%{transform:translate(-50%,-50%) scale(1)} }
@keyframes shake { 0%,100%{transform:translate(-50%,-50%) rotate(0)} 25%{transform:translate(-50%,-50%) rotate(-9deg)} 75%{transform:translate(-50%,-50%) rotate(9deg)} }
@keyframes targetPulse {
  0%,100% { transform: translate(-50%,-50%) scale(1);    box-shadow: 0 0 0 0 rgba(255,255,120,0), var(--shadow-sm); filter: brightness(1); }
  50%     { transform: translate(-50%,-50%) scale(1.13); box-shadow: 0 0 20px 7px rgba(255,221,90,.9), var(--shadow-sm); filter: brightness(1.25); }
}
@keyframes popIn  { 0%{opacity:0; transform:scale(.92)} 100%{opacity:1; transform:scale(1)} }
@keyframes bobble { 0%,100%{transform:translateY(0) rotate(-2deg)} 50%{transform:translateY(-10px) rotate(2deg)} }

/* ============================================================
   Pile meter + chip feedback
   ============================================================ */
.chip--pile { background: linear-gradient(180deg, #6b8e5a, #4e7a3a); }
.chip--pile.danger {
  background: linear-gradient(180deg, var(--red), #e23a4c);
  animation: pilePulse .5s ease-in-out infinite;
}
@keyframes pilePulse { 0%,100%{ transform: scale(1);} 50%{ transform: scale(1.12);} }

.chip.punch { animation: chipPunch .35s ease; }
@keyframes chipPunch { 0%{ transform: scale(1);} 40%{ transform: scale(1.28);} 100%{ transform: scale(1);} }

/* ============================================================
   Direction arrow (points the carried item toward its bin)
   ============================================================ */
.game-arrow {
  position: absolute;
  width: 0; height: 0;
  pointer-events: none;
  z-index: 25;
  transition: opacity .15s ease;
}
.game-arrow::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  width: 0; height: 0;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 21px solid #fff200;
  transform: translateY(-50%);
  filter: drop-shadow(0 0 4px rgba(0,0,0,.55));
  animation: arrowPulse .6s ease-in-out infinite;
}
@keyframes arrowPulse {
  0%,100% { transform: translateY(-50%) translateX(0)   scale(1); }
  50%     { transform: translateY(-50%) translateX(7px) scale(1.12); }
}

/* Screen-edge indicator: hugs the viewport edge and points to an off-screen
   target (a waiting customer 🧍 when empty, the destination stop when carrying). */
.edge-ind {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 40px; height: 40px;
  pointer-events: none;
  z-index: 60;
}
.edge-ind-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1;
  background: rgba(20, 24, 32, .72);
  border: 2px solid #fff;
  border-radius: 50%;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.5));
}
.edge-ind.cust .edge-ind-icon { border-color: #7CFC5A; }
.edge-ind.dest .edge-ind-icon { border-color: #fff200; }
/* Little triangle that rotates to point outward, past the icon disc. */
.edge-ind-arrow { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.edge-ind-arrow::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 14px solid #fff;
  transform: translate(6px, -50%);
  filter: drop-shadow(0 0 3px rgba(0,0,0,.6));
}
.edge-ind.cust .edge-ind-arrow::before { border-left-color: #7CFC5A; }
.edge-ind.dest .edge-ind-arrow::before { border-left-color: #fff200; }

/* "Taksi!" speech bubble bobbing above a waiting customer. */
.taxi-bubble {
  position: absolute;
  left: 50%; bottom: 100%;
  transform: translate(-50%, -4px);
  background: #fff; color: #1a2230;
  font-size: 8px; font-weight: 800; line-height: 1;
  white-space: nowrap;
  padding: 3px 5px; border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
  animation: taxiBob 1s ease-in-out infinite;
}
.taxi-bubble::after {
  content: '';
  position: absolute;
  left: 50%; top: 100%;
  width: 0; height: 0;
  border: 3px solid transparent;
  border-top-color: #fff;
  transform: translateX(-50%);
}
@keyframes taxiBob {
  0%,100% { transform: translate(-50%, -4px); }
  50%     { transform: translate(-50%, -7px); }
}

/* ============================================================
   Effects (confetti, rings, floating text, fly-to-score, shake)
   ============================================================ */
.fx-confetti {
  position: absolute;
  width: 10px; height: 14px;
  border-radius: 2px;
  z-index: 24;
  pointer-events: none;
  animation: confettiFly .9s ease-out forwards;
}
@keyframes confettiFly {
  0%   { transform: translate(-50%,-50%) translate(0,0) rotate(0);                       opacity: 1; }
  100% { transform: translate(-50%,-50%) translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

.fx-ring {
  position: absolute;
  width: 30px; height: 30px;
  margin: -15px 0 0 -15px;
  border: 4px solid #fff200;
  border-radius: 50%;
  z-index: 24;
  pointer-events: none;
  animation: ringPop .6s ease-out forwards;
}
@keyframes ringPop { 0%{ transform: scale(.3); opacity:.9; } 100%{ transform: scale(2.6); opacity:0; } }

/* Drift tyre marks + smoke. Marks sit under the car (z below .avatar's 15). */
.fx-skid {
  position: absolute;
  width: 6px; height: 15px;
  border-radius: 3px;
  background: rgba(28,24,30,.42);
  z-index: 12;
  pointer-events: none;
  animation: fxSkidFade 1.2s linear forwards;
}
@keyframes fxSkidFade { 0% { opacity: .5; } 100% { opacity: 0; } }
.fx-smoke {
  position: absolute;
  width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(225,225,230,.6), rgba(225,225,230,0) 70%);
  z-index: 13;
  pointer-events: none;
  animation: fxSmoke .7s ease-out forwards;
}
@keyframes fxSmoke {
  0%   { transform: translate(0,0) scale(.5);                opacity: .7; }
  100% { transform: translate(var(--dx,0), -18px) scale(1.7); opacity: 0; }
}

/* New-trash indicator: pulsing rings + a bouncing "!" badge at a spawn point. */
.fx-spawn { position: absolute; transform: translate(-50%, -50%); z-index: 23; pointer-events: none; }
.fx-spawn-ring {
  position: absolute; left: 0; top: 0;
  width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 3px solid #ffd23f; border-radius: 50%;
  animation: fxSpawnRing 1.05s ease-out forwards;
}
.fx-spawn-ring--2 { border-color: #ff9442; animation-delay: .26s; }
@keyframes fxSpawnRing { 0%{ transform: scale(.3); opacity:.9; } 70%{ opacity:.45; } 100%{ transform: scale(4.4); opacity:0; } }
.fx-spawn-badge {
  position: absolute; left: 0; top: 0;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: #ffd23f; color: #4a3a00;
  font-weight: 800; font-size: 16px; line-height: 1;
  box-shadow: 0 3px 6px rgba(0,0,0,.35);
  animation: fxSpawnBadge 1.3s ease forwards;
}
@keyframes fxSpawnBadge {
  0%   { transform: translate(-50%, -90%)  scale(0); }
  15%  { transform: translate(-50%, -175%) scale(1.2); }
  32%  { transform: translate(-50%, -150%) scale(1); }
  80%  { transform: translate(-50%, -150%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -150%) scale(.9); opacity: 0; }
}

.fx-float {
  position: absolute;
  z-index: 26;
  font-weight: 800;
  font-size: 26px;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.3), 0 0 8px rgba(0,0,0,.3);
  pointer-events: none;
  white-space: nowrap;
  animation: floatUp 1.6s ease-out forwards;
}
.fx-float.good  { color: #fff200; text-shadow: 0 2px 0 #c98a00, 0 0 10px rgba(255,242,0,.6); }
.fx-float.bad   { color: #ff5d6c; }
.fx-float.combo { color: #ff9442; font-size: 22px; }
.fx-float.drift { color: #59c1ff; text-shadow: 0 2px 0 #14456b, 0 0 10px rgba(89,193,255,.6); }

/* Coin shower: bursts out of the taxi, spins, then swoops onto the HUD coin chip. */
.fx-coin {
  position: absolute;
  font-size: 28px;
  z-index: 27;
  pointer-events: none;
  filter: drop-shadow(0 0 7px rgba(255,208,60,.95)) drop-shadow(0 2px 3px rgba(0,0,0,.45));
  animation: coinFly .82s cubic-bezier(.35, 0, .2, 1) forwards;
}
@keyframes coinFly {
  0%   { transform: translate(-50%,-50%) translate(0,0)                   scale(.4)  rotate(0);                     opacity: 0; }
  15%  { transform: translate(-50%,-50%) translate(var(--sx), var(--sy)) scale(1.35) rotate(calc(var(--spin) * .3)); opacity: 1; }
  100% { transform: translate(-50%,-50%) translate(var(--tx), var(--ty)) scale(.35) rotate(var(--spin));            opacity: .3; }
}
/* Coin chip "cash-in" flash when the shower lands. */
.chip--coins.cash { animation: coinCash .55s ease; }
@keyframes coinCash {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(255,208,60,0); }
  35%  { transform: scale(1.35); box-shadow: 0 0 22px 8px rgba(255,208,60,.9); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(255,208,60,0); }
}
@keyframes floatUp {
  0%   { transform: translate(-50%,-50%) translateY(0)    scale(.6); opacity: 0; }
  12%  { transform: translate(-50%,-50%) translateY(-6px) scale(1.1); opacity: 1; }
  75%  { transform: translate(-50%,-50%) translateY(-32px) scale(1);  opacity: 1; }
  100% { transform: translate(-50%,-50%) translateY(-54px) scale(1);  opacity: 0; }
}

.fx-screen { position: fixed; inset: 0; pointer-events: none; z-index: 2000; }

/* Big spectacular result splash (KK.FX.hero) — centred, pops in, holds, fades. */
.fx-hero {
  position: absolute; left: 50%; top: 42%;
  transform: translate(-50%, -50%);
  text-align: center; pointer-events: none; z-index: 40;
  animation: fxHero 3s ease forwards;
}
.fx-hero-main {
  font-size: clamp(34px, 9vw, 74px); font-weight: 800; letter-spacing: 1px;
  color: #ffd23f;
  text-shadow:
    -3px -3px 0 #141414, 3px -3px 0 #141414, -3px 3px 0 #141414, 3px 3px 0 #141414,
    0 8px 0 rgba(0,0,0,.3), 0 16px 32px rgba(0,0,0,.55);
}
.fx-hero-sub {
  margin-top: 10px;
  font-size: clamp(20px, 5.5vw, 42px); font-weight: 800; color: #fff;
  text-shadow:
    -2px -2px 0 #b06a00, 2px -2px 0 #b06a00, -2px 2px 0 #b06a00, 2px 2px 0 #b06a00,
    0 6px 16px rgba(0,0,0,.5);
}
@keyframes fxHero {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(.5); }
  12%  { opacity: 1; transform: translate(-50%,-50%) scale(1.16); }
  22%  {             transform: translate(-50%,-50%) scale(1); }
  80%  { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(.95); }
}

/* Weekday title card (KK.FX.title) — wears the hero's shield lettering, but its
   duration is the caller's (--dur), so the animation must not hard-code 3s. */
.fx-title {
  position: absolute; left: 50%; top: 42%;
  transform: translate(-50%, -50%);
  text-align: center; pointer-events: none; z-index: 40;
  font-size: clamp(38px, 11vw, 88px); font-weight: 800; letter-spacing: 2px;
  color: #ffd23f;
  text-shadow:
    -3px -3px 0 #141414, 3px -3px 0 #141414, -3px 3px 0 #141414, 3px 3px 0 #141414,
    0 8px 0 rgba(0,0,0,.3), 0 16px 32px rgba(0,0,0,.55);
  animation: fxTitle var(--dur, 2000ms) ease forwards;
}
@keyframes fxTitle {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(.6); }
  15%  { opacity: 1; transform: translate(-50%,-50%) scale(1.1); }
  25%  {             transform: translate(-50%,-50%) scale(1); }
  75%  { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.05); }
}
.fx-fly {
  position: absolute;
  transform: translate(-50%,-50%);
  font-weight: 800;
  font-size: 24px;
  color: #fff200;
  text-shadow: 0 2px 0 #c98a00, 0 0 10px rgba(255,242,0,.7);
  transition: transform .6s cubic-bezier(.4,-0.2,.2,1), opacity .6s ease-in;
}

.fx-shake { animation: fxShake .4s ease; }
@keyframes fxShake {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-7px, 3px); }
  40% { transform: translate(7px, -3px); }
  60% { transform: translate(-5px, 2px); }
  80% { transform: translate(5px, -2px); }
}

/* ============================================================
   Combo badge + timer bar
   ============================================================ */
.combo {
  position: absolute;
  /* Clear the left HUD stack (score/progress/lives+pile) so it never overlaps —
     track the notch inset the HUD padding adds so the gap holds on any phone. */
  top: calc(192px + env(safe-area-inset-top, 0px)); left: 50%;
  transform: translateX(-50%) translateY(-8px) scale(.9);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  opacity: 0;
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
  z-index: 30;
}
.combo.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
.combo-x {
  font-weight: 800;
  font-size: clamp(18px, 5vw, 26px);
  color: #ff9442;
  text-shadow: 0 2px 0 #b54e16, 0 0 10px rgba(255,148,66,.6);
}
.combo-bar {
  width: 120px; height: 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.3);
  border: 2px solid #fff;
  overflow: hidden;
}
.combo-bar > i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--sun), var(--red));
  transition: width .1s linear;
}

/* Active power-up timers: a badge with a draining bar per active power.
   Sit top-centre, just below the combo bar. */
.powers {
  position: absolute;
  top: calc(244px + env(safe-area-inset-top, 0px)); left: 50%;  /* below the combo bar, still top-centre */
  transform: translateX(-50%);
  display: flex; flex-direction: row; gap: 8px;
  z-index: 30; pointer-events: none;
}
.power {
  display: flex; align-items: center; gap: 7px;
  background: rgba(0,0,0,.42);
  border: 2px solid #fff;
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  animation: popIn .18s ease;
}
.power-x { font-size: 20px; line-height: 1; }
.power-bar {
  width: 66px; height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.25);
  overflow: hidden;
}
.power-bar > i { display: block; height: 100%; width: 100%; transition: width .12s linear; }
.power-nitro  .power-bar > i { background: linear-gradient(90deg, #7cf6ff, #2f9fe0); }
.power-fare   .power-bar > i { background: linear-gradient(90deg, #ffe066, #ff9d2e); }
.power-coffee .power-bar > i { background: linear-gradient(90deg, #d8b088, #9c6b3b); }
.power-ghost  .power-bar > i { background: linear-gradient(90deg, #d9c8ff, #8f6fe0); }
.power.ending { animation: powerEnding .5s ease-in-out infinite; }
@keyframes powerEnding { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* Narrow (portrait) phones only: the full-width top banner covers the top-left
   chips, so drop the chip stack — and the combo/power timers below it. (Landscape
   is wide, so the centred banner clears the left chips and nothing moves.) Placed
   after the base rules so it wins. */
@media (max-width: 640px) {
  .hud--stack { padding-top: calc(96px + env(safe-area-inset-top, 0px)); }
  .combo  { top: calc(272px + env(safe-area-inset-top, 0px)); }
  .powers { top: calc(324px + env(safe-area-inset-top, 0px)); }
}

/* ============================================================
   Time-of-day tint + danger vignette
   ============================================================ */
.level-tint { position: absolute; inset: 0; border-radius: 18px; pointer-events: none; z-index: 23; }
.danger-vignette {
  position: absolute; inset: 0;
  border-radius: 18px;
  pointer-events: none;
  z-index: 29;
  opacity: 0;
  transition: opacity .25s ease;
}
.danger-vignette.on { opacity: 1; animation: dangerPulse .7s ease-in-out infinite; }
@keyframes dangerPulse {
  0%,100% { box-shadow: inset 0 0 50px 12px rgba(255,40,60,.35); }
  50%     { box-shadow: inset 0 0 85px 26px rgba(255,40,60,.62); }
}

/* Golden bonus item (double points). */
.trash.golden img { animation: goldGlow 1s ease-in-out infinite; }
@keyframes goldGlow {
  0%,100% { filter: drop-shadow(0 0 4px rgba(255,210,40,.7)); }
  50%     { filter: drop-shadow(0 0 13px rgba(255,210,40,1)); }
}

/* ============================================================
   Stars (game over)
   ============================================================ */
.star-row { display: flex; gap: 10px; justify-content: center; }
.star {
  font-size: clamp(40px, 11vw, 64px);
  line-height: 1;
  color: rgba(255,255,255,.35);
  text-shadow: 0 3px 0 rgba(0,0,0,.2);
}
.star.on {
  color: var(--sun);
  text-shadow: 0 3px 0 #c98a00, 0 0 16px rgba(255,210,63,.85);
  animation: starPop .5s ease both;
}
@keyframes starPop {
  0%   { transform: scale(0) rotate(-30deg); }
  60%  { transform: scale(1.3) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ============================================================
   Rippee-themed start menu (matches rippee.fi — brand blue on white)
   ============================================================ */
:root {
  --rippee-blue:      #0090d8;
  --rippee-navy:      #004890;
  --rippee-blue-dark: #0072ad;
}
/* Bright, on-theme start menu (sky → grass with a sunny glow). */
/* Taxi theme: dark asphalt with a warm cab-yellow glow, framed by taxi checker. */
.overlay.menu-rippee {
  background:
    radial-gradient(120% 85% at 50% -10%, rgba(255,196,0,.34), transparent 55%),
    linear-gradient(180deg, rgba(28,32,48,.5) 0%, rgba(16,18,28,.62) 100%);
  backdrop-filter: blur(1.5px);
  gap: 13px;
  /* clear the top/bottom checker strips (26px) even when the content scrolls */
  padding-top: calc(40px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
}
/* Checker strips top + bottom (13px black/yellow squares) — the taxi cue. */
.overlay.menu-rippee::before,
.overlay.menu-rippee::after {
  content: '';
  position: absolute; left: 0; right: 0; height: 26px;
  /* 2×2 checkerboard tiled every 26px → 13px black/yellow squares (taxi checker). */
  background: conic-gradient(#141414 25%, #ffd23f 0 50%, #141414 0 75%, #ffd23f 0) 0 0 / 26px 26px;
  box-shadow: 0 1px 0 rgba(0,0,0,.35);
  pointer-events: none;
}
.overlay.menu-rippee::before { top: 0; animation: checkerRoll 4.5s linear infinite; }
.overlay.menu-rippee::after  { bottom: 0; animation: checkerRoll 4.5s linear infinite reverse; }
@keyframes checkerRoll { to { background-position: 26px 0; } }

/* One big taxi-yellow frame around the whole menu. */
.menu-panel {
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(10px, 2vh, 15px);
  padding: clamp(18px, 3.5vh, 30px) clamp(18px, 5vw, 40px);
  max-width: min(94vw, 540px);
  border: 4px solid #ffd23f;
  border-radius: 26px;
  background: rgba(18, 22, 34, .55);
  box-shadow:
    0 0 0 4px rgba(10,12,18,.75),        /* dark outer ring around the yellow frame */
    inset 0 0 0 2px rgba(0,0,0,.4),       /* thin inner line */
    inset 0 3px 0 rgba(255,255,255,.12),  /* top gloss */
    0 16px 38px rgba(0,0,0,.55);          /* soft drop */
}
.menu-rippee .rippee-brand {
  font-weight: 800;
  letter-spacing: .3px;
  color: var(--rippee-navy);
  background: #fff;
  border: 3px solid var(--rippee-blue);
  border-radius: 999px;
  padding: 6px 20px;
  box-shadow: var(--shadow-sm);
  font-size: clamp(14px, 4vw, 20px);
}
/* Taxi title: yellow fill, black sticker outline (like a cab sign). */
.overlay.menu-rippee h1 {
  color: #ffd23f;
  font-size: clamp(26px, 6.6vw, 48px);
  max-width: 15ch;
  line-height: 1.05;
  text-shadow:
    -2px -2px 0 #141414, 2px -2px 0 #141414,
    -2px  2px 0 #141414, 2px  2px 0 #141414,
     0 6px 0 rgba(0,0,0,.35), 0 10px 16px rgba(0,0,0,.45);
}
.overlay.menu-rippee p { color: #e6ecf5; text-shadow: 0 1px 3px rgba(0,0,0,.55); }

/* ---- Pre-shift briefing (Intro.js) -----------------------------------
   Reuses .overlay.menu-rippee + .menu-panel above, so it wears the menu's taxi
   theme for free; only the step list and the keycaps are new. */
.overlay.intro { z-index: 40; }        /* above the HUD (z-index 30) */
.intro-steps {
  display: flex; flex-direction: column;
  gap: 9px;
  text-align: left;
  max-width: 42ch;
}
.intro-step { display: flex; align-items: flex-start; gap: 10px; }
.intro-step-icon { font-size: clamp(16px, 4vw, 20px); line-height: 1.4; }
.intro-step-text {
  color: #e6ecf5;
  font-weight: 600;
  font-size: clamp(13px, 3.2vw, 16px);
  line-height: 1.4;
  text-shadow: 0 1px 3px rgba(0,0,0,.55);
}

.intro-keys { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.intro-key-row { display: flex; align-items: center; gap: 10px; }
.intro-key-caps { display: flex; gap: 5px; flex: 0 0 auto; }
/* Keycap: dark cab-dash cap with a taxi-yellow legend and a chunky bottom edge. */
.intro-key {
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(11px, 2.8vw, 14px);
  color: #ffd23f;
  background: linear-gradient(180deg, #2c3145, #171b28);
  border: 2px solid #ffd23f;
  border-radius: 8px;
  padding: 4px 8px;
  min-width: 14px;
  text-align: center;
  box-shadow: 0 3px 0 rgba(0,0,0,.55);
}
.intro-key-label {
  color: #e6ecf5;
  font-weight: 600;
  font-size: clamp(12px, 3vw, 15px);
  text-align: left;
  text-shadow: 0 1px 3px rgba(0,0,0,.55);
}
.overlay.menu-rippee .welcome { font-weight: 700; max-width: 32ch; color: var(--red); text-shadow: 0 1px 2px rgba(0,0,0,.45); }
/* Stats as separate chips (clearer than one run-on line). */
.menu-stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.stat-chip {
  font-weight: 800; color: #5a3e00;
  background: linear-gradient(180deg, #fff3c9, #ffdf87);
  border: 2px solid #fff; border-radius: 999px;
  padding: 5px 15px; font-size: clamp(14px, 3.8vw, 18px);
  box-shadow: var(--shadow-sm);
}
.overlay.menu-rippee .menu-label { font-weight: 800; color: var(--red); text-shadow: 0 1px 2px rgba(0,0,0,.45); opacity: 1; }
.menu-rippee .mascot { filter: drop-shadow(0 8px 10px rgba(0,72,144,.3)); }

/* Menu buttons — varied theme colours instead of all-blue. */
.btn-rippee { background: linear-gradient(180deg, var(--teal), #1f9e92) !important; }
.menu-actions .btn.secondary {
  background: linear-gradient(180deg, var(--sun), var(--orange));
  color: #5a3e00; text-shadow: 0 1px 0 rgba(255,255,255,.35);
}
/* Level cards colour-coded by time of day (Aamu→Yö). */
.menu-rippee .level-btn { background: linear-gradient(180deg, var(--grass), var(--grass-deep)); }
.menu-rippee .level-1 { background: linear-gradient(180deg, #f9a825, #ef8a00); } /* Maanantai — gold */
.menu-rippee .level-2 { background: linear-gradient(180deg, #5fb84a, #3f9a3f); } /* Tiistai — green */
.menu-rippee .level-3 { background: linear-gradient(180deg, #2ec4b6, #1fa99c); } /* Keskiviikko — teal */
.menu-rippee .level-4 { background: linear-gradient(180deg, #9b7ede, #6f4fb0); } /* Torstai — purple */
.menu-rippee .level-5 { background: linear-gradient(180deg, #3d6ee9, #244e8f); } /* Perjantai — night blue */
.menu-rippee .level-btn.locked {
  background: linear-gradient(180deg, #b8c6d0, #8ba0ad);
}

/* Primary "start game" call-to-action — big taxi-yellow button, gently pulsing. */
.btn-start {
  font-size: clamp(20px, 5.2vw, 28px);
  padding: 15px 46px;
  background: linear-gradient(180deg, #ffd23f, #f5a800);
  color: #1a1a1a;
  text-shadow: 0 1px 0 rgba(255,255,255,.4);
  box-shadow: 0 6px 0 rgba(0,0,0,.3), 0 12px 24px rgba(0,0,0,.34);
  animation: startPulse 1.8s ease-in-out infinite;
}
@keyframes startPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.btn-start:active { animation: none; }

/* --- Framed, glossy "cab plate" buttons in the taxi menu --- */
.overlay.menu-rippee .btn,
.overlay.menu-rippee .level-btn {
  border: 3px solid rgba(10,12,18,.72);
  box-shadow:
    0 0 0 2px rgba(255,210,63,.55),        /* yellow taxi frame ring */
    inset 0 2px 0 rgba(255,255,255,.4),    /* top gloss highlight */
    inset 0 -4px 8px rgba(0,0,0,.22),      /* inner bottom shade */
    0 5px 0 rgba(0,0,0,.32),               /* 3D lip */
    0 11px 20px rgba(0,0,0,.42);           /* soft drop */
}
.overlay.menu-rippee .btn:active,
.overlay.menu-rippee .level-btn:active {
  transform: translateY(3px);
  box-shadow:
    0 0 0 2px rgba(255,210,63,.55),
    inset 0 2px 0 rgba(255,255,255,.32),
    inset 0 -2px 6px rgba(0,0,0,.25),
    0 2px 0 rgba(0,0,0,.3),
    0 5px 10px rgba(0,0,0,.4);
}
.overlay.menu-rippee .level-btn.locked { box-shadow: 0 0 0 2px rgba(255,255,255,.15), var(--shadow-sm); }

/* Glossy shine sweeping across the start button. */
.btn-start { position: relative; overflow: hidden; }
.btn-start::after {
  content: '';
  position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.6), transparent);
  transform: skewX(-16deg);
  pointer-events: none;
  animation: btnShine 2.8s ease-in-out infinite;
}
@keyframes btnShine { 0% { left: -60%; } 60%, 100% { left: 135%; } }

/* ============================================================
   Level select (menu)
   ============================================================ */
.trophy-line { font-weight: 700; }
.level-grid { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; max-width: 430px; }
.level-btn {
  cursor: pointer;
  width: 94px; padding: 10px 8px;
  border: var(--stroke); border-radius: 16px;
  background: linear-gradient(180deg, var(--grass), var(--grass-deep));
  color: #fff;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: transform .08s ease, filter .15s ease;
}
.level-btn:hover { filter: brightness(1.08); }
.level-btn:active { transform: translateY(2px); }
.level-btn.locked { background: linear-gradient(180deg, #9fb0a4, #75857a); cursor: default; filter: none; }
.level-no { font-size: 24px; font-weight: 800; text-shadow: 0 2px 0 rgba(0,0,0,.18); }
.level-name { font-size: 13px; font-weight: 700; }
.level-stars { font-size: 15px; letter-spacing: 1px; color: #fff; }

/* Mobile: compact the whole start menu so it fits one screen without scrolling. */
@media (max-width: 640px) {
  .overlay.menu-rippee {
    gap: 8px;
    padding-top: calc(30px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  }
  .menu-panel { gap: 7px; padding: 14px 16px; }
  .overlay.menu-rippee h1 { font-size: clamp(24px, 6.6vw, 34px); }
  .overlay.menu-rippee .welcome { font-size: 14px; }
  .menu-stats { gap: 6px; }
  .stat-chip { padding: 4px 11px; font-size: 13px; }
  .btn-start { font-size: 20px; padding: 11px 34px; }
  .overlay.menu-rippee .btn { padding: 9px 20px; font-size: 16px; }
  .daily-btn .daily-title { font-size: 14px; }
  .daily-btn .daily-desc { font-size: 12px; }
  .overlay.menu-rippee .menu-label { font-size: 14px; }
  .level-grid { gap: 8px; }
  .level-btn { width: 82px; padding: 7px 6px; gap: 2px; }
  .level-no { font-size: 20px; }
  .level-name { font-size: 12px; }
  .level-stars { font-size: 13px; }
}

/* ============================================================
   "Did you know?" fact (game over)
   ============================================================ */
.fact {
  font-size: clamp(13px, 3.6vw, 17px) !important;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,.22);
  border-radius: 12px;
  padding: 9px 15px;
  max-width: 34ch;
  line-height: 1.4;
}

/* ============================================================
   Sorting guide (learn screen)
   ============================================================ */
.overlay.learn { justify-content: flex-start; overflow-y: auto; gap: 12px; }
.learn-title { margin-top: 4px; font-size: clamp(26px, 7vw, 46px); }
.learn-grid { display: flex; flex-direction: column; gap: 12px; width: min(560px, 92vw); }
.learn-card {
  background: rgba(255,255,255,.93);
  border: var(--stroke);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.learn-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  color: #fff;
  font-weight: 800;
  font-size: clamp(15px, 4vw, 20px);
  text-shadow: 0 2px 2px rgba(0,0,0,.35);
}
.learn-icon { font-size: 1.4em; }
.learn-items { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
.learn-item { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 72px; }
.learn-item img { width: 52px; height: 52px; object-fit: contain; }
.learn-item span { font-size: 11px; font-weight: 700; color: var(--ink); text-align: center; line-height: 1.15; }

/* ============================================================
   Touch controls (throttle pad + steer/handbrake pad)
   ============================================================ */
/* Touch controls. Left pad = throttle (▲ forward / ▼ reverse), right pad = steer
   (◀ / ▶) with the handbrake (✋) above them. Real buttons keep pointer-events;
   touch-action:none stops a hold from scrolling. The pad wrappers are pass-through
   so only the buttons (not the gaps) capture touches. */
.ctl-pad {
  position: absolute;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  display: none;   /* touch-only — desktop drives with the keyboard (see below) */
  flex-direction: column; align-items: center; gap: 12px;
  z-index: 35;
  pointer-events: none;
}
/* Show the on-screen buttons only on touch devices. */
@media (pointer: coarse) {
  .ctl-pad { display: flex; }
}
.ctl-pad--left  { left: calc(24px + env(safe-area-inset-left, 0px)); }
.ctl-pad--right { right: calc(24px + env(safe-area-inset-right, 0px)); }
.ctl-row { display: flex; gap: 12px; }

.ctl-btn {
  width: clamp(70px, 18vw, 92px); height: clamp(70px, 18vw, 92px);
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.65);
  background: rgba(255,255,255,.16);
  color: #fff; font-size: clamp(26px, 7vw, 38px); font-weight: 800; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  user-select: none; -webkit-user-select: none;
  touch-action: none;
  pointer-events: auto;
  transition: background .1s ease, transform .08s ease, border-color .1s ease;
}
.ctl-btn.active { border-color: #fff; transform: scale(.92); }
.ctl-fwd  { background: rgba(90,200,120,.32); }
.ctl-back { background: rgba(60,140,230,.32); }
.ctl-brake { background: rgba(255,80,90,.32); font-size: clamp(24px, 6.5vw, 34px); }
.ctl-fwd.active  { background: rgba(90,200,120,.62); }
.ctl-back.active { background: rgba(60,140,230,.62); }
.ctl-left.active, .ctl-right.active { background: rgba(255,255,255,.42); }
.ctl-brake.active { background: rgba(255,80,90,.62); }

/* ============================================================
   Pop quiz ("which doesn't belong?")
   ============================================================ */
.quiz {
  position: absolute; inset: 0;
  z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: clamp(10px, 2.2vh, 16px);
  padding: clamp(14px, 3.5vh, 20px);
  text-align: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, rgba(60,40,110,.6), rgba(30,50,30,.62));
  backdrop-filter: blur(3px);
  animation: popIn .3s ease;
}
.quiz > :first-child { margin-top: auto; }
.quiz > :last-child { margin-bottom: auto; }
.quiz-badge {
  background: linear-gradient(180deg, var(--purple), #7a5fc0);
  color: #fff;
  border: var(--stroke);
  border-radius: 999px;
  padding: 6px 18px;
  font-weight: 800;
  font-size: clamp(14px, 4vw, 18px);
  box-shadow: var(--shadow-sm);
}
.quiz h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(20px, 5.5vw, 30px);
  text-shadow: -2px -2px 0 #5a3e8c, 2px -2px 0 #5a3e8c, -2px 2px 0 #5a3e8c, 2px 2px 0 #5a3e8c, 0 6px 0 rgba(0,0,0,.18);
}
.quiz-opts { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.quiz-opt {
  width: clamp(92px, 22vw, 132px);
  background: #fff;
  border: var(--stroke);
  border-radius: 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  padding: 10px 10px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .08s ease, filter .15s ease;
}
.quiz-opt img { width: 100%; height: clamp(64px, 15vw, 92px); object-fit: contain; pointer-events: none; }
.quiz-opt-name { font-size: clamp(11px, 3vw, 14px); font-weight: 700; color: var(--ink); }
/* Text-question answer: big bin icon over the bin label. */
.quiz-qopt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: clamp(96px, 21vw, 124px);
}
.quiz-qicon { font-size: clamp(40px, 10vw, 58px); line-height: 1; pointer-events: none; }
/* Statement answers: a stack of full-width text buttons. */
.quiz-sopts { flex-direction: column; flex-wrap: nowrap; width: min(92vw, 480px); gap: 10px; }
.quiz-sopt {
  width: 100%;
  padding: 14px 18px;
  display: block;            /* plain block so long text wraps within the button */
  text-align: center;
}
.quiz-sopt-text { font-size: clamp(14px, 4vw, 18px); font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }

/* Quiz gate between levels: progress pips + back button. */
.gate-pips { display: flex; gap: 12px; }
.gate-pip {
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(255,255,255,.3); border: 2px solid #fff;
  transition: background .2s ease, box-shadow .2s ease, transform .2s ease;
}
.gate-pip.on { background: var(--sun); box-shadow: 0 0 10px var(--sun); transform: scale(1.15); }
.gate-back { padding: 10px 22px; font-size: clamp(14px, 3.6vw, 18px); }
.quiz-opt:hover { filter: brightness(1.05); transform: translateY(-3px); }
.quiz-opt:active { transform: translateY(1px); }
.quiz-opt.correct { box-shadow: 0 0 0 5px var(--grass-deep), var(--shadow); animation: qPop .4s ease; }
.quiz-opt.wrong   { box-shadow: 0 0 0 5px var(--red), var(--shadow); animation: qShake .4s ease; }
.quiz-opt.dim     { opacity: .4; }
@keyframes qPop   { 0%{ transform: scale(1);} 50%{ transform: scale(1.12);} 100%{ transform: scale(1);} }
@keyframes qShake { 0%,100%{ transform: translateX(0);} 25%{ transform: translateX(-6px);} 75%{ transform: translateX(6px);} }
.quiz-feedback {
  min-height: 26px;
  max-width: min(92vw, 540px);   /* keep long explanations to a readable width */
  margin: 0 auto;
  line-height: 1.35;
  font-weight: 800;
  font-size: clamp(15px, 4vw, 20px);
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,.4);
}
/* Explanation text stays white for readability; the answer buttons + the
   "Oikein!/Väärin." prefix already signal right vs. wrong. */
.quiz-feedback.good { color: #fff; }
.quiz-feedback.bad  { color: #fff; }

/* Tietovisa (QuizScene) result view */
.quiz-score {
  font-weight: 800; color: #fff;
  font-size: clamp(30px, 9vw, 48px);
  text-shadow: -2px -2px 0 #5a3e8c, 2px -2px 0 #5a3e8c, -2px 2px 0 #5a3e8c, 2px 2px 0 #5a3e8c, 0 6px 0 rgba(0,0,0,.18);
}
.quiz-note { margin: 0; color: #fff; font-weight: 700; font-size: clamp(15px, 4vw, 20px); text-shadow: 0 2px 4px rgba(0,0,0,.4); }
.quiz-scene .coin-earn { color: #ffe066; }
.quiz-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ============================================================
   Fare-haggle minigame (shown on pickup)
   ============================================================ */
.haggle {
  position: absolute; inset: 0;
  z-index: 55;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(12px, 2.6vh, 20px);
  padding: clamp(14px, 3.5vh, 22px);
  text-align: center;
  background: linear-gradient(180deg, rgba(120,80,20,.6), rgba(30,50,30,.62));
  backdrop-filter: blur(3px);
  animation: popIn .28s ease;
}
.haggle-badge {
  background: linear-gradient(180deg, #ffb020, #ff8c1a);
  color: #4a3200;
  border: var(--stroke);
  border-radius: 999px;
  padding: 6px 18px;
  font-weight: 800;
  font-size: clamp(14px, 4vw, 18px);
  box-shadow: var(--shadow-sm);
}
.haggle h2 {
  margin: 0; color: #fff;
  font-size: clamp(20px, 5.5vw, 30px);
  text-shadow: -2px -2px 0 #8a5a00, 2px -2px 0 #8a5a00, -2px 2px 0 #8a5a00, 2px 2px 0 #8a5a00, 0 6px 0 rgba(0,0,0,.18);
}
.haggle-body { display: flex; flex-direction: column; align-items: center; gap: clamp(12px, 2.6vh, 20px); width: min(92vw, 460px); }
.haggle-result {
  min-height: 1.4em;
  font-weight: 800; color: #fff;
  font-size: clamp(16px, 4.4vw, 22px);
  text-shadow: 0 2px 4px rgba(0,0,0,.45);
  opacity: 0; transform: scale(.8); transition: opacity .2s ease, transform .2s ease;
}
.haggle-result.show { opacity: 1; transform: scale(1); }
.haggle-result.good { color: #d6ffd0; }
.haggle-result.bad  { color: #ffd0d4; }
.haggle.win  { animation: popIn .28s ease, hgWin .5s ease .02s; }
.haggle.lose { animation: popIn .28s ease, qShake .4s ease .02s; }
@keyframes hgWin { 0%,100% { filter: none; } 50% { filter: brightness(1.15); } }

.hg-btn {
  font-size: clamp(18px, 5vw, 26px);
  padding: clamp(12px, 2.6vh, 18px) clamp(26px, 8vw, 44px);
  background: linear-gradient(180deg, #ffd23f, #ff9442);
  color: #4a2f00;
}

/* --- Mittarin pysäytys (stop the needle) --- */
.hg-track {
  position: relative;
  width: 100%; height: clamp(26px, 5vh, 34px);
  background: #2a1c33; border: var(--stroke); border-radius: 999px;
  box-shadow: inset 0 3px 6px rgba(0,0,0,.5);
  overflow: hidden;
}
.hg-zone {
  position: absolute; top: 0; bottom: 0;
  background: repeating-linear-gradient(45deg, #59c96b, #59c96b 8px, #4bb85d 8px, #4bb85d 16px);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.35);
}
.hg-marker {
  position: absolute; top: -3px; bottom: -3px; left: 0;
  width: 6px; margin-left: -3px;
  background: #fff; border-radius: 3px;
  box-shadow: 0 0 8px #fff, 0 0 3px #000;
}

/* --- Napin hakkaus (mash to raise) --- */
.hg-meter {
  position: relative;
  width: clamp(56px, 16vw, 74px); height: clamp(150px, 30vh, 210px);
  background: #2a1c33; border: var(--stroke); border-radius: 16px;
  box-shadow: inset 0 3px 8px rgba(0,0,0,.5);
  overflow: hidden;
}
.hg-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0%;
  background: linear-gradient(180deg, #ffd23f, #ff8c1a);
  transition: height .05s linear;
}
.hg-greed {
  position: absolute; left: -4px; right: -4px; height: 5px;
  background: var(--red); box-shadow: 0 0 8px var(--red);
}
.hg-timer {
  width: 100%; height: 10px;
  background: rgba(0,0,0,.4); border-radius: 999px; overflow: hidden;
}
.hg-timer > i { display: block; height: 100%; width: 100%; background: #ffd23f; }

/* --- Oikea hinta (pick the price) --- */
.hg-mood { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hg-mood-face { font-size: clamp(46px, 12vw, 64px); line-height: 1; }
.hg-mood-hint { color: #fff; font-weight: 700; font-size: clamp(14px, 3.8vw, 18px); text-shadow: 0 2px 4px rgba(0,0,0,.4); }
.hg-cards { display: flex; gap: clamp(8px, 2.5vw, 14px); justify-content: center; }
.hg-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: clamp(84px, 24vw, 120px);
  padding: clamp(12px, 2.4vh, 18px) 8px;
  background: #fff; color: var(--ink);
}
.hg-card-coins { font-size: clamp(20px, 6vw, 30px); font-weight: 800; color: #c47a00; }
.hg-card-label { font-size: clamp(12px, 3.4vw, 16px); font-weight: 700; }

/* ============================================================
   In-game editor (toggle with "E")
   ============================================================ */
.ed-marker {
  position: absolute;
  width: 22px; height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.5);
  cursor: grab;
  touch-action: none;
  z-index: 40;
}
.ed-marker:active { cursor: grabbing; }
/* Coin line: a gold dashed bar between its two draggable 🪙 endpoints. */
.ed-coinline {
  position: absolute;
  height: 6px;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, #f7b500 0 9px, #a97600 9px 18px);
  box-shadow: 0 0 0 2px rgba(0,0,0,.4);
  pointer-events: none;
  z-index: 38;
}
.ed-marker .ed-lbl {
  position: absolute;
  left: 50%; top: -8px;
  transform: translate(-50%, -100%);
  background: rgba(0,0,0,.8);
  color: #fff;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
}

.ed-panel {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: min(320px, 86vw);
  background: #243a2c;
  color: #e9f5ee;
  font-family: system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  overflow-y: auto;
  box-shadow: -8px 0 24px rgba(0,0,0,.4);
  z-index: 1000;
}
.ed-head { display: flex; align-items: center; justify-content: space-between; }
.ed-head h2 { margin: 0; font-size: 18px; }
.ed-x {
  cursor: pointer; border: none; background: #3c5a45; color: #e9f5ee;
  width: 30px; height: 30px; border-radius: 8px; font-size: 15px;
}
.ed-x:hover { background: #4a6e55; }
.ed-hint { margin: 0; font-size: 12.5px; color: #a9c9b5; line-height: 1.45; }
.ed-list { display: flex; flex-direction: column; gap: 6px; }
.ed-row {
  display: flex; align-items: center; gap: 8px;
  background: #1b2a20; border: 1px solid #34503e; border-radius: 8px;
  padding: 7px 9px; font-size: 12.5px; cursor: pointer;
}
.ed-row.sel { border-color: #ffd43b; }
.ed-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; flex: 0 0 auto; }
.ed-name { flex: 1; font-weight: 600; }
.ed-coord { color: #9fc1ac; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ed-actions { display: flex; gap: 8px; }
.ed-btn {
  cursor: pointer; border: none; border-radius: 8px; padding: 9px 10px;
  font-size: 13px; font-weight: 700; background: #3c5a45; color: #e9f5ee; flex: 1;
}
.ed-btn:hover { background: #4a6e55; }
.ed-save { background: #2f9e54; }
.ed-save:hover { background: #37b863; }
.ed-reset { background: #8a3b3b; }
.ed-reset:hover { background: #a64545; }
.ed-msg { font-size: 13px; font-weight: 700; color: #8be0a6; min-height: 18px; text-align: center; }
.ed-add-ob { background: #8a3b3b; margin-top: 4px; }
.ed-add-ob:hover { background: #a64545; }

/* Collision zones drawn in the editor (visible only while editing). */
.ed-obstacle {
  position: absolute;
  background: rgba(255, 70, 70, .28);
  border: 2px dashed #ff5d6c;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.3);
  cursor: grab;
  touch-action: none;
  z-index: 38;
}
.ed-obstacle:active { cursor: grabbing; }
.ed-ob-tag { position: absolute; left: 4px; top: 2px; font-size: 15px; pointer-events: none; }
.ed-ob-del {
  position: absolute; right: -10px; top: -10px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #ff5d6c; color: #fff; border: 2px solid #fff;
  font-size: 13px; font-weight: 800; line-height: 18px; text-align: center;
  cursor: pointer; z-index: 39;
}
.ed-ob-resize {
  position: absolute; right: -8px; bottom: -8px;
  width: 18px; height: 18px; border-radius: 4px;
  background: #fff; border: 2px solid #ff5d6c;
  cursor: nwse-resize; touch-action: none;
}
.ed-ob-rotate {
  position: absolute; left: 50%; top: -30px;
  transform: translateX(-50%);
  width: 24px; height: 24px; border-radius: 50%;
  background: #6bd0ff; color: #06344a; border: 2px solid #fff;
  font-size: 15px; font-weight: 800; line-height: 20px; text-align: center;
  cursor: grab; touch-action: none; z-index: 39;
  box-shadow: 0 2px 5px rgba(0,0,0,.4);
}
/* Stalk connecting the rotate knob to the box. */
.ed-ob-rotate::before {
  content: ""; position: absolute; left: 50%; top: 100%;
  width: 2px; height: 8px; background: #fff; transform: translateX(-50%);
}

/* ============================================================
   Splash / title screen (shown on launch)
   ============================================================ */
.splash {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-deep) 48%, var(--grass) 100%);
  animation: popIn .35s ease;
  cursor: pointer;
}
.splash-img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.28));
}
/* Full-bleed hero art as the launch screen background. */
.splash--image { background-size: cover; background-position: center; background-repeat: no-repeat; }
.splash-title { text-align: center; user-select: none; }
.splash-emoji { font-size: clamp(72px, 26vw, 180px); line-height: 1; filter: drop-shadow(0 10px 22px rgba(0,0,0,.28)); }
.splash-name {
  font-size: clamp(36px, 12vw, 92px); font-weight: 800; color: #fff;
  letter-spacing: 1px; text-shadow: 0 3px 0 rgba(0,0,0,.25);
}
.splash-tag { font-size: clamp(15px, 4.5vw, 24px); font-weight: 700; color: #fff; opacity: .92; margin-top: 4px; }
.splash-cta {
  position: absolute; bottom: 6%; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, var(--grass), var(--grass-deep));
  color: #fff; border: var(--stroke); border-radius: 999px;
  padding: 12px 32px; font-weight: 800;
  font-size: clamp(16px, 4.5vw, 24px);
  text-shadow: 0 2px 0 rgba(0,0,0,.2);
  box-shadow: var(--shadow);
  animation: splashPulse 1.4s ease-in-out infinite;
  cursor: pointer;
}
@keyframes splashPulse {
  0%,100% { transform: translateX(-50%) scale(1); }
  50%     { transform: translateX(-50%) scale(1.06); }
}

/* ============================================================
   Boot / loading
   ============================================================ */
.loader {
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  color: #fff; font-weight: 700;
  text-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* --- Taxi-themed boot screen: dark asphalt night + checker strips + a cab that
   drives to the finish flag as loading progresses. --- */
.scene.boot {
  background:
    radial-gradient(130% 90% at 50% -15%, rgba(255,196,0,.30), transparent 55%),
    linear-gradient(180deg, #1c2030 0%, #0e1018 100%);
}
/* Rolling taxi-checker strips top + bottom (matches the menu). */
.scene.boot::before,
.scene.boot::after {
  content: '';
  position: absolute; left: 0; right: 0; height: 26px;
  background: conic-gradient(#141414 25%, #ffd23f 0 50%, #141414 0 75%, #ffd23f 0) 0 0 / 26px 26px;
  box-shadow: 0 1px 0 rgba(0,0,0,.35);
  animation: checkerRoll 4.5s linear infinite;
}
.scene.boot::before { top: 0; }
.scene.boot::after  { bottom: 0; animation-direction: reverse; }

.loader-title {
  font-size: clamp(20px, 5.5vw, 30px);
  color: #ffd23f;
  text-shadow: -1px -1px 0 #141414, 1px -1px 0 #141414, -1px 1px 0 #141414, 1px 1px 0 #141414, 0 4px 10px rgba(0,0,0,.5);
}

/* The road: a strip of dark asphalt with a bright kerb line top and bottom. */
.road {
  position: relative;
  width: min(74vw, 400px); height: 42px;
  border-radius: 10px;
  background: linear-gradient(180deg, #3a3f46 0%, #262a30 55%, #1c1f24 100%);
  border: 3px solid #101216;
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.05),
    inset 0 -8px 14px rgba(0,0,0,.55),
    0 12px 28px rgba(0,0,0,.55);
  overflow: hidden;
}
/* Thin white kerb lines hugging the top + bottom edges. */
.road::before, .road::after {
  content: ''; position: absolute; left: 0; right: 0; height: 3px;
  background: rgba(255,255,255,.22);
}
.road::before { top: 4px; }
.road::after  { bottom: 4px; }

/* Dashed yellow centre line that scrolls, so the road looks like it's moving. */
.road-lane {
  position: absolute; left: 0; right: 0; top: 50%;
  height: 5px; transform: translateY(-50%);
  background: repeating-linear-gradient(90deg, #ffd23f 0 20px, transparent 20px 40px);
  opacity: .85;
  animation: laneScroll .45s linear infinite;
}
@keyframes laneScroll { to { background-position: -40px 0; } }

/* Warm "already travelled" tint trailing behind the cab. */
.road-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: linear-gradient(90deg, rgba(255,210,63,0), rgba(255,210,63,.20));
  transition: width .25s ease;
}

/* The cab drives from the start toward the flag (left bound to progress %). */
.road-cab {
  position: absolute; top: 50%; left: 0;
  font-size: 30px; line-height: 1;
  filter: drop-shadow(-7px 5px 3px rgba(0,0,0,.55));
  transition: left .25s ease;
  animation: cabDrive .32s ease-in-out infinite alternate;
}
/* scaleX(-1) points the emoji cab in its direction of travel (rightward). */
@keyframes cabDrive {
  from { transform: translate(-50%, -56%) scaleX(-1) rotate(-1.5deg); }
  to   { transform: translate(-50%, -50%) scaleX(-1) rotate(1.5deg); }
}

/* Checker finish flag pinned to the end of the road. */
.road-flag {
  position: absolute; right: 5px; top: 50%;
  transform: translateY(-50%);
  font-size: 22px; line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.5));
}

.loader-pct {
  font-size: clamp(16px, 4.2vw, 22px); font-weight: 800;
  color: #ffd23f; font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 6px rgba(0,0,0,.45);
}

/* ============================================================
   Meta loop: coins, daily challenge, daily reward
   ============================================================ */

/* Daily challenge button in the menu. */
.daily-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 26px;
  background: linear-gradient(180deg, var(--red), #e23a4c);
  line-height: 1.2;
}
.daily-btn.done { background: linear-gradient(180deg, var(--grass), var(--grass-deep)); }
.menu-garage { background: linear-gradient(180deg, #5a6b7a, #3a4756); } /* steel — garage/mechanic */
.daily-title { font-size: clamp(15px, 4vw, 20px); }
.daily-desc { font-size: clamp(11px, 3vw, 14px); font-weight: 600; opacity: .92; }

.menu-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Coins earned line on the result screen. */
.coin-earn { font-weight: 800; color: #b8860b; }
@media (prefers-color-scheme: dark) { .coin-earn { color: #ffd23f; } }

/* --- Win/lose score meter (GameOverScene): bar fills + number counts up --- */
.score-meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(320px, 78vw);
}
.score-meter-label {
  font-size: clamp(12px, 3.2vw, 15px);
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,.4);
}
.score-meter-track {
  position: relative;
  width: 100%;
  height: 16px;
  border-radius: 999px;
  background: rgba(0,0,0,.28);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.35), 0 0 0 2px rgba(255,255,255,.25);
  overflow: hidden;
}
.score-meter-fill {
  position: relative;
  display: block;
  height: 100%;
  width: 0;                       /* driven by JS (_animateScore) */
  border-radius: 999px;
  background: linear-gradient(90deg, #86cf4e, #ffd23f);
  box-shadow: 0 0 10px rgba(255,210,63,.7);
}
.score-meter-fill::after {        /* travelling gloss so the fill feels alive */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
  transform: translateX(-100%);
  animation: meterShine 1.2s ease-in-out infinite;
}
@keyframes meterShine { to { transform: translateX(100%); } }
.score-meter-num {
  font-size: clamp(30px, 8vw, 52px);
  font-weight: 900;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow:
    -2px -2px 0 var(--grass-deep), 2px -2px 0 var(--grass-deep),
    -2px  2px 0 var(--grass-deep), 2px  2px 0 var(--grass-deep),
     0 5px 0 rgba(0,0,0,.2);
}
.score-meter-num.pop { animation: scorePop .5s cubic-bezier(.2,1.4,.4,1); }
@keyframes scorePop { 0% { transform: scale(1); } 45% { transform: scale(1.28); } 100% { transform: scale(1); } }

/* --- Shared modal shell (daily reward + shop) --- */
.modal-backdrop {
  position: absolute; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(20, 30, 20, .5);
  backdrop-filter: blur(3px);
  animation: popIn .2s ease;
}
.modal {
  width: min(94vw, 460px);
  max-height: 90vh; overflow-y: auto;
  background: linear-gradient(180deg, #ffffff, #f2f7ef);
  border: var(--stroke);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: clamp(16px, 4vw, 26px);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  color: var(--ink);
  animation: popIn .25s ease;
}
.modal h2 { margin: 0; font-size: clamp(20px, 5.5vw, 28px); color: var(--grass-deep); }
.dr-badge {
  font-weight: 800; color: #fff;
  background: linear-gradient(180deg, var(--orange), #ef6f2a);
  border: var(--stroke); border-radius: 999px;
  padding: 6px 16px; font-size: clamp(15px, 4vw, 19px);
}

/* --- Daily reward calendar --- */
.dr-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; width: 100%; }
.dr-day {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px; border-radius: 12px;
  background: #e8eee2; border: 2px solid transparent;
  font-weight: 700;
}
.dr-day-n { font-size: 11px; color: #6a7a63; }
.dr-day-coin { font-size: clamp(12px, 3vw, 15px); }
.dr-day.done { background: #cfe8c2; opacity: .8; }
.dr-day.today {
  background: linear-gradient(180deg, var(--sun), var(--orange));
  border-color: #fff; color: #4a3400;
  transform: scale(1.08);
  box-shadow: 0 4px 10px rgba(255,150,40,.5);
}
.dr-note { margin: 0; font-size: clamp(12px, 3.4vw, 15px); color: #5a6a53; max-width: 30ch; }

/* --- Shared item-grid modal (the `.shop-*` names predate the shop it was built
   for; the Garage and Share modals are what wear them now). --- */
.shop-head { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 10px; }
.shop-coins {
  font-weight: 800; font-size: clamp(16px, 4.4vw, 20px);
  background: #fff6d8; border: 2px solid var(--sun); border-radius: 999px; padding: 4px 12px;
}
.shop-coins.deny { animation: shopDeny .4s ease; }
@keyframes shopDeny { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.shop-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%;
}
.shop-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px; border-radius: 14px;
  background: #eef3ea; border: 2px solid transparent;
}
.shop-item.on { border-color: var(--grass); background: #dff0d2; }
.shop-emoji { font-size: 34px; line-height: 1; }
.shop-name { font-size: 12px; font-weight: 700; color: #4a5a44; }

/* ============================================================
   Garage — taxi-themed override of the shop modal
   ============================================================ */
.garage-backdrop { background: rgba(8, 10, 16, .62); }
.garage-card {
  background:
    radial-gradient(120% 70% at 50% -8%, rgba(255,196,0,.28), transparent 60%),
    linear-gradient(180deg, #262c3c 0%, #171a24 100%);
  border: 4px solid #ffd23f;
  border-radius: 24px;
  color: #e6ecf5;
  box-shadow: 0 0 0 4px rgba(10,12,18,.72), inset 0 0 0 2px rgba(0,0,0,.35), 0 22px 46px rgba(0,0,0,.6);
}
.garage-card .dr-badge {
  background: linear-gradient(180deg, #ffd23f, #f5a800);
  color: #1a1a1a; border: 3px solid #14161f;
  text-shadow: 0 1px 0 rgba(255,255,255,.4);
}
.garage-card .shop-coins {
  color: #ffe08a; background: rgba(0,0,0,.4);
  border: 2px solid #ffd23f;
}
/* Four upgrades as a tidy 2×2 grid of steel tiles. */
.garage-card .shop-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
.garage-card .gar-item {
  background: linear-gradient(180deg, rgba(64,74,92,.95), rgba(38,44,58,.96));
  border: 2px solid rgba(255,255,255,.14);
  border-radius: 16px; padding: 14px 8px; gap: 7px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.1), 0 5px 12px rgba(0,0,0,.38);
}
.garage-card .gar-item.on {
  border-color: #ffd23f;
  background: linear-gradient(180deg, rgba(92,80,34,.7), rgba(40,46,60,.96));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.12), 0 0 14px rgba(255,210,63,.35);
}
.garage-card .shop-emoji { font-size: 42px; filter: drop-shadow(0 2px 5px rgba(0,0,0,.55)); }
.garage-card .shop-name { color: #fff; font-size: 15px; font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.garage-card .gar-desc { color: #b9c3d2; }
.garage-card .gar-pip { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.22); }
.garage-card .gar-pip.on { background: var(--sun); border-color: var(--orange); box-shadow: 0 0 7px var(--sun); }
/* Paid for but dialled down: hollow gold — yours, just not switched on. */
.garage-card .gar-pip.owned { background: rgba(255,210,63,.2); border-color: rgba(255,210,63,.7); }
/* ---- Share modal (Share.js) ------------------------------------------
   Reuses .garage-card above for the taxi theme; only the layout is new. */
.share-card { gap: 14px; }
.share-stats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.share-stats .chip { font-size: clamp(13px, 3.4vw, 16px); padding: 5px 12px; }
.share-btns { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.share-btns .btn { padding: 10px 18px; font-size: clamp(14px, 3.6vw, 17px); }
.share-go { background: linear-gradient(180deg, #ffd23f, #f5a800); color: #1a1a1a; text-shadow: none; }
/* Facebook's brand colour, weighted to sit alongside .share-go rather than under
   it — neither button should read as the "real" one next to the other. */
.share-fb   { background: linear-gradient(180deg, #4a7bd8, #1d4ed8); }

/* The link is always visible and selectable — the last-resort fallback when the
   clipboard is unavailable (no permission / not a secure context). */
.share-link-row { display: flex; gap: 8px; width: 100%; align-items: center; flex-wrap: wrap; }
.share-url {
  flex: 1 1 190px; min-width: 0;
  font-family: inherit; font-size: 12px; font-weight: 600;
  color: #cfd8e6;
  background: rgba(0,0,0,.45);
  border: 2px solid rgba(255,255,255,.22);
  border-radius: 10px;
  padding: 9px 11px;
}
.share-url:focus { outline: none; border-color: #ffd23f; }
.share-copy { flex: 0 0 auto; padding: 9px 14px !important; font-size: 13px !important; }

/* Sits under the menu's stat chips — deliberately quieter than "Aloita peli". */
.menu-share { padding: 8px 18px; font-size: clamp(13px, 3.4vw, 16px); }

.garage-card .btn.secondary {
  background: rgba(255,255,255,.14); color: #fff;
  border: 2px solid rgba(255,255,255,.28); text-shadow: 0 1px 2px rgba(0,0,0,.5);
}

/* Garage upgrade items reuse .shop-item; these add the level pips + description. */
.gar-desc { font-size: clamp(10px, 2.8vw, 12px); font-weight: 700; color: #4a5a44; opacity: .85; text-align: center; }
.gar-pips { display: flex; gap: 4px; justify-content: center; }
.gar-pip {
  width: 11px; height: 11px; border-radius: 50%;
  background: rgba(0,0,0,.16); border: 2px solid rgba(0,0,0,.22);
  transition: background .2s ease, box-shadow .2s ease;
}
.gar-pip.on { background: var(--sun); border-color: var(--orange); box-shadow: 0 0 6px var(--sun); }

/* One-line explainer under the garage header. */
.gar-hint {
  margin: 0;
  font-size: clamp(11px, 2.8vw, 13px);
  font-weight: 600;
  line-height: 1.35;
  color: #aab4c4;
  text-align: center;
  max-width: 44ch;
}

/* ---- Level stepper: [− refund]  TASO n/max  [+ cost] ------------------
   A level is one click away in either direction; the price on each button is
   what that click costs or pays back. */
.gar-steps {
  display: flex; align-items: center; justify-content: space-between;
  gap: 5px; width: 100%; margin-top: 3px;
}
.gar-step {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 46px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  border: 2px solid rgba(0,0,0,.45);
  border-radius: 11px;
  padding: 5px 6px;
  box-shadow: 0 3px 0 rgba(0,0,0,.4);
  transition: transform .08s ease, filter .15s ease;
}
.gar-step:hover:not(:disabled) { filter: brightness(1.1); }
.gar-step:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.4); }
.gar-step:disabled { opacity: .3; cursor: default; box-shadow: none; }
.gar-step-sign { font-size: 17px; line-height: 1; }
.gar-step-cost { font-size: 10px; line-height: 1; white-space: nowrap; opacity: .92; }
.gar-step-max { font-size: 13px; letter-spacing: .5px; padding: 3px 0; }

.gar-buy   { background: linear-gradient(180deg, #ffd23f, #f5a800); color: #1a1a1a; }
.gar-lower { background: linear-gradient(180deg, #6b7488, #464e60); color: #fff; }
/* Restoring a level already paid for: blue, not gold — no coins change hands. */
.gar-buy.gar-free { background: linear-gradient(180deg, #7fd3ff, #3d9be9); color: #06263d; }
/* Priced out for now — still legible, clearly not yet clickable-worthy. */
.gar-buy.gar-poor { filter: grayscale(.65) brightness(.82); }
/* Maxed reads as an achievement, so it keeps full contrast despite being disabled. */
.gar-buy.gar-maxed { background: linear-gradient(180deg, #5fce74, #3f9a3f); color: #fff; }
.gar-buy.gar-maxed:disabled { opacity: 1; box-shadow: 0 3px 0 rgba(0,0,0,.35); }

.gar-lvl { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.gar-lvl-label { font-size: 8px; font-weight: 800; letter-spacing: 1px; color: #8e99ab; }
.gar-lvl-num {
  font-size: 15px; font-weight: 800;
  color: #ffd23f;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}


/* ============================================================
   Lajitteluralli — time-attack drag-to-bin mode
   ============================================================ */
/* Full-screen playfield. Non-interactive itself; only the falling items are,
   so taps on empty space fall through and pointerup can hit-test the bins. */
.rally-field {
  position: absolute;
  inset: 0;
  z-index: 6;                /* above the bin row, so trash falls in front of it */
  pointer-events: none;
  overflow: hidden;
}

/* Falling trash is draggable (overrides .trash's pointer-events: none). */
.rally-item { pointer-events: auto; cursor: grab; touch-action: none; }
.rally-item.dragging { cursor: grabbing; z-index: 40; filter: drop-shadow(0 8px 12px rgba(0,0,0,.5)); }

/* Bin targets pinned along the bottom; height is set from settings in JS. */
.rally-bins {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  display: flex;
  gap: 6px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.18));
}
.rally-bin {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 14px;
  border: var(--stroke);
  background: linear-gradient(180deg, var(--bin-color), rgba(0,0,0,.25));
  box-shadow: var(--shadow-sm);
  color: #fff;
  overflow: hidden;
}
.rally-bin-icon { font-size: clamp(20px, 5vw, 34px); line-height: 1; }
.rally-bin-label {
  font-size: clamp(9px, 2.4vw, 14px);
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rally-bin.hit  { animation: rallyHit .4s ease; }
.rally-bin.miss { animation: rallyMiss .4s ease; }
@keyframes rallyHit  { 0%,100% { transform: translateY(0); filter: brightness(1); } 40% { transform: translateY(-8px) scale(1.05); filter: brightness(1.4); } }
@keyframes rallyMiss { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

/* Timer chip: teal normally, pulsing red in the final seconds. */
.chip--time { background: linear-gradient(180deg, var(--teal), #1fa99c); }
.chip--time.danger {
  background: linear-gradient(180deg, var(--red), #e23a4c);
  animation: pilePulse .5s ease-in-out infinite;
}

/* Combo badge, centred near the top of the field. */
.rally-combo {
  position: absolute;
  left: 50%; top: 14%;
  transform: translateX(-50%) scale(.8);
  z-index: 30;
  padding: 8px 18px;
  border-radius: 999px;
  border: var(--stroke);
  background: linear-gradient(180deg, var(--orange), #ef6f2a);
  color: #fff;
  font-weight: 800;
  font-size: clamp(18px, 5vw, 26px);
  text-shadow: 0 2px 0 rgba(0,0,0,.2);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
}
.rally-combo.show { animation: rallyCombo .6s ease; }
@keyframes rallyCombo {
  0%   { opacity: 0; transform: translateX(-50%) scale(.6); }
  35%  { opacity: 1; transform: translateX(-50%) scale(1.15); }
  100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* End-of-round result chip (bigger than the HUD score chip). */
.rally-over .rally-final {
  font-size: clamp(28px, 8vw, 44px);
  padding: 12px 26px;
  border: var(--stroke);
  box-shadow: var(--shadow);
}

/* Menu launch button. */
.btn-rally { background: linear-gradient(180deg, var(--purple), #7d5fc4) !important; }
.btn-quiz  { background: linear-gradient(180deg, var(--purple), #7d5fc4) !important; }

/* ============================================================
   Final-win celebration (whole week cleared)
   ============================================================ */
.win-pro {
  font-size: clamp(20px, 5.5vw, 32px) !important;
  font-weight: 800;
  color: #fff;
  text-shadow:
    -2px -2px 0 var(--grass-deep), 2px -2px 0 var(--grass-deep),
    -2px  2px 0 var(--grass-deep), 2px  2px 0 var(--grass-deep),
     0 6px 0 rgba(0,0,0,.18);
  animation: winProPulse 1.1s ease-in-out infinite;
}
@keyframes winProPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* Full-screen layer of tumbling trash flying up and off the top. */
.win-storm {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 50;
}
.win-trash {
  position: absolute;
  top: 100%;                       /* start just below the bottom edge */
  width: var(--sz, 48px);
  height: var(--sz, 48px);
  font-size: var(--sz, 48px);      /* coin emoji is sized text */
  line-height: 1;
  text-align: center;
  will-change: transform, opacity;
  filter: drop-shadow(0 4px 5px rgba(0,0,0,.35));
  animation: winFly var(--dur, 3s) linear forwards;
}
.win-trash img { width: 100%; height: 100%; object-fit: contain; }
@keyframes winFly {
  0%   { transform: translate(0, 0) rotate(0); opacity: 0; }
  10%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: translate(var(--drift, 0), var(--rise, -120vh)) rotate(var(--spin, 360deg)); opacity: 0; }
}
