/* Family Room (docs/FAMILY-ROOM.md): the phone controller (room/index.html) and the TV lobby (family-room.html).
 * The controller is a made object, not a web form: a dark shell lit in the player's own colour (--me), glossy domed buttons that go down
 * under the thumb, a stick that appears where the thumb lands. Targets are 72px and up (88px in Amaya's persona); still under reduced motion. */

:root { --me: #ff6b5e; --fr-ink: #fff; --fr-shell: #15131c; --fr-shell-2: #221e2c; }

/* ---------------------------------------------------------------- the join card ---------------------------------------------------------------- */
.fr-pad-main { max-inline-size: 560px; margin-inline: auto; padding: var(--s-4, 16px); }
.fr-join { display: grid; gap: var(--s-3, 12px); text-align: center; margin-block-start: var(--s-4, 16px); overflow: hidden; position: relative; }
.fr-join h1 { font-size: var(--t-title1, 30px); margin: 0; display: flex; justify-content: center; align-items: center; gap: var(--s-2, 8px); }
.fr-who { margin: 0; color: var(--ink-2); }
.fr-join-form { display: grid; gap: var(--s-3, 12px); }
.fr-code-lab { font-weight: 700; }
.fr-code { font: inherit; font-size: clamp(34px, 11vw, 48px); font-weight: 800; letter-spacing: .12em; text-align: center; font-variant-numeric: tabular-nums;
  inline-size: 100%; min-block-size: max(72px, var(--target)); border-radius: var(--r-lg, 18px); border: 2px solid var(--control-edge, var(--line)); background: var(--surface); color: var(--ink); }
.fr-code:focus-visible { outline: 3px solid var(--accent-ink, var(--accent)); outline-offset: 3px; }
.fr-join .fk-btn { min-block-size: max(56px, var(--target)); font-size: var(--t-title3, 20px); }
.fr-msg { margin: 0; min-block-size: 1.4em; font-weight: 650; }
.fr-msg.is-bad { color: var(--danger-ink, #b3261e); }
/* a little picture: a TV and three phones in the family's colours */
.fr-join-art { position: relative; block-size: 112px; inline-size: 220px; margin: var(--s-2, 8px) auto 0; }
.fr-join-tv { position: absolute; inset: 0 30px 34px; border-radius: 14px; background: linear-gradient(160deg, #2a2537, #121019); box-shadow: inset 0 0 0 5px #3a3448, 0 10px 18px -8px rgb(0 0 0 / .45); }
.fr-join-tv::before { content: ""; position: absolute; inset: 14px 18px; border-radius: 6px; background: radial-gradient(60% 80% at 50% 40%, color-mix(in oklch, var(--accent) 70%, white), color-mix(in oklch, var(--accent) 50%, #1a1626)); opacity: .9; }
.fr-join-tv::after { content: ""; position: absolute; inline-size: 44px; block-size: 6px; border-radius: 3px; background: #3a3448; inset-block-end: -12px; inset-inline-start: calc(50% - 22px); }
.fr-join-ph { position: absolute; inset-block-end: 0; inline-size: 30px; block-size: 50px; border-radius: 8px; background: #1b1824; box-shadow: inset 0 0 0 3px #2f2a3c, 0 6px 10px -4px rgb(0 0 0 / .4); }
.fr-join-ph::after { content: ""; position: absolute; inset: 9px 7px; border-radius: 50%; }
.fr-join-ph.p1 { inset-inline-start: 6px; rotate: -12deg; } .fr-join-ph.p1::after { background: #ff6b5e; }
.fr-join-ph.p2 { inset-inline-start: calc(50% - 15px); inset-block-end: -6px; } .fr-join-ph.p2::after { background: #3fa9ff; }
.fr-join-ph.p3 { inset-inline-end: 6px; rotate: 12deg; } .fr-join-ph.p3::after { background: #ffc83d; }
.fr-join-art--end { block-size: 90px; }
@media (prefers-reduced-motion: no-preference) {
  .fr-join-ph { animation: fr-bob 3.2s ease-in-out infinite; } .fr-join-ph.p2 { animation-delay: -1s; } .fr-join-ph.p3 { animation-delay: -2s; }
}
@keyframes fr-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }

/* ---------------------------------------------------------------- the controller ---------------------------------------------------------------- */
html[data-fr-view="pad"] .fos-shell-top, html[data-fr-view="pad"] .fos-shell-tabs, html[data-fr-view="pad"] .fd-skip { display: none !important; }
html[data-fr-view="pad"], html[data-fr-view="pad"] body { overflow: hidden; overscroll-behavior: none; background: var(--fr-shell); }
html[data-fr-view="pad"][data-fos-shell] body { padding: 0; }
.fr-padview { position: fixed; inset: 0; z-index: 5; display: grid; grid-template-rows: auto 1fr; color: var(--fr-ink);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background:
    radial-gradient(120% 70% at 50% -10%, color-mix(in oklch, var(--me) 45%, transparent), transparent 60%),
    radial-gradient(80% 60% at 50% 115%, color-mix(in oklch, var(--me) 28%, transparent), transparent 70%),
    linear-gradient(180deg, var(--fr-shell-2), var(--fr-shell));
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }
.fr-padview[hidden] { display: none; }
/* a fine grain, like moulded plastic */
.fr-padview::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgb(255 255 255 / .04) 1px, transparent 1.2px); background-size: 5px 5px; }
.fr-bar { position: relative; display: flex; align-items: center; gap: var(--s-2, 8px); padding: 10px 12px; min-block-size: 56px; }
.fr-me { display: flex; align-items: center; gap: 10px; min-inline-size: 0; flex: 1 1 auto; }
.fr-me-dot { flex: none; inline-size: 34px; block-size: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / .7) 0 12%, transparent 40%), var(--me); box-shadow: 0 0 0 3px rgb(255 255 255 / .9), 0 0 18px 2px color-mix(in oklch, var(--me) 70%, transparent); }
.fr-me-text { display: grid; line-height: 1.1; min-inline-size: 0; }
.fr-me-text b { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-me-text small { font-size: 13px; opacity: .75; }
.fr-title { font-weight: 700; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-title:empty { display: none; }
.fr-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; opacity: .85; white-space: nowrap; }
.fr-link i { inline-size: 10px; block-size: 10px; border-radius: 50%; background: #ffc83d; box-shadow: 0 0 8px #ffc83d; }
.fr-link[data-link="direct"] i, .fr-link[data-link="local"] i { background: #3ccf7a; box-shadow: 0 0 8px #3ccf7a; }
.fr-link[data-link="relay"] i { background: #3fa9ff; box-shadow: 0 0 8px #3fa9ff; }
@media (max-width: 420px) { .fr-link span { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); } }
.fr-leave { flex: none; min-block-size: 44px; min-inline-size: 64px; padding: 0 14px; border-radius: 999px; font: inherit; font-weight: 700; font-size: 15px; color: #fff;
  background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .28); }
.fr-pad { position: relative; min-block-size: 0; display: grid; padding: 12px 16px max(18px, env(safe-area-inset-bottom, 0px)); }

/* the buttons: glossy domes in a ring of the shell */
.fr-btn { --b: var(--me); --bd: oklch(from var(--b) calc(l - 0.18) c h); position: relative; display: grid; place-items: center; padding: 0; margin: 0;
  inline-size: var(--sz, 96px); block-size: var(--sz, 96px); min-inline-size: 72px; min-block-size: 72px; border-radius: 50%; border: 0; cursor: pointer;
  font: inherit; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgb(0 0 0 / .45); touch-action: none; -webkit-tap-highlight-color: transparent;
  background: radial-gradient(circle at 34% 26%, rgb(255 255 255 / .75) 0 8%, rgb(255 255 255 / 0) 34%), radial-gradient(circle at 50% 62%, var(--b) 36%, var(--bd));
  box-shadow: 0 7px 0 var(--bd), 0 8px 0 5px #0b0a10, 0 16px 22px -4px rgb(0 0 0 / .55); translate: 0 -5px; }
.fr-btn[data-hue="0"] { --b: #ff6b5e; } .fr-btn[data-hue="1"] { --b: #3fa9ff; } .fr-btn[data-hue="2"] { --b: #ffc83d; color: #2a2100; text-shadow: 0 1px 0 rgb(255 255 255 / .5); } .fr-btn[data-hue="3"] { --b: #3ccf7a; }
.fr-btn-cap { font-size: clamp(18px, calc(var(--sz, 96px) * .26), 40px); line-height: 1.05; max-inline-size: 86%; overflow-wrap: anywhere; text-align: center; }
.fr-btn.is-down { translate: 0 2px; box-shadow: 0 0 0 var(--bd), 0 1px 0 5px #0b0a10, 0 4px 8px -2px rgb(0 0 0 / .5), 0 0 30px 6px color-mix(in oklch, var(--b) 60%, transparent); filter: brightness(1.12); }
.fr-btn:focus-visible { outline: 3px solid #fff; outline-offset: 6px; }
@media (prefers-reduced-motion: no-preference) { .fr-btn { transition: translate 60ms ease-out, box-shadow 60ms ease-out, filter 60ms; } }

/* two halves: move on the left, act on the right; thumbs at the bottom in portrait */
.fr-pad[data-layout="stick+2"], .fr-pad[data-layout="dpad+4"], .fr-pad[data-layout="tilt+2"] { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: end; }
.fr-zone { position: relative; display: grid; place-items: center; min-block-size: 0; block-size: 100%; }
@media (orientation: portrait) { .fr-zone { align-content: end; padding-block-end: 4vh; } }
.fr-ab { --sz: clamp(84px, 24vmin, 140px); grid-template-areas: ". a" "b ."; grid-template-columns: auto auto; justify-content: center; gap: 6px 10px; }
.fr-ab .fr-btn--a { grid-area: a; } .fr-ab .fr-btn--b { grid-area: b; --sz: clamp(76px, 20vmin, 118px); --b: color-mix(in oklch, var(--me) 55%, #8e8a9e); }
@media (orientation: landscape) { .fr-ab { --sz: clamp(84px, 30vmin, 150px); } }

/* the stick: a well in the shell; on touch it moves under the thumb */
.fr-stick { position: absolute; inset: 0; touch-action: none; }
.fr-stick-base { position: absolute; left: 50%; top: 58%; inline-size: clamp(132px, 40vmin, 200px); aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, rgb(0 0 0 / .45) 0 52%, rgb(255 255 255 / .06) 53% 62%, rgb(0 0 0 / .25) 63%); box-shadow: inset 0 6px 16px rgb(0 0 0 / .6), 0 1px 0 rgb(255 255 255 / .12); }
@media (orientation: portrait) { .fr-stick-base { top: auto; bottom: 4vh; translate: -50% 0; } .fr-stick.is-on .fr-stick-base { translate: -50% -50%; bottom: auto; } }
.fr-stick-base::after { content: ""; position: absolute; inset: 14%; border-radius: 50%; border: 2px dashed rgb(255 255 255 / .12); }
.fr-stick-knob { position: absolute; inset: 27%; border-radius: 50%; background: radial-gradient(circle at 36% 28%, rgb(255 255 255 / .7) 0 10%, transparent 38%), radial-gradient(circle at 50% 60%, var(--me) 40%, oklch(from var(--me) calc(l - 0.2) c h));
  box-shadow: 0 8px 14px rgb(0 0 0 / .55), 0 0 0 4px rgb(0 0 0 / .35), 0 0 24px color-mix(in oklch, var(--me) 50%, transparent); }
.fr-stick.is-on .fr-stick-knob { box-shadow: 0 4px 8px rgb(0 0 0 / .5), 0 0 0 4px rgb(0 0 0 / .35), 0 0 34px 6px color-mix(in oklch, var(--me) 60%, transparent); }

/* the cross */
.fr-dpad { position: relative; inline-size: clamp(168px, 48vmin, 236px); aspect-ratio: 1; touch-action: none; }
.fr-arm { position: absolute; inline-size: 36%; block-size: 36%; min-inline-size: 64px; min-block-size: 64px; border: 0; padding: 0; display: grid; place-items: center; color: rgb(255 255 255 / .7);
  background: linear-gradient(180deg, #34303f, #23202c); box-shadow: inset 0 1px 0 rgb(255 255 255 / .12), 0 6px 0 #0b0a10, 0 12px 16px -6px rgb(0 0 0 / .6); touch-action: none; }
.fr-arm svg { inline-size: 46%; fill: currentColor; }
.fr-arm--up { inset: 0 32% auto; border-radius: 14px 14px 4px 4px; }
.fr-arm--down { inset: auto 32% 0; border-radius: 4px 4px 14px 14px; } .fr-arm--down svg { rotate: 180deg; }
.fr-arm--left { inset: 32% auto 32% 0; border-radius: 14px 4px 4px 14px; } .fr-arm--left svg { rotate: -90deg; }
.fr-arm--right { inset: 32% 0 32% auto; border-radius: 4px 14px 14px 4px; } .fr-arm--right svg { rotate: 90deg; }
.fr-arm.is-down { color: #fff; background: linear-gradient(180deg, color-mix(in oklch, var(--me) 70%, #23202c), color-mix(in oklch, var(--me) 45%, #23202c)); box-shadow: inset 0 1px 0 rgb(255 255 255 / .2), 0 2px 0 #0b0a10, 0 0 22px color-mix(in oklch, var(--me) 55%, transparent); translate: 0 3px; }
.fr-dpad-hub { position: absolute; inset: 32%; background: #2a2734; border-radius: 4px; box-shadow: 0 6px 0 #0b0a10; }
.fr-dpad-hub::after { content: ""; position: absolute; inset: 30%; border-radius: 50%; background: radial-gradient(circle, rgb(0 0 0 / .45), transparent 70%); }
.fr-diamond { --sz: clamp(72px, 19vmin, 104px); grid-template-areas: ". d ." "c . b" ". a ."; grid-template-columns: repeat(3, auto); gap: 0; }
/* a phone held upright has no room for a diamond beside the cross: the four buttons sit in a square, A at the thumb */
@media (orientation: portrait) and (max-width: 600px) { .fr-diamond { --sz: 76px; grid-template-areas: "c d" "a b"; grid-template-columns: auto auto; gap: 10px; } .fr-dpad { inline-size: clamp(178px, 47vw, 210px); } }
.fr-diamond [data-btn="a"] { grid-area: a; } .fr-diamond [data-btn="b"] { grid-area: b; } .fr-diamond [data-btn="c"] { grid-area: c; } .fr-diamond [data-btn="d"] { grid-area: d; }

/* four big buttons: answer tiles you can find without looking */
.fr-pad[data-layout="buttons:4"] { place-items: stretch; }
.fr-grid4 { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: clamp(14px, 4vmin, 26px); padding: 6px 2px 10px; }
.fr-grid4 .fr-btn { inline-size: 100%; block-size: 100%; border-radius: 28px; --sz: 22vmin; }
.fr-grid4 .fr-btn-cap { font-size: clamp(22px, 7vmin, 44px); }
@media (orientation: landscape) { .fr-grid4 { grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr; } }

/* the buzzer: one big dome */
.fr-buzz-wrap { --sz: min(70vmin, 360px); position: relative; display: grid; place-items: center; }
/* the bezel the dome sits in (on the wrapper: the dome itself is a stacking context, a ring inside it would cover it) */
.fr-buzz-wrap::before { content: ""; position: absolute; inline-size: calc(var(--sz) + 40px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, #0b0a10 0 calc(50% - 22px), #3a3546 calc(50% - 20px), #1d1a24 calc(50% - 8px), #120f17 50%); box-shadow: 0 22px 34px -12px rgb(0 0 0 / .8), inset 0 2px 0 rgb(255 255 255 / .08); }
.fr-btn--buzz { --b: var(--me); }
.fr-btn--buzz .fr-btn-cap { font-size: clamp(30px, 10vmin, 64px); }

/* tilt: a wheel that turns with the phone */
.fr-wheel { inline-size: clamp(150px, 44vmin, 230px); aspect-ratio: 1; rotate: var(--turn, 0deg); touch-action: none; filter: drop-shadow(0 10px 14px rgb(0 0 0 / .55)); }
.fr-wheel svg { inline-size: 100%; block-size: 100%; }
.fr-wheel-rim { fill: none; stroke: #2e2a38; stroke-width: 22; } .fr-wheel-spoke { stroke: #2e2a38; stroke-width: 16; stroke-linecap: round; fill: none; }
.fr-wheel-hub { fill: var(--me); stroke: #0b0a10; stroke-width: 4; } .fr-wheel-mark { fill: var(--me); }
.fr-zone--move:has(.fr-wheel) { align-content: center; gap: 10px; }
.fr-allow { min-block-size: max(56px, var(--target)); }
.fr-hint { margin: 0; text-align: center; font-size: 14px; opacity: .8; }

/* draw: a sheet of paper */
.fr-pad[data-layout="draw"] { grid-template-rows: 1fr auto; gap: 12px; }
.fr-paper { position: relative; border-radius: 18px; overflow: hidden; background: #fbf8f1; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08), 0 14px 24px -10px rgb(0 0 0 / .6);
  background-image: radial-gradient(rgb(0 0 0 / .05) 1px, transparent 1.2px); background-size: 9px 9px; }
.fr-paper canvas { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; touch-action: none; cursor: crosshair; }
.fr-row { display: flex; gap: 14px; justify-content: center; }
.fr-btn--flat { --sz: auto; inline-size: auto; block-size: auto; min-block-size: 64px; min-inline-size: 132px; border-radius: 999px; padding: 0 22px; --b: #5b566a; }
.fr-btn--flat .fr-btn-cap { font-size: 20px; }
.fr-btn--go { --b: #3ccf7a; }

/* text: one short answer */
.fr-pad[data-layout="text"] { align-items: center; }
.fr-text { display: grid; gap: 14px; inline-size: min(100%, 520px); margin-inline: auto; }
.fr-text-lab { font-size: 22px; font-weight: 800; text-align: center; }
.fr-text input { font: inherit; font-size: 26px; min-block-size: 72px; padding: 0 18px; border-radius: 18px; border: 2px solid rgb(255 255 255 / .3); background: rgb(255 255 255 / .96); color: #15131c; }
.fr-text .fr-btn { inline-size: 100%; block-size: 72px; border-radius: 999px; --sz: auto; }
.fr-text .fr-btn-cap { font-size: 22px; }

/* a card the game sends ("Your turn", "You're in the blue car") */
.fr-card { position: absolute; inset-inline: 16px; inset-block-start: 70px; z-index: 3; display: grid; gap: 4px; justify-items: center; text-align: center; padding: 16px 18px; border-radius: 20px;
  background: rgb(18 16 26 / .92); border: 2px solid var(--me); box-shadow: 0 16px 30px -10px rgb(0 0 0 / .6), 0 0 30px color-mix(in oklch, var(--me) 35%, transparent); pointer-events: none; }
.fr-card[hidden] { display: none; }
.fr-card b { font-size: 22px; } .fr-card-emo { font-size: 40px; line-height: 1; }

/* Amaya (and anyone with big targets): bigger again */
[data-persona="amaya"] .fr-btn, [data-persona="grandparent"] .fr-btn { min-inline-size: 88px; min-block-size: 88px; }
[data-persona="amaya"] .fr-ab { --sz: clamp(96px, 28vmin, 150px); }
[data-persona="amaya"] .fr-diamond { --sz: clamp(80px, 21vmin, 112px); }
@media (orientation: portrait) and (max-width: 600px) { [data-persona="amaya"] .fr-diamond { --sz: 80px; gap: 6px; } }
[data-persona="amaya"] .fr-leave { min-block-size: 64px; min-inline-size: 88px; }
[data-persona="amaya"] .fr-arm { min-inline-size: 72px; min-block-size: 72px; }
@media (prefers-contrast: more), (forced-colors: active) { .fr-btn { outline: 3px solid ButtonText; } .fr-padview::before { display: none; } }
@media (prefers-reduced-motion: reduce) { .fr-padview *, .fr-lobby * { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- the TV lobby ---------------------------------------------------------------- */
.fr-lobby { --tv-pad: clamp(16px, 3vw, 48px); position: relative; color: #fff; isolation: isolate; border-radius: var(--r-xl, 28px); overflow: hidden;
  background: radial-gradient(110% 70% at 50% -5%, color-mix(in oklch, var(--accent) 40%, #1c1828), transparent 65%), radial-gradient(70% 50% at 50% 110%, color-mix(in oklch, var(--accent) 25%, transparent), transparent), linear-gradient(180deg, #1e1a29, #110f17);
  padding: var(--tv-pad); box-shadow: 0 30px 60px -30px rgb(0 0 0 / .7); }
/* a slow sweep of light across the room (still under reduced motion) */
.fr-lobby::before { content: ""; position: absolute; inset: -40% -10%; z-index: -1; background: conic-gradient(from 200deg at 50% 0%, transparent 0deg, rgb(255 255 255 / .06) 10deg, transparent 22deg, transparent 50deg, rgb(255 255 255 / .05) 60deg, transparent 72deg); }
@media (prefers-reduced-motion: no-preference) { .fr-lobby::before { animation: fr-sweep 18s ease-in-out infinite alternate; will-change: transform; } }
@keyframes fr-sweep { from { rotate: -8deg; } to { rotate: 8deg; } }
.fr-lobby-grid { display: grid; gap: var(--tv-pad); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .fr-lobby-grid { grid-template-columns: minmax(280px, 0.9fr) 1.1fr; } }
.fr-join-panel { display: grid; justify-items: center; gap: 12px; text-align: center; }
.fr-lobby h2 { margin: 0; font-size: clamp(22px, 2.6vw, 40px); }
.fr-qr { position: relative; inline-size: min(68vw, 340px); aspect-ratio: 1; padding: 14px; border-radius: 26px; background: #fff;
  box-shadow: 0 0 0 6px color-mix(in oklch, var(--accent) 70%, white), 0 0 50px 6px color-mix(in oklch, var(--accent) 45%, transparent), 0 26px 40px -16px rgb(0 0 0 / .7); }
.fr-qr svg { display: block; inline-size: 100%; block-size: 100%; }
.fr-qr[data-off] svg { opacity: .12; }
.fr-code-big { font-size: clamp(40px, 5.6vw, 84px); font-weight: 900; letter-spacing: .06em; font-variant-numeric: tabular-nums; line-height: 1; }
.fr-step { margin: 0; opacity: .82; font-size: clamp(15px, 1.4vw, 22px); max-inline-size: 30ch; }
.fr-ring { --left: 1; inline-size: 44px; block-size: 44px; border-radius: 50%; background: conic-gradient(#fff calc(var(--left) * 360deg), rgb(255 255 255 / .18) 0); -webkit-mask: radial-gradient(circle, transparent 46%, #000 48%); mask: radial-gradient(circle, transparent 46%, #000 48%); }
.fr-codeline { display: flex; align-items: center; gap: 12px; }
.fr-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.fr-player { --c: #888; position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; background: linear-gradient(135deg, color-mix(in oklch, var(--c) 32%, #221e2c), #1b1823); box-shadow: inset 0 0 0 2px color-mix(in oklch, var(--c) 70%, transparent), 0 14px 22px -14px rgb(0 0 0 / .8); }
.fr-player-face { flex: none; inline-size: 58px; block-size: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; font-weight: 900; color: #fff;
  background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / .55) 0 10%, transparent 38%), var(--c); box-shadow: 0 0 0 3px #fff, 0 0 24px color-mix(in oklch, var(--c) 70%, transparent); text-shadow: 0 2px 3px rgb(0 0 0 / .35); }
.fr-player b { display: block; font-size: clamp(18px, 1.7vw, 28px); line-height: 1.1; }
.fr-player small { display: flex; align-items: center; gap: 6px; opacity: .8; font-size: 14px; }
.fr-player small i { inline-size: 8px; block-size: 8px; border-radius: 50%; background: #ffc83d; }
.fr-player[data-link="direct"] small i, .fr-player[data-link="local"] small i { background: #3ccf7a; } .fr-player[data-link="relay"] small i { background: #3fa9ff; }
.fr-player.is-press { box-shadow: inset 0 0 0 3px #fff, 0 0 36px 4px color-mix(in oklch, var(--c) 70%, transparent); }
.fr-seat-empty { display: flex; align-items: center; justify-content: center; min-block-size: 82px; border-radius: 20px; border: 2px dashed rgb(255 255 255 / .2); color: rgb(255 255 255 / .55); font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
  .fr-player { animation: fr-arrive 420ms cubic-bezier(.2, .9, .3, 1.3) both; }
  .fr-player.is-press { transition: box-shadow 80ms; }
}
@keyframes fr-arrive { from { opacity: 0; translate: 0 18px; scale: .92; } to { opacity: 1; translate: 0 0; scale: 1; } }
/* the dot race: lanes to a chequered line */
.fr-race { position: relative; display: grid; gap: 10px; padding: 16px 18px; border-radius: 22px; background: linear-gradient(180deg, #24202f, #17141e); box-shadow: inset 0 2px 10px rgb(0 0 0 / .5); }
.fr-race-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fr-race-head h3 { margin: 0; font-size: clamp(18px, 1.7vw, 28px); }
.fr-lane { --c: #888; position: relative; block-size: 46px; border-radius: 999px; background: linear-gradient(90deg, color-mix(in oklch, var(--c) 18%, #1a1721), #1a1721); overflow: hidden; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .06); }
.fr-lane::after { content: ""; position: absolute; inset-block: 0; inset-inline-end: 0; inline-size: 26px; background: repeating-conic-gradient(#fff 0 25%, #222 0 50%) 0 0 / 13px 13px; opacity: .85; }
.fr-dot { position: absolute; inset-block: 5px; inline-size: 36px; inset-inline-start: calc(6px + var(--x, 0) * (100% - 74px)); border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / .7) 0 12%, transparent 42%), var(--c);
  box-shadow: 0 0 0 3px #fff, 0 0 18px var(--c); display: grid; place-items: center; font-size: 15px; font-weight: 900; color: #fff; }
.fr-trail { position: absolute; inset-block: 19px; inset-inline-start: 6px; inline-size: calc(var(--x, 0) * (100% - 74px) + 18px); border-radius: 999px; background: linear-gradient(90deg, transparent, color-mix(in oklch, var(--c) 60%, transparent)); }
.fr-lane.is-home .fr-dot { box-shadow: 0 0 0 3px #fff, 0 0 30px 8px var(--c); }
.fr-race-note { margin: 0; font-size: clamp(15px, 1.4vw, 22px); opacity: .9; min-block-size: 1.4em; }
.fr-lobby .fk-btn { min-block-size: max(52px, var(--target)); }
.fr-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.fr-lobby .fr-layouts { display: flex; flex-wrap: wrap; gap: 8px; }
.fr-lobby .fr-layouts button { min-block-size: 44px; padding: 0 14px; border-radius: 999px; font: inherit; font-weight: 700; color: #fff; background: rgb(255 255 255 / .08); border: 1px solid rgb(255 255 255 / .22); }
.fr-lobby .fr-layouts button[aria-pressed="true"] { background: #fff; color: #15131c; }
.fr-lag { font-size: 14px; opacity: .7; margin: 0; }
/* the big screen: the room fills the TV, the QR can be read from the sofa */
@media (min-width: 1600px) and (min-height: 900px) {
  .fr-lobby { min-block-size: calc(100dvh - 150px); display: grid; align-content: center; }
  .fr-qr { inline-size: min(36vh, 460px); }
}
/* the lobby is always a lit room at night: its quiet buttons are light on dark in every theme */
.fr-lobby .fk-btn--ghost, .fr-lobby .fk-btn--secondary { color: #fff; background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .38); box-shadow: none; }
.fr-lobby .fk-btn--ghost[aria-pressed="true"] { background: #fff; color: #15131c; }
@media (orientation: portrait) and (max-width: 600px) { [data-persona="amaya"] .fr-pad { padding-inline: 8px; } [data-persona="amaya"] .fr-dpad { inline-size: 172px; } }
/* four tiles: a sheen across the top instead of a dome's spot, and a shape on each so a colour is never the only clue */
.fr-grid4 .fr-btn { background: linear-gradient(180deg, rgb(255 255 255 / .38), rgb(255 255 255 / 0) 34%), radial-gradient(120% 90% at 50% 30%, var(--b) 55%, var(--bd)); }
.fr-grid4 .fr-btn::before { position: absolute; inset-block-start: 14px; inset-inline-start: 16px; font-size: 26px; line-height: 1; opacity: .85; text-shadow: none; color: rgb(255 255 255 / .92); }
.fr-grid4 .fr-btn[data-hue="2"]::before { color: rgb(42 33 0 / .8); }
.fr-grid4 [data-btn="a"]::before { content: "●"; } .fr-grid4 [data-btn="b"]::before { content: "▲"; } .fr-grid4 [data-btn="c"]::before { content: "■"; } .fr-grid4 [data-btn="d"]::before { content: "◆"; }
/* tilt held upright: the wheel on top, the two buttons side by side under the thumbs */
@media (orientation: portrait) {
  .fr-pad[data-layout="tilt+2"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; align-items: center; }
  .fr-pad[data-layout="tilt+2"] .fr-zone--move { padding-block-end: 0; align-content: center; }
  .fr-pad[data-layout="tilt+2"] .fr-ab { grid-template-areas: "b a"; align-items: end; justify-content: space-around; padding-block-end: 2vh; }
}
.fr-allow { max-inline-size: 100%; white-space: normal; }
.fr-btn.fr-btn--flat { min-inline-size: 140px; background: linear-gradient(180deg, rgb(255 255 255 / .3), rgb(255 255 255 / 0) 45%), var(--b); }
.fr-btn--flat .fr-btn-cap { white-space: nowrap; overflow-wrap: normal; max-inline-size: none; }
@media (max-width: 600px) { .fr-title { display: none; } }
.fr-text .fr-btn { background: linear-gradient(180deg, rgb(255 255 255 / .3), rgb(255 255 255 / 0) 45%), var(--b); }
/* the name pressed into the shell, like the maker's mark on a controller (upright two-thumb pads, where the top is free) */
@media (orientation: portrait) {
  .fr-pad[data-layout="stick+2"]::before, .fr-pad[data-layout="dpad+4"]::before { content: attr(data-name); position: absolute; inset-inline: 0; inset-block-start: 14%; text-align: center; pointer-events: none;
    font-size: clamp(54px, 19vw, 120px); font-weight: 900; letter-spacing: -.02em; line-height: 1; color: transparent; -webkit-text-stroke: 1.5px color-mix(in oklch, var(--me) 45%, transparent);
    text-shadow: 0 2px 0 rgb(0 0 0 / .35); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-inline: 16px; }
}
/* everyone home: the track lights up gold and a few dots in the family's colours float up from the line (still under reduced motion) */
.fr-race.is-done { box-shadow: inset 0 2px 10px rgb(0 0 0 / .5), 0 0 0 2px #ffc83d, 0 0 44px 4px rgb(255 200 61 / .35); }
.fr-race.is-done .fr-race-note { font-size: clamp(20px, 2vw, 34px); font-weight: 800; color: #ffe08a; }
#frLanes { position: relative; }
.fr-burst { position: absolute; inset: 0; pointer-events: none; }
.fr-burst i { position: absolute; inset-inline-end: var(--end); inset-block-start: var(--top); inline-size: 12px; block-size: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 12px var(--c); opacity: .9; }
@media (prefers-reduced-motion: no-preference) {
  .fr-burst i { animation: fr-float 1.6s cubic-bezier(.2, .8, .3, 1) var(--d) both; }
}
@keyframes fr-float { from { opacity: 0; translate: 0 30px; scale: .4; } 30% { opacity: 1; } to { opacity: 0; translate: var(--dx) -90px; scale: 1.2; } }
/* upright, the two buttons share one column on a diagonal (A high on the right, B low on the left), so big buttons always fit a half */
@media (orientation: portrait) {
  .fr-pad[data-layout="stick+2"] .fr-ab { grid-template-areas: "a" "b"; grid-template-columns: minmax(0, 1fr); justify-content: stretch; row-gap: 0; inline-size: 100%; }
  .fr-pad[data-layout="stick+2"] .fr-ab .fr-btn--a { justify-self: end; }
  .fr-pad[data-layout="stick+2"] .fr-ab .fr-btn--b { justify-self: start; margin-block-start: -18px; }
  .fr-pad[data-layout="stick+2"] .fr-ab { --sz: clamp(84px, 24vw, 110px); }
  [data-persona="amaya"] .fr-pad[data-layout="stick+2"] .fr-ab { --sz: clamp(92px, 25vw, 112px); }
}
[data-persona="amaya"] .fr-allow, [data-persona="amaya"] .fr-join .fk-btn, [data-persona="amaya"] .fr-text .fr-btn { min-block-size: 64px; }
.fr-join h1 { font-size: var(--t-title2, 26px); flex-wrap: wrap; }
.fr-msg:empty { display: none; }
.fr-msg.is-bad { padding: 10px 14px; border-radius: var(--r-md, 12px); background: var(--tint-b, rgb(0 0 0 / .05)); }
#room:focus { outline: none; }
