/* ============================================================
   Desktop / TV lobby — layout A (#428, mockups on #429)
   ============================================================
   The right painting is a fixed panel at its natural shape (504×1017 →
   535×1080) with the wordmark on its sky; the menus get the rest of the
   screen. Text sizes come from the kit's automatic ramp (shared/ui/tokens.css:
   phone sizes below 1024px, TV sizes at 1920px), so nothing here is a
   per-screen pixel size. The room step (no video since #400) uses it too.
   

   Loaded after the page's inline <style>, so equal-specificity rules win;
   !important is used only where the old desktop block sets the same property
   with higher specificity or !important of its own.                        */

/* The system bar and the mode buttons' second lines are desktop/TV only. */
uf-system-bar#lobby-bar { display: none; }
#lobby-mode .uf-button__sub { display: none; }

@media (min-width: 1024px) {
  uf-system-bar#lobby-bar { display: flex; }
  #lobby-mode .uf-button__sub { display: block; }
  /* The art panel's width, for the stage and for kit sheets / the system bar. */
  :root:has(#lobby:not([style*="none"])) { --uf-stage-inset: 535px; }

  /* ── Frame ── */
  #lobby {
    --gutter: clamp(24px, 2.5vw, 64px);
    --bar-h: calc(var(--uf-size-md) * 3.3 + 16px);   /* matches <uf-system-bar> */
    display: grid;   /* not !important: the game hides the lobby with an inline display:none */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) var(--uf-stage-inset) !important;
    grid-template-rows: var(--gutter) minmax(0, 1fr) var(--bar-h) !important;
    gap: 0 !important; padding: 0 !important; align-items: center !important; overflow: hidden !important;
    background: radial-gradient(120% 90% at 30% 40%, #161b24 0%, #0a0c11 70%) !important;
  }
  #lobby #lobby-img-left { display: none !important; }
  #lobby #lobby-img-right {
    grid-column: 3 !important; grid-row: 1 / -1 !important; object-position: center !important;
    box-shadow: -24px 0 48px rgba(0, 0, 0, .55);
  }
  #lobby-wordmark { display: none; }
  /* tandemonium_title.png at 0.435× (wordmark ≈ 470px wide), centred on the
     wordmark; the dirt splash and pedals fade into the sky through the mask. */
  #lobby #lobby-wordmark {
    display: block; position: fixed; z-index: 3; top: 10px; right: 0; width: var(--uf-stage-inset); height: 200px; pointer-events: none;
    background: url(../images/tandemonium_title.png) no-repeat;
    background-size: 668px auto; background-position: calc(var(--uf-stage-inset) / 2 - 334px) -70px;
    -webkit-mask-image: radial-gradient(ellipse 64% 46% at 50% 46%, #000 72%, transparent 100%);
            mask-image: radial-gradient(ellipse 64% 46% at 50% 46%, #000 72%, transparent 100%);
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .45));
  }

  /* ── Stage: the mode screen pairs the bike chooser with the buttons; every other step gets the full width ── */
  #lobby #bike-carousel {
    grid-column: 1 !important; grid-row: 2 !important;
    width: calc(100% - var(--gutter)) !important; margin: 0 0 0 var(--gutter) !important;
    justify-self: stretch !important; align-self: center !important; border-radius: var(--uf-radius-lg);
  }
  #lobby #bike-preview-wrap { flex: 1 1 auto !important; min-width: 0 !important; overflow: hidden !important; }
  /* #521: taller (it can't get wider); js/lobby/preview-fit.js keeps the whole bike in view. */
  #lobby #bike-preview-canvas { width: 100% !important; height: 60vh !important; }
  #lobby #bike-carousel .bike-carousel-nav { width: calc(var(--uf-size-md) * 2.4) !important; font-size: var(--uf-size-2xl) !important; }
  /* The bike's name sits inside the top of the preview: the box clips (overflow hidden), so a name placed above it
     was cut off and never showed. The locked count card drops below it. */
  #lobby #bike-name {
    font-size: var(--uf-size-2xl) !important; line-height: 1.2 !important; top: var(--uf-space-3) !important;
    z-index: 2; pointer-events: none;
  }
  #lobby #bike-hint { top: calc(var(--uf-size-2xl) * 1.2 + var(--uf-space-3) * 2) !important; }
  /* the rooms' bike row, at TV size */
  #lobby .room-bike-row { gap: var(--uf-space-3); margin: var(--uf-space-3) 0; }
  #lobby .room-bike-label { font-size: var(--uf-size-sm); }
  #lobby .room-bike-name { font-size: var(--uf-size-xl); min-width: 11em; }
  #lobby .room-bike-nav { height: calc(var(--uf-size-xl) * 1.9); min-width: calc(var(--uf-size-xl) * 1.9); justify-content: center; font-size: var(--uf-size-xl); }
  #lobby .room-bike-note { font-size: var(--uf-size-sm); }
  #lobby:has(#lobby-mode[active]) { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) var(--uf-stage-inset) !important; }
  #lobby:not(:has(#lobby-mode[active])) #bike-carousel { display: none !important; }

  #lobby .lobby-card {
    grid-column: 2 !important; grid-row: 2 !important;
    max-width: none !important; width: 100% !important; height: auto !important; max-height: 100% !important;
    padding: 0 var(--gutter) !important; margin: 0 !important; overflow: visible !important;
    display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important;
    align-self: center !important; justify-self: stretch !important;
  }
  #lobby:not(:has(#lobby-mode[active])) .lobby-card { grid-column: 1 / 3 !important; }
  #lobby .lobby-layout { display: block !important; width: 100%; flex: 0 0 auto !important; }
  #lobby .lobby-steps-col { width: 100% !important; max-width: none !important; min-width: 0 !important; overflow: visible !important; }
  #lobby .lobby-step { overflow: visible !important; }
  #lobby .lobby-prompt { font-size: var(--uf-size-xl) !important; margin: 0 0 var(--uf-space-4) !important; }

  /* The system bar replaces the round toggle columns, the Back hint and the
     credits footer on every step but the room (css below + lobby-tv.js). */
  #lobby .lobby-toggle-col,
  #lobby .lobby-toggles,
  #lobby .gamepad-back-hint,
  #lobby #lobby-fixed-back,
  #lobby .lobby-step .lobby-back,
  #lobby .lobby-credits { display: none !important; }

  /* ── Mode screen: narrower two-line buttons (sub lines set in index.html) ── */
  #lobby-mode .lobby-mode-buttons { width: 100% !important; max-width: 22em; gap: var(--uf-space-4) !important; margin: 0 auto; font-size: var(--uf-size-md); }
  #lobby-mode .lobby-mode-buttons > uf-button:not([size]) {
    display: block; text-align: left; min-height: 0; padding: var(--uf-space-4) var(--uf-space-5) !important;
    font-size: var(--uf-size-lg); border-radius: var(--uf-radius-lg);
  }
  #lobby-mode #btn-mode-phone, #lobby-mode #btn-mode-connect-hid { align-self: flex-start; font-size: var(--uf-size-sm); }

  /* ── Level select: every card in one row, START RIDE on screen (#428 finding 1) ── */
  #lobby #level-cards {
    flex-direction: row !important; width: 100% !important; max-width: none !important;
    gap: var(--uf-space-5) !important; align-items: stretch !important; padding: var(--uf-space-2) 0 !important;
  }
  #lobby .level-card { flex: 1 1 0 !important; min-width: 0 !important; width: auto !important; min-height: 0; padding: var(--uf-space-5) var(--uf-space-5) !important; text-align: left; }
  /* #611 · the Daily Ride card with its time-warp row: one column of the row, card on top */
  #lobby .level-card-stack { flex: 1 1 calc(2 * var(--uf-space-5) + 4px); min-width: 0; width: auto; gap: var(--uf-space-3); }
  #lobby .level-card-stack > .level-card { flex: 1 1 auto !important; width: 100% !important; }
  #lobby .daily-warp-row { flex-direction: column; gap: var(--uf-space-3); }
  #lobby .daily-warp-btn { font-size: var(--uf-size-md); padding: var(--uf-space-3) var(--uf-space-4); border-width: 2px; flex: 0 0 auto; }
  #lobby .level-card-warp-day { font-size: var(--uf-size-lg) !important; margin-bottom: var(--uf-space-1); }
  #lobby .level-card-top { flex-direction: column !important; align-items: flex-start !important; gap: var(--uf-space-3) !important; }
  #lobby .level-card-icon { font-size: calc(var(--uf-size-2xl) * 1.25) !important; }
  #lobby .level-card-name { font-size: var(--uf-size-xl) !important; }
  #lobby .level-card-desc { font-size: var(--uf-size-md) !important; line-height: 1.35 !important; margin-top: var(--uf-space-2) !important; display: block !important; }
  #lobby .level-card-daily-rule { font-size: var(--uf-size-xs) !important; display: block; margin-top: 6px; }
  #lobby .level-card-record { font-size: var(--uf-size-md) !important; margin-top: var(--uf-space-3) !important; }
  #lobby .difficulty-selector { margin-top: var(--uf-space-5) !important; font-size: var(--uf-size-md) !important; }
  /* Three equal difficulty buttons, each wide enough for its one-line description
     (the phone rule caps the row at 160 × --ls, which wrapped them at 1080p). */
  #lobby .difficulty-selector { width: auto !important; max-width: 100%; }
  #lobby .difficulty-buttons { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--uf-space-4) !important; }
  #lobby .difficulty-btn { padding: var(--uf-space-3) var(--uf-space-5) !important; }
  #lobby .diff-desc { white-space: nowrap; }
  #lobby #level-extras { margin-top: var(--uf-space-5) !important; }
  #lobby #btn-start-ride { min-width: 14em; font-size: var(--uf-size-lg) !important; }
  #lobby .level-room-team { max-width: 60em; margin-bottom: var(--uf-space-3); }
  /* Level select needs the whole width for the cards: drop the art panel
     (and the wordmark over it); kit sheets and the system bar follow the inset. */
  :root:has(#lobby:not([style*="none"]) #lobby-level[active]) { --uf-stage-inset: 0px; }
  #lobby:has(#lobby-level[active]) #lobby-img-right,
  #lobby:has(#lobby-level[active]) #lobby-wordmark { display: none !important; }
}

