/* תחרוז · a quiet room for a loud thing.
   Dark, flat surfaces; one accent (the Play button and what's selected); the graffiti logo and the
   rhyme-word stickers are the identity. Nothing tilts except the stickers, by a degree.
   Bar, 15/11: "less loud, not overwhelming, simple like the English app". */
:root {
  --bg: #121110;
  --surface: #1c1b19;
  --surface2: #262522;
  --surface3: #302f2b;
  --line: rgba(255, 255, 255, .08);
  --text: #f3f0ea;
  --muted: #a39e95;
  --dim: #6e6a63;
  --accent: #ffd84d;
  --pink: #ff5a98;
  --cyan: #5ee0ec;
  --yellow: #ffd84d;
  --white: #ece7dc;
  --rec: #ff4d4d;
  --brick: rgba(255, 255, 255, .045);
  --brick-hi: rgba(255, 255, 255, .09);
  --r: 14px;
  --wet: 'Rubik Wet Paint', 'Rubik', sans-serif;
  --marker: 'Karantina', 'Rubik', sans-serif;
  --font: 'Rubik', system-ui, sans-serif;
  --pop: cubic-bezier(.2, 1.5, .4, 1);
  --out: cubic-bezier(.2, .8, .3, 1);
  --spring: cubic-bezier(.3, 1.55, .5, 1);   /* a press springing back */
  --glide: cubic-bezier(.3, 1.25, .5, 1);    /* a thumb sliding to a segment: a little overshoot */
  --ios: cubic-bezier(.32, .72, 0, 1);       /* sheets and pushed screens, the iOS curve */
  --paper: radial-gradient(120% 60% at 50% -10%, rgba(255, 255, 255, .05), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E");
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; } /* no iOS text autosizing */
body {
  color: var(--text); font-family: var(--font); font-size: 16px; overflow: hidden;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  background-color: var(--bg); background-image: var(--paper);
}
button { font-family: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; font-size: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input { -webkit-user-select: text; user-select: text; }
bdi { unicode-bidi: isolate; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic .f, .ic path.f { fill: currentColor; stroke: none; }
[hidden] { display: none !important; }

/* ---------- touch: press, glow, ripples (touch.js) ---------- */
/* Pressed things shrink a touch (scale composes with any transform they have) and spring back on release. */
button, .tog, [data-press] { transition: scale .5s var(--spring); }
:is(button, .tog, [data-press]).pressing { scale: var(--ps, .95); transition-duration: .08s; transition-timing-function: ease-out; } /* beats any one-class rule */
/* A soft light where the finger is (--px, --py), fading out after the release. */
/* (no overflow: hidden: the light is inset 0 with the element's own radius, and clipping squeezed grid rows) */
:is(.go, .ghost, .daily, .item, .recopt, .tog, .optrow.more, .tappad, .recbtn, .icon, .streak, .metrochip, .wallcard, .step) { position: relative; }
:is(.go, .ghost, .daily, .item, .recopt, .tog, .optrow.more, .tappad, .recbtn, .icon, .streak, .metrochip, .wallcard, .step)::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .5s ease-out;
  background: radial-gradient(130px circle at var(--px, 50%) var(--py, 50%), var(--glow, rgba(255, 255, 255, .13)), transparent 70%);
}
.pressing::after { opacity: 1 !important; transition-duration: .05s !important; }
#touchfx { position: fixed; inset: 0; pointer-events: none; z-index: 16; overflow: hidden; }
#touchfx .rip { position: absolute; width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2); border-radius: 50%;
  border: 2.5px solid var(--c); animation: rip var(--ms) var(--out) forwards; }
#touchfx .rip.fill { border: 0; background: radial-gradient(circle, var(--c), transparent 70%); }
@keyframes rip { from { transform: scale(.15); opacity: 1; } to { transform: scale(1); opacity: 0; } }

/* ---------- splash / screens ---------- */
#splash { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; background: var(--bg); transition: opacity .35s; }
#splash .logo { animation: splashIn .6s var(--out) both; }
@keyframes splashIn { from { opacity: 0; transform: scale(.92); } }
body:not(.loading) #splash { opacity: 0; pointer-events: none; }
.screen {
  position: fixed; inset: 0; display: none; flex-direction: column; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  max-width: 520px; margin: 0 auto; height: 100dvh;
}
.screen.active, .screen.leaving, .screen.peeking { display: flex; }
.screen.leaving, .screen.peeking { pointer-events: none; }

/* Screen changes (touch.js, swapScreens). push / pop: the iOS stack mirrored for RTL, a pushed screen comes in
   from the left over the one below, which drifts right and dims; pop reverses it. The sliding screen carries
   the page's own background so it covers what is under it. -wide: short cross-fades on a computer. */
.screen[data-fx] { will-change: transform, opacity; }
.screen[data-fx^="in-"] { z-index: 2; }
.screen[data-fx="out-pop"], .screen.swiping { z-index: 3; }
.screen.peeking { z-index: 1; }
.screen[data-fx="in-push"], .screen[data-fx="out-pop"], .screen.swiping { background-color: var(--bg); background-image: var(--paper); box-shadow: 14px 0 40px rgba(0, 0, 0, .5); }
.screen[data-fx="in-push"] { animation: inPush .38s var(--ios) both; }
.screen[data-fx="out-push"] { animation: outPush .38s var(--ios) both; }
.screen[data-fx="in-pop"] { animation: inPop .34s var(--ios) both; }
.screen[data-fx="out-pop"] { animation: outPop .34s var(--ios) both; }
@keyframes inPush { from { transform: translateX(-100%); } }
@keyframes outPush { to { transform: translateX(30%); opacity: .35; } }
@keyframes inPop { from { transform: translateX(30%); opacity: .35; } }
@keyframes outPop { to { transform: translateX(-100%); } }
.screen[data-fx="in-push-wide"] { animation: axIn .24s var(--out) both .12s; }
.screen[data-fx="out-push-wide"] { animation: axOut .13s ease-in both; }
.screen[data-fx="in-pop-wide"] { animation: axInBack .24s var(--out) both .12s; }
.screen[data-fx="out-pop-wide"] { animation: axOutBack .13s ease-in both; }
@keyframes axIn { from { opacity: 0; transform: translateX(-28px); } }
@keyframes axOut { to { opacity: 0; transform: translateX(28px); } }
@keyframes axInBack { from { opacity: 0; transform: translateX(28px); } }
@keyframes axOutBack { to { opacity: 0; transform: translateX(-28px); } }
/* Play: the home screen sinks back, the game comes up (translate only: the round measures its rows meanwhile) */
.screen[data-fx="in-launch"] { animation: launchIn .42s var(--out) both .05s; }
.screen[data-fx="out-launch"] { animation: launchOut .24s ease-in both; }
@keyframes launchIn { from { opacity: 0; transform: translateY(22px); } }
@keyframes launchOut { to { opacity: 0; transform: scale(.95); } }
.screen[data-fx="in-rise"] { animation: launchIn .44s var(--out) both .06s; }
.screen[data-fx="out-rise"], .screen[data-fx="out-fade"] { animation: fadeOut .2s ease-in both; }
.screen[data-fx="in-fade"] { animation: fadeIn .26s ease-out both; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
/* the stacked screens take horizontal drags themselves (the back swipe); vertical ones still scroll */
#dict, #stats, #calib, #dict .list, #stats .scroll { touch-action: pan-y; }

/* ---------- header ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; min-height: 48px; gap: 8px; flex: none; }
.icon { width: 44px; height: 44px; display: grid; place-items: center; flex: none; border-radius: 13px; color: var(--text); background: var(--surface); --ps: .9;
  transition: scale .5s var(--spring), background .2s; }
.icon.pressing { background: var(--surface2); }
.icon .ic { width: 21px; height: 21px; }
.icon.roll .ic { animation: roll .55s var(--spring); }
@keyframes roll { from { transform: rotate(-220deg) scale(.7); } }
.spacer { width: 44px; }
.logo { font: 40px var(--wet); color: var(--pink); line-height: 1; }
.logo.big { font-size: 84px; text-align: center; margin-top: 7vh; }
.title { font: 600 19px var(--font); color: var(--text); }
.hdr { display: flex; gap: 8px; align-items: center; }
.streak { height: 44px; padding: 0 13px; border-radius: 13px; display: inline-flex; align-items: center; gap: 6px; background: var(--surface); font: 600 17px var(--font); font-variant-numeric: tabular-nums; }
.streak .ic { width: 18px; height: 18px; color: var(--accent); }
.streak.cold .ic { color: var(--dim); }

/* ---------- cards + controls ---------- */
.card { background: var(--surface); border-radius: var(--r); padding: 12px; border: 1px solid var(--line); }
.cap { margin: 8px 2px 0; font-size: 14px; color: var(--muted); line-height: 1.35; min-height: 1.35em; }
.seg { display: flex; background: var(--bg); border-radius: 11px; padding: 3px; gap: 2px; flex: 1; min-width: 0; position: relative; touch-action: pan-y; }
.seg button { flex: 1; min-width: 0; height: 38px; border-radius: 9px; font: 500 15px var(--font); color: var(--muted); white-space: nowrap; padding: 0 4px;
  position: relative; z-index: 1; --ps: 1; transition: color .2s, background .2s; }
.seg button[aria-checked="true"], .seg button.hover { color: var(--text); }
.seg button[aria-checked="true"] { font-weight: 600; }
.seg button.pressing:not([aria-checked="true"]) { background: rgba(255, 255, 255, .04); }
/* the thumb: placed under the chosen segment by touch.js (placeThumb), it glides when the choice changes */
.seg .thumb { position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 9px; background: var(--surface3); pointer-events: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 2px 6px rgba(0, 0, 0, .25);
  transition: transform .42s var(--glide), width .42s var(--glide), scale .25s var(--out), opacity .2s; }
.seg.grab .thumb { scale: .94; }
.go {
  height: 58px; border-radius: 16px; background: var(--accent); color: #1a1600; font: 700 22px var(--font);
  display: flex; align-items: center; justify-content: center; gap: 8px; flex: none; margin-top: auto;
  box-shadow: 0 6px 20px rgba(255, 216, 77, .16); transition: scale .5s var(--spring), filter .15s, box-shadow .2s;
  --ps: .97; --glow: rgba(255, 255, 255, .45);
}
.go.pressing { filter: brightness(.96); box-shadow: 0 3px 10px rgba(255, 216, 77, .12); }
.go.sm { height: 50px; font-size: 18px; margin-top: 0; border-radius: 14px; }
.go:disabled { opacity: .45; }
.go .ic { width: 20px; height: 20px; }
.ghost { height: 50px; width: 100%; border-radius: 14px; background: var(--surface); color: var(--text); font: 500 17px var(--font); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; gap: 8px; }
.ghost { --ps: .98; }
a.ghost { text-decoration: none; }
.ghost.pressing { background: var(--surface2); }
.link { font: 500 15px var(--font); color: var(--muted); align-self: center; padding: 10px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- brick grid ---------- */
.grid { display: flex; flex-direction: column; gap: 6px; }
.grow { display: grid; grid-template-columns: repeat(3, 1fr) 1.4fr; gap: 6px; }
.grow.two, .beatind.two { grid-template-columns: 1fr 1.4fr 1fr 1.4fr; } /* two words per line: beats 2 and 4 hold words */
.brick { height: 52px; background: var(--brick); border-radius: 9px; position: relative; display: grid; place-items: center; }
.stk {
  font: 700 29px var(--marker); line-height: 1; padding: 9px 6px 4px; width: 94%; text-align: center; border-radius: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
  --r: 0deg; transform: rotate(var(--r));
}
.stk.c0 { background: #f5528f; color: #fff; --r: -1deg; } /* a touch deeper than --pink: white text at 3.2:1 (WCAG large text) */
.stk.c1 { background: var(--cyan); color: #0d1a1c; --r: 1deg; }
.stk.c2 { background: var(--yellow); color: #1a1600; --r: -.5deg; }
.stk.c3 { background: var(--white); color: #1a1917; --r: 1deg; }
.stk.blank { background: transparent; box-shadow: none; color: var(--text); outline: 1.5px dashed rgba(255, 255, 255, .35); outline-offset: -2px; }
.stk.blank small { font-size: 16px; opacity: .7; }
.stk.slap { animation: slap .36s var(--pop); }
@keyframes slap { 0% { transform: rotate(var(--r)) scale(1.25); opacity: .4; } 100% { transform: rotate(var(--r)) scale(1); } }
.stk.land { animation: land .46s var(--pop) both; }
@keyframes land { 0% { transform: rotate(var(--r)) translateY(-12px) scale(1.3); opacity: 0; } 50% { opacity: 1; } 100% { transform: rotate(var(--r)) scale(1); } }
.preview { pointer-events: none; gap: 5px; }
.preview .grow { gap: 5px; }
.preview .brick { height: 30px; border-radius: 7px; }
.preview .stk { font-size: 19px; padding: 4px 4px 1px; border-radius: 5px; }

/* ---------- setup ---------- */
#setup { overflow: hidden; gap: 10px; }
.sscroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin: 0 -16px; padding: 2px 16px 12px; overscroll-behavior: contain; }
.sscroll > * { flex-shrink: 0; } /* a column inside a scroller must not squeeze its items */
/* the word of the day and the weekly challenge: two half cards in one row */
.dayrow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.daily { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; padding: 10px 12px 9px; border-radius: var(--r); background: var(--surface);
  border: 1px solid var(--line); text-align: start; font: 400 15px var(--font); color: var(--muted); }
.daily small { font-size: 13px; color: var(--muted); }
.daily b { font: 700 24px var(--marker); color: var(--text); line-height: 1; padding-top: 3px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daily .go2 { font-weight: 600; color: var(--accent); font-size: 13px; }
.daily.weekly b { font: 600 19px var(--font); padding-top: 2px; } /* a beat's name, not a rhyme word: Rubik (Karantina is for rhyme words) */
.daily.done .go2 { color: var(--muted); }
.daily { --ps: .98; }
.daily.pressing { background: var(--surface2); }
/* the wall: a tap brings new words; the dice in the corner says so */
.wallcard { --ps: .985; cursor: pointer; }
.wallcard.pressing { background: var(--surface2); }
.wallcard .shuffle { position: absolute; left: 12px; bottom: 11px; width: 17px; height: 17px; color: var(--dim); transition: rotate .5s var(--spring), color .2s; }
.wallcard.pressing .shuffle { rotate: -40deg; color: var(--muted); }
.wallcard .cap { padding-inline-end: 26px; }
/* the home screen comes in in layers */
#setup.stagger .sscroll > * { animation: rise .5s var(--out) both; }
#setup.stagger .sscroll > :nth-child(2) { animation-delay: .05s; }
#setup.stagger .sscroll > :nth-child(3) { animation-delay: .1s; }
#setup.stagger .bar { animation: fadeIn .4s ease-out both; }
.opts { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; }
.optrow { display: flex; align-items: center; gap: 10px; min-height: 46px; width: 100%; }
.ol { width: 44px; flex: none; font: 500 15px var(--font); color: var(--muted); text-align: start; }
.optrow.more { border-top: 1px solid var(--line); margin-top: 2px; padding-top: 4px; text-align: start; --ps: .98; border-radius: 0 0 10px 10px; }
.ov { flex: 1; font-size: 15px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { width: 18px; height: 18px; color: var(--muted); transition: transform .2s var(--out); }
.more[aria-expanded="true"] .chev { transform: rotate(180deg); }
.moreopts { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 6px; }
.optcol { display: flex; flex-direction: column; gap: 6px; }
.optcol .cap { margin: 0 2px; }

/* the beat dock: a slim player row, then Record + Play */
.dock { flex: none; display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 5; }
.player { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; position: relative; }
.phead { display: flex; align-items: center; gap: 10px; touch-action: none; } /* swipe: left/right another beat, up/down open and fold */
.phead .cover, .phead .meta { will-change: transform; }
.cover { width: 42px; height: 42px; flex: none; display: grid; place-items: center; font: 22px var(--wet); color: #1a1600; background: var(--accent); border-radius: 10px; cursor: pointer; }
.cover.spin { animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { scale: 1.06; } } /* scale, not transform: the beat row's swipe moves the cover with transform */
.meta { flex: 1; display: flex; flex-direction: column; line-height: 1.2; min-width: 0; cursor: pointer; }
.meta small { font-size: 12px; color: var(--muted); }
.meta b { font: 600 16px var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctrls { display: flex; gap: 2px; align-items: center; }
.arr { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; color: var(--text); --ps: .86; transition: scale .5s var(--spring), background .2s; }
.arr.pressing { background: var(--surface2); }
.arr .ic { width: 20px; height: 20px; }
.pp { width: 44px; height: 44px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; flex: none; --ps: .86; }
.pp .ic { width: 18px; height: 18px; }
.pp.stop { background: var(--rec); color: #fff; }
.pmore { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .38s var(--ios), opacity .25s; }
#beatCard.open .pmore { grid-template-rows: 1fr; opacity: 1; }
.pmore-in { min-height: 0; overflow: hidden; }
.prow { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
#speeds button { height: 34px; font-size: 14px; }
.dock.peek #beatCard { animation: rise .4s var(--out) both; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

/* your own beat: tempo, a tap pad with beat lights, a metronome switch */
.metro { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.tempo { display: flex; align-items: center; justify-content: center; gap: 18px; }
.step { width: 48px; height: 48px; border-radius: 50%; background: var(--surface2); color: var(--text); font: 400 26px var(--font); line-height: 1;
  display: grid; place-items: center; padding-bottom: 2px; touch-action: none; --ps: .86; transition: scale .5s var(--spring), background .15s; }
.step.pressing { background: var(--surface3); }
/* the number itself drags: up (or toward +) is faster */
.bpm { display: flex; align-items: baseline; justify-content: center; gap: 6px; min-width: 120px; direction: ltr; padding: 6px 10px; border-radius: 14px;
  cursor: ns-resize; transition: background .2s; }
.bpm.dragging { background: var(--surface2); }
.bpm.dragging b { color: var(--accent); }
.bpm b { font: 700 40px var(--font); color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.bpm small { font: 600 13px var(--font); color: var(--muted); letter-spacing: .06em; }
.bpm.bump b { animation: bpmBump .18s var(--pop); }
@keyframes bpmBump { from { transform: scale(.88); } }
.taprow { display: flex; gap: 8px; align-items: stretch; }
.tappad { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px 10px;
  border-radius: 12px; background: var(--surface2); color: var(--text); font: 600 15px var(--font); touch-action: none; --ps: .97;
  transition: scale .4s var(--spring), background .1s; }
.tappad.pressing { background: var(--surface3); transition-duration: .04s; }
.tappad .tl { display: inline-flex; align-items: center; gap: 6px; line-height: 1; }
.tappad .tl .ic { width: 18px; height: 18px; }
.lights { display: flex; gap: 6px; direction: rtl; } /* beat 1 on the right, like the grid */
.lights i { width: 24px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); transition: background .06s; }
.lights i.on { background: var(--text); }
.lights i.on:first-child { background: var(--accent); }
.metrochip { width: 84px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 12px;
  background: var(--surface2); color: var(--muted); font: 500 13px var(--font); line-height: 1; padding: 8px 4px; transition: scale .5s var(--spring), background .15s, color .15s; }
.metrochip .ic { width: 24px; height: 24px; }
.metrochip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.metrochip[aria-pressed="true"] .ic { animation: tock 1s ease-in-out infinite alternate; transform-origin: 50% 85%; }
@keyframes tock { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
.metrohint { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }

.gorow { display: flex; gap: 10px; align-items: stretch; flex: none; }
.gorow .go { flex: 1; margin-top: 0; }
.recbtn { width: 70px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); font: 500 12px var(--font); line-height: 1; --ps: .93;
  transition: scale .5s var(--spring), color .2s, border-color .2s; }
.recbtn .ic { width: 22px; height: 22px; }
.recbtn.on { color: var(--text); border-color: rgba(255, 77, 77, .5); }
.recbtn.on .ic { color: var(--rec); animation: recPulse 2s ease-in-out infinite; }
@keyframes recPulse { 50% { opacity: .55; } }

/* ---------- intro ---------- */
#intro { gap: 18px; }
.kicker { text-align: center; margin: -6px 0 0; font: 500 18px var(--font); color: var(--muted); }
.steps { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); font: 500 17px var(--font); padding: 12px 14px; }
body:not(.loading) #intro.active :is(.logo, .kicker, .steps li, .demo, .note, .go) { animation: rise .55s var(--out) both; }
#intro .kicker { animation-delay: .06s !important; }
#intro .steps li:nth-child(1) { animation-delay: .12s !important; }
#intro .steps li:nth-child(2) { animation-delay: .18s !important; }
#intro .steps li:nth-child(3) { animation-delay: .24s !important; }
#intro .demo { animation-delay: .3s !important; }
#intro .note, #intro .go { animation-delay: .36s !important; }
.steps b { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface3); color: var(--accent); font: 700 15px var(--font); }
.note { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; color: var(--muted); margin: auto 0 0; }
.note .ic { width: 18px; height: 18px; }
.demo { position: relative; padding-top: 44px; margin: 0; }
.demo .grow { opacity: 1; }
.demo .brick { height: 44px; background: var(--brick-hi); }
.demo .stk { font-size: 25px; padding: 7px 4px 3px; }
.demo .db { position: absolute; top: 44px; left: 0; width: 100%; height: 0; animation: hopX 2.667s infinite; }
.demo .db i { position: absolute; left: 0; top: 0; width: 20px; height: 20px; margin: -20px 0 0 -10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8d0, var(--accent) 50%, #c9a52c); animation: hopY .667s infinite cubic-bezier(.3, 0, .7, 1); }
@keyframes hopX { 0%, 100% { transform: translateX(88.6%); } 25% { transform: translateX(65.9%); } 50% { transform: translateX(43.2%); } 75% { transform: translateX(15.9%); } }
@keyframes hopY { 0%, 100% { transform: translateY(0) scale(1.2, .8); } 12% { transform: translateY(-12px) scale(.95, 1.05); } 50% { transform: translateY(-34px); } 88% { transform: translateY(-12px); } }

/* ---------- game ---------- */
#game::after { content: ''; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 45%, rgba(255, 240, 180, .12), transparent 65%); opacity: 0; }
#game.pulse::after { animation: flash .22s ease-out; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.barcount { font: 600 17px var(--font); color: var(--muted); flex: 1; text-align: center; font-variant-numeric: tabular-nums; }
.beatind { display: grid; grid-template-columns: repeat(3, 1fr) 1.4fr; gap: 6px; flex: none; }
.beatind i { height: 6px; background: var(--brick-hi); border-radius: 3px; transition: background .08s; }
.beatind i.on { background: var(--accent); }

.stage { flex: 1; position: relative; overflow: hidden; touch-action: manipulation;
  -webkit-mask-image: linear-gradient(transparent, #000 7%, #000 90%, transparent);
          mask-image: linear-gradient(transparent, #000 7%, #000 90%, transparent); }
.rows { position: absolute; inset-inline: 0; top: 0; will-change: transform; } /* moved per frame from the audio clock */
.rows .grow { opacity: .4; transition: opacity .2s; }
.rows .grow.cur { opacity: 1; }
.rows .grow.cur .brick { background: var(--brick-hi); }
.rows .grow.next { opacity: .75; }
.rows .grow.done { opacity: .2; }
.ball, .shadow { position: absolute; top: 0; left: 0; opacity: 0; will-change: transform; pointer-events: none; }
.ball { width: 24px; height: 24px; margin: -24px 0 0 -12px; border-radius: 50%; transform-origin: 50% 100%; z-index: 3;
  background: radial-gradient(circle at 35% 35%, #fff8d0, var(--accent) 50%, #c9a52c); box-shadow: 0 0 14px rgba(255, 216, 77, .35); }
.shadow { width: 26px; height: 7px; margin: -4px 0 0 -13px; border-radius: 50%; background: rgba(0, 0, 0, .55); filter: blur(1px); }
.trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.brick.flash { animation: brickFlash .34s ease-out; }
@keyframes brickFlash { 0%, 55% { background: rgba(255, 250, 235, .55); } 100% { background: var(--brick-hi); } }
.coach { position: absolute; top: 10px; left: 50%; z-index: 3; white-space: nowrap; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--line); color: var(--text); font: 500 15px var(--font); padding: 8px 14px; border-radius: 999px; }
.coach.in { animation: coachIn .3s var(--out); }
@keyframes coachIn { from { opacity: 0; transform: translateX(-50%) translateY(-6px); } }
/* paused: one big "continue" over the stage, tap anywhere on it */
.paused { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: rgba(18, 17, 16, .66); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: var(--text); --ps: 1; animation: fadeIn .2s ease-out; }
.paused .pbig { width: 78px; height: 78px; border-radius: 50%; background: var(--accent); color: #1a1600; display: grid; place-items: center; margin-bottom: 6px;
  box-shadow: 0 8px 30px rgba(255, 216, 77, .22); animation: popIn .45s var(--spring) both; transition: scale .4s var(--spring); }
.paused .pbig .ic { width: 30px; height: 30px; translate: 2px 0; }
.paused.pressing .pbig { scale: .9; transition-duration: .08s; }
.paused b { font: 600 20px var(--font); }
.paused small { font-size: 14px; color: var(--muted); }
@keyframes popIn { from { scale: .6; opacity: 0; } }
.player.mini { flex-direction: row; align-items: center; gap: 10px; padding-bottom: 14px; }
.player.mini .meta b { font-size: 15px; }
.prog { position: absolute; inset-inline: 12px; bottom: 7px; height: 3px; border-radius: 2px; background: var(--surface3); overflow: hidden; }
.prog i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: right; transform: scaleX(0); }
.countin { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; font: 800 150px var(--font); color: var(--text); opacity: 0; z-index: 4; font-variant-numeric: tabular-nums; }
.countin.slam { animation: count .5s var(--out); }
@keyframes count { 0% { opacity: 0; transform: scale(1.3); } 25% { opacity: .9; transform: scale(1); } 80% { opacity: .9; } 100% { opacity: 0; } }
/* tutorial: a sample line, one word per beat (lights up as the ball lands) */
.brick .sw { font: 700 23px var(--marker); color: rgba(243, 240, 234, .45); line-height: 1; padding-top: 4px; transition: color .15s, transform .15s; }
.rows .grow.cur .brick .sw { color: rgba(243, 240, 234, .75); }
.brick.flash .sw { color: var(--accent); transform: scale(1.1); }

/* recording during the round: a REC badge with the time, the camera in a corner */
.recdot { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; background: rgba(255, 77, 77, .14);
  color: #ffb3b3; font: 600 14px var(--font); font-variant-numeric: tabular-nums; }
.recdot i { width: 9px; height: 9px; border-radius: 50%; background: var(--rec); transform: scale(calc(1 + var(--lvl, 0) * .7)); transition: transform .06s; box-shadow: 0 0 0 calc(var(--lvl, 0) * 6px) rgba(255, 77, 77, .25); }
.campv { position: absolute; top: 8px; left: 8px; width: 92px; height: 124px; object-fit: cover; transform: scaleX(-1); border-radius: 12px; z-index: 3; background: #000;
  box-shadow: 0 0 0 2px rgba(255, 77, 77, .7), 0 6px 18px rgba(0, 0, 0, .5); }

/* ---------- dictionary ---------- */
.searchbox { position: relative; flex: none; }
.search { width: 100%; height: 50px; padding: 0 16px; padding-inline-end: 50px; font: 500 18px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); outline: none; flex: none; -webkit-appearance: none; appearance: none; transition: border-color .2s; }
.search::-webkit-search-cancel-button, .search::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.qclear { position: absolute; top: 50%; inset-inline-end: 5px; translate: 0 -50%; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: var(--muted); --ps: .85; animation: popIn .25s var(--spring) both; }
.qclear .ic { width: 15px; height: 15px; stroke-width: 2.6; }
.qclear.pressing { color: var(--text); background: var(--surface2); }
.search::placeholder { color: var(--dim); }
.search:focus { border-color: rgba(255, 216, 77, .5); }
.results { margin: 0 2px; font-size: 14px; color: var(--muted); flex: none; }
.list { flex: 1; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; align-content: start; gap: 8px; padding: 2px 0 24px; }
.item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start; padding: 10px 12px 9px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.item { --ps: .97; transition: scale .5s var(--spring), background .2s; }
.item.pressing { background: var(--surface2); }
.item.in { animation: itemIn .34s var(--out) both; }
@keyframes itemIn { from { opacity: 0; transform: translateY(10px); } }
.item b { font: 700 28px var(--marker); line-height: 1; padding-top: 3px; }
.item span { font-size: 13px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item.me { border-color: var(--accent); }
.item.fam b { color: var(--accent); }

/* ---------- calibration ---------- */
.calibtext { font-size: 16px; color: var(--muted); text-align: center; margin: 4px 8px; line-height: 1.5; }
.calibtext b { color: var(--text); }
.pad { align-self: center; width: min(64vw, 250px); aspect-ratio: 1; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); color: var(--text); font: 700 24px var(--font);
  margin-top: 3vh; flex: none; touch-action: none; --ps: .94; transition: transform .06s, background .06s, scale .4s var(--spring); }
.pad.beat { transform: scale(1.04); background: var(--surface2); }
.pad.pressing { transition: transform .06s, background .06s, scale .05s; }
.dots { display: flex; justify-content: center; gap: 8px; min-height: 12px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface3); }
.dots i.on { background: var(--accent); }
.calibres { text-align: center; font: 600 20px var(--font); min-height: 1.3em; margin: 0; }
.row2 { display: flex; gap: 10px; margin-top: auto; align-items: center; }
.row2 > * { flex: 1; }

/* ---------- end ---------- */
#end { overflow-y: auto; justify-content: flex-start; padding-top: max(24px, env(safe-area-inset-top)); padding-bottom: 0; } /* the sticky bar pads for the home indicator itself; the screen's own bottom padding left a gap under it where the recap showed through */
.endbox { text-align: center; display: flex; flex-direction: column; gap: 14px; margin: auto 0; padding-bottom: 4px; } /* auto below too: the bar sits at the bottom */
.sticker { align-self: center; background: var(--surface2); color: var(--text); font: 600 15px var(--font); padding: 7px 14px; border-radius: 999px; animation: rise .4s var(--out) both; }
/* the recap: the numbers in one row with hairlines between them, then the round's lines as they were on the wall */
.recap { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 10px 12px; display: flex; flex-direction: column; gap: 12px;
  animation: rise .45s var(--out) both .04s; }
.rstats { display: flex; }
.rs { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 0 4px; }
.rs + .rs { border-inline-start: 1px solid var(--line); }
.rs b { font: 800 30px var(--font); line-height: 1; display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.rs b .ic { width: 20px; height: 20px; color: var(--accent); }
.rs span { font: 500 12px var(--font); color: var(--muted); }
.rgrid { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; }
.rline { display: grid; grid-template-columns: 16px minmax(0, 1fr); align-items: center; gap: 5px; animation: rise .4s var(--out) both; }
.rline .rn { font: 500 11px var(--font); color: var(--dim); font-variant-numeric: tabular-nums; }
.rgrid .grow { gap: 5px; }
.rgrid .brick { height: 40px; border-radius: 8px; }
.rgrid .stk { font-size: 23px; padding: 6px 4px 2px; border-radius: 6px; }
.rgrid .brick .sw { font-size: 18px; color: rgba(243, 240, 234, .55); }
.stk.was { background: transparent; color: var(--muted); box-shadow: none; outline: 1.5px dashed rgba(255, 255, 255, .28); outline-offset: -2px; } /* was "?" in the round */
.rcap { font-size: 13px; color: var(--muted); }
/* the two ways out, pinned to the bottom while the recap scrolls */
.endbar { position: sticky; bottom: 0; z-index: 2; flex: none; display: flex; gap: 10px; margin: 0 -2px; padding: 14px 2px max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(18, 17, 16, 0), var(--bg) 24%); }
.endbar > * { flex: 1; margin-top: 0; height: 54px; font-size: 19px; }
.milestone { font: 500 16px var(--font); color: var(--accent); margin: 0; min-height: 1.2em; }
.milestone:empty { display: none; }
.newach { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.newach:empty { display: none; }
.newach .a { font: 600 14px var(--font); background: rgba(255, 216, 77, .12); color: var(--accent); padding: 6px 12px; border-radius: 999px; animation: rise .4s var(--out) both; }

/* the clip card: the take on top, one clear way out (save or share), a quiet alternative */
.clip { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 10px; display: flex; flex-direction: column; gap: 10px; animation: rise .4s var(--out) both; }
.clipmedia video { height: min(46vh, 440px); width: auto; max-width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: #000; display: block; margin: 0 auto; border-radius: 12px; }
.clipmain { width: 100%; }
/* the caption to paste: an editable box with its own copy button (the share button carries only the file) */
.capbox { display: flex; flex-direction: column; gap: 6px; text-align: start; padding: 10px; border-radius: 14px; background: var(--bg); }
.caphead { display: flex; align-items: center; justify-content: space-between; gap: 8px; font: 600 14px var(--font); color: var(--muted); }
.capcopy { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 10px; background: var(--surface2); color: var(--text);
  font: 600 14px var(--font); --ps: .93; transition: scale .5s var(--spring), background .2s, color .2s; }
.capcopy .ic { width: 17px; height: 17px; }
.capcopy.done { background: rgba(255, 216, 77, .16); color: var(--accent); }
#capText { width: 100%; resize: none; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); padding: 9px 11px;
  font: 400 14px/1.45 var(--font); -webkit-user-select: text; user-select: text; outline: none; }
#capText:focus { border-color: rgba(255, 216, 77, .5); }
.caphint { font-size: 12px; color: var(--muted); line-height: 1.4; }
/* the record nudge: one quiet card, after a round that went well */
.nudge { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid rgba(255, 77, 77, .35);
  text-align: start; animation: rise .45s var(--out) both .5s; }
.nudge > .ic { width: 26px; height: 26px; color: var(--rec); flex: none; }
.nudge .ntext { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nudge b { font: 600 15px var(--font); }
.nudge span { font-size: 13px; color: var(--muted); line-height: 1.35; }
.nudge .go { flex: none; padding: 0 16px; height: 42px; font-size: 16px; }
.clip .link { padding: 2px 10px 4px; }
.aplay { display: flex; align-items: center; gap: 12px; direction: ltr; padding: 4px 2px; }
.aplay .pp { width: 46px; height: 46px; background: var(--accent); color: #1a1600; }
.wave { flex: 1; height: 44px; display: flex; align-items: center; gap: 2px; cursor: pointer; touch-action: none; }
.wave i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--surface3); height: calc(8% + var(--h) * 92%); transition: background .1s; }
.wave i.on { background: var(--accent); }
.atime { font: 500 13px var(--font); color: var(--muted); font-variant-numeric: tabular-nums; min-width: 36px; text-align: end; }

/* ---------- stats ---------- */
#stats .scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 0 20px; }
.sub { margin: 10px 2px 0; font: 600 15px var(--font); color: var(--muted); }
.nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.num { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; text-align: center; }
.num b { display: block; font: 700 24px var(--font); line-height: 1.1; font-variant-numeric: tabular-nums; }
.num span { font-size: 12px; color: var(--muted); }
.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.heat i { aspect-ratio: 1.6; background: var(--surface); border-radius: 4px; }
.heat i.l1 { background: rgba(255, 216, 77, .3); } .heat i.l2 { background: rgba(255, 216, 77, .6); } .heat i.l3 { background: var(--accent); }
.heat i.today { outline: 1.5px solid var(--text); outline-offset: -1.5px; }
.achs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ach { padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); opacity: .5; }
.ach.on { opacity: 1; border-color: rgba(255, 216, 77, .4); }
.ach b { display: block; font: 600 15px var(--font); line-height: 1.25; }
.ach.on b { color: var(--accent); }
.ach span { font-size: 12px; color: var(--muted); }

/* ---------- sheets (settings, recording) ---------- */
.sheet { position: fixed; inset: 0; display: flex; align-items: flex-end; pointer-events: none; z-index: 20; }
.sheet::before { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .35s ease; }
.sheet.open { pointer-events: auto; }
.sheet.open::before { opacity: var(--sheet-dim, 1); } /* --sheet-dim: set while a drag is under way (touch.js) */
.sheet.dragging::before { transition: none; }
.sheetin { position: relative; z-index: 1; width: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; max-height: 92dvh; overflow-y: auto;
  overscroll-behavior: contain; background: var(--surface); border-radius: 22px 22px 0 0; border-top: 1px solid var(--line); box-shadow: 0 -10px 40px rgba(0, 0, 0, .35);
  padding: 10px max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  transform: translateY(calc(100% + 30px)); visibility: hidden; transition: transform .38s var(--ios), visibility 0s linear .38s; }
.sheetin > * { flex-shrink: 0; } /* a column that scrolls must not squeeze its items (the open credits list did) */
.sheetin::before { content: ''; align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--surface3); margin-bottom: 4px; flex: none; }
.sheet.open .sheetin { transform: none; visibility: visible; transition: transform .5s var(--ios), visibility 0s; }
.sheetin .title { align-self: center; margin-bottom: 2px; }
.tog { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 14px; border-radius: 12px; background: var(--surface2); font: 500 16px var(--font); cursor: pointer; position: relative; --ps: .985; }
.tog input { position: absolute; opacity: 0; }
.tog i { width: 46px; height: 28px; border-radius: 14px; background: var(--surface3); position: relative; transition: background .15s; flex: none; }
.tog i::after { content: ''; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 11px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
  transition: transform .35s var(--spring), width .2s var(--out); }
.tog input:checked + i { background: var(--accent); }
.tog input:checked + i::after { transform: translateX(-18px); }
/* held down, the knob stretches toward where it would go (as on iOS) */
.tog.pressing i::after { width: 28px; }
.tog.pressing input:checked + i::after { transform: translateX(-12px); }
.tog input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.vol { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 14px; border-radius: 12px; background: var(--surface2); font: 500 16px var(--font); }
.vol span { flex: none; }
.vol bdi { font: 500 15px var(--font); min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
/* the volume slider: a filled track (RTL, from the right) and a big thumb that grows under the finger */
.vol input { flex: 1; min-width: 0; height: 32px; margin: 0; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.vol input::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to left, var(--accent) var(--v, 50%), var(--surface3) var(--v, 50%)); }
.vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: #fff; border: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45); transition: scale .35s var(--spring); }
.vol input:active::-webkit-slider-thumb { scale: 1.18; }
.vol input::-moz-range-track { height: 6px; border-radius: 3px; background: var(--surface3); }
.vol input::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
.vol input::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, .45); }
.sheetin .ghost { background: var(--surface2); }
.credits { font-size: 13px; color: var(--muted); padding: 4px 2px; }
.credits summary { cursor: pointer; font-weight: 500; font-size: 14px; }
.credits p { margin: 6px 0; }
.credits ul { margin: 0; padding-inline-start: 18px; max-height: 30vh; overflow-y: auto; }
.credits li { margin: 3px 0; }
.credits a { color: var(--text); text-decoration: underline; }
.credits bdi { font-size: 12px; opacity: .85; }

/* the recording sheet: three choices, a live check of the mic (and the camera), one tip */
.recopts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.recopt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px 12px; border-radius: 14px; background: var(--surface2); border: 1.5px solid transparent; color: var(--muted); transition: border-color .15s, color .15s, background .15s; }
.recopt .ic { width: 24px; height: 24px; }
.recopt b { font: 600 16px var(--font); color: var(--text); }
.recopt small { font-size: 12px; line-height: 1.3; text-align: center; }
.recopt { --ps: .96; transition: scale .5s var(--spring), border-color .15s, color .15s, background .15s; }
.recopt[aria-checked="true"] { border-color: var(--accent); background: var(--surface3); color: var(--text); }
.recopt[aria-checked="true"] .ic { animation: popIn .35s var(--spring); }
.recopt[aria-checked="true"][data-rec="audio"] .ic, .recopt[aria-checked="true"][data-rec="video"] .ic { color: var(--rec); }
.reccheck { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border-radius: 14px; background: var(--bg); }
.recframe { position: relative; width: 132px; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; background: #000; }
.recframe video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.recframe span { position: absolute; inset-inline: 0; bottom: 6px; text-align: center; font-size: 11px; color: rgba(255, 255, 255, .85); text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.meter { display: flex; gap: 3px; height: 22px; align-items: center; direction: ltr; }
.meter i { width: 6px; height: 100%; border-radius: 3px; background: var(--surface3); transition: background .05s; }
.meter i.on { background: #6fdc8c; }
.meter i.on.hot { background: var(--accent); }
.meter i.on.clip { background: var(--rec); }
.rechint { margin: 0; font-size: 14px; color: var(--muted); text-align: center; line-height: 1.45; }
.rechint.bad { color: #ffb3b3; }
.rechint b { color: var(--text); font-weight: 600; }
.rectip { margin: 0; display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); line-height: 1.45; padding: 0 2px; }
.rectip .ic { width: 17px; height: 17px; margin-top: 1px; }

.toast { position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); width: max-content; transform: translate(-50%, -12px); opacity: 0; pointer-events: none; z-index: 30;
  background: var(--surface3); color: var(--text); font: 500 15px var(--font); padding: 11px 18px; border-radius: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
  max-width: min(92vw, 420px); text-align: center; line-height: 1.4; transition: transform .3s var(--out), opacity .2s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 15; }

/* ---------- sizes: phones first, then the rest ---------- */
/* touch screens: no scrollbars (the content's edge and momentum say it scrolls), no scroll chaining */
@media (pointer: coarse) {
  .sscroll, .list, #stats .scroll, .sheetin, #end, .credits ul { scrollbar-width: none; }
  :is(.sscroll, .list, #stats .scroll, .sheetin, #end, .credits ul)::-webkit-scrollbar { display: none; }
}
.list, #stats .scroll, #end { overscroll-behavior: contain; }
/* short phones (SE, mini): keep Play and the beat above the fold */
@media (max-height: 700px) {
  .preview .brick { height: 26px; }
  .preview .stk { font-size: 17px; }
  .go { height: 52px; }
  .optrow { min-height: 42px; }
  .seg button { height: 34px; }
  .logo.big { font-size: 70px; margin-top: 3vh; }
  #intro { gap: 12px; }
}
/* narrow phones (320–360): four segments still fit */
@media (max-width: 360px) {
  .seg button { font-size: 14px; padding: 0 2px; }
  .ol { width: 36px; }
  .stk { font-size: 25px; }
  .go { font-size: 20px; }
  .ctrls .arr { width: 36px; }
  .recbtn { width: 62px; }
}
/* a phone on its side: the home screen in two columns (choices | beat and Play), a lower game */
@media (orientation: landscape) and (max-height: 540px) {
  .screen { max-width: 940px; gap: 8px; }
  #setup:is(.active, .leaving, .peeking) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); grid-template-rows: auto minmax(0, 1fr); column-gap: 16px; row-gap: 6px; }
  #setup > .bar { grid-column: 1 / -1; min-height: 44px; }
  #setup .sscroll { grid-row: 2; grid-column: 1; margin: 0; padding: 2px 2px 12px; }
  #setup .dock { grid-row: 2; grid-column: 2; align-self: end; }
  .preview .brick { height: 24px; }
  .preview .stk { font-size: 16px; }
  .logo.big { font-size: 56px; margin-top: 0; }
  #intro { overflow-y: auto; }
  #intro .steps { flex-direction: row; } #intro .steps li { flex: 1; font-size: 15px; }
  .brick { height: 40px; }
  .stk { font-size: 24px; padding: 6px 6px 3px; }
  .grow { grid-template-columns: repeat(3, 1fr) 1.6fr; }
  .beatind { grid-template-columns: repeat(3, 1fr) 1.6fr; }
  .grow.two, .beatind.two { grid-template-columns: 1fr 1.6fr 1fr 1.6fr; }
  .countin { font-size: 110px; }
  .clipmedia video { height: min(70vh, 300px); }
  #end :is(.endbox, .endbar) { max-width: 520px; margin-inline: auto; width: 100%; }
  .pad { width: min(42vh, 200px); margin-top: 0; }
}
/* tablets: a wider column and bigger bricks */
@media (min-width: 700px) and (min-height: 820px) {
  .screen { max-width: 620px; }
  .brick { height: 64px; }
  .stk { font-size: 35px; }
  .preview .brick { height: 36px; }
  .preview .stk { font-size: 22px; }
  .logo { font-size: 46px; }
  .logo.big { font-size: 110px; }
  .seg button { font-size: 16px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.tapgo { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; background: rgba(18, 17, 16, .82); padding: 24px; }
.tapgoin { width: min(100%, 360px); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; animation: rise .3s var(--out) both; }
.tapgoin .ic { width: 34px; height: 34px; color: var(--rec); }
.tapgoin p { margin: 0 0 6px; font: 500 17px var(--font); color: var(--muted); }
.tapgoin .go { width: 100%; }
.reccheck.tap { cursor: pointer; }
#end.withclip #again { background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: none; } /* the take's own button leads */
.clipnote { margin: 0; font-size: 13px; line-height: 1.45; color: #ffd0a8; text-align: center; }
/* the two wordless lines that open a round: quieter bricks, the count on the second */
.rows .grow.lead .brick { background: rgba(255, 255, 255, .03); }
.rows .grow.lead.cur .brick { background: var(--brick); }
.grow.lead .sw { font: 600 18px var(--font); color: rgba(243, 240, 234, .35); padding-top: 0; }

/* For search engines and screen readers only (decision 0018): the page's one h1. */
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
