/* The big screen (engine/tv/): TV mode, the stage, the start button, the banner and the phone
   remote. Layout only: colors and type come from the theme (its variables, with the browser's
   own colors as a fallback), and the scenes reuse the theme's own card, race, note and name
   styles. No colors are set here. */

/* ---- TV mode: just the theme's header (.hero), full screen, with the stage on top ---- */
html[data-tv], html[data-tv] body{overflow:hidden; height:100%}
html[data-tv] body > :not(.hero):not(#tv):not(svg){display:none !important}
html[data-tv] .hero{position:fixed; inset:0; width:100%; height:100%; min-height:0; margin:0; z-index:0}
html[data-tv] .hero > :not(canvas):not([aria-hidden="true"]){display:none !important}
html[data-tv][data-flat] body > .hero{display:none}
html:not([data-flat]) .tv-flat{display:none}
.tv-flat{position:fixed; inset:0; z-index:0}
.tv-flat .hero [aria-hidden="true"]{opacity:1 !important}

#tv{position:fixed; inset:0; z-index:5; cursor:none}
#tv.tv-awake{cursor:auto}
.tv-stage{position:absolute; left:50%; top:50%; width:1920px; height:1080px; transform-origin:50% 50%}
.tv-in{animation:tv-in .7s ease both}
.tv-out{animation:tv-out .7s ease both}
@keyframes tv-in{from{opacity:0; transform:translateY(14px)}}
@keyframes tv-out{to{opacity:0}}
/* on-screen.js: Exit, and the dark bar at the foot, sized by the screen's height (a TV browser may say 960x540) */
#tv{touch-action:none; --tv-h:clamp(48px, 8.9vh, 96px); --tv-f:clamp(17px, 3.5vh, 38px)}
.tv-exit, .tv-dock, .tv-hint, .tv-turn{opacity:0; transition:opacity .3s; pointer-events:none}
#tv.tv-awake :is(.tv-exit, .tv-dock, .tv-hint){opacity:1; pointer-events:auto}
#tv .tv-exit{position:absolute; top:max(14px, 4.4vh); right:max(14px, 2.5vw); display:flex; align-items:center; gap:.4em; height:calc(var(--tv-h) * .8);
  margin:0; padding:0 1.1em 0 .8em; border:0; border-radius:999px; font:400 calc(var(--tv-f) * .9)/1 var(--f-caps); letter-spacing:.14em; text-transform:uppercase;
  color:var(--paper); background:color-mix(in srgb, var(--ink-deep, var(--ink)) 92%, transparent); box-shadow:0 14px 30px -14px var(--shadow, CanvasText); z-index:4}
.tv-icon{width:1.05em; height:1.05em; flex:none; fill:none; stroke:currentColor; stroke-width:2.4; stroke-linecap:round; stroke-linejoin:round}
.tv-bar{position:absolute; left:50%; bottom:max(14px, 5vh, env(safe-area-inset-bottom)); transform:translateX(-50%); display:flex; flex-direction:column; align-items:center;
  gap:max(10px, 2vh); max-width:calc(100% - 28px); z-index:4; pointer-events:none}
.tv-dock{display:flex; align-items:center; gap:.3em; padding:.28em; border-radius:999px; font:400 var(--tv-f)/1 var(--f-caps); letter-spacing:.14em; text-transform:uppercase;
  background:color-mix(in srgb, var(--ink-deep, var(--ink)) 92%, transparent); box-shadow:0 20px 50px -18px var(--shadow, CanvasText)}
.tv-dock button{display:inline-flex; align-items:center; justify-content:center; gap:.4em; height:var(--tv-h); margin:0; padding:0 1em; border:0; border-radius:999px;
  font:inherit; letter-spacing:inherit; text-transform:inherit; white-space:nowrap; color:var(--paper); background:none; cursor:pointer}