/* ── Popups the system bar opens (moved to <body> on desktop; lobby.js _initSystemBar
      anchors each just above its pill) ── */
@media (min-width: 1024px) {
  body > .bar-popup { position: fixed !important; top: auto !important; right: auto !important; transform: translateX(-50%) !important; z-index: 120 !important; }
  body > #keyboard-confirm-popup.bar-popup { left: calc((100vw - var(--uf-stage-inset)) / 2) !important; bottom: 50vh !important; transform: translate(-50%, 50%) !important; z-index: 130 !important; }
  #bar-music.active { border-color: var(--uf-color-accent-line); color: var(--uf-color-accent); }
  #help-modal .help-credits { margin-top: var(--uf-space-4); padding-top: var(--uf-space-3); border-top: 1px solid var(--uf-color-line-soft); justify-content: flex-start; }
}
#help-modal .help-credits { display: none; }
@media (min-width: 1024px) { #help-modal .help-credits { display: flex; } }

/* Profile popup in <body>: a compact column at the kit's text sizes (its old
   desktop rules sized it from the toggle column's --ls scale). */
@media (min-width: 1024px) {
  body > #profile-popup.bar-popup { min-width: 0 !important; width: min(22em, 36vw); padding: var(--uf-space-4) !important; border-radius: var(--uf-radius-lg) !important; font-size: var(--uf-size-sm); }
  body > #profile-popup.bar-popup .profile-popup-content { gap: var(--uf-space-2) !important; }
  body > #profile-popup.bar-popup .profile-popup-name { font-size: var(--uf-size-md) !important; }
  /* "Signed in with Steam + Discord": readable from the couch (was xs at 45%). */
  body > #profile-popup.bar-popup .profile-popup-email { font-size: var(--uf-size-sm) !important; color: rgba(255,255,255,0.8) !important; }
  /* (not the shared elements' buttons, [data-part]: those are sized by their element, lab #152) */
  body > #profile-popup.bar-popup button:not([data-part]) { display: block; width: 100%; box-sizing: border-box; font-size: var(--uf-size-sm) !important; padding: .6em 1em !important; margin: var(--uf-space-2) 0 0 !important; border-radius: var(--uf-radius-md) !important; }
  body > #profile-popup.bar-popup #profile-popup-signin { padding: 0 !important; }
  /* lab #152 · the shared elements at the TV's size: one font-size, everything inside is em */
  body > #profile-popup.bar-popup uf-signin, body > #profile-popup.bar-popup uf-profile-card { font-size: var(--uf-size-sm); }
  /* The pad's ring sits inside the button here: the default ring is drawn 3px
     outside it with a glow, which covered the "Signed in with…" line above and
     ran over the system bar below. */
  body > #profile-popup.bar-popup button.gamepad-focus { outline-offset: -4px !important; box-shadow: none !important; }
  /* Music levels (HIGH / MED / LOW / MUTE): readable from the couch. The phone
     sizes (38×28 buttons, 8px text) were unreadable on a TV. */
  body > #volume-picker.bar-popup { align-items: stretch; gap: var(--uf-space-2); padding: var(--uf-space-3); border-radius: var(--uf-radius-lg); }
  body > #volume-picker.bar-popup .vol-btn {
    width: auto; min-width: 6.5em; height: auto; padding: .5em 1em;
    font: 800 var(--uf-size-lg)/1.2 var(--uf-font-ui); letter-spacing: .04em;
    color: var(--uf-color-fg); border-width: 2px; border-radius: var(--uf-radius-md);
  }
  body > #volume-picker.bar-popup .vol-btn.active { color: var(--uf-color-accent); }
  body > #volume-picker.bar-popup .vol-btn[data-vol="0"]::after { content: "\00a0MUTE"; }
}
#help-modal .help-credits { align-items: center; gap: var(--uf-space-3); flex-wrap: wrap; font-size: var(--uf-size-sm); color: var(--uf-color-fg-muted); }
#help-modal .help-credits button { background: none; border: none; color: inherit; font: inherit; cursor: pointer; }

