/* Colours come from the theme file (assets/css/themes/default.css, linked in templates/page.php).
   Soft tints and glows are derived from the theme's main colours below, so they follow any theme. */
:root {
    --heads-soft: color-mix(in srgb, var(--heads) 14%, transparent);
    --tails-soft: color-mix(in srgb, var(--tails) 14%, transparent);
    --font-display: 'Oswald', sans-serif;
    --font-body: 'Inter', sans-serif;
    /* Card/coin sizes: desktop values unchanged, scaled down on narrow phones so the versus layout fits */
    --poster-w: 190px;
    --poster-h: calc(var(--poster-w) * 1.5);
    --coin-size: 210px;
    --carousel-w: 190px;
    --carousel-h: calc(var(--carousel-w) * 280 / 190);
    /* Star with softly rounded points (round-joined stroke keeps it crisp at ~11px) */
    --star-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-1.5 -1.5 27 27'%3E%3Cpath d='M12 2.6l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5L12 17.4l-5.8 3.1 1.1-6.5L2.6 9.4l6.5-.9z' fill='black' stroke='black' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/svg%3E");
}
@media (max-width: 479.98px) {
    :root {
        --poster-w: min(190px, 40vw);
        --coin-size: min(210px, 42vw);
        --carousel-w: min(190px, 40vw);
    }
}
/* Mode accent: Shuffle uses the theme's shuffle accent, 1v1 (body.mode-1v1) the 1v1 accent */
body.mode-1v1 {
    --accent: var(--accent-1v1);
    --accent-ink: var(--accent-1v1-ink);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* Room for the tab bar: across the top on every screen (under the phone's status bar), a playing game included. Nothing
   sits along the bottom, so the page keeps clear of the home indicator itself (--page-safe-bottom). */
:root {
    --tabbar-h: 56px;
    --tab-top: var(--tabbar-h);
    --live-strip-h: 34px; /* the Live strip under the tab bar on phones */
    --tab-bottom: 0px;
    --page-safe-bottom: env(safe-area-inset-bottom, 0px);
}
/* The page scrolls (body's overflow passes to it): anything scrolled or tabbed to stays clear of the tab bar */
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + var(--tab-top)); scroll-padding-bottom: calc(var(--tab-bottom) + 8px); }
body {
    --accent: var(--accent-shuffle);
    --accent-ink: var(--accent-shuffle-ink);
    --accent-dim: color-mix(in srgb, var(--accent) 14%, transparent);
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: auto;
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--tab-top));
}

.container {
    display: flex; flex-direction: column; align-items: center;
    width: 100%; min-height: 100vh;
    padding-bottom: calc(var(--tab-bottom) + var(--page-safe-bottom)); /* after the content, which can run past body's 100vh */
}
.main-panel {
    background: var(--bg); padding: 3rem 1.25rem 1rem;
    display: flex; flex-direction: column; align-items: center;
    width: 100%; max-width: 800px; flex: none;
}
/* The commit the page came from (app_build()), under everything: a deploy is checked at a glance */
.app-build { margin-top: auto; padding: 1rem 1.25rem .5rem; font-size: .7rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.history-panel {
    flex: none; width: 100%; max-width: 480px;
    background: transparent; padding: 1rem 1.25rem 3rem;
    border-top: 1px solid var(--border); margin-top: 1rem;
    display: none;
}

/* Keyboard focus is always visible */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="text"]:focus-visible, input[type="password"]:focus-visible { outline: none; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

h1 {
    font-family: var(--font-display); font-size: 2.1rem; font-weight: 600;
    letter-spacing: 0.01em; color: var(--text); margin-bottom: 0.4rem;
}
.subhead { color: var(--text-dim); font-size: 0.95rem; margin-bottom: 2rem; }
h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; color: var(--text); text-align: center; }
h3 { font-family: var(--font-display); font-weight: 500; }
label { display: block; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.4rem; font-weight: 500; }

.toggle-group { display: flex; gap: 8px; margin: 0 0 1.5rem 0; width: 100%; }
/* The active tint grows out from the middle of the new button while the old one shrinks away, so the highlight
   reads as moving across. (A real sliding indicator breaks on rows that wrap and on Sudden Death's disabled row.) */
.toggle-btn {
    flex: 1; border: 1px solid var(--border);
    /* one image layer (the colour set apart), so background-size can animate */
    background: linear-gradient(var(--toggle-tint, var(--accent-dim)), var(--toggle-tint, var(--accent-dim))) center / 0% 100% no-repeat;
    background-color: var(--surface-2);
    color: var(--text-dim); padding: 10px; border-radius: 6px; font-size: 0.9rem;
    font-family: var(--font-body); cursor: pointer; font-weight: 500;
    transition: border-color 0.25s, color 0.25s, background-color 0.25s, background-size 0.3s cubic-bezier(0.25, 1, 0.5, 1), transform 0.1s;
}
.toggle-btn.active { background-color: transparent; background-size: 100% 100%; border-color: var(--accent); color: var(--accent); }
.toggle-btn:hover:not(.active) { border-color: var(--border-hover); color: var(--text); }

button.action-btn {
    background: var(--accent); color: var(--accent-ink);
    border: none; padding: 12px 20px; font-size: 0.95rem; font-weight: 600;
    font-family: var(--font-body); cursor: pointer; border-radius: 6px; margin-top: 6px;
    transition: filter 0.15s, transform 0.1s, background 0.25s, color 0.25s;
}
button.action-btn:hover { filter: brightness(1.08); }
button.action-btn:active { transform: translateY(1px); }
/* Small buttons press in slightly too */
.toggle-btn:active:not(:disabled), .sort-dir:active, .sort-menu-btn:active, .history-play:active,
.match-log-close:active, .match-log-page-btn:active:not(:disabled), .match-log-retry:active { transform: scale(0.96); }
button.action-btn:active:not(:disabled) { transform: translateY(1px) scale(0.98); }
/* Setup screen buttons and messages */
button.action-btn.btn-wide { width: 100%; }
button.action-btn.btn-start { font-size: 1.05rem; }
button.action-btn.btn-secondary { margin-top: 10px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
button.action-btn.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); margin-top: 0; padding: 6px 12px; }
.form-error { display: none; color: var(--error-text); margin-bottom: 14px; font-weight: 500; font-size: 0.9rem; text-align: center; }
.svg-defs { position: absolute; }

/* Shown by the app when needed (JS sets their display) */
#carousel-target-frame, #btn-start-flips, #intro-layer { display: none; }
button.action-btn#btn-begin-shuffle { margin-top: 1rem; width: 100%; max-width: 300px; display: none; }
#pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; width: 100%; }

button.action-btn:disabled { background: var(--surface-2); color: var(--text-dim); cursor: not-allowed; }

input[type="text"], input[type="password"], input[type="number"] {
    width: 100%; padding: 10px 12px; margin: 0 0 1rem 0;
    background: var(--surface-2); color: var(--text); font-family: var(--font-body);
    border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem;
}
input[type="text"]::placeholder, input[type="password"]::placeholder { color: var(--text-placeholder); }
input[type="text"]:focus, input[type="password"]:focus { outline: none; border-color: var(--accent); }
input[type="range"] {
    width: 100%; margin: 10px 0 1.5rem 0; accent-color: var(--accent); cursor: pointer;
}

.view { display: none; flex-direction: column; align-items: center; justify-content: center; width: 100%; max-width: 480px; text-align: center; }
/* Screens fade in (opacity only: a transform would move the fixed Library layout and the coin's 3D) */
.view.active { display: flex; animation: view-in 0.2s ease-out; }
@keyframes view-in { from { opacity: 0; } to { opacity: 1; } }

#staging-view { max-width: 100%; position: relative; } /* the parked Heads/Tails posters sit over the strip's edges */
/* The staging line ("Waiting for Keath…", "Picking the first movie…"); no heading above it (11-18) */
.staging-heading { position: relative; width: 100%; }
.staging-status {
    margin: 0; min-height: 2.2rem; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; color: var(--text);
}
.staging-status:empty { min-height: 0; }
#carousel-container {
position: relative;
width: 100%;
max-width: 800px;
height: calc(var(--carousel-h) + 64px);
overflow: hidden;
margin: 1.5rem auto;
display: flex;
align-items: center;
-webkit-mask-image: linear-gradient(to right, transparent 0%, black 20%, black 80%, transparent 100%);
mask-image: linear-gradient(to right, transparent 0%, black 20%, black 80%, transparent 100%);
}
#carousel-track {
display: flex;
gap: 20px;
position: absolute;
left: 0;
z-index: 1;
}
.carousel-item {
    width: var(--carousel-w);
    height: var(--carousel-h);
    background: var(--surface-2);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 500;
    border: 2px solid var(--border);
    border-radius: 10px;
    text-align: center;
    padding: 10px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    transition: transform 0.4s ease, filter 0.4s ease, border-color 0.4s ease;
    filter: brightness(0.4);
}
.carousel-item.highlight {
    transform: scale(1.14);
    filter: brightness(1);
    border-color: var(--text);
    box-shadow: 0 8px 28px color-mix(in srgb, var(--shadow) 60%, transparent);
}

/* The cover under the middle marker during a spin: lights up fast, fades back slowly */
.carousel-item.passing { transform: scale(1.06); filter: brightness(0.85); transition: transform 0.08s, filter 0.08s, border-color 0.4s; }
.carousel-item.highlight.landed { animation: land-pop 0.55s cubic-bezier(0.3, 1.5, 0.5, 1); }
@keyframes land-pop {
    0% { transform: scale(1.14); }
    40% { transform: scale(1.22); }
    100% { transform: scale(1.14); }
}

/* A drafted poster parked over the strip's faded edge (shuffle.js parkLanded): both in one neutral white border (11-16) */
.carousel-item.parked {
    position: absolute; z-index: 5; margin: 0; pointer-events: none; transform-origin: 0 0;
    width: calc(var(--carousel-w) * 0.55); height: calc(var(--carousel-h) * 0.55);
    font-size: 0.75rem; padding: 6px; filter: none; transition: none;
}
.carousel-item.parked.heads, .carousel-item.parked.tails { border-color: var(--text); box-shadow: 0 4px 16px color-mix(in srgb, var(--shadow) 60%, transparent); }
.carousel-item.parked-gap { visibility: hidden; }

@property --spin-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes spin-border { to { --spin-angle: 360deg; } }

.hollow-spin-border {
    position: absolute;
    width: var(--carousel-w);
    height: var(--carousel-h);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(1.08);
    border-radius: 10px;
    z-index: 10;
    pointer-events: none;
}
.hollow-spin-border::before {
    content: ""; position: absolute; inset: -4px; border-radius: 14px; z-index: 10;
    background: conic-gradient(from var(--spin-angle), var(--spin-1), var(--spin-2), var(--spin-1));
    animation: spin-border 2.4s linear infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 4px;
}

/* Three columns with equal sides, so the format in the middle sits at the exact centre whatever the titles */
.scoreboard {
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; width: 100%;
    background: var(--surface); padding: 0.75rem 1.25rem; border-radius: 10px; margin-bottom: 2rem;
    border: 1px solid var(--border); position: relative;
}

/* "How we got here..": small link under Decide For Me / the Replay bar (shuffle games, when idle) */
.got-here-link {
    display: block; margin: 12px auto 0; padding: 4px 6px; background: none; border: 0; cursor: pointer; white-space: nowrap;
    font-family: var(--font-body); font-size: 0.64rem; color: var(--text-dim);
    text-decoration: none; transition: color 0.15s;
}
.got-here-link:hover, .got-here-link:focus-visible, .got-here-link[aria-expanded="true"] { color: var(--accent); }

/* Middle of the scoreboard: the series format, centred level with the scores.
   Skips the name row (1.5rem line + 2px gap) above, and the gold-circle row (8px + 3px) below in a series */
.score-middle {
    align-self: stretch; display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: calc(1.5rem + 2px) 6px 0;
}
.score-format {
    display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
    font-family: var(--font-display); font-size: 0.8rem; font-weight: 500; line-height: 1.2;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim);
}
/* "Best of" / "flips" small, their numbers big and white (not Heads' green or Tails' pink). The line's own left padding
   matches the letter spacing that trails its last letter, so each line's ink sits on the scoreboard's centre */
/* MUTUALLY AGREED (a one-title Movie Night, 1-1): heads' colour running into tails' */
.score-format .format-agreed {
    display: flex; flex-direction: column; align-items: center; font-size: 1.05rem; font-weight: 600; color: var(--heads);
    background: linear-gradient(90deg, var(--heads), var(--tails)); -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
/* SUDDEN DEATH: gold, a shimmer that sweeps through the letters and little stars twinkling around it.
   During the flip (.calm) both fade out, leaving a steady soft glow. */
.score-format .format-sudden {
    position: relative; display: inline-block; color: var(--gold); font-weight: 600;
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--gold) calc(35% * var(--glow)), transparent));
}
.sd-shine {
    position: absolute; inset: 0; color: transparent; pointer-events: none;
    background: linear-gradient(100deg, transparent 38%, var(--medal-2) 50%, transparent 62%) no-repeat;
    background-size: 300% 100%; -webkit-background-clip: text; background-clip: text;
    animation: sudden-shimmer 3s ease-in-out infinite; transition: opacity 0.4s;
}
@keyframes sudden-shimmer { 0% { background-position: 100% 0; } 55%, 100% { background-position: 0% 0; } }
.sd-sparkles { position: absolute; inset: -9px -16px; pointer-events: none; transition: opacity 0.4s; }
.sd-sparkles i {
    position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; opacity: 0; background: var(--medal-2);
    clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
    animation: sparkle-twinkle 1.8s ease-in-out infinite;
}
@keyframes sparkle-twinkle {
    0%, 100% { opacity: 0; transform: scale(0.2) rotate(0deg); }
    50% { opacity: 1; transform: scale(1) rotate(45deg); }
}
.score-format.calm .sd-shine, .score-format.calm .sd-sparkles { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .sd-shine, .sd-sparkles { display: none; } }
.got-here-link[hidden] { display: none; }

/* The panel slides open under the link with smaller versions of every option's cover */
.got-here-panel {
    width: 100%; display: grid; grid-template-rows: 0fr; opacity: 0; margin: 0;
    transition: grid-template-rows 0.3s ease, opacity 0.25s ease, margin 0.3s ease;
}
.got-here-panel.open { grid-template-rows: 1fr; opacity: 1; margin: 10px 0 0; }
.got-here-inner { overflow: hidden; min-height: 0; }
.got-here-grid {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 10px;
    padding: 14px 12px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.got-here-item { position: relative; flex: none; width: 60px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.got-here-thumb {
    width: 60px; height: 90px; border-radius: 6px; overflow: hidden; padding: 4px;
    background: var(--surface-2) center / cover no-repeat; border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; text-align: center;
    font-size: 0.6rem; color: var(--text);
}
.got-here-thumb.no-cover { gap: 2px; }
.got-here-thumb.no-cover::before { font-size: 1rem; }
.got-here-item.not-drafted .got-here-thumb { opacity: 0.45; filter: grayscale(0.4); }
.got-here-item:has(.got-here-tag.heads) .got-here-thumb { border-color: var(--heads); }
.got-here-item:has(.got-here-tag.tails) .got-here-thumb { border-color: var(--tails); }
.got-here-tag {
    position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
    padding: 1px 6px; border-radius: 8px; font-size: 0.55rem; font-weight: 700; white-space: nowrap;
}
.got-here-tag.heads { background: var(--heads); color: var(--heads-ink); }
.got-here-tag.tails { background: var(--tails); color: var(--tails-tag-text); }
.got-here-title {
    width: 100%; font-size: 0.6rem; color: var(--text-dim); text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.got-here-item.not-drafted .got-here-title { opacity: 0.6; }
/* Phones: more than 6 options become one row you swipe sideways, with a fade hinting at more */
@media (max-width: 600px) {
    .got-here-grid.many {
        flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scroll-snap-type: x proximity;
        -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
        mask-image: linear-gradient(to right, #000 85%, transparent);
    }
    .got-here-grid.many .got-here-item { scroll-snap-align: start; }
}
.score-box { text-align: center; min-width: 0; padding: 0 10px; }
.score-box h3 {
    color: var(--text); font-size: 1rem; line-height: 1.5rem; margin-bottom: 6px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;
}
.score-box .score { font-family: var(--font-display); font-size: 2.2rem; line-height: 1.2; font-weight: 600; }
#heads-score { color: var(--heads); text-shadow: 0 0 14px color-mix(in srgb, var(--heads) calc(35% * var(--glow)), transparent); }
#tails-score { color: var(--tails); text-shadow: 0 0 14px color-mix(in srgb, var(--tails) calc(35% * var(--glow)), transparent); }

/* Intro Swap-and-Drop Illusion */
.intro-layer {
    position: relative; height: var(--poster-h); width: 100%; margin: 1rem auto 2rem;
    /* Same outer box as .flip-container (3px padding), so nothing jumps at the intro -> flipper swap */
    box-sizing: content-box; padding: 3px;
    perspective: 1000px; /* depth for the flip into place */
}
.intro-face {
    position: absolute; left: 50%; top: 50%;
    background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 500; font-size: 1.1rem; text-align: center; padding: 12px;
    background-color: var(--surface-2); color: var(--text); text-shadow: 0 1px 3px color-mix(in srgb, var(--shadow) 70%, transparent); box-shadow: inset 0 0 24px color-mix(in srgb, var(--shadow) 50%, transparent);
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    backface-visibility: hidden;
}
.intro-layer.poster-mode .intro-face { width: var(--poster-w); height: var(--poster-h); border-radius: 10px; }
.intro-layer.coin-mode .intro-face { width: var(--coin-size); height: var(--coin-size); border-radius: 50%; }

/* Side-by-side offsets scale with the card size (120px / 130px at desktop size) */
.heads-intro { transform: translate(calc(-50% - var(--poster-w) * 120 / 190), -50%); z-index: 2; }
.tails-intro { transform: translate(calc(-50% + var(--poster-w) * 120 / 190), -50%); z-index: 1; }
.intro-layer.coin-mode .heads-intro { transform: translate(calc(-50% - var(--coin-size) * 130 / 210), -50%); }
.intro-layer.coin-mode .tails-intro { transform: translate(calc(-50% + var(--coin-size) * 130 / 210), -50%); }

/* Merge: both flip horizontally into the middle and stack like the game card (Heads face-up, Tails on the back) */
.intro-layer.merge-in .heads-intro { transform: translate(-50%, -50%) rotateY(360deg); }
.intro-layer.merge-in .tails-intro { transform: translate(-50%, -50%) rotateY(180deg); }

/* Actual Flipper Elements */
.flip-quip { position: absolute; left: 50%; top: calc(100% + 6px); translate: -50% 0; width: max-content; max-width: 90vw; pointer-events: none;
    font-size: 0.85rem; font-style: italic; color: var(--text-soft); text-align: center; opacity: 0; }
.flip-quip.is-on { animation: flip-quip 1.8s ease-out forwards; }
.flip-quip.is-decider { opacity: 1; color: var(--text); } /* the deciding flip's line, while it spins (arena.js deciderLine) */
@keyframes flip-quip { 10%, 70% { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .flip-quip.is-on { animation: none; opacity: 1; } }
/* Easter eggs (easter.js): a golden glow on a rare flip, FLAWLESS over the coin on 5 in a row, a poke line */
.flip-container.gold-flip .face { animation: gold-flip 1.3s ease-in-out 3; }
@keyframes gold-flip { 50% { box-shadow: 0 0 28px 8px var(--gold), inset 0 0 40px color-mix(in srgb, var(--gold) 55%, transparent); } }
.egg-banner, .egg-poke { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: max-content; max-width: 90vw; pointer-events: none; z-index: 6;
    font-family: var(--font-display); font-weight: 800; color: var(--gold); text-align: center; text-shadow: 0 2px 10px color-mix(in srgb, var(--shadow) 60%, transparent);
    animation: egg-pop 2.4s ease-out forwards; }
.egg-banner { font-size: 2rem; letter-spacing: 0.06em; }
.egg-poke { font-size: 1.1rem; top: 15%; }
@keyframes egg-pop { 0% { opacity: 0; scale: 0.6; } 12%, 75% { opacity: 1; scale: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .flip-container.gold-flip .face { animation: none; box-shadow: 0 0 20px 6px var(--gold); } .egg-banner, .egg-poke { animation: none; } }
/* A taunt (taunts.js): over the coin when its owner's pick wins the flip */
.flip-taunt { position: absolute; left: 50%; bottom: calc(100% + 8px); translate: -50% 0; width: max-content; max-width: 90vw; pointer-events: none;
    font-family: var(--font-display); font-size: 1rem; font-weight: 600; color: var(--gold); text-align: center; opacity: 0; z-index: 5; }
.flip-taunt.is-on { animation: flip-taunt 2.2s ease-out forwards; }
@keyframes flip-taunt { 0% { opacity: 0; transform: scale(0.8); } 12%, 75% { opacity: 1; transform: scale(1); } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .flip-taunt.is-on { animation: none; opacity: 1; } }
.mn-taunt-roll { flex: none; width: 38px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 1rem; }
.flip-container { perspective: 1000px; margin: 1rem auto 2rem; position: relative; padding: 3px; border-radius: inherit; display: none; transition: box-shadow 0.2s; }
.flipper { transform-style: preserve-3d; transition: transform 2.5s cubic-bezier(0.4, 0, 0.2, 1); position: relative; background: var(--surface-2); }
.coin-mode { width: var(--coin-size); height: var(--coin-size); border-radius: 50%; }
.poster-mode { width: var(--poster-w); height: var(--poster-h); border-radius: 10px; }
/* Movie with no poster: film icon above the title instead of a bare grey box */
.no-cover { flex-direction: column; gap: 8px; }
.no-cover::before { content: "🎬"; font-size: 1.8rem; line-height: 1; opacity: 0.8; }
.face {
    position: absolute; width: 100%; height: 100%; backface-visibility: hidden;
    background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 500; font-size: 1.1rem; text-align: center; padding: 12px;
    border-radius: inherit; background-color: var(--surface-2); color: var(--text);
    text-shadow: 0 1px 3px color-mix(in srgb, var(--shadow) 70%, transparent); box-shadow: inset 0 0 24px color-mix(in srgb, var(--shadow) 50%, transparent);
}
.face.heads { transform: rotateY(0deg); }
.face.tails { transform: rotateY(180deg); }

/* Text-only coins (titles without a poster): each side minted in the theme's coin colours, with a rim and an
   inner groove. The intro coins match, so nothing changes at the intro -> flipper swap. */
.coin-mode .face.text-face.heads, .intro-layer.coin-mode .text-face.heads-intro {
    --coin-face: var(--coin-heads-face); --coin-rim: var(--coin-heads-rim); --coin-ink: var(--coin-heads-text);
}
.coin-mode .face.text-face.tails, .intro-layer.coin-mode .text-face.tails-intro {
    --coin-face: var(--coin-tails-face); --coin-rim: var(--coin-tails-rim); --coin-ink: var(--coin-tails-text);
}
.coin-mode .face.text-face, .intro-layer.coin-mode .intro-face.text-face {
    background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--coin-rim) 16%, transparent), transparent 68%), var(--coin-face);
    border: 4px solid var(--coin-rim); color: var(--coin-ink);
    box-shadow: inset 0 0 0 5px var(--coin-face), inset 0 0 0 6px color-mix(in srgb, var(--coin-rim) 40%, transparent),
                inset 0 0 24px color-mix(in srgb, var(--shadow) 50%, transparent);
}

/* Soft shadow under the coin/poster. arena.js shrinks and fades it while the coin spins (it "lifts"),
   and it comes back as the coin lands. */
.flip-container::after {
    content: ""; position: absolute; left: 12%; right: 12%; bottom: -18px; height: 14px; z-index: -1;
    border-radius: 50%; pointer-events: none;
    background: radial-gradient(closest-side, var(--coin-shadow), transparent);
}

/* Score punch when a side takes a flip (setScore() in arena.js also rolls the new number up into place) */
@keyframes score-pop {
    0% { transform: scale(1); filter: brightness(1); }
    35% { transform: scale(1.45); filter: brightness(1.7); }
    100% { transform: scale(1); filter: brightness(1); }
}
.score.pop { animation: score-pop 0.55s cubic-bezier(0.3, 1.5, 0.5, 1); }

/* Versus stand-off: both contenders breathe (glow + slight swell) until they merge.
   Uses the separate `scale` property so it never fights the translate() that positions them. */
@keyframes border-pulse-heads {
    0%, 100% { box-shadow: inset 0 0 24px color-mix(in srgb, var(--shadow) 50%, transparent), 0 0 0 3px color-mix(in srgb, var(--heads) 35%, transparent), 0 0 4px color-mix(in srgb, var(--heads) calc(10% * var(--glow)), transparent); }
    50% { box-shadow: inset 0 0 24px color-mix(in srgb, var(--shadow) 50%, transparent), 0 0 0 3px var(--heads), 0 0 22px color-mix(in srgb, var(--heads) calc(55% * var(--glow)), transparent); }
}
@keyframes border-pulse-tails {
    0%, 100% { box-shadow: inset 0 0 24px color-mix(in srgb, var(--shadow) 50%, transparent), 0 0 0 3px color-mix(in srgb, var(--tails) 35%, transparent), 0 0 4px color-mix(in srgb, var(--tails) calc(10% * var(--glow)), transparent); }
    50% { box-shadow: inset 0 0 24px color-mix(in srgb, var(--shadow) 50%, transparent), 0 0 0 3px var(--tails), 0 0 22px color-mix(in srgb, var(--tails) calc(55% * var(--glow)), transparent); }
}
/* Stand-off: only the border ring pulses (the posters stay still); arena.js gives each its own random pace */
.intro-face.heads-intro { animation: border-pulse-heads 0.5s ease-in-out infinite; }
.intro-face.tails-intro { animation: border-pulse-tails 0.5s ease-in-out infinite; }

/* Win fireworks: rockets climb, then burst into sparks (JS in arena.js) */
.fireworks-layer { position: fixed; inset: 0; pointer-events: none; z-index: 9000; overflow: hidden; }
/* Confetti and popcorn share the celebration layer (arena.js celebrateWin) */
.confetti-piece { position: absolute; top: 0; border-radius: 2px; will-change: transform; }
.popcorn-kernel {
    position: absolute; top: 0; will-change: transform;
    background: var(--popcorn); border-radius: 48% 52% 45% 55% / 55% 45% 55% 45%;
    box-shadow: inset -3px -4px 0 var(--popcorn-butter), 0 0 0 1px var(--popcorn-edge);
}
.popcorn-kernel::before, .popcorn-kernel::after {
    content: ''; position: absolute; background: var(--popcorn); border-radius: 50%;
    box-shadow: 0 0 0 1px var(--popcorn-edge);
}
.popcorn-kernel::before { width: 60%; height: 60%; top: -22%; left: 8%; }
.popcorn-kernel::after { width: 52%; height: 52%; top: -12%; right: -14%; }
.firework-rocket { position: absolute; display: block; width: 3px; height: 12px; border-radius: 2px; will-change: transform; }
.firework-spark { position: absolute; display: block; border-radius: 50%; will-change: transform, opacity; }
.firework-flash { position: absolute; display: block; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, var(--overlay-ink) 0%, transparent 70%); will-change: transform, opacity; }

@media (prefers-reduced-motion: reduce) {
    .intro-face.heads-intro, .intro-face.tails-intro { animation: none !important; }
    .intro-face.heads-intro { box-shadow: inset 0 0 24px color-mix(in srgb, var(--shadow) 50%, transparent), 0 0 0 3px var(--heads); }
    .intro-face.tails-intro { box-shadow: inset 0 0 24px color-mix(in srgb, var(--shadow) 50%, transparent), 0 0 0 3px var(--tails); }
    .intro-layer.merge-in .heads-intro, .intro-layer.merge-in .tails-intro { transform: translate(-50%, -50%); }
    .score.pop { animation: none; }
    .carousel-item.highlight.landed { animation: none; }
}

.match_winner { border-radius: inherit; position: relative; }
.match_winner::before {
    content: ""; position: absolute; inset: -4px; border-radius: inherit; z-index: -1;
    background: conic-gradient(from var(--spin-angle), var(--spin-1), var(--spin-2), var(--spin-1));
    animation: spin-border 2.4s linear infinite;
}

details { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; padding: 12px 14px; overflow: hidden; }
summary { font-size: 0.9rem; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
summary::-webkit-details-marker { display: none; }
.history-details { margin-top: 10px; font-size: 0.85rem; color: var(--text-dim); line-height: 1.5; display: flex; gap: 14px; align-items: flex-start; }
.history-row { position: relative; }
.history-row summary { padding-right: 30px; }
/* Keep the score and winner circle on one line where there's room */
@media (min-width: 480px) {
    .history-row summary > span:last-child { flex-shrink: 0; white-space: nowrap; }
}
.history-play {
    position: absolute; top: 9px; right: 10px;
    width: 26px; height: 26px; padding: 0 0 0 2px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.history-play:hover { border-color: var(--accent); color: var(--accent); }

/* Pool Grid Styles */
.pool-card {
    background: var(--surface-2); border: 2px solid var(--border); border-radius: 8px;
    overflow: hidden; cursor: pointer; transition: transform 0.2s, border-color 0.4s, box-shadow 0.2s;
    display: flex; flex-direction: column; position: relative;
}
.pool-card.selected { transform: scale(1.03); }
/* Cards fade in whenever the grid renders, the first few slightly staggered (under 0.3s in all).
   Opacity only, and no fill afterwards, so the delete/gather animations' transforms are never overridden. */
.pool-card { animation: card-in 0.18s ease-out backwards; }
.pool-card:nth-child(n+2) { animation-delay: 25ms; }
.pool-card:nth-child(n+3) { animation-delay: 50ms; }
.pool-card:nth-child(n+4) { animation-delay: 75ms; }
.pool-card:nth-child(n+5) { animation-delay: 100ms; }
@keyframes card-in { from { opacity: 0; } to { opacity: 1; } }
.pool-cover {
    width: 100%; height: var(--cover-h, 190px); background-size: cover; background-position: center;
    transition: filter 0.4s ease;
}
.pool-cover:focus-visible { outline-offset: -3px; }
.pool-info { padding: 8px; text-align: center; }
.pool-title { font-size: 0.8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px;}
.watched-cb { cursor: pointer; accent-color: var(--accent); }
/* ---------- Personal rating: a circle on the cover that stretches into 10 stars ---------- */
.pool-rating {
    position: absolute; top: 6px; left: 6px; z-index: 2;
    width: 30px; height: 30px; border-radius: 15px; overflow: hidden;
    border: 2px solid transparent;
    /* Border: rating1's share in Heads green, rating2's in Tails pink (--split is rating1's percentage) */
    background:
        linear-gradient(var(--card-overlay), var(--card-overlay)) padding-box,
        conic-gradient(var(--r1-color, var(--heads)) 0% calc(var(--split, 50) * 1%), var(--r2-color, var(--tails)) calc(var(--split, 50) * 1%) 100%) border-box;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--shadow) 55%, transparent);
    transition: width 0.28s cubic-bezier(0.25, 1, 0.5, 1), height 0.28s cubic-bezier(0.25, 1, 0.5, 1),
                border-radius 0.28s, border-width 0.28s, opacity 0.2s;
}
.pool-rating.no-r1 { --r1-color: var(--rating-unrated); }
.pool-rating.no-r2 { --r2-color: var(--rating-unrated); }
.pool-rating { --rating-unrated: color-mix(in srgb, var(--overlay-ink) 28%, transparent); }
.pool-rating.unrated {
    width: 40px;
    background:
        linear-gradient(var(--card-overlay), var(--card-overlay)) padding-box,
        color-mix(in srgb, var(--overlay-ink) 16%, transparent) border-box;
}
.rating-label {
    position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none;
    color: var(--text); font-family: var(--font-display); font-size: 0.74rem; font-weight: 600;
    cursor: pointer; transition: opacity 0.15s, font-size 0.28s;
}
.pool-rating.unrated .rating-label {
    color: var(--text-dim); font-family: var(--font-body); font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase;
}
.rating-label:focus-visible { outline: none; }
.pool-rating:has(.rating-label:focus-visible) { border-color: var(--accent); }

.sort-dir {
    flex: none; width: 34px; height: 32px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
    cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.sort-dir:hover { border-color: var(--accent); color: var(--accent); }
.sort-dir svg { transition: transform 0.2s ease; }
.sort-dir.asc svg { transform: rotate(180deg); }

/* ---------- Library page: fixed header, a grid that scrolls on its own, buttons pinned to the bottom ---------- */
body.pool-open { overflow: hidden; }
#pool-view.active {
    position: fixed; top: var(--tab-top); bottom: var(--tab-bottom); left: 0; right: 0; z-index: 5;
    margin: 0 auto; width: 100%; max-width: 800px;
    padding: calc(1.25rem + env(safe-area-inset-top, 0px)) 1.25rem 0;
    display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
    background: var(--bg);
}
.pool-head { flex: none; }
.pool-scroll {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    /* room for the selected-card scale-up and gold frame, without shifting the grid */
    margin: 0 -10px; padding: 10px 10px 18px;
    /* soft fade at both edges hints that there's more to scroll */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 16px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 16px), transparent 100%);
}
/* Under the grid only while + Add movies picks for a Movie Night (lobby.js pick mode): its Done bar */
.pool-bottom[hidden] { display: none; }
.pool-bottom {
    flex: none; display: flex; flex-direction: column; gap: 10px;
    padding: 12px 0 calc(12px + var(--page-safe-bottom));
    border-top: 1px solid var(--border); background: var(--bg);
}
@keyframes bar-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }


/* Selected cards: rating locked (dimmed, not clickable) and Watched hidden */

/* 9+: the circle is twice the size (60px), with number, ring, glow and glint scaled to match.
   Opening it morphs into the normal-height star strip. */
.pool-rating.elite:not(.open) .rating-label { font-size: 1.45rem; }
.pool-card.selected .pool-rating { opacity: 0.5; pointer-events: none; }


/* Rated 2.5 or below: faded cover with a crosshatched sad face on top */
.pool-card.low-rated .pool-cover { filter: brightness(0.3) saturate(0.25); }
.sad-face {
    position: absolute; top: 0; left: 0; right: 0; height: var(--cover-h, 190px); z-index: 1;
    display: flex; align-items: center; justify-content: center; pointer-events: none;
    animation: sad-in 0.4s ease;
    transition: opacity 0.4s;
}
.sad-face svg { width: 55%; height: auto; filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--shadow) 65%, transparent)); }
.sad-face.leaving { opacity: 0; }
@keyframes sad-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }

/* Delete: the gathered stack takes a red tint as it vanishes */
.anim-clone-tint { position: absolute; inset: 0; border-radius: inherit; background: var(--danger); opacity: 0; transition: opacity 0.3s; pointer-events: none; }
/* The start button, under Filters · Sort · Pick (pool.js updateDraftButton): greyed with a line of Flippy's while nothing
   is picked; one title = Be a Loser in the Tails pink; 2 to 10 = Start Movie Night in gold, which sweeps once as it lights
   up and then glows slowly while it's ready */
.lib-start-row { display: flex; gap: 10px; margin-top: 10px; }
#pool-view.is-picking .lib-start-row { display: none; } /* (+ Add movies' Done bar takes over, at the bottom) */
.lib-start-row [hidden] { display: none; }
button.action-btn.lib-start {
    flex: 1; min-width: 0; margin: 0; position: relative; overflow: hidden; isolation: isolate;
    background: var(--gold); color: var(--gold-ink); border: 1px solid transparent;
}
.lib-start > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.action-btn.lib-start:disabled {
    background: var(--surface-2); color: var(--text-dim); border-color: var(--border); font-weight: 600; font-size: 0.92rem; cursor: default;
}
.lib-start.lit::after {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: linear-gradient(105deg, transparent 30%, color-mix(in srgb, var(--overlay-ink) 55%, transparent) 50%, transparent 70%);
    background-size: 250% 100%; background-position: 130% 0; animation: start-sweep 0.9s ease-out forwards;
}
.lib-start.is-ready { animation: start-glow 4s ease-in-out 0.9s infinite; }
@keyframes start-sweep { to { background-position: -30% 0; } }
@keyframes start-glow {
    0%, 70%, 100% { box-shadow: 0 0 0 0 transparent; }
    35% { box-shadow: 0 0 18px 2px color-mix(in srgb, var(--gold) 55%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .lib-start.lit::after { animation: none; display: none; } .lib-start.is-ready { animation: none; } }
.draft-hint { margin: 6px 0 0; text-align: center; font-size: 0.8rem; color: var(--text-dim); }
.draft-hint[hidden] { display: none; }



/* Favorite heart: bottom-right of the cover; red when a favorite, grey outline otherwise */
/* Heart sits in the info row before the dice: just the heart, no circle behind it */
.pool-card .pool-info { padding-left: 6px; padding-right: 6px; }
.pool-fav {
    position: relative; flex: none; width: 14px; height: 14px; padding: 0; border: 0; background: none;
    display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--icon);
    transition: opacity 0.2s, visibility 0s, color 0.15s;
}
.pool-fav::before { content: ""; position: absolute; inset: -7px; } /* bigger click area than the icon */
.pool-fav:hover { color: var(--icon-hover); }
.pool-fav svg { width: 14px; height: 14px; }
.pool-fav svg path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.pool-fav.on, .pool-fav.on:hover { color: var(--favorite); }
.pool-fav.on svg path { fill: currentColor; }
.pool-fav.pop svg { animation: heart-pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
.pool-fav.revert svg { animation: heart-flip 0.45s ease; }
@keyframes heart-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes heart-flip { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }
.pool-card.selected .pool-fav { opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0s 0.2s; }

/* Selection: one seamless gold frame that fully replaces any rating border */
.pool-card.selected, .pool-card.rated.selected {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px var(--gold), 0 0 16px color-mix(in srgb, var(--gold) calc(35% * var(--glow)), transparent);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.pool-card::after {
    content: "✓"; position: absolute; top: 6px; right: 6px; z-index: 2;
    width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--gold); color: var(--gold-ink); font-size: 0.78rem; font-weight: 800;
    box-shadow: 0 2px 6px color-mix(in srgb, var(--shadow) 50%, transparent);
    transform: scale(0); opacity: 0; transition: transform 0.2s, opacity 0.2s;
    pointer-events: none;
}
.pool-card.selected::after { transform: scale(1); opacity: 1; }

/* Unticking Watched: the title dips and settles while the border fades back */
@keyframes title-reset {
    0% { opacity: 1; filter: none; transform: none; }
    45% { opacity: 0.4; filter: blur(1.5px); transform: translateY(2px); }
    100% { opacity: 1; filter: none; transform: none; }
}
.pool-card.resetting .pool-title { animation: title-reset 0.5s ease; }

/* Watched but never rated: the Rate chip gently pulses */

/* 9+: champagne ring with a soft glow, and a light glint that circles it every ~6s */
@property --glint { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes medal-glint {
    0% { --glint: 0deg; opacity: 1; }
    20% { --glint: 360deg; opacity: 1; }
    21%, 100% { --glint: 360deg; opacity: 0; }
}
.pool-rating.elite:not(.open) {
    width: 60px; height: 60px; border-radius: 30px; border-width: 3px;
    overflow: visible;
    background:
        linear-gradient(var(--card-overlay), var(--card-overlay)) padding-box,
        conic-gradient(var(--medal-1), var(--medal-2), var(--medal-3), var(--medal-1)) border-box;
    box-shadow: 0 3px 12px color-mix(in srgb, var(--shadow) 55%, transparent), 0 0 16px color-mix(in srgb, var(--medal-1) calc(50% * var(--glow)), transparent);
}
.pool-rating.elite:not(.open)::after {
    content: ""; position: absolute; inset: -3px; border-radius: inherit; padding: 3px; pointer-events: none;
    background: conic-gradient(from var(--glint), transparent 0deg 290deg, var(--medal-shine) 335deg, transparent 360deg);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: medal-glint 6s linear infinite;
    animation-delay: var(--glint-delay, 0s);
}

/* Can play (canplay.php): a movie none of Flippy's Plex servers has, dimmed under a grey "Not on Plex" (an inset shadow,
   not a filter, so the words stay sharp) */
.pool-card.cant-play .pool-cover { box-shadow: inset 0 0 0 100vmax var(--backdrop); }
.pool-noplex {
    position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); padding: 4px 6px;
    background: var(--backdrop); color: var(--text-dim); font-size: 0.75rem; font-weight: 600; text-align: center; pointer-events: none;
}

/* ---------- Watched rating dial (over the cover) ---------- */
.watch-dial {
    position: absolute; top: 0; left: 0; right: 0; height: 190px; z-index: 3;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    background: var(--dial-backdrop);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    animation: dial-in 0.18s ease-out;
}
.watch-dial.closing { opacity: 0; transform: scale(0.96); transition: opacity 0.18s, transform 0.18s; }
@keyframes dial-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
.watch-dial-prompt { font-family: var(--font-display); font-size: 0.8rem; font-weight: 500; color: var(--text); letter-spacing: 0.02em; }
.watch-dial-ring { position: relative; width: 64px; height: 64px; }
.watch-dial-ring svg { width: 100%; height: 100%; cursor: pointer; touch-action: none; overflow: visible; }
.watch-dial-ring svg:focus, .watch-dial-ring svg:focus-visible { outline: none; }
.watch-dial-ring:not(.has-value) .dial-value { opacity: 0; }
.watch-dial-ring svg:focus-visible .dial-track { stroke: color-mix(in srgb, var(--overlay-ink) 30%, transparent); }
.dial-track, .dial-value { fill: none; stroke-width: 8; stroke-linecap: round; }
.dial-track { stroke: color-mix(in srgb, var(--overlay-ink) 14%, transparent); }
.dial-value { stroke: var(--row-color); stroke-dasharray: 0 100; transition: stroke-dasharray 0.06s linear; }
.watch-dial-ring.max .dial-value { stroke: var(--rating-gold); }
.dial-knob { fill: var(--knob); stroke: color-mix(in srgb, var(--shadow) 40%, transparent); stroke-width: 1.5; opacity: 0; transition: opacity 0.15s; }
.watch-dial-ring.has-value .dial-knob { opacity: 1; }
.watch-dial-value {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none;
    font-family: var(--font-display); font-size: 1rem; font-weight: 600; color: var(--text);
}
.watch-dial-ring:not(.has-value) .watch-dial-value { color: var(--text-dim); }
.watch-dial-actions { display: flex; gap: 6px; }
.watch-dial-actions button {
    border-radius: 6px; padding: 5px 9px; font-family: var(--font-body); font-size: 0.72rem; font-weight: 600; cursor: pointer;
}
.dial-cancel { background: transparent; color: var(--text); border: 1px solid var(--border); }
.dial-save { background: var(--gold); color: var(--gold-ink); border: 0; }
.dial-save:disabled { background: var(--surface-2); color: var(--text-dim); cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
    .pool-rating.elite:not(.open)::after { animation: none; }
    .pool-card.resetting .pool-title { animation: none; }
}

/* Themed sort dropdown (replaces the OS-drawn <select> list) */
.sort-menu { position: relative; flex: none; }
.sort-menu-btn {
    height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 10px 0 12px;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
    font-family: var(--font-body); font-size: 0.85rem; white-space: nowrap; cursor: pointer;
    transition: border-color 0.15s;
}
.sort-menu-prefix { color: var(--text-dim); }
.sort-menu-btn:hover, .sort-menu.open .sort-menu-btn { border-color: var(--accent); }
.sort-menu-btn svg { color: var(--text-dim); transition: transform 0.2s ease; }
.sort-menu.open .sort-menu-btn svg { transform: rotate(180deg); }
.sort-menu-list {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 100%;
    list-style: none; margin: 0; padding: 4px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 12px 30px color-mix(in srgb, var(--shadow) 60%, transparent);
    opacity: 0; transform: translateY(-4px); visibility: hidden; pointer-events: none;
    transition: opacity 0.15s, transform 0.15s, visibility 0s 0.15s;
}
.sort-menu.open .sort-menu-list {
    opacity: 1; transform: none; visibility: visible; pointer-events: auto;
    transition: opacity 0.15s, transform 0.15s, visibility 0s;
}
.sort-menu-list:focus { outline: none; }
.sort-menu-list li {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; border-radius: 5px;
    font-size: 0.85rem; color: var(--text); white-space: nowrap; cursor: pointer;
}
.sort-menu-list li::before { content: ""; width: 14px; flex: none; text-align: center; }
.sort-menu-list li[aria-selected="true"]::before { content: "✓"; color: var(--accent); font-weight: 700; }
.sort-menu-list li:hover, .sort-menu-list li.active { background: var(--accent-dim); }
/* Two rows on phones (+ Add and the filter; then sort, Pick for me and the admin's ⋯), one row from 700px */
button.action-btn.pool-add-btn { flex: none; height: 36px; margin: 0; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; }
.more-menu { position: relative; margin-left: auto; flex: none; }
#pool-more-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.more-menu-list {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 200px; padding: 4px;
    display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-hover); border-radius: 10px;
    box-shadow: 0 12px 30px color-mix(in srgb, var(--shadow) 60%, transparent);
}
.more-menu-list[hidden] { display: none; }
.more-menu-list button {
    height: 40px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text);
    font: 500 0.9rem var(--font-body); text-align: left; cursor: pointer; white-space: nowrap;
}
.more-menu-list button:hover, .more-menu-list button:focus-visible { background: var(--accent-dim); outline: none; }
.pool-message { grid-column: 1 / -1; color: var(--text-dim); font-size: 0.9rem; padding: 2rem 1rem; text-align: center; }

/* Toast notifications */
#toast-region {
    position: fixed; left: 50%; bottom: calc(20px + var(--tab-bottom) + var(--page-safe-bottom)); transform: translateX(-50%);
    z-index: 10000; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-left: 3px solid var(--tails);
    border-radius: 8px; padding: 10px 14px; font-size: 0.85rem; line-height: 1.4; box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow) 60%, transparent);
    opacity: 0; transform: translateY(18px) scale(0.96); transition: opacity 0.25s, transform 0.3s cubic-bezier(0.25, 1.3, 0.5, 1);
}
.toast.show { opacity: 1; transform: none; }

/* Library page fade-out (everything except the floating cover clones) */
#pool-view.fading-out {
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

/* Deck Stack Animation Classes */
#anim-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 9999; display: none; }
.anim-clone {
    position: fixed; background-size: cover; background-position: center;
    background-color: var(--surface-2); color: var(--text);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-size: 1.1rem; font-weight: 500; text-align: center; padding: 10px;
    border-radius: 8px; box-shadow: 0 5px 15px color-mix(in srgb, var(--shadow) 50%, transparent);
    transition: top 0.5s cubic-bezier(0.25, 1, 0.5, 1), left 0.5s cubic-bezier(0.25, 1, 0.5, 1), transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    transform-style: preserve-3d; backface-visibility: hidden;
}
.anim-clone-back {
    position: absolute; inset: 0; background: var(--surface-2); border: 2px solid var(--accent);
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    transform: rotateY(180deg); backface-visibility: hidden; font-family: var(--font-display);
    color: var(--text); font-size: 1.2rem; text-align: center;
}
.anim-clone-back svg { width: 38%; color: var(--text-dim); }
/* Start Movie Night's covers (pool.js gatherIntoStack): the starter's green edge on both faces */
.anim-clone.is-mine { outline: 2px solid var(--heads); }
.anim-clone.is-mine .anim-clone-back { border-color: var(--heads); }
/* The Google TV's stack (fallAndCatch): one card back with two flat edges behind it (no blur) */
.anim-tv-stack {
    position: fixed; transform: translate(-50%, -50%); border-radius: 8px; background: var(--surface-2);
    border: 2px solid var(--heads); display: flex; align-items: center; justify-content: center;
    box-shadow: 4px 4px 0 var(--surface), 5px 5px 0 1px var(--border), 9px 9px 0 var(--surface), 10px 10px 0 1px var(--border);
}
.anim-tv-stack svg { width: 38%; color: var(--text-dim); }

/* ---------- Toggle buttons: one that can't be used now dims ---------- */
.toggle-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.toggle-btn:disabled:hover { border-color: var(--border); color: var(--text-dim); }

/* The Library's Filters sheet (pool-draft.js): Show as square buttons like Rounds, then rows like Quick Draft's were */
.qd-count { font-size: 0.8rem; color: var(--text-dim); margin-right: auto; }
.lib-filters-body { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; }
.toggle-group.lib-show { margin: 0 0 4px; flex-wrap: nowrap; }
.lib-show .toggle-btn { flex: 1 1 0; min-width: 0; padding: 10px 4px; aspect-ratio: auto; font-size: 0.85rem; }
.lib-filters-body .qd-row { grid-template-columns: 1fr; gap: 4px; }
.lib-filters-body .qd-seg .toggle-btn { flex: 1 1 0; padding: 7px 4px; }
.lib-hidden-row { padding: 0; border-top: 1px solid var(--border); border-bottom: 0; }
.lib-hidden-row span:first-child { flex: 1; }
.lib-filters-foot .action-btn { margin-top: 0; padding: 8px 18px; }
.match-log-page-btn:disabled { opacity: 0.4; cursor: default; }
#pool-sort-label { overflow: hidden; text-overflow: ellipsis; }
/* Who added a title (schema 42), on its cover; a title you hid shows dimmed when "Show my hidden movies" is on */
.pool-cover { position: relative; }
.pool-by {
    position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px); padding: 2px 6px; border-radius: 4px;
    background: var(--backdrop); color: var(--text); font-size: 0.68rem; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.pool-card.is-hidden .pool-cover { filter: grayscale(0.8) brightness(0.55); }
.qd-row { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; }
.qd-filters { display: flex; flex-direction: column; gap: 8px; }
.qd-label { font-size: 0.78rem; color: var(--text-dim); margin: 0; font-weight: 500; }
.toggle-group.qd-seg { margin: 0; gap: 6px; flex-wrap: wrap; }
.qd-seg .toggle-btn { flex: 1 1 auto; padding: 6px 8px; font-size: 0.78rem; white-space: nowrap; }
.qd-hint { font-size: 0.72rem; color: var(--text-dim); line-height: 1.3; }
/* Import From Plex in the admin's ⋯ menu turns Plex orange on hover (a brand colour, not part of the theme) */
.more-menu-list #plex-btn:hover, .more-menu-list #plex-btn:focus-visible { color: #E5A00D; }
.plex-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 0.8rem; color: var(--text-dim); }
.plex-tools[hidden] { display: none; }
.plex-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.plex-list { padding: 8px 10px; }
label.plex-row { display: flex; align-items: center; gap: 12px; margin: 0; padding: 6px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; color: var(--text); }
label.plex-row:hover { background: var(--surface-2); }
.plex-row input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.plex-thumb { flex: none; width: 36px; height: 54px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-2) center / cover no-repeat; }
.plex-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plex-year { color: var(--text-dim); }
.plex-footer { justify-content: flex-end; }
.plex-footer .action-btn { margin-top: 0; flex: none; }
.qd-switch {
    flex: none; position: relative; width: 42px; height: 24px; border-radius: 12px; padding: 0; cursor: pointer;
    background: var(--surface-2); border: 1px solid var(--border); transition: background 0.2s, border-color 0.2s;
}
.qd-switch span {
    position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--text-dim); transition: transform 0.2s, background 0.2s;
}
.qd-switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.qd-switch[aria-checked="true"] span { transform: translateX(18px); background: var(--accent-ink); }
/* Freshly drafted cards flash once */
.pool-card.just-drafted { animation: just-drafted 0.7s ease-out; }
@keyframes just-drafted { 0% { filter: brightness(1.7); } 100% { filter: brightness(1); } }
@media (prefers-reduced-motion: reduce) { .pool-card.just-drafted { animation: none; } }
@media (max-width: 480px) {
    .qd-row { grid-template-columns: 78px 1fr; }
}
button.action-btn.btn-options-start { flex: 2; background: var(--gold); color: var(--gold-ink); }

/* Scoreboard: gold circle per match won, centred under the score */
.score-name { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; margin-bottom: 2px; }
.score-name h3 { width: auto; min-width: 0; margin-bottom: 0; }
.match-pips { display: flex; justify-content: center; gap: 4px; height: 8px; margin-top: 3px; }
.match-pips[hidden] { display: none; }
.match-pip {
    width: 9px; height: 9px; border-radius: 50%; background: var(--gold);
    box-shadow: 0 0 6px color-mix(in srgb, var(--gold) calc(55% * var(--glow)), transparent);
}
.match-pip.new { animation: pip-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes pip-pop {
    0% { transform: scale(0); filter: brightness(1.8); }
    60% { transform: scale(1.5); filter: brightness(1.5); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* Match winner flash (1.5s, MATCH_WIN_HIGHLIGHT_MS in arena.js) before the next match starts */
.score-box.match-win .score { animation: match-win 0.6s ease-out; }
.flip-container.match-flash.heads { box-shadow: 0 0 0 2px var(--heads), 0 0 24px color-mix(in srgb, var(--heads) calc(45% * var(--glow)), transparent); }
.flip-container.match-flash.tails { box-shadow: 0 0 0 2px var(--tails), 0 0 24px color-mix(in srgb, var(--tails) calc(45% * var(--glow)), transparent); }
@keyframes match-win { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.25); } }

/* "Match 2 of 3" between matches. The row has no height (nothing shifts); arena.js sets --banner-y so the
   label sits over the middle of the coin, and shows it for 1.1s (MATCH_BANNER_MS). */
.match-banner { position: relative; width: 100%; height: 0; z-index: 20; pointer-events: none; }
.match-banner-label {
    position: absolute; left: 50%; top: var(--banner-y, 0px); transform: translate(-50%, -50%);
    padding: 10px 24px; border-radius: 999px; white-space: nowrap;
    background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--accent);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    box-shadow: 0 10px 28px color-mix(in srgb, var(--shadow) 60%, transparent), 0 0 22px color-mix(in srgb, var(--accent) calc(30% * var(--glow)), transparent);
    font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text);
}
.match-banner-label b { color: var(--accent); font-weight: 700; }
.match-banner.show .match-banner-label { animation: banner-in-out 1.1s cubic-bezier(0.25, 1, 0.5, 1) both; }
@keyframes banner-in-out {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); letter-spacing: 0.3em; }
    22% { opacity: 1; transform: translate(-50%, -50%) scale(1); letter-spacing: 0.12em; }
    78% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.06); }
}
/* "Match 1: ●●●" on one line; circles wrap under themselves, not under the label */
.history-match { margin-top: 8px; display: flex; align-items: flex-start; gap: 8px; }
.history-match-label { flex: none; font-size: 0.72rem; line-height: 16px; color: var(--text-dim); }
.history-match .history-dots { margin-top: 4.5px; } /* centres the 7px circles on the 16px label line */
@media (prefers-reduced-motion: reduce) {
    .match-pip.new, .score-box.match-win .score { animation: none; }
}
.history-dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.history-dots .history-dot { width: 7px; height: 7px; }

/* Titles struck in the veto round: covers with a red slashed circle over them (history.js VETO_MARK) */
.history-vetoed { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.history-veto {
    position: relative; width: 40px; height: 60px; border-radius: 4px; overflow: hidden; flex: none;
    border: 1px solid var(--border); background: var(--surface) center / cover no-repeat;
    display: flex; align-items: center; justify-content: center;
}
.history-veto.no-cover { padding: 3px; font-size: 0.58rem; line-height: 1.15; text-align: center; color: var(--text-dim); overflow-wrap: anywhere; }
.veto-mark { position: absolute; inset: 0; margin: auto; width: 28px; height: 28px; fill: none; stroke: var(--danger); stroke-width: 2.4; stroke-linecap: round; }
.veto-mark circle { fill: color-mix(in srgb, var(--surface) 60%, transparent); }
.history-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.history-dot.is-heads { background: var(--heads); }
.history-dot.is-tails { background: var(--tails); }

/* "Decide For Me": spinning winner border; it turns the other way once the flips start */
button.action-btn.spin-border-btn { position: relative; }
.spin-border-btn::before {
    content: ""; position: absolute; inset: -3px; border-radius: 9px; padding: 3px; pointer-events: none;
    background: conic-gradient(from var(--spin-angle), var(--spin-1), var(--spin-2), var(--spin-1));
    animation: spin-border 2.4s linear infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}
.spin-border-btn.reverse::before { animation: spin-border-reverse 2.4s linear var(--reverse-delay, 0s) infinite; }
@keyframes spin-border-reverse { from { --spin-angle: 360deg; } to { --spin-angle: 0deg; } }

/* Be a Loser (watched alone): no coin, scores or winner card, only the player */
#arena-view.is-solo :is(.scoreboard, .match-banner, .intro-layer, .flip-container, .arena-actions, .end-actions, .winner-card) { display: none !important; }

/* End of series: ( Replay | New Match | Library ) */
.end-actions {
    display: inline-flex; margin-top: 18px; max-width: 100%;
    background: var(--surface); border: 1px solid var(--border); border-radius: 999px; overflow: hidden;
    animation: bar-in 0.25s ease-out;
}
.end-actions[hidden] { display: none; }
.end-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: none; border: 0; color: var(--text); cursor: pointer; white-space: nowrap;
    font-family: var(--font-body); font-size: 0.9rem; font-weight: 600; padding: 11px 18px;
    transition: background 0.15s, color 0.15s;
}
.end-btn + .end-btn { border-left: 1px solid var(--border); }
.end-btn.end-replay { color: var(--accent); }
/* ▶ Replay plays the saved flips back; "Flip again" (just played) keeps the circular arrow */
.end-btn.end-replay .end-play-icon, .end-btn.end-replay.is-playback .end-flip-icon { display: none; }
.end-btn.end-replay.is-playback .end-play-icon { display: inline; }
.end-btn:hover, .end-btn:focus-visible { background: var(--surface-2); outline: none; }
.end-btn:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
@media (max-width: 380px) { .end-btn { padding: 10px 13px; font-size: 0.84rem; } }

/* History rows: date + winning movie, score, winner circle; poster on the right when expanded */
.history-row summary > span.history-when { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-date { color: var(--text); font-weight: 600; }
.history-title { color: var(--text-dim); }
.history-row summary > span.history-score { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; white-space: nowrap; }
.history-info { flex: 1; min-width: 0; }
/* Poster height is fitted to the text beside it (fitHistoryPoster); width follows at 2:3 */
.history-poster {
    flex: none; width: 70px; aspect-ratio: 2 / 3; border-radius: 6px; border: 2px solid var(--border);
    background: var(--surface) center / cover no-repeat;
    display: flex; align-items: center; justify-content: center;
}
.history-poster.is-heads { border-color: var(--heads); }
.history-poster.is-tails { border-color: var(--tails); }
.history-poster.no-cover::before { font-size: 1.2rem; }
.history-matchup { font-size: 0.78rem; }
.history-matchup .is-heads { color: var(--heads); font-weight: 600; }
.history-matchup .is-tails { color: var(--tails); font-weight: 600; }
.history-matchup .history-vs { color: var(--text-dim); margin: 0 2px; }

/* Decide For Me: always dark inside its spinning border (no grey-out once the flips start) */
button.action-btn.spin-border-btn, button.action-btn.spin-border-btn:disabled { background: var(--surface); color: var(--text); border: 0; }
button.action-btn.spin-border-btn:disabled { cursor: default; filter: none; transform: none; }

/* Decide For Me, centred under the card */
.arena-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; margin-top: 6px; }
.arena-actions .action-btn { margin-top: 0; }
.arena-actions .action-btn[hidden] { display: none; }
/* ⏩ on a replay: a small square beside "Showing Results"; the number shows once it is faster */
button.action-btn.btn-speed { min-width: 46px; padding-left: 12px; padding-right: 12px; font-variant-numeric: tabular-nums; }
/* An instant finish plays out unseen; the winner card shows once it is done */
#arena-view.skipping { visibility: hidden; }

/* History: collapsed behind a small "Show History" link */
.history-toggle {
    display: block; margin: 0 auto 0.75rem; padding: 4px 8px; background: none; border: 0; cursor: pointer;
    font-family: var(--font-body); font-size: 0.8rem; color: var(--text-soft); transition: color 0.15s;
}
.history-toggle:hover, .history-toggle:focus-visible { color: var(--text); }
.history-toggle[hidden] { display: none; }
#history-container[hidden] { display: none; }

/* Popups (Manage, Profile, Import From Plex, ...): the panel, its head and close button, a scrolling list and its pager */
.match-log {
    margin: auto; padding: 0; background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: 12px;
    width: min(560px, calc(100vw - 32px)); max-height: min(80vh, 760px);
    display: none; flex-direction: column; overflow: hidden;
}
.match-log[open] { display: flex; animation: dialog-in 0.22s cubic-bezier(0.25, 1, 0.5, 1); }
.match-log::backdrop { background: var(--backdrop); }
.match-log[open]::backdrop { animation: view-in 0.2s ease-out; }
/* The trailer popup: as wide as it fits, the player 16:9 */
.trailer-dialog { width: min(960px, calc(100vw - 32px)); max-height: none; }
.trailer-frame { aspect-ratio: 16 / 9; width: 100%; }
.trailer-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
.match-log-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.match-log-head h2 { font-size: 1.2rem; margin: 0; }
.match-log-close {
    width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 0.9rem;
}
.match-log-close:hover { border-color: var(--accent); color: var(--accent); }
.match-log-list { flex: 1; min-height: 120px; overflow-y: auto; padding: 14px 16px 4px; overscroll-behavior: contain; }
.match-log-message { color: var(--text-dim); font-size: 0.9rem; text-align: center; padding: 1.5rem 0; }
.match-log-retry {
    display: block; margin: 10px auto 0; padding: 6px 14px; border-radius: 6px; cursor: pointer;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border); font-family: var(--font-body);
}
.match-log-pager {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border);
    font-size: 0.85rem; color: var(--text-dim);
}
.match-log-pager[hidden] { display: none; }
.match-log-page-btn {
    padding: 6px 12px; border-radius: 6px; cursor: pointer; font-family: var(--font-body); font-size: 0.85rem;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}
.match-log-page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.match-log-page-btn:disabled { opacity: 0.4; cursor: default; }

/* Movie Night room */
.watch-panel { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.watch-panel[hidden] { display: none; }
.watch-row { display: flex; gap: 8px; width: 100%; }
.watch-row input[type="text"] { flex: 1; min-width: 0; margin: 0; }
.watch-row button { margin-top: 0; }
.watch-status { margin: 0; color: var(--text-dim); font-size: 0.9rem; text-align: center; overflow-wrap: anywhere; }

/* Reduced motion: screens, popups, library cards and toasts just appear; the toggle tint, button presses and the
   "Match 2 of 3" banner change instantly. (arena.js skips the coin lift, landing wobble and score roll itself.) */
@media (prefers-reduced-motion: reduce) {
    .view.active, .match-log[open], .match-log[open]::backdrop, .pool-card, .match-banner.show .match-banner-label { animation: none; }
    .toggle-btn { transition: none; }
    .toast, .toast.show { transform: none; }
    .toggle-btn:active:not(:disabled), .sort-dir:active, .sort-menu-btn:active, .history-play:active,
    .match-log-close:active, .match-log-page-btn:active:not(:disabled), .match-log-retry:active { transform: none; }
    button.action-btn:active:not(:disabled) { transform: translateY(1px); }
}

/* Movie Night (watch.js). Colours come from the theme tokens. */

/* Room for the error line below the lobby or room */
#watch-view .watch-panel { margin-bottom: 18px; }

/* Add / Join line up with their text box (.btn-secondary's top margin would push them down) */
.watch-row button.action-btn.btn-secondary { margin-top: 0; }

.watch-status[hidden] { display: none; }

/* The room's heading: Movie Night on the left, the share button and the starter's Invite beside it */
.watch-head { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-bottom: 0.4rem; }
.watch-head h1 { margin: 0; }
.watch-head .games-head-btn[hidden] { display: none; }
.watch-head-actions { display: flex; align-items: center; gap: 8px; }
.watch-head .watch-share-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; padding: 0; color: var(--heads); }
#watch-view.in-room .watch-head { justify-content: space-between; margin-bottom: 1rem; }
#watch-view.in-room .watch-head h1 { text-align: left; }

/* Who is in it: one chip each, the starter marked host, declines dimmed */
.watch-chips { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; margin: 0; padding: 0; list-style: none; }
.watch-chip {
    padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); font-size: 0.85rem; overflow-wrap: anywhere;
}
.watch-chip.is-you { border-color: var(--heads); }
.watch-chip.is-declined { color: var(--text-dim); border-style: dashed; background: none; }
.chip-tag { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); }
.watch-chip.is-declined .chip-tag { color: var(--text-dim); }
.watch-chip-note { align-self: center; color: var(--text-dim); font-size: 0.85rem; }
.watch-chip.is-ready { border-color: var(--watch-ok); }
.watch-chip .chip-ok { color: var(--watch-ok); font-weight: 700; }
/* Create Game when every invitee pressed Done adding · Ready (watch.js renderWatchRoom) */
#watch-create-btn.is-all-ready { animation: mn-hurry 1.8s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { #watch-create-btn.is-all-ready { animation: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--heads) 35%, transparent); } }

/* The poster wall: the room's titles as covers, 3 across on a phone; a tap opens the movie's details (movie-info.js) */
.watch-list { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 600px) { .watch-list { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.watch-list li { position: relative; border-radius: 8px; transition: transform 0.12s ease; }
.watch-poster {
    position: relative; display: block; width: 100%; aspect-ratio: 2 / 3; padding: 0; margin: 0; overflow: hidden; cursor: pointer;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font: inherit; text-align: left;
}
div.watch-poster { cursor: default; }
.watch-poster:hover, .watch-poster:focus-visible { border-color: var(--accent); outline: none; }
.watch-poster .watch-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.watch-poster .watch-thumb.is-text { display: grid; place-items: center; font: 700 2.4rem var(--font-display); color: var(--text-dim); background: var(--surface); }
.watch-poster::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, color-mix(in srgb, var(--bg) 92%, transparent)); pointer-events: none; }
.watch-poster .watch-poster-title, .watch-poster .watch-by { position: absolute; left: 7px; right: 7px; z-index: 1; overflow: hidden; }
.watch-poster .watch-poster-title { bottom: 20px; font: 700 0.82rem/1.1 var(--font-display); text-transform: uppercase; letter-spacing: 0.02em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-shadow: 0 1px 4px var(--shadow); }
.watch-poster .watch-by { bottom: 5px; font-size: 0.65rem; white-space: nowrap; text-overflow: ellipsis; }
.watch-remove {
    position: absolute; top: 4px; right: 4px; z-index: 2; min-width: 30px; min-height: 30px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
    background: color-mix(in srgb, var(--bg) 70%, transparent); color: var(--text); font-size: 0.8rem;
}
.watch-remove:hover { color: var(--danger); }
/* Flip for it alone (watch.js spinPosterWall): the lights go round, then the picked one stays lit */
.watch-list li.is-lit .watch-poster { border-color: var(--gold); box-shadow: 0 0 18px color-mix(in srgb, var(--gold) calc(45% * var(--glow)), transparent); }
.watch-list li.is-picked { transform: scale(1.06); z-index: 1; }
.watch-list li.is-picked .watch-poster { border: 2px solid var(--gold); box-shadow: 0 0 30px color-mix(in srgb, var(--gold) calc(70% * var(--glow)), transparent); }
@media (prefers-reduced-motion: reduce) { .watch-list li { transition: none; } }

@keyframes chaos-spin { to { transform: rotate(360deg); } }


/* Titles 3 / 10 over the add box and the list; the hint under Create Game; plain links (.watch-leave) */
.watch-list-head { display: flex; align-items: baseline; justify-content: space-between; width: 100%; margin-bottom: -6px; }
.watch-count { color: var(--text-dim); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
button.action-btn#watch-create-btn { margin-top: 4px; }
/* gold once everyone is Ready; red while its second press would leave someone out (like Begin Shuffling's) */
button.action-btn#watch-create-btn.is-all-ready { background: var(--gold); color: var(--gold-ink); }
button.action-btn#watch-create-btn:disabled { background: var(--surface-2); color: var(--text-dim); }
#watch-room .watch-status { margin-top: -6px; font-size: 0.85rem; }
.watch-leave {
    margin-top: 4px; padding: 6px; background: none; border: 0; border-radius: 6px; cursor: pointer;
    color: var(--text-dim); font: 500 0.85rem var(--font-body); text-decoration: underline; text-underline-offset: 3px;
}
.watch-leave:hover { color: var(--text); }
.mn-later { display: block; margin: 0 auto 6px; }


/* "David started a Movie Night" over the home page and the Library (movie-night-invite.js) */
.invite-banner {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin: 0 0 14px; padding: 8px 10px 8px 14px;
    background: var(--surface); border: 1px solid var(--accent); border-radius: 10px; color: var(--text); font-size: 0.9rem; text-align: left;
}
.invite-banner[hidden] { display: none; }
#invite-banner-text { flex: 1 1 12em; min-width: 0; } /* a phone: Hide · End · Open drop under it, kept right */
.invite-banner .action-btn { flex: none; margin: 0; padding-top: 6px; padding-bottom: 6px; }
.invite-banner-actions { display: flex; gap: 8px; margin-left: auto; }
.invite-banner .action-btn.btn-ghost.armed { border-color: var(--danger); color: var(--danger); }
#pool-view .play-continue { flex: none; margin-bottom: 10px; max-height: 32vh; overflow-y: auto; } /* Movies' Continue: live, scheduled, invites */
.library-scheduled { border-color: var(--tails); } /* a scheduled Movie Night: pick here, Movie Night! starts it (schedule.js) */

/* The invite sheet, Who's coming? (11-16, movie-night-invite.js renderMovieNightPeople): Usual, then Everyone else; one Invite each */
.movie-night-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mn-people-head { margin: 10px 0 2px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.mn-people-head:first-child { margin-top: 0; }
.mn-person { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.mn-face-wrap { position: relative; flex: none; display: inline-flex; }
.mn-status { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface); background: var(--text-dim); }
.mn-status.is-online { background: var(--heads); }
.mn-status.is-livetv { background: var(--gold); }
.mn-status.is-night { background: var(--tails); }
.mn-person-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mn-person-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mn-person-text .mn-name { font-size: 0.95rem; color: var(--text); }
.mn-person-text > span { font-size: 0.78rem; color: var(--text-dim); }
.movie-night-people .action-btn.mn-invite-btn { flex: none; margin: 0; min-height: 0; height: 30px; padding: 0 12px; font-size: 0.85rem; }
/* No one: a slim row under the people, with its roast (pickNoOne) */
.mn-noone {
    display: flex; align-items: center; gap: 10px; width: 100%; margin: 6px 0 0; padding: 6px 0; cursor: pointer;
    background: none; border: 0; color: var(--text-dim); font: 500 0.95rem var(--font-body); text-align: left;
}
.mn-noone > span:first-child { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mn-noone[hidden] { display: none; }
.mn-noone small { color: var(--tails); font: italic 0.8rem var(--font-body); }
.mn-noone:hover, .mn-noone:focus-visible { color: var(--text); outline: none; }

/* The No One roast: a full-screen spotlight on one empty chair */
.mn-alone {
    width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 24px max(20px, env(safe-area-inset-left, 0px)); border: 0;
    flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; color: var(--text);
    background: radial-gradient(ellipse at 50% 32%, color-mix(in srgb, var(--tails) 20%, transparent), var(--bg) 62%);
}
.mn-alone[open] { display: flex; animation: card-in 0.25s ease-out; }
.mn-alone::backdrop { background: var(--bg); }
.mn-alone-spot { display: grid; place-items: center; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--text) 16%, transparent), transparent 66%); }
.mn-alone-chair { position: relative; width: 50px; height: 60px; }
.mn-alone-chair::before { content: ""; position: absolute; left: 7px; right: 7px; top: 0; height: 32px; border-radius: 7px 7px 2px 2px; background: var(--tails); opacity: 0.85; }
.mn-alone-chair::after { content: ""; position: absolute; left: 0; right: 0; top: 30px; height: 13px; border-radius: 3px; background: var(--tails); box-shadow: 5px 13px 0 -3px var(--tails), -5px 13px 0 -3px var(--tails); }
.mn-alone-kick { font: 600 0.75rem var(--font-body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--tails); }
.mn-alone-line { margin: 0; max-width: 22ch; min-height: 3.4em; display: grid; place-items: center; font: 700 1.7rem/1.15 var(--font-display); text-transform: uppercase; text-wrap: balance; }
.mn-alone-again { background: none; border: 0; color: var(--text-dim); font: 500 0.8rem var(--font-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.mn-alone-btns { display: flex; flex-direction: column; gap: 8px; width: min(360px, 100%); }
.mn-alone-btns .action-btn { margin: 0; }
button.action-btn.mn-alone-go { background: var(--tails); color: var(--tails-ink); }



/* TMDB matches under the add box */
.watch-search { list-style: none; margin: -6px 0 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 4px; }
.watch-search[hidden] { display: none; }
.watch-search li { margin: 0; }
.watch-search-result {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; margin: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text);
    font: inherit; text-align: left; cursor: pointer;
}
.watch-search-result:hover, .watch-search-result:focus-visible { border-color: var(--accent); outline: none; }
.watch-search-result img, .watch-search-result .thumb-empty { width: 34px; height: 51px; object-fit: cover; border-radius: 4px; flex: none; }
.watch-search-text { display: flex; flex-direction: column; min-width: 0; }
.watch-search-text .sr-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-search-status { padding: 6px 8px; color: var(--text-dim); font-size: 0.85rem; }
.watch-by { color: var(--text-dim); font-size: 0.75rem; }

/* The small dialogs (account, Who's watching?, + Add) */
.name-dialog { width: min(360px, calc(100vw - 32px)); }
.name-form { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; min-height: 0; overflow-y: auto; } /* scrolls on short screens, so the last buttons stay reachable */
#account-dialog .name-form > *, #account-dialog .profile-sec > * { flex-shrink: 0; } /* the Profile sheet's boxes keep their height and the form scrolls (shrinking clipped its rows; .profile-sec has no box of its own) */
.name-form input { margin: 0; }
.name-text { margin: 0; color: var(--text-dim); font-size: 0.9rem; }
.name-error { margin: 0; min-height: 1.1em; color: var(--error-text); font-size: 0.85rem; }
.name-actions { display: flex; justify-content: flex-end; gap: 8px; }
.name-actions .action-btn { margin-top: 0; }
.name-actions [hidden] { display: none; }
.account-section { display: flex; flex-direction: column; gap: 8px; }
.account-section label { margin: 0; }
.account-section .action-btn { margin-top: 2px; align-self: flex-end; }

.name-form a { color: var(--accent); }

/* Login screen (templates/login.php) */
.login-panel { max-width: 380px; }
.login-form { display: flex; flex-direction: column; width: 100%; }
.login-form input { margin-bottom: 14px; }
.login-error { min-height: 1.2em; margin: 0 0 10px; color: var(--error-text); font-weight: 500; font-size: 0.9rem; text-align: center; }
.login-note { margin-top: 1.25rem; color: var(--text-dim); font-size: 0.85rem; text-align: center; }
.login-note code { font-size: 0.8rem; word-break: break-word; }

/* Who added which title, in an expanded history row */
.history-added { margin: 8px 0 0; font-size: 0.78rem; color: var(--text-dim); }
.history-added b { color: var(--text); font-weight: 600; }

#watch-error { overflow-wrap: anywhere; }

/* Stats page (stats.js). Colours come from the theme tokens. */
.stats-body { width: 100%; display: flex; flex-direction: column; gap: 1rem; text-align: left; }
button.action-btn.stats-retry { display: block; margin: 0.75rem auto 0; }
.stats-message { color: var(--text-dim); font-size: 0.9rem; text-align: center; padding: 2rem 0 0.5rem; }

/* Cards: one per section, like the setup screen's groups */
.stats-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem 1.25rem 1.25rem; min-width: 0; }
.stats-card h2 { font-size: 1.25rem; text-align: left; margin-bottom: 0.75rem; }
.stats-card h3 { font-size: 1rem; color: var(--text); letter-spacing: 0.01em; margin: 1.25rem 0 0.4rem; }
.stats-card h3 + .stats-note { margin-top: -0.3rem; }
.stats-note { font-size: 0.78rem; line-height: 1.45; color: var(--text-dim); margin-bottom: 0.6rem; }
.stats-card > .stats-note:last-child { margin-bottom: 0; }
.stats-empty { font-size: 0.85rem; color: var(--text-dim); padding: 0.3rem 0; }
.stats-empty-card { text-align: center; }
.stats-empty-card h2 { text-align: center; }
.stats-empty-card .stats-note { font-size: 0.88rem; margin-bottom: 0.4rem; }
@media (max-width: 400px) { .stats-card { padding: 1rem; } }

/* Number tiles, two per row */
.stats-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 0.6rem; }
.stats-tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 9px; min-width: 0; }
.stats-tile dt { font-size: 0.7rem; font-weight: 500; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.stats-tile dd { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; line-height: 1.2; color: var(--text); overflow-wrap: anywhere; }
.stats-tile.is-heads dd { color: var(--heads); }
.stats-tile.is-tails dd { color: var(--tails); }
.stats-unit { font-family: var(--font-body); font-size: 0.78rem; font-weight: 500; color: var(--text-dim); margin-left: 4px; }

/* Coin bias bar: the Heads share in the Heads colour, the rest in Tails, a line at 50% */
.stats-bias-labels, .stats-bias-counts { display: flex; justify-content: space-between; gap: 10px; }
.stats-bias-labels { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.stats-bias-labels .is-heads { color: var(--heads); }
.stats-bias-labels .is-tails { color: var(--tails); }
.stats-bias { position: relative; display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.stats-bias-heads { flex: none; background: var(--heads); }
.stats-bias-tails { flex: 1; background: var(--tails); }
.stats-bias::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--bg); }
.stats-bias-counts { font-size: 0.75rem; color: var(--text-dim); margin: 5px 0 0.6rem; }

/* Longest Heads / Tails streaks */
.stats-streaks { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.stats-streaks li, .stats-feature {
    display: flex; align-items: center; gap: 10px; min-width: 0;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
.stats-streak-len { flex: none; min-width: 2ch; font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; line-height: 1; text-align: center; }
.stats-streaks .is-heads .stats-streak-len { color: var(--heads); }
.stats-streaks .is-tails .stats-streak-len { color: var(--tails); }
.stats-streak-info, .stats-feature-info { flex: 1; min-width: 0; }
.stats-streak-what, .stats-feature-title { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.stats-streak-meta { font-size: 0.75rem; line-height: 1.35; color: var(--text-dim); margin-top: 1px; overflow-wrap: anywhere; }
.stats-feature-title { overflow-wrap: anywhere; }
.stats-feature .stats-note { margin: 1px 0 0; }
.stats-link {
    flex: none; height: 26px; padding: 0 10px; border-radius: 13px; display: inline-flex; align-items: center;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font-size: 0.75rem; text-decoration: none; white-space: nowrap; transition: border-color 0.15s, color 0.15s;
}
.stats-link:hover { border-color: var(--accent); color: var(--accent); }

/* Movie Night players (stats.js statsPlayers): seven number columns, scrolled sideways on a phone */
.stats-table-scroll { overflow-x: auto; margin-top: 10px; }
.stats-table.stats-players { min-width: 640px; }
.stats-table.stats-players thead th:first-child { width: 8.5rem; }
.stats-table.stats-players thead th.stats-num { width: auto; }
.stats-roast { font-style: italic; }

/* Ranked title tables: rank, poster, title (cut short with …), then the numbers */
.stats-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.85rem; }
.stats-table th, .stats-table td { padding: 6px 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.stats-table tbody tr:last-child > * { border-bottom: 0; }
.stats-table thead th {
    padding-top: 0; font-size: 0.68rem; font-weight: 500; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.05em; text-align: left;
}
.stats-table thead th.stats-num { width: 3.4rem; text-align: right; }
.stats-table tbody th { text-align: left; font-weight: 500; color: var(--text); }
.stats-table td { text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats-table td.is-key { color: var(--text); font-weight: 600; }
.stats-table td.is-heads { color: var(--heads); }
.stats-table td.is-tails { color: var(--tails); }
.stats-name-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.stats-rank { flex: none; width: 1.3em; text-align: right; font-size: 0.75rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
/* Title over at most two lines, with the "still going" tag under it */
.stats-name-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.stats-name {
    max-width: 100%; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
    overflow: hidden; overflow-wrap: break-word; hyphens: auto; line-height: 1.3;
}
.stats-pill {
    flex: none; padding: 1px 6px; border: 1px solid var(--gold); border-radius: 999px;
    font-size: 0.65rem; font-weight: 600; color: var(--gold); white-space: nowrap;
}
.stats-thumb {
    flex: none; width: 24px; height: 36px; border-radius: 3px; border: 1px solid var(--border);
    background: var(--surface-2) center / cover no-repeat;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-size: 0.8rem; color: var(--text-dim);
}
.stats-thumb.no-cover { gap: 0; }
.stats-thumb.no-cover::before { font-size: 0.75rem; }
.stats-feature .stats-thumb { width: 32px; height: 48px; border-radius: 4px; }
.stats-feature .stats-thumb.no-cover::before { font-size: 1rem; }

/* Head-to-head: "A 3–1 B", the leader first and brighter */
.stats-h2h { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.stats-h2h li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px 7px; }
.stats-h2h-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; font-size: 0.85rem; }
.stats-h2h-a, .stats-h2h-b {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
    overflow: hidden; overflow-wrap: anywhere; line-height: 1.3;
}
.stats-h2h-a { text-align: right; color: var(--text); font-weight: 600; }
.stats-h2h-b { text-align: left; color: var(--text-dim); }
.stats-h2h .is-level .stats-h2h-b { color: var(--text); font-weight: 600; }
.stats-h2h-score { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stats-h2h-met { text-align: center; font-size: 0.7rem; color: var(--text-dim); margin-top: 3px; }

/* Winner card (winner.js). Colours come from the theme tokens. */
.winner-card {
    width: 100%; max-width: 420px; margin: 18px auto 0; padding: 14px 16px; text-align: left;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    border-top: 3px solid var(--winner-side, var(--accent));
}
.winner-card[hidden] { display: none; }
.winner-link { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.winner-link-form { display: flex; gap: 8px; }
.winner-link-form input { flex: 1; min-width: 0; margin: 0; }
.winner-link-form button, .winner-link > .action-btn { margin-top: 0; }
.winner-link .watch-search { margin: 0; }

/* Marquee lights around the final pick's poster (they replace its spinning border): every third bulb lit. Off bulbs every
   12px, lit bulbs every 36px; a round every 2 s (11-20): three hops 0.22 s apart (the lit layers step 12px), then a rest.
   A coin gets round bulbs instead (built by ensureMarqueeBulbs in winner.js), lit with a glow (none on the TV, --glow 0),
   as Tonight's pick's are (night-ended.js nightBulbs): phase 0 (every third bulb from the first) is lit at the start and
   through the rest, phase 1 for the first hop, phase 2 for the second. */
.flip-container:not(:has(.coin-mode)).match_winner.marquee::before {
    inset: -12px; border-radius: 0;
    --bulb-off: radial-gradient(circle, var(--marquee-off) 2.5px, transparent 3px);
    --bulb-on: radial-gradient(circle, var(--marquee-on) 3px, transparent 3.5px);
    background:
        var(--bulb-on) 0 0 / 36px 12px repeat-x, var(--bulb-on) 0 100% / 36px 12px repeat-x,
        var(--bulb-on) 0 0 / 12px 36px repeat-y, var(--bulb-on) 100% 0 / 12px 36px repeat-y,
        var(--bulb-off) 0 0 / 12px 12px repeat-x, var(--bulb-off) 0 100% / 12px 12px repeat-x,
        var(--bulb-off) 0 0 / 12px 12px repeat-y, var(--bulb-off) 100% 0 / 12px 12px repeat-y;
    animation: marquee-hop 2s step-end infinite;
}
.flip-container:has(.coin-mode).match_winner.marquee::before { display: none; }
.marquee-bulbs { display: none; position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.flip-container:has(.coin-mode).match_winner.marquee .marquee-bulbs { display: block; }
.marquee-bulbs i {
    position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--marquee-off);
    transform: rotate(var(--a)) translateY(calc(var(--coin-size) / -2 - 9px));
}
@keyframes marquee-hop {
    0% { background-position: 0 0, 0 100%, 0 0, 100% 0, 0 0, 0 100%, 0 0, 100% 0; }
    11% { background-position: 12px 0, -12px 100%, 0 -12px, 100% 12px, 0 0, 0 100%, 0 0, 100% 0; }
    22% { background-position: 24px 0, -24px 100%, 0 -24px, 100% 24px, 0 0, 0 100%, 0 0, 100% 0; }
    33%, 100% { background-position: 36px 0, -36px 100%, 0 -36px, 100% 36px, 0 0, 0 100%, 0 0, 100% 0; }
}
:is(.marquee-bulbs, .mne-bulbs) { --bulb-big: 1;
    --bulb-glow: 0 0 4px 1px color-mix(in srgb, var(--marquee-on) calc(80% * var(--glow)), transparent), 0 0 11px 2px color-mix(in srgb, var(--marquee-on) calc(35% * var(--glow)), transparent); }
:is(.marquee-bulbs, .mne-bulbs) i { animation: bulb-hop-0 2s step-end infinite; }
:is(.marquee-bulbs, .mne-bulbs) i:nth-child(3n+2) { animation-name: bulb-hop-1; }
:is(.marquee-bulbs, .mne-bulbs) i:nth-child(3n) { animation-name: bulb-hop-2; }
@keyframes bulb-hop-0 {
    0%, 33%, 100% { background: var(--marquee-on); scale: var(--bulb-big); box-shadow: var(--bulb-glow); }
    11% { background: var(--marquee-off); scale: 1; box-shadow: none; }
}
@keyframes bulb-hop-1 { 11% { background: var(--marquee-on); scale: var(--bulb-big); box-shadow: var(--bulb-glow); } 0%, 22%, 100% { background: var(--marquee-off); scale: 1; box-shadow: none; } }
@keyframes bulb-hop-2 { 22% { background: var(--marquee-on); scale: var(--bulb-big); box-shadow: var(--bulb-glow); } 0%, 33%, 100% { background: var(--marquee-off); scale: 1; box-shadow: none; } }
/* Reduce motion (the device's setting or the admin's switch: html.reduce-motion, arena.js) and the TV: still, every third
   bulb lit (Tonight's pick's bulbs too) */
html.reduce-motion :is(.marquee-bulbs, .mne-bulbs) i, html.tv .mne-bulbs i { animation: none; }
html.reduce-motion :is(.marquee-bulbs, .mne-bulbs) i:nth-child(3n+1), html.tv .mne-bulbs i:nth-child(3n+1) { background: var(--marquee-on); }
html.reduce-motion .flip-container.match_winner.marquee::before, html.tv .flip-container.match_winner.marquee::before { animation: none; }
.winner-card.is-heads { --winner-side: var(--heads); }
.winner-card.is-tails { --winner-side: var(--tails); }
.winner-kicker { margin: 0; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--winner-side, var(--accent)); font-weight: 600; }
/* "Agreed 1–1" beside Tonight's pick: a pill with a heads-to-tails border */
.agreed-tag {
    display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; vertical-align: 1px;
    border: 1px solid transparent; color: var(--text); font-size: 0.68rem; letter-spacing: 0.06em;
    background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(90deg, var(--heads), var(--tails)) border-box;
}
.winner-title { margin: 2px 0 2px; font-family: var(--font-display); font-size: 1.35rem; line-height: 1.2; overflow-wrap: anywhere; }
.winner-meta { margin: 0; color: var(--text-dim); font-size: 0.85rem; }
.winner-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.winner-score { font-weight: 600; color: var(--gold); font-size: 0.9rem; }
.winner-trailer {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 600;
    color: var(--text); text-decoration: none; border: 1px solid var(--border); background: var(--surface-2);
}
.winner-trailer::before { content: ''; width: 0; height: 0; margin-right: 6px; border-style: solid; border-width: 4.5px 0 4.5px 7px; border-color: transparent transparent transparent currentColor; }
.winner-trailer:hover, .winner-trailer:focus-visible { border-color: var(--winner-side, var(--accent)); outline: none; }
.winner-overview {
    margin: 10px 0 0; color: var(--text-soft); font-size: 0.85rem; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.winner-watch { display: none; /* hidden everywhere (David 11-09): still built from the TMDB answer, only not shown */ margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.winner-watch-title { margin: 0 0 6px; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; }
.winner-watch-none { margin: 0; color: var(--text-dim); font-size: 0.85rem; }
.winner-watch-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.winner-watch-label { flex: 0 0 44px; font-size: 0.78rem; color: var(--text-dim); }
.winner-providers { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.winner-provider { width: 30px; height: 30px; border-radius: 7px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.winner-provider img { display: block; width: 100%; height: 100%; object-fit: cover; }
.winner-provider.no-logo, .winner-provider.more {
    width: auto; min-width: 30px; padding: 0 6px; display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; color: var(--text-dim);
}
.winner-credit { margin: 8px 0 0; font-size: 0.72rem; color: var(--text-dim); }
.winner-credit a { color: var(--text-soft); }

/* ---------- Movie info: the ⓘ on a Library card and its sheet ---------- */
.movie-info-btn {
    position: absolute; top: calc(var(--cover-h, 190px) - 30px); right: 6px; z-index: 1; /* the cover's bottom corner: the top one is the draft ✓ */
    width: 24px; height: 24px; padding: 0; border-radius: 50%; cursor: pointer;
    font: italic 700 0.85rem/1 Georgia, serif; color: var(--overlay-ink);
    background: var(--card-overlay); border: 1px solid color-mix(in srgb, var(--overlay-ink) 35%, transparent);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--shadow) 55%, transparent);
    display: flex; align-items: center; justify-content: center;
}
.movie-info-btn::before { content: ""; position: absolute; inset: -8px; } /* a bigger tap area than the icon */
.movie-info-btn:hover, .movie-info-btn:focus-visible { border-color: var(--accent); outline: none; }
.movie-info-dialog { width: min(640px, calc(100vw - 32px)); max-height: min(88vh, 860px); }
.movie-info-dialog .match-log-head {
    background: linear-gradient(color-mix(in srgb, var(--surface) 70%, transparent), var(--surface)), var(--movie-info-backdrop, none) center / cover;
    min-height: 64px; align-items: flex-end;
}
.movie-info-body { padding-bottom: 16px; }
.movie-info-loading { color: var(--text-dim); margin: 8px 0; }
.movie-info-top { display: flex; gap: 14px; align-items: flex-start; }
.movie-info-poster { width: 96px; flex: none; border-radius: 8px; box-shadow: 0 4px 14px color-mix(in srgb, var(--shadow) 50%, transparent); }
.movie-info-head { min-width: 0; }
.movie-info-meta, .movie-info-genres { margin: 0 0 4px; color: var(--text-dim); font-size: 0.88rem; }
.movie-info-tagline { margin: 14px 0 0; font-style: italic; color: var(--text-soft); }
.movie-info-overview { margin: 8px 0 0; color: var(--text-soft); line-height: 1.5; font-size: 0.92rem; }
.movie-info-people { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 14px 0 0; font-size: 0.88rem; }
.movie-info-people dt { color: var(--text-dim); }
.movie-info-people dd { margin: 0; }
/* From a Movie Night room's poster: the trailer plays in the sheet, then who added it and Take it out */
.movie-info-trailer {
    position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; margin: 14px 0 0; padding: 0; overflow: hidden; cursor: pointer;
    background: var(--surface-2) var(--trailer-still, none) center / cover no-repeat; border: 1px solid var(--border); border-radius: 10px; color: var(--text);
}
.movie-info-trailer.is-playing { cursor: default; background: var(--bg); }
.movie-info-trailer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.movie-info-play { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: var(--heads);
    box-shadow: 0 0 22px color-mix(in srgb, var(--heads) calc(50% * var(--glow)), transparent); }
.movie-info-play::after { content: ""; position: absolute; left: 22px; top: 17px; border-left: 17px solid var(--heads-ink); border-top: 11px solid transparent; border-bottom: 11px solid transparent; }
.movie-info-trailer:hover .movie-info-play, .movie-info-trailer:focus-visible .movie-info-play { transform: scale(1.08); }
.movie-info-trailer-cap { position: absolute; left: 10px; bottom: 8px; font: 600 0.78rem var(--font-body); text-shadow: 0 1px 4px var(--shadow); }
.movie-info-room { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 0; color: var(--text-dim); font-size: 0.85rem; }
.movie-info-remove { background: none; border: 0; padding: 6px 0; color: var(--tails); font: 600 0.85rem var(--font-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
/* The Library's foot: added by, watched by, then Mine / Give to… / Hide */
.movie-info-library { flex-wrap: wrap; row-gap: 4px; }
.movie-info-watched-by { flex-basis: 100%; order: 1; font-size: 0.8rem; }
.movie-info-library-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.movie-info-library-actions .movie-info-remove { color: var(--accent); }
.movie-info-library-actions .movie-info-remove:last-child { color: var(--tails); }
.movie-info-give {
    width: auto; margin: 0; padding: 4px 8px; font: inherit; font-size: 0.8rem;
    color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
}
/* Can play: the Plex line, and the admin's Search Plex (a title box, then one row per file found) */
.movie-info-plex { display: grid; gap: 6px; margin-top: 8px; }
.movie-info-plex-search .movie-info-remove { color: var(--accent); }
.movie-info-plex-form { display: flex; gap: 8px; }
.movie-info-plex-form input { flex: 1; min-width: 0; padding: 6px 10px; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; }
.movie-info-plex-form button { padding: 6px 14px; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.movie-info-plex-results { display: grid; gap: 4px; margin-top: 6px; }
.movie-info-plex-hit {
    padding: 8px 10px; text-align: left; font: inherit; font-size: 0.85rem; color: var(--text); cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
}
.movie-info-plex-hit:hover, .movie-info-plex-hit:focus-visible { border-color: var(--accent); outline: none; }
.movie-info-plex-hit:disabled { opacity: 0.5; cursor: default; }
@media (max-width: 600px) {
    .movie-info-dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 14px 14px 0 0; max-height: 90vh; }
    .movie-info-poster { width: 76px; }
}

.winner-tonight { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.winner-tonight-ask { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 500; }
.winner-tonight-ask[hidden], .winner-rate[hidden] { display: none; }
.winner-btn {
    padding: 6px 14px; border-radius: 999px; border: 1px solid var(--winner-side, var(--accent)); cursor: pointer;
    background: transparent; color: var(--text); font: inherit; font-size: 0.85rem; font-weight: 600; white-space: nowrap;
}
.winner-btn:hover, .winner-btn:focus-visible { background: var(--winner-side, var(--accent)); color: var(--bg); outline: none; }
.winner-btn:disabled { opacity: 0.5; cursor: default; }
.winner-rate { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; }
.winner-rate label { grid-column: 1 / -1; font-size: 0.85rem; color: var(--text-dim); }
.winner-rate-row { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 5em; align-items: center; gap: 12px; }
.winner-rate-value { color: var(--row-color); font-weight: 700; text-align: right; }
.rate-after-dialog { width: min(420px, calc(100vw - 32px)); }
.schedule-dialog { width: min(420px, calc(100vw - 32px)); }
.schedule-body { padding: 16px; display: grid; gap: 8px; }
.schedule-body input[type="datetime-local"] { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; color-scheme: light dark; }
.schedule-label { margin: 6px 0 0; font-weight: 600; }
.schedule-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 40vh; overflow-y: auto; }
.schedule-people label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.continue-card.is-scheduled { border-color: var(--heads); }
.rate-after-body { padding: 16px; display: grid; gap: 10px; }
.rate-after-body input[type="range"] { width: 100%; accent-color: var(--row-color); }
.rate-after-actions { display: flex; justify-content: flex-end; gap: 8px; }
.winner-rate-value.none { color: var(--text-dim); font-weight: 500; font-size: 0.8rem; }
.winner-rate input[type="range"] { width: 100%; accent-color: var(--row-color); }
.winner-rate-note { grid-column: 1; margin: 0; font-size: 0.75rem; color: var(--text-dim); }
.winner-rate .winner-btn { grid-column: 2; }
.winner-tonight-done { margin: 0; color: var(--winner-side, var(--accent)); font-weight: 500; font-size: 0.9rem; }

/* With Watch Together under it, the game above celebrates for about 12 s and then stands still: these loops repaint
   every frame (a conic-gradient turned through a custom property never runs on the GPU), which kept viewers' phones and
   laptops hot for the whole movie. Each count ends on its first frame, so nothing jumps when it stops. */
#arena-view:has(#watch-party:not([hidden])) .flip-container.match_winner::before { animation-iteration-count: 5; }
#arena-view:has(#watch-party:not([hidden])) .flip-container.match_winner.marquee::before,
#arena-view:has(#watch-party:not([hidden])) .marquee-bulbs i { animation-iteration-count: 6; }
#arena-view:has(#watch-party:not([hidden])) .sd-shine { animation-iteration-count: 4; }
#arena-view:has(#watch-party:not([hidden])) .sd-sparkles i { animation-iteration-count: 7; }
#arena-view:has(#watch-party:not([hidden])) .flip-container.rig-static:not(.rig-glitch),
#arena-view:has(#watch-party:not([hidden])) .flip-container.rig-static:not(.rig-glitch) .face::after { animation-iteration-count: 7; }

/* Watch Together under a Movie Night winner (watchparty.js). Colours come from the theme tokens. One card: the player (the
   movie here, or where you watch it) with its controls on it, then a status line, who is watching and where you watch. */
.watch-party {
    width: 100%; max-width: 480px; margin: 12px auto 0; padding: 14px 16px; text-align: left;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    display: flex; flex-direction: column; gap: 10px; overflow: hidden;
}
.watch-party[hidden], .watch-party [hidden] { display: none; }
.watch-party .action-btn { margin-top: 0; }
#watch-party-live { display: flex; flex-direction: column; gap: 12px; }
.watch-party-live-tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border: 1px solid var(--tails); border-radius: 6px; color: var(--tails); font-size: 0.75rem; font-weight: 600; }
.watch-party-live-tag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--tails); }
.watch-party-note { margin: 0; color: var(--text-dim); font-size: 0.85rem; min-height: 1.2em; }
/* TVs at home lists (the admin's, in the sheet) */
.watch-party-viewers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.watch-party-viewers li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-size: 0.88rem; }
.watch-party-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-party-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--watch-wait); }
.watch-party-dot.is-ok { background: var(--watch-ok); }
.watch-party-dot.is-bad { background: var(--watch-bad); }
.watch-party-dot.is-paused { background: var(--tails); }

/* The player: edge to edge in the card, 16:9; the controls sit on it */
.watch-party-stage { position: relative; margin: 0 -16px; aspect-ratio: 16 / 9; background: var(--video-bg); color: var(--video-text); overflow: hidden; user-select: none; }
.watch-party-stage:fullscreen { margin: 0; width: 100vw; height: 100vh; aspect-ratio: auto; }
.watch-party-stage:-webkit-full-screen { margin: 0; width: 100vw; height: 100vh; }
/* An iPhone's full screen (watchPartyFill()): the stage over the whole window, the picture and controls clear of the notch */
.watch-party-stage.is-filled { position: fixed; inset: 0; z-index: 1000; margin: 0; aspect-ratio: auto; }
.watch-party-stage.is-filled .watch-party-player-box, .watch-party-stage.is-filled .watch-party-controls {
    inset: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
html.watch-party-filled, html.watch-party-filled body { overflow: hidden; }
.watch-party-player-box { position: absolute; inset: 0; }
.watch-party-video { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--video-bg); }
.watch-party-video[hidden] { display: none; }
/* a copy loading behind the one still playing (watchparty.js watchPartyHandoffStart): out of sight until it takes over */
.watch-party-video.is-standby { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.watch-party-player-box.is-cast .watch-party-video { visibility: hidden; } /* the picture is on the TV */
.watch-party-tap { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 3; }
.watch-party-remote { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 16px 0; text-align: center;
    background: var(--surface-2); color: var(--text); }
.watch-party-remote svg { color: var(--heads); }
.watch-party-remote-where { font-weight: 600; font-size: 0.92rem; overflow-wrap: anywhere; }
.watch-party-remote-sub { color: var(--text-dim); font-size: 0.8rem; }
/* Casting to <TV> (cast.js castCardRender): the TV's name and state, its volume, then Subtitles, Quality, Sound, Stop casting */
.watch-party-castcard { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 4px; background: var(--surface-2); color: var(--text); }
.watch-party-castcard[hidden], .watch-party-stage.is-castcard .watch-party-player-box { display: none; }
.watch-party-stage.is-castcard .watch-party-controls { background: none; }
.castcard-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.castcard-title { flex: 1; min-width: 0; font-weight: 600; font-size: 0.92rem; overflow-wrap: anywhere; }
.castcard-state { flex: none; color: var(--text-dim); font-size: 0.8rem; }
.castcard-volume { display: flex; align-items: center; gap: 8px; }
.castcard-slider { flex: 1; min-width: 0; accent-color: var(--heads); }
.castcard-mute .icon-muted, .castcard-mute.is-muted .icon-sound { display: none; }
.castcard-mute.is-muted .icon-muted { display: block; }
.castcard-mute:disabled { opacity: 0.5; cursor: default; }
.castcard-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.castcard-row .watch-party-seg { flex: 0 0 auto; }
.castcard-row .watch-party-seg button { flex: 0 0 auto; height: 30px; padding: 0 10px; }
.castcard-row .watch-party-seg button:disabled[aria-pressed="true"] { opacity: 1; }
.castcard-row .watch-party-pill[hidden], .castcard-row .watch-party-seg[hidden] { display: none; }
.watch-party-controls { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; justify-content: space-between; transition: opacity 0.25s; }
.watch-party-player-box:not([hidden]) ~ .watch-party-controls { background: linear-gradient(var(--video-shade), transparent 30%, transparent 55%, var(--video-shade)); }
.watch-party-stage.is-idle { cursor: none; }
.watch-party-stage.is-idle .watch-party-controls { opacity: 0; pointer-events: none; }
.watch-party-stage.is-loading .watch-party-bar-mid { visibility: hidden; }
.watch-party-bar-top { display: flex; padding: 10px 12px 0; min-height: 30px; }
.watch-party-chip { padding: 3px 8px; border-radius: 6px; background: var(--video-shade); font-size: 0.72rem; font-weight: 600; }
.watch-party-bar-mid { display: flex; align-items: center; justify-content: center; gap: 30px; }
/* As a remote (the picture is on a TV, a Plex app or nowhere yet) the card grows to fit: where it plays, then the controls */
.watch-party-stage.is-remote { aspect-ratio: auto; display: flex; flex-direction: column; padding-bottom: 4px; background: var(--surface-2); color: var(--text); }
.watch-party-stage.is-remote .watch-party-remote { position: static; padding-bottom: 4px; }
.watch-party-stage.is-remote .watch-party-controls { position: static; gap: 10px; }
.watch-party-stage.is-remote .watch-party-bar-top { display: none; }
.watch-party-round { position: relative; display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 0; cursor: pointer;
    border-radius: 50%; border: 1px solid transparent; background: var(--video-shade); color: var(--video-text); }
.watch-party-remote:not([hidden]) ~ .watch-party-controls .watch-party-round, .watch-party-castcard:not([hidden]) ~ .watch-party-controls .watch-party-round { background: var(--surface); border-color: var(--border); color: var(--text); }
.watch-party-round-n { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -38%); font-size: 0.56rem; font-weight: 700; }
.watch-party-round.watch-party-play, .watch-party-remote:not([hidden]) ~ .watch-party-controls .watch-party-play, .watch-party-castcard:not([hidden]) ~ .watch-party-controls .watch-party-play { width: 60px; height: 60px; background: var(--heads); color: var(--heads-ink); border-color: transparent; }
.watch-party-play .icon-pause, .watch-party-play.is-playing .icon-play { display: none; }
.watch-party-play.is-playing .icon-pause { display: block; }
.watch-party-round:disabled { opacity: 0.6; cursor: default; }
.watch-party-round[hidden] { display: none; }
.watch-party-bar-bottom { display: flex; flex-direction: column; gap: 2px; padding: 0 12px 6px; }
.watch-party-remote:not([hidden]) ~ .watch-party-controls .watch-party-bar-bottom, .watch-party-castcard:not([hidden]) ~ .watch-party-controls .watch-party-bar-bottom { color: var(--text); }
.watch-party-bar-row { display: flex; align-items: center; gap: 2px; }
.watch-party-time { flex: 1; font-size: 0.78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.watch-party-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; cursor: pointer;
    border: none; border-radius: 8px; background: transparent; color: inherit; font: inherit; }
.watch-party-icon:hover { background: var(--video-shade); }
/* Stream details (the switch in the settings sheet): what plays, how the download and conversion go, the buffer; over the picture, top left */
/* (it stops above the bottom bar; its own ✕ closes it) */
.watch-party-debug { position: absolute; top: 8px; left: 8px; z-index: 3; max-width: calc(100% - 16px); max-height: calc(100% - 78px); overflow: auto; margin: 0;
    padding: 4px 4px 8px 10px; border-radius: 8px; background: var(--video-shade); color: var(--video-text); display: flex; flex-direction: row-reverse; align-items: flex-start; gap: 4px;
    font-size: 0.7rem; font-variant-numeric: tabular-nums; line-height: 1.35; pointer-events: auto; }
.watch-party-debug[hidden] { display: none; }
.watch-party-debug dl { flex: 1; min-width: 0; margin: 4px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; }
.watch-party-debug-close { position: sticky; top: 0; flex: none; width: 28px; height: 28px; font-size: 0.85rem; color: var(--video-text); }
.watch-party-debug dt { opacity: 0.7; white-space: nowrap; }
.watch-party-debug dd { margin: 0; overflow-wrap: anywhere; }
.watch-party-icon[aria-pressed="true"] { background: var(--video-shade); }
/* The bar: where everyone is (--played) and how far the picture is ready (--ready) */
.watch-party-scrub { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 0; padding: 0; background: transparent; cursor: pointer; }
.watch-party-scrub::-webkit-slider-runnable-track { height: 4px; border-radius: 2px;
    background: linear-gradient(to right, var(--heads) var(--played, 0%), var(--video-text) var(--played, 0%), var(--video-text) var(--ready, 0%), var(--video-track) var(--ready, 0%)); }
.watch-party-scrub::-moz-range-track { height: 4px; border-radius: 2px;
    background: linear-gradient(to right, var(--heads) var(--played, 0%), var(--video-text) var(--played, 0%), var(--video-text) var(--ready, 0%), var(--video-track) var(--ready, 0%)); }
.watch-party-scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border: none; border-radius: 50%; background: var(--heads); }
.watch-party-scrub::-moz-range-thumb { width: 14px; height: 14px; border: none; border-radius: 50%; background: var(--heads); }
.watch-party-scrub:focus-visible { outline: none; }
.watch-party-scrub:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-dim); }

/* Under the player: who is watching, a card each (the people row opens them: watchparty-page.js) */
.watch-party-people { list-style: none; margin: 0; padding: 0 0 2px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.watch-party-people::-webkit-scrollbar { display: none; }
.watch-party-people li { flex: 1 0 104px; max-width: 160px; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 9px 10px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; font-size: 0.8rem; }
.watch-party-people li.is-wait { border-color: color-mix(in srgb, var(--watch-wait) 60%, var(--border)); }
.watch-party-people li.is-bad { border-color: color-mix(in srgb, var(--watch-bad) 60%, var(--border)); }
.watch-party-people li.watch-party-empty { flex: 1; max-width: none; color: var(--text-dim); text-align: center; }
.watch-party-person-top { display: flex; align-items: center; justify-content: space-between; }
.watch-party-face { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; font-size: 0.72rem; font-weight: 700; }
.watch-party-face.is-heads { background: var(--heads); color: var(--heads-ink); }
.watch-party-face.is-tails { background: var(--tails); color: var(--tails-ink); }
.watch-party-face.is-gold { background: var(--gold); color: var(--gold-ink); }
.watch-party-person-name { font-weight: 600; font-size: 0.86rem; }
.watch-party-person-where, .watch-party-person-status { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-party-people li.is-wait .watch-party-person-status { color: var(--watch-wait); }
.watch-party-people li.is-bad .watch-party-person-status { color: var(--watch-bad); }

/* The settings sheet: from the bottom on phones, a dialog from 600px */
.watch-party-sheet { margin: auto 0 0; padding: 0; width: 100%; max-width: 100%; max-height: 82vh; background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-bottom: none; border-radius: 18px 18px 0 0; overflow: hidden; }
.watch-party-sheet[open] { display: flex; flex-direction: column; animation: dialog-in 0.22s cubic-bezier(0.25, 1, 0.5, 1); }
.watch-party-sheet::backdrop { background: var(--backdrop); }
@media (min-width: 600px) { .watch-party-sheet { margin: auto; width: min(440px, calc(100vw - 32px)); border-bottom: 1px solid var(--border); border-radius: 14px; } }
.watch-party-sheet-head { display: flex; align-items: center; gap: 6px; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--border); }
.watch-party-sheet-close { flex: none; color: var(--text-dim); }
.watch-party-sheet-close:hover { background: var(--surface-2); }
.watch-party-sheet-body { padding: 14px 16px 18px; overflow-y: auto; }
/* The Watch tab is one list: where, Quality, Audio, Subtitles, each its own section */
.watch-party-join.in-sheet > [data-tab="watch"]:not(:first-child):not([hidden]):not(.is-off-tab):not(.action-btn) { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
/* What the video waits on (finding the server, loading, buffering), over the picture */
.watch-party-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    padding: 12px; text-align: center; color: var(--video-text); background: var(--video-shade); font-size: 0.9rem; pointer-events: none; z-index: 1; }
.watch-party-loading.is-quiet { justify-content: flex-start; padding-top: 40px; background: none; font-weight: 600; }
.watch-party-stage.is-loading .watch-party-loading { z-index: 3; }
.watch-party-loading .action-btn { pointer-events: auto; }
.watch-party-spinner, .watch-party-refresh.is-busy::after { width: 28px; height: 28px; border: 3px solid var(--video-track); border-top-color: var(--video-text);
    border-radius: 50%; animation: watch-spin 0.9s linear infinite; }
button.watch-party-refresh.is-busy { color: transparent; position: relative; }
.watch-party-refresh.is-busy::after { content: ''; position: absolute; top: 50%; left: 50%; width: 14px; height: 14px; margin: -9px 0 0 -9px;
    border-color: var(--border); border-top-color: var(--text-dim); }
/* Another Quality on its way while this one plays, or the room held at a jump (watchPartySwitchRender): a card in the
   middle of the picture (from → to, a spinner and the step, a thin bar), up by the top edge while the controls show, never faded */
.watch-party-switching { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 3; display: flex; flex-direction: column;
    align-items: center; gap: 6px; width: max-content; max-width: calc(100% - 24px); padding: 10px 18px 12px; border-radius: 14px; background: color-mix(in srgb, var(--shadow) 72%, transparent);
    border: 1px solid var(--video-track); box-shadow: 0 6px 24px color-mix(in srgb, var(--shadow) 45%, transparent); color: var(--video-text); font-size: 0.85rem; font-weight: 600;
    text-align: center; pointer-events: none; transition: top 0.25s, transform 0.25s; }
.watch-party-stage:not(.is-idle) .watch-party-switching { top: 12px; transform: translate(-50%, 0); }
.watch-party-switching-head { font-size: 1.15rem; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; }
.watch-party-switching-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.watch-party-switching .watch-party-spinner { flex: none; width: 16px; height: 16px; border-width: 2px; }
.watch-party-switching .watch-party-bar { width: 100%; min-width: 160px; }
.watch-party-stage.is-loading .watch-party-switching, .watch-party-stage.is-prepping .watch-party-switching { display: none; }
@media (max-width: 480px) { .watch-party-switching { padding: 7px 12px 9px; font-size: 0.78rem; } .watch-party-switching-head { font-size: 1rem; } }
/* A thin bar under a busy card: how far along (its inner width), or a sliver running along it while that isn't known */
.watch-party-bar { position: relative; display: block; height: 3px; border-radius: 2px; background: var(--video-track); overflow: hidden; }
.watch-party-bar[hidden] { display: none; }
.watch-party-bar > span { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 2px; background: var(--video-text); transition: width 0.4s; }
.watch-party-bar.is-running > span { width: 35%; transition: none; animation: watch-bar 1.4s ease-in-out infinite; }
@keyframes watch-bar { from { left: -35%; } to { left: 100%; } }
/* From the Watch Together press until the picture shows (watchPartyPrepRender): a card where the player goes */
.watch-party-prep { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: hidden;
    background: var(--video-bg); color: var(--video-text); }
.watch-party-prep-bg { position: absolute; inset: -24px; background: center / cover no-repeat; filter: blur(18px) brightness(0.35); }
.watch-party-prep-card { position: relative; display: flex; align-items: center; gap: 16px; max-width: 100%; }
.watch-party-prep-poster { flex: none; width: clamp(56px, 18vw, 120px); aspect-ratio: 2 / 3; border-radius: 8px; background: var(--surface-2) center / cover no-repeat;
    box-shadow: 0 6px 20px color-mix(in srgb, var(--shadow) 50%, transparent); }
.watch-party-prep-poster[hidden] { display: none; }
.watch-party-prep-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; width: clamp(150px, 40vw, 280px); }
.watch-party-prep-title { font-size: 1.1rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.watch-party-prep-step { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; }
.watch-party-prep-step .watch-party-spinner { flex: none; width: 16px; height: 16px; border-width: 2px; }
/* Prepping as a remote (just pressed Watch together, or switching here from a TV): the player's place, with the card only */
.watch-party-stage.is-prepping.is-remote { display: block; aspect-ratio: 16 / 9; padding: 0; background: var(--video-bg); }
.watch-party-stage.is-prepping.is-remote > :not(.watch-party-prep) { display: none; }
#watch-party-live.is-starting > :not(.watch-party-stage), #watch-party-live.is-starting .watch-party-stage > :not(.watch-party-prep) { display: none; }
@media (max-width: 480px) { .watch-party-prep-title { font-size: 0.98rem; } .watch-party-prep-step { font-size: 0.8rem; } }
@keyframes watch-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .watch-party-spinner, .watch-party-refresh.is-busy::after { animation-duration: 3s; } .watch-party-bar.is-running > span { animation-duration: 4s; } }
.watch-party-join { display: flex; flex-direction: column; gap: 6px; }
.watch-party-join label { font-size: 0.85rem; color: var(--text-dim); }
.watch-party-version { display: flex; flex-direction: column; gap: 6px; }
.watch-party-version label { font-size: 0.85rem; color: var(--text-dim); }
.watch-party-tab-watch { display: flex; flex-direction: column; gap: 6px; }
/* The panel only lives in the settings sheet (in-sheet, watchparty.js); Quality is a row of its own there */
.watch-party-join.in-sheet #watch-party-quality, .watch-party-join.in-sheet label[for="watch-party-quality"] { display: none; }
.watch-party-seg { flex: 1; display: flex; gap: 6px; }
.watch-party-seg button { flex: 1 1 0; min-width: 0; height: 36px; padding: 0 4px; cursor: pointer; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text-dim); font: 600 0.8rem var(--font-body); }
.watch-party-seg button[aria-pressed="true"] { border-color: var(--heads); background: var(--heads-soft); color: var(--heads); }
.watch-party-seg button:disabled { opacity: 0.45; cursor: default; }
/* Text subtitles at the size picked (watchPartyCueSize) */
.watch-party-video::cue { font-size: var(--cue-size, inherit); }
.watch-party-pgs { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; } /* PGS subtitles over the picture */
/* Small buttons on the cast card, Live TV and Stop on the Roku */
.watch-party-pill { flex: 0 1 auto; min-width: 0; white-space: nowrap; font: inherit; font-size: clamp(0.7rem, 2.9vw, 0.8rem); font-weight: 600;
    padding: 7px clamp(8px, 2.6vw, 14px); border-radius: 999px; cursor: pointer; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.watch-party-pill:hover:not(:disabled) { border-color: var(--border-hover); }
.watch-party-pill:disabled { opacity: 0.6; cursor: default; }
.watch-party-pill.is-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
/* The admin's TVs at home, folded away under Watch on */
.watch-tv { margin-top: 4px; font-size: 0.9rem; }
.watch-tv summary { cursor: pointer; color: var(--text-dim); font-size: 0.85rem; }
.watch-tv > :not(summary) { margin-top: 8px; }
.watch-tv .watch-row input[type="text"] { padding: 8px 10px; font-size: 0.9rem; }
.watch-tv li .plex-link { margin: 0; white-space: nowrap; }
.watch-tv li .plex-link:disabled { color: var(--text-dim); cursor: default; }
.watch-tv li .watch-party-who { white-space: normal; overflow-wrap: anywhere; }
.watch-tv-kind { display: block; color: var(--text-dim); font-size: 0.8rem; }
.watch-party-msg { margin: 0; }

/* 1v1 odds (setup.js's badge). Colours come from the theme tokens. */

/* Arena: "Odds 60 / 40" under the format */
.score-odds { margin-top: 4px; font-size: 0.72rem; letter-spacing: 0.04em; color: var(--text-dim); white-space: nowrap; }
.score-odds[hidden] { display: none; }
.score-odds .is-heads { color: var(--heads); font-weight: 700; }
.score-odds .is-tails { color: var(--tails); font-weight: 700; }

button.action-btn#btn-begin-shuffle:disabled { opacity: 0.5; cursor: default; filter: none; }

/* ---------- App shell: the tab bar (Movies, Live TV, then Profile as the avatar alone; History lives in Profile) ----------
   Across the top on every screen: equal tabs on phones (icon beside its label) and the avatar at the right end, the
   desktop row from 900px. Movie Night has no tab since 11-12 (Movies' Start a Movie Night card) */
.tab-bar {
    position: fixed; left: 0; right: 0; top: env(safe-area-inset-top, 0px); z-index: 50;
    height: var(--tabbar-h); padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
    display: grid; grid-template-columns: minmax(0, 1fr) 56px;
    background: var(--tabbar-bg, var(--surface)); border-bottom: 1px solid var(--border);
}
/* The strip above the bar, under the status bar: the bar's colour, so nothing scrolls by behind the clock */
.tab-bar::before {
    content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: env(safe-area-inset-top, 0px);
    background: var(--tabbar-bg, var(--surface));
}
.tab {
    display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px; min-width: 0;
    padding: 0 2px; border: 0; background: transparent; color: var(--text-dim); text-decoration: none; cursor: pointer;
    font: 500 0.8rem var(--font-body); white-space: nowrap; transition: color 0.15s;
}
.tab svg { flex: none; width: 18px; height: 18px; }
.tab span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--heads); font-weight: 600; }
.tab:focus-visible { outline-offset: -4px; }
.tab-avatar {
    width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--border-hover); background: var(--surface-2); color: var(--text); font-size: 0.7rem; font-weight: 600;
}
.tab:hover .tab-avatar { border-color: var(--heads); }
@media (min-width: 900px) {
    .tab-bar { padding: 0 max(16px, calc(50% - 400px)); grid-template-columns: auto 1fr auto; gap: 6px; }
    .tab { gap: 8px; padding: 0 12px; font-size: 0.85rem; }
    #tab-profile { justify-self: end; }
}
/* The Movies tab's Movie Night invite count, and the Live pill (a live Watch Together): a strip under the tab bar on
   phones, in the top bar's free space from 900px */
.tab { position: relative; }
.tab-avatar { flex: none; }
.tab-badge {
    position: absolute; top: 5px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    background: var(--tails); color: var(--tails-ink); font: 700 0.62rem/16px var(--font-body); text-align: center;
}
.tab-badge[hidden] { display: none; }
.tab-dot { min-width: 10px; width: 10px; height: 10px; padding: 0; } /* Profile: an app update is waiting (cast-native.js) */
.live-pill {
    display: flex; align-items: center; gap: 8px; color: var(--text); font: 600 0.8rem var(--font-body); text-decoration: none;
    background: var(--surface-2); border: 1px solid var(--tails);
}
/* Phones: a strip right under the tab bar, and the page moves down by its height (it used to float over the bottom buttons) */
@media (max-width: 899.98px) {
    .live-pill {
        position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + var(--tabbar-h)); z-index: 49;
        height: var(--live-strip-h); padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
        border-width: 0 0 1px; border-radius: 0; justify-content: center;
    }
    html.live-strip { --tab-top: calc(var(--tabbar-h) + var(--live-strip-h)); }
}
@media (min-width: 900px) {
    .live-pill { max-width: 280px; padding: 7px 14px; border-radius: 8px; }
}
.live-pill[hidden] { display: none; }
.live-pill span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-pill:hover { border-color: var(--heads); }
.live-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tails); animation: live-pulse 1.6s ease-in-out infinite; }
@keyframes live-pulse { 50% { opacity: 0.35; } }
@media (min-width: 900px) {
    .tab-badge { top: 8px; left: 18px; right: auto; }
    .live-pill { position: static; justify-self: end; align-self: center; }
}

/* Profile: the avatar alone, no label and no underline; its ring turns green while the menu is open or on its pages */
.tab-me { padding: 0; }
.tab-me .tab-avatar { width: 30px; height: 30px; font-size: 0.85rem; border: 0; outline: 2px solid var(--border); outline-offset: 1px; }
.tab-me:hover .tab-avatar { outline-color: var(--border-hover); }
.tab-me[aria-expanded="true"] .tab-avatar, .tab-me[aria-current="page"] .tab-avatar { outline-color: var(--heads); }
.tab-me .tab-dot { top: 9px; right: 9px; left: auto; }

/* ---------- Play (/): Continue, the start tiles, the shortcuts and "This month" ---------- */
#setup-view, #games-view { justify-content: flex-start; }
@media (max-width: 899.98px) { .main-panel { padding-top: 1.5rem; } } /* the tab bar took over the top's job of leading in */
.play-section { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-bottom: 18px; text-align: left; }
.play-section[hidden] { display: none; }
.section-label {
    margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 0.8rem; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--text-dim); text-align: left;
}
.play-continue .invite-banner { margin: 0; border-color: var(--tails); }
.back-link {
    display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; margin: 0 0 14px -6px; padding: 6px;
    background: none; border: 0; border-radius: 6px; color: var(--text-dim); font: 500 0.85rem var(--font-body); cursor: pointer;
}
.back-link:hover { color: var(--text); }

/* Library's title sits on the left, like the other screens' headings */
#pool-view .view-title { text-align: left; font-size: 1.6rem; }


/* ---------- Profile sheet (the account dialog): a bottom sheet on phones, the usual popup from 600px ---------- */
.profile-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 4px; }
.profile-avatar {
    flex: none; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--heads); background: var(--surface-2); color: var(--text); font-size: 1.2rem; font-weight: 600;
}
.profile-who { flex: 1; min-width: 0; }
.profile-who h2 { margin: 0; text-align: left; font-size: 1.2rem; text-transform: uppercase; letter-spacing: 0.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-who .name-text { font-size: 0.78rem; }
.profile-group { display: flex; flex-direction: column; border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.profile-row { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-bottom: 1px solid var(--border); font-size: 0.9rem; font-weight: 500; }
.profile-row:last-child { border-bottom: 0; }
.profile-row[hidden] { display: none; }
details.profile-row { display: block; margin: 0; padding: 0; background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
details.profile-row:last-child { border-bottom: 0; }
details.profile-row summary { min-height: 48px; padding: 0 14px; font-size: 0.9rem; font-weight: 500; }
details.profile-row summary::after { content: "›"; color: var(--text-dim); transition: transform 0.15s; }
details.profile-row[open] summary::after { transform: rotate(90deg); }
details.profile-row .account-section { padding: 0 14px 14px; }
.profile-value { margin-left: auto; color: var(--text-soft); font-size: 0.8rem; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.profile-row summary .profile-value { flex: 1; min-width: 0; text-align: right; }
.profile-switch span { flex: 1; }
.profile-label { margin: 4px 4px -6px; color: var(--text-dim); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.profile-label[hidden] { display: none; }
.account-device-form { display: flex; flex-wrap: wrap; gap: 8px; }
.account-device-form input { flex: 1 1 160px; min-width: 0; }
.account-device-form .action-btn { margin: 0; padding: 6px 12px; font-size: 0.8rem; }
.user-rigs > span:first-child { flex: 1; }
.user-rigs-buttons { display: flex; gap: 8px; }
.user-rigs-step { min-width: 44px; min-height: 36px; padding: 0 12px; font-size: 1.1rem; }
/* A row that opens to a list (Devices, Remote with more than one TV): the list sits indented inside it */
.profile-sublist { display: flex; flex-direction: column; margin: 0 0 6px 14px; border-left: 2px solid var(--border); }
.profile-sublist .profile-row:last-child { border-bottom: 0; }
.profile-remote { display: contents; }
.profile-remote[hidden] { display: none; }
.profile-remote > .profile-row:last-child { border-bottom: 1px solid var(--border); } /* Link a TV follows it */
.cast-key { font-size: 1rem; font-weight: 600; }
@media (max-width: 599.98px) {
    .match-log.sheet {
        margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0;
        border-width: 1px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .match-log.sheet[open] { animation: sheet-in 0.25s cubic-bezier(0.25, 1, 0.5, 1); }
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
/* The sheet shows one section at a time (player.js openAccount) */
.profile-sec { display: contents; }
.profile-sec[hidden] { display: none; }
/* The Profile menu: a dropdown under the avatar (player.js openProfileMenu), compact 44px rows */
.profile-menu {
    position: fixed; inset: calc(env(safe-area-inset-top, 0px) + var(--tabbar-h) + 4px) max(8px, env(safe-area-inset-right, 0px)) auto auto;
    margin: 0; padding: 0; width: min(260px, calc(100vw - 16px)); max-height: calc(100vh - var(--tabbar-h) - 24px); overflow-y: auto;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border-hover); border-radius: 12px;
    box-shadow: 0 12px 32px color-mix(in srgb, var(--shadow) 70%, transparent);
}
@media (min-width: 900px) { .profile-menu { right: max(16px, calc(50% - 400px)); } } /* under the avatar (the tab bar's padding) */
.profile-menu[open] { animation: dialog-in 0.16s ease-out; }
.profile-menu::backdrop { background: var(--backdrop); }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.menu-avatar { width: 44px; height: 44px; font-size: 1.1rem; }
.menu-who { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.menu-name { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-stats { color: var(--text-dim); font-size: 0.75rem; }
.menu-row {
    display: flex; align-items: center; gap: 12px; width: 100%; height: 44px; padding: 0 14px; border: 0; border-bottom: 1px solid var(--border);
    background: none; color: var(--text); font: 500 0.88rem var(--font-body); text-align: left; text-decoration: none; cursor: pointer;
}
.menu-row:last-child { border-bottom: 0; }
.menu-row[hidden] { display: none; }
.menu-row:hover, .menu-row:focus-visible { background: var(--surface); }
.menu-row svg { flex: none; }
.menu-row > span:not(.menu-value) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-value { flex: none; max-width: 45%; color: var(--text-dim); font-size: 0.75rem; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-row.is-remote svg, .menu-row.is-remote .menu-value { color: var(--gold); }
.menu-row.is-update svg, .menu-row.is-update .menu-value { color: var(--heads); }
.menu-row.is-logout { color: var(--danger); }

/* ---------- History's game list (games.js, in #games-view; /games and /stats open History) ---------- */
#games-view h1:focus { outline: none; } /* focused only so screen readers start at the new page */
#games-view h1 { margin-bottom: 0.75rem; }
.games-list { width: 100%; text-align: left; }
.match-log-pager.games-pager { width: 100%; padding: 10px 0; border-top: 0; }

/* The list (games.js): Select in the heading, search, filter chips, rows with a poster, badges and ⋯ */
.games-head { display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 0.75rem; }
.games-head h1 { flex: 1; margin: 0; text-align: left; }
.games-head-btn, .game-bar-btn {
    flex: none; height: 32px; padding: 0 12px; border-radius: 8px; cursor: pointer;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font: 500 0.82rem var(--font-body);
}
.games-head-btn:hover, .game-bar-btn:hover { border-color: var(--border-hover); }
.games-head-btn[aria-pressed="true"] { border-color: var(--heads); color: var(--heads); }
.games-tools { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-bottom: 12px; }
.games-everyone { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px; border-radius: 12px; background: var(--surface-2); font-size: 0.88rem; font-weight: 500; color: var(--text); }
.games-everyone > span:first-child { flex: 1; min-width: 0; text-align: left; }
.game-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.game-row {
    display: flex; align-items: center; gap: 4px; padding: 0 2px 0 10px; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--border);
}
.game-row.is-live { border-color: var(--heads); }
.game-row.selected { border-color: var(--gold); }
.game-check { flex: none; width: 18px; height: 18px; margin: 0 4px 0 0; accent-color: var(--gold); }
.game-row-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 10px 0; color: var(--text); text-decoration: none; }
.game-poster {
    flex: none; width: 40px; height: 60px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
    background: var(--surface-2) center / cover no-repeat; border: 1px solid var(--border-hover);
    color: var(--text-dim); font: 600 1rem var(--font-display);
}
.game-poster.is-heads { border-color: var(--heads); }
.game-poster.is-tails { border-color: var(--tails); }
.game-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.game-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-line { font-size: 0.75rem; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.game-badges:empty { display: none; }
.game-badge { --badge: var(--text-dim); font-size: 0.68rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; color: var(--badge); background: color-mix(in srgb, var(--badge) 15%, transparent); }
.badge-1v1, .badge-night { --badge: var(--tails); }
.badge-shuffle, .badge-watching { --badge: var(--heads); }
.badge-unfinished { --badge: var(--gold); }
.game-more {
    flex: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 8px;
    background: none; border: 0; color: var(--text-soft); cursor: pointer;
}
.game-more:hover { color: var(--text); }
.games-select-bar {
    position: sticky; bottom: calc(var(--tab-bottom) + var(--page-safe-bottom) + 8px); z-index: 4; width: 100%; margin-top: 10px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px;
    background: var(--surface-2); border: 1px solid var(--gold);
}
.games-select-bar[hidden] { display: none; }
.games-select-head { flex: 1 0 100%; display: flex; align-items: center; gap: 8px; }
.games-select-bar #games-selected { flex: 1; font-size: 0.82rem; color: var(--text-soft); text-align: left; }
.games-all-btn { flex: none; }
.games-select-bar .action-btn { flex: 1; margin: 0; padding-top: 8px; padding-bottom: 8px; }
.games-select-bar .action-btn.btn-secondary { margin: 0; }
.games-cleanup { flex: 1 0 100%; font-size: 0.78rem; text-align: left; }
.games-cleanup.armed { color: var(--danger); }

/* Manage (a bottom sheet on phones) */
.manage-dialog { width: min(440px, calc(100vw - 32px)); }
#manage-body { display: flex; flex-direction: column; gap: 14px; }
.manage-title { margin: 0; font-weight: 600; font-size: 1rem; overflow-wrap: anywhere; }
.manage-details { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 0.82rem; }
.manage-details dt { color: var(--text-dim); }
.manage-details dd { margin: 0; overflow-wrap: anywhere; }
.manage-runs { margin: 0; padding-left: 1.4em; font-size: 0.78rem; color: var(--text-soft); max-height: 8.5em; overflow-y: auto; }
.manage-people { display: flex; flex-direction: column; gap: 6px; }
.manage-person { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; }
.manage-person-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-person-state { flex: none; font-size: 0.75rem; color: var(--text-dim); }
.manage-person-state.is-watching { color: var(--heads); }
.manage-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.manage-actions button.action-btn { flex: 1 1 auto; height: 30px; margin: 0; padding: 0 10px; font-size: 0.8rem; white-space: nowrap; }
.manage-note { margin: 0; font-size: 0.78rem; color: var(--text-dim); }
#manage-msg { color: var(--text-soft); }

/* ---------- Users (/users, the admin's accounts): rows like the Games list, the sheet like Manage ---------- */
#users-view { justify-content: flex-start; }
#users-view h1:focus { outline: none; }
.user-row { padding-right: 10px; }
.user-row.is-off .game-name { color: var(--text-dim); }
button.user-row-main { background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.user-avatar { flex: none; width: 36px; height: 36px; font-size: 0.95rem; }
.badge-admin { --badge: var(--gold); }
.badge-off { --badge: var(--danger); }
.users-note { width: 100%; margin-top: 14px; text-align: left; }
#user-body { display: flex; flex-direction: column; gap: 14px; }
.user-section { display: flex; flex-direction: column; gap: 6px; }
.user-section .watch-row input { flex: 1; min-width: 0; margin: 0; } /* the password box too (.watch-row only stretches text boxes) */
.user-add { display: flex; flex-direction: column; gap: 10px; }
.user-add input { margin: 0; }
.user-add .action-btn.btn-start { margin: 4px 0 0; }
#user-body .manage-actions .action-btn:only-child { grid-column: 1 / -1; }
.qd-switch:disabled { opacity: 0.5; cursor: not-allowed; }
a.profile-link { color: var(--text); text-decoration: none; }
a.profile-link::after { content: "›"; color: var(--text-dim); }
a.profile-link:hover { background: var(--surface); }
button.profile-link { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; font-family: inherit; color: var(--text); text-align: left; cursor: pointer; }
button.profile-link:last-child { border-bottom: 0; }
button.profile-link::after { content: "›"; color: var(--text-dim); }
button.profile-link:hover { background: var(--surface); }

/* The admin's Stored copies (media-admin.js) */
#media-dialog .game-rows { max-height: min(60vh, 520px); overflow-y: auto; }
.media-row { padding-right: 10px; }
.media-row .game-line { white-space: normal; }
.media-row button.action-btn { flex: none; margin: 0; padding: 7px 12px; font-size: 0.8rem; }

/* The game page's bar (back, name, mute, Manage): with a finished game, never while it plays */
.game-bar { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 480px; margin-bottom: 10px; }
.game-bar[hidden], .playing .game-bar { display: none; }
.game-bar-btn { width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; }
.game-bar-name { flex: 1; min-width: 0; font-weight: 600; font-size: 0.9rem; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#game-bar-mute .mute-on, #game-bar-mute[aria-pressed="true"] .mute-off { display: none; }
#game-bar-mute[aria-pressed="true"] .mute-on { display: inline; }
#game-bar-mute[aria-pressed="true"] { color: var(--text-dim); }

/* Play's Continue: your unfinished games */
.continue-games { display: flex; flex-direction: column; gap: 8px; }
.continue-games:empty { display: none; }
.continue-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--gold); }
.continue-card .game-poster { width: 32px; height: 48px; }
.continue-card.is-live { border-color: var(--tails); }
.continue-card button.action-btn { flex: none; margin: 0; padding: 6px 10px; font-size: 0.8rem; }
.continue-card .action-btn.btn-ghost.armed { border-color: var(--danger); color: var(--danger); }

/* + Add's TMDB matches (the Movie Night room's rows) */
.add-results { margin: 0; max-height: 50vh; overflow-y: auto; }
.add-results:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
    .match-log.sheet[open] { animation: none; }
    .tab { transition: none; }
    .live-dot { animation: none; }
}

/* Rig the game (rig.js). The rigger's colour: the starter's, or anyone else's (theme tokens) */
.rig-starter { --rig-color: var(--rig-starter); --rig-deep: var(--rig-starter-deep); }
.rig-other { --rig-color: var(--rig-other); --rig-deep: var(--rig-other-deep); }

/* The reveal: the winning cover in the rigger's colours, the RIGGED stamp, and the static (once at the swap, then every
   1.5 s while it shows; none with reduced motion) */
.flip-container.rigged { --spin-1: var(--rig-color); --spin-2: var(--rig-deep); --marquee-on: var(--rig-color); --marquee-off: var(--rig-deep); }
.rig-stamp {
    position: absolute; left: 50%; top: 42%; z-index: 5; transform: translate(-50%, -50%) rotate(-14deg) translateZ(40px);
    padding: 6px 14px 4px; border: 3px solid var(--rig-color); border-radius: 6px; background: var(--rig-stamp-bg);
    font-family: var(--font-display); font-weight: 700; font-size: 2.1rem; line-height: 1; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--rig-color); text-align: center; white-space: nowrap; pointer-events: none;
    box-shadow: 0 0 18px color-mix(in srgb, var(--rig-color) calc(45% * var(--glow)), transparent);
    -webkit-mask-image: repeating-linear-gradient(115deg, #000 0 6px, rgba(0, 0, 0, 0.78) 6px 8px);
    mask-image: repeating-linear-gradient(115deg, #000 0 6px, rgba(0, 0, 0, 0.78) 6px 8px);
}
.rig-stamp small { display: block; margin-top: 4px; font-size: 0.85rem; letter-spacing: 0.14em; }
.rig-stamp.slam { animation: rig-slam 0.42s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes rig-slam {
    0% { opacity: 0; transform: translate(-50%, -50%) rotate(-24deg) scale(2.6) translateZ(40px); }
    60% { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(0.92) translateZ(40px); }
    100% { opacity: 1; transform: translate(-50%, -50%) rotate(-14deg) scale(1) translateZ(40px); }
}
.flip-container.rig-glitch, .flip-container.rig-static { isolation: isolate; }
.flip-container.rig-glitch { animation: rig-glitch 0.7s steps(1) both; }
.flip-container.rig-static:not(.rig-glitch) { animation: rig-static 1.5s steps(1) 1.5s infinite; }
.flip-container.rig-glitch .face::after, .flip-container.rig-static .face::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
    background: repeating-linear-gradient(0deg, var(--rig-static) 0 1px, transparent 1px 3px);
}
.flip-container.rig-glitch .face::after { animation: rig-scan 0.7s linear both; }
.flip-container.rig-static:not(.rig-glitch) .face::after { animation: rig-scan-loop 1.5s linear 1.5s infinite; }
@keyframes rig-glitch {
    0% { translate: 0 0; filter: none; clip-path: none; }
    10% { translate: -4px 1px; filter: hue-rotate(80deg) saturate(2.4); clip-path: inset(12% -60px 58% -60px); }
    20% { translate: 5px -2px; filter: contrast(2) brightness(1.3); clip-path: inset(44% -60px 20% -60px); }
    30% { translate: -2px 0; filter: invert(1) hue-rotate(160deg); clip-path: none; }
    40% { translate: 3px 2px; filter: hue-rotate(-90deg) saturate(3); clip-path: inset(70% -60px 4% -60px); }
    50% { translate: -5px -1px; filter: contrast(2.4); clip-path: inset(8% -60px 30% -60px); }
    60% { translate: 2px 1px; filter: hue-rotate(200deg); clip-path: inset(30% -60px 40% -60px); }
    75% { translate: -1px 0; filter: brightness(1.8) saturate(0); clip-path: none; }
    90% { translate: 1px 0; filter: none; }
    100% { translate: 0 0; filter: none; clip-path: none; }
}
/* The same burst in the first 0.7 s of every 1.5 s */
@keyframes rig-static {
    0% { translate: 0 0; filter: none; clip-path: none; }
    4.67% { translate: -4px 1px; filter: hue-rotate(80deg) saturate(2.4); clip-path: inset(12% -60px 58% -60px); }
    9.33% { translate: 5px -2px; filter: contrast(2) brightness(1.3); clip-path: inset(44% -60px 20% -60px); }
    14% { translate: -2px 0; filter: invert(1) hue-rotate(160deg); clip-path: none; }
    18.67% { translate: 3px 2px; filter: hue-rotate(-90deg) saturate(3); clip-path: inset(70% -60px 4% -60px); }
    23.33% { translate: -5px -1px; filter: contrast(2.4); clip-path: inset(8% -60px 30% -60px); }
    28% { translate: 2px 1px; filter: hue-rotate(200deg); clip-path: inset(30% -60px 40% -60px); }
    35% { translate: -1px 0; filter: brightness(1.8) saturate(0); clip-path: none; }
    42% { translate: 1px 0; filter: none; }
    46.67%, 100% { translate: 0 0; filter: none; clip-path: none; }
}
@keyframes rig-scan { from { opacity: 1; background-position: 0 0; } to { opacity: 0; background-position: 0 40px; } }
@keyframes rig-scan-loop { 0% { opacity: 1; background-position: 0 0; } 46.67% { opacity: 0; background-position: 0 40px; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .rig-stamp.slam, .flip-container.rig-glitch, .flip-container.rig-static, .flip-container.rig-glitch .face::after, .flip-container.rig-static .face::after { animation: none !important; }
}
.match-banner-label small { display: block; margin-top: 2px; font-family: var(--font-body); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.02em; text-transform: none; color: var(--text-dim); }
/* The winner card, the game history and the Games list name the rigger, in their colour */
.winner-card.is-rigged { --winner-side: var(--rig-color); }
.winner-rig-line { margin: 2px 0 4px; font-size: 0.85rem; color: var(--text-dim); }
.history-rigged { margin: 2px 0 0; font-size: 0.8rem; color: var(--rig-color); }
.history-dot.is-rigged { background: var(--rig-color); }
.history-poster.is-rigged, .game-poster.is-rigged { border-color: var(--rig-color); }
.game-badge.badge-rigged { --badge: var(--rig-color); }

/* ---------- Rig-off (rigoff.js): "Time for a riggin'", a tap game on a wheel of the two rigged covers ---------- */
.rigoff-popup {
    /* As wide as fits, and on a short phone small enough that the heading, the wheel and the button all fit without scrolling */
    --wheel: min(440px, 112vw, calc((100dvh - 250px) / 0.84));
    position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 12px;
    background: color-mix(in srgb, var(--bg) 70%, transparent); animation: card-in 0.25s ease-out; transition: background 0.4s ease;
}
.rigoff-popup.is-closing { opacity: 0; transition: opacity 0.3s ease; }
.rigoff-popup.is-handoff { background: transparent; pointer-events: none; }
/* The card turns over at the end (rigoff.js handOffRigoff): it shrinks onto the cover under it, the popup on its front
   and the rigged poster on its back. No overflow here: it would flatten the 3D turn. */
.rigoff-card { position: relative; width: min(460px, 100%); transform-style: preserve-3d; border-radius: 16px; }
.rigoff-card.is-handoff {
    position: fixed; margin: 0;
    transition: left var(--shrink-ms) cubic-bezier(0.5, 0, 0.2, 1), top var(--shrink-ms) cubic-bezier(0.5, 0, 0.2, 1),
        width var(--shrink-ms) cubic-bezier(0.5, 0, 0.2, 1), height var(--shrink-ms) cubic-bezier(0.5, 0, 0.2, 1),
        border-radius var(--shrink-ms) ease, transform var(--flip-ms) cubic-bezier(0.45, -0.25, 0.3, 1.3) var(--flip-at);
}
.rigoff-card.is-flipped { transform: rotateY(180deg); }
.rigoff-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: inherit; }
.rigoff-front {
    position: relative; overflow: hidden; max-height: calc(100dvh - 32px); overflow-y: auto; box-sizing: border-box;
    display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 0 18px;
    background: var(--surface); color: var(--text); border: 2px solid var(--gold);
    box-shadow: 0 12px 48px color-mix(in srgb, var(--shadow) 60%, transparent), 0 0 30px color-mix(in srgb, var(--gold) calc(30% * var(--glow)), transparent);
}
.rigoff-card.is-handoff .rigoff-front { position: absolute; inset: 0; overflow: hidden; }
.rigoff-card.is-handoff .rigoff-front > * { opacity: 0; transition: opacity 0.25s ease; }
.rigoff-back {
    position: absolute; inset: 0; transform: rotateY(180deg); display: grid; place-items: center; padding: 8px; box-sizing: border-box; text-align: center;
    background: var(--surface-2) center / cover; border: 2px solid var(--rig-color, var(--gold)); color: var(--text);
    font-family: var(--font-display); font-size: 1.1rem;
}
.rigoff-caption { margin: 0; padding: 0 16px; font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; letter-spacing: 0.03em; text-align: center;
    color: var(--gold); text-shadow: 0 0 18px color-mix(in srgb, var(--gold) calc(45% * var(--glow)), transparent); }
/* The wheel: wider than the card on purpose, the sides are cut off */
.rigoff-window { position: relative; width: 100%; height: calc(var(--wheel) * 0.84); overflow: hidden; flex-shrink: 0; }
.rigoff-wheel {
    position: absolute; left: 50%; top: 22px; width: var(--wheel); height: var(--wheel); margin-left: calc(var(--wheel) / -2); border-radius: 50%; overflow: hidden;
    background: var(--surface-2);
    box-shadow: 0 0 0 6px var(--surface-2), 0 0 0 9px var(--gold), 0 0 50px color-mix(in srgb, var(--gold) calc(20% * var(--glow)), transparent);
    rotate: var(--angle, 0deg);
}
.rigoff-wheel.is-idle { animation: rigoff-idle 14s linear infinite; }
.rigoff-wheel.is-fast { animation: rigoff-idle 0.45s linear infinite; }
.rigoff-wheel.is-landing { transition: rotate 5.2s cubic-bezier(0.3, 0.75, 0.25, 1); } /* RIGOFF_LAND_MS */
@keyframes rigoff-idle { from { rotate: var(--angle, 0deg); } to { rotate: calc(var(--angle, 0deg) + 360deg); } }
/* A slice: a 45° triangle from the hub to the rim, filled with its cover */
.rigoff-slice { position: absolute; inset: 0; rotate: var(--a); clip-path: polygon(50% 50%, 29.29% 0, 70.71% 0); transition: filter 0.5s; }
.rigoff-slice.heads { --side: var(--heads); }
.rigoff-slice.tails { --side: var(--tails); }
.rigoff-slice.wild { --side: var(--gold); }
.rigoff-slice.wild .rigoff-art { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--gold) 30%, var(--surface-2)) 0 10px, var(--surface-2) 10px 20px); }
.rigoff-slice.wild .rigoff-name { color: var(--gold); font-size: 0.7rem; letter-spacing: 0.06em; }
.rigoff-art { position: absolute; left: 25%; right: 25%; top: 0; height: 50%; background: color-mix(in srgb, var(--side) 18%, var(--surface-2)) center 30% / cover; }
.rigoff-name { position: absolute; left: 50%; top: 14%; translate: -50% 0; writing-mode: vertical-rl; white-space: nowrap; font-family: var(--font-display); font-size: 0.8rem; color: var(--text); }
.rigoff-dot { position: absolute; left: 50%; top: 5.5%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--side);
    box-shadow: 0 0 0 2px var(--shadow), 0 0 12px color-mix(in srgb, var(--side) calc(80% * var(--glow)), transparent); }
/* Gold dividers between slices, and the pegs the ticker hits */
.rigoff-wheel::after { content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; z-index: 2;
    background: repeating-conic-gradient(from -22.5deg, var(--gold) 0 0.7deg, transparent 0.7deg 45deg); }
.rigoff-peg { position: absolute; left: 50%; top: 50%; width: 0; height: 0; rotate: var(--p); z-index: 3; }
.rigoff-peg::before { content: ""; position: absolute; left: -5px; top: calc(var(--wheel) * -0.5 + 5px); width: 10px; height: 10px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, var(--medal-2), var(--gold) 55%, var(--medal-3)); box-shadow: 0 1px 2px var(--shadow); }
.rigoff-wheel.is-result .is-lose { filter: grayscale(1) brightness(0.3); }
.rigoff-wheel.is-result .is-win { animation: rigoff-win 0.9s ease-in-out infinite alternate; }
@keyframes rigoff-win { to { filter: brightness(1.35) saturate(1.2); } }
/* The ticker: a flapper hinged above the rim; pegs push it over and it springs back (rigoff.js rigoffTicker) */
.rigoff-ticker { position: absolute; left: 50%; top: 0; z-index: 4; width: 30px; height: 46px; margin-left: -15px; transform-origin: 50% 8px; rotate: var(--tick, 0deg);
    filter: drop-shadow(0 3px 3px color-mix(in srgb, var(--shadow) 80%, transparent)); }
.rigoff-ticker::before { content: ""; position: absolute; inset: 0; background: linear-gradient(var(--medal-2), var(--gold) 40%, var(--medal-3));
    clip-path: polygon(50% 100%, 0 18%, 18% 0, 82% 0, 100% 18%); }
.rigoff-ticker::after { content: ""; position: absolute; left: 50%; top: 4px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--gold-ink); }
.rigoff-ticker.snap { animation: rigoff-snap 0.26s ease-out; }
@keyframes rigoff-snap { 0% { rotate: var(--from, 24deg); } 40% { rotate: calc(var(--from, 24deg) * -0.45); } 70% { rotate: calc(var(--from, 24deg) * 0.18); } 100% { rotate: 0deg; } }
/* The hub: blank while they tap (a flash per tap), the secret number in it during the wheel's last turn */
.rigoff-hub {
    position: absolute; left: 50%; top: calc(22px + var(--wheel) / 2); z-index: 3; width: calc(var(--wheel) * 0.24); height: calc(var(--wheel) * 0.24);
    transform: translate(-50%, -50%); border-radius: 50%; display: grid; place-items: center;
    background: radial-gradient(circle at 40% 35%, var(--surface-2), var(--surface)); border: 3px solid var(--gold);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--shadow) 50%, transparent);
    font-family: var(--font-display); font-weight: 700; font-size: calc(var(--wheel) * 0.1); font-variant-numeric: tabular-nums; color: var(--gold);
}
.rigoff-hub span, .rigoff-hub small { opacity: 0; }
.rigoff-hub small { position: absolute; bottom: 14%; font-size: 0.55rem; letter-spacing: 0.12em; color: var(--text-dim); }
.rigoff-hub.bump { animation: rigoff-bump 0.18s ease-out; }
@keyframes rigoff-bump { 40% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--shadow) 50%, transparent), 0 0 26px var(--gold); } }
.rigoff-hub.is-secret { box-shadow: 0 0 0 4px color-mix(in srgb, var(--shadow) 50%, transparent), 0 0 30px color-mix(in srgb, var(--gold) calc(60% * var(--glow)), transparent); }
.rigoff-hub.is-secret span { opacity: 1; animation: rigoff-reveal 0.6s cubic-bezier(0.3, 1.6, 0.5, 1); }
.rigoff-hub.is-secret small { opacity: 1; }
@keyframes rigoff-reveal { from { opacity: 0; scale: 0.2; } }
/* "Click me in 3.. 2.. 1", then "Rig me good baby": a big pushable pill, live for the taps with a draining bar */
.rigoff-btn {
    position: relative; overflow: hidden; min-width: min(300px, calc(100% - 32px)); padding: 14px 22px; border: 0; border-radius: 999px; cursor: pointer;
    font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: 0.04em;
    background: var(--gold); color: var(--gold-ink); box-shadow: 0 6px 0 color-mix(in srgb, var(--gold) 50%, var(--shadow));
    touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.rigoff-btn:active:not(:disabled) { translate: 0 4px; box-shadow: 0 2px 0 color-mix(in srgb, var(--gold) 50%, var(--shadow)); }
.rigoff-btn:disabled { cursor: default; background: var(--surface-2); color: var(--text); box-shadow: 0 6px 0 color-mix(in srgb, var(--shadow) 80%, transparent); }
.rigoff-btn.is-hot { background: var(--tails); color: var(--tails-ink); }
.rigoff-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.rigoff-bar { position: absolute; left: 0; bottom: 0; width: 100%; height: 5px; background: color-mix(in srgb, var(--surface) 55%, transparent); transform-origin: 0 0; scale: 0 1; }
.rigoff-btn.is-timing .rigoff-bar { scale: 1 1; animation: rigoff-drain var(--tap-ms, 3s) linear forwards; }
@keyframes rigoff-drain { to { scale: 0 1; } }
@media (prefers-reduced-motion: reduce) {
    .rigoff-wheel.is-idle, .rigoff-wheel.is-fast, .rigoff-wheel.is-result .is-win, .rigoff-hub.bump, .rigoff-hub.is-secret span, .rigoff-ticker.snap { animation: none; }
    .rigoff-wheel.is-landing { transition: none; }
}

#btn-begin-shuffle small, #watch-create-btn small { display: block; font-weight: 400; font-size: 0.78rem; opacity: 0.8; }
#btn-begin-shuffle small:empty, #watch-create-btn small:empty { display: none; }
@keyframes mn-hurry { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--heads) 35%, transparent); } }

/* The Remote (roku-remote.js): the Movie Night half and a Chromecast's pad (a Roku has its own remote now) */
.roku-remote-body { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 8px 0 4px; }
.roku-remote-row { display: flex; gap: 18px; justify-content: center; }
.link-tv-form { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 4px; }
.link-tv-code { font-size: 2rem; font-weight: 800; letter-spacing: 0.4em; text-align: center; text-transform: uppercase; }
.roku-night { width: 100%; display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.roku-night-line { margin: 0; text-align: center; color: var(--text-dim); }
.roku-night-buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.roku-action {
    min-height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 700; cursor: pointer; touch-action: manipulation;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}
.roku-action[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.roku-action:disabled { opacity: 0.6; cursor: default; }
.roku-rigs { display: flex; flex-direction: column; gap: 6px; }
.roku-rig-head { margin: 0; font-size: 0.85rem; color: var(--text-dim); }
.roku-rig-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.roku-rig-list .roku-action { min-height: 44px; text-align: left; font-weight: 500; }
.roku-key {
    min-width: 64px; height: 56px; padding: 0 14px; border-radius: 14px; font-size: 1.25rem; font-weight: 700;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border); cursor: pointer; touch-action: manipulation;
}
.roku-key:active { background: var(--accent-dim); border-color: var(--accent); }
.roku-remote-row[hidden], .roku-rigs[hidden], .cast-pad[hidden], .castcard-volume[hidden] { display: none; }
/* The Remote's top: one button naming the TV it steers; a tap lists every TV (roku-remote.js remoteTvsRender) */
.remote-tv-head { flex: 1; min-width: 0; }
.remote-tv {
    display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 44px; padding: 0 14px; border-radius: 14px;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border); font: inherit; font-weight: 700; cursor: pointer;
}
.remote-tv[aria-expanded="true"] { border-color: var(--accent); }
.remote-tv-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remote-tv-swap { flex: none; color: var(--text-dim); }
.remote-tvs { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 10px; border-bottom: 1px solid var(--border); }
.remote-tvs[hidden] { display: none; }
.remote-tvs .roku-action { min-height: 44px; text-align: left; font-weight: 500; }
.remote-tvs .roku-action.is-gone { opacity: 0.55; }
.cast-pad { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.cast-pad-volume { width: 100%; max-width: 320px; }
.cast-pad .watch-party-pill[hidden], .cast-pad .action-btn[hidden] { display: none; }
.castcard-remote { flex: none; width: 32px; height: 32px; }
.castcard-remote[hidden] { display: none; }

/* Flippy's mouth (voice.js): the grey line under a status, and the admin switch's Filthy / Clean */
/* Flippy's mouth (voice.js quip): the line itself is the joke; nothing extra to style */
.profile-switch .voice-value { flex: none; margin-right: 0.75rem; }

/* Play: the coin toss (cointoss.js) */
.toss { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 420px; margin: 0 auto; text-align: left; }
.toss-input { width: 100%; box-sizing: border-box; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 1rem; }
.toss-input::placeholder { color: var(--text-placeholder); }
.toss-input.toss-heads { border-color: color-mix(in srgb, var(--heads) 60%, var(--border)); }
.toss-input.toss-tails { border-color: color-mix(in srgb, var(--tails) 60%, var(--border)); }
.toss-stage { display: flex; justify-content: center; padding: 28px 0 8px; perspective: 900px; }
.toss-coin { position: relative; width: 190px; height: 190px; transform-style: preserve-3d; transition: transform 1.6s cubic-bezier(0.2, 0.7, 0.3, 1); }
.toss-face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 22px; box-sizing: border-box; border-radius: 50%; backface-visibility: hidden; font-family: 'Oswald', sans-serif; font-weight: 600; font-size: 1.3rem; overflow-wrap: anywhere; }
.toss-face-heads { background: var(--coin-heads-face); border: 6px solid var(--coin-heads-rim); color: var(--coin-heads-text); }
.toss-face-tails { background: var(--coin-tails-face); border: 6px solid var(--coin-tails-rim); color: var(--coin-tails-text); transform: rotateY(180deg); }
.toss-result { min-height: 2.6rem; margin: 6px 0 0; text-align: center; font-family: 'Oswald', sans-serif; font-weight: 700; font-size: 2rem; }
.toss-result.is-heads { color: var(--heads); }
.toss-result.is-tails { color: var(--tails); }
.toss-actions { display: flex; gap: 8px; align-items: stretch; }
.toss-actions .action-btn { flex: 1; margin: 0; padding: 14px 16px; font-size: 1rem; }
.toss-actions .action-btn[hidden] { display: none; }
#toss-btn { flex: 2; }
@media (prefers-reduced-motion: reduce) { .toss-coin { transition: none; } }

/* Cancel game on the shuffle screen, and the Profile's taunt */
.profile-taunt label { flex: none; }
.profile-taunt input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.85rem; }
.profile-taunt .mn-taunt-roll { height: 36px; }

/* The Movie Night tab's lobby (lobby.js): the room's pieces before there is a room */
#lobby-view { justify-content: flex-start; }
#lobby-view h1 { width: 100%; text-align: left; margin-bottom: 1rem; }
.lobby-on { padding: 16px; border: 1px solid var(--gold); border-radius: 10px; background: color-mix(in srgb, var(--gold) 8%, transparent); }
.lobby-on-text { margin: 0; font-weight: 600; text-align: center; }
.lobby-on-btns { display: flex; gap: 10px; justify-content: center; }
.lobby-on-btns .action-btn { margin-top: 0; min-width: 110px; }
.lobby-on-btns [hidden] { display: none; }
#lobby-end.armed { border-color: var(--danger); color: var(--danger); }
/* The Movies page while + Add movies picks for a Movie Night: one bar instead of the format and the buttons */
.pick-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.pick-bar[hidden] { display: none; }
.pick-bar-text { flex: 1 1 100%; color: var(--text-dim); font-size: 0.85rem; }
.pick-bar .action-btn { margin-top: 0; }
.pick-bar #pick-done { flex: 1; }
@keyframes format-pulse { 0% { box-shadow: 0 0 0 0 var(--accent); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* Phones: the heading goes (the Movies tab already says it); the covers' size is the slider's (11-18) */
@media (max-width: 600px) {
    #pool-view .view-title { display: none; }
}
/* ---------- Live TV (livetv.js): one sticky header, one edge-to-edge list, Movie Night's player, the admin's Manage ---------- */
#livetv-view { justify-content: flex-start; }
#livetv-view h1:focus { outline: none; }
#livetv-browse, #livetv-manage { width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; }
#livetv-browse[hidden], #livetv-manage[hidden] { display: none; }
/* (thin rows, two across, under each heading: 11-15, no squares) */
.livetv-cats, #livetv-peek-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.livetv-cats:empty { display: none; }
:is(.livetv-cats, #livetv-peek-group) .toggle-btn { min-width: 0; height: 34px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: none;
    color: var(--text); font-size: 0.85rem; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:is(.livetv-cats, #livetv-peek-group) .toggle-btn.active { color: var(--heads); font-weight: 700; }
.livetv-note { width: 100%; }
.livetv-ok { color: var(--heads); }
.livetv-bad { color: var(--danger); }
.livetv-warn { color: var(--gold); }
#livetv-status .profile-value { white-space: normal; text-align: right; } /* (the guide's counts and problems wrap, not cut off) */
.livetv-refresh { width: 100%; }
/* The header: flat tabs (Channels with its category, Guide) and 🔍, stuck to the top; searching, the row is the search box */
.livetv-head { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--tab-top)); z-index: 5; display: flex; align-items: stretch; gap: 8px; margin: 0 -16px -12px; padding: 0 8px 0 16px; min-height: 46px;
    background: var(--bg); border-bottom: 1px solid var(--border); }
.livetv-tabs { flex: 1; min-width: 0; display: flex; gap: 22px; }
.livetv-tab { position: relative; display: flex; align-items: center; gap: 5px; min-width: 0; padding: 0; border: 0; background: none; cursor: pointer;
    color: var(--text-dim); font: 600 0.95rem var(--font-body); white-space: nowrap; }
.livetv-tab.active { color: var(--text); }
.livetv-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.livetv-tab-cat { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--accent); font-weight: 500; font-size: 0.85rem; }
.livetv-search-btn { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; padding: 0; border: 0; background: none;
    color: var(--text-dim); font-size: 1.05rem; cursor: pointer; }
.livetv-search-btn:hover { color: var(--text); }
.livetv-search-btn[hidden], .livetv-search-row[hidden] { display: none; }
.livetv-head.is-searching .livetv-tabs { display: none; }
.livetv-search-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; padding: 5px 0; }
.livetv-search-row input { flex: 1; min-width: 0; height: 36px; margin: 0; padding: 0 12px; border: 0; border-radius: 8px; background: var(--surface); color: var(--text);
    font: inherit; font-size: 0.9rem; }
/* One list, edge to edge, its sections labelled inside it (they stick under the header) */
.livetv-list { display: flex; flex-direction: column; margin: 0 -16px; }
.livetv-list[hidden] { display: none; }
.livetv-list + .livetv-list { margin-top: -12px; }
.livetv-sec { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--tab-top) + 47px); z-index: 4; padding: 10px 16px 4px; background: var(--bg); border-bottom: 1px solid var(--border);
    color: var(--text-dim); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
/* A row: logo; name, number, ★, who's on it; on now; next; time left and ⋯. Always three lines tall. */
.livetv-ch { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 4px 7px 16px; border-bottom: 1px solid var(--border);
    background: var(--bg); cursor: pointer; -webkit-touch-callout: none; user-select: none; }
.livetv-ch:hover, .livetv-ch:focus-visible { background: var(--surface); }
.livetv-ch.playing .livetv-ch-name { color: var(--accent); }
.livetv-ch.editing { cursor: default; padding-right: 12px; }
.livetv-logo {
    width: 32px; height: 32px; border-radius: 5px; display: flex; align-items: center; justify-content: center; overflow: hidden;
    background: var(--surface-2); color: var(--text-dim); font: 600 0.7rem var(--font-display); letter-spacing: 0.03em;
}
.livetv-logo img { width: 100%; height: 100%; object-fit: contain; }
.livetv-ch-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.livetv-ch-line { min-width: 0; display: flex; align-items: baseline; gap: 6px; }
.livetv-ch-name { font-weight: 600; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livetv-ch-num { flex: none; color: var(--text-dim); font-size: 0.7rem; font-variant-numeric: tabular-nums; }
.livetv-ch-fav { flex: none; color: var(--gold); font-size: 0.7rem; }
.livetv-ch-who { flex: none; color: var(--heads); font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.livetv-ch-now, .livetv-ch-next { min-height: 1.3em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livetv-ch-now { font-size: 0.76rem; font-weight: 600; }
.livetv-ch-next { font-size: 0.72rem; color: var(--text-dim); }
.livetv-ch-end { display: flex; align-items: center; gap: 0; }
.livetv-ch-left { min-width: 3.2em; color: var(--text-dim); font-size: 0.7rem; line-height: 1.3; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.livetv-ch-left.soon { color: var(--accent); }
.livetv-more { width: 36px; height: 40px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--text-dim); font-size: 1.1rem; cursor: pointer; }
.livetv-more:hover { background: var(--surface-2); color: var(--text); }
.livetv-star {
    width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text-dim);
    font-size: 1rem; line-height: 1; cursor: pointer;
}
.livetv-star:hover { border-color: var(--border-hover); }
.livetv-star.on { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, var(--border)); }
.livetv-star:disabled { opacity: 0.5; }
.livetv-ch-tools { display: flex; gap: 6px; }
.livetv-tool {
    min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2);
    color: var(--text-dim); font: 500 0.82rem var(--font-body); cursor: pointer;
}
.livetv-tool:hover { border-color: var(--border-hover); color: var(--text); }
/* A search's programmes ("On the guide"), in the same list */
.livetv-show {
    display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 2px 10px; padding: 8px 16px; border: 0; border-bottom: 1px solid var(--border);
    background: var(--bg); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.livetv-show:hover { background: var(--surface); }
.livetv-show-when { grid-row: span 2; color: var(--text-dim); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.livetv-show-title { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livetv-show-channel { color: var(--text-dim); font-size: 0.76rem; }
/* "Keath is watching ESPN · Join" */
.livetv-watching { display: flex; flex-direction: column; gap: 6px; }
.livetv-watching[hidden] { display: none; }
.livetv-watching-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 12px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 0.88rem;
}
.livetv-watching-row .toggle-btn { flex: none; padding: 6px 14px; }
/* The player: Movie Night's stage (its controls over the picture), the Now playing card, Previous · Next · Guide · Stop.
   It scrolls away with the page. */
.livetv-player { display: flex; flex-direction: column; gap: 10px; }
.livetv-player[hidden] { display: none; }
.livetv-stage .watch-party-player-box { cursor: pointer; }
.livetv-stage:fullscreen .watch-party-player-box { position: absolute; }
.watch-party-controls[hidden] { display: none; }
.livetv-stage .watch-party-bar-top { align-items: center; gap: 8px; padding-top: 6px; }
.livetv-chip.is-live { background: var(--danger); color: var(--video-text); }
.livetv-top-btns { margin-left: auto; display: flex; gap: 2px; }
.livetv-cast-btn[hidden] { display: none; }
.castcard-head .livetv-cast-btn { color: var(--heads); }
.livetv-scrub-box { position: relative; }
.livetv-scrub::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--video-track) var(--joined, 0%), var(--heads) var(--joined, 0%), var(--heads) var(--at, 0%), var(--video-text) var(--at, 0%)); }
.livetv-scrub::-moz-range-track { background: linear-gradient(to right, var(--video-track) var(--joined, 0%), var(--heads) var(--joined, 0%), var(--heads) var(--at, 0%), var(--video-text) var(--at, 0%)); }
.livetv-joined-tick { position: absolute; top: 3px; width: 2px; height: 12px; margin-left: -1px; border-radius: 1px; background: var(--video-text); pointer-events: none; }
.livetv-joined-tick[hidden], .livetv-stage .watch-party-pill[hidden] { display: none; }
.livetv-you { color: var(--heads); }
.livetv-stage .watch-party-bar-row { min-height: 30px; }
.livetv-stage .watch-party-bar-row .watch-party-pill { padding: 4px 12px; }
.livetv-over {
    position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 12px;
    background: color-mix(in srgb, var(--shadow) 72%, transparent); color: var(--video-text); text-align: center; font-weight: 600;
}
.livetv-over[hidden] { display: none; }
.livetv-over p { margin: 0; }
.livetv-over-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.livetv-over-btns:empty { display: none; }
.livetv-stage.is-castcard .livetv-over { position: absolute; }
.livetv-over:not([hidden]) ~ .watch-party-controls { visibility: hidden; } /* (a message over the picture: its own buttons only) */
/* ...and ■, the only Stop there is: it stays, over the message, whether or not the bar has faded (a channel stuck tuning) */
.livetv-over:not([hidden]) ~ .watch-party-controls { z-index: 3; opacity: 1; }
.livetv-over:not([hidden]) ~ .watch-party-controls .slim-stop { visibility: visible; pointer-events: auto; }
.livetv-stage.is-castcard .slim-castrow { position: relative; z-index: 4; }
.livetv-castprog { display: flex; flex-direction: column; gap: 5px; }
.livetv-castprog-line { display: flex; justify-content: space-between; gap: 8px; font-size: 0.8rem; }
.livetv-castprog-line span { color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.livetv-castprog-sub { font-size: 0.74rem; }
.livetv-castprog-sub #livetv-castprog-you { color: var(--heads); font-weight: 600; }
.livetv-castprog-bar { position: relative; height: 6px; border-radius: 3px; background: var(--surface); overflow: hidden; }
.livetv-castprog-bar[hidden] { display: none; }
.livetv-castprog-bar i { position: absolute; top: 0; bottom: 0; left: 0; }
.livetv-castprog-bar .is-before { background: color-mix(in srgb, var(--text-dim) 45%, transparent); }
.livetv-castprog-bar .is-you { background: var(--heads); }
.livetv-cast-volume[hidden] { display: none; }
.livetv-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.livetv-card-logo .livetv-logo { width: 40px; height: 40px; font-size: 0.8rem; }
.livetv-now { min-width: 0; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livetv-stop { color: var(--danger); }
/* The sheets (a channel's: Watch, ★, Hide and its schedule; Watch on), from the bottom like Movie Night's */
.livetv-sheet-title { flex: 1; min-width: 0; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livetv-sheet-logo:empty { display: none; }
.livetv-sheet-body { display: flex; flex-direction: column; gap: 12px; }
.livetv-saved { color: var(--gold); }
.livetv-on-row { width: 100%; justify-content: space-between; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.livetv-on-mark { color: var(--heads); font-weight: 700; }
.livetv-guide-dialog { width: min(440px, calc(100vw - 32px)); }
.livetv-guide-body { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.livetv-guide-list { list-style: none; margin: 0; padding: 0; }
.livetv-guide-list:empty { display: none; }
.livetv-guide-day { padding: 10px 0 4px; color: var(--text-dim); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.livetv-guide-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); }
.livetv-guide-item.now .livetv-guide-when, .livetv-guide-item.now .livetv-guide-title { color: var(--accent); }
.livetv-guide-when { color: var(--text-dim); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.livetv-guide-what { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.livetv-guide-title { font-weight: 600; font-size: 0.9rem; }
.livetv-guide-desc { color: var(--text-dim); font-size: 0.8rem; }
/* Live TV's tab sits before the avatar */
.tab-bar.has-livetv { grid-template-columns: repeat(2, minmax(0, 1fr)) 56px; }
@media (min-width: 900px) {
    .tab-bar.has-livetv { grid-template-columns: repeat(2, auto) 1fr auto; }
}
/* The Category sheet, Manage's own rows */
.livetv-cat-body { max-height: min(70vh, 600px); overflow-y: auto; }
.livetv-cat-body .profile-label { margin: 6px 0 0; }
.livetv-manage-rows .profile-row { width: 100%; min-height: 42px; justify-content: space-between; cursor: pointer; border-width: 0 0 1px; background: none; color: var(--text); font-family: inherit; text-align: left; }
.livetv-manage-rows .profile-row:hover { background: var(--surface); }
/* "Still watching?" over another tab while a TV plays the channel (livetv.js liveTvStillAsk): a toast with its button */
.toast.livetv-still { display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: auto; }
.toast.livetv-still .toggle-btn { flex: none; }
/* Manage's categories: a row's name (a tap: a look at its channels, the search marked in it), its count, its switch; the
   row to All categories */
.livetv-catrow { gap: 8px; padding-right: 10px; }
.livetv-catname { flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none;
    color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.livetv-catname > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livetv-catname b { color: var(--accent); font-weight: 700; }
.livetv-chev { flex: none; color: var(--text-dim); font-size: 1.1rem; line-height: 1; }
.livetv-catcount { flex: none; margin-left: 0; font-variant-numeric: tabular-nums; }
.livetv-allcats-row { width: 100%; border: 0; background: none; color: var(--text); font: 600 0.9rem var(--font-body); text-align: left; cursor: pointer; }
.livetv-allcats-row:hover, .livetv-catname:hover { color: var(--accent); }
/* All categories: one height while it is searched; the search, Filters · Sort and what the list is stay, the rows scroll */
.livetv-allcats { height: 82vh; text-align: left; }
#livetv-allcats-back[hidden] { display: none; }
.livetv-allcats-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.livetv-allcats-body[hidden] { display: none; }
.livetv-allcats-top { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 10px; border-bottom: 1px solid var(--border); }
#livetv-cat-search { width: 100%; height: 40px; margin: 0; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
    color: var(--text); font: inherit; font-size: 0.9rem; }
.livetv-allcats-line { position: relative; display: flex; align-items: center; gap: 8px; }
#livetv-allcats-count { flex: 1; min-width: 0; font-weight: 600; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.livetv-allcats-on { margin: -2px 0 0; color: var(--accent); font-size: 0.8rem; }
.livetv-allcats-menu { position: absolute; top: calc(100% + 4px); right: 0; z-index: 10; min-width: 190px; padding: 4px; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border-hover); border-radius: 10px; box-shadow: 0 12px 30px color-mix(in srgb, var(--shadow) 60%, transparent); }
.livetv-allcats-menu[hidden] { display: none; }
.livetv-allcats-menu button[role="menuitemradio"] { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 40px; padding: 0 12px; border: 0; border-radius: 6px;
    background: none; color: var(--text); font: 500 0.88rem var(--font-body); text-align: left; cursor: pointer; }
.livetv-allcats-menu button[role="menuitemradio"]:hover { background: var(--surface-2); }
.livetv-allcats-menu button[role="menuitemradio"][aria-checked="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.livetv-allcats-menu button[role="menuitemradio"][aria-checked="true"]::after { content: "✓"; }
.livetv-allcats-rows { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom, 0px); }
.livetv-allcats-rows .profile-row { padding-left: 16px; }
.livetv-allcats .livetv-sec { top: 0; background: var(--surface); }
.livetv-allcats-none { padding: 16px; }
/* A look inside one category: Show for everyone, then its channels (nothing plays from here) */
.livetv-peek-what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.livetv-peek-sub { color: var(--text-dim); font-size: 0.76rem; font-weight: 400; }
.livetv-peek-row, .livetv-peek-row:hover { min-height: 48px; padding-right: 16px; background: var(--surface); cursor: default; }
/* Edit: a box on each row, ticked when it is selected; the bar stays along the bottom of the screen while the list scrolls */
.livetv-ch.selectable { grid-template-columns: 22px 32px minmax(0, 1fr) auto; cursor: pointer; }
.livetv-ch.selected { background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.livetv-check { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--border-hover); border-radius: 6px; }
.livetv-ch.selected .livetv-check { background: var(--accent); border-color: var(--accent); }
.livetv-ch.selected .livetv-check::after { content: ""; width: 10px; height: 5px; border: solid var(--accent-ink); border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
/* Edit's one slim row, docked under the head (which sticks above it): the count, Select all, then Hide · Save · Unsave · ✕ */
.livetv-edit-bar { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--tab-top) + 46px); z-index: 4; display: flex; align-items: center; gap: 8px;
    margin: 0 -16px -12px; padding: 0 16px; min-height: 40px; border-bottom: 1px solid var(--border); background: var(--bg); }
.livetv-edit-bar[hidden] { display: none; }
#livetv-select-count { min-width: 0; font-weight: 600; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#livetv-select-all, #livetv-edit-tile { flex: none; }
#livetv-select-all:disabled, #livetv-edit-tile:disabled { opacity: 0.4; cursor: default; }
.livetv-edit-acts { flex: none; display: flex; gap: 4px; margin-left: auto; }
.livetv-edit-acts .slim-act { padding: 0 7px; }
#livetv-edit-clear span { display: none; }
@media (max-width: 480px) {
    .livetv-edit-acts .slim-act:not(#livetv-edit-hide) span { display: none; } /* (their icons, each with its name for a reader) */
}
.livetv-edit-hide .icon-show, .livetv-edit-hide.is-show .icon-hide { display: none; }
.livetv-edit-hide.is-show .icon-show { display: inline; }
/* Filters' countries: a heading and a switch each under the menu's picks (the menu scrolls on a short screen) */
.livetv-allcats-menu { max-height: min(70vh, 420px); overflow-y: auto; }
.livetv-allcats-menu > * { flex: none; }
.livetv-allcats-menu .livetv-sec { position: static; margin-top: 4px; padding: 8px 12px 4px; border-top: 1px solid var(--border); border-bottom: 0; }
.livetv-country-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; padding: 0 8px 0 12px; font-size: 0.88rem; font-weight: 500; }
/* US by default (11-15): the service a channel is from, small plain text in the row's top corner; a shown category's guide
   coverage under its name in Manage */
.livetv-catname { flex-wrap: wrap; column-gap: 4px; row-gap: 0; }
.livetv-catname > span:first-child { max-width: calc(100% - 1.4em); } /* (the › stays beside the name) */
.livetv-catcov { order: 3; flex-basis: 100%; color: var(--text-dim); font-size: 0.72rem; font-weight: 400; }
/* Our own categories (11-15): Manage's row for one of ours with its switch (its categories under it, set in); the look inside a category's "Shows under" squares */
.livetv-grouprow { gap: 8px; padding-right: 10px; background: var(--surface-2); font-weight: 600; }
#livetv-cat-switches .livetv-catrow { padding-left: 28px; }
.livetv-allcats-top .profile-label { margin: 2px 0 -2px; }
/* The Guide's timeline (11-16 look): a sticky channel column (the logo with its badge on a phone, the full name beside it
   from 600 px), then two hours at --tl-w (it scrolls sideways on a phone); ‹ › in the top-left corner; a faint 1 px line
   for now with a green notch and NOW on the time header, what aired dimmed; a title stays in sight when its programme
   started off to the left (sticky inside a cell that clips without scrolling); nothing selects as text */
.livetv-tl[hidden] { display: none; }
.livetv-tl { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.livetv-tl-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.livetv-tl-grid { --tl-ch: 64px; --tl-w: 640px; --tl-head: 34px; position: relative; width: calc(var(--tl-ch) + var(--tl-w)); }
.livetv-tl-row { display: flex; border-bottom: 1px solid var(--border); }
.livetv-tl-ch { position: sticky; left: 0; z-index: 3; flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; width: var(--tl-ch);
    min-height: 54px; padding: 4px 6px; border: 0; border-right: 1px solid var(--border); background: var(--bg); color: var(--text); text-align: left; cursor: pointer; }
.livetv-tl-ch .livetv-logo { flex: none; width: 48px; height: 40px; }
.livetv-tl-name { display: none; flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; font-weight: 600; }
.livetv-tl-ruler .livetv-tl-ch { min-height: 0; padding: 0 2px; gap: 0; cursor: default; }
.livetv-tl-ruler .livetv-tl-track { height: var(--tl-head); }
.livetv-tl-step { flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--text); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.livetv-tl-step:hover:not(:disabled) { background: var(--surface-2); }
.livetv-tl-step:disabled { color: var(--text-dim); opacity: 0.4; cursor: default; }
.livetv-tl-when { display: none; min-width: 0; padding-left: 6px; color: var(--text-dim); font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.livetv-tl-track { position: relative; flex: none; width: var(--tl-w); }
.livetv-tl-mark { position: absolute; top: 5px; padding-left: 6px; border-left: 1px solid var(--border); color: var(--text-dim); font-size: 0.7rem; white-space: nowrap; }
.livetv-tl-show { position: absolute; z-index: 1; top: 0; bottom: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; min-width: 0;
    padding: 4px 8px; margin-left: 1px; overflow: clip; border: 0; border-left: 1px solid var(--border); border-radius: 0; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.livetv-tl-show:hover { background: var(--surface-2); }
.livetv-tl-show.now { background: color-mix(in srgb, var(--heads) 9%, var(--surface)); }
.livetv-tl-show.past { color: var(--text-dim); }
.livetv-tl-title, .livetv-tl-time { position: sticky; left: calc(var(--tl-ch) + 8px); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livetv-tl-title { font-size: 0.78rem; font-weight: 600; }
.livetv-tl-time { color: var(--text-dim); font-size: 0.68rem; }
.livetv-tl-now { position: absolute; z-index: 2; top: var(--tl-head); bottom: 0; width: 1px; left: calc(var(--tl-ch) + var(--tl-w) * var(--at, 0));
    background: color-mix(in srgb, var(--heads) 40%, transparent); pointer-events: none; }
.livetv-tl-aired { position: absolute; z-index: 2; top: var(--tl-head); bottom: 0; left: var(--tl-ch); width: calc(var(--tl-w) * var(--at, 0));
    background: color-mix(in srgb, var(--shadow) 32%, transparent); pointer-events: none; }
.livetv-tl-now[hidden], .livetv-tl-notch[hidden] { display: none; }
.livetv-tl-notch { position: absolute; bottom: -1px; left: calc(100% * var(--at, 0)); width: 0; height: 0; margin-left: -5px; border: 5px solid transparent; border-top: 0;
    border-bottom: 6px solid var(--heads); }
.livetv-tl-nowpill { position: absolute; z-index: 1; bottom: 4px; left: calc(100% * var(--at, 0)); margin-left: 6px; padding: 3px 6px; border: 0; border-radius: 4px;
    background: var(--heads); color: var(--heads-ink); font: 700 0.56rem/1 var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; }
.livetv-tl-nowpill:disabled { opacity: 1; cursor: default; }
.livetv-tl-nowpill.is-away { left: 0; cursor: pointer; } /* (pinned to the edge: a tap goes back to now) */
.livetv-tl-nowpill.is-away::before { content: "‹ "; }
@media (min-width: 600px) {
    .livetv-tl-grid { --tl-ch: 190px; }
    .livetv-tl-ch:not(.livetv-tl-corner) { justify-content: flex-start; padding-left: 12px; }
    .livetv-tl-name { display: block; }
    .livetv-tl-corner { justify-content: flex-start; padding-left: 8px; }
    .livetv-tl-when { display: block; }
}
/* A channel's logo on a light square, or a dark one when the logo is bright (white on see-through: iptv_logo_bright); one without (none, a 404, or
   a service's logo shared by many: iptv_logo_shared) gets Flippy's tile: the first two words of its name on a colour
   picked from the name (livetv.js liveTvLogo), sized to the square it's in, the first word only at the timeline's 24px */
.livetv-logo.livetv-img { background: var(--logo-backdrop); padding: 2px; }
.livetv-logo.livetv-img-dark { background: var(--logo-backdrop-dark); }
.livetv-tile-0 { background: var(--tile-0); } .livetv-tile-1 { background: var(--tile-1); } .livetv-tile-2 { background: var(--tile-2); } .livetv-tile-3 { background: var(--tile-3); }
.livetv-tile-4 { background: var(--tile-4); } .livetv-tile-5 { background: var(--tile-5); } .livetv-tile-6 { background: var(--tile-6); } .livetv-tile-7 { background: var(--tile-7); }
.livetv-logo.livetv-tile { position: relative; container-type: size; color: var(--tile-ink); }
.livetv-tile-text, .livetv-tile-short { padding: 8cqi; max-width: 100%; font: 600 20cqi / 1.02 var(--font-display); text-transform: uppercase; text-align: center; overflow-wrap: anywhere; }
.livetv-tile-short { display: none; padding: 4cqi; font-size: 30cqi; }
.livetv-tile-num { position: absolute; right: 0; bottom: 0; padding: 0 7cqi; border-top-left-radius: 10cqi; background: var(--tile-num-bg); font: 700 20cqi var(--font-display); }
@container (max-width: 28px) {
    .livetv-tile-text, .livetv-tile-num { display: none; }
    .livetv-tile-short { display: block; }
}
/* The copy's mark (11-16: EAST, EXTR, SIG, NY...): a small badge, always on the logo's top right */
.livetv-logo { position: relative; }
.livetv-badge { position: absolute; z-index: 1; top: 2px; right: 2px; padding: 2px 3px; border-radius: 3px; background: color-mix(in srgb, var(--shadow) 78%, transparent);
    color: var(--video-text); font: normal 700 0.5rem/1 var(--font-body); letter-spacing: 0.03em; pointer-events: none; }
.livetv-tile:has(.livetv-badge) .livetv-tile-num { display: none; } /* (the badge says which copy) */

/* The Google TV app's tuning layer (livetv.js liveTvTune, 11-15): the whole screen from the press until This TV's player has
   the channel. The channel's tile, its name, a gold spinner with "Tuning in… N s", or what went wrong and its buttons. */
.livetv-tune { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px;
    background: var(--bg); color: var(--text); text-align: center; font-size: 1rem; }
.livetv-tune[hidden], .livetv-tune-spin[hidden] { display: none; }
.livetv-tune-logo .livetv-logo { width: 64px; height: 64px; }
.livetv-tune-line { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.livetv-tune-spin { width: 16px; height: 16px; border: 2px solid color-mix(in srgb, var(--gold) 25%, transparent); border-top-color: var(--gold); border-radius: 50%; animation: livetv-tune-spin 0.9s linear infinite; }
@keyframes livetv-tune-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .livetv-tune-spin { animation: none; } }
.livetv-tune-btns { display: flex; gap: 8px; margin-top: 6px; }
.livetv-tune-btns:empty { display: none; }
.livetv-tune .slim-ask-btn { background: var(--surface-2); color: var(--text); }

/* Home and Guide (11-16): a network with several local stations is one row; open, a slim row a city, five first */
.livetv-net { border-bottom: 1px solid var(--border); }
.livetv-net-head { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 7px 12px 7px 16px; border: 0;
    background: var(--bg); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.livetv-net-head:hover, .livetv-net-head:focus-visible { background: var(--surface); }
.livetv-net-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 0.9rem; }
.livetv-net.is-open .livetv-chev { transform: rotate(90deg); }
.livetv-cities { display: flex; flex-direction: column; }
.livetv-cities[hidden] { display: none; }
.livetv-city, .livetv-city-more { display: flex; align-items: baseline; gap: 10px; min-width: 0; height: 36px; padding: 0 12px 0 58px; border: 0; border-top: 1px solid var(--border);
    background: none; color: var(--text); font: inherit; font-size: 0.85rem; text-align: left; cursor: pointer; line-height: 36px; }
.livetv-city:hover, .livetv-city-more:hover { background: var(--surface); }
.livetv-city b { flex: none; font-weight: 600; }
.livetv-city span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }
.livetv-city.playing b { color: var(--accent); }
.livetv-city-more { color: var(--accent); }
.livetv-home-cats { padding: 4px 16px 12px; }
/* A programme's details (the timeline's tap): what and when, its description, Tune in · Favourite, then what's next */
.livetv-prog-h { margin: 0; font-size: 1.1rem; }
.livetv-prog-when, .livetv-prog-next { margin: 0; color: var(--text-dim); font-size: 0.85rem; }
.livetv-prog-desc { margin: 0; font-size: 0.9rem; line-height: 1.4; }
.livetv-prog-desc:empty, .livetv-prog-next:empty { display: none; }
/* The backup card, over the picture: the channel's other copies, a slim row each with Tune */
.livetv-backup { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 12px 16px; overflow-y: auto;
    background: color-mix(in srgb, var(--shadow) 82%, transparent); color: var(--video-text); }
.livetv-backup[hidden] { display: none; }
.livetv-backup-head { margin: 0; font-weight: 600; }
.livetv-backup-list { display: flex; flex-direction: column; max-width: 520px; width: 100%; }
.livetv-backup-row { display: flex; align-items: center; gap: 10px; min-height: 40px; border-bottom: 1px solid color-mix(in srgb, var(--video-text) 18%, transparent); }
.livetv-backup-row .livetv-ch-body { flex: 1; min-width: 0; }
.livetv-backup-row .livetv-ch-now { color: color-mix(in srgb, var(--video-text) 70%, transparent); }
.livetv-backup-row .slim-act { flex: none; padding: 0 12px; }
.livetv-backup-none, .livetv-backup-foot { margin: 0; font-size: 0.8rem; color: color-mix(in srgb, var(--video-text) 70%, transparent); }
.livetv-backup .slim-acts { max-width: 520px; }
.livetv-backup:not([hidden]) ~ .watch-party-controls { visibility: hidden; z-index: 5; opacity: 1; } /* (its own buttons only, and ■, as over a message) */
.livetv-backup:not([hidden]) ~ .watch-party-controls .slim-stop { visibility: visible; pointer-events: auto; }
/* The mini player: under the tabs once the player has scrolled away; the head wraps to hold it */
.livetv-head:has(.livetv-mini:not([hidden])) { flex-wrap: wrap; }
.livetv-mini { position: relative; flex-basis: 100%; display: flex; align-items: center; gap: 8px; margin: 0 -8px 0 -16px; box-sizing: border-box; height: 45px; padding: 0 8px 2px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.livetv-mini[hidden] { display: none; }
#livetv-view:has(.livetv-mini:not([hidden])) .livetv-sec { top: calc(env(safe-area-inset-top, 0px) + var(--tab-top) + 47px + 45px); } /* (sections stick under the taller head) */
.livetv-mini-logo .livetv-logo { width: 28px; height: 28px; }
.livetv-mini-body { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.livetv-mini-body b, .livetv-mini-body span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livetv-mini-body b { font-size: 0.85rem; }
.livetv-mini-body span { color: var(--text-dim); font-size: 0.75rem; }
.livetv-mini .watch-party-icon { color: var(--text); }
.livetv-mini .watch-party-icon[hidden] { display: none; }
.livetv-mini-pause .icon-pause, .livetv-mini-pause.is-playing .icon-play { display: none; }
.livetv-mini-pause.is-playing .icon-pause { display: block; }
.livetv-mini-mute .icon-muted, .livetv-mini-mute[aria-pressed="true"] .icon-sound { display: none; }
.livetv-mini-mute[aria-pressed="true"] .icon-muted { display: block; }
.livetv-mini-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--border); }
.livetv-mini-bar i { display: block; height: 100%; background: var(--accent); }
/* Manage on a computer (11-16): three panes on a wide window; elsewhere a note (phones and the TV keep Edit and Hidden
   only) */
.livetv-desk-only { display: none; }
.livetv-desk-note { display: block; }
@media (min-width: 1280px) {
    .livetv-desk-only { display: flex; flex-direction: column; gap: 12px; }
    .livetv-desk-note { display: none; }
    html:not(.tv) #livetv-manage:has(.livetv-desk-only) { max-width: var(--page-max); } /* (the panes take the page's column) */
}
.livetv-desk { display: flex; flex-direction: column; gap: 10px; }
.livetv-desk-head { display: flex; align-items: center; gap: 14px; }
.livetv-desk-head input { flex: 0 1 360px; height: 34px; margin: 0; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem; }
.livetv-desk-count { color: var(--text-dim); font-size: 0.82rem; }
.livetv-desk-panes { display: grid; grid-template-columns: 220px 260px minmax(0, 1fr); gap: 0; height: min(70vh, 720px); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.livetv-pane { display: flex; flex-direction: column; min-width: 0; overflow-y: auto; padding: 6px 0; border-right: 1px solid var(--border); }
.livetv-pane:last-child { border-right: 0; padding: 0; }
.livetv-pane .profile-label { margin: 10px 12px 4px; }
.livetv-desk-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; height: 32px; padding: 0 12px; border: 0; background: none;
    color: var(--text); font: inherit; font-size: 0.86rem; text-align: left; cursor: pointer; }
.livetv-desk-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livetv-desk-item small { flex: none; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.livetv-desk-item:hover { background: var(--surface); }
.livetv-desk-item.active { background: var(--surface-2); color: var(--accent); font-weight: 600; }
.livetv-desk-cat { display: flex; align-items: center; padding-right: 10px; }
.livetv-desk-cat .livetv-desk-item { flex: 1; }
.livetv-desk-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 0 12px; font-size: 0.84rem; }
.livetv-desk-line select { max-width: 150px; height: 30px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 0.8rem; }
.livetv-desk-bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--bg); font-size: 0.84rem; }
.livetv-desk-bar .slim-act { flex: none; padding: 0 10px; }
.livetv-desk-bar.is-idle .slim-act:not(:first-of-type) { opacity: 0.5; pointer-events: none; }
.livetv-desk-hint { flex: 1; color: var(--text-dim); font-size: 0.76rem; }
.livetv-desk-row { display: grid; grid-template-columns: 28px minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) 48px 96px; align-items: center; gap: 8px; min-height: 34px; padding: 0 10px;
    border-bottom: 1px solid var(--border); font-size: 0.84rem; }
.livetv-desk-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livetv-desk-row > span:last-child { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 0.74rem; }
.livetv-desk-th { position: sticky; top: 43px; z-index: 1; background: var(--bg); color: var(--text-dim); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.livetv-desk-row.is-picked { background: var(--surface); }
.livetv-desk-row.is-off .livetv-desk-name { color: var(--text-dim); }
.livetv-desk-name { min-width: 0; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livetv-desk-name:hover { text-decoration: underline; }
.livetv-desk-copies { margin: 0; padding: 4px 10px 8px 46px; border-bottom: 1px solid var(--border); color: var(--text-dim); font-size: 0.76rem; }
.livetv-desk-rows .manage-note { padding: 12px; }

/* ---------- History (/history, from the Profile sheet): your record, the games you were in, the stats ---------- */
.history-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin: 0 0 6px -4px; padding: 4px; border: 0; background: none;
    color: var(--text-dim); font: 500 0.85rem var(--font-body); cursor: pointer; }
.history-back:hover { color: var(--text); }
.history-me { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.history-me:empty { display: none; }
.history-me .stats-tiles { margin: 0; }
.stats-tiles.is-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-tiles.is-four .stats-tile { padding: 8px 6px 9px; text-align: center; }
.stats-tiles.is-four dt { font-size: 0.62rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-tiles.is-four dd { font-size: 1.35rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-tile.is-gold dd { color: var(--gold); }
.history-rank { font-size: 0.82rem; color: var(--text-soft); text-align: left; }
.games-tools .toggle-group.games-filters { margin: 0; }
.games-archived-btn { align-self: center; margin: 10px 0 0; font-size: 0.82rem; }
.games-archived-btn[hidden] { display: none; }
.badge-won { --badge: var(--heads); }
.badge-lost { --badge: var(--tails); }
#games-view .stats-body { margin-top: 1rem; }
.stats-table.stats-vs { font-variant-numeric: tabular-nums; }
.stats-table.stats-vs thead th.stats-num { width: 2.4rem; }
.stats-table.stats-vs thead th.stats-num:nth-child(4) { width: 3.4rem; }
.stats-table.stats-vs thead th.stats-num:last-child { width: 4.4rem; }
.stats-table.stats-vs .stats-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.games-more-btn { width: 100%; margin-top: 8px; }
.stats-table.stats-vs td { text-align: right; }
.stats-table.stats-vs tr.is-you > * { color: var(--heads); font-weight: 600; }
.stats-vs-h2h { list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 0.85rem; }
.stats-vs-bar { display: flex; gap: 2px; height: 8px; margin-top: 5px; border-radius: 4px; overflow: hidden; }
.stats-vs-bar .is-heads { background: var(--heads); }
.stats-vs-bar .is-tails { background: var(--tails); }
.stats-everyone-coin { margin: 6px 0 0; font-size: 0.8rem; }
.stats-everyone-streak { color: var(--text-dim); font-weight: 500; }
.stats-more { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.stats-more > summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 1.25rem; cursor: pointer; list-style: none; }
.stats-more > summary::-webkit-details-marker { display: none; }
.stats-more > summary::after { content: "›"; margin-left: auto; color: var(--text-dim); transition: transform 0.15s; }
.stats-more[open] > summary::after { transform: rotate(90deg); }
.stats-more-title { font-weight: 600; font-size: 0.95rem; flex: none; }
.stats-more > summary small { color: var(--text-dim); font-size: 0.74rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-more-body { display: flex; flex-direction: column; gap: 1rem; padding: 0 0.75rem 0.75rem; }

/* ---------- The Roku (watchtv.js): Stop on the Roku while it plays this person's movie ---------- */
#watch-party-roku-stop { display: block; margin: 8px auto 0; }
#watch-party-roku-stop[hidden] { display: none; }

/* ---------- Movie Night page: the reveal and the player around Watch Together (watchparty-page.js) ---------- */
/* #arena-view.is-mn-reveal: the scoreboard and the poster, then Begin (the winner card and the end bar go; New Match is
   in the ⋯). .is-mn-player: the player page alone, with its own header (the game bar goes). .is-mn-pending: the first
   answer isn't in yet (a page opened while the movie is on goes straight to the player), so nothing shows. */
#arena-view.is-mn-pending > * { visibility: hidden; }
#arena-view.is-mn-reveal > :is(.end-actions, .winner-card) { display: none !important; }
#arena-view.is-mn-player > :not(#watch-party) { display: none !important; }
body:has(#arena-view.active.is-mn-player) #game-bar { display: none; }
#arena-view:is(.is-mn-reveal, .is-mn-player) #watch-party { margin-top: 0; padding: 0; gap: 12px; background: none; border: 0; border-radius: 0; overflow: visible; }
#arena-view:not(.is-mn-reveal) #mn-reveal, #arena-view:not(.is-mn-player) #mn-head { display: none; }
#arena-view.is-mn-reveal #watch-party > :not(#mn-reveal, dialog, #watch-party-msg, #watch-party-roku-stop) { display: none; }

/* The reveal: Begin Watching (its fill is how far the copies are from ready to play), gold Ready, who else is in, where it plays */
.mn-reveal { display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: 100%; max-width: 360px; margin: 16px auto 0; text-align: center; }
.mn-begin { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; min-height: 64px; padding: 10px 16px; cursor: pointer;
    border: 1px solid var(--border-hover); border-radius: 12px; color: var(--text); font: inherit;
    background: linear-gradient(90deg, var(--heads-soft) var(--fill, 0%), var(--surface-2) var(--fill, 0%)); }
.mn-begin:hover { border-color: var(--text-dim); }
.mn-begin:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mn-begin-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.mn-begin-line { max-width: 100%; color: var(--text-dim); font-size: 0.84rem; overflow-wrap: anywhere; }
.mn-begin-eta { color: var(--text-dim); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.mn-begin-eta:empty { display: none; }
.mn-begin.is-ready { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.mn-begin.is-ready .mn-begin-line { color: var(--gold-ink); }
.mn-partner { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; color: var(--text-dim); font-size: 0.85rem; }
.mn-partner .watch-party-face { width: 20px; height: 20px; font-size: 0.64rem; }
.mn-partner-state.is-ok { color: var(--watch-ok); font-weight: 600; }
.mn-wide-btn { display: block; width: 100%; min-height: 44px; padding: 10px 16px; cursor: pointer; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface-2); color: var(--text); font: 600 0.9rem var(--font-body); }
.mn-wide-btn:hover:not(:disabled) { border-color: var(--border-hover); }
.mn-wide-btn:disabled { opacity: 0.6; cursor: default; }
.mn-wide-btn.is-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.mn-wide-btn.is-ghost { background: none; border-color: transparent; color: var(--text-dim); }

/* The player page: header with ‹, the video edge to edge on a phone, the movie card, the people row, four squares */
.mn-head { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.mn-head-back { flex: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; cursor: pointer;
    border: 0; border-radius: 8px; background: none; color: var(--text); }
.mn-head-back:hover { background: var(--surface-2); }
.mn-head-title { flex: 1; min-width: 0; margin: 0; font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; text-align: left; }
#arena-view.is-mn-player .watch-party-stage:not(.is-filled, :fullscreen) { margin: 0; border-radius: 12px; }
@media (max-width: 520px) { #arena-view.is-mn-player .watch-party-stage:not(.is-filled, :fullscreen) { margin: 0 -1.25rem; border-radius: 0; } }
.mn-bar-gap { flex: 1; }
.watch-party-icon.is-on { color: var(--heads); }
.mn-time-left { font-size: 0.78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.mn-card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; text-align: left; }
.mn-card-poster { flex: none; display: flex; align-items: center; justify-content: center; width: 54px; aspect-ratio: 2 / 3; overflow: hidden; padding: 2px;
    border-radius: 6px; background: var(--surface-2) center / cover no-repeat; color: var(--text-dim); font-size: 0.6rem; text-align: center; overflow-wrap: anywhere; }
.mn-card-title { font-weight: 700; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mn-card-meta { color: var(--text-dim); font-size: 0.8rem; }
.mn-card-meta:empty { display: none; }
.mn-card-result { color: var(--gold); font-size: 0.82rem; font-weight: 600; }
.mn-card-ends { display: flex; justify-content: space-between; gap: 8px; color: var(--text-dim); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.mn-card-ends b { color: var(--text); }
.mn-card-more { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 14px 14px; border-top: 1px solid var(--border); animation: bar-in 0.25s ease-out; }
.mn-card-score { width: 100%; }
.mn-score-head { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0 0 8px; font-family: var(--font-display); font-size: 1.15rem; text-align: center; }
.mn-score-rig { margin: 0 0 8px; color: var(--text-dim); font-size: 0.85rem; text-align: center; }
.mn-score-rounds { list-style: none; margin: 0; padding: 0; }
.mn-score-rounds li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 2px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.mn-score-rounds li:last-child { border-bottom: 0; }
.mn-score-rounds span { color: var(--text-dim); }
.mn-card-score .is-win { color: var(--gold); }
.mn-card-score .is-lose { color: var(--tails); }
.mn-people-faces { flex: none; display: flex; gap: 10px; }
.mn-who { display: inline-flex; align-items: center; gap: 5px; font-size: 0.82rem; font-weight: 600; }
.mn-who .watch-party-face { width: 20px; height: 20px; font-size: 0.62rem; }
.mn-who .watch-party-dot { flex-basis: 7px; width: 7px; height: 7px; }

/* Over the video: someone's press for a moment, who it waits on, the countdown with Wait, not yet / Start now (the
   middle buttons step aside for it), a skip's Cancel; as a remote (casting, a TV) the same in line, over the controls */
.mn-over { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 48px 12px 12px;
    color: var(--video-text); pointer-events: none; }
.mn-over.is-dim { justify-content: center; padding-top: 12px; background: var(--video-shade); }
.watch-party-stage.is-counting .watch-party-bar-mid { visibility: hidden; }
.mn-toast { display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 12px; border-radius: 10px; background: var(--video-shade);
    font-size: 0.82rem; font-weight: 600; animation: bar-in 0.2s ease-out; }
.mn-toast-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--tails); }
.mn-wait { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 100%; padding: 8px 14px; border-radius: 12px;
    background: var(--video-shade); font-size: 0.82rem; text-align: center; }
.mn-wait b { font-size: 0.95rem; }
.mn-wait b:empty { display: none; }
.mn-wait.is-count { padding: 0; background: none; font-size: 0.9rem; }
.mn-wait-n { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; line-height: 1; color: var(--gold); }
.mn-wait-btns { display: flex; gap: 8px; margin-top: 6px; }
.mn-wait-btns:not(:has(> :not([hidden]))) { display: none; }
.mn-over-btn { padding: 7px 14px; cursor: pointer; pointer-events: auto; border: 1px solid var(--video-track); border-radius: 8px;
    background: var(--video-shade); color: var(--video-text); font: 600 0.82rem var(--font-body); }
.mn-over-btn.is-go { border-color: var(--heads); background: var(--heads); color: var(--heads-ink); }
.mn-over-btn:disabled { opacity: 0.6; cursor: default; }
.mn-skip-cancel { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); }
.watch-party-stage.is-remote .mn-over { position: static; padding: 4px 12px 0; color: var(--text); background: none; }
.watch-party-stage.is-remote .mn-over:not(:has(> :not([hidden]))) { display: none; }
.watch-party-stage.is-remote :is(.mn-toast, .mn-wait) { background: var(--surface); }
.watch-party-stage.is-remote .mn-skip-cancel { position: static; transform: none; }
.watch-party-stage.is-remote .mn-over-btn:not(.is-go) { border-color: var(--border); background: var(--surface); color: var(--text); }

/* The settings sheet: Where as rows to tap (a check on what's in effect); the other selects are drop-downs (.st-dd,
   watchparty-sheet.js), the hidden ones the state */
#watch-party-sheet .watch-party-join select:not(.st-dd), #watch-party-sheet #watch-party-join-btn { display: none; }
#watch-party-sheet .watch-party-tab-watch .watch-row { order: 1; justify-content: flex-end; }
.mn-rows[hidden] { display: none; }
.mn-rows { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.mn-rows:empty { display: none; }
.mn-rows-head { margin: 0; padding: 8px 12px 4px; border-bottom: 1px solid var(--border); color: var(--text-dim); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
.mn-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 8px 12px; cursor: pointer; text-align: left;
    border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); font: inherit; font-size: 0.92rem; }
.mn-row:last-child { border-bottom: 0; }
.mn-row:hover:not(:disabled) { background: var(--surface); }
.mn-row:disabled { color: var(--text-dim); cursor: default; }
.mn-row-check { flex: none; width: 16px; color: var(--heads); font-weight: 700; }
.mn-row-main { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.mn-row.is-on .mn-row-main { font-weight: 600; }
.mn-row-more { flex: 0 1 auto; min-width: 0; max-width: 55%; color: var(--text-dim); font-size: 0.78rem; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The End sheet: End Watch Together, Complete Movie Night, Keep watching */
.mn-end-body { display: flex; flex-direction: column; gap: 10px; padding: 20px 16px calc(18px + env(safe-area-inset-bottom, 0px)); text-align: left; }
.mn-end-title { margin: 0; font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; }
.mn-end-body .watch-party-note { margin-bottom: 4px; }

/* A phone turned sideways: the player fills the screen by itself (clear of the notch), the page under it held still */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
    #arena-view.active.is-mn-player .watch-party-stage:not(.is-remote) { position: fixed; inset: 0; z-index: 1000; margin: 0; border-radius: 0; aspect-ratio: auto; }
    #arena-view.active.is-mn-player .watch-party-stage:not(.is-remote) :is(.watch-party-player-box, .watch-party-controls) {
        inset: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
    html:has(#arena-view.active.is-mn-player #watch-party-live:not([hidden]) .watch-party-stage:not(.is-remote)),
    html:has(#arena-view.active.is-mn-player #watch-party-live:not([hidden]) .watch-party-stage:not(.is-remote)) body { overflow: hidden; }
}

/* A show room (watchparty.js openShowRoom): no game around the player, the show's poster and episode on the reveal, and
   Ready over the video for the next episode */
#arena-view.is-show :is(.scoreboard, .match-banner, .intro-layer, .flip-container, .arena-actions, .end-actions, .winner-card, .got-here-link, .got-here-panel) { display: none !important; }
.mn-reveal-show { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.mn-reveal-show[hidden] { display: none; }
.mn-reveal-poster { width: 140px; aspect-ratio: 2 / 3; border-radius: 10px; background: var(--surface-2) center / cover no-repeat; border: 1px solid var(--border); }
.mn-reveal-show-text { display: flex; flex-direction: column; gap: 4px; }
.mn-reveal-title { margin: 0; font-family: var(--font-display); font-size: 1.35rem; line-height: 1.15; }
.mn-reveal-episode { margin: 0; color: var(--text-dim); font-size: 0.9rem; }
#mn-next-ready { min-height: 36px; padding: 0 22px; }

/* The shuffle's new look (11-16): the landed movie blurred behind the strip (shuffle.js setStagingBackdrop), the stand-off's
   centred VS, and the who-added dots on the flip page (arena.js markWhoAdded: green the starter's, pink the invitee's) */
#staging-view { isolation: isolate; }
.staging-backdrop { position: absolute; inset: -40px; z-index: -1; background-size: cover; background-position: center; filter: blur(28px) brightness(0.35); opacity: 0; transition: opacity 0.6s ease; pointer-events: none; }
.staging-backdrop.is-on { opacity: 1; }
.intro-vs { position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 3; padding: 4px 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); font: 700 1.1rem var(--font-display); letter-spacing: 0.08em; color: var(--text); transition: opacity 0.3s ease; }
.intro-layer.merge-in .intro-vs { opacity: 0; }
.face[data-who]::before { content: ''; position: absolute; z-index: 2; top: 8px; right: 8px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); }
.score-name[data-who]::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; }
:is(.face, .score-name)[data-who="starter"]::before { background: var(--heads); }
:is(.face, .score-name)[data-who="invitee"]::before { background: var(--tails); }

/* ---------- Shows (shows.js): the list, a show's page, its seasons ---------- */
/* The Shows tab sits after Movies (and before Live TV) */
.tab-bar.has-shows { grid-template-columns: repeat(2, minmax(0, 1fr)) 56px; }
.tab-bar.has-shows.has-livetv { grid-template-columns: repeat(3, minmax(0, 1fr)) 56px; }
@media (min-width: 900px) {
    .tab-bar.has-shows { grid-template-columns: repeat(2, auto) 1fr auto; }
    .tab-bar.has-shows.has-livetv { grid-template-columns: repeat(3, auto) 1fr auto; }
}
#shows-view { justify-content: flex-start; text-align: left; max-width: 800px; }
#shows-home, #show-page { width: 100%; display: flex; flex-direction: column; gap: 10px; }
#shows-home[hidden], #show-page[hidden] { display: none; }
.shows-search {
    display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 8px;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
}
.shows-search:focus-within { border-color: var(--border-hover); }
.shows-search input { flex: 1; min-width: 0; margin: 0; padding: 0; height: 100%; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 0.9rem; outline: none; }
.shows-note { margin: 0; color: var(--text-dim); font-size: 0.85rem; }
.shows-note[hidden], .shows-grid[hidden], #shows-view .section-label[hidden] { display: none; }
#shows-view .section-label { margin-top: 6px; }
.shows-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 600px) { .shows-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); } }
.show-tile { display: flex; flex-direction: column; gap: 5px; min-width: 0; color: var(--text); text-decoration: none; }
.show-tile-poster {
    aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border);
    display: flex; align-items: flex-end; justify-content: center; padding: 6px; text-align: center;
    font: 600 0.8rem var(--font-display); color: var(--text-dim);
}
.show-tile-poster img { width: calc(100% + 12px); height: calc(100% + 12px); margin: -6px; object-fit: cover; display: block; }
.show-tile:hover .show-tile-poster { border-color: var(--border-hover); }
.show-tile-title { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shows-more { height: 1px; }
/* A show's page: poster, title and "2022 · 2 seasons · on ed-2", then the seasons and episodes */
#show-page .back-link { margin-bottom: 0; }
.show-head { display: flex; gap: 14px; align-items: flex-start; }
.show-poster { flex: none; width: 92px; aspect-ratio: 2 / 3; border-radius: 8px; background: var(--surface-2) center / cover no-repeat; border: 1px solid var(--border); }
.show-head-text { display: flex; flex-direction: column; gap: 5px; min-width: 0; padding-top: 4px; }
.show-head-text h1 { margin: 0; font-size: 1.6rem; line-height: 1.1; text-align: left; }
.show-meta { margin: 0; color: var(--text-dim); font-size: 0.8rem; }
.show-seasons { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); margin-top: 6px; }
.show-seasons::-webkit-scrollbar { display: none; }
.show-seasons[hidden], .show-season-pick[hidden] { display: none; }
.show-season {
    flex: none; padding: 10px 2px 9px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-dim);
    font: 500 0.9rem var(--font-body); cursor: pointer; white-space: nowrap;
}
.show-season[aria-selected="true"] { color: var(--text); border-bottom-color: var(--heads); }
.show-season-pick {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; margin-top: 6px;
    border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 500 0.9rem var(--font-body); cursor: pointer;
}
.show-episodes { list-style: none; margin: 0; padding: 0; }
.show-episode { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 4px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.show-episode-n { flex: none; min-width: 22px; color: var(--text-dim); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.show-episode-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.show-episode-len { flex: none; color: var(--text-dim); font-size: 0.75rem; }
/* The Seasons sheet (more than 15 seasons) */
.show-season-list { display: flex; flex-direction: column; max-height: min(70vh, 600px); overflow-y: auto; padding: 0 16px 12px; }
.show-season-row {
    min-height: 44px; padding: 0 4px; background: none; border: 0; border-bottom: 1px solid var(--border); color: var(--text);
    font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer;
}
.show-season-row[aria-current="true"] { color: var(--heads); }
#shows-refresh { height: 36px; }
/* Watching it together: your spots (▶ where you are), ▶ Just you and + Start with someone else, episodes to tap, the start sheet */
.show-spots { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.show-spots[hidden], .show-start[hidden] { display: none; }
.show-spot {
    display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 4px; background: none; border: 0; border-bottom: 1px solid var(--border);
    color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.show-spot:hover:not(:disabled) { background: var(--surface-2); }
.show-spot-play { flex: none; width: 22px; color: var(--heads); }
.show-spot-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.show-spot-who { font-size: 0.9rem; font-weight: 600; }
.show-spot-where { color: var(--text-dim); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.show-start { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.show-start-btn {
    height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    font: 600 0.9rem var(--font-body); cursor: pointer;
}
.show-start-btn.is-go { border-color: var(--heads); background: var(--heads); color: var(--heads-ink); }
.show-episode.is-btn { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--border); color: var(--text); font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer; }
.show-episode.is-btn:hover:not(:disabled) { background: var(--surface-2); }
.show-start-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.show-start-row small { color: var(--text-dim); font-size: 0.78rem; }
:is(.show-start-btn, .show-spot, .show-episode.is-btn, .show-start-row):disabled { opacity: 0.6; cursor: default; }
/* A spot's X (shows.js showSpotSwipe): swiped left on a phone, ✕ on hover or keyboard focus with a mouse; none while it plays */
.show-spot-wrap { position: relative; overflow: hidden; display: flex; }
.show-spot-wrap .show-spot { flex: 1; min-width: 0; padding-right: 48px; touch-action: pan-y; transition: transform 0.2s ease; }
.show-spot-wrap.is-dragging .show-spot { transition: none; }
.show-spot-wrap.is-open .show-spot { transform: translateX(-48px); }
.show-spot-x {
    position: absolute; right: 4px; top: 50%; width: 36px; height: 36px; margin-top: -18px; border-radius: 8px; border: 0;
    background: var(--danger); color: var(--danger-ink); font: 600 0.9rem var(--font-body); cursor: pointer;
    opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
.show-spot-wrap:is(.is-open, .is-dragging) .show-spot-x, .show-spot-x:focus-visible { opacity: 1; pointer-events: auto; }
.show-spot-wrap.is-dragging .show-spot-x { pointer-events: none; }
@media (hover: hover) {
    .show-spot-wrap:is(:hover, :focus-within) .show-spot-x { opacity: 1; pointer-events: auto; }
    .show-spot-x:hover { background: var(--danger-hover); }
}
/* The end sheet: "End Severance with Keath?" */
.show-spot-end { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 16px; }
.show-spot-end .action-btn { margin: 0; }
#show-spot-end-yes { background: var(--danger); color: var(--danger-ink); }
/* An episode's mark from your spots: Watched (dim), or "Keath · 31:12" where a spot is */
.show-episode-mark { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); font-size: 0.75rem; }
.show-episode-mark:empty { display: none; }
.show-episode-mark.is-here { color: var(--heads); font-weight: 600; }
/* Keep watching (the Shows home): cards that scroll sideways */
.shows-keep { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.shows-keep::-webkit-scrollbar { display: none; }
.shows-keep[hidden] { display: none; }
.show-keep {
    flex: none; width: min(280px, 82%); display: flex; align-items: center; gap: 8px; padding: 8px; scroll-snap-align: start;
    border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border);
}
.show-keep:hover { border-color: var(--border-hover); }
.show-keep-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.show-keep-poster { flex: none; width: 44px; aspect-ratio: 2 / 3; border-radius: 4px; background: var(--surface) center / cover no-repeat; border: 1px solid var(--border); }
.show-keep-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.show-keep-title { font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.show-keep-line { color: var(--text-dim); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.show-keep-play { flex: none; width: 36px; height: 36px; border-radius: 8px; border: 0; background: var(--heads); color: var(--heads-ink); font-size: 0.85rem; cursor: pointer; }
.show-keep-play:disabled { opacity: 0.6; cursor: default; }
/* A hidden Just you's Undo toast */
.toast.show-undo { display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: auto; }
.toast-undo { flex: none; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border); background: none; color: var(--heads); font: 600 0.85rem var(--font-body); cursor: pointer; }
/* History's Shows chip: show rows only, no Select, Everyone's nights or Archived */
#games-view.is-shows :is(#games-select-btn, .games-everyone, #games-archived-btn) { display: none; }

/* The line over the list (11-14): Movies' .lib-line, Lists tiles and Filters sheet; Sort and ↓ go while Lists is open */
.shows-line { margin-top: 18px; }
.shows-line[hidden], .shows-lists[hidden], .shows-grid[hidden] { display: none; }
#shows-view.is-lists #shows-sort-menu, #shows-view.is-lists #shows-sort-dir { display: none; }
.lib-line-tools #shows-filters-btn.active { border-color: var(--border); color: var(--text); background: var(--surface-2); }
.shows-lists { margin-top: 8px; }
/* Hide and ★ Favorite (schema 50): the show page's two buttons; a hidden show's tile dimmed with "Hidden" when shown */
.show-marks { display: flex; gap: 8px; margin-top: 10px; }
.show-marks .toggle-btn { flex: none; }
.show-tile-poster { position: relative; }
.show-tile.is-hidden .show-tile-poster img { filter: grayscale(0.8) brightness(0.55); }

/* ---------- Profile pictures (player.js fillFace and the Account sheet's Picture row, schema 48) ---------- */
/* A face with a picture: the picture fills the circle over the face's own colour (a 2:3 poster shows its upper middle) */
.has-pic { overflow: hidden; padding: 0; }
.face-pic { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 25%; }
.invite-banner-face { width: 28px; height: 28px; border-width: 1.5px; font-size: 0.8rem; flex: none; }
.invite-banner-face[hidden] { display: none; }
.movie-night-people .mn-face { width: 28px; height: 28px; font-size: 0.75rem; }
.show-history-row .game-poster { position: relative; }
.show-history-face { position: absolute; right: -7px; bottom: -5px; width: 22px; height: 22px; font: 600 0.6rem var(--font-body); }
/* The Picture row: one 36px button a line, the poster grid between them */
.avatar-pick button.action-btn { align-self: stretch; margin: 0; min-height: 36px; padding: 0 12px; font-size: 0.85rem; }
.avatar-pick button.action-btn[hidden] { display: none; }
.avatar-posters { display: flex; flex-direction: column; gap: 8px; }
.avatar-posters[hidden] { display: none; }
.avatar-posters input { min-height: 36px; }
.avatar-poster-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; max-height: min(320px, 40vh); overflow-y: auto;
    overscroll-behavior: contain; padding: 2px;
}
.avatar-poster { aspect-ratio: 2 / 3; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); overflow: hidden; cursor: pointer; }
.avatar-poster:hover, .avatar-poster:focus-visible { border-color: var(--heads); }
.avatar-poster:disabled { opacity: 0.6; cursor: default; }
.avatar-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Movies: the Google TV's header (11-13): one line, Lists, green picks, a movie's squares ---------- */
/* + Add is grey (green on Movies is only Start and picks) */
#pool-view .pool-add-btn.tool-btn { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); height: 36px; margin: 0; padding: 0 12px; font-weight: 500; }
/* The line: where you are ("All movies ⌄ 24"), your filters in green under it, then Filters · Sort · ↓ · Pick for me */
.lib-line { display: flex; align-items: center; gap: 12px; margin: 12px 0 2px; min-height: 40px; }
.lib-line-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; text-align: left; }
.lib-line-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.lib-list-btn {
    display: inline-flex; align-items: center; gap: 4px; min-width: 0; padding: 0; border: 0; background: none; cursor: pointer;
    color: var(--text); font: 600 1.05rem var(--font-body); white-space: nowrap;
}
.lib-list-btn > span { overflow: hidden; text-overflow: ellipsis; }
.lib-list-btn svg { flex: none; color: var(--text-dim); transition: transform 0.15s; }
.lib-list-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.lib-list-count { color: var(--text-dim); font-size: 0.8rem; white-space: nowrap; }
.lib-applied { color: var(--heads); font-size: 0.72rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-applied[hidden] { display: none; }
.lib-line-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.lib-line-tools .sort-dir, .lib-line-tools .sort-menu-btn { height: 36px; }
.lib-line-tools .sort-dir { width: 36px; }
.lib-line-tools .tool-btn { width: auto; gap: 6px; padding: 0 12px; font-family: var(--font-body); font-size: 0.85rem; white-space: nowrap; }
/* (Lists: no sorting tiles) */
#pool-view.is-lists #pool-sort-menu, #pool-view.is-lists #pool-sort-dir { display: none; }
@media (min-width: 600px) { #pool-view .lib-line-tools .sort-menu-prefix::after { content: " ·"; } }
/* phone: the tools take their own row above the line */
@media (max-width: 599px) {
    .lib-line { flex-direction: column-reverse; align-items: stretch; gap: 10px; margin-top: 8px; }
    .lib-line-tools { gap: 6px; }
    .lib-line-tools .tool-btn { padding: 0 10px; gap: 5px; }
    .lib-line-tools .sort-menu { flex: 1 1 auto; min-width: 0; }
    .lib-line-tools .sort-menu-btn { width: 100%; justify-content: space-between; padding: 0 9px; }
    .lib-line-tools .sort-menu-prefix { display: none; }
    .lib-line-tools .lib-filters-word { display: inline; }
    .lib-line-text { min-height: 34px; justify-content: center; }
}
/* The wide start button under the line (pinned: the posters scroll under it): grey with Flippy's line when nothing's
   picked (it opens the lobby), green with picks, outlined "Open Movie Night" when your night is open */
#pool-view .lib-start-row { margin: 10px 0 2px; }
button.action-btn.lib-start.is-idle { background: var(--surface-2); color: var(--text-dim); border-color: var(--border); font-weight: 600; font-size: 0.92rem; }
button.action-btn.lib-start.is-idle:hover { color: var(--text); }
button.action-btn.lib-start.is-on-night { background: transparent; color: var(--heads); box-shadow: inset 0 0 0 1.5px var(--heads); }
/* Picks: a green frame and ✓, and the selection bar with them (was gold) */
#pool-view .pool-card { --gold: var(--heads); --gold-ink: var(--heads-ink); }
/* ...and the rest of Movies stays neutral */
.lib-filters-dialog .toggle-btn.active { --toggle-tint: var(--surface-2); border-color: var(--text); color: var(--text); }
.lib-filters-foot .action-btn.btn-start { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
/* The Filters sheet: Show gets its label */
.lib-show-row { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.lib-show-row .qd-label { text-align: left; align-self: flex-start; }
/* Lists: every list, vibe and genre as a tile with three posters, counted with your filters */
#pool-grid.is-lists { display: block; }
.lib-lists { text-align: left; padding-bottom: 8px; }
.lib-group { margin: 2px 0 6px; font: 600 0.72rem var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.lib-group:not(:first-child) { margin-top: 18px; }
.lib-tiles { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 600px) { .lib-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; } }
.lib-tile {
    position: relative; display: block; height: 92px; padding: 0; overflow: hidden; text-align: left; cursor: pointer;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit;
}
.lib-tile:hover { background: var(--surface-2); }
.lib-tile-art { position: absolute; left: 0; right: 0; top: 0; height: 42px; display: flex; }
.lib-tile-art span { flex: 1; background-size: cover; background-position: center 40%; }
.lib-tile-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 30%, var(--surface)); }
.lib-tile-name { position: absolute; left: 10px; right: 8px; top: 48px; font: 600 0.92rem var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-tile-n { position: absolute; left: 10px; top: 69px; font-size: 0.74rem; color: var(--text-dim); }
.lib-tile.is-empty .lib-tile-art { opacity: 0.3; }
.lib-tile.is-empty .lib-tile-name { color: var(--text-dim); }
.lib-tile.is-current { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
/* A movie's sheet: Watch now · Pick · Trailer · Hide, one slim row (.slim-acts) */
.movie-info-actions { margin: 4px 0 2px; }
.movie-info-note { margin: 0; font-size: 0.78rem; color: var(--text-dim); text-align: left; }

/* The start button at the top (11-16): first in the header, over the filters (the Google TV keeps it under the line) */
html:not(.tv) #pool-view .pool-head > .lib-start-row { margin: 0 0 8px; }
html:not(.tv) button.action-btn.lib-start.is-idle > span { font-style: italic; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.25; }
/* ...and grey still reads as a button (11-17): a lighter fill, a clear edge, a hover and a press */
html:not(.tv) button.action-btn.lib-start.is-idle {
    background: color-mix(in srgb, var(--text) 9%, var(--surface-2)); color: var(--text-soft); border-color: var(--border-hover);
    box-shadow: 0 1px 2px var(--shadow); cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
html:not(.tv) button.action-btn.lib-start.is-idle:hover { background: color-mix(in srgb, var(--text) 15%, var(--surface-2)); border-color: var(--text-dim); color: var(--text); }
html:not(.tv) button.action-btn.lib-start.is-idle:active { background: var(--surface-2); box-shadow: none; transform: translateY(1px); }
/* The one-movie roast (movie-night-invite.js showOnePick): the line in pink, the movie, then Play now (or Go on) */
.one-pick { margin: auto; width: min(340px, calc(100vw - 32px)); padding: 18px 16px 16px; border: 1.5px solid var(--tails); border-radius: 14px; background: var(--surface); color: var(--text); }
.one-pick[open] { display: flex; flex-direction: column; gap: 14px; animation: card-in 0.25s ease-out; }
.one-pick::backdrop { background: var(--backdrop); }
.one-pick-line { margin: 0; color: var(--tails); font: 700 1.1rem/1.3 var(--font-body); text-align: center; text-wrap: balance; }
.one-pick-movie { display: flex; align-items: center; gap: 12px; }
.one-pick-cover { flex: none; width: 56px; height: 84px; border-radius: 6px; background: var(--surface-2) center / cover; }
.one-pick-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: left; }
.one-pick-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.one-pick-text span { color: var(--text-dim); font-size: 0.85rem; }

/* ---------- Google TV (html.tv: the Android app on a Chromecast with Google TV, page.php and login.php tv_app()) ----------
   The screen is across the room (960x540 CSS px) and the remote moves a focus ring instead of a pointer (tv.js): text a
   size up, none under 12 px, a gold ring on whatever has the focus, and the tab bar clear of the screen's top 5% (TVs
   may crop it) */
html.tv { font-size: 112.5%; --tabbar-h: 72px; }
html.tv :focus { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Inside a box that clips its edge (overflow: hidden), the ring goes inside */
html.tv :is(.tab, .pool-cover, .menu-row, .lib-tile, .livetv-ch, .profile-row):focus { outline-offset: -3px; }
html.tv .tab-bar { padding-top: 16px; }
html.tv :is(.wt-label, .stats-tiles.is-four dt, .app-build, .got-here-tag, .got-here-title, .rating-label, .rigoff-hub small, .watch-party-round-n) { font-size: 0.7rem; }
/* Movies: a focused poster scrolls clear of the grid's faded edges */
html.tv .pool-scroll { scroll-padding-block: 24px 32px; }
/* Nothing the TV can use: the room's link (no clipboard to put it on), TVs at home and a Roku's code or remote (from the TV
   itself) */
html.tv :is(#watch-share-btn, #watch-tv, #account-link-tv, #account-remote) { display: none !important; }
/* The login page: a code to enter on a phone beside its steps (tv.js tvLink*), the password form one press away */
html.tv .login-panel { max-width: 720px; }
html.tv .login-form { max-width: 380px; margin: 0 auto; }
html.tv :is(.login-form, .tv-link)[hidden] { display: none; }
.tv-link { display: flex; gap: 32px; align-items: center; margin: 8px 0 20px; text-align: left; }
.tv-link-steps { flex: 1; display: grid; gap: 12px; margin: 0; padding-left: 1.4em; }
.tv-link-side { text-align: center; }
.tv-link-label { margin: 0 0 8px; color: var(--text-dim); font-size: 0.85rem; }
.tv-link-code { display: flex; gap: 8px; justify-content: center; min-height: 72px; margin: 0; }
.tv-link-code span { display: grid; place-items: center; width: 56px; height: 72px; border: 2px solid var(--border); border-radius: 8px; background: var(--surface-2); font: 600 2.4rem var(--font-display); }
.tv-link-note { min-height: 1.2em; margin: 10px 0 0; color: var(--text-dim); font-size: 0.85rem; }
.tv-link-password { display: block; margin: 0 auto 16px; }
/* Movies on the TV (11-13): the screen starts on the Lists tiles, five across; a list is its posters, six across (11-18: with
   the corner controls of the clean style, app.css "Movies: clean style"): OK picks, held it opens the movie's sheet
   (tv.js). Filters and a movie's sheet are panels down the right edge, and a filter is a row: ◀ ▶ change it. */
html.tv .main-panel:has(> #pool-view.active) { max-width: 904px; padding-top: 1rem; }
html.tv #pool-view .view-title { display: none; }
html.tv .lib-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
html.tv #pool-grid:not(.is-lists) { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; padding-bottom: 56px; } /* (the last row clears the line of keys) */
html.tv .pool-card { border-color: transparent; background: none; }
html.tv .pool-cover { height: auto; aspect-ratio: 2 / 3; border-radius: 6px; }
/* What the remote does here: a line of keys, bottom right of the screen or at the foot of a panel */
.tv-keys { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 16px; color: var(--text-dim); font-size: 0.85rem; }
.tv-keys kbd { padding: 3px 8px; border: 1px solid var(--border-hover); border-radius: 6px; background: var(--surface-2); color: var(--text); font: 600 0.8rem var(--font-body); }
.tv-keys kbd:not(:first-child) { margin-left: 12px; }
.tv-keys-movies { position: fixed; right: 48px; bottom: 16px; z-index: 5; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
/* (only over posters: not on the tiles, an empty list, the bar of a Movie Night being added to, or behind a panel) */
#pool-view:not(:has(#pool-grid .pool-card)) .tv-keys-movies, #pool-view:has(#pool-bottom:not([hidden])) .tv-keys-movies, body:has(dialog[open]) .tv-keys-movies { display: none; }
html.tv :is(.lib-filters-dialog, .movie-info-dialog) { margin: 0 0 0 auto; width: 460px; max-width: none; height: 100vh; max-height: none; border-width: 0 0 0 1px; border-radius: 0; }
html.tv .lib-filters-dialog .qd-row { display: flex; flex-direction: row; align-items: center; gap: 8px; min-height: 40px; padding: 0 4px; border-bottom: 1px solid var(--border); }
html.tv .lib-filters-dialog .qd-row .qd-label { align-self: center; }
html.tv .lib-filters-dialog .qd-row:has(.toggle-btn:focus) { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: 6px; }
/* (the choice fills its row to the right edge: ▲▼ go straight down the panel, tv.js picks the nearest by its centre) */
html.tv .lib-filters-dialog .qd-row .toggle-group { width: auto; flex: 1; margin: 0; }
html.tv .lib-filters-dialog .toggle-btn:not(.active) { display: none; }
html.tv .lib-filters-dialog .toggle-btn.active { flex: 1; padding: 6px 4px; border: 0; background: none; font-size: 0.9rem; text-align: right; outline: none; }
html.tv .lib-filters-dialog .toggle-btn.active:focus::before { content: "‹  "; color: var(--text-dim); }
html.tv .lib-filters-dialog .toggle-btn.active:focus::after { content: "  ›"; color: var(--text-dim); }
/* Search on the TV (tv-search.js, 11-13): the toolbar row's 🔍 (11-18; not in the tab row) opens the whole screen: Flippy's own letters on the left, what
   they find in rows beside them. In the results the letters slide away. Movies has no Add or search box of its own there. */
html.tv #pool-add-btn, html.tv #pool-filter { display: none; }
.tv-search { inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 24px 0 0 48px; border: 0; border-radius: 0; background: var(--bg); color: var(--text); overflow: hidden; }
.tv-search[open] { display: flex; gap: 34px; }
.tvs-side { flex: none; width: 294px; }
.tv-search.in-results .tvs-side { display: none; }
.tvs-query { display: flex; align-items: center; gap: 10px; height: 44px; margin: 0 0 20px; border-bottom: 2px solid var(--accent); color: var(--text-dim); font-size: 1.5rem; white-space: nowrap; overflow: hidden; }
.tvs-query #tvs-q { color: var(--text); white-space: pre; }
.tvs-caret { width: 2px; height: 28px; margin-left: -8px; background: var(--accent); }
.tvs-mic { position: absolute; left: 48px; top: 24px; width: 294px; height: 44px; opacity: 0; pointer-events: none; }
.tvs-keys { display: grid; grid-template-columns: repeat(6, 44px); gap: 6px; }
.tvs-key { height: 44px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: 1.2rem var(--font-body); }
.tvs-key.is-wide { grid-column: span 2; font-size: 1rem; }
.tvs-key:nth-child(n+37) { margin-top: 4px; }
.tvs-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tvs-note { margin: 6px 0 14px; min-height: 1.4em; color: var(--text-dim); font-size: 1rem; }
.tvs-results { flex: 1; overflow-y: auto; padding: 4px 0 70px 4px; scrollbar-width: none; }
.tvs-lab { margin: 0 0 10px; color: var(--text-dim); font: 1rem var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; }
.tvs-row { display: flex; gap: 12px; margin: 0 0 22px; padding: 4px 48px 4px 4px; overflow-x: auto; scrollbar-width: none; }
.tvs-item { flex: none; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: 1rem var(--font-body); text-align: left; }
.tvs-item:focus { background: var(--surface-2); }
.tvs-tile { display: flex; align-items: center; gap: 10px; width: 204px; height: 72px; padding: 0 10px; }
.tvs-tile .livetv-logo { flex: none; width: 40px; height: 40px; }
.tvs-tile-text { flex: 1; min-width: 0; }
.tvs-tile-text > *, .tvs-prog > * { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvs-tile-text span, .tvs-chan { color: var(--text-dim); }
.tvs-prog { display: flex; flex-direction: column; justify-content: center; gap: 2px; width: 204px; height: 84px; padding: 0 14px; }
.tvs-when.is-now { color: var(--accent); font-weight: 600; }
.tvs-poster { position: relative; display: flex; align-items: flex-end; justify-content: center; width: 110px; height: 165px; padding: 0 8px 12px; overflow: hidden; border: 0; border-radius: 8px; text-align: center; }
.tvs-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tvs-poster img ~ .tvs-name { display: none; }
.tvs-poster:focus img ~ .tvs-name { display: block; }
.tvs-name { position: relative; font: 600 1.1rem/1.15 var(--font-display); letter-spacing: 0.03em; overflow-wrap: anywhere; text-shadow: 0 1px 3px var(--backdrop); }
.tvs-tag { position: absolute; left: 6px; top: 6px; z-index: 1; padding: 2px 7px; border-radius: 4px; background: var(--backdrop); color: var(--text); font: 600 1rem var(--font-body); }
.tvs-movie[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--accent); }
.tvs-movie[aria-pressed="true"]::after { content: "✓"; position: absolute; right: 6px; top: 6px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--bg); font-weight: 700; }
.tvs-detail { display: flex; align-items: baseline; gap: 12px; margin: -8px 0 22px; padding-right: 48px; color: var(--text-dim); }
.tvs-detail[hidden] { display: none; }
.tvs-detail b { color: var(--text); font-size: 1.25rem; }
.tvs-add { flex: none; width: auto; margin: 0 0 0 auto; padding: 8px 14px; }
.tvs-legend { position: absolute; left: 48px; right: 48px; bottom: 14px; padding: 8px 0; background: var(--bg); }
.tv-search.in-results .tvs-legend-keys, .tv-search:not(.in-results) .tvs-legend-results { display: none; }
/* The guide on the TV (tv-guide.js, 11-13): Live TV's Guide is a whole screen there: the focused programme on top, then a
   row a channel with its programmes along two hours, a green line for now. Jump to slides over the left of it. */
.tv-guide { inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 18px 48px 0; border: 0; border-radius: 0; background: var(--bg); color: var(--text); overflow: hidden; }
.tv-guide[open] { display: flex; flex-direction: column; }
.tvg-head { flex: none; display: flex; align-items: baseline; gap: 14px; }
.tvg-head h2 { margin: 0; font-size: 1.45rem; letter-spacing: 0.02em; }
.tvg-sub { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvg-jump-btn { flex: none; width: auto; margin: 0 0 0 auto; padding: 3px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: 1rem var(--font-body); }
.tvg-clock { flex: none; font-variant-numeric: tabular-nums; }
.tvg-detail { flex: none; display: flex; align-items: flex-start; gap: 16px; height: 80px; margin-top: 12px; }
.tvg-detail .livetv-logo { flex: none; width: 56px; height: 56px; font-size: 1rem; }
.tvg-detail > div { flex: 1; min-width: 0; }
.tvg-detail > div > * { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvg-detail b { font-size: 1.2rem; }
.tvg-line { margin-top: 2px; }
.tvg-on { color: var(--accent); }
.tvg-desc { margin-top: 2px; color: var(--text-dim); }
.tvg-grid { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tv-guide.is-jump .tvg-grid, .tv-guide.is-jump .tvg-detail { opacity: 0.4; }
/* (the channel's name takes the first 200 px of a row; the two hours are the track beside it) */
.tvg-ticks { flex: none; height: 24px; padding-left: 200px; }
.tvg-track { position: relative; flex: 1; min-width: 0; height: 100%; }
.tvg-tick { position: absolute; top: 0; padding-left: 8px; border-left: 1px solid var(--border); color: var(--text-soft); line-height: 24px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tvg-rows-box { position: relative; flex: 1; min-height: 0; }
/* (6 px wider than the rows: the last cell's ring isn't cut off; the padding under them clears the line of keys) */
.tvg-rows { position: relative; z-index: 1; height: 100%; margin-right: -6px; padding: 4px 6px 64px 0; overflow-y: auto; scrollbar-width: none; scroll-padding-block: 34px 70px; }
.tvg-lab { margin: 10px 0 2px; color: var(--text-dim); font: 1rem var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; text-align: left; }
.tvg-row { display: flex; height: 54px; border-bottom: 1px solid var(--surface-2); }
.tvg-chan { flex: none; display: flex; align-items: center; gap: 10px; width: 192px; margin-right: 8px; overflow: hidden; }
.tvg-chan .livetv-logo { flex: none; width: 36px; height: 36px; }
.tvg-chan-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvg-cell { position: absolute; top: 6px; height: 42px; margin: 0 0 0 2px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font: 1rem/40px var(--font-body); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvg-cell.is-now { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.tvg-cell:focus { z-index: 2; background: color-mix(in srgb, var(--accent) 24%, var(--surface-2)); font-weight: 600; }
.tvg-none { border-style: dashed; background: var(--bg); color: var(--text-dim); }
/* (now: a line down the rows, behind their cells) */
.tvg-nowbox { position: absolute; left: 200px; right: 0; top: 0; bottom: 60px; pointer-events: none; }
.tvg-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: 1px; background: var(--accent); }
.tvg-now::before { content: ""; position: absolute; left: -5px; top: -8px; border: 6px solid transparent; border-top: 8px solid var(--accent); border-bottom: 0; }
.tvg-note { margin: 24px 0 0; color: var(--text-dim); }
.tvg-jump { position: absolute; left: 0; top: 0; bottom: 0; z-index: 5; width: 372px; padding: 14px 24px 70px 48px; border-right: 1px solid var(--border); background: var(--surface); overflow-y: auto; scrollbar-width: none; scroll-padding-block: 40px 76px; }
.tvg-jump-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; height: 44px; margin: 0 0 4px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font: 1rem var(--font-body); text-align: left; }
.tvg-jump-item > :first-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvg-jump-item:focus { background: var(--surface-2); }
.tvg-jump-item.is-on { color: var(--accent); font-weight: 600; }
.tvg-jump-n { flex: none; color: var(--text-dim); font-weight: 400; font-variant-numeric: tabular-nums; }
.tvg-legend { position: absolute; left: 48px; right: 48px; bottom: 14px; z-index: 3; padding: 8px 0; background: var(--bg); }
/* The TV's safe area (11-14, cut off on a real Chromecast): the page is laid out 960x540 and scaled to the screen
   (MainActivity), and every screen, sheet and bar keeps 5% clear of each edge (48 px at the sides, 27 at top and bottom),
   which a TV may crop */
html.tv { --tv-safe-x: 48px; --tv-safe-y: 27px; --tabbar-h: 83px; --page-safe-bottom: var(--tv-safe-y); }
html.tv body { padding-left: var(--tv-safe-x); padding-right: var(--tv-safe-x); }
html.tv .tab-bar { padding: var(--tv-safe-y) var(--tv-safe-x) 0; }
html.tv dialog[open]:not(.tv-search, .tv-guide) { max-width: calc(100vw - 2 * var(--tv-safe-x)); max-height: calc(100vh - 2 * var(--tv-safe-y)); }
html.tv :is(.lib-filters-dialog, .movie-info-dialog) { height: calc(100vh - 2 * var(--tv-safe-y)); margin: var(--tv-safe-y) var(--tv-safe-x) var(--tv-safe-y) auto; border-width: 1px; border-radius: 8px; }
html.tv :is(.tv-search, .tv-guide) { padding-top: var(--tv-safe-y); }
html.tv .tv-search { padding-left: var(--tv-safe-x); }
html.tv .tvs-mic { left: var(--tv-safe-x); top: var(--tv-safe-y); }
html.tv :is(.tvs-legend, .tvg-legend) { bottom: var(--tv-safe-y); }
html.tv .tv-keys-movies { right: var(--tv-safe-x); bottom: var(--tv-safe-y); }
/* Light mode on the TV (11-14, slow on the Chromecast's chip): no blur behind sheets, no glows, no transitions (the focus
   moves at once), sheets and screens appear without sliding, no marquee bulbs; the flip and the reveal stay, the confetti
   goes (arena.js celebrateWin) */
html.tv { --glow: 0; }
html.tv *, html.tv *::before, html.tv *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; transition: none !important; scroll-behavior: auto !important; }
html.tv :is(dialog[open], dialog[open]::backdrop, .view.active, .toast) { animation: none !important; }
html.tv :is(.toast, dialog, .profile-menu) { box-shadow: none; }
html.tv .watch-party-prep-bg { filter: none; }
html.tv .marquee-bulbs { display: none; }
/* The focus also zooms what is a picture or an icon (11-15); rows keep the ring alone (a zoomed row is cut by its list).
   The card, not the poster in it: the card clips. */
html.tv :is(.pool-card:has(.pool-cover:focus), .lib-tile:focus, .show-tile:focus) { transform: scale(1.05); z-index: 1; }
html.tv .watch-party-icon:focus { transform: scale(1.15); }

/* ---------- Last night (/last-night, lastnight.js): the admin's look at one night, flat underline tabs like Seasons ---------- */
#lastnight-view { justify-content: flex-start; }
#lastnight-view h1:focus { outline: none; }
.lastnight-pick {
    width: 100%; height: 40px; padding: 0 10px; margin-top: 6px; background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; font: 500 0.9rem var(--font-body);
}
.lastnight-pick[hidden] { display: none; }
.lastnight-tabs { width: 100%; }
.lastnight-list { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.lastnight-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.lastnight-line { display: flex; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 0.82rem; color: var(--text-dim); overflow-wrap: anywhere; }
.lastnight-line time { flex: none; min-width: 6.5em; font-variant-numeric: tabular-nums; }
.lastnight-line.is-warn { color: var(--text); }
.lastnight-line.is-warn time { color: var(--danger); }
.lastnight-device { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; }
.lastnight-device summary { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; cursor: pointer; font-size: 0.9rem; }
.lastnight-who { color: var(--text); overflow-wrap: anywhere; }
.lastnight-count { flex: none; color: var(--text-dim); }
/* (11-15) the night and its Remove on one line; the Profile's row only on a desktop */
.lastnight-top { width: 100%; display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.lastnight-top[hidden], .lastnight-tabs[hidden] { display: none; }
.lastnight-top .lastnight-pick { flex: 1; min-width: 0; margin-top: 0; }
.lastnight-top .slim-act { flex: none; height: 40px; padding: 0 12px; }
@media (max-width: 899px), (hover: none) {
    #account-lastnight { display: none; }
}
html.tv #account-lastnight { display: none; }

/* ---------- System status (status.js, Profile → Admin): the admin's read-only sheet and its dot ---------- */
.status-dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--danger); vertical-align: middle; }
.status-dot[hidden] { display: none; }
.menu-row > span.status-dot { flex: none; margin: 0 4px 0 0; }
.status-list { display: flex; flex-direction: column; gap: 10px; }
.status-list .profile-row { min-height: 38px; }
.status-list .profile-row.is-bad .profile-value { color: var(--danger); }

/* ---------- Slim players (11-15): Movie Night's and Live TV's player in one layout. Bare 32px icons on the picture
   (40px to tap), ■ top left with its ask over the picture, one line under it that opens. No boxes, no pills. ---------- */
.watch-party-stage .watch-party-icon { width: 40px; height: 40px; border-radius: 6px; }
.watch-party-stage .watch-party-icon:disabled { opacity: 0.4; cursor: default; }
.watch-party-stage .watch-party-icon[hidden] { display: none; }
.watch-party-icon.slim-stop { color: var(--danger); }
.livetv-step svg { width: 24px; height: 24px; }
.livetv-stage .watch-party-bar-top { padding: 2px 4px 0; gap: 2px; }
.livetv-stage .watch-party-bar-mid { gap: clamp(6px, 4vw, 26px); }
/* Movie Night: its icon row is its own layer over the picture (the controls under it only exist once joined) */
.slim-top { position: absolute; top: 2px; left: 4px; right: 4px; z-index: 3; display: flex; align-items: center; color: var(--video-text); transition: opacity 0.25s; }
.slim-top .mn-bar-gap { flex: 1; }
.watch-party-stage.is-idle .slim-top { opacity: 0; pointer-events: none; }
.watch-party-stage:has(.slim-top) .watch-party-bar-top { padding: 12px 12px 0 48px; }
.watch-party-stage.is-remote .slim-top { position: static; order: -1; color: var(--text); padding: 2px 4px 0; }
/* ■ asked: one or two buttons in the middle of the picture, everything else out of the way */
.slim-ask { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px;
    background: color-mix(in srgb, var(--shadow) 62%, transparent); color: var(--video-text); text-align: center; }
.slim-ask[hidden], .slim-ask-btn[hidden] { display: none; }
.slim-ask small { font-size: 0.7rem; opacity: 0.8; }
.slim-ask-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.slim-ask-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; cursor: pointer; border: 0; border-radius: 8px;
    background: color-mix(in srgb, var(--video-text) 16%, transparent); color: var(--video-text); font: inherit; font-size: 0.86rem; font-weight: 700; white-space: nowrap; }
.slim-ask-btn.is-danger { background: var(--danger); }
.slim-ask-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.slim-ask:not([hidden]) ~ .watch-party-controls, .slim-ask:not([hidden]) ~ .slim-top, .watch-party-stage:has(.slim-ask:not([hidden])) .slim-top { visibility: hidden; }
.watch-party-stage.is-remote .slim-ask { position: static; order: -2; padding: 12px 8px; background: none; color: var(--text); }
.watch-party-stage.is-remote .slim-ask-btn:not(.is-danger) { background: var(--surface); color: var(--text); }
/* plain text where a pill was ("Go live ›", Back to Movies) */
.slim-text { padding: 4px 2px; cursor: pointer; border: 0; background: none; color: var(--heads); font: inherit; font-size: 0.8rem; font-weight: 700; }
.slim-text[hidden] { display: none; }
.slim-text:hover { text-decoration: underline; }
/* the one line under the player */
.slim-line { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; text-align: left; }
.slim-line-top { display: flex; align-items: center; gap: 8px; width: 100%; height: 36px; padding: 0 4px 0 10px; cursor: pointer; border: 0; background: none;
    color: var(--text); font: inherit; font-size: 0.84rem; text-align: left; }
.slim-line-top:hover { background: var(--surface-2); }
.slim-line-top > b { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slim-line-what { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slim-line-left { flex: none; color: var(--text-dim); font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.slim-line-left:empty, .slim-line-top .livetv-ch-num:empty { display: none; }
.slim-line-chev { flex: none; display: grid; place-items: center; width: 28px; color: var(--text-dim); transition: transform 0.15s; }
.slim-line-top[aria-expanded="true"] .slim-line-chev { transform: rotate(180deg); }
.slim-line-more { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--border); }
.slim-line-more[hidden] { display: none; }
.slim-line-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: var(--text-dim); font-size: 0.76rem; }
.slim-line-info > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slim-line-info > :empty { display: none; }
.slim-line .livetv-card-logo .livetv-logo { width: 32px; height: 32px; }
/* Movie Night's line: faces with a ring for where each one is; opened, the sections stack with room between them */
.mn-card .mn-people-faces { flex: none; display: flex; gap: 3px; }
.mn-face { width: 22px; height: 22px; font-size: 0.64rem; box-sizing: border-box; border: 2px solid transparent; }
.mn-face.is-ring-wait { border-color: var(--ring-wait); }
.mn-face.is-ring-bad { border-color: var(--watch-bad); }
.mn-card .mn-card-more { flex-direction: column; align-items: stretch; gap: 16px; padding: 12px 10px; animation: none; }
.mn-card-head { display: flex; align-items: center; gap: 10px; }
.mn-card .mn-card-poster { width: 34px; }
.mn-card .mn-card-result { color: var(--text); font-size: 0.84rem; }
.mn-card .mn-card-ends { display: block; }
.mn-card .watch-party-people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 8px; padding: 12px 0; border-block: 1px solid var(--border); overflow: visible; }
.mn-card .watch-party-people li { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; row-gap: 0; align-items: center;
    max-width: none; padding: 0; border: 0; border-radius: 0; background: none; font-size: 0.7rem; }
.mn-card .watch-party-people li.watch-party-empty { display: block; grid-column: 1 / -1; }
.mn-card .watch-party-person-top { grid-row: 1 / 3; }
.mn-card .watch-party-person-top .watch-party-dot { display: none; }
.mn-card .watch-party-person-top .watch-party-face { width: 26px; height: 26px; box-sizing: border-box; border: 2px solid transparent; }
.mn-card .watch-party-people li.is-wait .watch-party-face { border-color: var(--ring-wait); }
.mn-card .watch-party-people li.is-bad .watch-party-face { border-color: var(--watch-bad); }
.mn-card .watch-party-person-name { font-size: 0.8rem; }
.mn-card .watch-party-person-where { display: none; } /* (it is in the row's title; the status line says the rest) */
.mn-card .mn-score-head { flex-direction: row; justify-content: space-between; gap: 10px; margin: 0 0 4px; font-family: inherit; font-size: 0.8rem; font-weight: 600; text-align: left; }
.mn-card .mn-score-rounds li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 6px; align-items: center; height: 30px; padding: 0; border-bottom: 0; border-top: 1px solid var(--border); font-size: 0.76rem; }
.mn-card .mn-score-rounds b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mn-score-flips { display: flex; gap: 3px; }
.mn-score-flips i { width: 8px; height: 8px; border-radius: 50%; background: var(--tails); }
.mn-score-flips i.is-heads { background: var(--heads); }
.mn-card #mn-card-movies { align-self: flex-start; }
/* the Casting to cards: one row of bare icons, no pills */
.slim-castrow { display: flex; align-items: center; justify-content: space-between; }
.watch-party-castcard .watch-party-icon { color: var(--text); }
.watch-party-castcard .watch-party-icon.slim-stop { color: var(--danger); }
.watch-party-castcard .watch-party-icon:hover { background: var(--surface); }
.livetv-on-row.is-danger { color: var(--danger); }
/* The result screen: one Watch together button, then one row of four that never wraps; "Seen it" opens the sliders under it */
.mn-reveal-acts { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.mn-reveal-acts[hidden] { display: none; }
.slim-act { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; height: 30px; padding: 0 4px; cursor: pointer; white-space: nowrap;
    border: 1px solid var(--border); border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 0.8rem; font-weight: 600; }
.slim-act[hidden] { display: none; }
.slim-act:hover { border-color: var(--border-hover); }
.slim-act:disabled { opacity: 0.5; cursor: default; }
.slim-act.is-on { border-color: var(--heads); color: var(--heads); }
.slim-act svg { flex: none; }
.slim-act.is-go { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
/* a sheet's actions (a movie's, a channel's): one row, each as wide as the next */
.slim-acts { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
@media (max-width: 380px) {
    .slim-act { font-size: 0.74rem; }
    .livetv-stage .watch-party-round { width: 42px; height: 42px; }
    .livetv-stage .watch-party-round.watch-party-play { width: 52px; height: 52px; }
}
.castcard-row[hidden] { display: none; }
.mn-row.mn-row-stop { color: var(--danger); }

/* ---------- A to Z strip (az-strip.js, 11-15): plain letters down the right edge of a list sorted by name; a big letter in
   the middle of the screen while a finger is on it. Made inside its list's screen (.has-az), which gives it room. ---------- */
/* (--az-half: half the width of its list's column, so on a wide window it sits at the list's edge, not the window's) */
.az-strip { position: fixed; right: max(env(safe-area-inset-right, 0px), calc(50% - var(--az-half, 50vw))); top: calc(env(safe-area-inset-top, 0px) + var(--tab-top) + 120px); bottom: calc(var(--tab-bottom) + var(--page-safe-bottom) + 8px);
    z-index: 4; width: 22px; display: flex; flex-direction: column; justify-content: center; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; outline-offset: -2px; }
.az-strip[hidden] { display: none; }
.az-strip span { flex: 0 1 17px; min-height: 0; display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 0.62rem; font-weight: 700; line-height: 1; pointer-events: none; }
.az-strip span.is-at { color: var(--heads); }
.az-bubble { position: fixed; left: 50%; top: 50%; z-index: 60; transform: translate(-50%, -50%); width: 76px; height: 76px; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); color: var(--text); font-size: 2.4rem; font-weight: 800; pointer-events: none; }
.az-bubble[hidden] { display: none; }
#pool-view.has-az .pool-scroll, #shows-home.has-az #shows-all { padding-right: 18px; }
#pool-view, #shows-home { --az-half: calc(var(--page-max, 800px) / 2); }
#livetv-browse { --az-half: calc(var(--livetv-max, 480px) / 2); }
#livetv-browse.has-az .livetv-ch { padding-right: 22px; }
/* the admin's All categories: its own sheet, the strip beside its rows */
#livetv-allcats-list { position: relative; }
#livetv-allcats-list > .az-strip { position: absolute; right: 0; top: 132px; bottom: 4px; }
#livetv-allcats-list.has-az .livetv-allcats-rows .profile-row { padding-right: 26px; }
/* the Category sheet's A to Z switch */
.livetv-az-row { min-height: 40px; padding: 0 2px; border-bottom: 0; justify-content: space-between; }
/* Google TV: bigger letters, the one it is on in gold (the ring is the strip's) */
html.tv .az-strip { width: 30px; right: 0; top: calc(var(--tabbar-h) + 24px); bottom: var(--tv-safe-y); }
html.tv .az-strip span { font-size: 0.7rem; }
html.tv .az-strip:focus span.is-at { color: var(--focus); transform: scale(1.5); }
/* (a jump scrolls the row to the top of the page: clear of Live TV's own sticky header there, under the tab bar) */
#livetv-list .livetv-ch { scroll-margin-top: 54px; }

/* ---------- Desktop: wide windows (11-15). The page's column is 800 wide as ever (--page-max); from 1280 wide it is 1200 and
   from 1680 it is 1520, for Movies, the Shows list and Live TV: more posters a row at the same size, the channel list in
   2 then 3 columns, the tab bar and the Profile menu over the column's edges. History, a show's own page, the lobby, the
   game and every sheet stay as narrow as they were. Never on the Google TV (html.tv is 960 wide) or under 1280. ---------- */
:root { --page-max: 800px; }
@media (min-width: 1280px) {
    html:not(.tv) { --page-max: 1200px; --livetv-max: var(--page-max); }
    html:not(.tv) .main-panel:has(> :is(#pool-view, #shows-view, #livetv-view).active) { max-width: var(--page-max); }
    html:not(.tv) #pool-view.active, html:not(.tv) #shows-view:has(> #shows-home:not([hidden])), html:not(.tv) #livetv-view { max-width: var(--page-max); }
    html:not(.tv) .tab-bar { padding: 0 max(16px, calc(50% - var(--page-max) / 2)); }
    html:not(.tv) .profile-menu { right: max(16px, calc(50% - var(--page-max) / 2)); }
    /* Live TV: the rows keep their shape, two across; a section's label runs over both and still sticks. Manage stays narrow. */
    html:not(.tv) #livetv-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; padding: 0 16px; }
    html:not(.tv) #livetv-list[hidden] { display: none; }
    html:not(.tv) #livetv-list > :not(.livetv-ch) { grid-column: 1 / -1; margin: 0 -16px; }
    html:not(.tv) #livetv-manage { width: 100%; max-width: 480px; margin: 0 auto; }
    /* its player: never taller than the window leaves under the header, centred */
    html:not(.tv) #livetv-player { width: 100%; max-width: calc((100vh - var(--tab-top) - 220px) * 16 / 9); margin: 0 auto; }
}
@media (min-width: 1680px) {
    html:not(.tv) { --page-max: 1520px; }
    html:not(.tv) #livetv-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Desktop: guide hours (11-15). From 1280 wide the Guide's timeline fills the page's column instead of scrolling
   sideways: a wider channel column, and as many hours as fit (livetv.js liveTvTlHours, which asks the server for them). ---------- */
@media (min-width: 1280px) {
    html:not(.tv) .livetv-tl-grid { --tl-ch: 200px; --tl-w: calc(100% - var(--tl-ch)); width: 100%; } /* (livetv.js LIVETV_TL_CH_WIDE) */
    html:not(.tv) .livetv-tl-scroll { overflow-x: hidden; }
}

/* ---------- Right-click menu (context-menu.js): compact rows, like the Profile menu's ---------- */
.ctx-menu {
    position: fixed; z-index: 9500; min-width: 180px; max-width: min(280px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow-y: auto;
    padding: 4px 0; background: var(--surface-2); color: var(--text); border: 1px solid var(--border-hover); border-radius: 10px;
    box-shadow: 0 12px 32px color-mix(in srgb, var(--shadow) 70%, transparent); outline: 0;
}
.ctx-row {
    display: block; width: 100%; height: 34px; padding: 0 14px; border: 0; background: none; color: var(--text);
    font: 500 0.85rem var(--font-body); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.ctx-row:hover:not(:disabled), .ctx-row:focus-visible { background: var(--surface); outline: 0; }
.ctx-row:disabled { color: var(--text-dim); opacity: 0.6; cursor: default; }
.ctx-row.is-danger { color: var(--danger); }

/* ---------- Watch together's sheet (watch-start.js, 11-17; clean style 11-18): Start movie asks who and where. A bottom
   sheet on phones, a 420 px card from 600 px: a hairline and a grab bar, no glow. Who's watching? is two outlined radio
   choices: the pick turns green (With) or pink (Just me), the other dims; rows and borders stay neutral. TV and Cast slide
   in sideways and the sheet shrinks to them. Start: grey outline, then gold filling with the copy, then shimmering. ---------- */
.wt-sheet { --wt: var(--text-dim); margin: auto 0 0; padding: 8px 16px 16px; width: 100%; max-width: 100%; max-height: 88vh; overflow: hidden auto;
    background: var(--surface); color: var(--text); border: 0; border-top: 1px solid var(--border); border-radius: 14px 14px 0 0; }
.wt-sheet[open] { display: flex; flex-direction: column; gap: 12px; animation: dialog-in 0.22s cubic-bezier(0.25, 1, 0.5, 1); }
.wt-sheet::before { content: ''; align-self: center; flex: none; width: 36px; height: 4px; border-radius: 2px; background: var(--border-hover); }
.wt-sheet::backdrop { background: var(--backdrop); }
.wt-sheet.is-with { --wt: var(--heads); }
.wt-sheet.is-alone { --wt: var(--tails); }
.wt-page { display: flex; flex-direction: column; gap: 12px; }
.wt-page[hidden] { display: none; }
.wt-page.is-in { animation: wt-slide 0.24s cubic-bezier(0.25, 1, 0.5, 1); }
#wt-main.is-in { animation-name: wt-slide-back; }
@keyframes wt-slide { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes wt-slide-back { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
.wt-head { display: grid; gap: 2px; }
.wt-title { margin: 0; font: 600 1.05rem var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; overflow-wrap: anywhere; }
.wt-line { margin: 0; color: var(--text-dim); font-size: 0.8rem; }
.wt-line[hidden] { display: none; }
.wt-group { display: grid; gap: 4px; }
.wt-group[hidden] { display: none; }
.wt-sheet .wt-label { color: var(--text-dim); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.wt-who { display: flex; gap: 8px; }
.wt-pick { --pk: var(--heads); flex: 1 1 0; min-width: 0; height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 8px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; cursor: pointer; text-align: left; transition: opacity 0.2s, border-color 0.2s, background 0.2s;
    border: 1px solid var(--border); border-radius: 8px; background: none; color: var(--text); font: 500 0.88rem var(--font-body); }
#wt-alone { --pk: var(--tails); }
.wt-pick::before { content: ''; flex: none; width: 14px; height: 14px; box-sizing: border-box; border-radius: 50%; border: 1.5px solid var(--text-dim); }
.wt-pick:hover { border-color: var(--border-hover); }
.wt-pick.is-on { border-color: var(--pk); color: var(--pk); font-weight: 600; background: color-mix(in srgb, var(--pk) 10%, transparent); }
.wt-pick.is-on::before { border: 4px solid var(--pk); }
.wt-sheet:is(.is-with, .is-alone) .wt-pick:not(.is-on) { opacity: 0.45; }
.wt-rows { display: flex; flex-direction: column; }
.wt-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0; margin: 0; cursor: pointer; text-align: left;
    border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text-dim); font: inherit; font-size: 0.86rem; }
.wt-row:last-child { border-bottom: 0; }
.wt-row[hidden] { display: none; }
.wt-row svg { flex: none; }
.wt-row b { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-weight: 500; color: var(--text); }
.wt-row span { flex: none; font-size: 0.74rem; }
.wt-row.is-dim:not(.is-on) { opacity: 0.45; }
.wt-row:hover:not(.is-note, .is-on) b { color: var(--text-soft); }
.wt-row:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.wt-row.is-on :is(svg, span) { color: var(--text); }
.wt-row.is-note { cursor: default; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 40px; }
.wt-none-line { margin-top: -4px; color: var(--tails); }
.wt-sub-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wt-back { padding: 0; border: 0; background: none; color: var(--text-dim); font: 500 0.85rem var(--font-body); cursor: pointer; }
.wt-back:hover { color: var(--text); }
.wt-refresh:disabled { opacity: 0.4; }
.wt-btn { min-height: 40px; padding: 6px 12px; cursor: pointer; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
    color: var(--text-dim); font: 600 0.9rem var(--font-body); line-height: 1.2; text-align: center; }
.wt-btn[hidden] { display: none; }
.wt-btn.is-go { position: relative; overflow: hidden; background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.wt-btn.is-go::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%; pointer-events: none;
    background: linear-gradient(100deg, transparent, color-mix(in srgb, var(--overlay-ink) 60%, transparent), transparent); animation: wt-shimmer 2.2s ease-in-out infinite; }
@keyframes wt-shimmer { to { left: 120%; } }
.wt-start { width: 100%; height: 42px; min-height: 42px; margin-top: auto; background: none; color: var(--text-dim);
    font: 600 0.82rem var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; }
.wt-start:disabled { cursor: default; }
.wt-start.is-go { background: var(--gold); font-size: 0.95rem; }
.wt-start.is-fill { border-color: var(--gold); color: var(--text); background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 55%, transparent) var(--fill, 0%), transparent var(--fill, 0%)); }
.wt-start.is-started { font: italic 500 0.8rem var(--font-body); letter-spacing: 0; text-transform: none; }
.wt-ask { display: grid; gap: 10px; padding: 12px; border-radius: 10px; background: var(--surface-2); }
.wt-ask[hidden] { display: none; }
.wt-ask .wt-line { color: var(--tails); }
.wt-ask-note { margin: 0; color: var(--text-dim); font-size: 0.8rem; }
.wt-ask-note[hidden], .wt-wait[hidden] { display: none; }
.wt-ask-btns { display: flex; gap: 8px; }
.wt-ask-btns .wt-btn { flex: 1 1 0; min-width: 0; font-size: 0.8rem; }
.wt-wait { display: flex; align-items: center; gap: 10px; font-size: 0.92rem; }
.wt-dots { display: flex; gap: 4px; }
.wt-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: wt-dot 1.2s infinite ease-in-out; }
.wt-dots i:nth-child(2) { animation-delay: 0.2s; }
.wt-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes wt-dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (min-width: 600px) {
    .wt-sheet { margin: auto; width: 420px; max-width: calc(100vw - 32px); padding: 18px 20px 20px; border: 1px solid var(--border); border-radius: 14px;
        box-shadow: 0 20px 60px color-mix(in srgb, var(--shadow) 60%, transparent); }
    .wt-sheet::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .wt-page.is-in, .wt-btn.is-go::after, .wt-dots i { animation: none; }
}

/* ---------- Player settings and theatre mode (watchparty-sheet.js, 11-17). The settings sheet: Settings and its line (green
   with someone, pink alone), one row per group at one fixed height, one group open at a time (0.25 s, the rows below
   slide), Apply at its foot: grey with a line while nothing changed, gold with the shimmer once something did. A desktop
   window: in the middle, no outline, a soft shadow; full screen: a 360 px glass panel over the picture's right. Theatre
   mode (a desktop window, 1280 px and up): the picture big on the left, the movie's card opened beside it. ---------- */
.st-sheet { --st: var(--text-dim); }
.st-sheet.is-with { --st: var(--heads); }
.st-sheet.is-alone { --st: var(--tails); }
.st-sheet[open] { height: min(560px, 86vh); border-top: 2px solid var(--st); box-shadow: 0 -8px 30px color-mix(in srgb, var(--st) 18%, transparent); }
.st-head { display: grid; gap: 2px; padding: 16px 16px 8px; }
.st-title { margin: 0; font: 600 1.15rem var(--font-display); }
.st-head:focus { outline: none; }
.st-line { margin: 0; color: var(--st); font-size: 0.8rem; font-style: italic; }
#watch-party-sheet .watch-party-sheet-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
#watch-party-sheet .watch-party-join { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0; }
#watch-party-sheet .watch-party-join[hidden] { display: none; }
.st-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px; }
.st-g[hidden], .st-set[hidden], .st-none[hidden], .st-ask[hidden] { display: none; }
.st-h { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 0; margin: 0; border: 0; border-bottom: 1px solid var(--border);
    background: none; color: var(--text); font: inherit; font-size: 0.95rem; text-align: left; cursor: pointer; }
.st-h:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.st-name { flex: none; display: grid; }
.st-name small, .st-set label small { color: var(--text-dim); font-size: 0.72rem; }
.st-val { flex: 1; min-width: 0; color: var(--text-dim); font-style: normal; font-size: 0.85rem; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-chev { flex: none; color: var(--text-dim); transition: transform 0.25s; }
.st-g.is-open .st-chev { transform: rotate(180deg); }
.st-b { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.25s ease; }
.st-g.is-open > .st-b { grid-template-rows: 1fr; }
.st-in { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 8px; }
.st-in > :first-child { margin-top: 10px; }
.st-in > :last-child { margin-bottom: 12px; }
.st-g.is-open { border-bottom: 1px solid var(--border); }
.st-g.is-open > .st-h { border-bottom-color: transparent; }
.st-in .watch-party-version { display: flex; flex-direction: column; gap: 6px; }
.st-in .watch-party-version[hidden] { display: none; }
.st-set { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; font-size: 0.9rem; }
.st-set label, .st-set > span { display: grid; }
#watch-party-sheet select.st-dd { display: block; flex: 0 1 auto; width: auto; max-width: 62%; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.85rem; text-overflow: ellipsis; }
#watch-party-sheet select.st-dd:disabled { opacity: 0.5; }
.st-subs-on { flex: none; pointer-events: none; }
.st-subs.is-on .st-subs-on { display: none; }
.st-adm { cursor: default; }
.st-sheet.is-none #mn-debug-row { display: none; }
.st-none { margin: 10px 0; color: var(--text-dim); font-size: 0.85rem; }
.st-foot { position: relative; padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }
.st-apply { position: relative; overflow: hidden; width: 100%; min-height: 44px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface-2); color: var(--text-dim); font: italic 0.82rem var(--font-body); line-height: 1.25; cursor: pointer; }
.st-apply.is-go { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font: 600 0.95rem var(--font-body); }
.st-apply.is-go::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%; pointer-events: none;
    background: linear-gradient(100deg, transparent, color-mix(in srgb, var(--overlay-ink) 60%, transparent), transparent); animation: wt-shimmer 2.2s ease-in-out infinite; }
.st-apply.is-applying { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); cursor: default; }
.st-apply:disabled { cursor: default; }
.st-ask { position: absolute; inset: auto 0 0; display: grid; gap: 8px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -10px 30px color-mix(in srgb, var(--shadow) 40%, transparent); }
.st-ask b { font-size: 0.9rem; }
.st-ask-line { color: var(--st); font-size: 0.8rem; font-style: italic; }
.st-ask-btns { display: flex; gap: 8px; }
.st-ask-btns > button { flex: 1 1 0; min-width: 0; min-height: 40px; }
.st-ask-toss { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); font: 600 0.9rem var(--font-body); cursor: pointer; }
.mn-th { display: none; }
@media (min-width: 600px) {
    .st-sheet[open] { margin: auto; width: 420px; max-width: calc(100vw - 32px); border: 0; border-radius: 14px;
        box-shadow: 0 0 40px color-mix(in srgb, var(--st) 20%, transparent), 0 24px 70px color-mix(in srgb, var(--shadow) 70%, transparent); }
}
/* Full screen: the panel over the picture's right, dark glass, its glow on the left edge; nothing scrolls */
.st-sheet.is-side[open] { margin: 0 0 0 auto; width: 360px; max-width: 100vw; height: 100vh; max-height: 100vh; border: 0; border-left: 2px solid var(--st); border-radius: 0;
    background: color-mix(in srgb, var(--surface) 72%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    box-shadow: -16px 0 40px color-mix(in srgb, var(--st) 18%, transparent); }
.st-sheet.is-side::backdrop { background: transparent; }
.st-sheet.is-side .st-list { overflow-y: auto; }
@media (min-width: 1280px) {
    /* Theatre mode: the page as wide as the desktop's column, the picture 16:9 on the left, the card opened on the right */
    html:not(.tv) .main-panel:has(> #arena-view.active.is-mn-player), html:not(.tv) #arena-view.is-mn-player { max-width: var(--page-max); }
    html:not(.tv) #arena-view.is-mn-player { width: 100%; }
    html:not(.tv) #arena-view.is-mn-player #watch-party { max-width: none; }
    html:not(.tv) #arena-view.is-mn-player #watch-party-live:not([hidden]) { display: grid; grid-template-columns: minmax(0, calc((100vh - 200px) * 16 / 9)) 340px;
        justify-content: center; column-gap: 24px; align-items: start; }
    html:not(.tv) #arena-view.is-mn-player #watch-party-live > :not(.watch-party-stage, .mn-card) { grid-column: 1 / -1; }
    html:not(.tv) #arena-view.is-mn-player .watch-party-stage { grid-column: 1; margin: 0; border-radius: 10px; }
    html:not(.tv) #arena-view.is-mn-player .mn-card { grid-column: 2; margin: 0; border: 0; }
    html:not(.tv) #arena-view.is-mn-player #mn-card-top { display: none; }
    html:not(.tv) #arena-view.is-mn-player .mn-card-more, html:not(.tv) #arena-view.is-mn-player .mn-card-more[hidden] { display: flex; flex-direction: column; gap: 12px; }
    html:not(.tv) #arena-view.is-mn-player .mn-th { display: block; margin: 0; }
    html:not(.tv) #arena-view.is-mn-player .mn-th[hidden] { display: none; }
    .mn-th-line { color: var(--text-dim); font-size: 0.85rem; font-style: italic; }
    .mn-th-about { color: var(--text-soft); font-size: 0.84rem; line-height: 1.45; }
    html:not(.tv) #arena-view.is-mn-player .mn-th-row { display: flex; justify-content: space-between; gap: 12px; font-size: 0.85rem; }
    .mn-th-row span { color: var(--text-dim); }
    html:not(.tv) #arena-view.is-mn-player .mn-th-set { display: inline-flex; align-self: flex-start; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
        border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text-dim); font: 500 0.82rem var(--font-body); cursor: pointer; }
    .mn-th-set:hover { color: var(--text); border-color: var(--border-hover); }
}
@media (prefers-reduced-motion: reduce) {
    .st-b, .st-chev { transition: none; }
    .st-apply.is-go::after { animation: none; }
}

/* ---------- Movies: clean style (11-18). One bar for every screen, bare icons, the start button by state, the card with
   its controls in the corners, the cover size slider and the Filters sheet as lines. The bar (#lib-bar) is one grid:
   desktop "search + filters sort ⋮ … Start" over the list's line; phones Start, then search + filters sort, then the line,
   the slider and ⋮; the Google TV the line, then 🔍 filters sort Start ⋮ on one row. ---------- */
#pool-view .lib-bar {
    display: grid; align-items: center; column-gap: 12px; row-gap: 8px; margin: 6px 0 10px;
    grid-template-columns: minmax(0, 500px) repeat(4, 36px) minmax(0, 1fr) minmax(0, 440px);
    grid-template-areas: "search add filt sort more . start" "line line line line line line size";
}
#lib-bar > .lib-start-row { grid-area: start; margin: 0; }
#lib-bar > .lib-search { grid-area: search; }
#lib-bar > #pool-add-btn { grid-area: add; }
#lib-bar > #lib-filters-btn { grid-area: filt; }
#lib-bar > #pool-sort-menu { grid-area: sort; }
#lib-bar > #pool-more { grid-area: more; margin: 0; }
#lib-bar > #lib-find { grid-area: find; }
#lib-bar > .lib-line { grid-area: line; margin: 0; min-height: 30px; min-width: 0; }
#pool-view .lib-line-name { min-width: 0; overflow: hidden; }
#lib-bar > .lib-size { grid-area: size; justify-self: end; }
#lib-bar [hidden] { display: none; }
/* search: an underline, no box */
#pool-view .lib-search {
    margin: 0; height: 38px; padding: 6px 2px; min-width: 0; border: 0; border-bottom: 1px solid var(--border-hover); border-radius: 0;
    background: transparent; color: var(--text); font-size: 0.92rem; box-shadow: none;
}
#pool-view .lib-search:focus { outline: none; border-bottom-color: var(--text-dim); }
/* bare icons, no boxes */
.lib-icon {
    position: relative; width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 8px; background: none; color: var(--text-soft); cursor: pointer; transition: color 0.15s, background 0.15s;
}
.lib-icon:hover, .lib-icon[aria-expanded="true"], .sort-menu.open .lib-icon { color: var(--text); background: var(--surface-2); }
.lib-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#pool-view .lib-icon.sort-menu-btn { gap: 0; border: 0; }
#pool-view .lib-icon.sort-menu-btn svg { color: inherit; transform: none; }
.lib-icon-dot { display: none; }
#lib-filters-btn.active { background: none; color: var(--text); }
#lib-filters-btn.active .lib-icon-dot { display: block; position: absolute; top: 6px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--heads); }
#pool-view .sort-menu-list { right: auto; left: 0; min-width: 190px; }
/* the list's line: "All movies ⌄ 30 · Newest" (a tap on the order's words reverses it) */
#pool-view .lib-line-name { align-items: baseline; }
.lib-sort-word { padding: 0 2px; border: 0; background: none; color: var(--text-dim); font: 0.85rem var(--font-body); white-space: nowrap; cursor: pointer; }
.lib-sort-word:hover { color: var(--text); }
#pool-view.is-lists .lib-sort-word { display: none; }
/* ⋮: Delete (the admin's, red; armed it fills red) and Clear selection first while something is picked */
#pool-more-list .menu-danger { color: var(--danger); }
#pool-more-list .menu-danger.armed { background: var(--danger); color: var(--danger-ink); }
/* the start button, one fixed size: a thin grey outline with a coin while idle (lonely and lazy), green with one pick,
   gold with two or more, outlined green while your night is open */
#pool-view .lib-bar button.action-btn.lib-start {
    width: 100%; height: 40px; min-height: 40px; margin: 0; padding: 0 14px; display: flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: 8px; font: 600 0.92rem var(--font-body); box-shadow: none; transform: none;
}
#pool-view .lib-start > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: normal; display: block; }
.lib-start-coin { display: none; flex: none; }
#pool-view .lib-bar button.action-btn.lib-start.is-idle { background: transparent; color: var(--text-dim); border: 1px solid var(--border-hover); font-weight: 500; }
#pool-view .lib-bar button.action-btn.lib-start.is-idle:hover { color: var(--text); border-color: var(--text-dim); background: transparent; }
#pool-view .lib-start.is-idle .lib-start-coin { display: block; }
#pool-view .lib-bar button.action-btn.lib-start.is-one { background: var(--heads); color: var(--heads-ink); }
#pool-view .lib-start.is-one.is-ready { animation-name: start-glow-one; }
@keyframes start-glow-one { 0%, 70%, 100% { box-shadow: 0 0 0 0 transparent; } 35% { box-shadow: 0 0 18px 2px color-mix(in srgb, var(--heads) 55%, transparent); } }
/* the cover size slider (phones and tablets: a coarse pointer; never a desktop or the TV) */
.lib-size { display: none; align-items: center; gap: 6px; color: var(--text-dim); margin: 0; }
.lib-size input[type="range"] { width: 84px; margin: 0; accent-color: var(--text); }
@media (pointer: coarse) { html:not(.tv) .lib-size { display: inline-flex; } }

/* Phones: Start alone, then search + filters sort, then the line, the slider and ⋮ */
@media (max-width: 599px) {
    #pool-view .lib-bar {
        column-gap: 6px; grid-template-columns: minmax(0, 1fr) repeat(3, 36px);
        grid-template-areas: "start start start start" "search add filt sort" "line size size more";
    }
    #lib-bar > .lib-size { justify-self: end; }
    .lib-size input[type="range"] { width: 64px; }
    #pool-view .lib-line-name { gap: 6px; }
    #pool-view .lib-list-btn { font-size: 1rem; }
    /* folded on scroll (pool.js setPoolFolded): the line, 🔍, the slider and ⋮; Start stays while something is picked */
    #pool-view.is-folded :is(.view-title, .play-continue, .library-scheduled, .lib-applied, .draft-hint, .lib-search, #pool-add-btn, #lib-filters-btn, #pool-sort-menu) { display: none; }
    #pool-view.is-folded .lib-bar { grid-template-areas: "start start start start" "line size size more"; }
    #pool-view.is-folded:not(.has-picks) .lib-start-row { display: none; }
    #pool-view.is-folded .lib-line { cursor: pointer; }
    #pool-view.is-folded .pool-fold-only { display: inline-flex; }
}
.pool-fold-only { display: none; }
#pool-view .lib-line { gap: 4px; flex-direction: row; align-items: center; }
#pool-view .lib-line .lib-icon[hidden] { display: none; }

/* The card: the whole poster fitted (never cropped or stretched), the corners on it, one line of title under it */
#pool-view #pool-grid:not(.is-lists) { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px 14px; }
#pool-view #pool-grid.has-size:not(.is-lists) { grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 10px; }
#pool-view .pool-card { container-type: inline-size; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.pool-face { position: relative; aspect-ratio: 2 / 3; background: var(--surface); }
#pool-view .pool-cover { position: absolute; inset: 0; height: auto; background-size: contain; background-repeat: no-repeat; background-position: center; }
#pool-view .pool-cover.no-cover { display: flex; align-items: center; justify-content: center; padding: 8px; text-align: center; font-size: 0.8rem; color: var(--text); background: var(--surface); }
#pool-view .pool-info { padding: 6px 6px 7px; }
#pool-view .pool-title { margin: 0; font-size: clamp(0.6rem, 8.5cqi, 0.82rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the corners: one size, one inset, dark see-through fills with a faint edge */
.pool-face { --cc: 26px; --cc-in: 6px; --cc-bg: var(--card-overlay); --cc-edge: color-mix(in srgb, var(--overlay-ink) 22%, transparent); }
#pool-view .pool-rating {
    top: var(--cc-in); left: var(--cc-in); height: var(--cc); width: 34px; border-radius: calc(var(--cc) / 2); border-width: 1.5px; box-shadow: none;
}
#pool-view .pool-rating.unrated { width: 48px; background: linear-gradient(var(--cc-bg), var(--cc-bg)) padding-box, linear-gradient(var(--cc-edge), var(--cc-edge)) border-box; }
#pool-view .pool-rating.unrated .rating-label { color: var(--text); font-weight: 600; font-size: 0.62rem; }
#pool-view .pool-rating.elite:not(.open) { width: 34px; height: var(--cc); border-radius: calc(var(--cc) / 2); border-width: 1.5px; }
#pool-view .pool-rating.elite:not(.open) .rating-label { font-size: 0.74rem; }
#pool-view .pool-rating.elite:not(.open)::after { inset: -1.5px; padding: 1.5px; }
#pool-view .movie-info-btn {
    top: var(--cc-in); right: var(--cc-in); z-index: 2; width: var(--cc); height: var(--cc);
    background: var(--cc-bg); border: 1px solid var(--cc-edge); box-shadow: none; font-size: 0.82rem; font-style: normal;
}
#pool-view .pool-by {
    left: var(--cc-in); bottom: var(--cc-in); z-index: 2; max-width: calc(100% - 2 * var(--cc-in) - 2 * var(--cc) - 10px);
    height: var(--cc); padding: 0 9px; box-sizing: border-box; border-radius: calc(var(--cc) / 2); line-height: calc(var(--cc) - 2px);
    background: var(--cc-bg); border: 1px solid var(--cc-edge); font-size: 0.72rem; font-weight: 600;
}
.pool-corner { position: absolute; right: var(--cc-in); bottom: var(--cc-in); z-index: 2; display: flex; gap: 5px; }
.pool-corner > button, #pool-view .pool-corner .pool-fav {
    width: var(--cc); height: var(--cc); padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%;
    background: var(--cc-bg); border: 1px solid var(--cc-edge); color: var(--text-soft); cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.pool-corner > button:hover { color: var(--text); }
.pool-corner svg, #pool-view .pool-corner .pool-fav svg { width: 14px; height: 14px; }
#pool-view .pool-corner .pool-fav::before { inset: -4px; }
#pool-view .pool-corner .pool-fav.on { color: var(--tails); }
.pool-seen.on { color: var(--heads); border-color: color-mix(in srgb, var(--heads) 60%, transparent); }
.pool-seen.armed { color: var(--text-dim); border-color: var(--danger); }
#pool-view .pool-noplex { z-index: 1; }
#pool-view :is(.watch-dial, .sad-face) { height: auto; aspect-ratio: 2 / 3; }
/* picked: a dark layer over the full-colour poster, every corner hidden, a green ✓ where the ⓘ sits; no frame */
#pool-view .pool-card.selected, #pool-view .pool-card.rated.selected { transform: none; border-color: var(--border); box-shadow: none; }
#pool-view .pool-card.selected .pool-face::after { content: ""; position: absolute; inset: 0; z-index: 2; background: var(--backdrop); pointer-events: none; }
#pool-view .pool-card.selected .pool-face > :not(.pool-cover) { opacity: 0; visibility: hidden; pointer-events: none; }
#pool-view .pool-card::after { top: 7px; right: 7px; z-index: 3; width: var(--cc, 26px); height: var(--cc, 26px); font-size: 0.85rem; box-shadow: none; }
/* small covers: the corners go (the movie's sheet still has them), then the title shrinks and goes; never wraps */
@container (max-width: 104px) {
    #pool-view .pool-face > :is(.pool-rating, .movie-info-btn, .pool-by, .pool-corner) { display: none; }
    #pool-view .pool-card::after { top: 4px; right: 4px; width: 20px; height: 20px; font-size: 0.7rem; }
    #pool-view .pool-noplex { font-size: 0.6rem; padding: 2px; }
}
@container (max-width: 62px) { #pool-view .pool-info { display: none; } }

/* The Google TV: the poster with its corners (smaller), no title or caption under it; OK picks, OK held opens the movie's
   sheet, ▲ ▼ from a poster reach the corners on it (tv.js tvPick) */
html.tv #pool-view #pool-grid:not(.is-lists) { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
html.tv #pool-view .pool-card { background: none; border-color: transparent; }
html.tv #pool-view .pool-info { display: none; }
html.tv .pool-face { --cc: 24px; border-radius: 6px; overflow: hidden; }
html.tv #pool-view .pool-face :is(.rating-label, .pool-by, .movie-info-btn) { font-size: 12px; }
html.tv #pool-view .pool-cover { border-radius: 6px; }
html.tv #pool-view .lib-bar {
    margin-top: 0; column-gap: 8px; grid-template-columns: minmax(0, 1fr) repeat(3, 40px) 210px 40px;
    grid-template-areas: "line find filt sort start more";
}
html.tv #pool-view .lib-bar button.action-btn.lib-start { height: 38px; min-height: 38px; font-size: 0.85rem; }
html.tv #pool-view .lib-icon { width: 40px; height: 40px; }

/* Filters (11-18): Show as flat tabs, then one line a filter "Label · value" (green with a dot once set); a tap opens its
   choices under it as flat words, the chosen one underlined in green. Done says how many show. */
.lib-filters-dialog .lib-show-row { display: block; }
.lib-filters-dialog .lib-show { display: flex; gap: 18px; margin: 0 0 4px; border-bottom: 1px solid var(--border); }
html:not(.tv) .lib-filters-dialog .lib-show .toggle-btn {
    flex: none; padding: 8px 0 7px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--text-dim); font-size: 0.88rem;
}
html:not(.tv) .lib-filters-dialog .lib-show .toggle-btn.active { color: var(--text); border-bottom-color: var(--heads); }
.lib-filters-dialog .qd-filters { gap: 0; }
html:not(.tv) .lib-filters-dialog .lf-row { display: block; border-bottom: 1px solid var(--border); }
.lf-head {
    display: flex; align-items: center; gap: 0; width: 100%; padding: 12px 2px; border: 0; background: none; cursor: pointer;
    color: var(--text); font: 0.9rem var(--font-body); text-align: left;
}
.lf-head .qd-label { color: var(--text); font-size: 0.9rem; }
.lf-val { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lf-row.is-set .lf-val { color: var(--heads); }
.lf-row.is-set .lf-head::after { content: ""; flex: none; width: 7px; height: 7px; margin-left: auto; border-radius: 50%; background: var(--heads); }
html:not(.tv) .lf-row:not(.is-open) .qd-seg { display: none; }
html:not(.tv) .lib-filters-dialog .lf-row.is-open .qd-seg { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0 2px 12px; }
html:not(.tv) .lib-filters-dialog .lf-opt {
    flex: none; padding: 4px 0 3px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--text-dim); font-size: 0.85rem;
}
html:not(.tv) .lib-filters-dialog .lf-opt.active { color: var(--text); border-bottom-color: var(--heads); }
.lib-filters-dialog .lib-hidden-row { margin-top: 6px; }
#lib-filters-done.is-none { opacity: 0.5; }
.lib-filters-foot #lib-filters-clear[hidden] { display: none; }
.lib-filters-foot { justify-content: space-between; }
.lib-filters-foot #lib-filters-done { margin-left: auto; }
html.tv .lf-head { width: auto; flex: none; padding: 0; pointer-events: none; }
html.tv .lf-val, html.tv .lf-row.is-set .lf-head::after { display: none; }
html:not(.tv) #lf-l-show { display: none; }

/* ---------- Movie Night screens (11-18): the last chance to rig (rig.js) under a small waiting strip, no box and no glow.
   The countdown, a thin bar, the cheating line, the game's covers (5 across on a phone, 10 on a desktop, no titles), who is
   ready and the rigs left, gold Ready (pressed: a grey outline). Then "Game locked". The whole screen fits, no scrolling. */
#staging-view.is-rig { --carousel-w: 84px; --carousel-h: calc(var(--carousel-w) * 280 / 190); justify-content: flex-start; }
@media (min-width: 600px) { #staging-view.is-rig { --carousel-w: 100px; } }
#staging-view.is-rig .carousel-item { font-size: 0.7rem; padding: 4px; }
#staging-view.is-rig #carousel-container { height: calc(var(--carousel-h) + 30px); margin: 0.25rem auto 0.5rem; }
#staging-view.is-rig #carousel-track { gap: 12px; }
.lc {
    width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border);
    transition: opacity 0.35s ease, transform 0.35s ease;
}
@media (min-width: 600px) { .lc { max-width: 540px; } }
.lc[hidden] { display: none; }
.lc.is-gone { opacity: 0; transform: translateY(24px); pointer-events: none; }
.lc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lc-head h3 { margin: 0; font: 600 15px var(--font-display); letter-spacing: 0.05em; text-transform: uppercase; color: var(--text); }
.lc-count { min-width: 1.2em; text-align: right; font: 600 26px/1 var(--font-display); color: var(--text); }
.lc-bar { height: 2px; border-radius: 2px; background: var(--border); overflow: hidden; }
.lc-bar span { display: block; height: 100%; background: var(--text); transform-origin: left; transition: transform 0.2s linear; }
.lc-line { margin: 0; min-height: 2.6em; font-size: 13px; line-height: 1.3; color: var(--text); text-align: center; }
.lc-covers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
@media (min-width: 600px) { .lc-covers { grid-template-columns: repeat(10, minmax(0, 1fr)); } }
.lc-cover {
    position: relative; aspect-ratio: 2 / 3; padding: 2px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; cursor: pointer;
    background: var(--surface-2) center / cover no-repeat; color: var(--text); font-size: 9px; line-height: 1.1; touch-action: manipulation;
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.lc-cover:disabled { cursor: default; }
.lc-cover.rigged::before { content: ""; position: absolute; inset: 0; background: var(--backdrop); }
.lc-cover.rigged::after {
    content: "✓"; position: absolute; top: 4px; right: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--heads); color: var(--heads-ink);
    font: 700 11px/16px var(--font-body); text-align: center;
}
.lc-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--text-dim); }
.lc-who { display: flex; flex-wrap: wrap; gap: 4px 12px; min-width: 0; }
.lc-person { display: inline-flex; align-items: center; gap: 5px; }
.lc-person i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; }
.lc-person.is-starter { color: var(--heads); }
.lc-person.is-other { color: var(--tails); }
.lc-person.is-ready i { background: currentColor; }
.lc-person b { font-weight: 500; color: var(--text-dim); }
.lc-person.is-ready b { color: var(--text); }
.lc-rigs { display: flex; gap: 4px; }
.lc-rigs[hidden] { display: none; }
.lc-rigs i { width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--text-dim); }
.lc-rigs i.is-left { background: var(--text); border-color: var(--text); }
.lc-ready {
    width: 100%; height: 42px; border: 0; border-radius: 10px; background: var(--gold); color: var(--gold-ink); cursor: pointer;
    font: 600 14px var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 12px;
}
@media (min-width: 600px) { .lc-ready { width: 240px; align-self: center; } }
.lc-ready.is-wait { background: none; border: 1px solid var(--border); color: var(--text-dim); }
.lc-ready:disabled { opacity: 0.7; cursor: default; }
.lc-locked {
    position: absolute; left: 50%; top: 45%; z-index: 6; display: flex; align-items: center; gap: 10px; transform: translate(-50%, -50%);
    padding: 10px 22px; border-radius: 10px; background: color-mix(in srgb, var(--bg) 80%, transparent);
    font: 600 28px var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text); white-space: nowrap;
    animation: lc-lock-in 0.3s ease-out both;
}
.lc-locked[hidden] { display: none; }
@keyframes lc-lock-in { from { opacity: 0; transform: translate(-50%, -50%) scale(1.3); } }
/* The TV only watches the countdown (no rigging on the Chromecast, 11-18) */
html.tv .lc-line, html.tv .lc-covers, html.tv .lc-rigs, html.tv .lc-ready { display: none; }
@media (prefers-reduced-motion: reduce) { .lc, .lc-bar span { transition: none; } .lc-locked { animation: none; } }

/* The flip screen (11-18): the scoreboard unboxed, each name over its score (green / pink) with a plain dash between, round
   dots under each score (filled = won), a line for each side, then the format line under a hairline. During a Movie
   Night's flips, one gold button (240 × 42) with its "finishing" lines and a buzz that climbs (arena.js flipGo). */
.scoreboard { width: 100%; max-width: 320px; margin: 0 auto; padding: 0; background: none; border: 0; border-radius: 0; }
.score-box { padding: 0 4px; }
.score-box h3 { font-size: 13px; font-weight: 600; line-height: 1.3rem; }
.score-name[data-who]::before { display: none; }
.score-box:first-child h3 { color: var(--heads); }
.score-box:last-child h3 { color: var(--tails); }
.score-box .score { font-size: 34px; line-height: 1.1; text-shadow: none; }
#heads-score, #tails-score { text-shadow: none; }
.score-middle { padding: calc(1.3rem + 2px) 10px 0; justify-content: flex-start; }
.score-dash { font: 500 24px/1.5 var(--font-display); color: var(--text-dim); }
.match-pips { gap: 5px; height: 7px; margin-top: 6px; }
.match-pip { width: 7px; height: 7px; border: 1.5px solid currentColor; background: none; box-shadow: none; }
.match-pip.is-won { background: currentColor; }
#heads-pips { color: var(--heads); }
#tails-pips { color: var(--tails); }
.score-lines { width: 100%; max-width: 320px; margin: 8px auto 0; min-height: 2.6em; } /* one line across both scores (11-18) */
.score-line {
    margin: 0; font-size: 12px; line-height: 1.3; color: var(--text-dim); text-align: center;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.score-lines:empty { display: none; }
#arena-target {
    width: 100%; max-width: 320px; margin: 10px auto 0; padding-top: 10px; border-top: 1px solid var(--border);
    font: 400 12px var(--font-body); letter-spacing: 0; text-transform: none; color: var(--text-dim);
}
#arena-target .format-one { display: block; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#arena-target .format-one b { color: var(--text); font-weight: 600; }
#arena-target .format-sudden, #arena-target .format-agreed { font-family: var(--font-display); font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; }
#arena-view .flip-container { margin: 20px auto; }
html.tv #arena-target { font-size: 12px; }

#btn-start-flips.flip-go {
    width: 240px; max-width: 100%; height: 42px; min-height: 42px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--gold); color: var(--gold-ink);
    font: 600 12.5px var(--font-display); letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    box-shadow: none; opacity: 1; cursor: pointer; will-change: transform; /* (the buzz: arena.js flipGoTick moves it, 11-19) */
}
#btn-start-flips.flip-go::before, #btn-start-flips.flip-go::after { display: none; }

/* The reveal's Start movie (11-18): the same size, shimmering gold; the copy's progress is on Watch together's sheet. Its
   line sits under it. Straight after the flips it lands with a white wash and stars kept inside its edges. */
.mn-reveal { align-items: center; margin-top: 4px; }
.mn-begin {
    position: relative; isolation: isolate; overflow: hidden; flex-direction: row; justify-content: center; width: 240px; max-width: 100%; height: 42px; min-height: 42px;
    padding: 0 12px; border: 0; border-radius: 10px; background: var(--gold); color: var(--gold-ink);
}
.mn-begin::after {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background: linear-gradient(100deg, var(--gold) 0%, var(--gold) 35%, color-mix(in srgb, var(--gold) 35%, var(--splash)) 50%, var(--gold) 65%, var(--gold) 100%);
    background-size: 250% 100%; animation: begin-shimmer 2.4s linear infinite;
}
.mn-begin:hover { border-color: transparent; }
.mn-begin.is-ready { background: var(--gold); }
.mn-begin-title { position: relative; z-index: 2; font-size: 16px; }
@keyframes begin-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.mn-begin-sub { display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: 320px; margin: -2px 0 0; }
.mn-begin-sub[hidden] { display: none; }
.mn-begin-sub .mn-begin-line { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-dim); font-size: 12px; }
.mn-begin-sub .mn-begin-line:empty { display: none; }
.splash-wash { position: absolute; inset: 0; z-index: 3; background: var(--splash); pointer-events: none; animation: splash-wash 0.45s ease-out forwards; }
@keyframes splash-wash { 0%, 15% { opacity: 1; } 100% { opacity: 0; } }
.splash-star {
    position: absolute; left: 50%; top: 50%; z-index: 3; width: var(--s); height: var(--s); background: var(--splash); pointer-events: none;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    animation: splash-star 1.1s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes splash-star {
    from { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; }
    to { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(0.5) rotate(90deg); opacity: 0; }
}
html.reduce-motion .mn-begin::after, html.tv .mn-begin::after { animation: none; } /* (11-20: the device's setting, the admin's switch, the TV) */
/* The reveal fits the screen with its row (11-18): a smaller poster, Start movie's line on one line */
#arena-view.is-mn-reveal { --poster-w: min(160px, 34vw); --poster-h: calc(var(--poster-w) * 1.5); }
#arena-view.is-mn-reveal .flip-container { margin: 14px auto; }
.mn-begin-sub { width: 100%; }
/* ...and nothing under it, or under a Movie Night's rig page and flips, to scroll to: How we got here, the history panel, the build line */
body:has(#staging-view.active.is-mn, #arena-view.active:is(.is-mn, .is-mn-reveal)) :is(.got-here-link, .got-here-panel, .history-panel, .app-build) { display: none !important; }
.container:has(#staging-view.active.is-mn, #arena-view.active:is(.is-mn, .is-mn-reveal)) { min-height: 0; } /* (100vh under the top bar ran 56 px past the screen) */
#mn-reveal-acts .slim-act span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* A taunt shows over the top of the poster, not over the lines above it */
#arena-view .flip-taunt { bottom: auto; top: 10px; padding: 4px 10px; border-radius: 8px; background: var(--rig-stamp-bg); }
/* Done adding · Ready (11-18): the invitee's toggle on the Create Game screen, in Create Game's own button style */
button.action-btn.mn-ready-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 4px; border: 1px solid transparent; }
button.action-btn.mn-ready-btn[hidden] { display: none; }
.mn-ready-btn small { display: block; font-weight: 400; font-size: 0.78rem; opacity: 0.8; }
.mn-ready-btn small:empty { display: none; }
button.action-btn.mn-ready-btn.is-ready { background: var(--surface-2); color: var(--watch-ok); border-color: var(--watch-ok); }
.mn-ready-btn.is-hurry { animation: mn-hurry 1.8s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .mn-ready-btn.is-hurry { animation: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--heads) 35%, transparent); } }
/* Not watching in Flippy (11-18): the player page plays nothing here, only where the other person is (watchPartyRemote);
   no icons on the picture, no controls */
#arena-view.is-mn-out :is(#mn-top, #mn-ask, #watch-party-controls) { display: none !important; }
.watch-party-remote .watch-party-bar { width: min(260px, 80%); margin-top: 6px; }

/* ---------- Tonight's pick (night-ended.js, 11-18): the ended night's whole page. A small poster beside its title block, then
   Tonight's game, The movie, the ♥ / Seen / Rate row and the buttons, all inside the screen; desktop: the poster big on the
   left, the rest in a column. Re-do is pink and asks twice, then its sheet: Same movies (gold) or Swap movies. ---------- */
#arena-view.is-mn-ended > :not(#mn-ended, #watch-party, dialog) { display: none !important; }
body:has(#arena-view.active.is-mn-ended) :is(.history-panel, .app-build, .got-here-link, .got-here-panel, #game-bar) { display: none !important; }
.container:has(#arena-view.active.is-mn-ended) { min-height: 0; }
.mne { width: 100%; max-width: 480px; display: grid; grid-template-columns: 104px minmax(0, 1fr); grid-template-areas: "bar bar" "poster hd" "game game" "movie movie" "ctl ctl" "rate rate" "acts acts";
    column-gap: 14px; row-gap: 13px; padding: 4px 0 16px; text-align: left; }
.mne[hidden] { display: none; }
.mne-bar { grid-area: bar; display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text-dim); font-size: 13px; }
.mne-back { display: inline-flex; padding: 4px; margin-left: -4px; border: 0; background: none; color: var(--text); cursor: pointer; }
.mne-date { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mne-tag { flex: none; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-dim); font: 600 11px var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; }
.mne-tag.is-on { color: var(--heads); border-color: var(--heads); }
.mne-poster { grid-area: poster; position: relative; overflow: hidden; aspect-ratio: 2 / 3; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface) center / cover no-repeat; display: flex; align-items: center; justify-content: center; text-align: center; }
.mne-poster-title { padding: 0 8px; font: 600 15px/1.1 var(--font-display); color: var(--text); }
.mne-poster .mne-stamp { top: 50%; padding: 3px 8px 2px; border-width: 2px; font-size: 0.95rem; --glow: 1; }
.mne-stamp[hidden] { display: none; }
.mne-hd { grid-area: hd; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mne-kick { font: 600 11px var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.mne-kick[data-side="heads"] { color: var(--heads); }
.mne-kick[data-side="tails"] { color: var(--tails); }
.mne-title { margin: 0; font: 600 26px/1.05 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.mne-line { margin: 0; color: var(--text-dim); font-size: 12.5px; }
.mne-line:empty, .mne-meta:empty { display: none; }
.mne-meta { margin: 0; color: var(--text-dim); font-size: 12px; opacity: 0.8; }
.mne-added { margin: 6px 0 0; color: var(--text-dim); font-size: 12px; }
.mne-added[hidden] { display: none; }
.mne-added[data-side="heads"] .mne-dot { color: var(--heads); }
.mne-added[data-side="tails"] .mne-dot { color: var(--tails); }
.mne-lbl { margin: 0 0 4px; font: 600 11px var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); opacity: 0.8; }
.mne-game { grid-area: game; }
.mne-score { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-dim); font-size: 13px; }
.mne-n { font: 600 24px/1 var(--font-display); }
.mne-n.is-heads, .mne-dots.is-heads { color: var(--heads); }
.mne-n.is-tails, .mne-dots.is-tails { color: var(--tails); }
.mne-dots { display: inline-flex; gap: 4px; }
.mne-dots i { width: 6px; height: 6px; box-sizing: border-box; border-radius: 50%; border: 1.5px solid currentColor; }
.mne-dots i.is-won { background: currentColor; }
.mne-vs { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mne-vs b { color: var(--text); font-weight: 500; }
.mne-agreed { font: 600 15px var(--font-display); letter-spacing: 0.05em; text-transform: uppercase; color: var(--text); }
.mne-movie { grid-area: movie; display: flex; flex-direction: column; gap: 5px; min-width: 0; color: var(--text-dim); font-size: 12.5px; }
.mne-movie[hidden] { display: none; }
.mne-credit { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mne-credit[hidden], .mne-trl[hidden] { display: none; }
.mne-credit b { color: var(--text); font-weight: 500; }
.mne-ov { margin: 2px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.mne-ov.is-open { -webkit-line-clamp: unset; }
.mne-ov:empty { display: none; }
.mne-trl { align-self: flex-start; padding: 0; border: 0; background: none; color: var(--text); font: 500 12.5px var(--font-body); cursor: pointer; }
.mne-ctl { grid-area: ctl; display: flex; align-items: center; gap: 16px; }
.mne-ctl[hidden] { display: none; }
.mne-ctl button { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--text-dim); font: 500 12.5px var(--font-body); cursor: pointer; }
.mne-ctl svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mne-fav.is-on { color: var(--tails); }
.mne-fav.is-on svg { fill: currentColor; }
.mne-seen.is-on { color: var(--heads); }
.mne-ctl .mne-rate { margin-left: auto; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); font: 600 12px var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; }
.mne-ratebox { grid-area: rate; }
.mne-ratebox[hidden] { display: none; }
.mne-ratebox .winner-tonight { margin-top: 0; padding-top: 0; border-top: 0; }
.mne-acts { grid-area: acts; display: flex; gap: 10px; }
.mne-btn { flex: 1 1 0; min-width: 0; height: 42px; padding: 0 6px; border: 1px solid var(--border); border-radius: 10px; background: none; color: var(--text); cursor: pointer;
    font: 600 14px var(--font-display); letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mne-btn[hidden] { display: none; }
.mne-btn:disabled { opacity: 0.4; cursor: default; }
.mne-btn.is-redo { border-color: var(--tails); color: var(--tails); }
.mne-btn.is-redo.armed, .slim-act.is-redo.armed { background: var(--tails); color: var(--tails-ink); }
.mne-btn.is-gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.slim-act.is-redo { border-color: var(--tails); color: var(--tails); }
.redo-sheet { margin: auto 0 0; padding: 8px 18px calc(18px + env(safe-area-inset-bottom, 0px)); width: 100%; max-width: 100%; border: 0; border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0; background: var(--surface); color: var(--text); }
.redo-sheet[open] { display: flex; flex-direction: column; gap: 12px; animation: dialog-in 0.22s cubic-bezier(0.25, 1, 0.5, 1); }
.redo-sheet::before { content: ''; align-self: center; width: 36px; height: 4px; border-radius: 2px; background: var(--border-hover); }
.redo-sheet::backdrop { background: var(--backdrop); }
.redo-sheet.is-busy .mne-btn { opacity: 0.6; pointer-events: none; }
.redo-title { margin: 0; font: 600 18px var(--font-display); letter-spacing: 0.05em; text-transform: uppercase; }
.redo-line { margin: -6px 0 0; color: var(--text-dim); font-size: 13px; }
.redo-btns { display: flex; gap: 10px; }
.redo-x { align-self: center; padding: 2px 0; border: 0; background: none; color: var(--text-dim); font: 500 13px var(--font-body); cursor: pointer; }
@media (min-width: 600px) {
    .redo-sheet { margin: auto; width: 420px; max-width: calc(100vw - 32px); border: 1px solid var(--border); border-radius: 14px; }
    .redo-sheet::before { display: none; }
}
@media (min-width: 900px) {
    #arena-view.is-mn-ended { max-width: 860px; }
    .mne { max-width: 820px; grid-template-columns: 230px minmax(0, 1fr); grid-template-areas: "poster bar" "poster hd" "poster game" "poster movie" "ctl acts" "rate rate";
        column-gap: 28px; align-content: start; }
    .mne-poster { align-self: start; }
    .mne-poster-title { font-size: 26px; }
    .mne-poster .mne-stamp { font-size: 1.6rem; }
    .mne-title { font-size: 34px; }
    .mne-ov { -webkit-line-clamp: 3; }
    .mne-acts .mne-btn { flex: 0 0 170px; }
}

/* ---------- Movie Night flow (11-19) ---------- */
/* The invitee said no after Create Game (watch.js movieNightWait): Invite someone else / Go solo under the line */
.mn-declined { display: flex; gap: 10px; width: 100%; max-width: 360px; margin: 10px auto 0; }
.mn-declined[hidden] { display: none; }
/* Tonight's pick, Open (night-ended.js nightOpenSlots): the reveal's shimmering Start movie in Replay's slot at the buttons'
   size, its line and the other person's row under them, End night in New night's place; the final pick's marquee lights
   round the poster while the night is on */
#arena-view.is-mn-ended #mn-reveal { display: none; }
.mne { grid-template-areas: "bar bar" "poster hd" "game game" "movie movie" "ctl ctl" "rate rate" "acts acts" "wait wait"; }
.mne-wait { grid-area: wait; display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: -4px; min-width: 0; }
.mne-wait[hidden] { display: none; }
.mne-wait .mn-begin-sub { margin: 0; }
.mne-acts .mn-begin { flex: 1 1 0; width: auto; min-width: 0; }
.mne-acts .mn-begin[hidden] { display: none; }
.mne-acts .mn-begin-title { font-size: 14px; letter-spacing: 0.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mne-btn.is-end.armed { background: var(--surface-2); border-color: var(--text-dim); }
.mne-poster.is-open { overflow: visible; }
@media (min-width: 900px) {
    .mne { grid-template-areas: "poster bar" "poster hd" "poster game" "poster movie" "ctl acts" ". wait" "rate rate"; }
    .mne-acts .mn-begin { flex: 0 0 170px; }
}
/* The Filthy win: a spray of white over the screen that drips down (arena.js burstSpray), in the celebration layer */
.spray-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- Movie Night room (11-19, lobby.js / watch.js; mock VCqD2jP5W7rq8toM76fct1): C on a phone, B on a computer ---------- */
/* Who's coming as one line (a dot and a name each, no chips), the covers with a + tile, one Rules line, one button */
.mn-room { align-items: stretch; gap: 12px; }
.mn-room .mn-who-label, .mn-room .mn-rules-slot { display: none; }
.mn-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mn-who .watch-chips { flex: 1; min-width: 0; gap: 4px 14px; align-items: center; }
.mn-who .watch-chip { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; border-radius: 0; background: none; font-size: 13.5px; font-weight: 500; }
.mn-who .watch-chip::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--tails); }
.mn-who .watch-chip.is-host::before { background: var(--heads); }
.mn-who .watch-chip.is-declined { border: 0; text-decoration: line-through; }
.mn-who .watch-chip.is-declined::before { background: var(--text-dim); }
.mn-who .chip-tag { font: 600 11px var(--font-display); letter-spacing: 0.08em; }
.mn-who .watch-chip-note { font-size: 12.5px; }
.mn-invite { flex: none; margin-left: auto; padding: 4px 0; border: 0; background: none; color: var(--heads); font: 500 13px var(--font-body); cursor: pointer; }
.mn-invite[hidden] { display: none; }
.mn-movies { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mn-movies .watch-list-head { margin-bottom: 0; }
.watch-list.mn-covers { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mn-add { display: grid; place-items: center; width: 100%; aspect-ratio: 2 / 3; padding: 0; border: 1px dashed var(--border-hover); border-radius: 8px;
    background: none; color: var(--text-dim); font: 400 26px var(--font-body); cursor: pointer; }
.mn-add:hover, .mn-add:focus-visible { border-color: var(--heads); color: var(--heads); outline: none; }
.mn-rules-line { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0; border: 0; border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border); background: none; color: var(--text); font: 500 13.5px var(--font-body); text-align: left; cursor: pointer; }
.mn-rules-v { min-width: 0; margin-left: auto; overflow: hidden; color: var(--text-dim); font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }
.mn-chev { color: var(--text-dim); font-size: 18px; line-height: 1; }
.mn-go { display: flex; gap: 10px; margin-top: 8px; }
.mn-go > button.action-btn { flex: 1 1 0; min-width: 0; margin: 0; }
.mn-go > button.action-btn[hidden], .mn-go > .mn-pick-btn { display: none; }
/* I'm being lazy: a quiet button with its line (one a page load) and what it does */
button.action-btn.mn-lazy-btn { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; background: none;
    border: 1px solid var(--border-hover); color: var(--text-dim); font: 500 13px var(--font-body); letter-spacing: 0; text-transform: none; }
.mn-coin { flex: none; width: 14px; height: 14px; box-sizing: border-box; border: 1.5px solid currentColor; border-radius: 50%; }
.mn-lazy-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; text-align: left; }
.mn-lazy-line { overflow: hidden; color: var(--text); white-space: nowrap; text-overflow: ellipsis; }
.mn-lazy-sub { font-size: 0.75rem; opacity: 0.85; }
.mn-lazy-sub:empty { display: none; }
/* Create Game carries the "Waiting on" line until everyone is Ready; I'm Ready is gold until pressed */
button.action-btn#watch-create-btn.is-waiting { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-hover); }
#watch-create-btn > span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mn-room #watch-ready-btn:not(.is-ready) { background: var(--gold); color: var(--gold-ink); }
#watch-room .watch-status:empty { display: none; }
/* The Rules (the sheet on a phone and the TV, the right column on a computer): rows with hairlines, flat tabs, switches */
.mn-rules { display: flex; flex-direction: column; width: 100%; }
.mn-rules.pulse { animation: format-pulse 0.9s ease-out 2; }
.mn-rule { display: flex; align-items: center; gap: 10px; min-height: 46px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.mn-rule:first-child { border-top: 1px solid var(--border); }
.mn-rule[hidden] { display: none; }
.mn-rule-k { font-weight: 500; }
.mn-seg { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; margin-left: auto; }
.mn-rule-k { white-space: nowrap; }
.rules-sheet > .mne-btn { flex: none; }
.mn-seg button { padding: 4px 0 3px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-dim);
    font: 600 12.5px var(--font-display); letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; }
.mn-seg button.is-on { color: var(--text); border-bottom-color: var(--heads); }
.mn-seg button:disabled { cursor: default; }
.mn-seg button:disabled:not(.is-on) { opacity: 0.45; }
.mn-rule .qd-switch { margin-left: auto; }
.mn-rule .qd-switch[aria-checked="true"] { background: var(--gold); border-color: var(--gold); }
.mn-rule .qd-switch[aria-checked="true"] span { background: var(--gold-ink); }
.mn-rule-i { flex: none; width: 18px; height: 18px; padding: 0; border: 1.3px solid var(--text-dim); border-radius: 50%; background: none; color: var(--text-dim);
    font: 600 10px/1 var(--font-body); cursor: pointer; }
.mn-rule-wheel { position: relative; flex: none; width: 18px; height: 18px; border-radius: 50%;
    background: conic-gradient(var(--heads) 0 60deg, var(--tails) 60deg 120deg, var(--gold) 120deg 150deg, var(--heads) 150deg 210deg,
        var(--tails) 210deg 270deg, var(--gold) 270deg 300deg, var(--heads) 300deg 330deg, var(--tails) 330deg 360deg);
    filter: saturate(0.2) brightness(0.55); }
.mn-rule-wheel::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--bg); }
.rules-sheet .mn-rule-wheel::after { background: var(--surface); }
.mn-rule-wheel.is-on { filter: none; animation: chaos-spin 6s linear infinite; }
.mn-rule-note { margin: 8px 0 0; color: var(--text-dim); font-size: 12px; line-height: 1.4; }
.mn-rule-note[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .mn-rule-wheel.is-on { animation: none; } .mn-rules.pulse { animation: none; outline: 2px solid var(--accent); } }
/* A computer (not the TV): movies on the left with + Add movies beside the button; who's coming and the Rules list on the right */
@media (min-width: 900px) {
    /* the room's two columns need more than the views' usual 480px */
    html:not(.tv) #lobby-view:has(#lobby-new:not([hidden])), html:not(.tv) #watch-view:has(#watch-room:not([hidden])) { max-width: 880px; }
    html:not(.tv) .mn-room .mn-seg { flex-wrap: nowrap; }
    html:not(.tv) .mn-room { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr auto auto;
        grid-template-areas: "movies label" "movies who" "movies slot" "go slot" "status slot"; column-gap: 36px; row-gap: 12px; align-items: start; }
    html:not(.tv) .mn-room .mn-who-label { display: block; grid-area: label; margin: 0; }
    html:not(.tv) .mn-room .mn-who { grid-area: who; }
    html:not(.tv) .mn-room .mn-movies { grid-area: movies; }
    html:not(.tv) .mn-room .mn-rules-slot { display: block; grid-area: slot; }
    html:not(.tv) .mn-room .mn-go { grid-area: go; margin-top: 0; }
    html:not(.tv) .mn-room .watch-status { grid-area: status; margin: 0; }
    html:not(.tv) .mn-room .mn-rules-line { display: none; }
    html:not(.tv) .watch-list.mn-covers { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    html:not(.tv) .mn-go > .mn-pick-btn { display: block; flex: 0 0 38%; }
    html:not(.tv) .mn-go > .mn-pick-btn[hidden] { display: none; }
}
/* The Rules for everyone but the starter (11-23, lobby.js renderRules): who set them and one line, no sheet; on a computer
   in the right column under Who's coming */
.mn-rules-line[hidden], .mn-rules-sum[hidden] { display: none; }
.mn-rules-sum { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; text-align: left; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.mn-rules-by { color: var(--text-dim); font: 600 11px var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; }
.mn-rules-now { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13.5px; }
.mn-rules-now .mn-rule-wheel { width: 14px; height: 14px; }
.mn-rules-now .mn-rule-wheel::after { inset: 4.5px; }
.mn-rules-dot { color: var(--text-dim); }
@media (min-width: 900px) {
    html:not(.tv) .mn-room .mn-rules-sum { grid-area: slot; margin-top: 6px; }
}

/* ---------- Ratings, Flippy finishes early, round dots (11-19) ---------- */
/* Tonight's pick's Rate: the covers' two rating dials, in a row under the buttons (pool-cards.js openWatchedDial) */
.mne-ratebox .watch-dial { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 10px 18px; padding: 12px;
    border: 1px solid var(--border); border-radius: 10px; }
.mne-ratebox .watch-dial-prompt, .mne-ratebox .watch-dial-actions { flex: 1 1 100%; justify-content: center; text-align: center; }
.mne-seen.armed { border-color: var(--danger); }
/* Flippy finishes early: its line over the celebration (arena.js finishLine), the score's label, the cover's splotches */
.finish-line { position: absolute; left: 50%; top: 22%; width: min(86vw, 520px); margin: 0; padding: 10px 16px; transform: translateX(-50%);
    border-radius: 10px; background: var(--rig-stamp-bg); color: var(--text); font: 600 1.15rem/1.25 var(--font-display); text-align: center; }
.mne-early { color: var(--gold); font: 600 12px var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; }
.mne-splotch { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
/* Round dots in white (filled when won, an outline otherwise); the score numbers keep their colours */
#heads-pips, #tails-pips, .mne-dots.is-heads, .mne-dots.is-tails { color: var(--splash); }

/* ---------- Tonight's pick row (11-19, night-ended.js): Start movie, Re-do, Complete night, New night ---------- */
/* Two a row on a phone (four make two rows, three put the last on its own), one row of up to four on a computer */
.mne-acts { flex-wrap: wrap; }
.mne-acts .mne-btn, .mne-acts .mn-begin { flex: 1 1 calc(50% - 5px); }
.lobby-ends { margin: 0; color: var(--text-dim); font-size: 13px; text-align: center; }
.lobby-ends[hidden] { display: none; }
@media (min-width: 900px) {
    .mne-acts { flex-wrap: nowrap; }
    .mne-acts .mne-btn, .mne-acts .mn-begin { flex: 1 1 0; }
}

/* ---------- Flip and win animations, Tonight's pick's backdrop and strip, Clear filters, the desktop panel (11-20) ---------- */
/* Tonight's pick: whole bulbs round the poster (no more half bulbs from the background), the poster's edge a faint gold;
   the dud flickers through the rest of its round (night-ended.js moves it each round). Their hops and stills: "Marquee
   lights" above */
.mne-poster.is-open { box-shadow: 0 0 18px -3px color-mix(in srgb, var(--marquee-on) calc(45% * var(--glow)), transparent); }
.mne-bulbs { --bulb-big: 1.2; position: absolute; inset: -9px; z-index: 2; pointer-events: none; }
.mne-bulbs i { position: absolute; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: var(--marquee-off); }
.mne-bulbs i.dud { animation: bulb-hop-0 2s step-end infinite, bulb-dud 2s step-end; }
@keyframes bulb-dud { 0% { opacity: 1; } 48% { opacity: 0.2; } 51% { opacity: 1; } 56% { opacity: 0.15; } 62% { opacity: 1; } 77% { opacity: 0.3; } 80%, 100% { opacity: 1; } }
/* The TV: the shuffle's backdrop dimmed, not blurred (shuffle.js and arena.js leave the motion blur off there) */
html.tv .staging-backdrop { filter: brightness(0.25); }

/* The hand-off (night-ended.js nightGlide): the winning cover glides from the coin into the poster's spot */
.mne-poster.is-gliding { visibility: hidden; }
.mne-glide { position: fixed; z-index: 40; overflow: hidden; pointer-events: none; display: flex; align-items: center; justify-content: center; padding: 0 8px;
    background: var(--surface) center / cover no-repeat; color: var(--text); font: 600 15px/1.1 var(--font-display); text-align: center; }

/* The strip of covers under the score (night-ended.js nightStrip): never drawn dimmed, the winner edged in gold */
.mne-strip { display: flex; gap: 4px; margin-top: 10px; min-width: 0; }
.mne-strip-c { position: relative; flex: 0 1 34px; min-width: 0; aspect-ratio: 2 / 3; overflow: hidden; display: grid; place-items: center; border-radius: 3px;
    background: var(--surface-2) center / cover no-repeat; box-shadow: inset 0 0 0 1px var(--border); color: var(--text-dim); font: 600 11px var(--font-display); }
.mne-strip-c.is-out { opacity: 0.35; }
.mne-strip-c.is-won { overflow: visible; box-shadow: 0 0 0 2px var(--gold); }
@media (min-width: 900px) { .mne-strip { gap: 6px; } .mne-strip-c { flex-basis: 40px; } }
/* The loser crossed out (night-ended.js nightStrike): a marker stroke in its side's colour (--lose) through the runner-up
   line and its cover; .is-striking draws it in */
.mne-vs b { position: relative; }
.mne-game.is-struck :is(.mne-vs b, .mne-strip-c.is-lost)::after { content: ""; position: absolute; left: -3px; right: -3px; top: calc(50% - 1.5px); height: 3px; border-radius: 2px;
    background: var(--lose); opacity: 0.9; rotate: -2deg; transform-origin: left center; }
.mne-game.is-struck .mne-strip-c.is-lost::after { left: 0; right: auto; width: 181%; top: calc(100% - 1.5px); rotate: -56.3deg; } /* (corner to corner, from the bottom left) */
.mne-game.is-striking :is(.mne-vs b, .mne-strip-c.is-lost)::after { animation: mne-strike 0.4s ease-out backwards; }
@keyframes mne-strike { from { scale: 0 1; } }

/* The movie's own backdrop (night-ended.js nightBackdrop): a band across the window behind the poster and the title,
   dimmed, faded into the page at the bottom and the sides; under the page (the column goes see-through over it) */
.mne-bd { --pg: var(--bg); position: absolute; left: 0; right: 0; top: 0; height: 640px; z-index: -1; pointer-events: none;
    background: linear-gradient(to right, var(--pg) 0, transparent 14%, transparent 86%, var(--pg) 100%),
        linear-gradient(to bottom, color-mix(in srgb, var(--pg) 50%, transparent) 0%, color-mix(in srgb, var(--pg) 72%, transparent) 55%, var(--pg) 100%),
        var(--mne-bd) center 30% / cover no-repeat; }
body:not(:has(#arena-view.active.is-mn-ended:not(.is-mn-player))) .mne-bd { display: none; }
body:has(> .mne-bd):has(#arena-view.active.is-mn-ended:not(.is-mn-player)) .main-panel { background: transparent; }
/* Tonight's pick on a phone: a shorter band; Tonight's game and The movie in cards (not on a computer, not on the TV) */
@media (max-width: 899.98px) {
    .mne-bd { height: 380px; }
    html:not(.tv) :is(.mne-game, .mne-movie) { padding: 10px 14px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
    html:not(.tv) :is(.mne-game, .mne-movie) .mne-lbl { margin-bottom: 6px; }
}

/* Clear on the filters line, after the green words (Movies and Shows: the Filters sheet's Clear; the list and the search
   stay), and Clear filters / Show all under a list the filters emptied (pool.js, shows.js, games.js) */
.lib-applied-row { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.lib-applied-row:has(> .lib-applied[hidden]), #pool-view.is-folded .lib-applied-row { display: none; }
.lib-applied-row .lib-applied { min-width: 0; }
.lib-clear-sep { color: var(--text-dim); font-size: 0.72rem; }
.lib-clear { flex: none; padding: 0; border: 0; background: none; color: var(--text); font: 500 0.72rem/1.3 var(--font-body); text-decoration: underline;
    text-underline-offset: 2px; cursor: pointer; }
.list-clear { display: block; margin: -0.5rem auto 0; }
.list-clear[hidden] { display: none; }
#pool-grid .list-clear { grid-column: 1 / -1; justify-self: center; margin-top: -1.25rem; }
#shows-clear { margin-top: 0.75rem; }

/* A computer from 1280 wide (never the TV): the page's column is a lighter panel with thin edges on a darker backdrop;
   on Tonight's pick the movie's backdrop runs over the panel's top */
@media (min-width: 1280px) {
    html:not(.tv) body { background: var(--out); }
    html:not(.tv) .main-panel { --bg: var(--panel); background: var(--bg); flex: 1 0 auto; box-shadow: inset 1px 0 var(--border), inset -1px 0 var(--border); }
    html:not(.tv) #pool-view.active { box-shadow: inset 1px 0 var(--border), inset -1px 0 var(--border); }
    html:not(.tv) .container:has(#staging-view.active.is-mn, #arena-view.active:is(.is-mn, .is-mn-reveal, .is-mn-ended)) { min-height: calc(100vh - var(--tab-top)); }
    html:not(.tv) .mne-bd { --pg: var(--out); }
    html:not(.tv) body:has(> .mne-bd):has(#arena-view.active.is-mn-ended:not(.is-mn-player)) .main-panel { background: linear-gradient(to bottom, transparent 0, transparent 380px, var(--panel) 620px); }
}
/* Tonight's pick (11-23): a panel of the page's colour behind the column over the movie's backdrop (bar, title, game, movie),
   so its words read on any backdrop, the TV too; on a phone behind the title block (Tonight's game and The movie are cards) */
@media (min-width: 900px) {
    .mne { isolation: isolate; }
    .mne::before { content: ""; grid-area: 1 / 2 / 5 / 3; z-index: -1; margin: -12px -16px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 85%, transparent); }
}
@media (max-width: 899.98px) {
    .mne-hd { margin: -8px; padding: 8px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 85%, transparent); }
}

/* ---------- Buttons keep their size, their words wrap (11-23) ---------- */
/* Two lines at most, never "…": past two lines the font steps down to 10 px where a line is set (arena.js fitBox). The
   ones sized by their words are pinned at the height they had. Kept on one line: the tab bar and the player's now-playing line */
.mne-btn, #btn-start-flips.flip-go, .mne-acts .mn-begin-title, .wt-pick, .wt-row.is-note, .slim-act, #mn-reveal-acts .slim-act span, .slim-ask-btn,
.sort-menu-btn, .more-menu-list button, .manage-actions button.action-btn, :is(.livetv-cats, #livetv-peek-group) .toggle-btn,
#watch-create-btn > span, .mn-lazy-line, .lib-start > span, #pool-view .lib-start > span, .lib-list-btn, .lib-list-btn > span, .end-btn, .winner-btn,
.qd-seg .toggle-btn, .lib-line-tools .tool-btn, .lib-show .toggle-btn, .mn-begin-sub .mn-begin-line {
    white-space: normal; line-height: 1.1; overflow-wrap: anywhere; text-overflow: clip;
}
.wt-row.is-note { display: flex; align-items: center; height: 40px; }
.mn-go > button.action-btn { height: 3.8rem; padding-top: 0; padding-bottom: 0; }
.end-btn { height: 2.7em; padding-top: 0; padding-bottom: 0; }
.winner-btn { height: 2.2em; padding-top: 0; padding-bottom: 0; }
.qd-seg .toggle-btn { height: 2.35em; padding-top: 0; padding-bottom: 0; }
.lib-filters-body .qd-seg .toggle-btn { height: 2.5em; }
.lib-show .toggle-btn { height: 2.8em; padding-top: 0; padding-bottom: 0; }
