* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0b1220;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}
body { position: fixed; inset: 0; }

#stage {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  max-width: calc(100vh * 0.62);
  max-width: calc(100dvh * 0.62);
  margin: 0 auto;
  overflow: hidden;
  touch-action: manipulation;
  background: #0b1220;
}
#stage.shake { animation: shakeStage 0.25s; }
@keyframes shakeStage {
  0%, 100% { transform: none; }
  25% { transform: translate(-5px, 3px); }
  75% { transform: translate(5px, -3px); }
}
@media (min-width: 700px) {
  #stage { border-radius: 18px; box-shadow: 0 0 60px rgba(0,0,0,0.6); }
}

/* ---------- city background ---------- */
#city { position: absolute; inset: 0; pointer-events: none; }
.sky {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom,
    #131a3a 0%, #2b3a72 22%, #6b4d97 38%, #c05b8c 50%, #ef7960 60%, #ffb25e 68%, #ffd97a 74%);
}
/* soft aurora glow drifting across the upper sky */
.sky::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(50% 32% at 20% 14%, rgba(120,180,255,0.22), transparent 70%),
    radial-gradient(46% 30% at 78% 20%, rgba(236,120,190,0.20), transparent 70%);
  mix-blend-mode: screen;
  animation: aurora 14s ease-in-out infinite;
}
@keyframes aurora {
  0%, 100% { transform: translateX(-4%) translateY(0); opacity: 0.75; }
  50% { transform: translateX(4%) translateY(-2%); opacity: 1; }
}
.stars span {
  position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: #fff; animation: twinkle 2.2s infinite;
}
@keyframes twinkle { 0%, 100% { opacity: 0.9; } 50% { opacity: 0.15; } }

.sun {
  position: absolute; top: 7%; left: 66%;
  width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fffdf3, #ffe08a 55%, #ffc85a);
  animation: sunGlow 3.5s ease-in-out infinite;
}
/* subtle rotating sun rays */
.sun::before {
  content: ''; position: absolute; inset: -22px;
  background: conic-gradient(from 0deg, rgba(255,214,120,0.28) 0 8deg, transparent 8deg 30deg);
  border-radius: 50%;
  animation: sunRays 26s linear infinite;
  opacity: 0.7;
}
@keyframes sunRays { to { transform: rotate(360deg); } }
@keyframes sunGlow {
  0%, 100% { box-shadow: 0 0 44px 20px rgba(255,214,120,0.5); }
  50% { box-shadow: 0 0 74px 34px rgba(255,214,120,0.72); }
}

.cloud {
  position: absolute;
  height: 15px; border-radius: 999px;
  background: rgba(255,255,255,0.35);
  animation: drift 42s linear infinite;
}
.cloud::before, .cloud::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.35);
}
.cloud::before { width: 26px; height: 26px; top: -12px; left: 18%; }
.cloud::after { width: 18px; height: 18px; top: -8px; left: 52%; }
.cloud.c1 { top: 10%; left: 8%; width: 95px; }
.cloud.c2 { top: 17%; left: 48%; width: 65px; animation-duration: 56s; }
@keyframes drift {
  from { transform: translateX(0); }
  50%  { transform: translateX(70px); }
  to   { transform: translateX(0); }
}

