/* Brimbob app styles. Tokens live in tokens.css. No inline styles anywhere (CSP style-src 'self'). */

/* ---------------- base ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}
[hidden] { display: none !important; }
h1, h2, h3, p, ol, ul, dl, dd, figure, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled, [aria-disabled="true"] { cursor: default; }
a { color: inherit; }
svg { flex: none; }
img { max-width: 100%; height: auto; }
.ic { width: 22px; height: 22px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 10px; }
h1:focus-visible, h2:focus-visible, section:focus-visible, main:focus-visible { outline: none; }

.sr-only, .offscreen {
  position: absolute !important; 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; padding: 10px 16px; border-radius: 12px;
  min-height: 44px; display: inline-flex; align-items: center;
  background: var(--ink); color: var(--bg); font-weight: 600; text-decoration: none;
}
.skip:focus { top: calc(8px + env(safe-area-inset-top)); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.noscript { padding: 40px 16px; text-align: center; font-family: var(--font-display); font-size: 22px; }

/* liquid colour hooks */
.liq-violet { --liq: var(--liq-violet); }
.liq-teal { --liq: var(--liq-teal); }
.liq-sky { --liq: var(--liq-sky); }
.liq-coral { --liq: var(--liq-coral); }
.liq-mint { --liq: var(--liq-mint); }
.liq-indigo { --liq: var(--liq-indigo); }
.liq-green { --liq: var(--liq-green); }

/* ---------------- buttons, tags, fields ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: var(--r-pill);
  border: 2px solid transparent; background: var(--surface); color: var(--ink);
  font: 600 17px/1.1 var(--font-display); letter-spacing: .01em; text-decoration: none; text-align: center;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), background-color .15s;
}
.btn .ic { width: 20px; height: 20px; }
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn:disabled { opacity: .55; }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 4px 0 var(--brand-deep); }
.btn-primary:active:not(:disabled) { box-shadow: 0 2px 0 var(--brand-deep); }
.btn-secondary { background: var(--surface); border-color: var(--line); box-shadow: 0 3px 0 var(--line); }
.btn-secondary:active:not(:disabled) { box-shadow: 0 1px 0 var(--line); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-fill); color: #fff; }
.btn-xl { min-height: 58px; font-size: 20px; padding: 0 26px; }
.btn-sm { min-height: 44px; font-size: 15px; padding: 0 16px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink);
  transition: background-color .15s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn .ic { width: 24px; height: 24px; }
.icon-btn-sm { width: 44px; height: 44px; }
.icon-btn-sm .ic { width: 20px; height: 20px; }

.link {
  border: 0; background: none; padding: 10px 4px; min-height: 44px;
  color: var(--muted); font: 600 14px var(--font-ui); text-decoration: underline; text-underline-offset: 3px;
}
.link:hover { color: var(--ink); }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--ink); font: 700 13px/1.5 var(--font-ui); letter-spacing: .02em; vertical-align: middle;
}
.tag .ic { width: 15px; height: 15px; }
.tag-archive { background: var(--brand); color: var(--on-brand); }
.tag-bot { background: #9AA7BA; color: #13223A; text-transform: lowercase; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 12px;
  border-radius: var(--r-pill); background: var(--surface); border: 1.5px solid var(--line);
  font: 600 14px var(--font-ui); color: var(--ink);
}
.pill .ic { width: 18px; height: 18px; }
.pill-streak .ic { color: var(--liq-sky); }
.pill-freeze .ic { color: var(--liq-sky); }
.pill-gold { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 18%, var(--surface)); color: var(--ink); min-height: 28px; padding: 2px 10px; font-size: 13px; }

.field { display: grid; gap: 6px; margin: 12px 0; }
.field-label { font: 600 14px var(--font-ui); }
.field-hint { font-size: 13px; color: var(--muted); }
.field input, .field textarea, textarea.code {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px;
  border: 2px solid var(--field-line); background: var(--bg); color: var(--ink);
}
.copy-fallback { margin-top: 10px; }
textarea.code { font: 13px/1.4 ui-monospace, Consolas, monospace; resize: vertical; word-break: break-all; }
.field input:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: transparent; }
.field input[aria-invalid="true"] { border-color: var(--danger); }

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.topbar-in { max-width: 560px; margin: 0 auto; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.logo { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 8px 4px 0; min-height: 44px; color: var(--ink); }
.logo-bob { width: 44px; height: auto; }
.logo-word { font: 700 25px/1 var(--font-display); letter-spacing: -.01em; }
.topbar-actions { display: flex; gap: 2px; }

main { padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left)); }
.page { max-width: 480px; margin: 0 auto; padding: 8px 0 calc(40px + env(safe-area-inset-bottom)); }

.eyebrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font: 600 15px var(--font-ui); text-align: center; }

/* ---------------- Bob ---------------- */
.bob { overflow: visible; }
.bob .bob-eye-open, .bob .bob-wing { display: inline; }
.bob .bob-eye-wide, .bob .bob-eye-wink, .bob .bob-sweat, .bob .bob-lines, .bob .bob-wing-up { display: none; }
.bob[data-state="nervous"] .bob-eye-open { display: none; }
.bob[data-state="nervous"] .bob-eye-wide, .bob[data-state="nervous"] .bob-sweat { display: inline; }
.bob[data-state="wink"] .bob-eye-open { display: none; }
.bob[data-state="wink"] .bob-eye-wink { display: inline; }
.bob[data-state="balance"] .bob-wing, .bob[data-state="surf"] .bob-wing { display: none; }
.bob[data-state="balance"] .bob-wing-up, .bob[data-state="surf"] .bob-wing-up, .bob[data-state="surf"] .bob-lines { display: inline; }

