/* Void Rally interface, over the Godot canvas.
   Broadcast-style: flat dark plates with hard edges, one condensed display face
   for names and numbers, a plain sans for sentences, colour only where it
   carries meaning (your cyan, their magenta, live green). */

@font-face { font-family: "Barlow"; font-weight: 500; font-display: block; src: url(fonts/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: block; src: url(fonts/barlow-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: block; src: url(fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: block; src: url(fonts/barlow-condensed-latin-800-normal.woff2) format("woff2"); }

:root {
  --ink: #f2f4f7;
  --ink-2: rgba(242, 244, 247, 0.62);
  --ink-3: rgba(242, 244, 247, 0.38);
  --plate: rgba(9, 11, 15, 0.94);
  --hair: rgba(242, 244, 247, 0.14);
  --you: #35d0ff;
  --them: #ff4fb4;
  --live: #3ddc84;
  --warn: #f5a623;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --text: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --pad: max(18px, env(safe-area-inset-left));
}

html, body { background: #05060a; }
/* Godot's own loader stays hidden; its progress is mirrored onto the splash. */
#status { background: #05060a !important; opacity: 0 !important; }

#vr { position: fixed; inset: 0; pointer-events: none; z-index: 5; color: var(--ink); font-family: var(--text);
  -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; }
#vr [hidden] { display: none !important; }
#vr p { margin: 0; }
#vr .screen { position: absolute; inset: 0; display: none; }
#vr[data-screen="loading"] .loading, #vr[data-screen="menu"] .menu,
#vr[data-screen="lobby"] .lobby, #vr[data-screen="hud"] .hud { display: block; }

/* ---------- buttons ---------- */
#vr button { pointer-events: auto; cursor: pointer; font: inherit; color: inherit; background: none; border: 0; padding: 0; }
#vr .btn { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 0 18px;
  font-family: var(--display); font-weight: 600; font-size: 21px; letter-spacing: 0.01em;
  border: 1px solid rgba(242, 244, 247, 0.32); border-radius: 2px; background: rgba(9, 11, 15, 0.55);
  transition: background 0.15s, border-color 0.15s, transform 0.08s; }
#vr .btn:hover { border-color: var(--ink); }
#vr .btn:active { transform: translateY(1px); }
#vr .btn.primary { background: var(--ink); color: #07090c; border-color: var(--ink); }
#vr .btn.primary:hover { background: #fff; }
#vr .btn.fill { position: relative; overflow: hidden; justify-content: center; }
#vr .btn.fill .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(7, 9, 12, 0.16); pointer-events: none; }
#vr .btn.fill .l { position: relative; }
#vr #vr-vote-invite { display: block; margin: 12px auto 0; }
#vr .btn .go { font-family: var(--text); font-weight: 600; font-size: 18px; }
#vr .link-btn { min-height: 44px; padding: 0 4px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
#vr .link-btn:hover { color: var(--ink); }
#vr .x { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; font-size: 24px; line-height: 1; color: var(--ink-3); }
#vr .x:hover { color: var(--ink); }

/* ---------- title and menu ---------- */
.menu::before { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(5, 6, 10, 0) 30%, rgba(5, 6, 10, 0.78) 78%); }
.title, .menu .buttons { position: absolute; left: var(--pad); }
.title { bottom: calc(max(24px, env(safe-area-inset-bottom)) + 392px); }
#vr h1, .splash h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(64px, 19vw, 132px); line-height: 0.84;
  letter-spacing: -0.01em; text-transform: uppercase; }
.lede { margin-top: 14px !important; font-size: 16px; color: var(--ink-2); }
.menu .buttons { bottom: calc(max(24px, env(safe-area-inset-bottom)) + 34px); width: min(380px, calc(100vw - 2 * var(--pad))); display: flex; flex-direction: column; gap: 10px; }
.join { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--hair); }
.join label { font-size: 14px; color: var(--ink-2); }
.join input { pointer-events: auto; min-width: 0; height: 44px; font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid rgba(242, 244, 247, 0.4); border-radius: 0;
  outline: none; user-select: text; -webkit-user-select: text; }
.join input::placeholder { color: var(--ink-3); }
.join input:focus { border-bottom-color: var(--ink); }
#vr .join .btn { min-height: 44px; font-size: 18px; }
@media (min-width: 900px) and (min-height: 560px) {
  .title { bottom: auto; top: 18vh; }
  .menu::before { background: linear-gradient(90deg, rgba(5, 6, 10, 0.82) 0, rgba(5, 6, 10, 0.5) 32%, rgba(5, 6, 10, 0) 60%); }
}

/* ---------- sheets: invite and install ---------- */
.sheet { pointer-events: auto; position: absolute; left: var(--pad); right: var(--pad); bottom: max(64px, calc(env(safe-area-inset-bottom) + 56px));
  max-width: 420px; padding: 18px 18px 16px; background: var(--plate); border: 1px solid var(--hair); border-radius: 2px; }
