/* Revvo: Hi-Fi Deck.
   Brushed aluminium ground, black tape housings, printed label paper,
   one signal orange for REC and primary keys, cobalt only for Side A. */

:root {
  --alu: #D9D6CF;
  --alu-hi: #E6E3DD;
  --panel: #ECEAE5;
  --paper: #F4F2EC;
  --ink: #1C1C1C;
  --ink-2: #2B2B2A;
  --window: #262625;
  --muted: #55524D;
  --muted-soft: #77746E;
  --line: rgba(28, 28, 28, .14);
  --line-soft: rgba(28, 28, 28, .08);
  --signal: #FF5A1F;
  --signal-deep: #C83C0A;
  --signal-tint: #FFD9C8;
  --cobalt: #2B4FC4;
  --cobalt-lit: #7C96FF;
  --tape: #4A3B32;
  
  --f-sans: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
  --f-mono: 'Martian Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;

  --shadow-key: inset 0 -3px 0 rgba(0, 0, 0, .14), inset 0 1px 0 rgba(255, 255, 255, .55), 0 1px 2px rgba(0, 0, 0, .12), 0 4px 10px -4px rgba(0, 0, 0, .18);
  --shadow-key-down: inset 0 -1px 0 rgba(0, 0, 0, .14), inset 0 1px 2px rgba(0, 0, 0, .12), 0 1px 1px rgba(0, 0, 0, .08);
  --shadow-housing: 0 2px 4px rgba(0, 0, 0, .14), 0 24px 48px -24px rgba(0, 0, 0, .55);

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --gutter: 20px;
  --maxw: 1120px;

  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scrollbar-color: #A9A59E var(--alu); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--alu);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 420px);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01';
  caret-color: var(--signal);
  padding-bottom: env(safe-area-inset-bottom);
}
::selection { background: var(--signal); color: var(--ink); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--alu); }
::-webkit-scrollbar-thumb { background: #A9A59E; border-radius: 10px; border: 2px solid var(--alu); }

h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 6px; }

/* ---------- layout ---------- */
.topbar, main { max-width: var(--maxw); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 64px;
  padding-top: env(safe-area-inset-top);
}
main { padding-top: 12px; padding-bottom: 48px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; }
.brand-word { font-weight: 800; font-size: 20px; letter-spacing: -.03em; }

.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.narrow { max-width: 460px; margin: 6vh auto 0; }
.center { text-align: center; align-items: center; }