.tv-dock button[aria-pressed="true"]{background:var(--paper); color:var(--ink)}
.tv-dock button:focus-visible{outline:none; box-shadow:0 0 0 .14em var(--wash, var(--paper))}
.tv-dock .tv-arrow{width:1.05em; height:1.05em; flex:none; fill:none; stroke:currentColor; stroke-width:2.6; stroke-linecap:round; stroke-linejoin:round}
.tv-rule{width:2px; height:calc(var(--tv-h) * .55); background:color-mix(in srgb, var(--paper) 25%, transparent)}
.tv-hint{margin:0; padding:.45em 1em; border-radius:999px; font:400 calc(var(--tv-f) * .8)/1 var(--f-caps); letter-spacing:.14em; text-transform:uppercase;
  background:color-mix(in srgb, var(--card, var(--paper)) 94%, transparent); color:var(--ink); box-shadow:0 8px 24px -10px var(--shadow, CanvasText)}
#tv:not(.tv-touch) .tv-hint, #tv.tv-touch :is(.tv-dock-step, .tv-rule){display:none}
/* the join card steps aside while the bar is up */
#tv.tv-awake :is(.tv-join, .tv-made){opacity:0}
/* a phone held upright as the TV: turn it sideways */
.tv-turn{position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); margin:0; padding:.6em 1.2em; border-radius:999px; font:400 20px/1.2 var(--f-caps); letter-spacing:.12em;
  text-transform:uppercase; white-space:nowrap; color:var(--paper); background:color-mix(in srgb, var(--ink-deep, var(--ink)) 92%, transparent); z-index:6}
@media (orientation:portrait) and (max-width:700px){ #tv .tv-turn{opacity:1} }
/* "Press OK to fill the screen" (mode.js fillPrompt): the theme's own card, drawn round the remote's OK, pressed with OK */
#tv .tv-fill{position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); display:flex; flex-direction:column; align-items:center; width:min(45vw, 860px);
  margin:0; padding:clamp(20px, 6vh, 70px) clamp(20px, 3.6vw, 70px); text-align:center; font-family:var(--f-body); color:var(--ink); cursor:pointer; z-index:5}
#tv .tv-fill:focus-visible{outline:none}
.tv-ok{position:relative; display:grid; place-items:center; width:clamp(90px, 21vh, 230px); aspect-ratio:1; margin:0 0 clamp(12px, 3vh, 34px); border-radius:50%;
  border:clamp(3px, .55vh, 6px) solid var(--ink); box-sizing:border-box}