.skyline {
  position: absolute; left: 0; right: 0; top: 24%; height: 20%;
  display: flex; align-items: flex-end; gap: 3px; padding: 0 4px;
}
.skyline div {
  flex: 1;
  position: relative;
  background: linear-gradient(#2a3a66, #1d2a4d);
  border-radius: 3px 3px 0 0;
}
/* traditional pitched roofs on some distant buildings — kampung townscape */
.skyline div:nth-child(2)::before,
.skyline div:nth-child(6)::before,
.skyline div:nth-child(9)::before {
  content: ''; position: absolute; left: -2px; right: -2px; top: -7px; height: 8px;
  background: #223052;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}

/* Monas — landmark silhouette */
.monas {
  position: absolute; left: 48.5%; top: 27.5%;
  width: 9px; height: 15%;
  background: linear-gradient(#f1f5f9, #cbd5e1);
  transform: translateX(-50%);
}
.monas::before {
  content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 30px; height: 12px;
  background: #dbe3ee;
  border-radius: 3px 3px 0 0;
}
.monas::after {
  content: ''; position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(#ffe589, #f5a623);
  box-shadow: 0 0 12px 4px rgba(255,200,80,0.8);
}

/* Masjid — mosque silhouette in the distant skyline */
.mosque {
  position: absolute; left: 30%; top: 33%;
  width: 24px; height: 11%;
  transform: translateX(-50%);
  background: linear-gradient(#2a3a66, #1d2a4d);
  border-radius: 3px 3px 0 0;
}
.mosque .dome {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  width: 22px; height: 15px;
  background: linear-gradient(#33477e, #24325a);
  border-radius: 50% 50% 12% 12% / 78% 78% 22% 22%;
}
.mosque .dome::after { /* gold finial */
  content: ''; position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  width: 2px; height: 8px; background: #f5c542;
  box-shadow: 0 0 5px rgba(245,197,66,0.75);
}
.mosque .minaret {
  position: absolute; top: -20px; right: -7px;
  width: 5px; height: 30px;
  background: linear-gradient(#33477e, #24325a);
  border-radius: 3px 3px 0 0;
}
.mosque .minaret::after { /* small onion crown */
  content: ''; position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  width: 9px; height: 10px;
  background: #33477e;
  border-radius: 50% 50% 20% 20% / 75% 75% 25% 25%;
}

.row-buildings {
  position: absolute; left: 0; right: 0; top: 36%; height: 20%;
  display: flex; align-items: flex-end; gap: 6px; padding: 0 8px;
}
.bld {
  flex: 1;
  position: relative;
  border-radius: 5px 5px 0 0;
  border-top: 4px solid rgba(0,0,0,0.18);
  background-image:
    linear-gradient(transparent 55%, rgba(0,0,0,0.28)),
    radial-gradient(rgba(255,240,180,0.92) 30%, transparent 34%);
  background-size: auto, 13px 17px;
  background-position: 0 0, 4px 8px;
}
.bld::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.95) 30%, transparent 34%);
  background-size: 13px 17px;
  background-position: 4px 8px;
  opacity: 0;
  animation: windowGlow 3.4s infinite;
}
.bld.b2::after { animation-delay: 1.1s; }
.bld.b4::after { animation-delay: 2.3s; }
.bld.b5::after { animation-delay: 0.6s; }
@keyframes windowGlow { 0%, 100% { opacity: 0; } 50% { opacity: 0.5; } }

.bld.b1 { height: 92%;  background-color: #8b5cf6; }
.bld.b2 { height: 70%;  background-color: #e05d6f; }
.bld.b3 { height: 100%; background-color: #4f83e0; }
.bld.b4 { height: 62%;  background-color: #e8a04c; }
.bld.b5 { height: 84%;  background-color: #4fae84; }

.door {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 15px; height: 20px;
  background: rgba(10,14,26,0.5);
  border-radius: 7px 7px 0 0;
}
.ant {
  position: absolute; top: -20px; left: 28%;
  width: 2px; height: 18px; background: #cbd5e1;
}
.ant::after {
  content: ''; position: absolute; top: -4px; left: -2px;
  width: 6px; height: 6px; border-radius: 50%;
  background: #ef4444;
  animation: blink 1.4s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.15; } }
.tank {
  position: absolute; top: -14px; right: 12%;
  width: 17px; height: 12px;
  background: linear-gradient(#aab6c8, #7e8ba0);
  border-radius: 4px;
}
.flagpole {
  position: absolute; top: -24px; left: 50%; width: 2px; height: 24px;
  background: #e2e8f0;
}
.flagpole::after {
  content: ''; position: absolute; top: 0; left: 2px;
  width: 16px; height: 11px;
  background: linear-gradient(#e11d48 50%, #ffffff 50%);
}
.sign {
  position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  background: #fef08a; color: #713f12;
  font-size: 7px; font-weight: 800; letter-spacing: 0.04em;
  padding: 2px 5px; border-radius: 3px; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.awning {
  position: absolute; top: 24px; left: 8%; right: 8%; height: 9px;
  background: repeating-linear-gradient(90deg, #e11d48 0 9px, #fff 9px 18px);
  border-radius: 0 0 5px 5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

/* genteng — terracotta tiled pitched roof for the shophouses */
.roof {
  position: absolute; top: -13px; left: -8%; right: -8%; height: 15px;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.14) 0 1px, transparent 1px 6px),
    linear-gradient(#cd6f4d, #a24630);
  clip-path: polygon(6% 100%, 22% 0, 78% 0, 94% 100%);
}
.roof::after { /* ridge cap */
  content: ''; position: absolute; top: 0; left: 22%; right: 22%; height: 3px;
  background: #8a3623; border-radius: 2px;
}

.park {
  position: absolute; left: 0; right: 0; top: 56%; height: 14%;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.06) 0 16px, rgba(0,0,0,0.06) 16px 32px),
    repeating-linear-gradient(80deg, rgba(0,0,0,0.05) 0 3px, transparent 3px 7px),
    linear-gradient(#6fae5f 0%, #52894b 50%, #3e663e 100%);
}
/* soft grass-blade fringe along the front edge of the lawn */
.park::before {
  content: ''; position: absolute; left: 0; right: 0; top: -6px; height: 7px;
  background: #6fae5f;
  clip-path: polygon(
    0 100%, 3% 0, 6% 100%, 9% 0, 12% 100%, 15% 0, 18% 100%, 21% 0,
    24% 100%, 27% 0, 30% 100%, 33% 0, 36% 100%, 39% 0, 42% 100%, 45% 0,
    48% 100%, 51% 0, 54% 100%, 57% 0, 60% 100%, 63% 0, 66% 100%, 69% 0,
    72% 100%, 75% 0, 78% 100%, 81% 0, 84% 100%, 87% 0, 90% 100%, 93% 0,
    96% 100%, 100% 0, 100% 100%
  );
}
.park .t { position: absolute; bottom: 10%; font-size: 27px; }
.park .f { position: absolute; bottom: 4%; font-size: 13px; }

.road {
  position: absolute; left: 0; right: 0; top: 70%; height: 18%;
  background: linear-gradient(#33383f, #26292f);
}
.road::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 4px;
  background-image: repeating-linear-gradient(90deg, #fbbf24 0 24px, transparent 24px 48px);
}
.zebra {
  position: absolute; right: 8%; top: 0; bottom: 0; width: 58px;
  background: repeating-linear-gradient(180deg, rgba(226,232,240,0.85) 0 9px, transparent 9px 20px);
}
.ride {
  position: absolute; transform: scaleX(-1);
  line-height: 1;
  animation: ride linear infinite;
  filter: drop-shadow(0 4px 5px rgba(0,0,0,0.45));
}
/* r1 = auto/bajaj — the larger vehicle, in the near lane */
.ride.r1 {
  bottom: 4%; left: -20%;
  font-size: 50px;
  font-size: clamp(48px, 6.8dvh, 66px);
  animation-duration: 8s;
}
/* r2 = scooter — smaller vehicle, farther lane */
.ride.r2 {
  bottom: 52%; left: -20%;
  font-size: 42px;
  font-size: clamp(38px, 5.2dvh, 52px);
  animation-duration: 12s; animation-delay: 3.5s;
}
@keyframes ride { to { left: 115%; } }

.sidewalk {
  position: absolute; left: 0; right: 0; top: 88%; bottom: 0;
  background: #8a94a6;
  background-image: repeating-linear-gradient(90deg, transparent 0 34px, rgba(0,0,0,0.15) 34px 36px);
}

#vignette {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  box-shadow: inset 0 0 90px rgba(0,0,0,0.4);
}

/* ---------- HUD ---------- */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 8px;
  z-index: 5;
}
.hud-chip {
  background: rgba(11,18,32,0.6);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  padding: 7px 12px;
  border-radius: 999px;
  min-width: 76px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
/* narrow stage (landscape letterbox): let chips shrink to content */
@media (orientation: landscape) {
  .hud-chip { min-width: 0; padding: 6px 9px; font-size: 13px; }
  .hud-score { font-size: 19px; padding: 7px 16px; }
}
.hud-score {
  background: linear-gradient(135deg, #f43f5e, #be123c);
  color: #fff;
  font-weight: 900;
  font-size: 23px;
  padding: 8px 24px;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(225,29,72,0.55), inset 0 1px 0 rgba(255,255,255,0.25);
}
.hud-score.bump { animation: bump 0.18s; }
@keyframes bump { 50% { transform: scale(1.2); } }

#combo {
  position: absolute; top: 15%; left: 50%; transform: translateX(-50%);
  font-size: 30px; font-weight: 900;
  background: linear-gradient(180deg, #fde047, #f59e0b);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.65));
  z-index: 5; pointer-events: none; opacity: 0;
}
#combo.show { animation: comboPop 0.9s ease-out; }
@keyframes comboPop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.4); }
  20% { opacity: 1; transform: translateX(-50%) scale(1.3); }
  70% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1); }
}

/* ---------- rank-up toast ---------- */
.rankup {
  position: absolute; top: 23%; left: 50%;
  z-index: 7;
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  color: #451a03;
  font-weight: 900; font-size: 14px;
  padding: 9px 16px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(245,158,11,0.55), inset 0 1px 0 rgba(255,255,255,0.45);
  animation: rankupPop 1.8s ease-out forwards;
}
.rankup span { font-size: 20px; }
@keyframes rankupPop {
  0%   { opacity: 0; transform: translate(-50%, 12px) scale(0.8); }
  12%  { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
  22%  { transform: translate(-50%, 0) scale(1); }
  80%  { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -16px) scale(1); }
}

/* ---------- bubbles (hazards) ---------- */
#play { position: absolute; inset: 0; z-index: 4; }

.bubble {
  position: absolute;
  width: 76px; height: 76px;
  margin: -38px 0 0 -38px;
  border: 3px solid #e11d48;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ffffff, #ffe3e3 62%, #ffb9b9);
  display: flex; align-items: center; justify-content: center;
  font-size: 37px;
  box-shadow: 0 0 22px rgba(225,29,72,0.55), 0 8px 18px rgba(0,0,0,0.45), inset 0 -6px 12px rgba(225,29,72,0.25);
  cursor: pointer;
  animation: pop 0.22s ease-out, bubbleBob 2.6s ease-in-out 0.22s infinite;
  padding: 0;
}
@keyframes bubbleBob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.03); }
}
.bubble::after {
  content: ''; position: absolute; top: 9px; left: 15px;
  width: 20px; height: 11px; border-radius: 50%;
  background: rgba(255,255,255,0.85);
  transform: rotate(-24deg);
}
.bubble .ring {
  position: absolute; inset: -8px;
  border: 3px solid rgba(225,29,72,0.65);
  border-radius: 50%;
  animation: ring 1s ease-out infinite;
}
.bubble.urgent { border-color: #f59e0b; animation: shake 0.28s infinite; box-shadow: 0 0 26px rgba(245,158,11,0.8), 0 8px 18px rgba(0,0,0,0.45); }
.bubble.urgent .ring { border-color: rgba(245,158,11,0.85); animation-duration: 0.5s; }
.bubble .hand {
  position: absolute; bottom: -42px; left: 50%; transform: translateX(-50%);
  font-size: 34px;
  animation: handBounce 0.7s ease-in-out infinite;
  pointer-events: none;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.55));
}
.bubble .hand::after {
  content: 'Ketuk!';
  position: absolute; top: 36px; left: 50%; transform: translateX(-50%);
  font-size: 14px; font-weight: 900; color: #fff;
  text-shadow: 0 1px 5px rgba(0,0,0,0.9);
}
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes ring {
  0% { transform: scale(0.75); opacity: 1; }
  100% { transform: scale(1.55); opacity: 0; }
}
@keyframes shake {
  0%, 100% { transform: rotate(-7deg); }
  50% { transform: rotate(7deg); }
}
@keyframes handBounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -11px); }
}

