@font-face { font-family: "Fredoka"; src: url("../fonts/fredoka-latin-wght-normal.woff2") format("woff2"); font-weight: 300 700; font-display: block; }
@font-face { font-family: "VT323"; src: url("../fonts/vt323-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "Anton"; src: url("../fonts/anton-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: block; }

:root {
  --teal: #10b7a4; --teal-dark: #0b7f73; --cream: #fff6e3; --ink: #17202b; --orange: #ff7a1a; --red: #e5392f; --yellow: #ffd23f; --night: #0f1420;
  --ui: "Fredoka", "Trebuchet MS", "Segoe UI", "PingFang SC", "PingFang TC", "Hiragino Sans", "Apple SD Gothic Neo", "Microsoft YaHei", "Microsoft JhengHei", "Yu Gothic", "Malgun Gothic", "Noto Sans CJK SC", system-ui, sans-serif;
  --mono: "VT323", "Courier New", "PingFang SC", "PingFang TC", "Hiragino Sans", "Apple SD Gothic Neo", "Microsoft YaHei", "Microsoft JhengHei", "Yu Gothic", "Malgun Gothic", "Noto Sans CJK SC", monospace;
  --tall: "Anton", "Arial Narrow", Impact, "PingFang SC", "PingFang TC", "Hiragino Sans", "Apple SD Gothic Neo", "Microsoft YaHei", "Microsoft JhengHei", "Yu Gothic", "Malgun Gothic", "Noto Sans CJK SC", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --u: clamp(11px, 1.55vmin, 20px); /* one UI unit; every HUD size derives from it */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--cream); font-family: var(--ui); overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; touch-action: none; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; cursor: default; }
#stage.can-grab { cursor: grab; }
#stage.grabbing { cursor: grabbing; }
#stage.can-press { cursor: pointer; }
#stage.gun, #stage.gun.can-grab { cursor: crosshair; }

.ui { position: fixed; inset: 0; pointer-events: none; font-size: var(--u); }
.ui > * { pointer-events: none; }
.hidden { display: none !important; }

