@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), Bubble Wrap palette ---------- */
:root {
  --bg: #e6f4fb; --paper: #fffdf8; --ink: #1d3147; --muted: #5f7890; --line: #bfdcec;
  --aqua: #19a9d8; --aqua-dark: #0b6f95; --orange: #ff5d8f; --orange-dark: #b3285a;
  --green: #23b67f; --red: #e8483f; --yellow: #ffd23f;
  --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: radial-gradient(circle at 13px 13px, rgba(25, 169, 216, .2) 6px, transparent 7px); 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 board ---------- */
.goals { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.goalchip { display: flex; align-items: center; gap: 5px; background: var(--paper); border: 2px solid var(--line); border-radius: 999px; padding: 3px 10px 3px 4px; font: 20px/1 var(--display); }
.goalchip b { padding-top: 4px; font-weight: 400; }
.goalchip .mini { position: relative; width: 30px; height: 30px; flex: none; font-size: 13px; }
.goalchip.done { background: #d5f5e7; border-color: var(--green); }
.stat.low b { color: var(--red); }
.wrap { width: 100%; max-width: max(250px, calc((100dvh - 350px) * var(--w) / var(--h))); margin: 0 auto; background: #cfe6f3; border: 3px solid var(--ink); border-radius: 18px; padding: 7px; box-shadow: 0 6px 0 rgba(29, 49, 71, .2); }
.board { position: relative; width: 100%; aspect-ratio: var(--w) / var(--h); overflow: hidden; border-radius: 8px; touch-action: manipulation; user-select: none; }
.tile { position: absolute; width: calc(100% / var(--w)); height: calc(100% / var(--h)); background: rgba(255, 255, 255, .55); box-shadow: inset 0 0 0 1px rgba(29, 49, 71, .08); }
.p { position: absolute; left: 0; top: 0; width: calc(100% / var(--w)); height: calc(100% / var(--h)); padding: 0; border: 0; background: none; transition: transform .24s cubic-bezier(.35, 0, .55, 1.25); will-change: transform; }
.p:focus-visible { outline-offset: -3px; z-index: 2; }
.face { position: absolute; inset: 4%; border-radius: 22%; display: grid; place-items: center; background: var(--col, #bbb) center / contain no-repeat; border: 2px solid var(--ink); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .16), inset 0 3px 0 rgba(255, 255, 255, .35); transition: transform .16s, opacity .16s; }
.sym { font-size: 115%; line-height: 1; color: rgba(255, 255, 255, .92); text-shadow: 0 1px 0 rgba(0, 0, 0, .35); pointer-events: none; }
.k-b1 { --col: #e8483f; } .k-b2 { --col: #2f7fe0; } .k-b3 { --col: #23b67f; } .k-b4 { --col: #ffc61a; } .k-b5 { --col: #8b5cf6; }
.has-b-red .k-b1 .face { background-image: url(/img/b-red.webp); } .has-b-blue .k-b2 .face { background-image: url(/img/b-blue.webp); }
.has-b-green .k-b3 .face { background-image: url(/img/b-green.webp); } .has-b-yellow .k-b4 .face { background-image: url(/img/b-yellow.webp); }
.has-b-purple .k-b5 .face { background-image: url(/img/b-purple.webp); }
.has-b-red .k-b1 .face, .has-b-blue .k-b2 .face, .has-b-green .k-b3 .face, .has-b-yellow .k-b4 .face, .has-b-purple .k-b5 .face,
.has-rocket .k-rocket .face, .has-bomb .k-bomb .face, .has-disco .k-disco .face, .has-crate .k-crate .face { background-color: transparent; border: 0; box-shadow: none; inset: 2%; }
.has-b-red .k-b1 .sym, .has-b-blue .k-b2 .sym, .has-b-green .k-b3 .sym, .has-b-yellow .k-b4 .sym, .has-b-purple .k-b5 .sym,
.has-rocket .k-rocket .sym, .has-bomb .k-bomb .sym, .has-crate .k-crate .sym { display: none; }
.k-rocket { --col: #f4f4f0; } .k-rocket .sym { color: var(--red); text-shadow: none; }
.has-rocket .k-rocket .face { background-image: url(/img/rocket.webp); }
.has-rocket .k-rocket.v .face { transform: rotate(-90deg); }
.k-bomb { --col: #2f3540; } .k-bomb .face { border-radius: 50%; }
.has-bomb .k-bomb .face { background-image: url(/img/bomb.webp); }
.k-bomb.big .face { inset: -6%; } .has-bomb .k-bomb.big .face { inset: -8%; }
.k-bomb.big { z-index: 1; }
.k-disco { --col: #e9e4ff; } .k-disco .face { border-radius: 50%; }
.has-disco .k-disco .face { background-image: url(/img/disco.webp); }
.k-disco .sym { width: 52%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--ink); background: var(--dc); font-size: 80%; }
.dc1 { --dc: #e8483f; } .dc2 { --dc: #2f7fe0; } .dc3 { --dc: #23b67f; } .dc4 { --dc: #ffc61a; } .dc5 { --dc: #8b5cf6; }
.k-crate { --col: #b9824a; } .k-crate .face { border-radius: 10%; } .k-crate .sym { color: #6b4421; text-shadow: none; }
.has-crate .k-crate .face { background-image: url(/img/crate.webp); }
.k-stap .face { background: none; border: 0; box-shadow: none; }
.k-stap .sym { display: none; }
.k-stap .face::before { content: ''; position: absolute; left: 6%; right: 6%; bottom: 14%; height: 20%; border-radius: 20% 20% 10% 10%; background: #8d99a6; border: 2px solid var(--ink); }
.k-stap .face::after { content: ''; position: absolute; left: 6%; right: 2%; bottom: 36%; height: 30%; border-radius: 60% 30% 12% 12%; background: var(--red); border: 2px solid var(--ink); transform: rotate(-9deg); transform-origin: left bottom; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35); }
.dirtag { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); font: 800 11px/1 var(--body); background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 0 4px 1px; pointer-events: none; z-index: 1; }
.cor { position: absolute; right: 1%; top: 1%; width: 38%; height: 38%; border-radius: 50%; background: #fff center / 84% no-repeat; border: 2px solid var(--ink); display: none; place-items: center; font: 800 9px/1 var(--body); pointer-events: none; z-index: 1; }
.p[data-h] .cor { display: grid; }
.has-rocket .p[data-h="r"] .cor { background-image: url(/img/rocket.webp); color: transparent; }
.has-bomb .p[data-h="m"] .cor { background-image: url(/img/bomb.webp); color: transparent; }
.has-disco .p[data-h="d"] .cor { background-image: url(/img/disco.webp); color: transparent; }
.p.pop { pointer-events: none; z-index: 0; } .p.pop .face { transform: scale(.1) rotate(25deg); opacity: 0; }
.p.pop .cor, .p.pop .dirtag { display: none; }
.p.born .face { animation: born .3s cubic-bezier(.3, 1.6, .5, 1); }
.p.no .face { animation: no .28s; }
@keyframes born { 0% { transform: scale(.2); } }
@keyframes no { 25% { transform: translateX(-7%) rotate(-4deg); } 75% { transform: translateX(7%) rotate(4deg); } }
.fx { position: absolute; pointer-events: none; z-index: 3; border-radius: 999px; background: rgba(255, 244, 168, .9); box-shadow: 0 0 10px 3px rgba(255, 210, 63, .9); animation: fx .34s ease-out forwards; }
.fx.area { border-radius: 24%; background: rgba(255, 138, 61, .55); }
.fx.all { border-radius: 8px; background: rgba(255, 255, 255, .75); }
@keyframes fx { 0% { opacity: 0; transform: scale(.3); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1); } }

/* ---------- level map ---------- */
.map { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px 10px; }
.map .lv { border-radius: 46%; position: relative; }
.map .lv::after { content: ''; position: absolute; pointer-events: none; }
.map .lv.ltr:not(.endrow)::after { left: calc(100% + 3px); top: 50%; width: 10px; border-top: 3px dotted var(--muted); }
.map .lv.rtl:not(.endrow)::after { right: calc(100% + 3px); top: 50%; width: 10px; border-top: 3px dotted var(--muted); }
.map .lv.endrow::after { left: 50%; top: calc(100% + 6px); height: 9px; border-left: 3px dotted var(--muted); }
.map .lv.last::after { display: none; }

@media (max-height: 700px) { h1 { font-size: 32px; } .hero { width: min(100%, 300px); } }
@media (prefers-reduced-motion: reduce) {
  .bigstars .s.on, .p.born .face, .p.no .face { animation: none; }
  .p, .face { transition: none; }
  .fx { display: none; }
}
