@font-face { font-family: "Baloo 2"; src: url("/assets/fonts/baloo-2-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Baloo 2"; src: url("/assets/fonts/baloo-2-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/assets/fonts/nunito-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/assets/fonts/nunito-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/assets/fonts/nunito-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --ground: #fffaf0;
  --ground-2: #fff3d6;
  --sun: #ffd23f;
  --sun-deep: #f5b800;
  --ink: #241c14;
  --ink-2: #5a4b3c;
  --line: #2a2118;
  --paper: #ffffff;
  --butter: #fff0bd;
  --peach: #ffe0d3;
  --sky: #dcecff;
  --lilac: #ebe2ff;
  --mint: #daf3e1;
  --sand: #f1ece3;
  --red: #d93a3f;
  --open: #17703f;
  --open-bg: #ddf4e5;
  --closed-bg: #fde4e2;
  --display: "Baloo 2", "Nunito", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-s: 12px;
  --r-m: 20px;
  --r-l: 28px;
  --shadow: 0 6px 0 -1px rgba(42, 33, 24, .12), 0 14px 30px -12px rgba(42, 33, 24, .28);
  --shadow-soft: 0 2px 0 rgba(42, 33, 24, .06), 0 10px 24px -14px rgba(42, 33, 24, .3);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--sun-deep) var(--ground); }
body {
  margin: 0; min-height: 100dvh; background: var(--ground); color: var(--ink);
  font: 400 1.0625rem/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--sun); color: var(--ink); }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 2px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-weight: 800; }
.skip:focus { top: 12px; }

h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.02; letter-spacing: -.02em; margin: 0; text-wrap: balance; }