/* ── Versus: two kit team boxes side by side, every controller in the strip under them ── */
#lobby-versus .versus-teams { display: flex; align-items: stretch; gap: var(--uf-space-4); width: 100%; margin: 0; }
#lobby-versus .versus-teams > uf-team { flex: 1 1 0; min-width: 0; }
#lobby-versus .versus-vs { align-self: center; font: 800 var(--uf-size-xl)/1 var(--uf-font-ui); color: var(--uf-color-fg-muted); opacity: 1; }
#lobby-versus #versus-roster { width: 100%; margin-top: var(--uf-space-4); }
#lobby-versus .versus-join-hint { font-size: var(--uf-size-md); color: var(--uf-color-fg); opacity: .85; margin: var(--uf-space-4) 0; }
@media (min-width: 1024px) {
  #lobby-versus #btn-versus-continue { min-width: 14em; font-size: var(--uf-size-lg); }
}

/* ── Captain's room: Online multiplayer | Local multiplayer (#428 round 5) ── */
.host-tv { display: none; }
@media (min-width: 1024px) {
  #lobby-host[active] {
    display: grid !important; grid-template-columns: minmax(0, auto) minmax(0, 1fr); column-gap: calc(var(--uf-space-7) * 1.5); row-gap: var(--uf-space-3);
    align-items: start; justify-items: start; text-align: left;
  }
  #lobby-host[active] > * { grid-column: 1; margin: 0 !important; }
  #lobby-host[active] .lobby-prompt, #lobby-host[active] #room-qr, #lobby-host[active] #room-url,
  #lobby-host[active] .lobby-hint, #lobby-host[active] #local-join-section { display: none !important; }
  #lobby-host[active] .host-tv { display: block; }
  #lobby-host[active] #host-online-head { grid-row: 1; }
  /* #563 · "Scan to join" (one QR, the phone chooses) on top; the room code
     only once the online room is open (a phone chose Play, or the code button). */
  #lobby-host[active] #host-join-qr { grid-row: 2; display: inline-grid; }
  #lobby-host.host-join-off #host-join-qr { visibility: hidden; }
  #lobby-host[active] #btn-host-room-code { grid-row: 3; }
  #lobby-host[active]:not(.host-room-open) #room-code-display,
  #lobby-host[active]:not(.host-room-open) #btn-host-online-next { display: none !important; }
  #lobby-host[active] #room-code-display { grid-row: 3; font: 800 calc(var(--uf-size-2xl) * 1.3)/1 var(--uf-font-mono) !important; letter-spacing: .12em !important; color: var(--uf-color-accent); }
  #lobby-host[active] #host-status { grid-row: 4; font-size: var(--uf-size-md) !important; color: var(--uf-color-fg); }
  #lobby-host[active] #host-status:not(:empty)::before { content: '● '; color: var(--uf-color-accent-2); }
  #lobby-host[active] #host-local { grid-column: 2; grid-row: 1 / span 4; display: grid; gap: var(--uf-space-3); width: 100%; min-width: 0; }
  #lobby-host h3 { margin: 0; font: 800 var(--uf-size-xl)/1.2 var(--uf-font-ui); color: var(--uf-color-fg); }
  #lobby-host .host-tv p { margin: var(--uf-space-1) 0 0; font-size: var(--uf-size-sm); color: var(--uf-color-fg-muted); max-width: 26em; }
  #lobby-host #host-team { margin-top: var(--uf-space-2); }
  #lobby-host[active] #btn-host-online-next { grid-row: 5; }
  #lobby-host[active] #btn-host-online-next, #lobby-host[active] #btn-host-local-next { min-width: 14em; font-size: var(--uf-size-lg); justify-self: start; }
  /* Whichever side has the stoker dims the other (2026-10-23). */
  #lobby-host.host-local-on #host-online-head, #lobby-host.host-local-on #room-code-display,
  #lobby-host.host-local-on #host-status,
  #lobby-host.host-local-on #btn-host-online-next,
  #lobby-host.host-online-on #host-local > h3, #lobby-host.host-online-on #host-local > p,
  #lobby-host.host-online-on #host-roster, #lobby-host.host-online-on #btn-host-local-next { opacity: .4; }
}
/* Narrow layouts have no local seats: the Local button never shows there... */
@media (max-width: 1023px) {
  #btn-host-local-next { display: none; }
  /* ...except for a bot. A phone's room offers the same back seat as the TV's (Pete, 2026-11-18):
     the Back seat row and RIDE WITH <BOT>, under the room code; the rest of the Local column stays away. */
  /* (first on the screen: someone who wants the bot should not have to scroll past a greyed CHOOSE LEVEL to find it) */
  #lobby-host[active].host-bot-on { display: flex !important; flex-direction: column; align-items: center; }
  #lobby-host[active].host-bot-on #host-local { order: -1; display: grid; gap: 8px; justify-items: center; margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.14); width: 100%; }
  #lobby-host[active].host-bot-on #host-local > :not(#host-bot-row):not(#btn-host-local-next) { display: none !important; }
  #lobby-host[active].host-bot-on #btn-host-local-next { display: inline-flex; }
  #lobby-host.host-online-on #host-local { display: none !important; }
}

/* ── Join with a code: kit keypad (#428 round 3) ── */
.join-tv { display: none; }
@media (min-width: 1024px) {
  #lobby-join .join-tv.on { display: grid; justify-items: center; gap: var(--uf-space-4); }
  #lobby-join .join-tv h3 { margin: 0; font: 800 var(--uf-size-2xl)/1.15 var(--uf-font-ui); color: var(--uf-color-fg); }
  #lobby-join .join-tv p { margin: calc(var(--uf-space-3) * -1) 0 0; font-size: var(--uf-size-md); color: var(--uf-color-fg-muted); }
  #lobby-join:has(.join-tv.on) .lobby-prompt, #lobby-join:has(.join-tv.on) #gamepad-code-spinners { display: none !important; }
}