.kicker { font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.invite .code { margin: 4px 0 2px !important; font-family: var(--display); font-weight: 800; font-size: 56px; line-height: 1; letter-spacing: 0.12em; }
.invite .link { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; -webkit-user-select: all; }
.invite .row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 16px 0 12px; }
#vr .invite .btn { min-height: 46px; font-size: 19px; justify-content: center; }
.fine { font-size: 13px; line-height: 1.45; color: var(--ink-2); }
#vr .chip { position: absolute; right: var(--pad); top: max(14px, env(safe-area-inset-top)); display: none; min-height: 40px; padding: 0 14px;
  font-family: var(--display); font-weight: 600; font-size: 16px; background: var(--plate); border: 1px solid var(--hair); border-radius: 2px; }
#vr .chip b { font-weight: 800; letter-spacing: 0.12em; margin-left: 6px; }
#vr.invite-min .invite { display: none; }
#vr.invite-min .chip { display: block; }

.install { z-index: 2; display: flex; align-items: flex-start; gap: 12px; padding-right: 44px; border-left: 3px solid var(--you); }
.install .text { flex: 1; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.install .text b { color: var(--ink); font-weight: 600; }
.install .text svg { vertical-align: -2px; color: var(--ink); }
.install .kicker { margin-bottom: 4px !important; color: var(--ink); }
/* The install prompt belongs to the menu; in a match it would sit on top of the invite and the arena. */
#vr:not([data-screen="menu"]) .install { display: none; }
#vr.has-install .menu .buttons { bottom: calc(max(24px, env(safe-area-inset-bottom)) + 150px); }
#vr.has-install .menu .title { bottom: calc(max(24px, env(safe-area-inset-bottom)) + 410px); }

.corner { position: absolute; left: var(--pad); bottom: max(8px, env(safe-area-inset-bottom)); display: flex; gap: 18px; }
#vr:not([data-ready]) .corner, #vr[data-screen="menu"] .corner [data-leave] { display: none; }
#vr[data-screen="menu"] .corner { left: auto; right: var(--pad); }
.note { display: none; }

/* ---------- score bug ---------- */
.bug { position: absolute; left: var(--pad); top: max(14px, env(safe-area-inset-top)); width: 184px; font-family: var(--display); }
#vr[data-screen="menu"] .bug, #vr:not([data-ready]) .bug { display: none; }
.bug .row { display: grid; grid-template-columns: 4px 1fr 44px; align-items: stretch; height: 34px; background: var(--plate); }
.bug .row + .row { border-top: 1px solid var(--hair); }
.bug .row i { display: block; }
/* The Tap's serve clock: a hairline along the server's row in their colour, draining to the left;
   amber and a touch heavier for the last two seconds, with a pulse on each (the clock's ticks). */
.bug .row { position: relative; }
.bug .row .clock { position: absolute; left: 4px; right: 0; bottom: 0; height: 2px; opacity: 0; text-decoration: none;
  transform-origin: left bottom; transform: scaleX(var(--k, 1)); background: var(--row-c);
  transition: opacity 0.18s ease-out, background-color 0.2s ease-out, height 0.2s ease-out; }
.bug .me .clock { --row-c: var(--you); }
.bug .them .clock { --row-c: var(--them); }
.bug .row .clock.on { opacity: 0.75; }
.bug .row .clock.on.warm { opacity: 1; height: 3px; background: var(--warn); }
.bug .row .clock.beat { animation: vr-clock-beat 0.45s ease-out; }
@keyframes vr-clock-beat { 0% { box-shadow: 0 0 10px 1px var(--warn); } 100% { box-shadow: 0 0 0 0 transparent; } }
.bug .me i { background: var(--you); }
.bug .them i { background: var(--them); }
.bug .name { align-self: center; padding-left: 10px; font-weight: 600; font-size: 17px; text-transform: uppercase; letter-spacing: 0.04em; }
.bug .row b { display: grid; place-items: center; font-weight: 800; font-size: 24px; font-variant-numeric: tabular-nums; background: rgba(242, 244, 247, 0.06); }
.bug .row b.tick { animation: vr-tick 0.6s ease-out; }
@keyframes vr-tick { 0% { background: var(--ink); color: #07090c; } 100% { background: rgba(242, 244, 247, 0.06); } }
.bug .strip { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0 0; font-weight: 600; font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; text-shadow: 0 1px 2px #000; }
.bug .state { color: var(--ink-2); }
.bug .state.live { color: var(--live); }
.bug .state.live::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; vertical-align: 1px; background: var(--live); }
.bug .rally { color: color-mix(in srgb, var(--ink) calc(100% - var(--heat, 0) * 100%), var(--warn)); }

/* ---------- banners ---------- */
#vr-banner { position: absolute; left: 0; right: 0; top: 38%; transform: translateY(-50%); }
#vr-banner .band { padding: 14px var(--pad) 16px; text-align: center; background: rgba(5, 6, 10, 0.74);
  border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair);
  clip-path: inset(0 50% 0 50%); opacity: 0; transition: clip-path 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.2s; }
#vr-banner.on .band { clip-path: inset(0 0 0 0); opacity: 1; }
#vr-banner .big { font-family: var(--display); font-weight: 800; font-size: clamp(44px, 12vw, 96px); line-height: 0.95; text-transform: uppercase; letter-spacing: 0.01em; }
#vr-banner .sub { margin-top: 6px; font-size: 15px; color: var(--ink-2); }
#vr-banner .sub:empty { display: none; }

/* ---------- splash ---------- */
.splash { position: fixed; inset: 0; z-index: 10; background: #05060a; color: var(--ink); font-family: var(--text);
  -webkit-font-smoothing: antialiased; transition: opacity 0.55s ease; }
.splash.out { opacity: 0; pointer-events: none; }
/* Text waits for its own face; the bar shows at once. */
.splash p { margin: 0; }
.splash .title, .splash .what { opacity: 0; transition: opacity 0.3s; }
.splash.fonts .title, .splash.fonts .what { opacity: 1; }
.splash .title { position: absolute; left: var(--pad); bottom: calc(max(24px, env(safe-area-inset-bottom)) + 260px); }
/* Same spot as the menu title, so the hand-over is a pure crossfade. */
.splash.has-install .title { bottom: calc(max(24px, env(safe-area-inset-bottom)) + 410px); }
.splash .load { position: absolute; left: var(--pad); right: var(--pad); bottom: max(28px, env(safe-area-inset-bottom)); max-width: 380px; }
.splash .bar { height: 2px; background: rgba(242, 244, 247, 0.14); overflow: hidden; }
.splash .bar i { display: block; height: 100%; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 0.2s linear; }
.splash .bar.busy i { width: 30%; transform: none; animation: vr-busy 1.1s ease-in-out infinite; }
@keyframes vr-busy { from { margin-left: -30%; } to { margin-left: 100%; } }
.splash .what { margin: 12px 0 0; font-family: var(--display); font-weight: 600; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2); font-variant-numeric: tabular-nums; }
@media (min-width: 900px) and (min-height: 560px) {
  .splash .title { bottom: auto; top: 18vh; }
}

