@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url(/fonts/nunito-bold.woff2) format('woff2');
}

:root {
  --bg: #ffffff;
  --card: #ffffff;
  --soft: #f7f7f7;
  --line: #e5e5e5;
  --text: #4b4b4b;
  --muted: #777777;
  --faint: #afafaf;
  --green: #58cc02;   --green-d: #58a700;  --green-l: #d7ffb8;  --green-t: #58a700;
  --blue: #1cb0f6;    --blue-d: #1899d6;   --blue-l: #ddf4ff;   --blue-t: #1899d6;
  --red: #ff4b4b;     --red-d: #ea2b2b;    --red-l: #ffdfe0;    --red-t: #ea2b2b;
  --orange: #ff9600;  --orange-d: #e58600; --orange-l: #fff1d6; --orange-t: #e58600;
  --yellow: #ffc800;  --yellow-d: #e5b400;
  --purple: #ce82ff;  --purple-d: #a568cc;
  --pink: #ff86d0;    --pink-d: #e56fb8;
  --shade: rgba(0, 0, 0, .45);
  --chart: #1899d6;   /* chart columns: passes lightness band + 3:1 on the light and the dark surface */
  --tabs-h: 68px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131f24;
    --card: #131f24;
    --soft: #202f36;
    --line: #37464f;
    --text: #f1f7fb;
    --muted: #b6c4cb;
    --faint: #52656d;
    --green-l: #1f3713;  --green-t: #79d634;
    --blue-l: #10334a;   --blue-t: #49c0f8;
    --red-l: #3f1d20;    --red-t: #ff7878;
    --orange-l: #3a2a10; --orange-t: #ffb020;
    --shade: rgba(0, 0, 0, .65);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* An app shell exactly the screen's height (100dvh: the visible part, also on iPhone with Safari's bars): top bar, the middle that
 * scrolls, the tab bar. The page itself never scrolls or rubber-bands. */