/* ── JOIN A RIDE: Rejoin a recent ride (#547) ── */
.join-rejoin[hidden] { display: none !important; }
.join-rejoin { display: grid; justify-items: center; gap: var(--uf-space-3, 12px); width: 100%; margin: 0 auto var(--uf-space-3, 12px); }
.join-rejoin-head { margin: 0; font: 800 var(--uf-size-lg, 1.2em)/1.15 var(--uf-font-ui, inherit); color: var(--uf-color-fg, #fff); }
.join-rejoin-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--uf-space-3, 12px); width: 100%; }
.join-rejoin-cards uf-card { flex: 0 1 15em; }
.join-rejoin-or { margin: 0; font-size: var(--uf-size-md, 1em); color: var(--uf-color-fg-muted, #aaa); }
@media (min-width: 1024px) {
  .join-rejoin-head { font-size: var(--uf-size-2xl); }
  .join-rejoin-cards uf-card { flex: 0 0 auto; min-width: 14em; }
  .join-rejoin-cards .uf-card__title, .join-rejoin-cards .uf-card__foot { white-space: nowrap; }
  /* the keypad's own "Join a ride" heading repeats the line above it */
  #lobby-join:has(.join-rejoin:not([hidden])) .join-tv h3 { display: none; }
}
/* Short TV screens (720p): the row and the keypad share the height, so the
   helper lines go and the cards tighten; Delete / JOIN stay above the bar. */
@media (min-width: 1024px) and (max-height: 860px) {
  .join-rejoin { gap: var(--uf-space-2); margin-bottom: 0; }
  .join-rejoin-head { font-size: var(--uf-size-xl); }
  .join-rejoin-or { display: none; }
  .join-rejoin-cards uf-card { padding: var(--uf-space-2) var(--uf-space-4); gap: 2px; }
  #lobby-join:has(.join-rejoin:not([hidden])) .join-tv p { display: none; }
  #lobby-join:has(.join-rejoin:not([hidden])) .join-tv { gap: var(--uf-space-3); }
  /* Pete (2026-11-11): on a short screen the join step drops the art panel, like level select;
     the keypad, the rejoin row and the bar get the whole width (the bar stays one row). */
  :root:has(#lobby:not([style*="none"]) #lobby-join[active]) { --uf-stage-inset: 0px; }
  #lobby:has(#lobby-join[active]) #lobby-img-right,
  #lobby:has(#lobby-join[active]) #lobby-wordmark { display: none !important; }
}

/* ── Waiting in an online room (#694): the wait's buttons under the status line ── */
.room-wait-actions[hidden] { display: none !important; }
.room-wait-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--uf-space-3, 12px); margin: var(--uf-space-2, 8px) 0; }
.room-idle-note[hidden] { display: none !important; }
.room-idle-note { margin: var(--uf-space-2, 8px) 0 0; }
@media (min-width: 1024px) { #lobby-host .room-wait-actions { justify-content: flex-start; } }
/* Joined and waiting: the code entry has done its job; the wait takes its place. */
#lobby-join.room-waiting .join-rejoin, #lobby-join.room-waiting .join-tv, #lobby-join.room-waiting #btn-join,
#lobby-join.room-waiting .lobby-prompt, #lobby-join.room-waiting .room-code-join-wrap,
#lobby-join.room-waiting #gamepad-code-spinners { display: none !important; }
#lobby-join.room-waiting #join-status { font-size: var(--uf-size-lg, 1.2em); margin-top: var(--uf-space-5, 24px); }

/* Ride Together's seat choice: a readable column, not full width. */
@media (min-width: 1024px) {
  #lobby-role[active] { max-width: 30em; margin: 0 auto !important; font-size: var(--uf-size-md); }
  #lobby-role uf-button { font-size: var(--uf-size-lg); padding: var(--uf-space-4) var(--uf-space-5) !important; }
}

/* ── Phone as controller: a large card over the menus only, QR sized for the
      couch (#428 round 2). The panel's own CSS is injected at runtime, so these
      rules carry a leading `body` to outrank it. ── */
@media (min-width: 1024px) {
  body #phone-pad-panel { right: var(--uf-stage-inset); }
  body #phone-pad-panel .ppp-card {
    width: min(58em, calc(100% - 2 * var(--uf-space-6))); padding: var(--uf-space-6); border-radius: var(--uf-radius-lg); text-align: left;
    display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--uf-space-6); row-gap: var(--uf-space-3); align-items: start;
    grid-template-areas: "qr title" "qr steps" "qr status" "qr link" "qr row"; font-size: var(--uf-size-md);
  }
  body #phone-pad-panel h2 { grid-area: title; margin: 0; font-size: var(--uf-size-xl); }
  body #phone-pad-panel .ppp-qr { grid-area: qr; padding: var(--uf-space-4); border-radius: var(--uf-radius-lg); }
  body #phone-pad-panel .ppp-qr svg { width: min(400px, 38vh); height: min(400px, 38vh); }
  body #phone-pad-panel .ppp-card::after {
    grid-area: steps; white-space: pre-line; line-height: 1.7; color: var(--uf-color-fg);
    content: '1  Open your phone’s camera\A 2  Point it at the code\A 3  Steer and pedal on your phone';
  }
  body #phone-pad-panel .ppp-status { grid-area: status; font-size: var(--uf-size-md); min-height: 0; }
  body #phone-pad-panel .ppp-link { grid-area: link; font-size: var(--uf-size-xs); }
  body #phone-pad-panel .ppp-row { grid-area: row; justify-content: flex-start; align-self: end; gap: var(--uf-space-3); }
  body #phone-pad-panel #btn-ppp-done { min-width: 8em; font-size: var(--uf-size-lg); }
}


/* #517 · the Profile pill shows the signed-in player's picture (Steam or Google)
   in the icon's place, a little larger than an icon so a face reads. */