.bob-float { animation: bobFloat 2.4s ease-in-out infinite; }
.bob-tilt { transform-box: fill-box; transform-origin: 50% 90%; }
.bob[data-state="nervous"] .bob-tilt { animation: bobNervous .7s ease-in-out infinite; }
.bob[data-state="balance"] .bob-tilt { animation: bobBalance 1.5s ease-in-out infinite; }
.bob[data-state="wink"] .bob-tilt { animation: bobWink .6s var(--ease-pop) 1; }
.bob[data-state="surf"] .bob-float { animation: none; }
.bob .bob-sweat { animation: sweat 1.2s ease-in infinite; transform-box: fill-box; }
@keyframes bobFloat { 0%, 100% { transform: translateY(-6px); } 50% { transform: translateY(6px); } }
@keyframes bobNervous { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes bobBalance { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(10deg); } }
@keyframes bobWink { 0% { transform: scale(.9); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes sweat { 0% { transform: translateY(-2px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(10px); opacity: 0; } }

/* ---------------- beaker ---------------- */
.beaker { display: block; overflow: visible; }
.bk-back { fill: var(--glass); }
.bk-outline, .bk-brim { stroke: var(--glass-stroke); }
.bk-tick { stroke: var(--grad-ink); opacity: 1; }
/* Scale labels keep >= 4.5:1 over any liquid: solid ink plus a halo in the glass colour. */
.bk-grad { fill: var(--ink); fill-opacity: .82; opacity: 1; font-family: var(--font-ui); font-weight: 600; paint-order: stroke; stroke: var(--glass); stroke-width: 3px; stroke-linejoin: round; }
.bk-shine { stroke: var(--glass-shine); opacity: 1; }
.bk-tag-bg { fill: var(--ink); }
.bk-tag-k, .bk-tag-v { fill: var(--bg); font-family: var(--font-display); font-weight: 700; letter-spacing: .04em; }
.bk-tag-v { letter-spacing: 0; }
.bk-wave-front { animation: waveA 2.6s linear infinite; }
.bk-wave-back { animation: waveB 3.6s linear infinite; }
.bk-static .bk-wave, .bk-mini .bk-wave-back { animation: none; }
.bk-mini .bk-wave-front { animation-duration: 4s; }
@keyframes waveA { from { transform: translateX(0); } to { transform: translateX(40px); } }
@keyframes waveB { from { transform: translateX(0); } to { transform: translateX(-40px); } }

.bk-stream { opacity: 0; transform-box: fill-box; transform-origin: 50% 0; transition: opacity .22s; }
.bk-stream.is-on { opacity: .95; animation: streamIn .28s ease-in both; }
@keyframes streamIn { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.beaker[data-phase="tense"] .bk-brim, .beaker[data-phase="brimful"] .bk-brim { animation: brimPulse 1.2s ease-in-out infinite; }
@keyframes brimPulse { 0%, 100% { stroke: var(--glass-stroke); stroke-width: 5.5; } 50% { stroke: var(--gold); stroke-width: 8.5; } }
.beaker[data-phase="surface"] .bk-brim { stroke: var(--gold); }

.bk-dome { transform-box: fill-box; transform-origin: 50% 100%; }
.bk-dome.is-wobble { animation: domeWobble 1.1s ease-out; }
@keyframes domeWobble {
  0% { transform: scaleY(.2); } 36% { transform: scaleY(1.28); } 52% { transform: scaleY(.84); }
  68% { transform: scaleY(1.12); } 84% { transform: scaleY(.95); } 100% { transform: scaleY(1); }
}

.bk-drips, .bk-puddle { display: none; }
.beaker.is-spilled .bk-drips, .beaker.is-spilled .bk-puddle { display: inline; }
.bk-drip { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: drip .75s ease-in .1s forwards; }
.bk-puddle { transform-box: fill-box; transform-origin: 50% 50%; animation: puddle .8s var(--ease-out) .35s both; }
.beaker.is-static .bk-drip { animation: none; stroke-dashoffset: 0; }
.beaker.is-static .bk-puddle { animation: none; }
@keyframes drip { to { stroke-dashoffset: 0; } }
@keyframes puddle { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: .9; } }
.bk-drop { animation: splash .7s cubic-bezier(.2, .7, .4, 1) forwards; }
@keyframes splash {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  45% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 1; }
  100% { transform: translate(calc(var(--dx) * 1.5), var(--fall)) scale(.6); opacity: 0; }
}

.bk-spark { opacity: 0; transform-box: fill-box; transform-origin: 50% 50%; }
.beaker.is-sparkle .bk-spark { animation: spark 1s var(--ease-out) both; }
.bk-sparks g:nth-child(3n+1) .bk-spark { animation-delay: 0ms; }
.bk-sparks g:nth-child(3n+2) .bk-spark { animation-delay: 120ms; }
.bk-sparks g:nth-child(3n) .bk-spark { animation-delay: 240ms; }
@keyframes spark { 0% { opacity: 0; transform: scale(0) rotate(0); } 40% { opacity: 1; transform: scale(1.25) rotate(45deg); } 100% { opacity: 0; transform: scale(.4) rotate(90deg); } }
.bk-shimmer { opacity: 0; }
.beaker.is-shimmer .bk-shimmer { animation: shimmer .9s ease-in-out; }
@keyframes shimmer { 0% { transform: translateX(0); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateX(330px); opacity: 0; } }

.is-shaking { animation: shake .25s linear; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }

/* ---------------- home ---------------- */
.page-home { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.hero { position: relative; display: grid; place-items: center; width: 100%; padding: 12px 0 2px; }
.hero .beaker { height: clamp(150px, 28vh, 330px); height: clamp(150px, 28dvh, 330px); width: auto; }
.hero.is-loading .beaker { opacity: .55; }
.hero-bubbles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.hero-bubbles i {
  position: absolute; bottom: -20px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--bubble); border: 2px solid color-mix(in srgb, var(--liq-sky) 22%, transparent);
  animation: rise 9s linear infinite;
}
.hero-bubbles i:nth-child(1) { left: 12%; animation-delay: -1s; width: 18px; height: 18px; }
.hero-bubbles i:nth-child(2) { left: 26%; animation-delay: -5s; width: 10px; height: 10px; }
.hero-bubbles i:nth-child(3) { left: 74%; animation-delay: -3s; }
.hero-bubbles i:nth-child(4) { left: 86%; animation-delay: -7s; width: 22px; height: 22px; }
.hero-bubbles i:nth-child(5) { left: 64%; animation-delay: -8.5s; width: 9px; height: 9px; }
@keyframes rise { from { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } to { transform: translateY(-360px); opacity: 0; } }
.hero-missing { padding: 30px 0 10px; }
.missing-bob { width: 150px; height: auto; }

.home-title { font: 700 clamp(28px, 7.4vw, 36px)/1.08 var(--font-display); letter-spacing: -.01em; max-width: 16ch; text-wrap: balance; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px 6px 10px;
  border-radius: var(--r-pill); background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow-1);
  font: 600 15px var(--font-display);
}
/* A finished glass is marked by a check and a flatter chip, never by dimming text below AA. */
.chip.is-done { background: var(--surface-2); box-shadow: none; }
.chip.is-done .chip-title { color: var(--muted); }
.chip-check { display: grid; place-items: center; width: 14px; height: 14px; }
.chip-check .ic { width: 16px; height: 16px; color: var(--ok-text); }
.chip-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--liq); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .14); }
.chip-size { font: 600 13px var(--font-ui); color: var(--muted); }
.chips-skel span { width: 104px; height: 40px; border-radius: var(--r-pill); background: var(--surface-3); animation: skel 1.2s ease-in-out infinite alternate; }
@keyframes skel { to { opacity: .45; } }
.home-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; margin-top: 6px; }
.btn-play { width: min(100%, 340px); }
.btn-play .ic { width: 18px; height: 18px; }
.home-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; }
/* Status notes (streak, freezes, relaxed): plain text, so they do not look like buttons. */
.meta-note { display: inline-flex; align-items: center; gap: 6px; font: 600 14px var(--font-ui); color: var(--muted); }
.meta-note .ic { width: 18px; height: 18px; color: var(--liq-sky); }
.home-title-error { font-size: clamp(22px, 6vw, 28px); max-width: 22ch; }
.banner {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; border-radius: var(--r-md);
  background: color-mix(in srgb, var(--brand) 22%, var(--surface)); border: 2px solid var(--brand);
  text-align: left; font: 600 16px/1.3 var(--font-display);
}
.banner-bob { width: 54px; height: auto; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 8px; margin-top: 18px; color: var(--muted); }