.cols { display: grid; gap: 16px; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (min-width: 900px) {
  .cols { grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: 28px; align-items: start; }
}

/* ---------- type ---------- */
.display {
  font-weight: 800;
  font-size: clamp(2.6rem, 6.6vw, 5.4rem);
  line-height: .98;
  letter-spacing: -.04em;
  text-wrap: balance;
}
.title {
  font-weight: 800;
  font-size: clamp(1.6rem, 3.4vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.sub { margin-top: 10px; color: var(--muted); font-size: 16px; line-height: 1.55; max-width: 60ch; text-wrap: pretty; }
.card-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.legend {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.hint { font-size: 14px; line-height: 1.5; color: var(--muted); }
.lede { font-size: clamp(16px, 1.5vw, 18px); line-height: 1.55; color: var(--muted); max-width: 40ch; text-wrap: pretty; }

.round-tag {
  display: inline-flex; align-items: center;
  font-family: var(--f-mono); font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  padding: 3px 8px; margin-right: 6px;
  background: var(--ink); color: var(--paper); border-radius: 6px;
  vertical-align: 2px;
}

.screen-head { margin: 10px 0 24px; }

/* ---------- keys (buttons) ---------- */
.key {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px;
  border: 0; border-radius: var(--r);
  background: var(--paper); color: var(--ink);
  font-weight: 700; font-size: 16px; letter-spacing: -.01em; line-height: 1.1;
  text-decoration: none; text-align: center;
  box-shadow: var(--shadow-key);
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), background-color .2s, opacity .2s;
  user-select: none; -webkit-user-select: none;
}
.key svg { width: 18px; height: 18px; flex: none; }
.key:active:not(:disabled) { transform: translateY(1.5px); box-shadow: var(--shadow-key-down); }
.key:disabled { background: #CBC7BF; color: #6E6B65; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08); cursor: not-allowed; }
.key-signal { background: var(--signal); color: var(--ink); }
.key-signal:hover:not(:disabled) { background: #FF6A33; }
.key-ink { background: var(--ink); color: var(--paper); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .12), 0 4px 10px -4px rgba(0, 0, 0, .35); }
.key-ink:hover:not(:disabled) { background: #2E2E2D; }
.key-paper:hover:not(:disabled) { background: #FFFFFF; }
.key-xl { min-height: 60px; font-size: 18px; width: 100%; }
.key-small { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.key-ghost-dark { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1px rgba(244, 242, 236, .28); }
.key-ghost-dark:hover { box-shadow: inset 0 0 0 1px rgba(244, 242, 236, .6); }
.key-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); box-shadow: inset 0 1px 1px rgba(255, 255, 255, .25); }

.link-quiet {
  background: none; border: 0; padding: 8px 4px;
  color: var(--muted); font-size: 15px; font-weight: 600;
  text-decoration: underline; text-decoration-color: rgba(28, 28, 28, .3);
  align-self: center;
}
.link-quiet:hover { color: var(--ink); text-decoration-color: currentColor; }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.input {
  width: 100%; min-width: 0;
  height: 54px; padding: 0 16px;
  font-size: 17px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .06);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #6E6B65; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 90, 31, .3); }
.input:disabled { opacity: .55; }
.input-code {
  font-family: var(--f-mono); font-weight: 600; font-size: 18px;
  letter-spacing: .32em; text-transform: uppercase; text-align: center;
}
.input-code::placeholder { letter-spacing: .32em; }

/* ---------- panels ---------- */
.panel {
  background: rgba(255, 255, 255, .22);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .05);
}
.panel-dark {
  background: var(--ink);
  color: var(--paper);
  border-color: #000;
  box-shadow: var(--shadow-housing);
}
.panel-dark .hint { color: #B8B4AC; }
.panel-legends {
  display: flex; justify-content: space-between;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: #A8A49C;
}
.panel-legends span:first-child { color: var(--signal); }
.panel-legends span:first-child::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 7px; vertical-align: 1px; }

/* ---------- home ---------- */
.home { display: grid; gap: 28px; padding-top: 4px; }
.home-art { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.home-panel { display: flex; flex-direction: column; gap: 22px; }
@media (min-width: 900px) {
  .home { grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr); gap: 64px; align-items: center; min-height: calc(100vh - 140px); }
}

.display .flip {
  display: inline-block;
  color: var(--signal-deep);
  animation: flip 5s var(--ease-out) infinite;
  transform-origin: 50% 55%;
}
@keyframes flip {
  0%, 38% { transform: scaleX(1); }
  46%, 84% { transform: scaleX(-1); }
  92%, 100% { transform: scaleX(1); }
}

/* the hero cassette */
.cassette {
  position: relative;
  width: 100%; max-width: 520px;
  aspect-ratio: 1.58;
  background: linear-gradient(180deg, #2A2A29, var(--ink) 40%);
  border-radius: 18px;
  padding: 5.5% 5.5% 0;
  box-shadow: var(--shadow-housing), inset 0 1px 0 rgba(255, 255, 255, .08);
  display: flex; flex-direction: column;
}
.cassette::before, .cassette::after {
  content: ''; position: absolute; top: 4.5%; width: 2.4%; aspect-ratio: 1; border-radius: 50%;
  background: #0E0E0E; box-shadow: inset 0 1px 1px rgba(255, 255, 255, .1);
}
.cassette::before { left: 2%; }
.cassette::after { right: 2%; }
.cassette-label {
  flex: 1;
  background: var(--paper);
  border-radius: 8px 8px 4px 4px;
  padding: max(4%, 12px) max(5%, 14px) 0;
  display: flex; flex-direction: column;
}
.cl-row { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: max(3%, 8px); border-bottom: 6px solid var(--signal); }
.cl-side { font-weight: 800; font-size: clamp(20px, 4vw, 30px); line-height: 1; letter-spacing: -.03em; }
.cl-meta { font-family: var(--f-mono); font-size: clamp(9px, 1.4vw, 11px); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.cl-name { display: block; margin-top: 4%; }
.cl-name input {
  width: 100%; border: 0; border-bottom: 1px solid rgba(28, 28, 28, .28); border-radius: 0;
  background: transparent; padding: 6px 0 7px;
  font-weight: 700; font-size: clamp(18px, 3.4vw, 26px); letter-spacing: -.02em; color: var(--ink);
}
.cl-name input::placeholder { color: #6E6B65; font-weight: 600; }
.cl-name input:focus { outline: none; border-bottom: 2px solid var(--ink); padding-bottom: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.cl-window {
  margin: auto 8% 7%;
  height: 34%;
  border-radius: 999px;
  background: var(--window);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4%;
  position: relative;
}
.cl-tape { position: absolute; left: 22%; right: 22%; top: 50%; height: 42%; transform: translateY(-50%); background: linear-gradient(180deg, #3A2E27, var(--tape) 50%, #3A2E27); opacity: .9; }
.cl-reel {
  position: relative; z-index: 1;
  height: 78%; aspect-ratio: 1; border-radius: 50%;
  background:
    radial-gradient(circle, var(--ink) 0 12%, transparent 13%),
    conic-gradient(from 0deg, var(--paper) 0 10%, #CFCBC3 10% 33.3%, var(--paper) 33.3% 43.3%, #CFCBC3 43.3% 66.6%, var(--paper) 66.6% 76.6%, #CFCBC3 76.6% 100%);
  box-shadow: 0 0 0 3px var(--tape);
  animation: spin 4.8s linear infinite;
}
.cl-reel:last-child { animation-duration: 3.4s; }
.cassette-foot {
  align-self: center;
  width: 64%; height: 12%;
  margin-top: 3%;
  background: #262625;
  clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%);
  display: flex; justify-content: space-evenly; align-items: center;
}
.cassette-foot i { width: 5%; aspect-ratio: 1; border-radius: 50%; background: #0E0E0E; }
@keyframes spin { to { transform: rotate(360deg); } }

.deck-keys { display: flex; flex-direction: column; gap: 10px; }
.hw {
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  border: 0; border-radius: 14px;
  padding: 12px 16px 14px;
  background: var(--paper); color: var(--ink);
  text-align: left;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255, 255, 255, .5), 0 1px 2px rgba(0, 0, 0, .14), 0 10px 18px -10px rgba(0, 0, 0, .4);
  transition: transform .1s var(--ease-out), box-shadow .1s var(--ease-out);
}
.hw:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .16), inset 0 1px 2px rgba(0, 0, 0, .1), 0 1px 1px rgba(0, 0, 0, .1); }
.hw:disabled { opacity: .6; }
.hw-legend { display: inline-flex; align-items: center; gap: 7px; font-family: var(--f-mono); font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.hw-word { font-weight: 800; font-size: 22px; letter-spacing: -.025em; line-height: 1.1; }
.hw-rec { width: 100%; min-height: 96px; background: var(--signal); }
.hw-rec:hover:not(:disabled) { background: #FF6A33; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.hw-ink { background: var(--ink); color: var(--paper); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .12), 0 10px 18px -10px rgba(0, 0, 0, .5); min-height: 80px; min-width: 112px; }
.hw-ink .hw-legend { color: #A8A49C; }
.hw-join { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.hw-code {
  display: flex; flex-direction: column; justify-content: space-between; gap: 4px;
  min-height: 80px; padding: 12px 16px;
  background: linear-gradient(180deg, #151515, #0D0D0D);
  border-radius: 14px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .7);
  cursor: text;
}
.hw-code .hw-legend { color: #A8A49C; }
.hw-code input {
  width: 100%; border: 0; background: transparent; padding: 0;
  color: var(--paper); caret-color: var(--signal);
  font-family: var(--f-mono); font-weight: 600; font-size: 24px; letter-spacing: .3em; text-transform: uppercase;
}
.hw-code input::placeholder { color: #8A8780; }
.hw-code input:focus { outline: none; }
.hw-code:focus-within { box-shadow: inset 0 2px 5px rgba(0, 0, 0, .7), 0 0 0 3px rgba(255, 90, 31, .45); }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 600; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.join-row, .share { display: flex; gap: 10px; }
.join-row .key, .share .key { flex: none; min-width: 92px; }

.how { list-style: none; margin: 0; padding: 0 4px; display: grid; gap: 12px; }
.how li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.how-n {
  width: 28px; height: 28px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--ink); color: var(--paper);
  font-weight: 800; font-size: 13px;
}
.how li:nth-child(2) .how-n { background: var(--signal); color: var(--ink); }
.how p { font-size: 15px; line-height: 1.45; color: var(--muted); padding-top: 3px; }
.how strong { color: var(--ink); font-weight: 700; }

/* ---------- join / gone ---------- */
.code-inline {
  font-family: var(--f-mono); font-weight: 600; letter-spacing: .14em;
  background: var(--ink); color: var(--paper); border-radius: 8px; padding: 0 10px;
  font-size: .8em; vertical-align: .08em;
}

/* ---------- lobby ---------- */
.lobby-head { text-align: center; }
.lobby-head .sub { margin-inline: auto; }
.dots i { font-style: normal; animation: blink 1.4s infinite both; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .15; } 40% { opacity: 1; } }

.counter { display: flex; gap: 8px; justify-content: center; padding: 4px 0 6px; }
.counter span {
  width: 64px; height: 82px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #111 0 49%, #000 49% 51%, #1A1A1A 51%);
  color: var(--paper);
  font-family: var(--f-mono); font-weight: 600; font-size: 42px;
  border-radius: 10px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .7);
}
.share-link { font-family: var(--f-mono); font-size: 14px; color: var(--muted); }

/* ---------- top bar score + chip ---------- */
.score { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.s-name { font-weight: 600; max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-num {
  font-family: var(--f-mono); font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--ink); color: var(--paper);
  border-radius: 6px; padding: 2px 7px; min-width: 26px; text-align: center;
}
.s-sep { color: var(--muted-soft); }
.room-chip {
  border: 0; height: 34px; padding: 0 12px;
  font-family: var(--f-mono); font-weight: 600; font-size: 13px; letter-spacing: .16em;
  background: var(--paper); color: var(--ink); border-radius: 9px;
  box-shadow: var(--shadow-key);
}
.room-chip:active { transform: translateY(1px); box-shadow: var(--shadow-key-down); }
@media (max-width: 420px) { .s-name { display: none; } }

/* ---------- banner + toast ---------- */
.banner {
  max-width: var(--maxw); margin: 0 auto 8px;
  padding: 10px var(--gutter);
  background: var(--ink); color: var(--paper);
  font-size: 14px; font-weight: 500; text-align: center;
}
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 50;
  transform: translateX(-50%);
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  background: var(--ink); color: var(--paper);
  border-radius: var(--r); font-size: 15px; font-weight: 500;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .5);
  animation: toast .35s var(--ease-out);
}
@keyframes toast { from { transform: translate(-50%, 12px); opacity: 0; } }

/* ---------- mic (record key) ---------- */
.mic { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 0 8px; }
.mic-stage { position: relative; width: 184px; height: 184px; display: grid; place-items: center; }
.mic-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.mic-ring circle { fill: none; stroke-width: 5; }
.mic-ring .track { stroke: rgba(244, 242, 236, .12); }
.mic-ring .prog { stroke: var(--signal); stroke-linecap: round; transition: stroke-dashoffset .1s linear; }
.mic-level {
  position: absolute; width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255, 90, 31, .18);
  transition: transform .08s linear;
}
.mic-btn {
  position: relative;
  width: 108px; height: 108px; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 50% 35%, #FF7440, var(--signal) 60%, var(--signal-deep));
  color: var(--ink);
  display: grid; place-items: center;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18), inset 0 2px 0 rgba(255, 255, 255, .3), 0 10px 22px -8px rgba(0, 0, 0, .7), 0 0 0 6px #2A2A29;
  transition: transform .12s var(--ease-out);
}
.mic-btn svg { width: 38px; height: 38px; }
.mic-btn:active { transform: scale(.97); }
.mic.is-recording .mic-btn { background: var(--paper); }
.mic.is-processing .mic-btn { opacity: .6; pointer-events: none; }
.mic-time { font-family: var(--f-mono); font-weight: 500; font-size: 28px; font-variant-numeric: tabular-nums; letter-spacing: .02em; margin-top: 10px; }
.mic-time small { font-size: 15px; color: #A8A49C; }
.mic-hint { font-size: 14px; color: #B8B4AC; }
.mic-error { text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 12px 4px; max-width: 36ch; }
.mic-error strong { font-size: 18px; }
.mic-error p { font-size: 14px; color: #B8B4AC; margin-bottom: 6px; }

/* compact mic on a light panel (sing it backwards) */
.mic.compact { padding: 6px 0 0; }
.mic.compact .mic-stage { width: 132px; height: 132px; }
.mic.compact .mic-btn { width: 76px; height: 76px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), inset 0 2px 0 rgba(255, 255, 255, .3), 0 0 0 5px var(--ink); }
.mic.compact .mic-btn svg { width: 28px; height: 28px; }
.mic.compact .mic-level { width: 92px; height: 92px; }
.mic.compact .mic-ring .track { stroke: rgba(28, 28, 28, .12); }
.mic.compact .mic-time { font-size: 20px; margin-top: 4px; }
.mic.compact .mic-time small, .mic.compact .mic-hint, .mic.compact .mic-error p { color: var(--muted); }
.mic.compact.is-recording .mic-btn { background: var(--ink); color: var(--paper); }

/* ---------- deck (every clip is a small cassette) ---------- */
.deck {
  --tone: var(--signal);
  --wave-base: #F4F2EC;
  --reel-tape: var(--tape);
  --reel-hub: var(--paper);
  --reel-spoke: var(--ink);
  --p: 0;
  position: relative;
  background: linear-gradient(180deg, #2C2C2B, var(--ink) 45%);
  border-radius: 16px;
  padding: 12px 12px 0;
  box-shadow: var(--shadow-housing), inset 0 1px 0 rgba(255, 255, 255, .08);
  color: var(--ink);
}
.deck.tone-orig { --tone: var(--cobalt-lit); }
.deck.tone-take { --tone: #FFB08A; }
.deck-label {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  background: var(--paper);
  border-radius: 8px 8px 4px 4px;
  padding: 8px 8px 8px 9px;
}
.deck-side {
  width: 30px; height: 30px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--signal); color: var(--ink);
  font-weight: 800; font-size: 16px; letter-spacing: -.02em;
}
.tone-orig .deck-side { background: var(--cobalt); color: var(--paper); }
.tone-take .deck-side { background: #FFB08A; }
.deck-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-time {
  font-family: var(--f-mono); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap;
  background: #111; color: var(--paper);
  padding: 6px 8px; border-radius: 6px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .7);
}
.deck-lock { font-family: var(--f-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #C9C5BD; }
.deck-play {
  width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: var(--tone); color: var(--ink);
  display: grid; place-items: center;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 4px rgba(0, 0, 0, .25);
  transition: transform .12s var(--ease-out);
}
.tone-orig .deck-play { background: var(--cobalt); color: var(--paper); }
.deck-play svg { width: 18px; height: 18px; }
.deck-play:active { transform: scale(.95); }
.deck-window {
  margin: 12px 10% 0;
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; align-items: center;
  background: var(--window);
  border-radius: 999px;
  padding: 6px 10px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6);
}
.pack {
  position: relative; width: 44px; height: 44px; display: grid; place-items: center;
}
.pack::before {
  content: ''; position: absolute; left: 50%; top: 50%; border-radius: 50%;
  background: var(--tape);
  width: 100%; height: 100%;
  transform: translate(-50%, -50%) scale(var(--s));
  transition: transform .2s linear;
}
.pack-l { --s: calc(.62 + (1 - var(--p)) * .38); }
.pack-r { --s: calc(.62 + var(--p) * .38); }
.pack .reel { position: relative; width: 26px; height: 26px; }
.deck .reel circle:first-child { fill: transparent; }
.deck.playing .reel { animation: spin var(--spin, 1.6s) linear infinite; }
.deck-wave { width: 100%; height: 36px; cursor: pointer; touch-action: none; }
.deck-foot {
  width: 56%; height: 16px; margin: 10px auto 0;
  background: #262625;
  clip-path: polygon(5% 0, 95% 0, 100% 100%, 0 100%);
  display: flex; justify-content: space-evenly; align-items: center;
}
.deck-foot i { width: 6px; height: 6px; border-radius: 50%; background: #0E0E0E; }
.deck.locked .deck-play { background: #3A3A39; color: #77746E; cursor: default; }
.deck.locked .pack { opacity: .45; }
.deck.locked .deck-wave { cursor: default; }

/* ---------- record: preview + settings ---------- */
#recordCard { display: flex; flex-direction: column; gap: 10px; }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.preview .deck { box-shadow: none; background: #2A2A29; }

.settings { gap: 6px; }
.settings .card-title { margin-bottom: 4px; }
.setting {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
  cursor: default;
}
label.setting { cursor: pointer; }
.setting-name { font-weight: 700; font-size: 16px; }
.setting-help { font-size: 14px; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 6px; background: var(--ink); border-radius: 12px; padding: 4px; }
.step {
  width: 40px; height: 40px; border: 0; border-radius: 9px;
  background: #3A3A39; color: var(--paper);
  display: grid; place-items: center;
}
.step svg { width: 16px; height: 16px; }
.step:disabled { opacity: .35; cursor: not-allowed; }
.step:active:not(:disabled) { background: #4A4A48; }
.stepper output {
  min-width: 34px; text-align: center;
  font-family: var(--f-mono); font-weight: 600; font-size: 20px; color: var(--paper); font-variant-numeric: tabular-nums;
}
.switch { position: relative; flex: none; width: 56px; height: 32px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px;
  background: #BDB9B1; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .2);
  transition: background-color .2s;
}
.switch i::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--paper); box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .25s var(--ease-out);
}
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { transform: translateX(24px); background: var(--signal); }
.switch input:focus-visible + i { outline: 2px solid var(--signal); outline-offset: 3px; }

.btn-sticky { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 5; }
@media (min-width: 900px) { .btn-sticky { position: static; } }

/* ---------- await ---------- */
.await { max-width: 520px; margin: 10vh auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.await .sub { margin-top: 12px; }
.vu { display: flex; align-items: flex-end; gap: 5px; height: 72px; margin-bottom: 24px; padding: 12px 16px; background: var(--ink); border-radius: 14px; box-shadow: var(--shadow-housing); }
.vu i { width: 8px; height: 100%; border-radius: 2px; background: var(--paper); transform-origin: bottom; animation: vu 1.1s ease-in-out infinite; }
.vu i:nth-child(n+7) { background: var(--signal); }
.vu i:nth-child(2) { animation-delay: -.3s; } .vu i:nth-child(3) { animation-delay: -.7s; }
.vu i:nth-child(4) { animation-delay: -.15s; } .vu i:nth-child(5) { animation-delay: -.5s; }
.vu i:nth-child(6) { animation-delay: -.9s; } .vu i:nth-child(7) { animation-delay: -.25s; }
.vu i:nth-child(8) { animation-delay: -.6s; } .vu i:nth-child(9) { animation-delay: -.4s; }
@keyframes vu { 0%, 100% { transform: scaleY(.18); } 50% { transform: scaleY(1); } }
.vu-small { height: 48px; padding: 9px 12px; margin: 0 auto 14px; box-shadow: none; }
.vu-small i { width: 6px; }

/* ---------- guess ---------- */
.speed { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px; }
.speed-keys { display: flex; gap: 4px; padding: 4px; background: var(--ink); border-radius: 12px; }
.speed-keys button {
  min-width: 60px; height: 40px; border: 0; border-radius: 9px;
  background: transparent; color: #B8B4AC;
  font-family: var(--f-mono); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums;
  transition: background-color .15s, color .15s;
}
.speed-keys button:hover { color: var(--paper); }
.speed-keys button.on { background: var(--signal); color: var(--ink); }

.guess-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pill {
  font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(28, 28, 28, .07); color: var(--ink);
}
.pill.low { background: var(--signal-tint); }
.guess-row { display: flex; gap: 10px; }
.guess-row .key { flex: none; }
@media (max-width: 480px) {
  .guess-row { flex-direction: column; }
  .guess-row .key { width: 100%; }
}
.guess-box.is-waiting .input { background: #E8E5DF; }
.judging { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(28, 28, 28, .15); border-top-color: var(--signal); animation: spin .8s linear infinite; }
.give-up[data-confirm="1"] { color: var(--signal-deep); text-decoration-color: currentColor; }

.history-wrap { background: rgba(255, 255, 255, .22); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px 8px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .05); }
.history { list-style: none; margin: 8px 0 0; padding: 0; }
.history li {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 11px 0; border-top: 1px solid var(--line-soft);
  animation: rise .35s var(--ease-out);
}
.history li:first-child { border-top: 0; }
.h-num { font-family: var(--f-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.h-text { font-weight: 600; overflow-wrap: anywhere; }
.h-verdict { font-family: var(--f-mono); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; }
.v-yes { background: var(--signal); color: var(--ink); }
.v-no { background: rgba(28, 28, 28, .08); color: var(--muted); }
.v-wait { color: var(--signal-deep); background: var(--signal-tint); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.sing { padding: 0; overflow: hidden; }
.sing summary {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: 40px 1fr 16px; gap: 14px; align-items: center;
  padding: 16px 18px;
}
.sing summary::-webkit-details-marker { display: none; }
.sing-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--ink); color: var(--paper); display: grid; place-items: center; }
.sing-icon svg { width: 20px; height: 20px; }
.sing summary strong { display: block; font-size: 16px; }
.sing summary small { display: block; font-size: 14px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.chev { width: 16px; height: 16px; color: var(--muted); transition: transform .25s var(--ease-out); }
.sing[open] .chev { transform: rotate(90deg); }
.sing-body { padding: 0 18px 18px; }

/* ---------- judge ---------- */
.verdict-card {
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: 24px 22px 22px;
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .05);
  animation: rise .4s var(--ease-out);
}
.verdict-guess {
  margin: 0 0 18px;
  font-weight: 800; font-size: clamp(30px, 5.4vw, 46px); line-height: 1.05; letter-spacing: -.035em;
  overflow-wrap: anywhere; text-wrap: balance;
}
.verdict-guess[data-len="mid"] { font-size: clamp(26px, 4.4vw, 36px); }
.verdict-guess[data-len="long"] { font-size: clamp(20px, 3.2vw, 26px); line-height: 1.25; letter-spacing: -.02em; }
.verdict-q { font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.verdict-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.listen-card { text-align: center; padding: 28px 20px; color: var(--muted); }

/* ---------- reveal ---------- */
.reveal-head { margin: 8px 0 26px; }
.reveal-title { font-size: clamp(2.6rem, 7vw, 4.8rem); }
body[data-outcome="correct"] .reveal-title { color: var(--ink); }
.reveal-msg { margin-top: 12px; font-size: 18px; line-height: 1.5; color: var(--muted); max-width: 52ch; text-wrap: pretty; }
.reveal-answer {
  display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  margin-top: 14px; padding: 8px 14px;
  background: var(--paper); border-radius: 10px; border: 1px solid var(--line-soft);
  font-size: 15px; color: var(--muted);
}
.reveal-answer b { color: var(--ink); font-size: 17px; }

.reveal-tapes { gap: 12px; }
.flipper { display: grid; perspective: 1400px; }
.flipper .face {
  grid-area: 1 / 1;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform .9s var(--ease-out);
}
.flipper .face-a { transform: rotateY(-180deg); }
.flipper.flipped .face-b { transform: rotateY(180deg); }
.flipper.flipped .face-a { transform: rotateY(0deg); }
.flipper.no-anim .face { transition: none; }
.side-keys { display: flex; gap: 4px; padding: 4px; background: var(--ink); border-radius: 12px; align-self: flex-start; }
.side-keys button {
  height: 40px; padding: 0 14px; border: 0; border-radius: 9px;
  background: transparent; color: #B8B4AC;
  font-size: 14px; font-weight: 600;
}
.side-keys button:hover { color: var(--paper); }
.side-keys button.on { background: var(--paper); color: var(--ink); }

.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 10px; }
.sb-p {
  display: grid; justify-items: center; gap: 4px;
  background: rgba(255, 255, 255, .22); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 12px; min-width: 0;
}
.sb-num {
  min-width: 68px; padding: 6px 12px; text-align: center;
  background: linear-gradient(180deg, #111 0 49%, #000 49% 51%, #1A1A1A 51%);
  color: var(--paper); border-radius: 10px;
  font-family: var(--f-mono); font-weight: 600; font-size: 40px; line-height: 1.1; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .7);
}
.sb-p.lead .sb-num { color: var(--signal); }
[data-screen="reveal"]:not([hidden]) .sb-p.lead .sb-num { animation: counter-roll .6s var(--ease-out) 1.9s; }
@keyframes counter-roll { 0%, 100% { transform: rotateX(0); } 45% { transform: rotateX(88deg); } }
.sb-name { margin-top: 8px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-you { font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sb-vs { align-self: center; font-family: var(--f-mono); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }

/* ---------- small screens ---------- */
@media (max-width: 899px) {
  .home-art .cassette { max-width: 360px; }
  .home .display { font-size: clamp(2.5rem, 11vw, 3.6rem); }
}
@media (max-width: 380px) {
  :root { --gutter: 16px; }
  .counter span { width: 54px; height: 70px; font-size: 34px; }
  .deck-window { margin-inline: 4%; }
  .speed-keys button { min-width: 52px; }
}

/* ---------- home: notes + questions ---------- */
.notes { margin-top: 72px; padding-top: 40px; border-top: 1px solid var(--line); display: grid; gap: 28px; }
.notes-intro .sub { max-width: 62ch; }
.faq { display: grid; gap: 10px; }
.faq-item {
  background: rgba(255, 255, 255, .22);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .05);
}
.faq-item summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px 18px; min-height: 56px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item h3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; line-height: 1.35; }
.faq-item[open] .chev { transform: rotate(90deg); }
.faq-item p { padding: 0 18px 18px; color: var(--muted); font-size: 15.5px; line-height: 1.6; max-width: 68ch; }
@media (min-width: 900px) {
  .notes { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 64px; align-items: start; margin-top: 40px; }
  .notes-intro { position: sticky; top: 24px; }
}

.deck-wave:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; border-radius: 4px; }
.screen-focus:focus { outline: none; }

@media (prefers-reduced-motion: reduce) {
  /* Keep state changes (the tape still turns over, keys still press) but drop
     looping and decorative motion. "Flip it." rests mirrored so the idea still reads. */
  .display .flip { animation: none; transform: scaleX(-1); }
  .cl-reel, .deck.playing .reel, .vu i, .dots i, .spinner { animation-duration: 4s !important; }
  .vu i { animation: none; transform: scaleY(.55); }
  .flipper .face { transition-duration: .25s; }
  .history li, .verdict-card, .toast, [data-screen="reveal"]:not([hidden]) .sb-p.lead .sb-num { animation: none; }
}