uf-button[size="pill"] > img.bar-avatar {
  width: 1.5em; height: 1.5em; flex: none; margin: -0.2em 0;
  border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1.5px currentColor;
}
/* #612 · Discord's picture on the left of "Profile", Steam's on the right. */
uf-button[size="pill"] > img.bar-avatar[data-provider="discord"] { box-shadow: 0 0 0 2px #5865f2; }
uf-button[size="pill"] > img.bar-avatar[data-provider="steam"] { box-shadow: 0 0 0 2px #66c0f4; }
/* The QR steps in the popup, at the kit's sizes on a TV. */
@media (min-width: 1024px) {
  body > #profile-popup.bar-popup { width: min(24em, 40vw); }
  body > #profile-popup.bar-popup .profile-popup-title { font-size: var(--uf-size-md); }
  body > #profile-popup.bar-popup .profile-popup-sub,
  body > #profile-popup.bar-popup .profile-popup-steps { font-size: var(--uf-size-xs); }
  body > #profile-popup.bar-popup .profile-popup-qr svg { width: 9em; height: 9em; }
  body > #profile-popup.bar-popup .profile-popup-code { font-size: var(--uf-size-md); }
  body > #profile-popup.bar-popup .profile-popup-avatars img { width: 3.2em; height: 3.2em; }
  /* #612 · "was combined into this one. Not you?" at the email line's size. */
  body > #profile-popup.bar-popup .profile-popup-notice { max-width: none; padding: var(--uf-space-2) var(--uf-space-3); gap: 0; }
  body > #profile-popup.bar-popup .profile-popup-notice-text { font-size: var(--uf-size-sm); }
  body > #profile-popup.bar-popup .profile-popup-device-status { font-size: var(--uf-size-sm); line-height: 1.35; }
}

/* #517 · Settings (the Options overlay) owns the pad while it is open: the
   lobby's highlight under it would look like a second focus. */
body:has(#options-overlay.visible) #lobby .gamepad-focus { outline: none !important; box-shadow: none !important; }
/* #540 · icon-only pills (Leaderboard, Settings): a round-ish pill, the icon a touch larger, no label gap. */
#lobby-bar uf-button.bar-icon-only { padding: 0 var(--uf-space-2); gap: 0; min-width: calc(var(--uf-size-md) * 2.2); justify-content: center; }
#lobby-bar uf-button.bar-icon-only > svg { width: 1.3em; height: 1.3em; }

/* #517 · Help, the Leaderboard and Achievements (#540) own the pad while open: hide the step's highlight under the scrim. */
body:has(#help-modal[open], #leaderboard-modal[open], #achievements-modal[open]) #lobby .gamepad-focus { outline: none !important; box-shadow: none !important; }

/* ── #523 · Settings (the Options overlay) readable from the couch ──
   The card kept the phone's pixel sizes (11–14px text, 400px wide, one button
   per line). On a desktop/TV it sits on the kit's text sizes, each choice is
   one segmented row, and the sections (.opt-section) run in two columns when
   the card is wide enough. It is a modal, so it takes the whole screen (over
   the art panel too): two columns of four-button rows need the width.
   Columns are grid tracks, so the sections side by side start at the same
   height and the row-first pad navigation (js/row-focus.js) keeps ↓ in its
   column and ←/→ along a row. The phone layout is unchanged. */
@media (min-width: 1024px) {
  #options-overlay .options-card {
    --gutter: clamp(24px, 2.5vw, 64px);
    box-sizing: border-box; min-width: 0; max-width: none;
    width: min(calc(100vw - 2 * var(--gutter)), 1800px);
    max-height: calc(100vh - 2 * var(--gutter)); max-height: calc(100dvh - 2 * var(--gutter));
    padding: var(--uf-space-6) var(--uf-space-7); border-radius: var(--uf-radius-lg);
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(18em, 34%)), 1fr));   /* two at most */
    column-gap: var(--uf-space-7); row-gap: var(--uf-space-5); align-items: start;
    font-size: var(--uf-size-md); text-align: left;
  }
  #options-overlay .options-card > h2, #options-overlay .opt-wide { grid-column: 1 / -1; }
  #options-overlay .options-card > h2 { margin: 0; font: 800 var(--uf-size-2xl)/1.2 var(--uf-font-ui); color: var(--uf-color-fg); text-align: center; }
  /* A section with nothing shown (Explore without a Maps key) takes no cell. */
  #options-overlay .opt-section:not(.opt-heading):not(:has(button:not([style*="display:none"]):not([style*="display: none"]))) { display: none; }
  #options-overlay .opt-section { display: grid; gap: var(--uf-space-2); min-width: 0; }
  #options-overlay .opt-heading { padding-top: var(--uf-space-4); border-top: 1px solid var(--uf-color-line-soft); }
  #options-overlay .options-card .label {
    margin: 0; font: 700 var(--uf-size-md)/1.25 var(--uf-font-ui); letter-spacing: .06em; color: var(--uf-color-fg);
  }
  #options-overlay .options-row { flex-direction: row; flex-wrap: nowrap; align-items: stretch; gap: var(--uf-space-3); margin: 0; }
  #options-overlay .opt-btn {
    /* equal shares, but never narrower than the longest word: wrap between words, never inside one */
    flex: 1 1 0; min-width: min-content; width: auto; padding: .45em .5em;
    font: 700 var(--uf-size-lg)/1.2 var(--uf-font-ui); border-width: 2px; border-radius: var(--uf-radius-md);
  }
  #options-overlay .options-row:has(> .opt-btn:only-child) .opt-btn { flex: 0 1 auto; padding-inline: 1.2em; }
  #options-overlay .options-note { margin: 0; font-size: var(--uf-size-sm); line-height: 1.35; color: rgba(255, 255, 255, .72); }   /* was 30% white */
  #options-overlay .options-note:empty { display: none; }
  #options-overlay #options-tourist-btn { justify-self: start; padding: .45em 1.2em; font: 700 var(--uf-size-lg)/1.2 var(--uf-font-ui); }
  /* Tools row: perf test, tools, dev tools and Close on one line at the bottom. */
  #options-overlay .opt-tools {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--uf-space-3);
    padding-top: var(--uf-space-4); border-top: 1px solid var(--uf-color-line-soft);
  }
  #options-overlay #options-perf-btn, #options-overlay #options-devtools-btn, #options-overlay #options-browserdev-btn, #options-overlay #options-close-btn {
    min-width: 8em; margin: 0; padding: .45em 1.2em; font: 700 var(--uf-size-md)/1.2 var(--uf-font-ui); border-width: 2px; border-radius: var(--uf-radius-md);
  }
  #options-overlay #options-close-btn { font-size: var(--uf-size-lg); color: var(--uf-color-fg); }
  #options-overlay #options-perf-result, #options-overlay #options-browserdev-hint { flex-basis: 100%; min-height: 0; margin: 0; text-align: center; font-size: var(--uf-size-sm); }
  #options-overlay #options-perf-result:empty, #options-overlay #options-browserdev-hint:empty { display: none; }
  #options-overlay .gamepad-focus { outline: 3px solid var(--uf-color-fg) !important; outline-offset: 3px; }
}

/* ── #541 · tutorial coaching at TV size ──
   The ride's instruction line, its phase dots, the COLLECT marker, the dodge
   arrow and the crash / off-road notes were phone pixel sizes; on a TV they
   take the kit ramp (at 1920px: 2xl ≈ 44px, xl ≈ 36px, lg ≈ 30px). */