/* ---------- frame rate and ping, top right ---------- */
.perf { position: absolute; right: var(--pad); top: max(14px, env(safe-area-inset-top)); display: flex; gap: 10px;
  font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
  font-variant-numeric: tabular-nums; color: var(--ink-2); text-shadow: 0 1px 2px #000; }
.perf .ping:empty { display: none; }
.perf .ping[data-q="good"] { color: var(--live); }
.perf .ping[data-q="ok"] { color: var(--warn); }
.perf .ping[data-q="bad"] { color: #ff5a5a; }
#vr[data-screen="menu"] .perf, #vr:not([data-ready]) .perf { display: none; }
/* In the lobby the folded invite button owns the corner; sit just under it. */
#vr[data-screen="lobby"].invite-min .perf { top: calc(max(14px, env(safe-area-inset-top)) + 50px); }

/* ---------- ready check and rematch vote ---------- */
#vr .decide { z-index: 3; }
.decide .headline { margin: 6px 0 14px !important; font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; text-transform: uppercase; }
.decide .fine { margin: -8px 0 14px !important; }
.decide .who { list-style: none; margin: 0 0 16px; padding: 0; border-top: 1px solid var(--hair); }
.decide .who li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--hair);
  font-family: var(--display); font-weight: 600; font-size: 16px; text-transform: uppercase; letter-spacing: 0.04em; }
.decide .who li:first-child span { color: var(--you); }
.decide .who li:last-child span { color: var(--them); }
.decide .who b { font-weight: 600; color: var(--ink-3); }
.decide .who b.on { color: var(--live); }
#vr .decide > .btn { width: 100%; justify-content: center; }
#vr .decide .row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
#vr .decide .btn { min-height: 50px; justify-content: center; }
/* The end-of-match Share row (match card, clips): one or more quiet buttons above Rematch. */
#vr .decide .share-row { display: flex; gap: 10px; margin-bottom: 10px; }
#vr .decide .share-row[hidden] { display: none; }
#vr .decide .share-row .btn { flex: 1; min-height: 44px; font-size: 17px; }
#vr .btn:disabled { opacity: 0.55; cursor: default; }
/* While a decision is up, the invite sheet steps aside. */
#vr.deciding .invite, #vr.deciding .chip { display: none !important; }
#vr #vr-log { position: absolute; right: var(--pad); top: calc(max(14px, env(safe-area-inset-top)) + 20px); pointer-events: auto; }

/* ---------- menu picks and stats ---------- */
.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
#vr .opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 52px; padding: 8px 12px;
  border: 1px solid var(--hair); border-radius: 2px; background: rgba(9, 11, 15, 0.55); text-align: left; }