/* ---------------- glass screen ---------------- */
body[data-screen="glass"] main { padding-top: env(safe-area-inset-top); }
.g-wrap { position: relative; max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.g-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; }
.g-meta { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; min-width: 0; font: 600 15px var(--font-ui); color: var(--muted); }
.g-meta > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.g-head { min-width: 0; }
.g-tools { display: flex; align-items: center; gap: 4px; }
.pill-relaxed { min-height: 32px; font-size: 13px; }
.timer { position: relative; width: 48px; height: 48px; display: grid; place-items: center; }
.timer svg { position: absolute; inset: 0; width: 48px; height: 48px; }
.timer-track { fill: none; stroke: var(--line); stroke-width: 4; }
.timer-ring { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; transition: stroke .3s; }
.timer-n { position: relative; font: 800 15px var(--font-ui); font-variant-numeric: tabular-nums; }
.timer.is-warn .timer-ring { stroke: var(--danger); }
.timer.is-warn .timer-n { color: var(--danger-text); }

.g-main { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.g-left { display: flex; flex-direction: column; gap: 6px; }
.g-prompt { display: grid; gap: 2px; }
.g-title { font: 700 26px/1.1 var(--font-display); letter-spacing: -.01em; }
.g-brim { font: 600 15px var(--font-ui); color: var(--muted); }
.g-zone { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px; }
.g-beaker { display: grid; place-items: center; padding-top: 4px; }
.g-beaker .beaker { height: clamp(220px, 38vh, 420px); width: auto; max-width: 64vw; }
.g-readout { display: grid; gap: 4px; align-content: center; min-width: 0; padding-bottom: 8px; }
.ro-label { font: 700 13px var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ro-sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; min-width: 0; }
.ro-num { display: inline-block; font: 800 44px/1 var(--font-ui); font-variant-numeric: tabular-nums; letter-spacing: -.02em; white-space: nowrap; }
.ro-unit { font: 600 15px var(--font-ui); color: var(--muted); }
.ro-fill { font: 700 20px var(--font-ui); font-variant-numeric: tabular-nums; }
.ro-status {
  display: inline-flex; align-items: center; gap: 6px; justify-self: start; max-width: 100%;
  margin-top: 4px; padding: 5px 10px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--line);
  font: 600 14px/1.2 var(--font-ui);
}
.ro-ic:empty { display: none; }
.ro-ic .bi { width: 18px; height: 18px; display: block; }
.ro-status[data-phase="tense"] { border-color: var(--gold); }
.ro-status[data-phase="brimful"] { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, var(--surface)); }
.ro-status[data-phase="surface"] { border-color: var(--liq-sky); background: color-mix(in srgb, var(--liq-sky) 12%, var(--surface)); }
.ro-status[data-phase="spill"] { border-color: var(--danger); color: var(--danger-text); }
.g-wrap[data-phase="spill"] .ro-num, .g-wrap[data-phase="spill"] .ro-fill { color: var(--danger-text); }