@media (min-width: 1024px) {
  #tutorial-prompt { top: calc(var(--uf-size-2xl) * 1.6); }
  #tutorial-prompt-text { font-size: var(--uf-size-2xl); padding: .3em .9em; border-radius: .45em; }
  #tutorial-phase-dots { gap: calc(var(--uf-size-sm) * .8); margin-top: calc(var(--uf-size-sm) * .8); }
  .tutorial-dot { width: calc(var(--uf-size-md) * .7); height: calc(var(--uf-size-md) * .7); }
  #coaching-collect-indicator .collect-icon { font-size: calc(var(--uf-size-2xl) * 2.2); }
  #coaching-collect-indicator .collect-text { font-size: var(--uf-size-lg); letter-spacing: .15em; }
  #coaching-dodge-arrow svg { width: calc(var(--uf-size-2xl) * 4); height: calc(var(--uf-size-2xl) * 4); }
  #coaching-pylon-success { font-size: calc(var(--uf-size-2xl) * 2.5); }
  #coaching-offroad-warning { font-size: var(--uf-size-xl); }
  #tutorial-crash-text { font-size: calc(var(--uf-size-2xl) * 1.3); }
  #tutorial-crash-hint { font-size: var(--uf-size-lg); }
}

/* ── #542 · Steering feel slider at TV size ──
   Every copy: each controller's in Players (#646) and the tutorial finish
   screen's. The end labels read from the couch and the thumb is a real target. */
@media (min-width: 1024px) {
  #players-sheet .set-feel-end { font-size: var(--uf-size-md); }
  #players-sheet .pl-feel-slider { width: 100%; zoom: 1.6; }
  .steering-feel-label { font-size: var(--uf-size-md); }
  .steering-feel-row { gap: calc(var(--uf-size-md) * .6); }
  .steering-feel-end { font-size: var(--uf-size-md); min-width: 0; }
  #steering-feel-slider, #steering-feel-slider::-webkit-slider-runnable-track { height: calc(var(--uf-size-md) * .4); border-radius: 999px; }
  #steering-feel-slider::-webkit-slider-thumb {
    width: calc(var(--uf-size-md) * 1.5); height: calc(var(--uf-size-md) * 1.5);
    margin-top: calc(var(--uf-size-md) * -.55);   /* centre the thumb on the track: -(1.5 - .4) / 2 */
  }
}

/* #553 · First page on TV: the House Tandem site's hero treatment. The other
   painting (geese from behind) fills the stage, dimmed under a dark wash,
   and the right panel fades into it instead of meeting a hard dark edge. */
@media (min-width: 1024px) {
  #lobby:has(#lobby-mode[active])::before {
    /* Sized to the stage and lifted so both geese heads sit above the chooser and the buttons. */
    --art-w: calc((100vw - var(--uf-stage-inset)) * 1.08);
    content: ''; position: fixed; inset: -24px; z-index: -1; pointer-events: none;
    background:
      linear-gradient(to bottom, rgba(10, 10, 15, .35) 0%, rgba(10, 10, 15, .6) 60%, rgba(10, 10, 15, .92) 100%),
      url(../images/large_action_behind.png) 0 calc(var(--art-w) * -0.58) / var(--art-w) auto no-repeat;
    filter: blur(3px) brightness(.4);
  }
  #lobby:has(#lobby-mode[active]) #lobby-img-right {
    box-shadow: none;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 38%);
            mask-image: linear-gradient(to right, transparent 0, #000 38%);
  }
  /* The bike chooser sits at the bottom, a little clear of the bar, so the heads show above it. */
  #lobby:has(#lobby-mode[active]) #bike-carousel { align-self: end !important; margin-bottom: calc(var(--gutter) * 1.5) !important; }
  /* ...and is just tall enough that its top lines up with RIDE TOGETHER (1080p TV). */
  #lobby:has(#lobby-mode[active]) #bike-preview-canvas { height: 51.5vh !important; }
}

/* #553 · The bike chooser's arrows name the shoulder buttons that cycle bikes
   (L1/R1 on a DualSense, LB/RB on Xbox) while a controller drives the menus;
   mouse and touch keep the arrows. */
body.pad-menus #bike-carousel .bike-nav-arrow { display: none; }
/* The phone remote has no L1 / R1: keep the arrows, which take the D-pad focus. */
body.pad-menus.remote-menus #bike-carousel .bike-nav-arrow { display: inline; }
body.pad-menus.remote-menus #bike-carousel uf-controller-glyph.pad-only { display: none !important; }
#bike-carousel .bike-carousel-nav uf-controller-glyph { pointer-events: none; }
/* #576: the preview (position: relative, later in the DOM) painted over the
   L1 / R1 glow and focus ring on the side that meets it; lift the tabs over it. */
#bike-carousel .bike-carousel-nav { position: relative; z-index: 2; }
@media (min-width: 1024px) {
  #lobby #bike-carousel .bike-carousel-nav { width: calc(var(--uf-size-md) * 3.4) !important; }
  #bike-carousel .bike-carousel-nav uf-controller-glyph .ufg { --_s: calc(var(--uf-size-2xl) * 1.5); }
}

/* ── #548 · the Dressing Room at TV size ──
   It kept the laptop's pixel sizes (12.5 px choice buttons, 480 px cards, a
   preview capped at 560 px) inside a 52em sheet. On a desktop / TV it takes the
   whole screen like Settings (#523): the cards fill the height, the preview
   takes whatever the card does not need (the canvas follows its CSS size every
   frame, js/dressing-room-preview.js), and the text sits on the kit's sizes —
   choice buttons at --uf-size-md, the rule Settings keeps (smoke:tv-nav LY-09). */
