/* Four palettes, one watch-page layout. Video itself is never color-filtered. */
:root {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none; color-scheme: dark;
  --page: #100e10; --surface: #191619; --surface-raised: #211b1e; --surface-hover: #302329;
  --text: #f0e9e7; --muted: #b1a3a6; --quiet: #938489; --line: #34282e;
  --accent: #d97986; --accent-solid: #a93448; --accent-hover: #c04559; --on-accent: #fff6f5;
  --accent-soft: #351c23; --ambient: #571c2a; --player: #0c0a0c;
  --stage-center: #241218; --stage-edge: #0e0b0e; --stage-text: #f4e7e5; --stage-muted: #b69a9f;
  --stage-line: #ffffff19; --curtain: #691e32; --curtain-opacity: .3;
  --shadow: 0 14px 48px #00000030; --error-bg: #381c22; --error-text: #f6bac2; --error-line: #71323e;
}
:root[data-theme="classic"] {
  --page: #111412; --surface: #1a1f19; --surface-raised: #222a20; --surface-hover: #30382a;
  --text: #eeeae3; --muted: #a0aa98; --quiet: #8c9884; --line: #343e2f;
  --accent: #e4bb77; --accent-solid: #e4bb77; --accent-hover: #f3ce91; --on-accent: #24271e;
  --accent-soft: #302c20; --ambient: #273323; --player: #101810;
  --stage-center: #243122; --stage-edge: #101810; --stage-text: #e3e7d9; --stage-muted: #a7b49b;
  --curtain: #384b2e; --curtain-opacity: .15;
  --error-bg: #34291f; --error-text: #e9bb9a; --error-line: #6b5038;
}
:root[data-theme="dark"] {
  --page: #111214; --surface: #1b1d20; --surface-raised: #25272c; --surface-hover: #32353b;
  --text: #f0f1f3; --muted: #acb1bb; --quiet: #9198a4; --line: #33373e;
  --accent: #c3ccdc; --accent-solid: #d4dbe8; --accent-hover: #edf1f8; --on-accent: #161a21;
  --accent-soft: #2a303b; --ambient: #27303c; --player: #0c0e11;
  --stage-center: #202630; --stage-edge: #0e1014; --stage-text: #edf1f8; --stage-muted: #a3afbf;
  --curtain: #36445a; --curtain-opacity: .1;
  --error-bg: #342024; --error-text: #f6b9c3; --error-line: #633b44;
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f5f5f4; --surface: #ffffff; --surface-raised: #eeefef; --surface-hover: #e3e5e7;
  --text: #202125; --muted: #5f626a; --quiet: #6b6d74; --line: #dcdee1;
  --accent: #8d293d; --accent-solid: #942d42; --accent-hover: #772134; --on-accent: #fff9f9;
  --accent-soft: #f8e9ed; --ambient: #ded8dc; --player: #100e11;
  --stage-center: #26212a; --stage-edge: #100e13; --stage-text: #f3ecf1; --stage-muted: #b9a9b5;
  --curtain: #493043; --curtain-opacity: .13; --shadow: 0 12px 40px #27222a0c;
  --error-bg: #fff0f2; --error-text: #8e2436; --error-line: #e5b7c0;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--page); }
body::before { content: ""; position: absolute; z-index: -1; top: 72px; left: 0; right: 0; height: 560px; pointer-events: none; background: radial-gradient(ellipse at 38% 0, var(--ambient), transparent 68%); opacity: .3; }
button, select, input { font: inherit; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, input:disabled { cursor: default; opacity: .4; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.topbar { height: 76px; border-bottom: 1px solid var(--line); background: var(--page); }
.topbar-inner { height: 100%; max-width: 1860px; padding: 0 40px; margin: auto; display: flex; align-items: center; gap: 25px; }
.wordmark { text-decoration: none; color: var(--text); font-size: 26px; font-weight: 720; letter-spacing: -1.3px; display: inline-flex; align-items: center; }
.brand-icon { display: grid; place-items: center; width: 35px; height: 31px; border-radius: 9px; color: var(--on-accent); background: var(--accent-solid); margin-right: 10px; box-shadow: 0 3px 14px #00000015; }
.brand-icon .icon { width: 20px; fill: currentColor; stroke: none; margin-left: -2px; }
.brand-period { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.theme-control { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); }
.theme-control .icon { width: 17px; height: 17px; }
.theme-control select { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 7px 25px 7px 10px; cursor: pointer; font-size: 12px; }
.permission { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.permission .icon { width: 14px; height: 14px; color: var(--accent); }
.shell { max-width: 1860px; margin: auto; padding: 30px 40px; }
.watch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 26px; align-items: start; }
.watch-column { min-width: 0; }
.player-card { overflow: hidden; border-radius: 11px; border: 1px solid var(--line); background: var(--player); box-shadow: var(--shadow); }
.screen { position: relative; aspect-ratio: 16 / 9; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse at 50% 45%, var(--stage-center), var(--stage-edge) 75%); color: var(--stage-text); }
.screen::before, .screen::after { content: ""; position: absolute; pointer-events: none; inset: 0; z-index: -1; }
.screen::before { background: linear-gradient(90deg, var(--curtain), transparent 22%, transparent 78%, var(--curtain)); opacity: var(--curtain-opacity); }
:root[data-theme="theater"] .screen::after { background: repeating-linear-gradient(90deg, transparent 0, #00000020 20px, transparent 40px); mask-image: linear-gradient(90deg, #000, transparent 25%, transparent 75%, #000); }
.screen-grain { position: absolute; inset: 0; pointer-events: none; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.18' filter='url(%23n)'/%3E%3C/svg%3E"); opacity: .12; }
.screen canvas { position: absolute; width: 100%; height: 100%; object-fit: contain; opacity: 0; background: #000; }
.screen.playing canvas { opacity: 1; }
.screen.playing .screen-grain, .screen.playing::before, .screen.playing::after { display: none; }
.waiting { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 35px; text-align: center; }
.waiting h1 { font-size: 22px; font-weight: 550; margin: 0 0 22px; line-height: 1.3; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 7px; padding: 12px 21px; background: var(--accent-solid); color: var(--on-accent); font-size: 12px; font-weight: 650; box-shadow: 0 4px 16px #00000020; }
.primary .icon { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.primary:hover { background: var(--accent-hover); }
.primary:disabled { cursor: wait; }
.screen-top, .screen-bottom { position: absolute; left: 22px; right: 22px; display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none; }
.screen-top { top: 20px; }
.screen-bottom { bottom: 17px; font-size: 10px; color: #c3b9be; text-shadow: 0 1px 5px #000; }
.screen.playing .screen-top, .screen.playing .screen-bottom { background: #00000040; border-radius: 5px; padding: 5px 8px; }
.dot { display: inline-block; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--quiet); }
.dot.live { background: var(--accent); box-shadow: 0 0 9px var(--accent-soft); }
.stream-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 10px; padding: 7px 9px; border: 1px solid var(--stage-line); border-radius: 4px; color: var(--stage-muted); background: #00000020; }
.stream-badge .dot { background: var(--stage-muted); }
.stream-badge.active { color: #fff; }
.stream-badge.active .dot { background: #ed687b; }
.controls { min-height: 56px; padding: 8px 14px; background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); }
.control-left, .control-right { display: flex; align-items: center; gap: 8px; }
.control-right { margin-left: auto; }
.icon-button { min-width: 32px; width: 32px; height: 32px; border-radius: 6px; color: var(--text); display: inline-grid; place-items: center; border: 0; background: transparent; }
.icon-button:hover { background: var(--surface-hover); }
.icon-button .icon { width: 18px; height: 18px; }
#pause .icon { width: 15px; height: 15px; fill: currentColor; stroke: none; }
#volume { width: 76px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.control-divider { width: 1px; height: 15px; margin: 0 3px; background: var(--line); }
#sound-label { font-size: 10px; color: var(--muted); white-space: nowrap; min-width: 58px; }
.playback-limit { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.playback-limit select { background: var(--surface-raised); color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 5px 6px; font-size: 10px; cursor: pointer; }
#theater-mode[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.room-sidebar { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.room-card { padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.panel-heading { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { font-size: 14px; font-weight: 620; margin: 0; letter-spacing: -.2px; }
.source { display: flex; align-items: center; gap: 8px; }
.source strong { font-size: 12px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.stream-facts { margin: 20px 0 0; font-size: 12px; }
.stream-facts > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.stream-facts dt { color: var(--muted); }
.stream-facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.error { color: var(--error-text); background: var(--error-bg); border: 1px solid var(--error-line); border-radius: 8px; padding: 13px 16px; font-size: 12px; line-height: 1.6; }
.access-card { max-width: 380px; margin: 60px auto; padding: 28px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.access-card h1 { margin: 0 0 24px; font-size: 20px; font-weight: 550; }
.access-card form { display: grid; gap: 14px; }
.access-card label, .access-card p { font-size: 13px; }
.access-card input { width: 100%; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--page); }
.access-card p { color: var(--muted); margin-bottom: 0; }
.screen:fullscreen { width: 100%; height: 100%; aspect-ratio: auto; background: #000; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
:root[data-layout="wide"] .watch-layout { grid-template-columns: minmax(0, 1fr); }
:root[data-layout="wide"] .room-sidebar { max-width: 440px; }
:root[data-layout="wide"] .screen { max-height: calc(100dvh - 155px); min-height: 250px; }
@media (min-width: 1600px) {
  .watch-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 30px; }
  .room-card { padding: 25px; }
}
@media (max-width: 1100px) {
  .topbar-inner { padding: 0 24px; }
  .shell { padding: 24px; }
  .watch-layout { grid-template-columns: minmax(0, 1fr) 275px; gap: 20px; }
  .room-card { padding: 18px; }
  .controls { flex-wrap: wrap; }
  .control-divider, #sound-label { display: none; }
}
@media (max-width: 900px) {
  .watch-layout { grid-template-columns: minmax(0, 1fr); }
  .room-sidebar { max-width: 440px; }
  .control-divider, #sound-label { display: block; }
}
@media (max-width: 600px) {
  .topbar { height: 66px; }
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .wordmark { font-size: 23px; }
  .brand-icon { width: 29px; height: 27px; margin-right: 8px; }
  .header-actions { gap: 9px; }
  .theme-control { gap: 5px; }
  .theme-control > span, .theme-control > .icon, .permission { display: none; }
  .theme-control select { padding: 7px 5px; max-width: 100px; font-size: 11px; }
  .shell { padding: 17px 12px; }
  .watch-layout { gap: 20px; }
  .player-card { border-radius: 8px; }
  .waiting { padding: 20px; }
  .waiting h1 { font-size: 19px; margin-bottom: 16px; }
  .primary { padding: 9px 15px; font-size: 11px; }
  .screen-top, .screen-bottom { left: 12px; right: 12px; }
  .screen-top { top: 11px; }
  .screen-bottom { bottom: 11px; font-size: 8px; }
  .stream-badge { font-size: 8px; padding: 5px 6px; }
  .controls { padding: 7px 8px; gap: 4px; min-height: 49px; }
  .control-left, .control-right { gap: 3px; }
  .icon-button { width: 29px; min-width: 29px; height: 30px; }
  #volume { width: 52px; }
  .control-divider, #sound-label { display: none; }
  .playback-limit { gap: 5px; font-size: 9px; }
  .playback-limit select { font-size: 9px; padding: 5px 3px; }
  .room-sidebar { max-width: none; }
  .room-card { padding: 19px; }
  .panel-heading { padding-bottom: 15px; margin-bottom: 18px; }
  :root[data-layout="wide"] .screen { min-height: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  button, select { transition: background-color .15s, border-color .15s; }
}