/* header */
.top { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px clamp(16px, 4vw, 48px); max-width: 1240px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; }
.brand svg { width: 38px; height: 38px; }
.brand b { font: 800 1.6rem/1 var(--display); letter-spacing: -.02em; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a:not(.btn) { display: none; padding: 10px 14px; font-weight: 700; text-decoration: none; border-radius: 999px; min-height: 44px; align-items: center; }
.nav a:not(.btn):hover { background: var(--ground-2); }
@media (min-width: 760px) { .nav a:not(.btn) { display: inline-flex; } }

/* buttons */
.btn {
  --bg: var(--sun);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 24px; border-radius: 999px; border: 0;
  background: var(--bg); color: var(--ink); font: 800 1.05rem/1.1 var(--display); letter-spacing: .005em;
  text-decoration: none; box-shadow: 0 4px 0 var(--sun-deep), 0 12px 24px -12px rgba(120, 80, 0, .55);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background-color .18s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: #ffdb5e; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--sun-deep), 0 6px 14px -10px rgba(120, 80, 0, .5); }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--sand); color: #6f6355; box-shadow: none; cursor: not-allowed; }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn-sm { min-height: 44px; padding: 10px 18px; font-size: .98rem; }
.btn-xl { min-height: 64px; width: 100%; font-size: 1.45rem; letter-spacing: .02em; }
.btn-ghost { --bg: var(--paper); border: 2px solid var(--line); box-shadow: var(--shadow-soft); }
.btn-ghost:hover { background: var(--ground-2); }
.btn-ghost:active { box-shadow: none; }
.btn-ghost[disabled] { border-color: #cfc5b6; background: var(--sand); }
.link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; font-weight: 800; color: var(--ink); background: none; border: 0; text-decoration: underline; }
.link svg { width: 18px; height: 18px; }

/* ===== landing ===== */
.hero { max-width: 1240px; margin: 0 auto; padding: 18px clamp(16px, 4vw, 48px) 40px; display: grid; gap: 8px; }
.hero h1 { font-size: clamp(2.9rem, 12.5vw, 5.6rem); line-height: .96; }
.hero h1 .swash { position: relative; display: inline-block; padding: .02em .18em .04em; margin-top: .06em; z-index: 0; }
.hero h1 .swash::before { content: ""; position: absolute; inset: .14em -.02em .02em; background: var(--sun); border-radius: .42em .3em .5em .26em; transform: rotate(-2.2deg); z-index: -1; }
.hero p.lead { font-size: clamp(1.1rem, 3.6vw, 1.3rem); max-width: 30ch; margin: 18px 0 22px; color: var(--ink-2); }
.hero p.lead strong { color: var(--ink); }
.hero .cta-row { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.hero .cta-row .btn { min-height: 60px; padding: 14px 30px; font-size: 1.3rem; }
.hero .meta { font-size: .92rem; color: var(--ink-2); margin: 0; display: flex; flex-wrap: wrap; gap: 2px 16px; }
.hero .meta span { white-space: nowrap; }
.hero .meta span::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--sun-deep); margin: 0 7px 3px 0; }

.stage { position: relative; width: min(100%, 520px); aspect-ratio: 1 / 1; margin: 18px auto 0; }
.stage .glow { position: absolute; left: 26%; right: 26%; bottom: 13%; height: 7%; border-radius: 50%; background: var(--sun); opacity: .75; }
.mascot { position: absolute; left: 21%; top: 24%; width: 58%; cursor: pointer; background: none; border: 0; padding: 0; border-radius: 30px; }
.mascot svg { width: 100%; height: auto; overflow: visible; }
.bubble {
  position: absolute; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px 11px;
  font: 800 clamp(.95rem, 3.8vw, 1.2rem)/1.05 var(--display); border-radius: 26px; box-shadow: var(--shadow-soft);
  white-space: nowrap; z-index: 2;
}
.bubble svg { width: 1.6em; height: 1.6em; flex: none; }
.bubble::after { content: ""; position: absolute; width: 18px; height: 18px; background: inherit; border-radius: 3px; }
.bubble.b1 { background: var(--peach); left: 0; top: 4%; transform: rotate(-7deg); }
.bubble.b1::after { right: 26%; bottom: -6px; transform: rotate(45deg); }
.bubble.b2 { background: var(--sky); right: 0; top: 0; transform: rotate(6deg); }
.bubble.b2::after { left: 24%; bottom: -6px; transform: rotate(45deg); }
.bubble.b3 { background: var(--mint); left: -1%; top: 58%; transform: rotate(5deg); }
.bubble.b3::after { right: -6px; top: 34%; transform: rotate(45deg); }
.bubble.b4 { background: var(--lilac); right: -1%; top: 66%; transform: rotate(-5deg); }
.bubble.b4::after { left: -6px; top: 34%; transform: rotate(45deg); }
.spark { position: absolute; width: 7%; color: var(--sun-deep); }

@media (min-width: 900px) {
  .hero { grid-template-columns: 1.08fr 1fr; align-items: center; padding-top: 40px; padding-bottom: 72px; column-gap: 32px; }
  .stage { margin: 0 auto; width: 94%; }
  .bubble.b1 { left: 8%; top: 13%; }
  .bubble.b2 { right: 4%; top: 9%; }
  .bubble.b3 { left: -3%; top: 57%; }
  .bubble.b4 { right: -3%; top: 73%; }
}

/* how it works: board-game path */
.how { background: var(--paper); border-radius: 40px 40px 0 0; padding: 56px clamp(16px, 4vw, 48px) 64px; }
.how-in { max-width: 1100px; margin: 0 auto; }
.how h2 { font-size: clamp(2.1rem, 7vw, 3.2rem); text-align: center; }
.path { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 30px; position: relative; }
.path::before { content: ""; position: absolute; left: 33px; top: 30px; bottom: 30px; border-left: 4px dotted var(--sun-deep); }
.step { display: grid; grid-template-columns: 70px 1fr; gap: 18px; align-items: center; position: relative; }
.pip-tile { width: 70px; height: 70px; border-radius: 18px; background: var(--paper); border: 2.5px solid var(--line); box-shadow: var(--shadow-soft); display: grid; padding: 12px; gap: 4px; }
.pip-tile i { width: 11px; height: 11px; border-radius: 50%; background: var(--line); align-self: center; justify-self: center; }
.pip-tile.p1 { place-items: center; } .pip-tile.p1 i { width: 15px; height: 15px; background: var(--red); }
.pip-tile.p2 { grid-template: 1fr 1fr / 1fr 1fr; } .pip-tile.p2 i:nth-child(1) { grid-area: 1/1; } .pip-tile.p2 i:nth-child(2) { grid-area: 2/2; }
.pip-tile.p3 { grid-template: 1fr 1fr 1fr / 1fr 1fr 1fr; } .pip-tile.p3 i:nth-child(1) { grid-area: 1/1; } .pip-tile.p3 i:nth-child(2) { grid-area: 2/2; } .pip-tile.p3 i:nth-child(3) { grid-area: 3/3; }
.step h3 { font-size: 1.45rem; margin-bottom: 4px; }
.step p { margin: 0; color: var(--ink-2); max-width: 34ch; }
.step:nth-child(1) .pip-tile { background: var(--butter); }
.step:nth-child(2) .pip-tile { background: var(--peach); }
.step:nth-child(3) .pip-tile { background: var(--mint); }
@media (min-width: 820px) {
  .path { grid-template-columns: repeat(3, 1fr); gap: 28px; }
  .path::before { left: 12%; right: 12%; top: 33px; bottom: auto; border-left: 0; border-top: 4px dotted var(--sun-deep); }
  .step { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .step p { margin-inline: auto; }
}

/* rules card */
.rules-wrap { padding: 0 clamp(16px, 4vw, 48px) 64px; background: var(--paper); }
.rules { max-width: 860px; margin: 0 auto; background: var(--butter); border-radius: var(--r-l); box-shadow: var(--shadow); padding: 28px clamp(20px, 4vw, 40px) 30px; position: relative; }
.rules h2 { font-size: clamp(1.8rem, 6vw, 2.4rem); }
.rules > p { margin: 6px 0 18px; color: var(--ink-2); }
.rules ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.rules li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.rules li b { display: block; font: 800 1.2rem/1.2 var(--display); }
.rules li span { color: var(--ink-2); }
.rules li svg { width: 34px; height: 34px; color: var(--open); }
@media (min-width: 760px) { .rules ul { grid-template-columns: 1fr 1fr; column-gap: 32px; } }

/* footer */
.foot { max-width: 1240px; margin: 0 auto; padding: 22px clamp(16px, 4vw, 48px) 28px; display: grid; gap: 12px; font-size: .93rem; color: var(--ink-2); }
.foot .brand b { font-size: 1.3rem; color: var(--ink); }
.foot .brand svg { width: 30px; height: 30px; }
.foot p { margin: 0; }
.foot .note { color: var(--ink); font-weight: 700; }
@media (min-width: 820px) { .foot { grid-template-columns: auto 1fr; align-items: center; column-gap: 28px; } }

/* ===== app ===== */
.app-body { display: flex; flex-direction: column; }
.app { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 4px 18px 28px; position: relative; }
.screen[hidden] { display: none !important; }
.screen > h1 { font-size: clamp(2rem, 8.4vw, 2.6rem); margin: 10px 0 18px; }
.wave { height: 70px; background: var(--sun); -webkit-mask: url("/assets/wave.svg") top / 100% 100% no-repeat; mask: url("/assets/wave.svg") top / 100% 100% no-repeat; opacity: .55; margin-top: auto; }

.panel { background: var(--paper); border-radius: var(--r-m); box-shadow: var(--shadow-soft); padding: 16px; }
.code-panel { border: 2.5px dashed var(--sun-deep); margin-bottom: 18px; }
.code-panel h2 { font-size: 1.35rem; margin-bottom: 4px; }
.code-panel p { margin: 0 0 12px; color: var(--ink-2); font-size: .97rem; }
.field-row { display: flex; gap: 8px; }
.input { flex: 1; min-width: 0; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 2.5px solid var(--line); background: var(--paper); font-weight: 700; }
.input:focus-visible { outline-offset: 2px; }
.help-err { color: #a3181d; font-weight: 800; margin: 8px 0 0; font-size: .95rem; }

/* category grid */
.cats { border: 0; padding: 0; margin: 0 0 16px; }
.cats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cat { position: relative; }
.cat input { position: absolute; opacity: 0; inset: 0; margin: 0; pointer-events: none; }
.cat label {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 96px; padding: 12px 6px 10px; border-radius: 18px; background: var(--c, var(--sand));
  font-weight: 800; font-size: .95rem; line-height: 1.15; cursor: pointer; border: 2.5px solid transparent;
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s;
}
.cat label svg { width: 40px; height: 40px; }
.cat:hover label { transform: translateY(-2px); }
.cat input:checked + label { background: var(--sun); box-shadow: var(--shadow); transform: translateY(-2px); }
.cat input:checked + label::after { content: ""; position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4L18 8' fill='none' stroke='%23ffd23f' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat; }
.cat input:focus-visible + label { outline: 3px solid var(--ink); outline-offset: 3px; }
.cat.wide { grid-column: span 2; }
.cat.wide label { flex-direction: row; gap: 12px; }

.area { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; margin-bottom: 14px; }
.area > svg { width: 26px; height: 26px; flex: none; }
.area .area-text { flex: 1; min-width: 0; }
.area small { display: block; font-size: .8rem; color: var(--ink-2); font-weight: 700; }
.area strong { display: block; font-size: 1.08rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area .input { min-height: 44px; }
.area-hint { font-size: .85rem; color: var(--ink-2); margin: -6px 4px 14px; }

.filters { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 20px; }
.filters label, .filters .lbl { display: block; font-size: .85rem; font-weight: 800; margin-bottom: 6px; }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; width: 100%; min-height: 46px; padding: 8px 34px 8px 12px; border-radius: 14px; border: 2px solid #e2d9cb; background: var(--paper); font-weight: 800; font-size: .98rem; cursor: pointer; }
.select-wrap::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.switch { position: relative; display: inline-flex; align-items: center; min-height: 46px; min-width: 64px; cursor: pointer; }
.switch input { appearance: none; margin: 0; width: 60px; height: 34px; border-radius: 999px; background: #8c7e6a; position: relative; cursor: pointer; transition: background-color .2s; }
.switch input::after { content: ""; position: absolute; left: 4px; top: 4px; width: 26px; height: 26px; border-radius: 50%; background: var(--paper); box-shadow: 0 2px 4px rgba(0,0,0,.25); transition: transform .22s var(--ease); }
.switch input:checked { background: var(--open); }
.switch input:checked::after { transform: translateX(26px); }

.quota { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 18px; font-weight: 700; font-size: .98rem; }
.dots { display: flex; gap: 8px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: #e6ddcf; }
.dots i.on { background: var(--sun-deep); }
.mode-tag { display: inline-block; font: 800 .8rem/1 var(--body); letter-spacing: .08em; background: var(--ink); color: var(--sun); padding: 6px 9px; border-radius: 8px; }

/* process */
.rolling { text-align: center; padding-top: 6px; }
.dice-stage { position: relative; width: min(72vw, 260px); aspect-ratio: 1; margin: 6px auto 4px; }
.dice-stage .dice { position: absolute; inset: 12%; }
.dice-stage .whoosh { position: absolute; inset: 0; color: var(--sun-deep); }
.rolling h1 { font-size: clamp(2rem, 8vw, 2.5rem); margin: 4px 0 22px; }
.steps { list-style: none; padding: 0; margin: 0 auto; text-align: left; display: grid; gap: 6px; max-width: 360px; }
.steps li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: center; min-height: 44px; font-weight: 700; color: #6f6355; transition: color .25s; }
.steps li .st { width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid #d6ccbd; display: grid; place-items: center; }
.steps li .st svg { width: 18px; height: 18px; opacity: 0; }
.steps li[data-state="active"] { color: var(--ink); }
.steps li[data-state="active"] .st { border-color: var(--sun-deep); border-top-color: transparent; animation: spin .8s linear infinite; }
.steps li[data-state="done"] { color: var(--ink); }
.steps li[data-state="done"] .st { background: var(--open); border-color: var(--open); }
.steps li[data-state="done"] .st svg { opacity: 1; color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* result */
.result h1 { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: clamp(2.4rem, 10vw, 3rem); margin: 6px 0 14px; }
.result h1 svg { width: 34px; height: 34px; color: var(--sun-deep); }
.card { background: var(--paper); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; }
.card-head { position: relative; height: 128px; background: var(--c, var(--butter)); display: grid; place-items: center; overflow: hidden; }
.card-head svg.big { width: 76px; height: 76px; position: relative; }
.card-head .confetti { position: absolute; inset: 0; width: 100%; height: 100%; }
.card-head .sample { position: absolute; left: 14px; top: 14px; }
.card-body { padding: 18px 18px 20px; }
.card-body h2 { font-size: clamp(1.6rem, 6.6vw, 2rem); margin-bottom: 10px; overflow-wrap: anywhere; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 10px; font-weight: 800; }
.facts span { display: inline-flex; align-items: center; gap: 6px; }
.facts svg { width: 20px; height: 20px; flex: none; }
.facts .muted { font-weight: 700; color: var(--ink-2); }
.addr { display: grid; grid-template-columns: 20px 1fr; gap: 8px; margin: 0 0 12px; color: var(--ink-2); font-weight: 700; font-size: .98rem; }
.addr svg { width: 20px; height: 20px; margin-top: 2px; }
.status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 9px; border-radius: 999px; font-weight: 800; font-size: .95rem; background: var(--open-bg); color: var(--open); }
.chip i { width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(23, 112, 63, .2); }
.chip.closed { background: var(--closed-bg); color: #9b1c20; }
.chip.unknown { background: var(--sand); color: var(--ink-2); }
.checked { font-size: .9rem; font-weight: 700; color: var(--ink-2); }
.actions { display: grid; gap: 12px; margin-top: 18px; }
.actions .btn { width: 100%; min-height: 58px; font-size: 1.2rem; }
.back-row { display: flex; justify-content: center; margin-top: 6px; }

/* error */
.oops { text-align: center; padding-top: 10px; }
.oops .dice-sad { width: 150px; margin: 0 auto 6px; }
.oops h1 { font-size: clamp(1.9rem, 7.6vw, 2.4rem); margin: 6px 0 10px; }
.oops p { color: var(--ink-2); margin: 0 auto 18px; max-width: 34ch; }
.oops .actions { max-width: 380px; margin-inline: auto; }

.app-foot { text-align: center; font-size: .86rem; color: var(--ink-2); padding: 0 20px 10px; }
.app-foot .note { font-weight: 700; color: var(--ink); margin: 0 auto 4px; max-width: 46ch; }
.app-foot .link { font-size: .86rem; min-height: 44px; }

@media (min-width: 900px) {
  .app { padding-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .steps li[data-state="active"] .st { border-top-color: var(--sun-deep); }
}
.app-body { --ground: #fcfbf8; }
.app-body .top { max-width: 600px; }