@media (min-width: 1024px) {
  #dressing-room > .uf-sheet__card {
    --gutter: clamp(16px, 2vw, 48px);
    width: calc(100vw - 2 * var(--gutter)); max-width: none;
    height: calc(100vh - 2 * var(--gutter)); height: calc(100dvh - 2 * var(--gutter)); max-height: none;
    padding: var(--uf-space-5) var(--uf-space-6);
  }
  #dressing-room .uf-sheet__body { display: flex; flex-direction: column; gap: var(--uf-space-3); overflow: hidden auto; }
  #dressing-room .dr-cards { flex: 1 1 auto; min-height: 0; align-items: stretch; gap: var(--uf-space-5); }
  #dressing-room .dr-team { align-items: stretch; align-content: stretch; gap: var(--uf-space-4); padding: var(--uf-space-3); }
  #dressing-room .dr-team-title { flex: 0 0 100%; font-size: var(--uf-size-sm); }
  #dressing-room .dr-card {
    display: flex; flex-direction: column; gap: var(--uf-space-3); min-height: 0;
    max-width: none; padding: var(--uf-space-4); border-width: 2px; border-radius: var(--uf-radius-lg);
  }
  #dressing-room .dr-card[data-state="editing"] { max-width: none; flex-grow: 1.6; }
  /* The goose takes every spare pixel of the card: all of it when Ready, what the
     pickers leave when Editing. Nothing else shrinks, so the card never overflows. */
  #dressing-room .dr-card > * { flex-shrink: 0; }
  #dressing-room .dr-preview { flex: 1 1 0; height: auto; min-height: 9em; }
  #dressing-room .dr-card[data-state="editing"] .dr-preview { min-height: 5em; }
  /* #612 · a sign-in QR on the card: the goose gives up height so EDIT / DONE stay on the card. */
  #dressing-room .dr-card:has(.dr-account[data-state="pending"]) .dr-preview { min-height: 3em; }
  #dressing-room .dr-preview--static { font-size: var(--uf-size-2xl); }
  #dressing-room .dr-who { font-size: var(--uf-size-lg); }
  #dressing-room .dr-pnum { font-size: var(--uf-size-sm); }
  #dressing-room .dr-badge { font-size: var(--uf-size-sm); padding: .25em .7em; }
  #dressing-room .dr-summary { font-size: var(--uf-size-md); }
  #dressing-room .dr-stick-hint, #dressing-room .dr-hint { font-size: var(--uf-size-sm); }
  /* Each label beside its buttons (one line per group, not two): the label
     column is as wide as the widest label. Editing hides the summary line —
     the lit buttons already say it. */
  #dressing-room .dr-rows { grid-template-columns: max-content minmax(0, 1fr); column-gap: var(--uf-space-4); row-gap: var(--uf-space-3); align-items: center; }
  #dressing-room .dr-group { display: contents; }
  #dressing-room .dr-label { font-size: var(--uf-size-sm); margin: 0; }
  #dressing-room .dr-card[data-state="editing"] .dr-summary { display: none; }
  #dressing-room .dr-opts { gap: var(--uf-space-2); }
  #dressing-room .dr-card .opt-btn {
    padding: .4em .75em; font: 700 var(--uf-size-md)/1.2 var(--uf-font-ui);
    border-width: 2px; border-radius: var(--uf-radius-md);
  }
  #dressing-room .led-swatch { width: .8em; height: .8em; margin-right: .4em; vertical-align: -.05em; }
  #dressing-room .dr-buzz { margin-top: 0; gap: var(--uf-space-3); }
  #dressing-room .dr-buzz-label { font-size: var(--uf-size-sm); }
  #dressing-room .dr-chip { padding: .4em .9em; font: 700 var(--uf-size-md)/1.2 var(--uf-font-ui); border-width: 2px; border-radius: var(--uf-radius-md); }
  #dressing-room .dr-status { font-size: var(--uf-size-md); }
  #dressing-room .opt-btn.gamepad-focus, #dressing-room .dr-chip.gamepad-focus { outline: 3px solid var(--uf-color-fg); outline-offset: 3px; }
  /* Last resort on a short screen: the card scrolls, and the focused button
     scrolls into view (RowFocusController, js/row-focus.js). */
  #dressing-room .dr-card { overflow: hidden auto; }
  /* #617 · an editing card never scrolls as a whole: its pickers scroll in their own box, so the
     goose and DONE stay on the card. (The whole card scrolling hid the preview for good once a
     narrow card's last rows had scrolled it off: there is nothing to focus above the first row.) */
  #dressing-room .dr-card[data-state="editing"] { overflow: hidden; }
  #dressing-room .dr-card[data-state="editing"] > .dr-rows-wrap { min-height: 0; overflow: hidden auto; overscroll-behavior: contain; padding: 4px; margin: -4px; }
}
/* Editing a wide card (data-wide, set from its width by js/dressing-room.js): two columns, the goose
   at the card's full height on the left and the pickers on the right — a full-
   width preview over the pickers was a 5:1 strip. The editing card takes most
   of the row; the Ready card beside it, preview only, gets a taller shape. */
@media (min-width: 1024px) {
  #dr-cards > .dr-card[data-state="editing"] { flex-grow: 2.3; }
  #dressing-room .dr-card[data-state="editing"][data-wide] {
    display: grid; column-gap: var(--uf-space-5); row-gap: var(--uf-space-3);
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto;   /* the pickers never run under DONE: on a short card they scroll */
    grid-template-areas: "head head" "preview rows" "preview actions" "stick note";
  }
  #dressing-room .dr-card[data-state="editing"][data-wide] > .dr-head { grid-area: head; }
  #dressing-room .dr-card[data-state="editing"][data-wide] > .dr-preview { grid-area: preview; height: 100%; min-height: 0; contain: size; }   /* its bitmap follows its box: never let it size the row */
  #dressing-room .dr-card[data-state="editing"][data-wide] > .dr-stick-hint { grid-area: stick; display: block; }
  #dressing-room .dr-card[data-state="editing"][data-wide] > .dr-rows-wrap { grid-area: rows; align-self: stretch; }
  #dressing-room .dr-card[data-state="editing"][data-wide] > .dr-actions { grid-area: actions; justify-content: flex-start; }
  #dressing-room .dr-card[data-state="editing"][data-wide] > .dr-hint { grid-area: note; text-align: left; }
  /* The pickers' column is narrower than a full card: labels go back above their buttons. */
  #dressing-room .dr-card[data-state="editing"][data-wide] .dr-rows { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: var(--uf-space-3); }
  #dressing-room .dr-card[data-state="editing"][data-wide] .dr-group { display: block; }
  #dressing-room .dr-card[data-state="editing"][data-wide] .dr-label { margin-bottom: var(--uf-space-2); }
}
/* Versus with a shared team (3+ players; TV playtest 2026-11-06). The team box
   wrapped its title onto a line of its own, and a wrapped flex line grows to its
   tallest card: an editing card squeezed beside a teammate (labels in a column,
   one button per line) grew ~1500 px and stretched every card past the screen,
   ballooning the Ready previews. Now the title sits above a single line of
   cards that stop at the team's height (a long card scrolls), the team being
   edited and its editing card take most of the width (goose beside the pickers,
   as in co-op); a Ready card only needs room for its goose. */