.g-right { display: flex; flex-direction: column; gap: 10px; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.card {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 9px 8px 9px 12px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left;
  box-shadow: 0 3px 0 var(--line);
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), border-color .15s, background-color .25s;
}
.card:hover:not([aria-disabled="true"]) { border-color: color-mix(in srgb, var(--liq) 60%, var(--line)); }
.card:active:not([aria-disabled="true"]) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.card-text { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; min-width: 0; }
.cards { container-type: inline-size; }
/* Phone-width grids: the value becomes a sticker on the card's corner so labels keep the full width.
   Rules are scoped under .cards so they beat the base .card-val rule below and the media-query .card
   paddings. The top padding keeps a band for the sticker (it ends 16px below the card's top edge), so a
   long label such as "Scrambled eggs", or "Kingston" next to "12,914 ✓", is never covered. */
@container (max-width: 420px) {
  .cards .card { padding-top: 14px; padding-bottom: 6px; padding-right: 12px; }
  .cards .card-val {
    position: absolute; top: -10px; right: -5px; height: 24px; min-width: 30px; padding: 0 7px; gap: 1px;
    border: 1.5px solid var(--line); border-radius: 9px; font-size: 15px; box-shadow: 0 2px 0 var(--line);
  }
  .cards .card-val .ic { width: 13px; height: 13px; }
}
.card-label { font: 600 17px/1.15 var(--font-display); overflow-wrap: break-word; hyphens: auto; }
.card-label.is-long { font-size: 15.5px; }
.card-sub { font: 400 13px/1.25 var(--font-ui); color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: break-word; }
.card-val {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: 36px; height: 36px; padding: 0 6px;
  border-radius: 10px; background: var(--glass); font: 700 17px var(--font-display); font-variant-numeric: tabular-nums;
}
.card-q { color: var(--muted); }
.card-val .ic { width: 16px; height: 16px; color: var(--ok-text); }
.card-key { display: none; }
.card.is-lift { transform: translateY(-6px) scale(1.02); box-shadow: 0 10px 18px -8px rgba(19, 34, 58, .35); border-color: var(--liq); }
.card.is-poured {
  border-color: var(--liq); box-shadow: none;
  background: var(--surface-2); background: color-mix(in srgb, var(--liq) 15%, var(--surface));
}
.card.is-poured .card-val, .card.is-shown .card-val { background: var(--surface); border: 1.5px solid var(--line); animation: flip .32s var(--ease-out) both; animation-delay: var(--d, 0ms); }
.card.is-poured .card-val { border-color: var(--liq); }
.card.is-shown { color: var(--ink); }
.card.is-shown .card-val { border-style: dashed; }
.card.is-best { box-shadow: 0 0 0 3px var(--gold); border-color: var(--gold); }
@keyframes flip { 0% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
.g-hint { display: none; text-align: center; font-size: 13px; color: var(--muted); }

.g-stopbar {
  position: sticky; bottom: 0; z-index: 2; margin-top: auto;
  padding: 10px 0 calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 26%);
}
.btn-stop {
  width: 100%; min-height: 56px; border: 0; border-radius: 16px;
  background: var(--ink); color: var(--bg); font: 700 20px var(--font-display); letter-spacing: .03em;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--ink) 60%, #000); transition: transform .1s, box-shadow .1s, background-color .2s;
}
.btn-stop:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 color-mix(in srgb, var(--ink) 60%, #000); }
.btn-stop:disabled { background: var(--surface-3); color: var(--muted); box-shadow: none; font-size: 17px; letter-spacing: .01em; }

/* intro overlay */
.g-intro { position: fixed; inset: 0; z-index: 8; display: grid; place-items: center; background: var(--veil); animation: fadeIn .2s ease-out both; }
.g-intro.is-out { animation: fadeOut .26s ease-in both; }
.g-intro-card {
  width: min(86%, 340px); padding: 22px 20px 20px; border-radius: var(--r-lg); background: var(--surface); text-align: center;
  box-shadow: var(--shadow-2); border-top: 8px solid var(--liq); animation: pop .42s var(--ease-pop) both;
}
.gi-k { font: 700 14px var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.gi-t { margin-top: 6px; font: 700 30px/1.1 var(--font-display); }
.gi-b { margin-top: 8px; font: 600 17px var(--font-ui); }
@keyframes pop { from { transform: scale(.82); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }

/* result sheet */
.sheet {
  scrollbar-width: thin;
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; margin: 0 auto; width: 100%; max-width: 540px;
  max-height: 80vh; max-height: 80dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 6px 18px calc(18px + env(safe-area-inset-bottom));
  background: var(--surface); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-3);
  transform: translateY(105%); transition: transform .38s var(--ease-out);
  display: flex; flex-direction: column; gap: 10px;
}
.sheet.is-in { transform: translateY(0); }
.sheet.is-instant { transition: none; }
.sheet-grip { width: 44px; height: 5px; margin: 4px auto 0; border-radius: 3px; background: var(--line); flex: none; }
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-ic { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); color: var(--ink); }
.sheet-ic .bi { width: 32px; height: 32px; }
.out-brimful .sheet-ic { background: color-mix(in srgb, var(--gold) 22%, var(--surface)); }
.out-surface .sheet-ic { background: color-mix(in srgb, var(--liq-sky) 16%, var(--surface)); }
.out-spill .sheet-ic { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
.sheet-title { font: 700 26px/1.1 var(--font-display); }
.out-spill .sheet-title { color: var(--danger-text); }
.sheet-sub { font-size: 14px; color: var(--muted); }
.reveal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rv {
  display: flex; align-items: center; gap: 6px; min-height: 42px; padding: 5px 10px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--surface); animation: flipIn .36s var(--ease-out) both; animation-delay: var(--d, 0ms);
}
.rv-label { flex: 1; min-width: 0; font: 600 15px/1.15 var(--font-display); overflow-wrap: break-word; hyphens: auto; }
.reveal { container-type: inline-size; }
@container (max-width: 400px) {
  .rv { flex-wrap: wrap; row-gap: 2px; padding-top: 6px; padding-bottom: 6px; }
  .rv-label { flex-basis: 100%; }
  .rv-val { flex: 1; }
}
.rv-val { font: 800 15px var(--font-ui); font-variant-numeric: tabular-nums; }
.rv-mark { display: inline-flex; width: 18px; }
.rv-mark .ic { width: 16px; height: 16px; color: var(--ok-text); }
.rv.is-mine { background: var(--surface-2); background: color-mix(in srgb, var(--liq) 14%, var(--surface)); border-color: var(--liq); }
.rv.is-best { box-shadow: 0 0 0 3px var(--gold); border-color: var(--gold); }
@keyframes flipIn { from { transform: rotateX(80deg); opacity: 0; } to { transform: rotateX(0); opacity: 1; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-you .ic { width: 14px; height: 14px; color: var(--ok-text); }
.lg-best::before { content: ""; width: 14px; height: 14px; border-radius: 4px; box-shadow: 0 0 0 2.5px var(--gold); }
.best-line { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: start; gap: 4px 8px; font: 600 15px/1.35 var(--font-ui); }
.best-line .bi { width: 20px; height: 20px; margin-top: 1px; }
.best-line .pill { grid-column: 2; justify-self: start; }
.bot-line {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 8px 6px 8px 10px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid var(--line);
}
.bot-line p { font-size: 15px; line-height: 1.35; }
.bot-mini .beaker { height: 50px; width: auto; }
.bot-ava { width: 38px; height: 38px; }
.bot-name { font-weight: 700; white-space: nowrap; }
.why { font-size: 15px; line-height: 1.45; display: grid; gap: 2px; justify-items: start; }
.why .src-link { flex-wrap: nowrap; min-height: 32px; padding: 4px 0; }
.why-k { display: block; font: 700 13px var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.src-link { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-height: 44px; padding: 6px 0; font-size: 13px; color: var(--muted); text-underline-offset: 3px; overflow-wrap: anywhere; }
.src-link .nowrap { display: inline-flex; align-items: center; gap: 4px; }
.src-link .ic { width: 14px; height: 14px; }
.btn-next { width: 100%; flex: none; position: sticky; bottom: 0; box-shadow: 0 4px 0 var(--brand-deep), 0 -24px 24px -6px var(--surface); }
.btn-next .ic { width: 20px; height: 20px; }

/* ---------------- summary ---------------- */
.page-summary { display: flex; flex-direction: column; gap: 14px; }
.sum-title { display: grid; justify-items: center; gap: 0; margin-top: 4px; text-align: center; }
.sum-total { font: 700 72px/1 var(--font-display); letter-spacing: -.02em; }
.sum-total small { font-size: 28px; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.sum-tier { font: 600 26px/1.15 var(--font-display); }
.minis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mini {
  display: grid; justify-items: center; gap: 2px; padding: 10px 6px 12px; border-radius: 18px;
  background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow-1); text-align: center; min-width: 0;
}
.mini-glass .beaker { height: 104px; width: auto; }
.mini-score { font: 800 28px/1.1 var(--font-ui); font-variant-numeric: tabular-nums; margin-top: 4px; }
.mini-badge { display: inline-flex; align-items: center; gap: 4px; font: 600 13px var(--font-ui); }
.mini-badge .bi { width: 16px; height: 16px; }
.mini { align-content: start; }
.mini-badge { min-height: 2.4em; align-items: center; }
.mini-title { font-size: 13px; line-height: 1.2; color: var(--muted); max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; text-align: center; }
.mini.out-spill .mini-score { color: var(--danger-text); }

.block { padding: 16px; border-radius: 18px; background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow-1); }
.block-h { font: 700 20px/1.2 var(--font-display); margin-bottom: 10px; }
.block-h3 { font: 700 17px/1.2 var(--font-display); margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
.vs { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.vs-bot { width: 48px; height: 48px; }
.vs-line { font: 600 17px/1.35 var(--font-ui); }
.vs-verdict { margin-top: 2px; font: 700 16px var(--font-display); }
.vs-line b { font-weight: 800; font-variant-numeric: tabular-nums; }
.vs-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.vs-sub:empty { display: none; }
.challenge-cmp { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.cmp-line { font: 700 18px var(--font-display); }
.cmp-same { margin-top: 6px; font-weight: 600; }
.share-row { display: flex; flex-wrap: wrap; gap: 10px; }
.share-row .btn { flex: 1 1 140px; padding: 0 14px; gap: 6px; font-size: 16px; white-space: nowrap; }
.challenge-box .block-h3 { margin-top: 18px; }
.challenge-box .field { margin-top: 4px; }
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; text-align: center; padding: 12px 6px; border-radius: 18px; background: var(--surface-2); border: 1.5px solid var(--line); }
.strip b { display: block; font: 800 22px/1.2 var(--font-ui); font-variant-numeric: tabular-nums; }
.strip span { font-size: 13px; color: var(--muted); line-height: 1.2; display: block; }
.crowd-text { color: var(--muted); }
.countdown { display: flex; align-items: center; justify-content: center; gap: 8px; font: 600 16px var(--font-ui); font-variant-numeric: tabular-nums; }
.countdown .ic { width: 18px; height: 18px; color: var(--liq-sky); }
.sum-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ---------------- archive + sources ---------------- */
.page-head { display: flex; align-items: center; gap: 6px; margin: 4px 0 8px -10px; }
.page-head h1 { font: 700 30px/1.1 var(--font-display); }
.lead { color: var(--muted); margin-bottom: 14px; }
.arch-list { display: grid; gap: 8px; }
.arch-item {
  width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  min-height: 56px; padding: 10px 12px 10px 16px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--surface); text-align: left; box-shadow: var(--shadow-1);
}
.arch-item:hover { border-color: var(--muted); }
.a-n { font: 700 18px var(--font-display); min-width: 2.6em; font-variant-numeric: tabular-nums; }
.a-date { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-score { display: inline-flex; align-items: center; gap: 4px; font: 600 14px var(--font-ui); }
.a-score .bi { width: 16px; height: 16px; color: var(--ok-text); }
.arch-item.is-none .a-score { color: var(--muted); }
.arch-item .ic { width: 18px; height: 18px; color: var(--muted); }
.empty { display: grid; justify-items: center; gap: 10px; padding: 30px 0; text-align: center; color: var(--muted); }
.empty-bob { width: 110px; height: auto; }

.page-sources { display: flex; flex-direction: column; gap: 14px; }
.page-sources .lead { margin-bottom: 0; }
.src-cards { display: grid; gap: 10px; }
.src-card { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.src-name { font: 600 16px/1.3 var(--font-display); }
.src-tech { margin-top: 2px; }
.src-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 8px 0; font-size: 14px; }
.src-meta div { display: contents; }
.src-meta dt { color: var(--muted); white-space: nowrap; }
.src-meta dd { font-weight: 600; min-width: 0; }
.src-meta dd a { text-underline-offset: 3px; }
.src-url { color: var(--muted); }
.bot-row { display: flex; gap: 14px; align-items: flex-start; }
.bot-mid { width: 56px; height: 56px; }
.rule { font-size: 15px; line-height: 1.5; padding-left: 12px; border-left: 4px solid var(--liq-teal); }
.honesty { list-style: decimal; padding-left: 22px; display: grid; gap: 8px; }
.honesty li::marker { font-weight: 700; color: var(--muted); }
.root { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; margin-bottom: 8px; }
.commit-list { display: grid; gap: 6px; }
.commit-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.c-n { font: 700 16px var(--font-display); min-width: 34px; }
.c-d { color: var(--muted); font-size: 14px; }
.c-h { color: var(--muted); }
.c-res { font-weight: 700; font-size: 14px; }
.c-res.is-ok { color: var(--ok-text); }
.c-res.is-bad { color: var(--danger-text); }
.corrections { display: grid; gap: 6px; }
#privacy:focus-visible { outline: 3px solid var(--focus); }

/* ---------------- dialogs ---------------- */
/* The card is opaque from its first frame (only the backdrop fades) and has a visible edge in both themes. */
.dlg {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--dlg-edge); border-radius: var(--r-lg); background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5), 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden;
}
.dlg[open] { animation: dlgIn .28s var(--ease-out); }
/* ::backdrop inherits custom properties only in recent browsers: the fallback keeps older ones dimmed. */
.dlg::backdrop { background: var(--veil, rgba(8, 14, 26, .6)); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.dlg[open]::backdrop { animation: fadeIn .2s ease-out; }
@keyframes dlgIn { from { transform: translateY(16px) scale(.97); } to { transform: none; } }
.dlg-inner { max-height: inherit; overflow-y: auto; overscroll-behavior: contain; padding: 14px 20px 22px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -8px 6px 0; }
.dlg-title { font: 700 24px/1.2 var(--font-display); }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.dlg-links { margin-top: 10px; color: var(--muted); }

/* tutorial */
.tut-stage { position: relative; height: 230px; display: flex; align-items: center; justify-content: center; gap: clamp(8px, 3vw, 18px); padding: 0 10px; margin: 6px 0 10px; border-radius: 18px; background: var(--surface-2); overflow: hidden; }
.tut-art .beaker { height: min(200px, 46vw); width: auto; }
.tut-rise .bk-liq { animation: tutLiq 3.2s var(--ease-pop) infinite; }
.tut-rise .bk-bob { animation: tutBob 3.2s var(--ease-pop) infinite; }
@keyframes tutLiq { 0%, 28% { transform: translate(0, 256.8px); } 52%, 92% { transform: translate(0, 166px); } 100% { transform: translate(0, 256.8px); } }
@keyframes tutBob { 0%, 28% { transform: translate(92px, 256.8px); } 52%, 92% { transform: translate(92px, 166px); } 100% { transform: translate(92px, 256.8px); } }
.tut-card {
  display: grid; gap: 6px; justify-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface);
  border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); animation: tutTap 3.2s ease-in-out infinite;
}
.tc-l { font: 600 15px var(--font-display); }
.tc-v { position: relative; display: grid; place-items: center; width: 44px; height: 36px; border-radius: 10px; background: var(--glass); font: 700 17px var(--font-display); }
.tc-v b { grid-area: 1 / 1; }
.tc-q { animation: tutQ 3.2s steps(1) infinite; }
.tc-n { opacity: 0; animation: tutN 3.2s steps(1) infinite; }
@keyframes tutTap { 0%, 12% { transform: none; } 18% { transform: translateY(-6px) scale(1.04); } 28%, 100% { transform: none; } }
@keyframes tutQ { 0%, 24% { opacity: 1; } 25%, 95% { opacity: 0; } 96% { opacity: 1; } }
@keyframes tutN { 0%, 24% { opacity: 0; } 25%, 95% { opacity: 1; } 96% { opacity: 0; } }
.tut-dome .bk-dome { animation: domeWobble 1.6s ease-out infinite; }
.tut-note { display: grid; gap: 4px; justify-items: center; font: 600 15px var(--font-ui); }
.tut-note span { display: inline-flex; align-items: center; gap: 6px; text-align: center; }
.tut-note .bi { width: 20px; height: 20px; }
.tn-big { font: 700 34px var(--font-display); }
.tut-scores { display: grid; gap: 8px; font: 600 15px var(--font-ui); }
.tut-scores li { display: flex; align-items: center; gap: 8px; }
.tut-scores li span { white-space: nowrap; }
.tut-scores .bi { width: 20px; height: 20px; }
.tut-step { font: 700 13px var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tut-text { margin-top: 4px; font: 600 19px/1.35 var(--font-display); min-height: calc(3 * 1.35em); }
.tut-dots { display: flex; gap: 6px; margin-top: 8px; }
.tut-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: width .2s, background-color .2s; }
.tut-dots i.on { width: 22px; border-radius: 4px; background: var(--ink); }

/* stats */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.stat-grid div { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.stat-grid dt { font-size: 13px; color: var(--muted); }
.stat-grid dd { font: 800 22px/1.25 var(--font-ui); font-variant-numeric: tabular-nums; }
.risk { margin-top: 10px; font-weight: 600; }
.hist { display: grid; gap: 4px; }
.hist li { display: grid; grid-template-columns: 64px minmax(0, 1fr) 28px; align-items: center; gap: 8px; font-size: 13px; }
.h-lab { color: var(--muted); font-variant-numeric: tabular-nums; }
.h-bar { height: 16px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.h-bar i { display: block; height: 100%; width: var(--w, 0%); min-width: 0; border-radius: 6px; background: var(--brand); }
.hist li.is-today .h-bar i { background: var(--ink); }
.hist li.is-today .h-lab, .hist li.is-today .h-n { color: var(--ink); font-weight: 700; }
.h-n { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.wlt { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.wlt span { color: var(--muted); }
.stats .muted.small { margin-top: 12px; display: flex; gap: 6px; }
.stats .muted.small .ic { width: 16px; height: 16px; margin-top: 2px; }

/* settings */
.seg { border: 0; padding: 0; margin: 14px 0; }
.seg legend { font: 600 15px var(--font-ui); margin-bottom: 8px; padding: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg legend { width: 100%; }
.seg-opt { position: relative; flex: 1 1 0; min-width: 88px; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt span {
  display: grid; place-items: center; min-height: 44px; padding: 0 10px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--bg); font: 600 15px var(--font-ui);
}
.seg-opt input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.switch-row.is-disabled { opacity: .6; cursor: default; }
.sw-text { display: grid; gap: 2px; }
.sw-label { font: 600 15px var(--font-ui); }
.sw-hint { font-size: 13px; color: var(--muted); }
.switch-row input { position: absolute; opacity: 0; width: 52px; height: 32px; right: 0; margin: 0; cursor: inherit; }
.sw { position: relative; width: 52px; height: 32px; flex: none; border-radius: 16px; background: var(--surface-3); border: 2px solid var(--field-line); transition: background-color .2s; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--muted); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s var(--ease-out); }
.switch-row input:checked + .sw { background: var(--switch-on); border-color: var(--switch-on); }
.switch-row input:checked + .sw::after { background: #fff; }
.switch-row input:checked + .sw::after { transform: translateX(20px); }
.switch-row input:focus-visible + .sw { outline: 3px solid var(--focus); outline-offset: 2px; }
.transfer .share-row { margin-top: 8px; }
.tr-export { display: grid; gap: 8px; margin-top: 10px; justify-items: start; }
.tr-confirm { margin-top: 10px; padding: 12px; border-radius: 12px; border: 2px solid var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.tr-confirm p { font-weight: 600; margin-bottom: 8px; }

/* pourbot + story dialogs */
.bot-hero { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }
.bot-big { width: 84px; height: 84px; }
.bot-rule .lead { margin-bottom: 10px; color: var(--ink); font-weight: 600; }
.story-prev { display: grid; place-items: center; min-height: 200px; margin-top: 6px; }
.story-prev img { width: auto; max-width: 100%; max-height: 58vh; max-height: 58dvh; border-radius: 14px; box-shadow: var(--shadow-2); }

/* ---------------- toasts ---------------- */
.toasts { position: fixed; z-index: 60; left: 0; right: 0; bottom: calc(86px + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  max-width: 420px; padding: 10px 16px; border-radius: 14px; background: var(--ink); color: var(--bg);
  font: 600 15px/1.35 var(--font-ui); box-shadow: var(--shadow-2); animation: toastIn .25s var(--ease-out) both; text-align: center;
}
.toast.is-out { animation: fadeOut .3s ease-in both; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- larger screens ---------------- */
@media (hover: hover) and (pointer: fine) {
  .card-key {
    display: grid; place-items: center; position: absolute; left: -7px; top: -7px; width: 22px; height: 22px; border-radius: 50%;
    background: var(--ink); color: var(--bg); font: 700 13px/1 var(--font-ui);
  }
  .card[aria-disabled="true"] .card-key { display: none; }
  .g-hint { display: block; }
}

@media (min-width: 900px) {
  .topbar-in { max-width: 560px; }
  .page { max-width: 560px; }
  .g-wrap { max-width: 1100px; padding: 0 24px; }
  .g-head { min-height: 72px; }
  .g-main { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: center; }
  .g-left { gap: 14px; }
  .g-title { font-size: 36px; }
  .g-brim { font-size: 17px; }
  .g-beaker .beaker { height: clamp(320px, 56vh, 520px); max-width: none; }
  .g-zone { gap: 16px; }
  .g-right { gap: 14px; }
  .cards { gap: 14px; }
  .card { min-height: 84px; padding: 12px 12px 12px 16px; }
  .card-label { font-size: 19px; }
  .card-sub { font-size: 14px; }
  .card-val { min-width: 42px; height: 42px; font-size: 19px; }
  .g-stopbar { position: static; background: none; padding: 4px 0 0; margin-top: 0; }
  .sheet {
    left: auto; right: max(24px, calc((100vw - 1100px) / 2 + 24px)); bottom: 24px; width: min(500px, 44vw);
    max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); border-radius: 26px; box-shadow: var(--shadow-2), 0 0 0 1px var(--line);
    transform: translateY(30px); opacity: 0; transition: transform .38s var(--ease-out), opacity .3s;
  }
  .sheet.is-in { transform: none; opacity: 1; }
  .sheet-grip { display: none; }
  .g-wrap.has-sheet .g-right { visibility: hidden; }
  .card-label.is-long { font-size: 17px; }
  .hero .beaker { height: clamp(200px, 30vh, 320px); }
  .toasts { bottom: 32px; }
}

/* Short screens (iPhone SE, 320x700, laptops at 800 px): keep the Play button above the fold and the
   result sheet's "Why it's tricky" reachable. */
@media (max-height: 760px) {
  .hero { padding-top: 0; }
  .page-home { gap: 10px; }
  .hero-bubbles { display: none; }
  .sheet { max-height: 90vh; max-height: 90dvh; }
  .rv { min-height: 34px; padding-block: 3px; }
  .sheet-ic { width: 40px; height: 40px; }
}

@media (max-height: 700px) and (max-width: 899px) {
  .g-head { min-height: 48px; }
  .g-title { font-size: 22px; }
  .card { min-height: 56px; padding-top: 6px; padding-bottom: 6px; }
  .cards { gap: 8px; }
  .g-beaker .beaker { height: clamp(200px, 34vh, 420px); }
}

@media (max-width: 360px) {
  :root { --gutter: 12px; }
  .tut-stage { height: 200px; }
  .tut-scores { font-size: 14px; }
  .tut-stage { padding: 0 6px; }
  .tut-stage:not([data-step="1"]) .tut-art .beaker { height: min(150px, 40vw); }
  .tut-text { font-size: 17px; }
  .pill-relaxed > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .card-label { font-size: 16px; }
  .sum-total { font-size: 60px; }
  .mini-score { font-size: 24px; }
  .strip b { font-size: 19px; }
}

/* ---------------- reduced motion (system or the settings override) ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 150ms !important; transition-property: opacity, background-color, color, border-color !important; }
  .bob-float, .bob-tilt, .bk-wave, .hero-bubbles i, .bk-drop, .tut-rise .bk-liq, .tut-rise .bk-bob, .tut-card, .bob .bob-sweat { animation: none !important; }
  .sheet { transform: none !important; opacity: 0; }
  .sheet.is-in { opacity: 1; }
  .is-shaking { animation: none !important; }
  .tc-q { display: none; } .tc-n { opacity: 1; animation: none !important; }
}
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after {
  animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important;
  transition-duration: 150ms !important; transition-property: opacity, background-color, color, border-color !important;
}
:root[data-motion="reduce"] .bob-float, :root[data-motion="reduce"] .bob-tilt, :root[data-motion="reduce"] .bk-wave,
:root[data-motion="reduce"] .hero-bubbles i, :root[data-motion="reduce"] .bk-drop, :root[data-motion="reduce"] .tut-rise .bk-liq,
:root[data-motion="reduce"] .tut-rise .bk-bob, :root[data-motion="reduce"] .tut-card, :root[data-motion="reduce"] .bob .bob-sweat,
:root[data-motion="reduce"] .is-shaking { animation: none !important; }
:root[data-motion="reduce"] .sheet { transform: none !important; opacity: 0; }
:root[data-motion="reduce"] .sheet.is-in { opacity: 1; }
:root[data-motion="reduce"] .tc-q { display: none; }
:root[data-motion="reduce"] .tc-n { opacity: 1; animation: none !important; }