.tv-ok::before{content:""; position:absolute; inset:-12%; border-radius:50%; border:clamp(3px, .5vh, 5px) solid var(--accent, var(--ink)); opacity:.55; animation:tv-pulse 1.6s ease-in-out infinite}
.tv-ok b{display:grid; place-items:center; width:52%; aspect-ratio:1; border-radius:50%; background:var(--ink); color:var(--card, var(--paper)); font:400 clamp(24px, 5vh, 54px)/1 var(--f-caps); letter-spacing:.06em}
.tv-ok i{position:absolute; width:0; height:0; border:clamp(6px, 1.3vh, 14px) solid transparent}
.tv-ok .tv-ok-up{top:6%; border-bottom-color:var(--ink); border-top:0}
.tv-ok .tv-ok-down{bottom:6%; border-top-color:var(--ink); border-bottom:0}
.tv-ok .tv-ok-left{left:6%; border-right-color:var(--ink); border-left:0}
.tv-ok .tv-ok-right{right:6%; border-left-color:var(--ink); border-right:0}
.tv-fill-big{font-size:clamp(44px, 12vh, 130px); line-height:1}
.tv-fill-small{margin-top:.4em; font-size:clamp(18px, 4vh, 44px); color:var(--soft, var(--ink))}
/* its paper and shadow only as a fallback: a theme that frames its cards keeps its own edges */
:where(#tv) > .tv-fill{background:var(--card, var(--paper, Canvas)); box-shadow:0 16px 40px -18px var(--shadow, CanvasText)}
@keyframes tv-pulse{50%{transform:scale(1.06); opacity:.25}}

/* ---- start button (TV browsers) and banner (laptops near party day) ---- */
.tv-prompt{position:fixed; inset:0; z-index:50; display:grid; place-items:center; padding:20px; background:var(--paper, Canvas)}
.tv-prompt .card{max-width:640px; text-align:center; font-size:24px}
.tv-prompt .btn{display:block; width:100%; min-height:64px; margin:14px 0 0; font-size:26px}
.tv-banner{position:sticky; top:0; z-index:40; display:flex; gap:12px; align-items:center; justify-content:center; flex-wrap:wrap;
  padding:8px 14px; font-size:17px; background:var(--paper, Canvas); border-bottom:1px solid}
.tv-banner .btn{min-height:44px; margin:0}

/* ---- the phone remote ---- */
.tv-sheet-back{position:fixed; inset:0; z-index:60; display:flex; align-items:flex-end; justify-content:center}
.tv-dim{position:absolute; inset:0; background:color-mix(in srgb, var(--ink, CanvasText) 35%, transparent)}
.tv-sheet{position:relative; width:100%; max-width:520px; max-height:92vh; max-height:92dvh; overflow:auto; overscroll-behavior:contain; margin:0; padding:22px 20px 28px;
  border-radius:16px 16px 0 0; background:var(--paper, Canvas); font-size:17px}
/* the one shadow every drawer casts up from its top (base.css), past a theme's own card shadow */
.tv-sheet-back .tv-sheet{box-shadow:var(--drawer-up)}
/* its grabber (a drag from it, the title or the top of the sheet pulls it down: engine/drawer.js), pinned to the
   sheet's top middle so no theme's padding can move it, and a bigger box than it looks, to grab */
.tv-sheet-back .tv-sheet .tv-grab{display:block; position:absolute; top:0; left:50%; z-index:3; width:88px; height:26px; margin:0; padding:0; translate:-50% 0; touch-action:none}
.tv-sheet-back .tv-sheet .tv-grab::before{content:""; position:absolute; top:8px; left:24px; width:40px; height:5px; border-radius:3px; background:color-mix(in srgb, var(--ink, CanvasText) 22%, transparent)}
.tv-sheet > .sec-title{touch-action:none; font-size:clamp(34px, 10vw, 50px); padding:0 48px; overflow-wrap:anywhere}
/* one TV's steps (put/route-view.js): its name is the title, with "All TVs" at the top left */
.tv-sheet.put-sub > .sec-title{margin-top:30px}
.tv-sheet.put-sub .put-route > .put-back{position:absolute; top:12px; left:10px; z-index:3}
@media (min-width:700px){ .tv-sheet-back{align-items:center} .tv-sheet{border-radius:16px} .tv-sheet-back .tv-sheet{box-shadow:var(--drawer-box)} .tv-sheet-back .tv-sheet .tv-grab{display:none} }
/* the × drawn like the alerts sheet's (push.css): a theme's button font, size or capitals can't change it */
.tv-sheet-back .tv-sheet .tv-x{position:absolute; top:10px; right:10px; width:44px; height:44px; min-width:44px; min-height:44px; margin:0; padding:0;
  border-radius:50%; font-size:0; letter-spacing:0; line-height:0; color:var(--ink); overflow:hidden;
  z-index:3; background:var(--card, Canvas); box-shadow:0 1px 4px color-mix(in srgb, var(--ink) 18%, transparent)}
.tv-sheet-back .tv-sheet .tv-x::before,.tv-sheet-back .tv-sheet .tv-x::after{content:""; position:absolute; top:50%; left:50%; width:18px; height:2px;
  border-radius:1px; background:currentColor; transform:translate(-50%,-50%) rotate(45deg)}
.tv-sheet-back .tv-sheet .tv-x::after{transform:translate(-50%,-50%) rotate(-45deg)}
.tv-sheet .lede{font-size:17px}
.tv-sheet h3{margin:6px 0 2px}

@media (prefers-reduced-motion: reduce){ .tv-in, .tv-out{animation:none} }
