@font-face { font-family: 'Luckiest Guy'; src: url(/fonts/luckiest-guy-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Rubik'; font-weight: 400; src: url(/fonts/rubik-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Rubik'; font-weight: 600; src: url(/fonts/rubik-latin-600-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Rubik'; font-weight: 800; src: url(/fonts/rubik-latin-800-normal.woff2) format('woff2'); font-display: swap; }

/* ---------- house style (from Box Battle), Car Park Chaos palette ---------- */
:root {
  --bg: #e9edf0; --paper: #fffdf8; --ink: #24303a; --muted: #6b7783; --line: #cbd3d9;
  --aqua: #2f7fe0; --aqua-dark: #1c56a3; --orange: #ff7a1a; --orange-dark: #b34c05;
  --green: #23b67f; --red: #e8483f; --yellow: #ffd23f; --tarmac: #57626d; --tarmac-dark: #454f59;
  --display: 'Luckiest Guy', 'Arial Black', Impact, sans-serif;
  --body: 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); font: 16px/1.45 var(--body); overscroll-behavior: none; background: var(--bg);
  background-image: linear-gradient(rgba(36, 48, 58, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(36, 48, 58, .05) 1px, transparent 1px); background-size: 26px 26px;
}
#app { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px)); }
.screen { width: min(540px, 100%); display: flex; flex-direction: column; gap: 12px; flex: 1; min-width: 0; max-width: 100%; }
.screen > *, .card > * { min-width: 0; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
img { -webkit-user-drag: none; user-select: none; }
p { margin: 0; } .muted { color: var(--muted); } .center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.bar { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.bar .sp { flex: 1; }
.logo { font: 22px/1 var(--display); color: var(--aqua-dark); letter-spacing: .4px; padding-top: 4px; text-decoration: none; white-space: nowrap; }
.logo span { color: var(--orange); }
.chip { border: 2px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: var(--paper); font-size: 18px; font-weight: 800; display: grid; place-items: center; flex: none; }

.card { background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; padding: 16px; box-shadow: 0 6px 0 rgba(36, 48, 58, .2); }
h1 { font: 40px/1 var(--display); margin: 2px 0 0; text-align: center; letter-spacing: .5px; }
h1 em { font-style: normal; color: var(--orange); }
h2 { font: 26px/1.08 var(--display); margin: 0; letter-spacing: .3px; }
.btn { border: 3px solid var(--ink); border-radius: 16px; padding: 14px 18px 10px; font: 22px/1 var(--display); letter-spacing: .5px; background: var(--paper); box-shadow: 0 5px 0 var(--ink); transition: transform .08s, box-shadow .08s; width: 100%; min-height: 48px; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn.blue { background: var(--aqua); color: #fff; } .btn.orange { background: var(--orange); color: #fff; } .btn.yellow { background: var(--yellow); }
.btn.small { font-size: 17px; padding: 10px 12px 7px; min-height: 44px; }
.btn.big { font-size: 28px; padding: 18px 18px 13px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.hero { width: min(100%, 420px); aspect-ratio: 16 / 9; object-fit: cover; border-radius: 20px; border: 3px solid var(--ink); margin: 0 auto; display: block; box-shadow: 0 6px 0 rgba(36, 48, 58, .2); }
.banner { font: 34px/1.05 var(--display); text-align: center; color: var(--aqua-dark); padding-top: 6px; }
.prize { width: 130px; height: 130px; object-fit: contain; margin: 0 auto; display: block; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: #fff; font-weight: 600; padding: 10px 16px; border-radius: 999px; z-index: 9; max-width: calc(100vw - 28px); text-align: center; }
dialog { border: 3px solid var(--ink); border-radius: 22px; background: var(--paper); color: var(--ink); padding: 22px 20px 18px; width: min(460px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(36, 48, 58, .55); }
dialog ol { margin: 8px 0 14px; padding-left: 22px; } dialog li { margin: 4px 0; }
dialog .btn + .btn { margin-top: 12px; }
dialog p { margin: 8px 0 14px; }

/* ---------- shared by the long-break games: record, level list, stars, account line ---------- */
.today { display: flex; align-items: center; gap: 12px; }
.today .mascot { width: 84px; height: 84px; object-fit: contain; flex: none; }
.stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.stat { background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 6px 8px 5px; text-align: center; min-width: 0; }
.stat small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.stat b { font: 22px/1.1 var(--display); letter-spacing: .3px; display: block; padding-top: 3px; white-space: nowrap; }
.acct { text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); min-height: 21px; }
.acct a { color: var(--aqua-dark); }
.tip { background: #fff7d1; border: 2px dashed var(--ink); border-radius: 14px; padding: 8px 12px; font-weight: 600; font-size: 14.5px; }
.goal { text-align: center; font-weight: 800; }
.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.lv { border: 3px solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); padding: 8px 2px 5px; min-height: 58px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.lv b { font: 20px/1 var(--display); padding-top: 3px; }
.lv .st { font-size: 12px; letter-spacing: 1px; line-height: 1; color: #c9c2b0; }
.lv .st i { font-style: normal; color: #f2a900; }
.lv.next { background: var(--yellow); }
.lv[disabled] { opacity: .45; box-shadow: none; pointer-events: none; }
.bigstars { display: flex; justify-content: center; gap: 8px; }
.bigstars .s { width: 64px; height: 64px; display: grid; place-items: center; font-size: 56px; line-height: 1; color: #f2a900; }
.bigstars .s img { width: 100%; height: 100%; object-fit: contain; }
.bigstars .s.off { color: #c9c2b0; } .bigstars .s.off img { filter: grayscale(1) opacity(.3); }
.bigstars .s.on { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1) backwards; }
.bigstars .s.on:nth-child(2) { animation-delay: .15s; } .bigstars .s.on:nth-child(3) { animation-delay: .3s; }
@keyframes pop { 0% { transform: scale(.3) rotate(-20deg); opacity: 0; } }

/* ---------- the car park ---------- */
.cones { display: inline-flex; gap: 3px; justify-content: center; align-items: flex-end; height: 24px; }
.cone { width: 15px; height: 20px; background: linear-gradient(var(--orange) 0 30%, #fff 30% 48%, var(--orange) 48%); clip-path: polygon(50% 0, 84% 78%, 100% 78%, 100% 100%, 0 100%, 0 78%, 16% 78%); }
.cone.used { background: #c5ccd2; }
.lot { position: relative; width: 100%; max-width: max(250px, calc((100dvh - 340px) * var(--w) / var(--h))); margin: 0 auto; background: var(--tarmac-dark); border: 3px solid var(--ink); border-radius: 18px; padding: 9px; box-shadow: 0 6px 0 rgba(36, 48, 58, .2); }
.lot .deco { position: absolute; right: -8px; top: -22px; width: 74px; height: 38px; object-fit: contain; z-index: 3; pointer-events: none; }
.grid {
  position: relative; width: 100%; aspect-ratio: var(--w) / var(--h); overflow: hidden; border-radius: 8px; background-color: var(--tarmac);
  background-image: linear-gradient(rgba(255, 255, 255, .17) 2px, transparent 2px), linear-gradient(90deg, rgba(255, 255, 255, .17) 2px, transparent 2px);
  background-size: calc(100% / var(--w)) calc(100% / var(--h)); touch-action: manipulation; user-select: none;
}
.sq { position: absolute; width: calc(100% / var(--w)); height: calc(100% / var(--h)); pointer-events: none; }
.paint { display: grid; place-items: center; }
.paint svg { width: 74%; height: 74%; transform: rotate(var(--rot)); }
.paint.hit svg { animation: flash .5s; }
.gate { display: grid; place-items: center; border-radius: 8px; background: repeating-linear-gradient(135deg, var(--red) 0 8px, #fff 8px 16px); border: 2px solid var(--ink); transition: opacity .3s, transform .3s; }
.gate.pic { background: rgba(0, 0, 0, .28); border: 2px dashed rgba(255, 255, 255, .5); }
.gate img { position: absolute; left: 3%; top: 5%; width: 94%; height: 54%; object-fit: contain; }
.gate b { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%); font: 800 10px/1 var(--body); background: var(--ink); color: #fff; border-radius: 6px; padding: 3px 4px; }
.gate.open { opacity: .28; transform: rotate(-12deg) scale(.86); }
.gate.hit { outline: 3px solid var(--yellow); }
.crossing { position: absolute; left: 0; width: 100%; height: calc(100% / var(--h)); pointer-events: none; overflow: hidden;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .82) 0 14px, transparent 14px 28px); }
.crossing b { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 800 11px/1 var(--body); letter-spacing: 1px; padding: 3px 7px; border-radius: 999px; background: var(--green); color: #fff; border: 2px solid var(--ink); }
.crossing.busy { background: repeating-linear-gradient(90deg, #ffd9d6 0 14px, rgba(232, 72, 63, .55) 14px 28px); }
.crossing.busy b { background: var(--red); }
.crossing.hit { outline: 3px solid var(--yellow); outline-offset: -3px; }
.walker { position: absolute; top: 12%; width: 16%; height: 76%; display: none; animation: walk 5s linear infinite; }
.walker::before { content: ''; position: absolute; left: 50%; top: 0; width: 32%; aspect-ratio: 1; margin-left: -16%; border-radius: 50%; background: #ffcf9e; border: 2px solid var(--ink); }
.walker::after { content: ''; position: absolute; left: 50%; bottom: 0; width: 40%; height: 58%; margin-left: -20%; border-radius: 40% 40% 20% 20%; background: var(--aqua); border: 2px solid var(--ink); }
.walker:nth-child(2) { left: 8%; } .walker:nth-child(3) { left: 62%; animation-direction: reverse; } .walker:nth-child(3)::after { background: var(--yellow); }
.walker:nth-child(4) { left: 82%; } .walker:nth-child(4)::after { background: var(--green); }
.crossing.busy .walker { display: block; }
@keyframes walk { 0%, 100% { transform: translateX(-30%); } 50% { transform: translateX(30%); } }

.veh { position: absolute; z-index: 1; }
.veh .art { position: absolute; left: 50%; top: 50%; width: var(--aw); height: var(--ah); transform: translate(-50%, -50%) rotate(var(--rot)); pointer-events: none; }
.veh .body { position: absolute; inset: 4% 10%; border-radius: 30% / 14%; background: var(--col, #999); border: 2px solid var(--ink); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .15); }
.veh .body::before { content: ''; position: absolute; left: 12%; right: 12%; top: 16%; height: 15%; border-radius: 30% 30% 12% 12%; background: #cfe9f7; border: 2px solid var(--ink); }
.veh .body::after { content: ''; position: absolute; left: 6%; right: 6%; top: 2%; height: 5%; background: radial-gradient(circle at 12% 50%, #fff3a8 0 28%, transparent 30%), radial-gradient(circle at 88% 50%, #fff3a8 0 28%, transparent 30%); }
.veh img.pic { position: absolute; left: 3%; top: 1.5%; width: 94%; height: 97%; object-fit: fill; }
.veh.pic .body { display: none; }
.veh .nose, .veh .tail { position: absolute; left: 50%; width: 30%; aspect-ratio: 1.15; margin-left: -15%; background: #fff; clip-path: polygon(50% 0, 100% 100%, 50% 72%, 0 100%); filter: drop-shadow(0 0 1.5px #000) drop-shadow(0 0 1.5px #000); }
.veh .nose { top: calc(11% / var(--len) * 2); }
.veh .tail { bottom: calc(11% / var(--len) * 2); transform: rotate(180deg); background: var(--yellow); }
.veh.both .nose, .veh.both .tail { background: var(--yellow); width: 42%; margin-left: -21%; }
.veh .tap { position: absolute; inset: 0; background: none; border: 0; padding: 0; border-radius: 10px; z-index: 2; }
.veh.d0 .tap.fwd, .veh.d2 .tap.rev { inset: 0 0 50% 0; } .veh.d2 .tap.fwd, .veh.d0 .tap.rev { inset: 50% 0 0 0; }
.veh.d1 .tap.fwd, .veh.d3 .tap.rev { inset: 0 0 0 50%; } .veh.d3 .tap.fwd, .veh.d1 .tap.rev { inset: 0 50% 0 0; }
.veh .tap:focus-visible { outline-offset: -3px; }
.veh .keytag { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 800 10px/1 var(--body); background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 5px 2px; pointer-events: none; z-index: 1; }
.veh.leaving { z-index: 0; } .veh.leaving .tap { pointer-events: none; }
.veh.hit .art, .veh.bumped .art { filter: drop-shadow(0 0 5px var(--yellow)) drop-shadow(0 0 2px var(--yellow)); }
.veh.hintme .art { animation: beacon .5s 4 alternate; filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 3px var(--yellow)); }
.veh.hintme { z-index: 2; }
@keyframes beacon { to { transform: translate(-50%, -50%) rotate(var(--rot)) scale(1.12); } }
@keyframes flash { 50% { filter: drop-shadow(0 0 5px var(--yellow)); transform: rotate(var(--rot)) scale(1.3); } }
.c-car-red { --col: #e8483f; } .c-car-blue { --col: #2f7fe0; } .c-car-yellow { --col: #ffd23f; } .c-car-green { --col: #23b67f; }
.c-car-purple { --col: #8b5cf6; } .c-car-orange { --col: #ff7a1a; } .c-van-white { --col: #f4f4f0; } .c-bus-teal { --col: #19a7a0; }

@media (max-height: 700px) { h1 { font-size: 32px; } .hero { width: min(100%, 300px); } }
@media (prefers-reduced-motion: reduce) {
  .bigstars .s.on, .walker, .veh.hintme .art, .paint.hit svg { animation: none; }
  .gate { transition: none; }
}