@media (min-width: 1024px) {
  #dressing-room .dr-team { position: relative; flex-wrap: nowrap; min-height: 0; min-width: 0; padding-top: calc(var(--uf-space-3) + 1.9em); }
  #dressing-room .dr-team-title { position: absolute; top: var(--uf-space-3); left: var(--uf-space-3); right: var(--uf-space-3); }
  #dressing-room .dr-team > .dr-card { max-height: 100%; }
  #dressing-room .dr-team:has(> .dr-card[data-state="editing"]) { flex-grow: 4; }
  #dressing-room .dr-team > .dr-card[data-state="editing"][data-wide] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
    grid-template-areas: "head head" "preview rows" "actions rows" "stick rows" "note note";
  }
  #dressing-room .dr-team > .dr-card[data-state="editing"][data-wide] > .dr-actions { justify-content: center; }
  #dressing-room .dr-team:has(> .dr-card ~ .dr-card) > .dr-card[data-state="editing"] { flex-grow: 3; }
  /* A narrow editing card (several editing at once, or a small screen): the goose on top,
     each label above its buttons so they wrap across the card; a long card scrolls. */
  #dressing-room .dr-card[data-state="editing"]:not([data-wide]) .dr-preview { min-height: 8em; }
  #dressing-room .dr-card[data-state="editing"]:not([data-wide]) > .dr-rows-wrap { flex: 0 1 auto; min-height: 5em; }
  #dressing-room .dr-card[data-state="editing"]:not([data-wide]) .dr-rows { grid-template-columns: minmax(0, 1fr); }
  #dressing-room .dr-card[data-state="editing"]:not([data-wide]) .dr-group { display: block; }
  #dressing-room .dr-card[data-state="editing"]:not([data-wide]) .dr-label { margin-bottom: var(--uf-space-2); }
}
/* A laptop-height screen (1280×800): tighter rows; the stick hint waits until Ready. */
@media (min-width: 1024px) and (max-height: 900px) {
  #dressing-room .dr-card { padding: var(--uf-space-3); gap: var(--uf-space-2); }
  #dressing-room .dr-rows { row-gap: var(--uf-space-2); }
  #dressing-room .dr-card .opt-btn { padding: .3em .6em; }
  #dressing-room .dr-card[data-state="editing"][data-wide] .dr-stick-hint, #dressing-room .dr-card[data-state="editing"] .dr-stick-hint { display: none; }
}

/* ── #646 · Players: one card per seat on this screen (who · controller · its settings),
      then Available controllers. Rows built by js/players-sheet.js. ── */
#players-sheet .pl-rows { display: grid; gap: var(--uf-space-3); grid-template-columns: minmax(0, 1fr); }
#players-sheet .pl-row { --_tone: var(--uf-color-captain); display: grid; gap: var(--uf-space-2); align-content: start; min-width: 0;
  padding: var(--uf-space-3); border-radius: var(--uf-radius-md); background: var(--uf-color-surface-2);
  border: 2px solid color-mix(in srgb, var(--_tone) 55%, transparent); }
#players-sheet .pl-row[data-tone="stoker"] { --_tone: var(--uf-color-stoker); }
#players-sheet .pl-row[data-tone="team-a"] { --_tone: var(--uf-color-team-a); }
#players-sheet .pl-row[data-tone="team-b"] { --_tone: var(--uf-color-team-b); }
#players-sheet .pl-head { display: flex; align-items: center; gap: var(--uf-space-3); flex-wrap: wrap; min-width: 0; }
#players-sheet .pl-num { font: 800 var(--uf-size-sm)/1 var(--uf-font-mono); padding: .35em .55em; border-radius: 6px; background: var(--_tone); color: var(--uf-color-bg); flex: none; }
#players-sheet .pl-who { font: 700 var(--uf-size-lg)/1.2 var(--uf-font-ui); min-width: 0; flex: 1 1 auto; display: flex; overflow: hidden; }
#players-sheet .pl-guest { color: var(--uf-color-fg-muted); }
#players-sheet .pl-seat { font-size: var(--uf-size-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--uf-color-fg-muted); }
#players-sheet .pl-acc { margin-left: auto; display: flex; align-items: center; gap: var(--uf-space-2); }
#players-sheet .pl-acc-note { font-size: var(--uf-size-sm); color: var(--uf-color-fg-muted); }
#players-sheet .pl-acc-panel { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--uf-space-1) var(--uf-space-3); align-items: center; }
#players-sheet .pl-acc-qr { grid-row: span 2; }
#players-sheet .pl-acc-qr svg { width: 8em; height: 8em; display: block; background: #fff; border-radius: 8px; }
#players-sheet .pl-acc-steps { margin: 0; padding-left: 1.2em; font-size: var(--uf-size-sm); line-height: 1.5; }
#players-sheet .pl-acc-code { font: 800 var(--uf-size-lg)/1 var(--uf-font-mono); letter-spacing: .15em; color: var(--uf-color-accent); }
#players-sheet .pl-acc-status, #players-sheet .pl-note, #players-sheet .pl-avail-note { margin: 0; font-size: var(--uf-size-sm); color: var(--uf-color-fg-muted); }
#players-sheet .pl-pad { display: flex; align-items: center; gap: var(--uf-space-2); flex-wrap: wrap; font-size: var(--uf-size-sm); min-width: 0; }
#players-sheet .pl-pad-name { font-size: var(--uf-size-md); }
#players-sheet .pl-pad uf-button { margin-left: auto; }
#players-sheet .pl-led { width: .9em; height: .9em; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 0 2px var(--uf-color-line-soft); }
#players-sheet .pl-muted { color: var(--uf-color-fg-muted); }
#players-sheet .pl-settings { display: grid; gap: var(--uf-space-1); }
/* Steering feel: "Steering feel · Recalibrate" over "Stable [slider] Responsive" (fits half a TV card). */
#players-sheet uf-setting[data-set="gyro"][checked] > .uf-setting__detail { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--uf-space-2) var(--uf-space-3); }
#players-sheet .pl-feel-label { grid-column: 1 / 3; font-size: var(--uf-size-md); }
#players-sheet .uf-setting__detail [data-act="recal"] { justify-self: end; }
#players-sheet .set-feel-end { color: var(--uf-color-fg-muted); }
#players-sheet .pl-feel-slider { accent-color: var(--uf-color-accent); }
/* Below the TV layout (the #542 block above sizes them for the couch). */
@media (max-width: 1023px) {
  #players-sheet .set-feel-end { font-size: var(--uf-size-xs); }
  #players-sheet .pl-feel-slider { width: 100%; }
}
#players-sheet input[type=range].gamepad-focus { outline: 3px solid var(--uf-color-accent); outline-offset: 3px; border-radius: 999px; }
#players-sheet .pl-available { display: grid; gap: var(--uf-space-1); margin: var(--uf-space-4) 0 var(--uf-space-3); }
@media (min-width: 1024px) {
  /* Two players or more: side by side, two to a row. */
  #players-sheet .pl-rows:not([data-count="1"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  #players-sheet .pl-row { padding: var(--uf-space-2); }
  #players-sheet .pl-feel-slider { width: 100%; }
}