.float {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 23px; font-weight: 900; color: #4ade80;
  text-shadow: 0 2px 7px rgba(0,0,0,0.75);
  pointer-events: none; z-index: 6;
  animation: floatUp 0.9s ease-out forwards;
  white-space: nowrap; text-align: center;
}
.float small { display: block; font-size: 13px; color: #fff; }
.float.bad { color: #f87171; font-size: 17px; }
@keyframes floatUp {
  0% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -110%) translateY(-32px); }
}

.p {
  position: absolute; width: 9px; height: 9px; border-radius: 50%;
  pointer-events: none; z-index: 6;
}
.cf {
  position: absolute; top: 0; width: 8px; height: 13px;
  border-radius: 2px; z-index: 11; pointer-events: none;
}

/* ---------- overlays ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7,11,22,0.84);
  padding: 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.overlay.hidden { display: none; }
#lb { z-index: 12; }

.card {
  position: relative;
  margin: auto; /* keeps tall cards scrollable instead of clipped at top */
  width: 100%; max-width: 335px;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(245,158,11,0.16), transparent 55%),
    linear-gradient(#1c2848, #131c33);
  border: 1px solid #3a4d7d;
  border-radius: 22px;
  padding: 26px 22px;
  text-align: center;
  color: #e6ebf5;
  animation: cardIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), cardGlow 5s ease-in-out infinite;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow: hidden; /* clip the batik ribbon to the card's rounded corners */
}
/* batik (parang-style) ribbon accent along the top of every card */
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 9px;
  border-radius: 22px 22px 0 0;
  background:
    repeating-linear-gradient(45deg,
      transparent 0 4px,
      #d97706 4px 8px,
      #fbbf24 8px 11px,
      transparent 11px 15px),
    linear-gradient(90deg, #be123c, #f59e0b, #be123c);
  box-shadow: 0 1px 6px rgba(245,158,11,0.4);
}
@keyframes cardGlow {
  0%, 100% {
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08),
                0 0 26px rgba(245,158,11,0.28), 0 0 46px rgba(139,92,246,0.16);
  }
  50% {
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08),
                0 0 34px rgba(244,63,94,0.34), 0 0 60px rgba(139,92,246,0.28);
  }
}
@keyframes cardIn {
  0% { opacity: 0; transform: translateY(18px) scale(0.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.card .big {
  font-size: 56px; line-height: 1.1;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.45));
  animation: floatBig 3.4s ease-in-out infinite;
}
@keyframes floatBig {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}
.card h1 { font-size: 25px; font-weight: 900; margin: 8px 0 6px; letter-spacing: 0.03em; }
.card h1.gold {
  background: linear-gradient(110deg, #f59e0b 0%, #fde68a 30%, #fffdf5 45%, #fde68a 60%, #f59e0b 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: goldShimmer 3.6s linear infinite;
  filter: drop-shadow(0 2px 10px rgba(245,158,11,0.45));
}
@keyframes goldShimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}
.card p { font-size: 14px; color: #aab6d4; margin-bottom: 16px; line-height: 1.45; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps div {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid #2c3b5e;
  border-radius: 12px;
  padding: 10px 4px;
  font-size: 11px; font-weight: 700; color: #cbd5e1;
}
.steps div span { display: block; font-size: 23px; margin-bottom: 4px; }
.btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  background: linear-gradient(135deg, #fb7185, #f43f5e 45%, #be123c);
  color: #fff; border: none;
  font-size: 18px; font-weight: 900;
  padding: 15px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 5px 0 #881337, 0 8px 20px rgba(225,29,72,0.35), inset 0 1px 0 rgba(255,255,255,0.35);
  font-family: inherit;
  animation: btnPulse 2.4s ease-in-out infinite;
}
/* diagonal shine that sweeps across the button */
.btn::after {
  content: ''; position: absolute; top: 0; left: -60%;
  width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.55), transparent);
  transform: skewX(-20deg);
  animation: btnShine 2.8s ease-in-out infinite;
}
@keyframes btnShine {
  0% { left: -60%; }
  55%, 100% { left: 130%; }
}
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 5px 0 #881337, 0 8px 20px rgba(225,29,72,0.35), inset 0 1px 0 rgba(255,255,255,0.35); }
  50% { box-shadow: 0 5px 0 #881337, 0 8px 28px rgba(244,63,94,0.6), inset 0 1px 0 rgba(255,255,255,0.35); }
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #881337; animation: none; }
/* ghost + leaderboard buttons stay calm — no pulse/shine */
.btn.ghost { animation: none; }
.btn.ghost::after { display: none; }
.btn.ghost {
  background: transparent;
  border: 2px solid #3a4d7d;
  color: #cbd5e1;
  box-shadow: none;
  font-size: 15px;
  padding: 12px;
  margin-top: 10px;
}
.btn.ghost:active { transform: none; background: rgba(255,255,255,0.05); }
.intro-best { font-size: 12px; color: #7c8db5; margin-top: 12px; }

.close {
  position: absolute; top: 10px; right: 14px;
  background: none; border: none;
  color: #94a3b8; font-size: 22px; font-weight: 700;
  cursor: pointer; padding: 4px 8px;
  font-family: inherit;
}

/* end card */
#end-rank-icon { font-size: 62px; display: inline-block; animation: rankPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); filter: drop-shadow(0 4px 12px rgba(251,191,36,0.45)); }
@keyframes rankPop { from { transform: scale(0) rotate(-20deg); } to { transform: scale(1) rotate(0); } }
#end-rank-title { font-size: 22px; font-weight: 900; color: #fbbf24; margin-bottom: 2px; }
.end-score { font-size: 15px; color: #aab6d4; margin: 6px 0 4px; }
.end-score b { color: #fff; font-size: 28px; display: block; }
#end-pos { font-size: 13px; font-weight: 800; color: #7dd3fc; margin-bottom: 14px; }
#end-record {
  display: inline-block;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #451a03;
  font-size: 12px; font-weight: 900;
  padding: 4px 12px; border-radius: 999px;
  margin-bottom: 8px;
  animation: bump 0.4s;
}

/* prize banner */
.prize-banner {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  color: #451a03;
  font-size: 12.5px; font-weight: 900;
  padding: 8px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
  box-shadow: 0 3px 12px rgba(245,158,11,0.35);
  animation: prizeGlow 2.2s ease-in-out infinite;
}
@keyframes prizeGlow {
  0%, 100% { box-shadow: 0 3px 12px rgba(245,158,11,0.35); }
  50% { box-shadow: 0 3px 22px rgba(245,158,11,0.7); }
}

/* coming-soon store badges */
.store-badges {
  display: flex; gap: 8px;
  margin-top: 14px;
}
.store-badge {
  position: relative;
  overflow: hidden;
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(160deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03));
  border: 1px solid rgba(148,163,184,0.28);
  border-radius: 12px;
  padding: 9px 6px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.08);
}
/* slow shine sweep across the badges */
.store-badge::after {
  content: ''; position: absolute; top: 0; left: -70%;
  width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.22), transparent);
  transform: skewX(-20deg);
  animation: badgeShine 4.5s ease-in-out infinite;
}
.store-badge:last-child::after { animation-delay: 0.9s; }
@keyframes badgeShine {
  0% { left: -70%; }
  45%, 100% { left: 150%; }
}
.store-badge svg { width: 22px; height: 22px; flex: none; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.45)); }
.store-badge-text { text-align: left; line-height: 1.2; }
.store-badge-text small {
  display: block;
  font-size: 8px; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: #ffd08a;
}
.store-badge-text b { font-size: 13px; font-weight: 800; color: #f1f5f9; }

/* leaderboard */
.lb-sub { margin-top: -2px; }
#lb-list {
  max-height: 42vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(124,141,181,0.45) transparent;
  padding-right: 2px;
}
#lb-list::-webkit-scrollbar { width: 4px; }
#lb-list::-webkit-scrollbar-track { background: transparent; }
#lb-list::-webkit-scrollbar-thumb {
  background: rgba(124,141,181,0.45);
  border-radius: 999px;
}
.lb-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid #2c3b5e;
  border-radius: 12px;
  padding: 8px 12px;
  text-align: left;
}
.lb-row.you {
  border-color: #fbbf24;
  background: rgba(251,191,36,0.1);
}
.lb-medal { font-size: 18px; width: 30px; text-align: center; font-weight: 900; color: #7c8db5; }
.lb-who { flex: 1; min-width: 0; }
.lb-who b { display: block; font-size: 14px; }
.lb-who small { font-size: 11px; color: #8fa0c5; }
.lb-pts { font-weight: 900; font-size: 15px; color: #fbbf24; }

/* compact layout for short screens (iPhone SE, 360x640 Androids) */
@media (max-height: 650px) {
  .overlay { padding: 14px; }
  .card { padding: 16px 16px; border-radius: 16px; }
  .card::before { border-radius: 16px 16px 0 0; height: 7px; }
  .card .big { font-size: 40px; }
  .card h1 { font-size: 20px; margin: 5px 0 4px; }
  .card p { font-size: 12.5px; margin-bottom: 10px; }
  .steps { margin-bottom: 10px; }
  .steps div { padding: 7px 3px; font-size: 10px; }
  .steps div span { font-size: 18px; margin-bottom: 2px; }
  .prize-banner { font-size: 11px; padding: 6px 10px; margin-bottom: 10px; }
  .btn { font-size: 16px; padding: 11px; }
  .btn.ghost { font-size: 13px; padding: 9px; margin-top: 7px; }
  .store-badges { margin-top: 8px; gap: 6px; }
  .store-badge { padding: 6px 4px; border-radius: 10px; }
  .store-badge svg { width: 16px; height: 16px; }
  .store-badge-text b { font-size: 11.5px; }
  #end-rank-icon { font-size: 46px; }
  .end-score b { font-size: 22px; }
  #lb-list { max-height: 32vh; }
  .bubble { width: 64px; height: 64px; margin: -32px 0 0 -32px; font-size: 30px; }
}

/* respect reduced-motion: keep the game readable, drop decorative loops */
@media (prefers-reduced-motion: reduce) {
  .card h1.gold, .card .big, .btn, .btn::after, .store-badge::after,
  .sky::after, .sun::before, .prize-banner,
  .cloud, .stars span, .bubble { animation: none !important; }
  .btn { animation: none !important; }
  .bubble { animation: pop 0.22s ease-out !important; }
}
