/* Presentation values follow Z1RR.Restream's ttp-v2 Race scene. */
@font-face{font-family:Urbanist;src:url('./viewer-assets/urbanist-latin.woff2') format('woff2');font-style:normal;font-weight:400 900;font-display:swap}
:root{--race-background:#101827;--race-control:#182b46;--race-hover:#203958;color-scheme:dark;font:15px Urbanist,system-ui,sans-serif;background:var(--race-background);min-height:100%;color:#f8fafc}
.edit-crop{position:relative;display:inline-flex;flex:none;align-items:center;justify-content:center;width:.6em;height:.6em;min-height:0!important;padding:0!important;border:0;border-radius:2px;background:transparent!important;color:var(--racer-color);font:inherit;cursor:pointer;text-shadow:none;opacity:.75}
.edit-crop::after{content:'';position:absolute;inset:-5px}
.edit-crop svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.edit-crop:hover{opacity:1}
.edit-crop:focus-visible{outline:2px solid currentColor;outline-offset:2px}
.edit-crop[hidden]{display:none}
/* The parent sizes this frame to its content and owns page scrolling. Avoid a
   second scrollbar while the new height travels through the resize message. */
:root:has(body.embedded){overflow:hidden}
*{box-sizing:border-box}
body{margin:14px;padding-inline:env(safe-area-inset-left) env(safe-area-inset-right);background:var(--race-background)}
#race-home{max-width:1100px;margin:32px auto 48px;padding:0 16px}
.home-heading{display:flex;align-items:center;gap:18px;margin-bottom:32px}
.home-heading img{object-fit:contain;flex:none}
.home-heading h1{font-size:32px;margin:0 0 6px;font-weight:800}
.home-heading p{margin:0;color:#b9c8da;line-height:1.5}
.home-tools{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:16px}
.home-tools h2{font-size:20px;margin:0}
#home-search{width:min(360px,55%);min-width:0}
#home-status{color:#b9c8da;line-height:1.5}
#home-status:empty{display:none}
#recent-races{display:grid;gap:10px}
.recent-race{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:18px 20px;border:1px solid #35475e;border-radius:10px;background:#142239}
.recent-race.is-live{border-color:#64a88e}
.recent-race-info{min-width:0;display:grid;grid-template-columns:44px minmax(0,1fr);column-gap:16px;align-items:center}
.recent-race-info>:not(.race-logo){grid-column:2}
/* 2026-10-22: the event's mark beside a race's lines, as on the v3 Results scene. */
.race-logo{grid-row:1/span 3;width:44px;height:44px;object-fit:contain;align-self:center}
.race-choice-head{display:grid;grid-template-columns:40px minmax(0,1fr);gap:12px;align-items:center;width:100%}
.race-choice-head .race-logo{grid-row:auto;width:40px;height:40px}
.race-choice-head div{display:flex;flex-direction:column;gap:4px;min-width:0}
.recent-race h3{font-size:18px;line-height:1.35;margin:0 0 6px;overflow-wrap:anywhere}
.recent-race p{font-size:14px;margin:0;color:#b9c8da}
.race-entrants-more{font:inherit;color:#d8e4f2;background:none;border:1px solid #35475e;border-radius:999px;padding:0 7px;cursor:pointer}
.race-entrants-more:hover,.race-entrants-more:focus-visible{border-color:#7f9bbd}
.recent-race-links{display:flex;align-items:center;gap:8px;flex:none}
.race-link{display:inline-flex;align-items:center;justify-content:center;min-height:38px;padding:8px 14px;border:1px solid #44617e;border-radius:6px;background:var(--race-control);color:#e7f4ff;text-decoration:none;font-weight:700}
.race-link:hover{background:var(--race-hover);border-color:#71c7fb}
.live-link{color:#a5f0c9;border-color:#64a88e}
#more-races{display:block;margin:22px auto 0}
@media(max-width:600px){#race-home{margin:22px auto 32px;padding:0 12px}.home-heading{gap:12px;margin-bottom:24px}.home-heading h1{font-size:27px}.home-heading img{width:52px;height:52px}.home-tools{align-items:stretch;flex-direction:column;gap:10px}#home-search{width:100%}.recent-race{align-items:flex-start;flex-direction:column;gap:12px;padding:15px}.recent-race h3{font-size:17px}.recent-race-links{width:100%}.race-link{flex:1;min-height:42px}}
#viewer,#stage,.viewer-footer{background:var(--race-background)}
#viewer{--scene-logo-size:clamp(40px,calc(var(--scene-slot-width,600px)*.11),68px)}
.race-picker{display:grid;grid-template-columns:minmax(180px,260px) minmax(0,1fr);align-items:center;gap:8px 12px;margin-bottom:12px}
#race-search{width:100%;min-width:0;font-size:14px}
#race-search::placeholder{color:#b9c8da;opacity:1}
#race-matches{grid-column:1/-1;color:#b9c8da;font-size:12px}
#race-matches:empty{display:none}
.race-choice{display:flex;align-items:center;gap:10px;min-width:0;margin:0;font-size:14px;font-weight:700;color:#f1f5f9}
.race-choice select{width:100%;max-width:100%;min-width:0;font-size:14px;font-weight:400;padding:7px 8px;text-overflow:ellipsis}
.viewer-heading{position:relative;display:grid;grid-template-columns:minmax(0,1fr) var(--scene-logo-size) minmax(0,1fr);align-items:center;gap:0;width:var(--scene-width,92%);max-width:100%;min-height:calc(var(--scene-logo-size) + 9px);margin:0 auto 12px;padding:0 0 8px;border-bottom:1px solid #27354a}
#status{color:#d5c68e;margin:8px 0}
#status:empty{display:none}
#status[data-busy="true"]{--racer-color:#71c7fb;position:fixed;top:50%;left:calc(50% - var(--chat-room,0px) / 2);transform:translate(-50%,-50%);z-index:1100;display:flex;flex-direction:column;align-items:center;gap:14px;width:max-content;max-width:calc(100vw - 40px);margin:0;padding:24px 32px;border:1px solid #44617e;border-radius:12px;background:#142239f5;color:#f1f5f9;text-align:center;font-size:18px;font-weight:700;box-shadow:0 12px 50px #0008,0 0 0 100vmax #02061755;pointer-events:none}
#status[data-busy="true"]::before{content:'';display:block;flex:none;width:30px;height:30px;border:3px solid #35475e;border-top-color:#71c7fb;border-radius:50%;animation:loading-turn .9s linear infinite}
@media(prefers-reduced-motion:reduce){#status[data-busy="true"]::before{animation:none}}
#coverage-switch button[aria-pressed="true"]{border-color:#71c7fb;background:#244660}
#restream{width:min(92%,calc(var(--page-stage-height,600px)*16/9));margin:auto}
.restream-player{display:block;width:100%;aspect-ratio:16/9;min-height:200px;border:0;background:#000}
.restream-loading{position:relative}
.restream-caption{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:30px;font-size:13px;color:#b9c8da}
.restream-note{margin:0}.restream-caption a{margin-left:auto;white-space:nowrap}
.restream-mode .playback-main,.restream-mode .playback-tools,.restream-mode .playback-display>label,.restream-mode #live-edge,.restream-mode #racers,.restream-mode #note{display:none}
#viewer.mobile-view #restream{width:100%}
#viewer:is(:fullscreen,.page-fullscreen) #restream{width:min(100%,calc((100cqh - 30px)*16/9))}
#grid{
  --columns:2;--rows:1;--gap:14px;--name-height:36px;
  --game-height:calc((var(--page-stage-height,600px) - (var(--rows) - 1)*var(--gap))/var(--rows) - var(--name-height));
  display:grid;grid-template-columns:repeat(var(--columns),minmax(0,1fr));gap:var(--gap);
  width:100%;max-width:min(92%,calc(var(--game-height)*4/3*var(--columns) + (var(--columns) - 1)*var(--gap)));margin:auto;
}
#grid article{min-width:0;container-type:inline-size;--racer-color:#71c7fb}
#grid [data-race-loading] .racer-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* 2026-10-21: a live race nobody is streaming yet shows its room instead. */
#grid .race-waiting{grid-column:1/-1;max-width:560px;width:100%;justify-self:center;padding:20px 22px;border:1px solid #2c3f58;border-radius:12px;background:#111c2e}
.race-waiting-head{display:flex;flex-direction:column;gap:4px;margin-bottom:14px}
.race-waiting-head strong{font-size:18px;color:#f1f5f9}
.race-waiting-head small{color:#9fb1c7;font-size:13px}
.race-waiting-list{list-style:none;margin:0;padding:0;display:grid;gap:2px}
.race-waiting-list li{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:12px;align-items:baseline;padding:7px 10px;border-radius:8px}
.race-waiting-list li:nth-child(odd){background:#0d1626}
.race-waiting-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;color:#e2e8f0}
.race-waiting-status{color:#b9c8da;font-size:13px}
.race-waiting-stream{color:#7d8ea3;font-size:12px;min-width:92px;text-align:right}
.race-waiting-list li.is-streaming .race-waiting-stream{color:#84e671;font-weight:700}
#grid article:nth-child(2){--racer-color:#84e671}
#grid article:nth-child(3){--racer-color:#bf409b}
#grid article:nth-child(4){--racer-color:#eeca33}
#grid article:nth-child(5){--racer-color:#ffad69}
#grid article:nth-child(6){--racer-color:#64dfcf}
#grid article:nth-child(7){--racer-color:#ff85a6}
#grid article:nth-child(8){--racer-color:#a8a0ff}
.game{position:relative;overflow:hidden;aspect-ratio:4/3;background:#000;border-radius:clamp(6px,2.1cqw,14px);box-shadow:0 0 28px 11px color-mix(in srgb,var(--racer-color) 9%,transparent),0 0 64px 26px color-mix(in srgb,var(--racer-color) 4%,transparent)}
.game::after{content:'';position:absolute;inset:0;z-index:3;pointer-events:none;border:2px solid var(--racer-color);border-radius:inherit;box-shadow:inset 0 0 5px #020617ad}
.game video{position:absolute;max-width:none;object-fit:fill}
.game .uncropped{inset:0;width:100%;height:100%;object-fit:contain}
.trim{position:absolute;inset:0;pointer-events:none;border:solid black;border-width:0}
.racer-name{--clock-width:calc(72em / 29);position:relative;display:flex;align-items:center;gap:10px;margin:0;padding:5px calc(var(--clock-width) + 10px) 5px 10px;height:36px;font-size:clamp(16px,4.5cqw,29px);font-weight:800;line-height:1.14;color:#f1f5f9;text-shadow:0 2px 0 #020617d1,0 0 10px #1fcbfe29}
.racer-name:has([data-timer-format="mm-ss"]){--clock-width:calc(91.5em / 29)}
.racer-name:has([data-timer-format="h-mm-ss"]){--clock-width:calc(118em / 29)}
.racer-identity{display:inline-flex;align-items:center;gap:8px;min-width:0}
.racer-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-bottom:.08em;margin-bottom:-.08em}
.racer-twitch{display:inline-flex;flex:none;align-items:center;color:var(--racer-color);opacity:.75;text-shadow:none}
.racer-twitch:hover{opacity:1}
.racer-twitch svg{width:.6em;height:.6em;fill:currentColor}
/* Remove the combined blank SVG edges so both visible icon gaps match. */
.racer-identity>.edit-crop{margin-left:-.09em}
/* ttp-v2's 72 / 91.5 / 118px left anchors at 29px type, scaled with the nameplate. */
.racer-clock{position:absolute;right:0;top:50%;transform:translateY(-50%);width:var(--clock-width);white-space:nowrap;text-align:left;color:var(--racer-color);font-variant-numeric:tabular-nums;letter-spacing:.04em;text-shadow:0 2px 0 #020617d1,0 0 10px currentColor}
.racer-clock[data-finished="true"]{color:#f1d67a}
.racer-speaker{position:absolute;top:7px;right:7px;z-index:4;display:grid;place-items:center;width:30px;height:30px;color:#fffffff0;filter:drop-shadow(2px 2px 0 #020617c7);pointer-events:none}
.racer-speaker svg{display:block;width:24px;height:24px;fill:currentColor}
.video-error{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:24px;text-align:center;background:var(--race-background)}
.video-error:empty{display:none}
.video-loading{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:20px;text-align:center;background:var(--race-background);color:#e2e8f0}
.video-loading strong{font-size:clamp(15px,4cqw,22px);font-weight:700}
.video-loading small{font-size:13px;color:#aebcd0}
.loading-spinner{width:28px;height:28px;border:3px solid #35475e;border-top-color:var(--racer-color);border-radius:50%;animation:loading-turn .9s linear infinite}
@keyframes loading-turn{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.loading-spinner{animation:none}}
button,input,select,a.icon-control{font:inherit;padding:7px;background:var(--race-control);color:#f1f5f9;border:1px solid #35475e;border-radius:5px}
button{cursor:pointer}
button:hover,a.icon-control:hover{border-color:#71c7fb;background:var(--race-hover)}
button:disabled{cursor:default;opacity:.45}
:is(#play,#pause)[aria-pressed="true"]{background:#245479;border-color:#71c7fb;color:#fff}
:focus-visible{outline:2px solid #71c7fb;outline-offset:3px}
nav{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:8px;margin:8px 0}
.viewer-footer>nav{gap:12px 22px}
.playback-group{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:6px}
.playback-group button{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:34px}
.playback-group button svg{width:14px;height:14px;fill:currentColor;flex:none}
.playback-group .icon-control{display:inline-flex;align-items:center;justify-content:center;flex:none;width:34px;height:34px;padding:0;text-decoration:none}
.playback-group .icon-control svg{width:18px;height:18px}
.icon-control img{display:block}
#watch-options-open{width:auto;padding:0 9px}
.playback-display>label{display:flex;align-items:center;gap:6px}
#expand{font-size:0;width:34px;height:34px;min-width:34px;gap:0;padding:0}
#expand::before{content:'';display:block;width:18px;height:18px;background:currentColor;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M7 2H2v5m11-5h5v5M2 13v5h5m11-5v5h-5' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E") center/contain no-repeat}
#viewer:is(:fullscreen,.page-fullscreen) #expand::before{mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M2 7h5V2m6 0v5h5M7 18v-5H2m16 0h-5v5' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E")}
#time{display:inline-block;flex:none;width:5.5em;white-space:nowrap;text-align:left;font-variant-numeric:tabular-nums}
summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:12px;padding:10px 14px;color:#f1f5f9;font-size:15px;font-weight:700}
summary::-webkit-details-marker{display:none}
summary::before{content:'';width:7px;height:7px;flex:none;border-right:2px solid #71c7fb;border-bottom:2px solid #71c7fb;transform:rotate(-45deg)}
details[open]>summary::before{transform:rotate(45deg)}
summary:hover{background:var(--race-hover);border-radius:7px}
summary small{font-size:13px;color:#b9c8da;font-weight:500}
details[open]>summary{border-bottom:1px solid #35475e}
.settings-content{padding:14px}
#racer-count{margin-left:auto;font-variant-numeric:tabular-nums}
#racers{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,250px),1fr));gap:8px;align-items:stretch}
.racer-setting{min-height:50px;padding:10px 12px;border:1px solid #35475e;border-radius:7px;background:var(--race-background);display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;min-width:0}
.racer-setting:has(input[type=checkbox]:checked){border-color:#71c7fb;background:#14263e}
.racer-setting>label:first-child{display:flex;align-items:center;gap:6px;min-width:0;font-size:15px;font-weight:750;color:#f1f5f9;overflow-wrap:anywhere;cursor:pointer}
.racer-setting input[type=checkbox]{width:16px;height:16px;margin:0;flex:none;accent-color:#71c7fb}
.racer-setting small{font-size:12px;line-height:1.4;color:#d5c68e;flex-basis:100%}
.racer-unavailable>span{font-size:15px;font-weight:750;color:#d7e0eb;overflow-wrap:anywhere}
.racer-unavailable small{flex-basis:auto;color:#b9c8da}
.racer-setting input[type=number]{width:62px;padding:4px}
.racer-offset{display:flex;align-items:center;gap:4px;font-size:12px;color:#b9c8da}
.catalog-tools{display:flex;align-items:center;justify-content:space-between;gap:16px;border-top:1px solid #35475e;margin-top:12px;padding-top:12px}
.catalog-meta{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px 16px;min-width:0}
.catalog-tools p{margin:0;font-size:13px;color:#b9c8da}
#catalog-note{flex:none}
.catalog-tools button{flex:none}
#note{max-width:100ch;font-size:12px;color:#b9c8da}
a{color:#aebcd0}

/* The whole race frame enters fullscreen; resizing never replaces the videos. */
#viewer:is(:fullscreen,.page-fullscreen){display:flex;flex-direction:column;gap:12px;padding:12px 20px;background:var(--race-background);overflow:hidden}
#viewer:is(:fullscreen,.page-fullscreen) .viewer-heading{flex:none;margin:0 auto}
.viewer-brand{grid-column:2;grid-row:1;justify-self:center;text-decoration:none}
.viewer-brand img{display:block;width:var(--scene-logo-size);height:var(--scene-logo-size);object-fit:contain;filter:drop-shadow(0 0 10px #fde06b3d)}
.race-context{min-width:0;padding:0 clamp(12px,calc(var(--scene-slot-width,600px)*.06),36px)}
.race-context{grid-column:1;grid-row:1}
#race-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;margin:0;font-size:clamp(16px,calc(var(--scene-slot-width,600px)*.055),24px);font-weight:800;line-height:1.14;text-align:center;text-shadow:0 2px 0 #020617c7,0 0 16px #1fcbfe2e;overflow:hidden;overflow-wrap:anywhere;white-space:pre-line;text-wrap:balance}
.race-meta{grid-column:3;grid-row:1;min-width:0;width:calc(100% - clamp(24px,4vw,72px));justify-self:center;text-align:center}
#race-date{font-size:14px;color:#aebcd0}
.race-meta:has(.race-ticker:not([hidden])) #race-date{display:none}
.race-ticker{display:flex;align-items:center;width:80%;margin-inline:auto;height:clamp(32px,calc(var(--scene-slot-width,600px)*.082),46px);font-size:clamp(14px,calc(var(--scene-slot-width,600px)*.046),20px);min-width:0;overflow:hidden;border:1px solid #60a5fa5c;border-radius:8px;background:linear-gradient(90deg,#0b1f40f5,#07142ebd);box-shadow:inset 0 0 18px #0f172a9e,0 0 14px #1fcbfe14;padding:0 10px}
.race-ticker-track{position:relative;display:block;width:100%;height:100%;overflow:hidden;color:#e2e8f0e0;font-size:var(--ticker-font-size,20px);font-weight:700;line-height:1.15;text-shadow:0 1px 0 #020617b3}
.race-ticker-item{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;overflow:hidden;white-space:nowrap}
.race-ticker[data-multiple="true"] .race-ticker-item{animation:ticker-rise 10200ms cubic-bezier(.22,1,.36,1) both}
.race-ticker-text{display:inline-block;flex:none;white-space:nowrap}
.race-ticker[data-pan="true"] .race-ticker-item{justify-content:flex-start}
.race-ticker[data-pan="true"] .race-ticker-text{animation:ticker-pan 10200ms linear both}
@keyframes ticker-rise{0%{opacity:0;transform:translate3d(0,115%,0)}18%,76%{opacity:1;transform:translate3d(0,0,0)}94%,100%{opacity:0;transform:translate3d(0,-115%,0)}}
@keyframes ticker-pan{0%,26%{transform:translate3d(0,0,0)}70%,100%{transform:translate3d(calc(-1*var(--ticker-pan,0px)),0,0)}}
@media(prefers-reduced-motion:reduce){.race-ticker .race-ticker-item,.race-ticker .race-ticker-text{animation:none}.race-ticker-track{overflow-x:auto}.race-ticker-item{position:static;height:100%;overflow:visible}}
#viewer:is(:fullscreen,.page-fullscreen) #stage{container-type:size;flex:1;min-height:0;display:flex;align-items:center;justify-content:center}
#viewer:is(:fullscreen,.page-fullscreen) #grid{
  --columns:2;--rows:1;--gap:12px;--name-height:36px;
  --game-height:calc((100cqh - (var(--rows) - 1)*var(--gap))/var(--rows) - var(--name-height));
  width:100%;max-width:calc(var(--game-height)*4/3*var(--columns) + (var(--columns) - 1)*var(--gap));
  grid-template-columns:repeat(var(--columns),minmax(0,1fr));gap:var(--gap);margin:auto;
}
#viewer:is(:fullscreen,.page-fullscreen) .racer-name{height:36px}
#viewer:is(:fullscreen,.page-fullscreen) .viewer-footer{flex:none;max-height:45vh;overflow:auto;border-top:1px solid #27354a;padding-top:4px}
#viewer:is(:fullscreen,.page-fullscreen) nav{justify-content:center}
#viewer:is(:fullscreen,.page-fullscreen) #time{padding:0 7px;font-size:19px;color:#eacb75}
#viewer:is(:fullscreen,.page-fullscreen) #status{text-align:center}

@media(max-width:800px){
  body{margin:8px}
  nav{font-size:13px}button,input,select{padding:6px}
  .viewer-heading{grid-template-columns:54px minmax(0,1fr);gap:8px;width:100%;padding-inline:6px;min-height:0}
  .viewer-brand{position:static;transform:none;grid-column:1;grid-row:1/3;justify-self:start}.viewer-brand img{width:48px;height:48px}
  .race-context{grid-column:2;padding:0}
  .race-meta{grid-column:2;grid-row:2;width:100%}#race-title{font-size:16px}
  #viewer:is(:fullscreen,.page-fullscreen){padding:10px;gap:8px}
  #viewer:is(:fullscreen,.page-fullscreen) .viewer-heading{gap:12px;padding-bottom:8px}
  #viewer:is(:fullscreen,.page-fullscreen) #race-date{display:none}
  #viewer:is(:fullscreen,.page-fullscreen) .viewer-heading{grid-template-columns:54px minmax(0,1fr)}
  summary{flex-wrap:wrap;gap:8px}summary small{flex-basis:100%;padding-left:15px}
  .catalog-tools{flex-direction:column;align-items:flex-start}
}
@media(max-height:600px){
  #viewer:is(:fullscreen,.page-fullscreen){padding:8px 12px;gap:8px}
  #viewer:is(:fullscreen,.page-fullscreen) .viewer-heading{gap:12px;padding-bottom:6px}
  #viewer:is(:fullscreen,.page-fullscreen) #race-title{font-size:14px}
  #viewer:is(:fullscreen,.page-fullscreen) .viewer-brand img{width:38px;height:38px}
  #viewer:is(:fullscreen,.page-fullscreen) button,#viewer:is(:fullscreen,.page-fullscreen) input,#viewer:is(:fullscreen,.page-fullscreen) select{padding:5px}
  #viewer:is(:fullscreen,.page-fullscreen) #time{font-size:16px}
}
@media(max-width:600px){.race-picker{grid-template-columns:minmax(0,1fr)}}
/* Mobile pages size games by column width and scroll. Only fullscreen fits
   every selected row into the available height. */
#viewer.mobile-view:not(:fullscreen):not(.page-fullscreen) #grid{max-width:100%;--gap:8px;--name-height:26px}
#viewer.mobile-view .racer-name{height:26px;font-size:clamp(11px,5cqw,20px);gap:4px;padding:3px calc(var(--clock-width) + 4px) 3px 4px}
#viewer.mobile-view .racer-identity{gap:4px}
#viewer.mobile-view .racer-speaker{width:22px;height:22px;top:5px;right:5px}
#viewer.mobile-view .racer-speaker svg{width:18px;height:18px}
#viewer.mobile-view .video-loading{padding:8px;gap:6px}
#viewer.mobile-view .video-loading strong{font-size:12px}
#viewer.mobile-view .video-loading small{font-size:11px}
#viewer.mobile-view .loading-spinner{width:20px;height:20px;flex:none}
:root.viewer-fullscreen{overflow:hidden}
#viewer.page-fullscreen{position:fixed;inset:0;z-index:1000;width:100%;height:100%;height:100dvh}
#viewer.mobile-view:is(:fullscreen,.page-fullscreen){gap:6px;padding:max(6px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))}
#viewer.mobile-view:is(:fullscreen,.page-fullscreen) .viewer-heading{grid-template-columns:minmax(0,1fr) 28px minmax(0,1fr);gap:8px;min-height:30px;padding:0 0 4px}
#viewer.mobile-view:is(:fullscreen,.page-fullscreen) .viewer-brand{grid-column:2;grid-row:1}
#viewer.mobile-view:is(:fullscreen,.page-fullscreen) .viewer-brand img{width:28px;height:28px}
#viewer.mobile-view:is(:fullscreen,.page-fullscreen) .race-context{grid-column:1;grid-row:1;padding:0}
#viewer.mobile-view:is(:fullscreen,.page-fullscreen) #race-title{font-size:12px}
#viewer.mobile-view:is(:fullscreen,.page-fullscreen) .race-meta{grid-column:3;grid-row:1;width:100%}
#viewer.mobile-view:is(:fullscreen,.page-fullscreen) .race-ticker{height:26px;font-size:12px;padding-inline:6px}
#viewer.mobile-view:is(:fullscreen,.page-fullscreen) #grid{--gap:8px;--name-height:26px}
#viewer.mobile-view:is(:fullscreen,.page-fullscreen) .racer-name{height:26px;font-size:clamp(10px,4.7cqw,20px);padding-block:3px}
#viewer.mobile-view:is(:fullscreen,.page-fullscreen) .viewer-footer{overflow:visible;max-height:none}
[hidden]{display:none!important}
body.embedded{margin:0;padding:0}
.watch-account{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:8px;margin-top:12px;color:#aebcd0;font-size:12px}
.watch-account form{display:inline;margin:0}.watch-account button{font-size:12px;padding:4px 8px}
#viewer:is(:fullscreen,.page-fullscreen) .watch-account{display:none}
#share-dialog,#jump-dialog{width:min(460px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow:auto;padding:22px;border:1px solid #35475e;border-radius:12px;background:var(--race-background);color:#f1f5f9;box-shadow:0 12px 60px #0008}
#share-dialog::backdrop,#jump-dialog::backdrop{background:#0009}
/* 2026-10-20: Jump asks for the time in a dialog instead of a footer box. */
#jump-title{margin:0 0 14px;font-size:20px}
#jump-time{width:100%;font-size:22px;text-align:center;font-variant-numeric:tabular-nums}
#jump-status{margin:10px 0 0;color:#fca5a5;font-size:13px}
#jump-status:empty{display:none}
#share-title{margin:0 28px 16px 0;font-size:20px}
#share-close{position:absolute;top:10px;right:10px;width:30px;height:30px;padding:0;font-size:22px;line-height:1}
#share-url{width:100%;font-size:13px}
#share-time-row{display:flex;align-items:center;gap:6px;margin-top:14px;font-size:14px}
#share-time{width:16px;height:16px;margin:0 3px 0 0;accent-color:#71c7fb}
.share-actions{display:flex;gap:8px;margin-top:16px}
#share-status{margin:12px 0 0;font-size:13px;color:#b9c8da}
#share-status:empty{display:none}

/* Dialogs live inside the race frame so they also work in native fullscreen. */
.viewer-dialog{width:min(820px,calc(100vw - 32px));max-height:88vh;max-height:88dvh;padding:0;margin:auto;border:1px solid #52657f;border-radius:16px;background:var(--race-background);color:#f1f5f9;box-shadow:0 24px 80px #0009;overflow:hidden;text-align:left}
.viewer-dialog[open]{display:flex;flex-direction:column}
.viewer-dialog::backdrop{background:#020617a6}
.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 20px;flex:none;border-bottom:1px solid #35475e}
.dialog-heading h2{margin:0;font-size:23px;line-height:1.2}
.dialog-body{padding:18px 20px;overflow:auto;overscroll-behavior:contain;min-height:0}
.dialog-body h3{margin:0 0 10px;font-size:20px;line-height:1.3;overflow-wrap:anywhere}
.dialog-body p{line-height:1.5;color:#b9c8da}
.dialog-close{width:44px;height:44px;flex:none;padding:0;font-size:26px;line-height:1}
.dialog-tabs{display:flex;gap:8px;padding:12px 20px 0;flex:none}
.dialog-tabs button{flex:1;font-weight:750}
.dialog-tabs [aria-selected=true]{background:#245479;border-color:#71c7fb}
.dialog-actions{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 20px;border-top:1px solid #35475e;background:var(--race-background);flex:none}
#viewer :is(#watch-options,#race-details) button{min-height:44px;padding:8px 12px;font-size:15px}
#viewer :is(#watch-options,#race-details) .dialog-close{font-size:26px;padding:0}
#viewer #watch-options .primary-action{min-width:110px;background:#245479;border-color:#71c7fb;font-weight:800}
#watch-options #racer-count{margin:0;color:#dbeafe;font-size:14px}
.selection-help{margin:0 0 14px;font-size:14px}
#watch-options .racer-setting{padding:0;display:block;overflow:hidden}
#watch-options .racer-setting>label{display:flex;width:100%;min-height:72px;padding:14px;gap:12px}
#watch-options .racer-setting input[type=checkbox]{width:22px;height:22px}
.racer-choice{display:flex;flex-direction:column;gap:5px;min-width:0}
#watch-options .racer-choice small{font-size:12px;color:#b9c8da;font-weight:500}
#watch-options .racer-warning{display:block;padding:0 14px 12px}
#watch-options .racer-unavailable{padding:14px;opacity:.65}
#watch-options .racer-unavailable small{display:block;margin-top:5px}
#timing-settings{margin-top:18px;border:1px solid #35475e;border-radius:8px}
#timing-settings>p,#racer-offsets{margin:12px;font-size:13px}
#racer-offsets{display:grid;gap:10px}
#racer-offsets .racer-offset{justify-content:space-between;font-size:14px}
#racer-offsets input{width:88px}
#watch-options #race-search{min-height:44px;font-size:16px}
.race-results{display:grid;gap:8px}
#watch-options .race-day{font-size:14px;color:#b9c8da;margin:16px 0 2px}
#watch-options .race-day:first-child{margin-top:0}
#watch-options .race-choice-card{display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:14px;text-align:left;width:100%;border:1px solid #35475e;border-radius:8px;background:var(--race-control)}
.race-choice-actions{display:flex;flex-wrap:wrap;gap:8px}
#home-coverage,#watch-options #race-coverage{min-height:44px;font-size:16px}
#watch-options #race-coverage{margin-bottom:10px}
.race-choice-card strong{font-size:15px;line-height:1.4;overflow-wrap:anywhere}
.race-choice-card small{color:#b9c8da;font-size:13px}
#race-details{width:min(700px,calc(100vw - 32px))}
#race-details-status:empty{display:none}
#show-results{margin:4px 0 14px}
.race-times{width:100%;border-collapse:collapse;font-size:14px;font-variant-numeric:tabular-nums}
.race-times th,.race-times td{padding:12px 8px;border-bottom:1px solid #35475e;text-align:left}
.race-times th{color:#b9c8da;font-size:12px;text-transform:uppercase;letter-spacing:.04em}
.race-times td:nth-child(2){font-weight:750;overflow-wrap:anywhere}
.race-times td:nth-child(3){white-space:nowrap;color:#f4cf72}
#race-details-updated{font-size:12px;margin-bottom:0}
#race-details-link{color:#f4cf72;padding:8px 0;font-weight:700}
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
@media(max-width:600px){
  .dialog-heading{padding:12px 14px}.dialog-heading h2{font-size:20px}
  .dialog-tabs{padding:10px 14px 0}.dialog-body{padding:14px;flex:1}
  .dialog-actions{padding:12px 14px}
  #watch-options #racers{grid-template-columns:repeat(2,minmax(0,1fr))}
  #watch-options .racer-setting>label{padding:12px 10px;gap:8px;align-items:flex-start}
  .racer-choice strong{font-size:14px}.race-times th,.race-times td{padding:10px 5px;font-size:12px}
}

/* The same two control groups stay in the same order inside and outside fullscreen. */
/* 2026-10-20: each group is as wide as its buttons, and the groups sit as close as the buttons do. */
#viewer .viewer-footer>nav{display:grid;grid-template-columns:auto auto;justify-content:center;gap:8px 6px;margin:8px auto;font-size:14px}
#viewer .viewer-footer .playback-main{display:grid;grid-template-columns:40px 40px auto 150px;gap:6px;min-width:0}
#viewer .viewer-footer .playback-display{display:flex;flex-wrap:nowrap;gap:6px;min-width:0}
#viewer .viewer-footer .playback-display>*{flex:0 0 40px;min-width:0}
#viewer .viewer-footer nav .playback-display>:is(#watch-options-open,#chat-button){flex:1 1 auto;width:auto;padding-inline:10px}
#viewer .viewer-footer nav button,#viewer .viewer-footer nav select,#viewer .viewer-footer nav input{height:40px;min-height:40px;min-width:0;padding:6px;font-size:16px}
#viewer .viewer-footer nav .icon-control,#viewer .viewer-footer #expand{width:100%;padding:0}
#viewer .viewer-footer #expand{font-size:0}
#viewer .viewer-footer #go{grid-column:3;grid-row:1;min-width:0;padding-inline:12px;font-size:14px}
#viewer .viewer-footer #live-edge{grid-column:3;grid-row:1;white-space:nowrap;font-size:13px}
#viewer .viewer-footer .audio-control{grid-column:4;grid-row:1;min-width:0}
#viewer .viewer-footer #audio{width:100%;max-width:100%;text-overflow:ellipsis}
#viewer .viewer-footer :is(#watch-options-open,#chat-button){font-size:14px}
#viewer .viewer-footer .playback-display>button{grid-row:1}
#viewer.restream-mode .viewer-footer>nav{grid-template-columns:minmax(0,280px)}
#viewer.restream-mode .viewer-footer .playback-main{display:none}
/* Wrap the two groups only when their usable widths cannot fit side by side. */
#viewer.mobile-view .viewer-footer>nav{display:flex;flex-wrap:wrap;max-width:646px;gap:6px;margin:6px auto}
#viewer.mobile-view .viewer-footer .playback-main{flex:1 1 300px;max-width:360px;grid-template-columns:40px 40px auto minmax(0,1fr)}
#viewer.mobile-view .viewer-footer .playback-display{flex:1 1 220px;max-width:330px}
#playback-settings{margin-top:18px;border:1px solid #35475e;border-radius:8px}
.playback-preferences{display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:12px}
.playback-preferences>label{display:flex;align-items:center;gap:8px}
#watch-options .playback-preferences select{min-height:44px;font-size:16px}
#watch-options .playback-tools{justify-content:flex-start}
#watch-options .playback-tools button{width:auto;height:auto}
/* Keep official coverage visible without adding a third phone control row. */
#viewer .viewer-footer>nav:has(#coverage-switch:not([hidden])){grid-template-columns:auto auto;max-width:726px}
#viewer.restream-mode .viewer-footer>nav:has(#coverage-switch:not([hidden])){grid-template-columns:minmax(0,360px)}
#viewer .viewer-footer .playback-display:has(#coverage-switch:not([hidden])){gap:4px;flex-basis:300px;max-width:360px}
#viewer .viewer-footer nav .playback-display:has(#coverage-switch:not([hidden]))>*{flex:0 0 40px;padding-inline:0}
#viewer .viewer-footer .playback-display:has(#coverage-switch:not([hidden]))>#coverage-switch{flex:1 1 116px}
#viewer .viewer-footer nav .playback-display:has(#coverage-switch:not([hidden]))>#chat-button{flex:0 0 auto;width:auto;padding-inline:8px}
#viewer .viewer-footer .playback-display:has(#coverage-switch:not([hidden])) .chat-button-label{display:none}
#viewer .viewer-footer #coverage-switch{display:flex;flex-wrap:nowrap;gap:2px;min-width:0}
#viewer .viewer-footer #coverage-switch button{flex:1;min-width:0;padding-inline:4px;font-size:12px;white-space:nowrap}
#viewer .viewer-footer .playback-display:has(#coverage-switch:not([hidden])) #watch-options-open span{display:none}
/* Keep every dialog clear of rounded corners, the notch and the home indicator.
   Only the body scrolls; Close and Apply remain in the visible frame. */
#viewer{--dialog-top:max(24px,env(safe-area-inset-top));--dialog-bottom:max(24px,env(safe-area-inset-bottom));--dialog-left:max(20px,env(safe-area-inset-left));--dialog-right:max(20px,env(safe-area-inset-right))}
#viewer :is(.viewer-dialog,#share-dialog,#jump-dialog){position:fixed;inset:var(--dialog-top) var(--dialog-right) var(--dialog-bottom) var(--dialog-left);width:calc(100vw - var(--dialog-left) - var(--dialog-right));max-width:820px;height:auto;max-height:calc(100vh - var(--dialog-top) - var(--dialog-bottom));max-height:min(82dvh,calc(100dvh - var(--dialog-top) - var(--dialog-bottom)));margin:auto;border-radius:16px}
#viewer #race-details{max-width:700px}
#viewer #share-dialog{max-width:460px}
#viewer #jump-dialog{max-width:340px;height:fit-content}
/* 2026-10-20: race chat. A column beside the players, after the booth v3 chat
   panel: dark navy, an underlined heading, one-line messages with a colored
   name, an amber pinned note. Real time only, so there is no history to page. */
.stage-row{display:flex;align-items:stretch;gap:14px;min-width:0}
.stage-row>#stage{flex:1;min-width:0}
/* 2026-10-20, second pass: the column runs the full window height on the right.
   Docked (wide screens, or pinned) the page narrows beside it; otherwise it lies
   over the page. Its left edge drags to resize. */
.chat-panel{--chat-edge:#26364d;position:fixed;top:0;right:0;bottom:0;z-index:30;width:var(--chat-width,340px);display:flex;flex-direction:column;border-left:1px solid var(--chat-edge);background:#0d1524;overflow:hidden;box-shadow:-12px 0 30px #000a}
.chat-panel.is-docked{box-shadow:none}
:root.chat-docked body{padding-right:var(--chat-width,340px)}
.chat-resize{position:absolute;top:0;bottom:0;left:0;z-index:3;width:7px;cursor:col-resize;touch-action:none}
.chat-resize:is(:hover,:focus-visible),.chat-panel.is-resizing .chat-resize{background:linear-gradient(90deg,#71c7fb 0 2px,transparent 2px);outline:none}
.chat-panel.is-resizing{user-select:none}
.chat-panel[hidden]{display:none}
.chat-head{display:flex;align-items:center;gap:14px;padding:12px 12px 0 16px;border-bottom:1px solid var(--chat-edge)}
.chat-tab{margin:0 0 -1px;padding:0 0 8px;border:0;border-bottom:2px solid transparent;border-radius:0;background:none;color:#8fa3bd;font-size:14px;font-weight:800;cursor:pointer}
.chat-tab[aria-selected="true"]{border-bottom-color:#71c7fb;color:#f8fafc}
.chat-tab:disabled{cursor:default;opacity:.5}
.chat-count{margin-left:4px;color:#8fa3bd;font-size:11px}
.chat-view{display:flex;flex:1;flex-direction:column;min-height:0}
.chat-view[hidden]{display:none}
.watching-summary{margin:10px 12px 0;color:#cbd5e1;font-size:12px;font-weight:700}
.watching-summary[hidden]{display:none}
.watching-list{flex:1;min-height:0;overflow-y:auto;margin:0;padding:8px 6px;list-style:none}
.watching-person button{display:flex;align-items:center;gap:8px;width:100%;padding:6px;border:0;border-radius:6px;background:none;color:#f8fafc;font:inherit;font-size:13.5px;text-align:left;cursor:pointer}
.watching-person button:hover{background:#142239}
.watching-where{margin-left:auto;color:#8fa3bd;font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap}
#watching-now{margin-bottom:28px;padding-bottom:28px;border-bottom:1px solid #26364d}
#watching-now h2{margin:0 0 12px;font-size:20px}
.watching-now-list{display:grid;gap:10px}
.watching-now-race{border-color:#71c7fb}
.watching-faces{display:flex;margin:6px 0}
.watching-faces .chat-avatar{width:24px;height:24px;margin-left:-6px;border:2px solid #142239}
.watching-faces .chat-avatar:first-child{margin-left:0}
.chat-pinned{margin:10px 10px 0;padding:7px 10px;border:1px solid #a16207;border-radius:6px;background:#2b2108;color:#fde68a;font-size:13px;line-height:1.35}
.chat-pinned[hidden],.chat-notice[hidden],.chat-form[hidden]{display:none}
.chat-notice{margin:12px;padding:12px;border:1px solid var(--chat-edge);border-radius:8px;background:#142239;color:#cbd5e1;font-size:13.5px;line-height:1.45}
.chat-notice p{margin:0}
.chat-sign-in{display:inline-block;margin-top:10px;padding:7px 12px;border-radius:6px;background:#5865f2;color:#fff;font-weight:700;text-decoration:none}
.chat-messages{flex:1;min-height:0;overflow-y:auto;margin:0;padding:8px 12px;list-style:none;display:flex;flex-direction:column;gap:7px;font-size:13.5px;line-height:1.35;overflow-wrap:anywhere}
.chat-message{display:flex;gap:8px;align-items:flex-start}
.chat-avatar{flex:none;width:20px;height:20px;border-radius:50%;background:#334155 center/cover no-repeat}
.chat-body{min-width:0}
.chat-tag{display:inline-block;margin-right:4px;padding:1px 5px;border-radius:4px;font-size:10px;font-weight:800;letter-spacing:.03em;vertical-align:1px}
.chat-tag-racer,.chat-tag-racer-finished{border:1px solid #2f6b55;background:#123b2e;color:#a5f0c9}
.chat-tag-mod{border:1px solid #3b5f8f;background:#1e2f4d;color:#bfdbfe}
/* 2026-10-20: moderators carry a shield; emoji, including the server's own. */
.chat-mod-badge{display:inline-block;width:13px;height:14px;margin-right:4px;vertical-align:-2px;background:#93c5fd;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 22'%3E%3Cpath d='M10 0 1 3.6v6.2C1 15.6 4.8 20 10 22c5.2-2 9-6.4 9-12.2V3.6z'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 22'%3E%3Cpath d='M10 0 1 3.6v6.2C1 15.6 4.8 20 10 22c5.2-2 9-6.4 9-12.2V3.6z'/%3E%3C/svg%3E") center/contain no-repeat}
.chat-emoji{width:22px;height:22px;object-fit:contain;vertical-align:-6px}
.chat-emoji-picker{display:flex;flex-direction:column;gap:6px;max-height:min(260px,40vh);margin:8px 10px 0;padding:8px;border:1px solid var(--chat-edge);border-radius:8px;background:#0f1a2c}
.chat-emoji-picker[hidden]{display:none}
.chat-emoji-picker input{padding:6px 8px;font-size:13px}
.chat-emoji-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(34px,1fr));gap:2px;min-height:0;overflow-y:auto}
.chat-emoji-grid button{height:34px;padding:0;border:0;border-radius:6px;background:none;font-size:20px;line-height:1}
.chat-emoji-grid button:is(:hover,:focus-visible){background:#1d2b44}
.chat-emoji-grid img{width:26px;height:26px;object-fit:contain;vertical-align:middle}
.chat-emoji-heading{grid-column:1/-1;margin:4px 2px 0;color:#8fa3bd;font-size:11px;font-weight:700}
.chat-time{margin-left:6px;padding:0 4px;border:0;border-radius:4px;background:#182b46;color:#b9c8da;font:inherit;font-size:12px;font-variant-numeric:tabular-nums;cursor:pointer}
.chat-time:disabled{cursor:default;opacity:.7}
.chat-reveal{margin-left:6px;padding:0;border:0;background:none;color:#8fa3bd;font:inherit;font-style:italic;cursor:pointer;text-decoration:underline dotted}
.chat-removed{color:#8fa3bd;font-style:italic}
.chat-form{display:flex;gap:6px;margin:8px 10px 0}
.chat-form input{flex:1;min-width:0;padding:9px 11px;border:1px solid var(--chat-edge);border-radius:6px;background:#142239;color:#f8fafc}
.chat-form button{flex:none;width:40px}
.chat-form .chat-emoji-button{font-size:18px;line-height:1}
.chat-feedback{min-height:1em;margin:4px 12px 0;color:#fca5a5;font-size:12px}
.chat-hint{margin:2px 12px 10px;color:#8fa3bd;font-size:11.5px}
#chat-toggle[aria-pressed="false"]{opacity:.65}
.chat-message{position:relative}
.chat-mod{margin-left:auto;flex:none}
.chat-mod summary{display:block;list-style:none;margin:0;padding:0 6px;border:0;border-radius:4px;background:none;color:#8fa3bd;font-size:15px;line-height:1.2;cursor:pointer}
.chat-mod summary::marker,.chat-mod summary::before,.chat-mod summary::after{content:none;display:none}
.chat-mod summary::-webkit-details-marker{display:none}
.chat-mod[open]>summary{border:0;background:#182b46;color:#f8fafc}
.chat-mod-actions{position:absolute;right:0;z-index:2;display:grid;gap:2px;min-width:150px;padding:4px;border:1px solid #35475e;border-radius:8px;background:#101827;box-shadow:0 8px 24px #000a}
.chat-mod-actions button{padding:6px 8px;border:0;background:none;text-align:left;font-size:13px}
.chat-mod-actions button:hover{background:#182b46}
.chat-pin-form{display:flex;gap:6px;margin:8px 10px 0}
.chat-pin-form[hidden]{display:none}
.chat-pin-form input{flex:1;min-width:0;padding:6px 8px;font-size:12.5px}
.chat-pin-form button{padding:6px 8px;font-size:12.5px}
#viewer:is(:fullscreen,.page-fullscreen) .stage-row{display:contents}
/* Full screen: chat lies over the race inside the frame; the videos never move. */
#viewer:is(:fullscreen,.page-fullscreen) .chat-panel{position:absolute;top:0;right:0;bottom:0;left:auto;z-index:40;width:min(var(--chat-width,340px),46vw)}
#viewer:is(:fullscreen,.page-fullscreen) #chat-pin-panel{display:none}
/* With room to spare, full screen makes room for chat instead of covering the race. */
#viewer.chat-beside:is(:fullscreen,.page-fullscreen){padding-right:calc(var(--chat-width,340px) + 20px)}
#viewer.chat-beside:is(:fullscreen,.page-fullscreen) .chat-panel{width:var(--chat-width,340px);box-shadow:none}
#chat-mod-view[aria-pressed="true"]{border-color:#71c7fb;background:#1d3d5e}
.chat-head-tools{margin-left:auto;display:flex;gap:4px;padding-bottom:6px}
.chat-head-button{width:26px;height:26px;padding:0;font-size:13px;line-height:1}
#chat-pin-panel{display:inline-flex;align-items:center;justify-content:center}
#chat-pin-panel[aria-pressed="true"]{border-color:#71c7fb;background:#1d3d5e}
.chat-panel.is-collapsed{display:none}
.playback-group .chat-button{position:relative;gap:6px;padding:0 9px}
.chat-watchers{min-width:18px;padding:0 5px;border-radius:9px;background:#26364d;color:#cbd5e1;font-size:12px;font-weight:800;line-height:18px;text-align:center}
.chat-watchers.is-empty{visibility:hidden}
.chat-unread{position:absolute;top:-6px;right:-6px;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:#ef4444;color:#fff;font-size:11px;font-weight:800;line-height:18px;text-align:center}
.chat-unread[hidden]{display:none}
/* Phone: a sheet over the lower part of the screen. */
@media(max-width:600px){
  #chat-pin-panel,.chat-resize{display:none}
  .chat-panel{top:16dvh;left:0;width:auto;border-left:0;border-top:1px solid var(--chat-edge);border-radius:14px 14px 0 0;box-shadow:0 -12px 30px #000a}
  #viewer:is(:fullscreen,.page-fullscreen) .chat-panel{top:auto;left:0;width:auto;height:58%}
}
/* A phone on its side: a narrower column, so the race stays in view. */
@media(max-height:500px) and (orientation:landscape){
  .chat-resize{display:none}
  #viewer:is(:fullscreen,.page-fullscreen) .chat-panel{width:min(300px,42vw)}
}