html { -webkit-text-size-adjust: 100%; height: 100%; overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 700 16px/1.4 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-tap-highlight-color: transparent;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  display: grid;
  grid-template: 'top' auto 'main' minmax(0, 1fr) 'tabs' auto / minmax(0, 1fr);
}
img { display: block; }
/* an animated emoji: its still, then the Lottie SVG over it once that is drawn (app.js img / mount) */
.lot { display: block; position: relative; flex: none; }
.lot > img { width: 100%; height: 100%; }
.lot > svg { position: absolute; inset: 0; }
.lot.live > img { visibility: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---------- top bar ---------- */
.top {
  grid-area: top; z-index: 20;
  background: var(--bg);
  border-bottom: 2px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-in { max-width: 600px; margin: 0 auto; height: 60px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--green); font-weight: 900; font-size: 24px; letter-spacing: -.02em; text-decoration: none; }
.brand img { border-radius: 8px; }
.chips { display: flex; gap: 6px; }
.chip { display: flex; align-items: center; gap: 4px; padding: 4px 10px 4px 6px; border-radius: 12px; font-weight: 800; font-size: 17px; }
.chip.orange { color: var(--orange); }
.chip.blue { color: var(--blue); }
.chip.pop { animation: pop .45s ease; }
@keyframes pop { 40% { transform: scale(1.25); } }

/* ---------- layout ---------- */
main { grid-area: main; position: relative; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; padding: 16px 16px 24px; }
.tab { max-width: 600px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.card { border: 2px solid var(--line); border-radius: 16px; padding: 16px; background: var(--card); }
.h { font-size: 22px; font-weight: 900; color: var(--text); }
.muted { color: var(--muted); font-weight: 700; }
.small { font-size: 14px; }
.section-h { font-size: 20px; font-weight: 900; margin: 8px 2px -4px; }

/* ---------- buttons ---------- */
.btn {
  --b: var(--blue); --bd: var(--blue-d); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 12px 20px;
  border: 0; border-radius: 16px;
  background: var(--b); color: var(--fg);
  box-shadow: 0 4px 0 var(--bd);
  font-weight: 800; font-size: 16px; text-transform: uppercase; letter-spacing: .05em;
  transition: transform .06s, box-shadow .06s, filter .15s;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  margin-bottom: 4px; text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--bd); }
.btn:disabled { --b: var(--line); --bd: var(--line); --fg: var(--faint); cursor: default; filter: none; transform: none; box-shadow: 0 4px 0 var(--bd); }
.btn.green { --b: var(--green); --bd: var(--green-d); }
.btn.red { --b: var(--red); --bd: var(--red-d); }
.btn.orange { --b: var(--orange); --bd: var(--orange-d); }
.btn.ghost { --b: var(--card); --bd: var(--line); --fg: var(--blue); border: 2px solid var(--line); }
.btn.ghost.danger { --fg: var(--red); }
.btn.wide { width: 100%; }
.btn img { width: 28px; height: 28px; margin: -6px 0; }
.link { background: none; border: 0; padding: 8px; color: var(--blue); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; font-size: 14px; }
.link.danger { color: var(--red); }

/* ---------- mascot + speech bubble ---------- */
.hero { display: flex; align-items: center; gap: 14px; padding: 4px 0; }
.hero .lot { width: 112px; height: 112px; }
.bubble { position: relative; flex: 1; border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; font-size: 17px; font-weight: 800; background: var(--card); }
.bubble::before, .bubble::after { content: ''; position: absolute; top: 50%; width: 0; height: 0; border: 10px solid transparent; transform: translateY(-50%); }
.bubble::before { left: -20px; border-right-color: var(--line); }
.bubble::after { left: -16px; border-width: 8px; border-right-color: var(--card); }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats.four { grid-template-columns: repeat(2, 1fr); }
.stat {
  border: 2px solid var(--line); border-radius: 16px; padding: 10px 12px; min-width: 0;
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 6px;
}
.stat img { width: 30px; height: 30px; }
.stat > div { display: contents; }
.stat b { font-size: 22px; font-weight: 900; line-height: 1.1; }
.stat small { grid-column: 1 / -1; margin-top: 2px; color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.2; }
.stats.four .stat { grid-template-columns: auto 1fr; column-gap: 10px; }
.stats.four .stat img { grid-row: span 2; width: 36px; height: 36px; }
.stats.four .stat small { grid-column: 2; margin-top: 0; }

/* ---------- home: the clock ---------- */
.timer { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 20px 16px; }
.timer-h { font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.clock { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; max-width: 400px; }
.unit { border: 2px solid var(--line); border-radius: 16px; box-shadow: 0 4px 0 var(--line); padding: 10px 0 8px; background: var(--card); }
.unit b { display: block; font-size: clamp(30px, 10vw, 44px); font-weight: 900; line-height: 1; color: var(--green-t); font-variant-numeric: tabular-nums; }
.unit span { display: block; margin-top: 4px; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.best { display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--muted); }
.best img { width: 24px; height: 24px; }
.best b { color: var(--text); }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.cal-head .h { font-size: 24px; }
.cal-head .muted { font-size: 15px; }
.wk, .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px 6px; }
.wk { margin-bottom: 8px; }
.wk span { text-align: center; color: var(--faint); font-size: 13px; font-weight: 800; }
.d {
  position: relative; aspect-ratio: 1; width: 100%; max-width: 54px; justify-self: center;
  border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center;
  font-size: 16px; font-weight: 900;
  background: var(--soft); color: var(--faint);
  transition: transform .08s;
}
.d.past { background: var(--green); color: #fff; box-shadow: 0 3px 0 var(--green-d); }
.d.nut { background: var(--blue); color: #fff; box-shadow: 0 3px 0 var(--blue-d); }
.d.today { outline: 3px solid var(--orange); outline-offset: 3px; }
.d.today:not(.past):not(.nut) { background: var(--orange-l); color: var(--orange-t); }
.d.future { cursor: default; }
.d:not(.future):active { transform: translateY(3px); box-shadow: none; }
.d .badge {
  position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: 11px; background: var(--card); color: var(--blue-t); border: 2px solid var(--blue);
  font-size: 12px; line-height: 18px; font-weight: 900; text-align: center;
}
.legend { display: flex; gap: 16px; justify-content: center; margin-top: 16px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.legend .lg-clean { background: var(--green); }
.legend .lg-nut { background: var(--blue); }
.legend .lg-today { border: 3px solid var(--orange); }

.cta { position: sticky; bottom: 0; z-index: 5; padding-top: 4px; }
.cta .btn { width: 100%; min-height: 56px; font-size: 18px; }
.cta-note { text-align: center; color: var(--muted); font-size: 14px; margin-top: -6px; }

/* ---------- league ---------- */
.league-head { display: flex; align-items: center; gap: 14px; }
.league-head .lot { width: 72px; height: 72px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg button {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--muted);
  box-shadow: 0 3px 0 var(--line); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; font-size: 14px;
}
.seg button img { width: 26px; height: 26px; }
.seg button[aria-pressed='true'] { border-color: var(--blue); background: var(--blue-l); color: var(--blue-t); box-shadow: 0 3px 0 var(--blue); }
.note { display: flex; align-items: center; gap: 12px; border-radius: 16px; padding: 12px 14px; background: var(--soft); color: var(--muted); font-size: 15px; }
.note .lot { width: 44px; height: 44px; }
.note .btn { min-height: 40px; padding: 8px 14px; font-size: 13px; margin-left: auto; flex: none; }
.rows { list-style: none; margin: 0; padding: 0; border: 2px solid var(--line); border-radius: 16px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 2px solid var(--line); }
.row:first-child { border-top: 0; }
.row.you { background: var(--green-l); }
.rank { width: 32px; flex: none; text-align: center; font-weight: 900; font-size: 18px; color: var(--muted); }
.rank img { width: 32px; height: 32px; margin: 0 auto; }
.who { flex: 1; min-width: 0; }
.who b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score { display: flex; align-items: center; gap: 2px; font-weight: 900; flex: none; }
.score img { width: 22px; height: 22px; }
.score.drop { color: var(--blue-t); min-width: 46px; }
.score.fire { color: var(--orange-t); min-width: 46px; }
.empty { text-align: center; padding: 24px 16px; color: var(--muted); }
.empty .lot { width: 96px; height: 96px; margin: 0 auto 8px; }

/* ---------- charts (profile) ---------- */
.chart-card h4 { margin: 0; font-size: 18px; font-weight: 900; }
.chart { position: relative; margin-top: 10px; }
.chart svg { display: block; overflow: visible; touch-action: pan-y; }
.chart .hit { fill: transparent; }
.chart .hit.on { fill: var(--soft); }
.chart .bar { fill: var(--chart); pointer-events: none; }
.chart .grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
.chart .tick { fill: var(--muted); font-size: 11px; font-weight: 700; pointer-events: none; font-variant-numeric: tabular-nums; }
.chart .val { fill: var(--text); font-size: 12px; font-weight: 900; pointer-events: none; }
.tip {
  position: absolute; top: -8px; z-index: 2; pointer-events: none; white-space: nowrap;
  padding: 6px 10px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 800;
}

/* ---------- avatars ---------- */
.av { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 20px; text-transform: uppercase; }
.av.big { width: 88px; height: 88px; font-size: 40px; box-shadow: 0 4px 0 rgba(0, 0, 0, .15); }
.av.c0 { background: var(--green); } .av.c1 { background: var(--blue); } .av.c2 { background: var(--orange); }
.av.c3 { background: var(--purple); } .av.c4 { background: var(--red); } .av.c5 { background: var(--pink); }

/* ---------- profile ---------- */
.me-card { display: flex; align-items: center; gap: 16px; }
.me-card .h { word-break: break-word; }
.sync-line { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 14px; color: var(--muted); }
.sync-line img { width: 20px; height: 20px; }
.sync-line button { margin-left: 2px; padding: 0 4px; font-size: 12px; }
.welcome { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0; }
form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 15px; font-weight: 800; color: var(--text); padding-left: 2px; }
.field small { color: var(--muted); font-size: 13px; padding-left: 2px; }
.input {
  width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--soft); font-weight: 700; font-size: 17px; outline: none;
}
.input:focus { border-color: var(--blue); }
.err { color: var(--red-t); font-size: 15px; min-height: 1em; }
.err:empty { display: none; }
.check { position: relative; display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 4px 2px; }
.check input { position: absolute; top: 8px; left: 8px; opacity: 0; width: 1px; height: 1px; margin: 0; }   /* kept inside its label: placed by the page, it made the page taller than the screen */
.check .box {
  width: 30px; height: 30px; flex: none; border-radius: 9px; border: 2px solid var(--line); background: var(--card);
  box-shadow: 0 3px 0 var(--line); display: grid; place-items: center; transition: background .12s, border-color .12s;
}
.check .box::after { content: ''; width: 9px; height: 16px; border: solid #fff; border-width: 0 4px 4px 0; transform: rotate(45deg) translate(-1px, -2px) scale(0); transition: transform .15s; }
.check input:checked + .box { background: var(--blue); border-color: var(--blue); box-shadow: 0 3px 0 var(--blue-d); }
.check input:checked + .box::after { transform: rotate(45deg) translate(-1px, -2px) scale(1); }
.check input:focus-visible + .box { outline: 3px solid var(--blue); outline-offset: 2px; }
.check b { display: block; font-size: 17px; font-weight: 800; }
.check small { display: block; color: var(--muted); font-size: 14px; font-weight: 700; }
.settings { display: flex; flex-direction: column; gap: 16px; }
.mono { font-family: ui-monospace, 'Cascadia Mono', 'SF Mono', Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .02em; }
.id-line { font-size: 14px; }
.id-line .mono { color: var(--text); }
.devices { display: flex; flex-direction: column; gap: 14px; }
.dev-row { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 15px; }
.dev-row .lot { width: 48px; height: 48px; }
.code-form .field > span:first-child { font-size: 14px; color: var(--muted); }
.code-form .input { font-size: 15px; text-transform: uppercase; min-width: 0; }
.qr { width: min(260px, 72vw); aspect-ratio: 1; border-radius: 16px; overflow: hidden; border: 2px solid var(--line); background: #fff; display: grid; place-items: center; color: #4b4b4b; font-size: 14px; padding: 8px; }
.qr svg { display: block; width: 100%; height: 100%; }
.code { font-size: 16px; line-height: 1.6; color: var(--text); word-spacing: .2em; max-width: 300px; }
.name-row { display: flex; gap: 8px; }
.name-row .btn { flex: none; min-height: 52px; padding: 0 16px; font-size: 14px; }
.foot { text-align: center; color: var(--faint); font-size: 13px; padding: 8px 0 4px; }
.foot a { color: inherit; }

/* ---------- tab bar ---------- */
.tabs {
  grid-area: tabs; z-index: 20;
  display: flex; justify-content: space-around;
  background: var(--bg); border-top: 2px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabs a {
  flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 4px 6px; border: 2px solid transparent; border-radius: 14px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
}
.tabs a[aria-current='page'] { border-color: var(--blue); background: var(--blue-l); color: var(--blue-t); }
.tabs .ticon { width: 32px; height: 32px; }

@media (min-width: 900px) {
  :root { --tabs-h: 0px; }
  body { grid-template: 'tabs top' auto 'tabs main' minmax(0, 1fr) / 230px minmax(0, 1fr); }
  .tabs {
    flex-direction: column; justify-content: flex-start; gap: 8px;
    border-top: 0; border-right: 2px solid var(--line); padding: 96px 16px 16px;
  }
  .tabs a { flex: none; max-width: none; flex-direction: row; gap: 16px; padding: 8px 14px; font-size: 15px; }
  .toast { bottom: 24px; }
}
/* short screens (an iPhone SE with Safari's bars leaves ~550px): a smaller mascot and clock so Home fits */
@media (max-height: 720px) {
  .hero .lot { width: 84px; height: 84px; }
  .bubble { font-size: 16px; }
  .timer { padding: 14px 12px; gap: 8px; }
  .unit { padding: 6px 0; }
  .unit b { font-size: 30px; }
  .result > .lot { width: 120px; height: 120px; }
}

/* ---------- sheet (bottom drawer) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-back { position: absolute; inset: 0; background: var(--shade); animation: fade .2s ease; }
.sheet {
  position: relative; width: 100%; max-width: 520px; max-height: 92dvh; overflow: auto;
  background: var(--card); border-radius: 24px 24px 0 0; padding: 24px 20px calc(20px + env(safe-area-inset-bottom));
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  animation: up .25s cubic-bezier(.2, .9, .3, 1.2);
}
@media (min-width: 600px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 24px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.x { position: absolute; top: 10px; right: 12px; width: 40px; height: 40px; border: 0; background: none; color: var(--faint); font-size: 32px; line-height: 1; border-radius: 12px; }
.sheet-in { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.sheet-in > .lot { width: 120px; height: 120px; }
.sheet-in .h { font-size: 24px; }
.sheet-in .btn { width: 100%; }
.sheet-in form { width: 100%; text-align: left; }

/* ---------- hour picker and a day's nuts ---------- */
.sheet-in > .lot.day-face { width: 96px; height: 96px; }
.pick-h { color: var(--muted); font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.hours { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.hrow { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 8px; }
.hlab { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--muted); text-align: left; }
.hlab img { width: 22px; height: 22px; }
.hchips { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.hchip {
  position: relative; min-height: 40px; border-radius: 12px; border: 2px solid var(--line); background: var(--card);
  box-shadow: 0 3px 0 var(--line); font-weight: 900; font-size: 15px; color: var(--text); padding: 0;
  font-variant-numeric: tabular-nums; touch-action: manipulation;
}
.hchip:active { transform: translateY(3px); box-shadow: none; }
.hchip.on { border-color: var(--blue); background: var(--blue-l); color: var(--blue-t); box-shadow: 0 3px 0 var(--blue); }
.hchip:disabled { color: var(--faint); background: var(--soft); box-shadow: none; border-color: var(--soft); cursor: default; transform: none; }
.hchip i { position: absolute; top: -7px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--blue); color: #fff; font-size: 11px; font-style: normal; line-height: 18px; }
.nut-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.nut-list li { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 14px; background: var(--blue-l); color: var(--blue-t); font-weight: 900; }
.nut-list img { width: 22px; height: 22px; }
.nut-list .rm { width: 30px; height: 30px; border: 0; border-radius: 10px; background: transparent; color: var(--blue-t); font-size: 22px; line-height: 1; }
.nut-list .rm:hover { background: var(--card); }

/* ---------- result (full screen, after logging) ---------- */
.result {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); text-align: center;
  overflow-y: auto; overscroll-behavior: contain;
  animation: fade .2s ease;
}
/* centred when it fits; scrolls from the top when it doesn't (justify-content: center would cut the top off, out of reach) */
.result > :first-child { margin-top: auto; }
.result > :last-child { margin-bottom: auto; }
.result > * { flex: none; }
.result > .lot { width: 168px; height: 168px; animation: bounce .6s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes bounce { from { transform: scale(.4); opacity: 0; } }
.result h1 { font-size: 30px; font-weight: 900; color: var(--orange); }
.result p { color: var(--muted); font-size: 18px; max-width: 420px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 440px; }
.tile { --c: var(--blue); border: 2px solid var(--c); border-radius: 16px; background: var(--c); overflow: hidden; }
.tile .th { color: #fff; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; padding: 4px 4px 3px; }
.tile .tv { background: var(--card); border-radius: 13px; padding: 12px 4px; display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 22px; font-weight: 900; color: var(--c); }
.tile .tv img { width: 26px; height: 26px; }
.tile .tv.small { font-size: 18px; }
.tile.orange { --c: var(--orange); }
.tile.red { --c: var(--red); }
.tile.green { --c: var(--green); }
.result .actions { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* ---------- toast + confetti ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 88px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 10px;
  background: var(--text); color: var(--bg); border-radius: 16px; font-weight: 800; box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
  animation: up .25s ease;
}
.toast .lot { width: 36px; height: 36px; }
.toast button { background: none; border: 0; color: var(--blue); font-weight: 900; text-transform: uppercase; padding: 4px 6px; margin-left: 4px; }
.confetti { position: fixed; top: -12px; z-index: 70; width: 10px; height: 14px; border-radius: 3px; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translate3d(var(--dx), 105vh, 0) rotate(var(--rot)); } }

.noscript { padding: 24px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