#vr .opt:hover { border-color: var(--ink); }
#vr .opt span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
#vr .opt b { font-family: var(--display); font-weight: 600; font-size: 18px; white-space: nowrap; }
#vr-mode-note { min-height: 19px; }
.sheet.stats { z-index: 3; bottom: max(20px, env(safe-area-inset-bottom)); max-height: calc(100% - 60px); overflow-y: auto; background: #090b0f; }
.stats dl { margin: 10px 0 16px; }
.stats dl div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--hair); }
.stats dt { color: var(--ink-2); font-size: 14px; }
.stats dd { margin: 0; font-family: var(--display); font-weight: 600; font-size: 18px; font-variant-numeric: tabular-nums; }
.stats ul { list-style: none; margin: 8px 0 0; padding: 0; }
.stats li { display: grid; grid-template-columns: 18px 44px 56px 1fr auto; gap: 8px; align-items: baseline; padding: 5px 0; font-size: 13px; }
.stats li b { font-family: var(--display); font-size: 16px; }
.stats li.w b { color: var(--live); }
.stats li.l b { color: var(--them); }
.stats li .sc { font-family: var(--display); font-weight: 600; font-size: 16px; }
.stats li .dim { color: var(--ink-3); }
/* Short screens (a phone on its side): tighten the menu so it all fits. */
@media (max-height: 460px) {
  .menu .buttons { bottom: max(12px, env(safe-area-inset-bottom)); gap: 6px; }
  #vr .menu .btn { min-height: 44px; }
  #vr .opt { min-height: 44px; padding: 5px 10px; }
  #vr-mode-note, .menu .lede { display: none; }
  .menu .title { bottom: auto; top: max(14px, env(safe-area-inset-top)); }
  #vr .menu h1 { font-size: 44px; }
}
@media (max-height: 300px) { .opts { display: none; } #vr .menu h1 { display: none; } }

/* Settings sheet: rows are buttons that step to the next value. */
#vr:not([data-screen="menu"]) #vr-settings { display: none; }
.prefs .pref { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; width: 100%; padding: 11px 0; background: none; border: 0; border-bottom: 1px solid var(--hair); color: inherit; font: inherit; cursor: pointer; text-align: left; }
.prefs .pref span { color: var(--ink-2); font-size: 14px; }
.prefs .pref b { font-family: var(--display); font-weight: 600; font-size: 18px; }
.prefs .pref:active b { opacity: 0.6; }
.prefs .fine { margin-top: 12px; }
#vr-prefs-rows { margin: 8px 0 14px; }

/* ---------- waiting room ---------- */
.invite .waiting { display: flex; align-items: center; gap: 8px; margin: 0 0 12px !important; font-size: 14px; color: var(--ink); }
#vr .pulse { display: inline-block; flex: none; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--live);
  vertical-align: 1px; animation: vr-pulse 1.4s ease-in-out infinite; }
.invite .waiting .pulse { margin-right: 0; }
@keyframes vr-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.7); } }
#vr .invite .row + .waiting + .row { grid-template-columns: 1fr auto; margin: 0 0 12px; }
/* Waiting with the AI demo behind: no score to show yet. */
#vr[data-screen="lobby"]:not(.practising) .bug { display: none; }