/* ---------- boot ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(120% 90% at 50% 40%, #1c2740 0%, #0b0f18 70%); z-index: 50; transition: opacity .5s ease; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-box { width: min(78vw, 460px); text-align: center; }
.boot-logo { font-family: var(--tall); font-size: clamp(34px, 8vmin, 72px); letter-spacing: .02em; color: var(--cream); text-shadow: 0 .06em 0 var(--red); }
.boot-bar { height: 10px; border-radius: 99px; background: rgba(255,255,255,.12); margin: 22px 0 12px; overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 4%; border-radius: 99px; background: linear-gradient(90deg, var(--teal), #7ef0d9); transition: width .25s ease; }
.boot-msg { font-size: 15px; opacity: .7; }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; opacity: 0; transition: opacity .35s ease; }
.hud.on { opacity: 1; }
.hud-top { position: absolute; left: calc(1.2em + var(--safe-l)); right: calc(1.2em + var(--safe-r)); top: calc(1em + var(--safe-t)); display: flex; align-items: flex-start; justify-content: space-between; gap: 1em; }
.pill { background: rgba(15,20,32,.78); border: .14em solid rgba(255,255,255,.14); border-radius: 1.2em; padding: .55em .95em; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 .4em 1.2em rgba(0,0,0,.35); }
.hud-day { display: flex; flex-direction: column; gap: .1em; min-width: 9.5em; }
.hud-day b { font-family: var(--tall); font-weight: 400; font-size: 1.7em; letter-spacing: .03em; line-height: 1; }
.hud-day span { font-size: .95em; opacity: .75; font-weight: 500; }
.hud-items { display: flex; gap: .22em; margin-top: .35em; flex-wrap: wrap; max-width: 12em; }
.hud-items i { width: .62em; height: .62em; border-radius: 50%; background: rgba(255,255,255,.22); transition: background .2s, transform .25s cubic-bezier(.34,1.56,.64,1); }
.hud-items i.done { background: var(--teal); transform: scale(1.15); }

.queue { flex: 1 1 auto; max-width: 34em; min-width: 12em; }
.queue-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; font-size: .95em; letter-spacing: .04em; text-transform: uppercase; margin-bottom: .35em; }
.queue-head em { font-style: normal; opacity: .75; text-transform: none; letter-spacing: 0; font-weight: 500; }
.queue-bar { position: relative; height: 1.25em; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; }
.queue-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 99px; background: linear-gradient(90deg, #2bd97c, #9be15d); transform-origin: left center; transition: background .4s; }
.queue.warn .queue-fill { background: linear-gradient(90deg, #ffb020, #ffd23f); }
.queue.danger .queue-fill { background: linear-gradient(90deg, #e5392f, #ff7a1a); }
.queue.danger { animation: throb .55s ease-in-out infinite alternate; }
.queue-faces { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-around; padding: 0 .4em; font-size: .78em; font-weight: 700; color: rgba(15,20,32,.75); letter-spacing: .02em; }
@keyframes throb { to { transform: scale(1.025); } }

.hud-score { text-align: right; min-width: 9.5em; }
.hud-score b { display: block; font-family: var(--tall); font-weight: 400; font-size: 1.9em; line-height: 1; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.hud-score span { font-size: .9em; opacity: .7; font-weight: 500; }
/* frenzy meter: fills with clean scans */
.fever { margin-top: .45em; display: flex; align-items: center; gap: .4em; justify-content: flex-end; font-weight: 700; font-size: .8em; letter-spacing: .06em; }
.fever-bar { width: 6.2em; height: .62em; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.fever-bar i { display: block; height: 100%; width: 100%; transform-origin: left center; transform: scaleX(0); border-radius: 99px; background: linear-gradient(90deg, #ffbe0b, #ff006e); transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.fever.hot { color: var(--yellow); animation: throb .3s ease-in-out infinite alternate; }
.fever.hot .fever-bar i { background: linear-gradient(90deg, #fff, #ffbe0b, #ff006e, #8338ec); }

/* a strip under the queue bar for whatever is going on right now: a glitch, a bet, a boss */
.eventbar { position: absolute; left: 50%; top: calc(6.2em + var(--safe-t)); transform: translate(-50%, -.6em); width: min(30em, 88vw); padding: .45em .8em .55em; border-radius: 1em; background: rgba(15,20,32,.88); border: .14em solid rgba(255,255,255,.16); opacity: 0; transition: opacity .2s, transform .2s; }
.eventbar.on { opacity: 1; transform: translate(-50%, 0); }
.eventbar b { display: flex; justify-content: space-between; gap: 1em; font-weight: 700; font-size: .95em; letter-spacing: .05em; text-transform: uppercase; margin-bottom: .3em; }
.eventbar b em { font-style: normal; opacity: .8; font-variant-numeric: tabular-nums; }
.eventbar .bar { height: .7em; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.eventbar .bar i { display: block; height: 100%; width: 100%; transform-origin: left center; border-radius: 99px; background: var(--yellow); }
.eventbar.glitch { border-color: #ff3b30; } .eventbar.glitch .bar i { background: linear-gradient(90deg, #ff3b30, #ff7a1a); }
.eventbar.fever { border-color: #ff006e; } .eventbar.fever .bar i { background: linear-gradient(90deg, #ffbe0b, #ff006e, #8338ec); }
.eventbar.bet { border-color: var(--yellow); }
.eventbar.boss { border-color: #b517ff; } .eventbar.boss .bar i { background: linear-gradient(90deg, #b517ff, #ff3b30); }
.eventbar.last { border-color: #fff; animation: throb .25s ease-in-out infinite alternate; } .eventbar.last .bar i { background: #fff; }

.streak { display: inline-block; margin-top: .3em; padding: .12em .6em; border-radius: 99px; background: var(--yellow); color: var(--ink); font-weight: 700; font-size: .95em; transform: scale(0); transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.streak.on { transform: scale(1); }
.streak.bump { animation: bump .28s cubic-bezier(.34,1.56,.64,1); }
@keyframes bump { 0% { transform: scale(1.5) rotate(-6deg); } 100% { transform: scale(1) rotate(0); } }

.hud-btn { pointer-events: auto; position: absolute; right: calc(1.2em + var(--safe-r)); bottom: calc(1.2em + var(--safe-b)); display: flex; gap: .6em; }
.btn-round { pointer-events: auto; width: 3.4em; height: 3.4em; border-radius: 50%; border: .16em solid rgba(255,255,255,.2); background: rgba(15,20,32,.78); color: var(--cream); font: 600 1.25em var(--ui); display: grid; place-items: center; cursor: pointer; transition: transform .12s ease, background .2s; }
.btn-round:hover { background: rgba(30,40,62,.9); }
.btn-round:active { transform: scale(.92); }
.btn-round svg { width: 52%; height: 52%; }
.flip-btn { pointer-events: auto; position: absolute; left: calc(1.2em + var(--safe-l)); bottom: calc(1.2em + var(--safe-b)); display: none; align-items: center; gap: .5em; padding: .9em 1.4em; border-radius: 1.4em; border: .16em solid rgba(255,255,255,.25); background: var(--teal); color: #fff; font: 700 1.3em var(--ui); box-shadow: 0 .3em 0 var(--teal-dark); }
.flip-btn:active { transform: translateY(.2em); box-shadow: 0 .1em 0 var(--teal-dark); }
.touch .flip-btn.show { display: flex; }

.hint { position: absolute; left: 50%; bottom: calc(1.5em + var(--safe-b)); transform: translate(-50%, 1.2em); opacity: 0; transition: opacity .25s, transform .25s; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .35em .6em; padding: .6em 1.1em; border-radius: 1.2em; background: rgba(15,20,32,.86); border: .14em solid rgba(255,255,255,.16); font-weight: 600; font-size: 1.12em; width: max-content; max-width: 92vw; text-align: center; }
.hint.on { opacity: 1; transform: translate(-50%, 0); }
.key { flex: none; display: inline-grid; place-items: center; min-width: 1.9em; height: 1.7em; padding: 0 .45em; border-radius: .45em; background: var(--cream); color: var(--ink); font-weight: 700; font-size: .88em; box-shadow: 0 .16em 0 rgba(0,0,0,.35); }

/* what the machine is saying, for small screens and for anyone who wants subtitles */
.caption { position: absolute; left: 50%; bottom: calc(5.4em + var(--safe-b)); transform: translate(-50%, .8em); opacity: 0; transition: opacity .2s, transform .2s; display: flex; align-items: center; gap: .7em; width: max-content; max-width: min(92vw, 34em); padding: .55em 1em .6em .6em; border-radius: 1.1em; background: var(--cream); color: var(--ink); font-weight: 600; font-size: 1.12em; line-height: 1.22; box-shadow: 0 .4em 1.2em rgba(0,0,0,.4); }
.caption.on { opacity: 1; transform: translate(-50%, 0); }
.caption i { flex: none; width: 2em; height: 1.7em; border-radius: .5em; background: var(--teal); position: relative; }
.caption i::before, .caption i::after { content: ""; position: absolute; top: 28%; width: 18%; height: 34%; border-radius: 40%; background: #fff; }
.caption i::before { left: 22%; } .caption i::after { right: 22%; }
.caption.angry i { background: var(--red); } .caption.warn i { background: #f2a900; } .caption.evil i { background: #3b0a45; }

.heckle { position: absolute; padding: .5em .9em; border-radius: 1em 1em 1em .2em; background: var(--cream); color: var(--ink); font-weight: 600; font-size: 1.05em; box-shadow: 0 .3em .9em rgba(0,0,0,.35); transform-origin: left bottom; animation: heckle 2.6s ease forwards; white-space: nowrap; }
@keyframes heckle { 0% { opacity: 0; transform: scale(.5) translateY(.6em); } 10% { opacity: 1; transform: scale(1.06); } 16% { transform: scale(1); } 82% { opacity: 1; transform: translateY(-.4em); } 100% { opacity: 0; transform: translateY(-1em); } }
/* what a passer-by says: a bubble centred above their head */
.heckle.bubble { background: #fff; font-size: .95em; padding: .35em .75em; border-radius: 1em; transform-origin: center bottom; animation: bubble 2.3s ease forwards; pointer-events: none; }
@keyframes bubble { 0% { opacity: 0; transform: translate(-50%, -80%) scale(.5); } 10% { opacity: 1; transform: translate(-50%, -100%) scale(1.08); } 16% { transform: translate(-50%, -100%) scale(1); } 85% { opacity: 1; transform: translate(-50%, -115%); } 100% { opacity: 0; transform: translate(-50%, -135%); } }

/* small labels pinned to things in the world: where to drag, what to do next */
.marker { position: absolute; left: 0; top: 0; padding: .28em .7em .32em; border-radius: .7em; background: var(--yellow); color: var(--ink); font-weight: 700; font-size: 1.02em; letter-spacing: .03em; white-space: nowrap; box-shadow: 0 .25em .7em rgba(0,0,0,.4); opacity: 0; transition: opacity .18s; will-change: transform; }
.marker.on { opacity: 1; }
.marker::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -.42em; border: .42em solid transparent; border-top-color: var(--yellow); border-bottom: 0; }
.marker.warn { background: var(--orange); color: #fff; } .marker.warn::after { border-top-color: var(--orange); }
.marker.bad { background: var(--red); color: #fff; } .marker.bad::after { border-top-color: var(--red); }
.marker.good { background: #2bd97c; color: var(--ink); } .marker.good::after { border-top-color: #2bd97c; }

.pop { position: absolute; left: 0; top: 0; font-family: var(--tall); font-size: 1.9em; color: var(--yellow); text-shadow: 0 .08em 0 rgba(0,0,0,.55), 0 0 .5em rgba(0,0,0,.4); white-space: nowrap; will-change: transform, opacity; }
.pop.bad { color: #ff6b5e; }
/* a price tag: what the scanner gun says about things that are not groceries */
.pop.tagpop { font-size: 1.35em; color: var(--ink); background: var(--yellow); padding: .08em .5em .12em; border-radius: .28em; text-shadow: none; box-shadow: 0 .15em .5em rgba(0,0,0,.45); letter-spacing: .02em; }
.pop.big { font-size: 2.8em; color: #fff; }

.banner { position: absolute; left: 50%; top: 31%; transform: translate(-50%, -50%) scale(.6); opacity: 0; text-align: center; transition: opacity .2s, transform .35s cubic-bezier(.34,1.56,.64,1); }
.banner.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.banner b { display: block; font-family: var(--tall); font-weight: 400; font-size: 5.2em; line-height: .95; letter-spacing: .02em; color: #fff; text-shadow: 0 .07em 0 var(--red), 0 .3em .8em rgba(0,0,0,.5); }
.banner span { display: inline-block; margin-top: .5em; padding: .3em .9em; border-radius: 99px; background: rgba(15,20,32,.85); font-weight: 600; font-size: 1.25em; }
.banner p { margin: .7em auto 0; max-width: 22em; font-weight: 500; font-size: 1.2em; line-height: 1.3; color: var(--cream); text-shadow: 0 .1em .5em rgba(0,0,0,.8); }
.banner.alarm b { color: #ffe9e6; text-shadow: 0 .07em 0 #7a0c05, 0 0 1em rgba(229,57,47,.8); }
/* outcomes ("glitch fixed", "frenzy over") are told quietly, up under the status bars, so the machine's face stays in view */
.banner.minor { top: calc(11.3em + var(--safe-t)); }
.banner.minor b { font-size: 2.3em; text-shadow: 0 .06em 0 rgba(0,0,0,.55), 0 .2em .6em rgba(0,0,0,.5); }
.banner.minor span { margin-top: .25em; padding: .18em .7em; font-size: .98em; }
@media (min-aspect-ratio: 5/4) { .banner b { font-size: 4.5em; } .banner.minor b { font-size: 2.2em; } }

.flash { position: absolute; inset: 0; background: #fff; opacity: 0; mix-blend-mode: screen; }
.vign { position: absolute; inset: 0; box-shadow: inset 0 0 16em rgba(229,57,47,.0); transition: box-shadow .3s; }
.vign.alarm { box-shadow: inset 0 0 12em rgba(229,57,47,.55); }
.vign.hell { box-shadow: inset 0 0 13em rgba(170,8,0,.62); animation: hellpulse 2.6s ease-in-out infinite alternate; }
.vign.hell.alarm { animation: none; box-shadow: inset 0 0 12em rgba(229,57,47,.55); }
@keyframes hellpulse { to { box-shadow: inset 0 0 17em rgba(200,20,0,.75); } }

/* ---------- overlays (title, pause, results) ---------- */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: auto; opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility 0s linear .3s; padding: calc(1em + var(--safe-t)) calc(1em + var(--safe-r)) calc(1em + var(--safe-b)) calc(1em + var(--safe-l)); }
.overlay.on { opacity: 1; visibility: visible; transition: opacity .3s ease; }
.overlay.dim { background: radial-gradient(120% 90% at 50% 40%, rgba(15,20,32,.55), rgba(8,10,16,.9)); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.panel { width: min(92vw, 34em); background: var(--cream); color: var(--ink); border-radius: 1.6em; padding: 1.6em 1.7em 1.5em; box-shadow: 0 1.2em 3em rgba(0,0,0,.5), 0 .5em 0 #d8ccb2; text-align: center; transform: translateY(1.5em) scale(.96); transition: transform .4s cubic-bezier(.34,1.56,.64,1); }
.overlay.on .panel { transform: none; }
.panel h2 { margin: 0 0 .2em; font-family: var(--tall); font-weight: 400; font-size: 3em; letter-spacing: .02em; line-height: 1; }
.panel p { margin: .5em 0; font-size: 1.15em; font-weight: 500; line-height: 1.35; }
.panel .sub { opacity: .7; }
.btn { pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-width: 9em; padding: .75em 1.5em; border: 0; border-radius: 1.1em; background: var(--teal); color: #fff; font: 700 1.35em var(--ui); letter-spacing: .02em; cursor: pointer; box-shadow: 0 .28em 0 var(--teal-dark); transition: transform .1s ease, box-shadow .1s ease, filter .2s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(.18em); box-shadow: 0 .1em 0 var(--teal-dark); }
.btn:focus-visible, .btn-round:focus-visible, .flip-btn:focus-visible { outline: .2em solid var(--yellow); outline-offset: .15em; }
.btn.alt { background: #e9dfc8; color: var(--ink); box-shadow: 0 .28em 0 #c9bd9f; }
.btn.alt:active { box-shadow: 0 .1em 0 #c9bd9f; }
.btn.warn { background: var(--red); box-shadow: 0 .28em 0 #9b1f17; }
.btn-row { display: flex; gap: .8em; justify-content: center; flex-wrap: wrap; margin-top: 1.1em; }

.title { position: absolute; inset: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: calc(5vh + var(--safe-b)); opacity: 0; visibility: hidden; transition: opacity .4s, visibility 0s linear .4s; }
.title.on { opacity: 1; visibility: visible; transition: opacity .4s; }
.title-logo { position: absolute; top: calc(6vh + var(--safe-t)); left: 50%; transform: translateX(-50%) rotate(-2.5deg); text-align: center; width: max-content; max-width: 96vw; }
.title-logo b { display: block; font-family: var(--tall); font-weight: 400; font-size: clamp(42px, 12.5vmin, 150px); line-height: .9; letter-spacing: .015em; color: #fff; text-shadow: 0 .055em 0 var(--red), 0 .11em 0 #7a0c05, 0 .3em .6em rgba(0,0,0,.55); }
.title-logo span { display: inline-block; margin-top: .55em; padding: .22em .9em .28em; border-radius: 99px; background: var(--yellow); color: var(--ink); font-weight: 700; font-size: clamp(14px, 2.6vmin, 30px); transform: rotate(1.5deg); box-shadow: 0 .2em 0 rgba(0,0,0,.3); }
.title-cta { display: flex; flex-direction: column; align-items: center; gap: .9em; }
.title-cta .btn { font-size: 1.7em; min-width: 11em; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-.14em); } }
.title-note { font-size: 1.02em; font-weight: 500; opacity: .8; text-shadow: 0 .1em .4em #000; text-align: center; padding: 0 1em; }
.title-foot { position: absolute; left: calc(1em + var(--safe-l)); bottom: calc(.8em + var(--safe-b)); font-size: .85em; opacity: .5; }

.rank { display: inline-grid; place-items: center; width: 2.1em; height: 2.1em; border-radius: 50%; font-family: var(--tall); font-size: 3.2em; color: #fff; background: var(--orange); box-shadow: 0 .12em 0 rgba(0,0,0,.25); margin: .15em 0 .1em; transform: rotate(-8deg); }
.rank.S { background: linear-gradient(135deg, #ffb703, #fb5607); }
.rank.A { background: var(--teal); }
.rank.B { background: #4361ee; }
.rank.C { background: #6c757d; }
.stats { display: grid; grid-template-columns: 1fr auto; gap: .25em 1em; text-align: left; font-size: 1.12em; font-weight: 500; margin: .7em auto .2em; max-width: 19em; }
.stats dt { opacity: .75; }
.stats dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.receipt { font-family: var(--mono); font-size: 1.45em; line-height: 1.05; text-align: left; background: #fff; color: #222; padding: .8em 1em; border-radius: .3em; max-height: 38vh; overflow: auto; box-shadow: 0 .2em .8em rgba(0,0,0,.2); white-space: pre; }

.settings { display: grid; grid-template-columns: 1fr auto; gap: .6em 1em; align-items: center; text-align: left; font-size: 1.1em; font-weight: 600; margin: .9em 0 .2em; }
.settings input[type="range"] { width: 9em; accent-color: var(--teal); pointer-events: auto; }
.toggle { pointer-events: auto; width: 3.2em; height: 1.7em; border-radius: 99px; border: 0; background: #cfc5ad; position: relative; cursor: pointer; transition: background .2s; }
.toggle::after { content: ""; position: absolute; left: .2em; top: .2em; width: 1.3em; height: 1.3em; border-radius: 50%; background: #fff; transition: transform .2s cubic-bezier(.34,1.56,.64,1); box-shadow: 0 .1em .2em rgba(0,0,0,.3); }
.toggle[aria-pressed="true"] { background: var(--teal); }
.toggle[aria-pressed="true"]::after { transform: translateX(1.5em); }

@media (max-aspect-ratio: 9/10) {
  /* the top of the HUD is two rows here and the score pill grows with a streak: both strips sit clear of the patience bar */
  .eventbar { top: calc(14.2em + var(--safe-t)); }
  .banner.minor { top: calc(19.8em + var(--safe-t)); }
  .hud-top { flex-wrap: wrap; }
  .queue { order: 3; flex-basis: 100%; max-width: none; }
  .banner b { font-size: 3.6em; }
  .hint { bottom: calc(6.4em + var(--safe-b)); }
  .caption { bottom: 20vh; }
}
@media (prefers-reduced-motion: reduce) { .title-cta .btn, .queue.danger { animation: none; } }

/* controls card */
.controls { display: grid; gap: .45em; margin: .9em 0 .4em; text-align: left; }
.ctl { display: grid; grid-template-columns: minmax(9.5em, auto) 1fr; gap: .8em; align-items: center; font-size: 1.02em; }
.ctl .keys { display: flex; flex-wrap: wrap; align-items: center; gap: .3em; }
.ctl .keys i { font-style: normal; font-size: .8em; opacity: .65; }
.ctl kbd { font: 700 .92em var(--body, inherit); background: #fffaf0; color: var(--ink); border-radius: .45em; padding: .18em .55em; box-shadow: 0 .18em 0 #c9bd9f; white-space: nowrap; }
.ctl .what { opacity: .9; line-height: 1.25; }
@media (max-width: 520px) { .ctl { grid-template-columns: 1fr; gap: .2em; margin-bottom: .3em; } }
.title-cta .btn.small { font-size: 1.05em; min-width: 9em; padding: .5em 1.1em; animation: none; }
.title-cta { position: relative; }
.title-sound { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: .5em; white-space: nowrap; font-size: .95em; font-weight: 600; color: var(--yellow, #ffd23f); text-shadow: 0 .1em .4em #000; opacity: 0; visibility: hidden; transition: opacity .4s; pointer-events: none; }
.title-sound.on { opacity: 1; visibility: visible; }

/* secrets */
.secret-toast { position: absolute; left: calc(1em + var(--safe-l)); bottom: calc(5.4em + var(--safe-b)); z-index: 30; display: grid; gap: .1em; padding: .65em 1.1em .75em; max-width: min(22em, 80vw); border-radius: 1em; background: rgba(20,14,40,.94); border: .15em solid #ffd23f; box-shadow: 0 .5em 1.6em rgba(0,0,0,.45); pointer-events: none; opacity: 0; transform: translateX(-120%); transition: transform .45s cubic-bezier(.34,1.56,.64,1), opacity .3s; }
.secret-toast.on { opacity: 1; transform: none; }
.secret-toast b { font-size: .78em; letter-spacing: .12em; color: #ffd23f; }
.secret-toast strong { font-family: var(--tall); font-weight: 400; font-size: 1.6em; line-height: 1; letter-spacing: .02em; }
.secret-toast span { font-size: .92em; opacity: .85; }
.btn-row.tight { gap: .5em; }
.secrets { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5em, 1fr)); gap: .5em; margin: .8em 0 .5em; text-align: left; max-height: 52vh; overflow: auto; pointer-events: auto; padding-right: .3em; }
.secret { border-radius: .8em; padding: .55em .75em; background: #fffaf0; box-shadow: 0 .18em 0 #c9bd9f; }
.secret b { display: block; font-size: 1em; }
.secret span { display: block; font-size: .86em; opacity: .75; line-height: 1.25; margin-top: .15em; }
.secret.locked { background: #e9dfc8; }
.secret.locked b { letter-spacing: .2em; opacity: .55; }
.secret.locked span { opacity: .9; font-style: italic; }
.secret.got b::before { content: "★ "; color: #e0a100; }
.secrets-bar { height: .6em; border-radius: 99px; background: #e9dfc8; overflow: hidden; margin: .3em auto 0; max-width: 20em; }
.secrets-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd23f, #ff7a1a); }
.secret em.prog { display: block; margin-top: .3em; font-style: normal; font-weight: 600; font-size: .8em; color: #b5530a; line-height: 1.3; }
.howto { display: grid; gap: .55em; margin: .9em 0 .5em; text-align: left; max-height: 56vh; overflow: auto; pointer-events: auto; }
.howto .step { display: grid; grid-template-columns: 2.1em 1fr; gap: .7em; align-items: start; }
.howto .step > i { font-style: normal; display: grid; place-items: center; width: 2.1em; height: 2.1em; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 700; font-size: .95em; box-shadow: 0 .15em 0 rgba(0,0,0,.2); }
.howto .step:nth-child(4) > i { background: #e5392f; } .howto .step:nth-child(5) > i { background: #ff006e; } .howto .step:nth-child(6) > i { background: #3b0a45; }
.howto b { display: block; font-size: .98em; letter-spacing: .06em; }
.howto span { display: block; font-size: .93em; line-height: 1.3; opacity: .88; }

/* CJK: the tall display face has no CJK glyphs, and the system fallback is wider and needs weight and less tracking */
html.cjk .banner b, html.cjk .panel h2, html.cjk .hud-day b, html.cjk .pop, html.cjk .secret-toast strong { font-weight: 900; letter-spacing: 0; }
html.cjk .banner b { font-size: 4.2em; line-height: 1.1; }
html.cjk .panel h2 { font-size: 2.4em; line-height: 1.15; }
/* language picker */
.langs { display: grid; grid-template-columns: repeat(auto-fill, minmax(10em, 1fr)); gap: .5em; margin: .9em 0 .5em; }
.langs .btn { min-width: 0; font-size: 1.05em; padding: .6em .8em; }
.langs .btn.on { outline: .2em solid var(--orange, #ff7a1a); }
