/* Direction A: the live TV library. Dimensions scale with the TV, not devicePixelRatio. */
/* (2026-10-28 menupolish: Rubik throughout (it was already loaded for Settings), one type scale, soft art stages, spring hover,
   staggered enter motion, skeleton/empty states. Motion is transform/opacity only, and none of it runs once the screen settles,
   except the live dot and the detail view's floating gift, each one small composited layer.) */
body.gallery-live {
  --ink:#14283a; --muted:#566d82; --line:#dbe4ec; --blue:#1688ce; --blue-hi:#2aa7ee; --bg:#eff4f8;
  --paint:radial-gradient(120vw 80vh at 12% -18%,#dcedfa 0%,rgba(220,237,250,0) 62%),radial-gradient(90vw 70vh at 104% 112%,#e6ecfb 0%,rgba(230,236,251,0) 60%),#eff4f8;
  --spring:cubic-bezier(.34,1.45,.55,1); --out:cubic-bezier(.2,.8,.2,1);
  --lift:0 1px 2px rgba(20,40,58,.06),0 .45vh 1.3vh rgba(20,40,58,.06);
  --lift-hi:0 .5vh 1vh rgba(20,40,58,.08),0 1.8vh 3.8vh rgba(22,136,206,.2);
  background:var(--paint)!important; color:var(--ink); font-family:Rubik,"Segoe UI",Arial,sans-serif;
}
.gallery-live #scene { display:none; z-index:45; pointer-events:none; }
.gallery-settings #scene { display:block; }
.gallery-cursor { position:fixed; top:0; left:0; z-index:46; pointer-events:none; will-change:transform; }
.gallery-cursor[hidden] { display:none; }
.gallery-settings #gallery { pointer-events:none; }
.gallery-live #keys,.gallery-live #joinmode { display:none!important; }
.gallery-live #join-friend { position:static; background:white; color:var(--ink); border:1px solid var(--line); border-radius:.75vw; font-weight:500; z-index:auto; }
#gallery { --blue:#1688ce; --line:#dbe4ec; --muted:#566d82; position:fixed; inset:0; padding:5.93vh 5vw; font:400 max(22px,1.14584vw)/1.45 Rubik,"Segoe UI",Arial,sans-serif; color:var(--ink,#14283a); }
#gallery *,#gallery *::before,#gallery *::after { box-sizing:border-box; }
#gallery button,#gallery a { font:inherit; cursor:none; color:inherit; }
#gallery button { border:0; }
#gallery [hidden] { display:none!important; }
.gallery-brand svg,.gallery-button svg,.gallery-back svg,.gallery-footer svg { flex:none; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }

/* ── Header ── */
.gallery-header { height:7vh; display:flex; align-items:center; gap:2.5vw; padding-bottom:2.4vh; border-bottom:1px solid var(--line); animation:gallery-drop .5s var(--out) backwards; }
.gallery-brand { display:flex; gap:.84vw; align-items:center; font-size:max(28px,1.46vw); font-weight:700; letter-spacing:-.015em; white-space:nowrap; }
.gallery-brand>span { background:linear-gradient(150deg,#3cbcf6,#1688ce 70%); color:#fff; width:2.5vw; height:2.5vw; min-width:40px; min-height:40px; border-radius:50%; display:grid; place-items:center; box-shadow:0 .45vh 1.2vh rgba(22,136,206,.35),inset 0 1px 0 rgba(255,255,255,.35); }
.gallery-brand svg { width:1.5vw; height:1.5vw; min-width:22px; min-height:22px; stroke-width:1.7!important; transform:translateX(-6%); }
.gallery-nav { font-weight:600; color:var(--muted); padding:.2vh 0 .2vh 1.25vw; border-left:2px solid var(--line); }
/* (2026-10-28 audit: overflow:hidden clips the chips; min-width:0 alone still let 4 long names widen the whole gallery off-screen.) */
#gallery-players { margin-left:auto; min-width:0; overflow:hidden; }

/* ── Buttons: quiet secondary, glossy primary; the pointer's hover lifts them ── */
.gallery-button { display:inline-flex; justify-content:center; align-items:center; gap:.6vw; text-decoration:none; padding:1.2vh 1.25vw; border:1px solid var(--line)!important; background:#fff; border-radius:max(12px,.75vw); min-height:5.2vh; font-size:max(22px,1.14584vw)!important; font-weight:500; white-space:nowrap; box-shadow:0 1px 2px rgba(20,40,58,.06);
  transition:transform 220ms var(--spring),box-shadow 200ms ease,background-color 160ms ease,border-color 160ms ease,color 160ms ease; }
.gallery-button svg { width:1.15em; height:1.15em; color:var(--blue); }
.gallery-button:disabled { opacity:.3; }
.gallery-live .gallery-button.gallery-hover { transform:translateY(-.35vh); background:#f4faff; border-color:#a9d4f0!important; box-shadow:0 .9vh 2vh rgba(22,136,206,.16); }
.gallery-primary { background:linear-gradient(180deg,var(--blue-hi,#2aa7ee),var(--blue) 85%); color:white!important; border-color:#1580c2!important; font-weight:600!important; box-shadow:0 .5vh 1.3vh rgba(22,136,206,.32),inset 0 1px 0 rgba(255,255,255,.3); }
.gallery-primary svg { color:#fff; }
.gallery-live .gallery-primary.gallery-hover { background:linear-gradient(180deg,#43b5f3,#1d93d8 85%); border-color:#1580c2!important; box-shadow:0 1.2vh 2.6vh rgba(22,136,206,.38),inset 0 1px 0 rgba(255,255,255,.35); }
/* The friend link is index.html's #join-friend, moved in: its icon comes from here. */
.gallery-live #join-friend::before { content:""; width:1.15em; height:1.15em; background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231688ce' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.2'/%3E%3Cpath d='M3 19.5c.6-3.3 3-5.2 6-5.2s5.4 1.9 6 5.2'/%3E%3Ccircle cx='17' cy='9.2' r='2.5'/%3E%3Cpath d='M16.4 14.4c2.5.1 4.2 1.8 4.6 4.6'/%3E%3C/svg%3E") center/contain no-repeat; }

/* ── Heading + paging ── */
.gallery-heading { display:flex; align-items:end; justify-content:space-between; margin:3vh 0 2.6vh; gap:2vw; animation:gallery-rise .55s var(--out) .05s backwards; }
#gallery h1 { margin:0; font-size:max(52px,2.71vw); font-weight:700; line-height:1.12; letter-spacing:-.03em; }
.gallery-heading p { margin:1vh 0 0; color:var(--muted); font-size:max(24px,1.25vw); }
.gallery-pages { display:flex; align-items:center; gap:.8vw; white-space:nowrap; color:var(--muted); font-weight:500; font-variant-numeric:tabular-nums; }
.gallery-pages button { width:5.2vh; min-width:44px; padding:0; border-radius:50%!important; font-size:max(28px,1.46vw)!important; line-height:1; }

/* ── Tiles ── */
#gallery-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:2.22vh 1.25vw; }
.gallery-tile { position:relative; padding:0; height:25.1vh; min-width:0; border:1px solid var(--line)!important; border-radius:max(14px,1.05vw); background:white; text-align:left; box-shadow:var(--lift);
  transition:transform 280ms var(--spring),border-color 160ms ease;
  animation:gallery-rise .6s var(--out) backwards; animation-delay:calc(var(--i,0) * 24ms + 90ms); }
.gallery-art { position:relative; height:15.7vh; display:grid; place-items:center; border-radius:max(13px,1vw) max(13px,1vw) 0 0;
  background:radial-gradient(ellipse 72% 78% at 50% 42%,#fff 0%,#f1f6fa 52%,#e3ecf3 100%); }
/* A soft floor shadow under every gift, so each sits on the same stage whatever its own art does. */
.gallery-art::after { content:""; position:absolute; left:28%; right:28%; bottom:5%; height:9%; border-radius:50%; background:radial-gradient(closest-side,rgba(20,40,58,.2),rgba(20,40,58,0)); transition:transform 320ms var(--spring),opacity 220ms ease; }
.gallery-art img { position:relative; z-index:1; width:calc(100% - 2vw); height:14.2vh; object-fit:contain; transition:transform 340ms var(--spring); }
.gallery-tile-copy { display:block; padding:.9vh .9vw; border-top:1px solid #e8eef3; }
.gallery-tile-copy>b { display:block; font-size:max(24px,1.25vw); font-weight:600; line-height:1.25; letter-spacing:-.02em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; transition:color 160ms ease; }
.gallery-tile-copy>span { display:block; color:var(--muted); font-size:max(18px,.9375vw); line-height:1.35; margin-top:.3vh; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.gallery-tile-copy em { font-style:normal; color:var(--blue); font-weight:500; }
/* Hovered: an "A" key, the action it takes. */
.gallery-selection { position:absolute; z-index:2; top:.8vh; right:.7vw; background:var(--blue); color:#fff; border-radius:50%; width:1.9vw; height:1.9vw; min-width:30px; min-height:30px; display:grid; place-items:center; font-weight:700; font-size:max(16px,.83vw); box-shadow:0 .4vh 1vh rgba(22,136,206,.4);
  opacity:0; transform:scale(.5); transition:opacity 160ms ease,transform 260ms var(--spring); }
.gallery-live .gallery-hover,#gallery button:focus-visible,#gallery a:focus-visible { outline:max(4px,.21vw) solid var(--blue); outline-offset:max(4px,.21vw); }
#gallery .gallery-tile.gallery-hover { transform:translateY(-.7vh); border-color:transparent!important; }
/* The raised shadow is painted once on its own layer and only fades: no box-shadow repaint per frame of the hover. */
.gallery-tile::after { content:""; position:absolute; inset:0; z-index:-1; border-radius:inherit; box-shadow:var(--lift-hi); opacity:0; transition:opacity 220ms ease; pointer-events:none; }
.gallery-hover.gallery-tile::after { opacity:1; }
.gallery-hover .gallery-art img { transform:translateY(-4%) scale(1.07); }
.gallery-hover .gallery-art::after { transform:scale(.8); opacity:.7; }
.gallery-hover .gallery-tile-copy>b { color:var(--blue); }
.gallery-hover .gallery-selection { opacity:1; transform:none; }

/* Loading: placeholder tiles with a sweep, until the game list lands. Empty: say so, and offer a retry. */
.gallery-skeleton { position:relative; overflow:hidden; border-radius:max(14px,1.05vw); background:#fff; border:1px solid var(--line); min-height:0; display:grid; grid-template-rows:minmax(0,1fr) auto; }
.gallery-skeleton>span { background:#e9f0f5; }
.gallery-skeleton>i { display:block; height:1.3vh; margin:1.2vh .9vw 0; width:60%; border-radius:1vh; background:#e9f0f5; }
.gallery-skeleton>i+i { width:40%; margin-bottom:1.4vh; }
.gallery-skeleton::after { content:""; position:absolute; inset:0; background:linear-gradient(100deg,rgba(255,255,255,0) 30%,rgba(255,255,255,.75) 50%,rgba(255,255,255,0) 70%); transform:translateX(-100%); animation:gallery-sweep 1.4s ease-in-out infinite; }
.gallery-empty { grid-column:1/-1; grid-row:1/-1; align-self:center; justify-self:center; display:grid; justify-items:center; gap:1.2vh; text-align:center; padding:4vh 4vw; }
.gallery-empty img { width:12vh; height:12vh; object-fit:contain; filter:grayscale(.3) drop-shadow(0 .6vh 1vh rgba(20,40,58,.15)); }
.gallery-empty b { font-size:max(30px,1.7vw); font-weight:700; letter-spacing:-.02em; }
.gallery-empty span { color:var(--muted); margin-bottom:1vh; }

/* ── Footer ── */
.gallery-footer { position:absolute; left:5vw; right:5vw; bottom:5.93vh; display:flex; align-items:center; gap:1.25vw; border-top:1px solid var(--line); padding-top:2.3vh; animation:gallery-rise .55s var(--out) .15s backwards; }
.gallery-footer>div { flex:1; }
.gallery-footer b { font-weight:600; white-space:nowrap; display:inline-flex; align-items:center; gap:.6vw; }
.gallery-footer b svg { width:1.2em; height:1.2em; color:var(--blue); }
.gallery-footer p { margin:.4vh 0 0; color:var(--muted); }
/* A and B drawn as the remote's own round keys. */
#gallery kbd { display:inline-grid; place-items:center; width:1.75em; height:1.75em; margin-right:.35em; border-radius:50%; font:700 .8em/1 Rubik,"Segoe UI",Arial,sans-serif; color:#fff; background:var(--blue); box-shadow:0 2px 0 #0f6aa3; vertical-align:.1em; }
#gallery kbd.b { background:#8a9bab; box-shadow:0 2px 0 #66778a; }

/* ── Overlays: game details, Connect a phone ── */
/* (2026-10-28 audit: fixed, not absolute: in the scrolling layout #gallery is the scroller, so an absolute overlay opened at scroll
   offset 0, with Back off-screen and the grid showing below it. #gallery is fixed with no transform, so inset:0 is the viewport.) */
/* (2026-10-28 audit repair: overflow:auto here, not only in the scrolling layout: exact 4:3 now gets the TV layout, and at 800x600
   Golf's Play and the duel page's last lines sat below the screen out of the wheel's reach. Content that fits never scrolls.) */
.gallery-overlay { position:fixed; inset:0; z-index:5; padding:5.93vh 5vw; background:var(--paint,#f1f5f8); overflow:auto; }
.gallery-back { display:inline-flex; align-items:center; gap:.5vw; white-space:nowrap; background:transparent; padding:1vh 1vw 1vh 0; border-radius:max(10px,.6vw); color:var(--muted)!important; font-weight:500!important; transition:color 160ms ease,transform 220ms var(--spring); animation:gallery-fade .4s ease backwards; }
.gallery-back svg { width:1.1em; height:1.1em; }
.gallery-live .gallery-back.gallery-hover { color:var(--blue)!important; transform:translateX(-.3vw); outline-offset:max(2px,.1vw); }
.gallery-detail-layout { display:grid; grid-template-columns:44% 1fr; gap:5vw; align-items:center; margin-top:6vh; }
.gallery-detail-art { position:relative; height:59.3vh; border-radius:max(20px,1.8vw); display:grid; place-items:center; overflow:hidden;
  background:radial-gradient(ellipse 65% 70% at 50% 44%,#fff 0%,#eef5fb 50%,#d9e8f4 100%); box-shadow:inset 0 0 0 1px rgba(20,40,58,.06),var(--lift);
  animation:gallery-pop .6s var(--spring) backwards; }
.gallery-detail-art::after { content:""; position:absolute; left:30%; right:30%; bottom:9%; height:6%; border-radius:50%; background:radial-gradient(closest-side,rgba(20,40,58,.22),rgba(20,40,58,0)); animation:gallery-floor 4.2s ease-in-out .6s infinite; }
.gallery-detail-art img { position:relative; z-index:1; width:85%; height:48vh; object-fit:contain; filter:drop-shadow(0 1vh 1.4vh rgba(20,40,58,.16)); animation:gallery-float 4.2s ease-in-out .6s infinite; }
.gallery-detail-layout>div:last-child>*,.gallery-pair-layout>div:first-child>* { animation:gallery-slide .55s var(--out) backwards; }
.gallery-detail-layout>div:last-child>:nth-child(2),.gallery-pair-layout>div:first-child>:nth-child(2) { animation-delay:.05s; }
.gallery-detail-layout>div:last-child>:nth-child(3),.gallery-pair-layout>div:first-child>:nth-child(3) { animation-delay:.1s; }
.gallery-detail-layout>div:last-child>:nth-child(4),.gallery-pair-layout>div:first-child>:nth-child(4) { animation-delay:.15s; }
.gallery-detail-layout>div:last-child>:nth-child(n+5),.gallery-pair-layout>div:first-child>:nth-child(n+5) { animation-delay:.2s; }
#gallery-detail h1 { font-size:max(64px,3.75vw); margin:1.4vh 0 2vh; }
.gallery-description { font-size:max(26px,1.46vw); color:var(--muted); margin:2vh 0 3vh; max-width:32em; }
.gallery-description+.gallery-description { font-size:max(22px,1.14584vw); margin-top:-1vh; }
.gallery-eyebrow { color:var(--blue); font-weight:600; letter-spacing:.08em; text-transform:uppercase; font-size:max(18px,.94vw); }
.gallery-note { color:var(--muted); font-size:max(20px,1.04vw); }
#gallery-detail [data-gallery="play"] { font-size:max(26px,1.46vw)!important; padding:1.7vh 1.8vw 1.7vh 1.2vw; min-height:7.4vh; gap:.9vw; border-radius:max(14px,.95vw); }
.gallery-key { display:inline-grid; place-items:center; width:1.6em; height:1.6em; border-radius:50%; background:#fff; color:var(--blue); font-weight:700; font-size:.8em; box-shadow:0 2px 0 rgba(0,0,0,.12); }
.gallery-pair-layout { display:grid; grid-template-columns:1fr 32%; align-items:center; gap:7vw; margin-top:6vh; }
.gallery-pair-layout h1 { margin:1.4vh 0 2vh!important; }
#gallery-pair-words { max-width:35em; color:var(--muted); font-size:max(26px,1.46vw); }
#gallery-code { display:block; width:fit-content; max-width:100%; font-size:max(40px,2.6vw); line-height:1.2; overflow-wrap:anywhere; font-weight:700; letter-spacing:.06em; color:var(--ink); background:#fff; border:1px solid var(--line); border-radius:max(14px,1vw); padding:1.2vh 1.4vw; margin:1vh 0 3vh; box-shadow:var(--lift); }
#gallery-code:empty { display:none; }
#gallery-qr { width:100%; border:1.5vw solid #fff; border-radius:1.5vw; image-rendering:pixelated; box-shadow:0 .6vh 1.4vh rgba(20,40,58,.08),0 2.4vh 5vh rgba(20,40,58,.1); animation:gallery-pop .6s var(--spring) .1s backwards; }
.gallery-live #screens { position:static; transform:none; font:inherit; color:var(--ink); background:white; border:1px solid var(--line); border-radius:max(14px,1vw); padding:2vh 1.5vw; margin-top:4vh; white-space:normal; flex-wrap:wrap; box-shadow:var(--lift); }
.gallery-live #screens button,.gallery-live #screens a { font:inherit; color:var(--blue); background:#e5f1f9; padding:1vh 1vw; }
.gallery-live #screens b { color:var(--ink); }
.gallery-live .pp-bar { position:static; transform:none; display:flex; gap:.6vw; font-size:max(22px,1.14584vw); }
.gallery-live .pp-chip { color:var(--ink); background:white; box-shadow:0 1px 2px rgba(20,40,58,.06); border:1px solid var(--line); font-size:inherit; padding:.5vh .6vw; }
.gallery-live .pp-av { width:2vw; height:2vw; font-size:max(22px,1.14584vw); }
.gallery-live .pp-name { max-width:7em; }
/* The transient pill (pointer speed, "click once for sound"): in the empty bottom margin under the footer, so it never
   covers a tile or the footer's text (the sound hint can stay up until the first click). */
.gallery-live #speed { font:500 max(20px,1.04vw)/1.3 Rubik,"Segoe UI",Arial,sans-serif; bottom:.9vh; z-index:35; color:#fff; background:rgba(20,40,58,.92); border:0; padding:.7vh 1.2vw; box-shadow:0 .6vh 2vh rgba(20,40,58,.22);
  transform:translate(-50%,1vh); transition:opacity .2s ease,transform .3s var(--spring); }
.gallery-live #speed.on { transform:translate(-50%,0); }
.gallery-live #pair { padding:5vh 5vw; z-index:40; pointer-events:auto; background:rgba(20,40,58,.42); }
.gallery-live #pair .card { width:min(900px,80vw); border:1px solid var(--line); box-shadow:0 3vh 8vh rgba(20,40,58,.3); background:#f6f9fb; color:var(--ink); padding:3vh 3vw; gap:1.5vh; border-radius:max(20px,1.6vw); animation:gallery-pop .5s var(--spring) backwards; }
.gallery-live #pair .steps { transform:none; border:0; background:#e5f1f9; color:var(--ink); font-size:max(22px,1.14584vw); }
.gallery-live #pair .steps b { color:inherit; }
.gallery-live #pair h2 { font-size:max(56px,2.917vw); font-weight:700; }
.gallery-live #pair p,.gallery-live #pair .muted,.gallery-live #pair button { font-size:max(22px,1.14584vw)!important; }
.gallery-live #launch { inset:0!important; width:100vw!important; height:100vh!important; border-radius:0!important; transition:opacity .2s ease,transform .2s ease; box-shadow:none; animation:gallery-fade .22s ease backwards; }
.gallery-live #launch .l-gift { animation:gallery-pop .55s var(--spring) .05s backwards; }
.gallery-live #launch .l-title { font-family:Rubik,"Segoe UI",Arial,sans-serif; letter-spacing:-.02em; animation:gallery-rise .5s var(--out) .15s backwards; }
.gallery-live #who { font-size:max(22px,1.14584vw); padding:5vh 5vw; }
.gallery-live #who .wrap { width:min(800px,85vw); }
.gallery-live #who p,.gallery-live #who .pick b,.gallery-live #who .pick span,.gallery-live #who .go,.gallery-live #who .alt,.gallery-live #who .back,.gallery-live #who h2 { font-size:max(22px,1.14584vw); }
.gallery-live #who h1 { font-size:max(56px,2.917vw); }

@keyframes gallery-rise { from { opacity:0; transform:translateY(1.6vh) scale(.975); } }
@keyframes gallery-drop { from { opacity:0; transform:translateY(-1.2vh); } }
@keyframes gallery-slide { from { opacity:0; transform:translateX(2vw); } }
@keyframes gallery-pop { from { opacity:0; transform:scale(.92); } }
@keyframes gallery-fade { from { opacity:0; } }
@keyframes gallery-sweep { to { transform:translateX(100%); } }
@keyframes gallery-float { 50% { transform:translateY(-1.6vh); } }
@keyframes gallery-floor { 50% { transform:scale(.82); opacity:.65; } }
@keyframes gallery-live { from { transform:scale(1); opacity:.55; } to { transform:scale(2.6); opacity:0; } }
@media(prefers-reduced-motion:reduce) { #gallery *,#gallery *::before,#gallery *::after,.gallery-live #launch,.gallery-live #launch *,.gallery-live #pair .card { transition:none!important; animation:none!important; } }
@media(min-width:1280px) {
  body.gallery-live #pair .card { width:46.875vw; max-height:88vh; overflow:auto; }
  body.gallery-live #pair img { width:min(15.625vw,32vh); height:min(15.625vw,32vh); }
  /* The existing linked2/Telegram device chooser runs before menu.js boots. */
  body #who { padding:5vh 5vw; font-size:max(22px,1.14584vw); }
  body #who .wrap { width:42vw; }
  body #who h1 { font-size:max(56px,2.917vw); }
  body #who h2,body #who p,body #who .pick b,body #who .pick span,body #who .go,body #who .alt,body #who .back,body #who .or,body #who .err { font-size:max(22px,1.14584vw); }
  body #who input { font-size:max(28px,1.46vw); }
}
/* (2026-10-28 audit: the exact complement of the TV block below. Both used to be inclusive, so exact 4:3 (1024x768, 800x600) got both
   and four tiles collapsed to 2px slivers; 4:3 now gets the non-scrolling TV layout, which a phone pointer can reach entirely.) */
@media not all and (min-aspect-ratio:4/3) { #gallery { overflow:auto; } #gallery-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } .gallery-footer { position:static; margin-top:3vh; flex-wrap:wrap; } .gallery-header { gap:1vw; } .gallery-nav { display:none; } #gallery-players { display:none; } .gallery-detail-layout,.gallery-pair-layout { grid-template-columns:1fr; } .gallery-skeleton { height:25.1vh; } }

/* Presence stays out of document flow, so live updates never shift a tile. */
.gallery-online { display:inline-flex; align-items:center; justify-content:center; gap:.55em; color:var(--muted); background:#fff; border:1px solid var(--line); border-radius:2em; padding:.35vh .8vw; font-size:max(18px,.9375vw); font-weight:500; min-width:10.6em; text-align:center; white-space:nowrap; font-variant-numeric:tabular-nums; box-shadow:0 1px 2px rgba(20,40,58,.05); }
.gallery-online>i,.gallery-playing::before { content:""; position:relative; flex:none; width:.55em; height:.55em; border-radius:50%; background:#a3b3c2; }
.gallery-online.live { color:#1d6f4a; border-color:#cdebdc; background:#f4fbf7; }
.gallery-online.live>i,.gallery-playing::before { background:#22b26a; }
/* The live dot's ripple: one tiny composited layer, only while someone is playing. */
.gallery-online.live>i::after { content:""; position:absolute; inset:0; border-radius:50%; background:#22b26a; animation:gallery-live 1.8s ease-out infinite; }
.gallery-playing { position:absolute; z-index:2; top:1vh; left:.7vw; display:inline-flex; align-items:center; gap:.45em; color:#1d6f4a; background:rgba(255,255,255,.94); border:1px solid #cdebdc; padding:.3vh .6vw; border-radius:1em; font-size:max(18px,.9375vw); font-weight:500; line-height:1.4; pointer-events:none; box-shadow:0 .3vh .8vh rgba(20,40,58,.08); }

/* Spend the available TV height on games. Controls and focus rings stay in the safe area. */
@media(min-aspect-ratio:4/3) {
  /* (2026-10-28 audit: an explicit viewport-wide column; the implicit auto one grew to the header's min-content with 4 players seated.) */
  #gallery { display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:auto auto minmax(0,1fr) auto; row-gap:1.2vh; }
  .gallery-header { height:auto; min-height:6.4vh; padding-bottom:1vh; gap:1.25vw; }
  .gallery-heading { margin:.4vh 0 .2vh; }
  .gallery-heading p { display:none; }
  #gallery-grid { grid-template-rows:repeat(2,minmax(0,1fr)); gap:1.6vh .9vw; min-height:0; }
  /* (2026-10-28 audit: minmax(0,1fr) column so a long nowrap title (Gift Table Tennis at 960x540) ellipsizes instead of spilling.) */
  .gallery-tile { height:auto; min-height:0; display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr) auto; }
  .gallery-art { height:auto; min-height:0; overflow:hidden; }
  .gallery-art img { width:calc(100% - 1vw); height:12.4vh; max-height:100%; }
  .gallery-tile-copy { padding:.75vh .65vw .8vh; }
  /* (2026-10-28 audit: wrap rather than overflow: with the column now viewport-wide, a footer wider than the screen (a longer
     footer line at 1024-1340px, or 800x600) would push Connect a phone off-screen. Only wraps when one line can't fit.) */
  .gallery-footer { position:static; padding-top:1.2vh; flex-wrap:wrap; }
  .gallery-footer>div { display:flex; align-items:center; gap:1.25vw; }
  .gallery-footer p { margin:0; white-space:nowrap; }
}
/* Small windows (not TVs): the A/B hint gives way so the footer stays one line. */
@media(min-aspect-ratio:4/3) and (max-width:1279px) { .gallery-footer p { display:none; } }
@media(min-width:1600px) and (min-height:900px) and (min-aspect-ratio:3/2) {
  #gallery-grid { grid-template-columns:repeat(7,minmax(0,1fr)); grid-template-rows:repeat(3,minmax(0,1fr)); }
}
/* ── Keyboard & mouse mode (core/input-mode.js sets <html data-input="kbm">): the computer is the controller ──
   (2026-10-28 kbmouse: the words follow the input in use; the phone ones come back the moment a phone connects.) */
html:not([data-input="kbm"]) #gallery .on-kbm,html[data-input="kbm"] #gallery .on-phone { display:none!important; }
#gallery .gallery-input { padding:.5vh .9vw .5vh .7vw; border-radius:2em; background:#e8f3fc; color:#0f5f93; border:1px solid #c6e1f5; font-size:.92em; }
#gallery .gallery-input svg { color:var(--blue); }
#gallery kbd.key { width:auto; min-width:1.75em; padding:0 .55em; border-radius:.45em; font-size:.72em; }
.gallery-selection .on-kbm svg { display:block; width:1.35em; height:1.35em; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.gallery-desk { display:flex; align-items:flex-start; gap:.6vw; margin:0 0 3vh; line-height:1.7; max-width:32em; color:var(--ink); font-size:max(20px,1.05vw); }
.gallery-desk svg { flex:none; width:1.3em; height:1.3em; margin-top:.1em; fill:none; stroke:var(--blue); stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.gallery-desk kbd { width:auto!important; min-width:1.6em; height:auto!important; padding:.1em .45em; border-radius:.4em!important; background:#fff!important; color:var(--ink)!important; border:1px solid var(--line); box-shadow:0 2px 0 var(--line)!important; font-size:.8em!important; }
/* "Connect a phone" stops being the call to action: a quiet "Add a phone" (phones still join any time). */
html[data-input="kbm"] #gallery-connect-button { background:#fff; color:var(--ink)!important; border-color:var(--line)!important; font-weight:500!important; box-shadow:0 1px 2px rgba(20,40,58,.06); }
html[data-input="kbm"] #gallery-connect-button svg { color:var(--blue); }
html[data-input="kbm"] .gallery-live #gallery-connect-button.gallery-hover,html[data-input="kbm"] #gallery-connect-button.gallery-hover { background:#fff; border-color:var(--blue)!important; }