/* ---------- friends ---------- */
.pair { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
#vr .pair .btn:not(.primary) { gap: 10px; }
#vr .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
#vr .count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--them); color: #fff; font-style: normal; font-size: 12px; font-weight: 700; line-height: 1; }
#vr .count[hidden] { display: none; }
/* Friends, as a roster board bolted to the cage (Fable, 2026-11-15): one dark plate,
   a lit top lip and four bolts, rows like a broadcast line-up. Same as the app's sheet. */
#vr-friends-scrim { position: absolute; inset: 0; z-index: 2; pointer-events: auto; background: rgba(5, 6, 10, 0.55); animation: vr-fade 180ms ease-out both; }
#vr-friends-scrim.closing { animation: vr-fade-out 140ms ease-in both; }
#vr .sheet.friends { display: flex; flex-direction: column; overflow: hidden; padding: 0; max-width: 460px; top: max(28px, calc(env(safe-area-inset-top) + 14px)); max-height: none;
  margin-top: auto; height: fit-content; border-top-color: rgba(242, 244, 247, 0.26); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  background:
    linear-gradient(rgba(242, 244, 247, 0.22), rgba(242, 244, 247, 0.22)) 6px 6px / 4px 4px no-repeat,
    linear-gradient(rgba(242, 244, 247, 0.22), rgba(242, 244, 247, 0.22)) right 6px top 6px / 4px 4px no-repeat,
    linear-gradient(rgba(242, 244, 247, 0.22), rgba(242, 244, 247, 0.22)) left 6px bottom 6px / 4px 4px no-repeat,
    linear-gradient(rgba(242, 244, 247, 0.22), rgba(242, 244, 247, 0.22)) right 6px bottom 6px / 4px 4px no-repeat,
    #090b0f; }
#vr .sheet.friends::before { content: ""; position: absolute; top: -1px; left: -1px; right: -1px; height: 1px; background: rgba(242, 244, 247, 0.5); transform-origin: left; transform: scaleX(0); opacity: 0; }
#vr .sheet.friends.opening { animation: vr-rise 220ms cubic-bezier(0.33, 1, 0.68, 1) both; }
#vr .sheet.friends.opening::before { animation: vr-lip 320ms 80ms cubic-bezier(0.33, 1, 0.68, 1) both; }
#vr .sheet.friends.closing { animation: vr-sink 140ms cubic-bezier(0.32, 0, 0.67, 0) both; }
@keyframes vr-rise { from { opacity: 0; transform: translateY(24px); } }
@keyframes vr-sink { to { opacity: 0; transform: translateY(24px); } }
@keyframes vr-lip { 0% { transform: scaleX(0); opacity: 1; } 70% { opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
@keyframes vr-fade { from { opacity: 0; } }
@keyframes vr-fade-out { to { opacity: 0; } }
@keyframes vr-row-in { from { opacity: 0; transform: translateX(-8px); } }
@keyframes vr-landed { from { background-color: rgba(61, 220, 132, 0.10); } }
.friends.opening .list > li:nth-child(-n + 8) { animation: vr-row-in 160ms cubic-bezier(0.33, 1, 0.68, 1) both; }
.friends.opening .list > li:nth-child(2) { animation-delay: 30ms; }
.friends.opening .list > li:nth-child(3) { animation-delay: 60ms; }
.friends.opening .list > li:nth-child(4) { animation-delay: 90ms; }
.friends.opening .list > li:nth-child(5) { animation-delay: 120ms; }
.friends.opening .list > li:nth-child(6) { animation-delay: 150ms; }
.friends.opening .list > li:nth-child(7) { animation-delay: 180ms; }
.friends.opening .list > li:nth-child(8) { animation-delay: 210ms; }
@media (orientation: landscape) and (max-height: 600px) {
  #vr .sheet.friends { left: auto; right: var(--pad); width: min(420px, calc(100vw - 2 * var(--pad))); top: max(14px, env(safe-area-inset-top)); height: auto; }
}
@media (prefers-reduced-motion: reduce) { #vr .sheet.friends, #vr .sheet.friends::before, .friends .list > li { animation: none !important; } }

.friends .fhead { flex: none; display: flex; align-items: baseline; gap: 12px; height: 52px; padding: 0 0 0 18px; align-items: center; border-bottom: 1px solid var(--hair); }
.friends .ftitle { margin: 0; font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink); }
.friends .fonline, .friends .sec, .friends .you .k { font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.friends .fonline { color: var(--live); }
#vr .friends .fhead .x { position: static; margin-left: auto; width: 52px; height: 52px; font-size: 24px; color: var(--ink-2); }
.friends .you { flex: none; position: relative; min-height: 56px; padding: 8px 18px 8px; box-sizing: border-box; background: rgba(53, 208, 255, 0.05); border-bottom: 1px solid var(--hair); }
.friends .you::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--you); }
.friends .you .k { display: block; margin: 0; font-size: 11px; line-height: 12px; }
.friends .me-shown { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "k k ch" "bd h ch"; align-items: center; column-gap: 10px; }
.friends .me-shown .k { grid-area: k; }
.friends .me-shown .vr-bdg { grid-area: bd; width: 26px; height: 26px; margin: 0; font-size: 14px; }
.friends .me-shown b { grid-area: h; font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 28px; margin-top: 2px; color: var(--you); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friends .me-shown:not(:has(.vr-bdg)) b { grid-column: bd / h; }
.friends .me-shown .link-btn { grid-area: ch; min-height: 44px; }
.friends .fbody { flex: 0 1 auto; min-height: 0; overflow-y: auto; padding-bottom: 16px; }
.friends .sec { display: flex; justify-content: space-between; align-items: flex-end; height: 30px; box-sizing: border-box; margin: 10px 0 0; padding: 0 18px 6px; border-bottom: 1px solid var(--hair); }
.friends #vr-reqs-n { color: var(--ink); }
.friends .field, .friends .add { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.friends .add { margin: 4px 18px 0; }
.friends input { pointer-events: auto; min-width: 0; height: 44px; font-family: var(--display); font-weight: 600; font-size: 22px; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px solid var(--hair); border-radius: 0; outline: none; padding: 0; transition: border-color 120ms; }
.friends input::placeholder { color: var(--ink-3); }
.friends input:focus { border-bottom-color: var(--you); }
.friends #vr-me-name { color: var(--you); border-bottom-color: var(--you); }
#vr .friends .btn { min-height: 40px; min-width: 76px; font-size: 18px; justify-content: center; }
.friends .add:has(input:not(:placeholder-shown)) .btn, .friends .me:has(input:not(:placeholder-shown)) .btn { background: var(--ink); border-color: var(--ink); color: #07090c; }
.friends .me .fine { margin: 6px 0 0; }
.friends .list { list-style: none; margin: 0; padding: 0; }
.friends .list > li { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nm end" "sb end"; column-gap: 10px; align-content: center;
  min-height: 56px; box-sizing: border-box; padding: 6px 10px 6px 18px; border-bottom: 1px solid var(--hair); }
.friends .list > li > b { grid-area: nm; align-self: end; font-family: var(--display); font-weight: 600; font-size: 21px; line-height: 24px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friends .list .sub { grid-area: sb; align-self: start; font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-3); }
.friends .list .end { grid-area: end; display: flex; align-items: center; gap: 10px; }
#vr .friends .list .btn { min-height: 36px; min-width: 74px; padding: 0 14px; font-size: 17px; }
.friends .list .link-btn { min-height: 44px; padding: 0 6px; }
/* Friend rows: a 3px status bar (lit when online), the badge, name and status, record, Invite, caret. */
.friends .list > li.fr { grid-template-columns: 3px minmax(0, 1fr) auto; grid-template-areas: "st nm end" "st sb end"; cursor: pointer; transition: background-color 120ms; }
body.ff-cosmetics .friends .list > li.fr:has(> .vr-bdg) { grid-template-columns: 3px 22px minmax(0, 1fr) auto; grid-template-areas: "st bd nm end" "st bd sb end"; }
.friends .list > li.fr:active, .friends .list > li.fr.open { background: rgba(242, 244, 247, 0.04); }
.friends .list > li.fr > .vr-bdg { grid-area: bd; align-self: center; width: 22px; height: 22px; margin: 0; font-size: 12px; }
.friends .list .st { grid-area: st; align-self: center; width: 3px; height: 22px; border-radius: 1px; background: rgba(242, 244, 247, 0.16); }
.friends .list .on .st { background: var(--live); box-shadow: 0 0 6px rgba(61, 220, 132, 0.5); }
.friends .list .fr:not(.on) > b { color: var(--ink-2); }
.friends .list .on .sub { color: var(--live); }
.friends .list .caret { width: 14px; text-align: center; font-size: 18px; color: var(--ink-3); transition: transform 140ms cubic-bezier(0.33, 1, 0.68, 1); }
.friends .list .open .caret { transform: rotate(90deg); }
.friends .list .drawer { grid-column: 1 / -1; margin: 6px -10px -6px -5px; padding: 8px 0 0 13px; background: rgba(242, 244, 247, 0.03); cursor: default; }
.friends .list .drawer .foot { display: flex; justify-content: flex-end; align-items: center; height: 36px; margin-top: 4px; padding-right: 10px; }
.friends .list .drawer .rm { color: var(--ink-3); }
.friends .list > li.landed { animation: vr-landed 600ms ease-out; }
/* Requests: incoming leads (white bar, Accept lit, Decline quiet); sent waits quietly. */
.friends .list > li.req { background: rgba(242, 244, 247, 0.05); }
.friends .list > li.req::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ink); }
.friends .list > li.req .sub { color: var(--ink-2); }
.friends .list > li.req.sent { min-height: 48px; background: none; }
.friends .list > li.req.sent::before { display: none; }
.friends .list > li.req.sent > b { font-size: 19px; color: var(--ink-2); }
.friends .list > li.req.sent .sub { color: var(--ink-3); }
/* No friends yet: one vacant seat on the board. */
.friends .list > li.vacant { display: block; padding: 0 18px 6px; cursor: default; }
.friends .list > li.vacant i { display: inline-block; vertical-align: middle; width: 22px; height: 22px; box-sizing: border-box; margin-right: 12px; border-radius: 50%; border: 1px dashed rgba(242, 244, 247, 0.22); }
.friends .list > li.vacant b { display: inline-block; vertical-align: middle; line-height: 56px; font-family: var(--display); font-weight: 600; font-size: 21px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-3); }
.friends .list > li.vacant .fine { margin: 0; font-size: 13px; color: var(--ink-2); }
.friends .note, .friends .err { margin: 8px 18px 0 !important; font-size: 13px; }
.friends .note:empty, .friends .err:empty { display: none; }
.friends .err { color: var(--warn); }
#vr .btn.danger { color: #ff5a5a; border-color: rgba(255, 90, 90, 0.5); }
/* Remove: asks on a small plate over a darker scrim, Cancel lit. */
#vr #vr-unfriend { z-index: 4; top: 50%; bottom: auto; left: 50%; right: auto; width: min(340px, calc(100vw - 2 * var(--pad))); box-sizing: border-box; padding: 20px;
  transform: translate(-50%, -50%); background: #090b0f; border-top-color: rgba(242, 244, 247, 0.26); box-shadow: 0 0 0 100vmax rgba(5, 6, 10, 0.7), 0 18px 40px rgba(0, 0, 0, 0.6); animation: vr-pop 160ms cubic-bezier(0.33, 1, 0.68, 1) both; }
@keyframes vr-pop { from { opacity: 0; transform: translate(-50%, -50%) scale(0.97); } }
#vr #vr-unfriend .headline { margin: 0 0 6px !important; font-size: 26px; line-height: 1.1; text-transform: none; }
#vr #vr-unfriend .fine { margin: 0 0 18px !important; }
#vr #vr-unfriend .row { grid-template-columns: 1fr 1fr; }
#vr #vr-unfriend .btn { min-height: 46px; }

/* An invite from a friend while this page is open. */
#vr .ask { z-index: 4; top: max(14px, env(safe-area-inset-top)); bottom: auto; border-left: 3px solid var(--them); }
.ask .headline { margin: 4px 0 12px !important; font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1; text-transform: uppercase; }
#vr .ask .row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
#vr .ask .btn { min-height: 46px; justify-content: center; }
#vr .decide .add-friend { width: 100%; justify-content: center; min-height: 44px; margin: -4px 0 12px; font-size: 18px; border-color: var(--them); }
#vr-prefs-name { margin-top: -14px; margin-bottom: 14px; }

/* ---------- quick match (flag quick_match) ---------- */
#vr .menu .qm-row { display: none; }
body.ff-quick_match #vr .menu .qm-row { display: grid; }
#vr .menu .qm-row { grid-template-columns: 1fr; }
#vr .menu .qm-soon, body.ff-ranked #vr .menu .qm .l-quick, body:not(.ff-ranked) #vr .menu .qm .l-ranked { display: none; }
/* Flag ranked off: Quick match (casual), and beside it Ranked dimmed with a hairline Soon tag. */
#vr .menu .qm-soon { gap: 10px; border-color: rgba(242, 244, 247, 0.14); background: rgba(9, 11, 15, 0.35); color: rgba(242, 244, 247, 0.38); font-size: 17px; }
#vr .menu .qm-soon .soon { font-style: normal; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(242, 244, 247, 0.62); border: 1px solid rgba(242, 244, 247, 0.28); border-radius: 2px; padding: 2px 6px; }
body.ff-quick_match .title { bottom: calc(max(24px, env(safe-area-inset-bottom)) + 454px); }
@media (min-width: 900px) and (min-height: 560px) { body.ff-quick_match .title { bottom: auto; } }
#vr .quick .headline { margin: 6px 0 10px; font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; text-transform: uppercase; }
#vr .quick .fine { margin-bottom: 14px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
#vr .quick .btn { width: 100%; justify-content: center; }
#vr.deciding .quick { display: none !important; }

/* ---------- head-to-head (flag "h2h") ---------- */
.friends .list .rec { min-width: 40px; text-align: right; font-family: var(--display); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.friends .list .rec.lead { color: var(--you); }
.friends .list .rec.behind { color: var(--them, var(--warn)); }
.friends .list ol.last { list-style: none; margin: 0; padding: 0 0 0 18px; }
.friends .list ol.last li { display: grid; grid-template-columns: 20px 52px 1fr auto; gap: 8px; min-height: 26px; border: 0; cursor: default; font-size: 14px; }
.friends .list ol.last li b { font-size: 15px; }
.friends .list ol.last li.w b { color: var(--you); }
.friends .list ol.last li.l b { color: var(--ink-3); }
.friends .list ol.last .sc { font-variant-numeric: tabular-nums; }
#vr .h2h { margin: 10px 0 2px; font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: 0.01em; color: var(--ink-2); }
#vr .h2h.lead { color: var(--you); }
#vr .h2h .moment { display: block; font-size: 13px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--live); }
#vr .h2h .moment:empty { display: none; }
#vr .h2h.turned.pop .moment { animation: vr-h2h-pop 900ms cubic-bezier(.2, 1.4, .4, 1) both; }
#vr .h2h.pop .rec { animation: vr-h2h-rise 500ms ease-out both; }
@keyframes vr-h2h-pop { 0% { opacity: 0; transform: scale(0.6); } 60% { opacity: 1; transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes vr-h2h-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #vr .h2h .moment, #vr .h2h .rec { animation: none !important; } }
/* ---------- the rally clip (flag replays, clip.js) ---------- */
#vr .clip { position: absolute; inset: 0; z-index: 9; pointer-events: auto; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 6, 10, 0.92); padding: 24px var(--pad); }
#vr .clip .box { width: 100%; max-width: 360px; text-align: center; }
#vr .clip .bar { height: 4px; margin: 14px 0 16px; background: var(--hair); }
#vr .clip .bar i { display: block; height: 100%; width: 0; background: var(--you); }
#vr .clip video { display: block; width: auto; max-width: 100%; max-height: 52vh; margin: 12px auto 14px; aspect-ratio: 9 / 16; background: #000; }
#vr .clip .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#vr .clip .btn { min-height: 48px; justify-content: center; }
#vr .clip .headline { margin: 6px 0 0 !important; font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; text-transform: uppercase; }

/* Flag "replays": an instant replay plays clean. Score, status, banner, reactions, links all step aside. */
#vr.replaying > * { opacity: 0 !important; pointer-events: none !important; }

/* The match's mode and arena (lobby, ready check): one line, the mode first; not Classic, in its own colour. */
/* The picker's kicker: a short rule in the mode's colour, the mode, the arena. */
#vr .sheet p.match { display: flex; align-items: center; gap: 9px; margin: 4px 0 8px; font-family: var(--display); font-weight: 600; font-size: 15px;
  line-height: 1.2; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
#vr .match em { flex: none; width: 18px; height: 2px; background: var(--mt); box-shadow: 0 0 8px var(--mt); }
#vr .match:empty { display: none; }
#vr .match b { color: var(--ink); font-weight: 700; }
#vr .match b.odd { color: var(--mt); }
#vr .match i { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); }
#vr .sheet p.picked { margin: -4px 0 8px; font-size: 14px; color: var(--ink-2); }
#vr .picked[hidden] { display: none; }
/* Play offline (flag training_wall): the menu's Practice button opens a small screen of offline play. */
#vr .menu .off-open, .menu .buttons.offline { display: none; }
body.ff-training_wall #vr .menu .solo { display: none; }
body.ff-training_wall #vr .menu .off-open { display: flex; }
body.ff-training_wall #vr.offline-open .menu .buttons:not(.offline) { display: none; }
body.ff-training_wall #vr.offline-open .menu .buttons.offline { display: flex; }
/* Practice Range (flag serve_labs): Play offline's third card opens the station cards. */
#vr .menu .buttons.offline .btn.practice, #vr .menu .buttons.range { display: none; }
body.ff-serve_labs #vr .menu .buttons.offline .btn.practice { display: flex; }
/* Flag training_picker: one Training row opens the picker (picker.js); the Wall and the Range rows go. */
#vr .menu .buttons.offline .btn.training, #vr .menu .buttons.offline .train-fine { display: none; }
body.ff-training_picker.ff-serve_labs.ff-training_wall #vr .menu .buttons.offline .btn.training { display: flex; }
body.ff-training_picker.ff-serve_labs.ff-training_wall #vr .menu .buttons.offline .train-fine { display: block; }
body.ff-training_picker.ff-serve_labs.ff-training_wall #vr .menu .buttons.offline [data-act="wall"],
body.ff-training_picker.ff-serve_labs.ff-training_wall #vr .menu .buttons.offline .btn.practice,
body.ff-training_picker.ff-serve_labs.ff-training_wall #vr .menu .buttons.offline .wall-fine { display: none; }
body.ff-serve_labs #vr.offline-open.range-open .menu .buttons.offline { display: none; }
body.ff-serve_labs #vr.offline-open.range-open .menu .buttons.range { display: flex; }
#vr .stations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 56vh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
@media (min-width: 600px) and (orientation: landscape) { #vr .stations { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: 62vh; } }
/* Compact rows (Jack: eight stations didn't fit): the drawing on the left, the name, then my best and marks, or the one line before a first set. */
#vr .stn { min-width: 0; min-height: 54px; padding: 6px 8px 6px 4px; display: grid; grid-template-columns: 50px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 6px; align-content: center; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; background: rgba(9, 11, 15, 0.55); color: var(--ink); text-align: left; overflow: hidden; cursor: pointer; }
#vr .stn:hover { border-color: var(--you, #35d0ff); }
#vr .stn svg { grid-row: 1 / 3; display: block; width: 50px; height: 34px; color: rgba(242, 244, 247, 0.7); }
#vr .stn b { display: block; font: 600 12px/1.15 var(--display); letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#vr .stn small { display: block; margin-top: 3px; font-size: 11px; line-height: 1.25; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#vr .stn em { display: block; margin-top: 4px; font: 600 11px/1 var(--display); font-style: normal; letter-spacing: 0.06em; text-transform: uppercase; color: var(--you, #35d0ff); }
#vr .stn em:empty { display: none; }
#vr .stn em:not(:empty) + small { display: none; }
#vr .stn .fl { stroke: currentColor; stroke-width: 1.4; opacity: 0.5; }
#vr .stn .bt { stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
#vr .stn .pa { fill: none; stroke: currentColor; stroke-width: 1; stroke-dasharray: 1.5 3; opacity: 0.55; }
#vr .stn .tg { fill: var(--you, #35d0ff); opacity: 0.55; }
#vr .stn .tl { fill: none; stroke: var(--you, #35d0ff); stroke-width: 1; }
#vr .stn .mk { display: inline-flex; gap: 3px; margin-left: 8px; vertical-align: 1px; }
#vr .stn .mk span { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--you, #35d0ff); opacity: 0.6; }
#vr .stn .mk span.on { background: var(--you, #35d0ff); opacity: 1; }
#vr .stn .pt { fill: none; stroke: #ff4f8b; stroke-width: 1.2; }
#vr .stn .bl { fill: var(--you, #35d0ff); }
#vr[data-range="1"] .bug { cursor: pointer; pointer-events: auto; }
.offhead { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.offhead .kicker { margin: 0; color: var(--ink); }
#vr .offhead .back { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--hair, rgba(242, 244, 247, 0.16)); background: rgba(9, 11, 15, 0.55); color: var(--ink); font-size: 18px; border-radius: 2px; cursor: pointer; }
#vr .btn .best { margin-left: auto; margin-right: -6px; font-family: var(--display); font-weight: 600; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
/* On Play offline the Home Screen prompt steps aside, so the short list sits low under the title. */
#vr.offline-open .install { display: none; }
#vr.has-install.offline-open .menu .buttons.offline { bottom: calc(max(24px, env(safe-area-inset-bottom)) + 34px); }
@media (max-height: 460px) {
  #vr.has-install.offline-open .menu .buttons.offline { bottom: max(12px, env(safe-area-inset-bottom)); }
  .menu .buttons.offline .fine { display: none; }
}
