@font-face {
  font-family: "DHDPlayer Oxanium";
  src: url("./themes/command-center/fonts/Oxanium-Variable.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 200 800;
}

@font-face {
  font-family: "DHDPlayer Rajdhani";
  src: url("./themes/atlantis-expedition/fonts/Rajdhani-Regular.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "DHDPlayer Rajdhani";
  src: url("./themes/atlantis-expedition/fonts/Rajdhani-SemiBold.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 500 650;
}

@font-face {
  font-family: "DHDPlayer Rajdhani";
  src: url("./themes/atlantis-expedition/fonts/Rajdhani-Bold.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 700 900;
}

@font-face {
  font-family: "DHDPlayer Antonio";
  src: url("./themes/tng-operations/fonts/Antonio-Variable.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 100 700;
}

@font-face {
  font-family: "DHDPlayer Chakra Petch";
  src: url("./themes/living-tech/fonts/ChakraPetch-Regular.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "DHDPlayer Chakra Petch";
  src: url("./themes/living-tech/fonts/ChakraPetch-SemiBold.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 500 650;
}

@font-face {
  font-family: "DHDPlayer Chakra Petch";
  src: url("./themes/living-tech/fonts/ChakraPetch-Bold.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 700 900;
}

@font-face {
  font-family: "DHDPlayer Orbitron";
  src: url("./themes/atlantis-diagnostics/fonts/Orbitron-Variable.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 400 900;
}

@font-face {
  font-family: "DHDPlayer Exo 2";
  src: url("./themes/atlantis-diagnostics/fonts/Exo2-Variable.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 100 900;
}

:root {
  color-scheme: dark;
  --bg: #0f1216;
  --panel: #171c22;
  --panel-strong: #202733;
  --line: #2c3542;
  --text: #f4f7fb;
  --muted: #a9b4c2;
  --soft: #d7dee8;
  --teal: #19c2a7;
  --teal-ink: #031d19;
  --amber: #f0c14b;
  --blue: #6c8cff;
  --rose: #ff6b91;
  --green: #53d681;
  --danger: #ff6961;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  --panel-surface: rgba(23, 28, 34, 0.94);
  --control-bg: #0c1014;
  --native-control-bg: #0c1014;
  --native-control-text: #f4f7fb;
  --subtle-bg: rgba(255, 255, 255, 0.04);
  --subtle-border: rgba(255, 255, 255, 0.08);
  --topbar-bg: rgba(15, 18, 22, 0.9);
  --nav-bg: rgba(15, 18, 22, 0.94);
  --focus-ring: rgba(25, 194, 167, 0.8);
  --selected-bg: rgba(25, 194, 167, 0.14);
  --selected-border: rgba(25, 194, 167, 0.58);
  --selected-text: #c7fff3;
  --theme-pattern: none;
  --theme-pattern-size: auto;
  --theme-font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --theme-heading-font-family: var(--theme-font-family);
  --theme-heading-transform: none;
  --theme-artwork: none;
  --theme-artwork-opacity: 0;
  --theme-artwork-position: right top;
  --theme-artwork-size: min(66vw, 760px) auto;
  --badge-radius: 5px;
  --badge-min-height: 26px;
  --badge-padding-inline: 9px;
  --list-disclosure-radius: 999px;
  --list-disclosure-border: color-mix(in srgb, var(--selected-border) 72%, var(--line));
  --list-disclosure-background: color-mix(in srgb, var(--selected-bg) 72%, transparent);
  --list-disclosure-color: var(--selected-text);
  --list-disclosure-hover-border: var(--selected-border);
  --list-disclosure-hover-background: var(--selected-bg);
  --list-disclosure-icon-size: 19px;
  --list-disclosure-icon-stroke: 2;
  font-family: var(--theme-font-family);
}

:root[data-theme="field-manual"] {
  color-scheme: light;
  --bg: #f4f1ea;
  --panel: #fffdf8;
  --panel-strong: #edf4ee;
  --panel-surface: rgba(255, 253, 248, 0.96);
  --control-bg: #ffffff;
  --native-control-bg: #ffffff;
  --native-control-text: #1f2522;
  --line: #d2ccbf;
  --text: #1f2522;
  --soft: #303a35;
  --muted: #66716c;
  --teal: #2e6f58;
  --teal-ink: #ffffff;
  --blue: #37699a;
  --amber: #9c5a2e;
  --rose: #b24764;
  --green: #2f7b4a;
  --danger: #b63e36;
  --shadow: 0 14px 34px rgba(41, 37, 28, 0.12);
  --subtle-bg: rgba(46, 111, 88, 0.06);
  --subtle-border: rgba(31, 37, 34, 0.14);
  --topbar-bg: rgba(244, 241, 234, 0.92);
  --nav-bg: rgba(255, 253, 248, 0.96);
  --focus-ring: #2e6f58;
  --selected-bg: rgba(46, 111, 88, 0.12);
  --selected-border: rgba(46, 111, 88, 0.55);
  --selected-text: #1f523f;
}

:root[data-theme="night-watch"] {
  --bg: #141816; --panel: #202722; --panel-strong: #26382f; --panel-surface: rgba(32, 39, 34, 0.96);
  --control-bg: #111713; --native-control-bg: #111713; --native-control-text: #eef4ec; --line: #3c4b42; --text: #eef4ec; --soft: #dce8df; --muted: #a7b6ac;
  --teal: #78c59e; --teal-ink: #102118; --blue: #78a9d6; --amber: #e0a06d; --green: #75cf8f;
  --topbar-bg: rgba(20, 24, 22, 0.92); --nav-bg: rgba(24, 31, 27, 0.96); --focus-ring: #78c59e;
  --selected-bg: rgba(120, 197, 158, 0.14); --selected-border: rgba(120, 197, 158, 0.55); --selected-text: #c9f5db;
}

:root[data-theme="crt-green"] {
  --badge-radius: 2px;
  --bg: #08120b; --panel: #102016; --panel-strong: #163821; --panel-surface: rgba(16, 32, 22, 0.97);
  --control-bg: #071009; --native-control-bg: #071009; --native-control-text: #d7ffd8; --line: #245331; --text: #d7ffd8; --soft: #c1edc5; --muted: #89b58d;
  --teal: #50d46d; --teal-ink: #051408; --blue: #72b7a7; --amber: #e6d36a; --green: #65e67e;
  --topbar-bg: rgba(8, 18, 11, 0.94); --nav-bg: rgba(11, 23, 15, 0.97); --focus-ring: #e6d36a;
  --selected-bg: rgba(80, 212, 109, 0.13); --selected-border: rgba(80, 212, 109, 0.55); --selected-text: #b9ffc1;
  --theme-pattern: repeating-linear-gradient(0deg, transparent 0 3px, rgba(80, 212, 109, 0.018) 3px 4px);
  --theme-pattern-size: 100% 4px;
}

:root[data-theme="lcd-blue"] {
  color-scheme: light;
  --bg: #e8f0f4; --panel: #fbfdff; --panel-strong: #e4f2f8; --panel-surface: rgba(251, 253, 255, 0.97);
  --control-bg: #ffffff; --native-control-bg: #ffffff; --native-control-text: #16222b; --line: #bccbd3; --text: #16222b; --soft: #263842; --muted: #5d6c76;
  --teal: #2e789b; --teal-ink: #ffffff; --blue: #3869b0; --amber: #9c5d2e; --green: #2b7b57; --danger: #b53f43;
  --topbar-bg: rgba(232, 240, 244, 0.94); --nav-bg: rgba(251, 253, 255, 0.97); --focus-ring: #2e789b;
  --selected-bg: rgba(46, 120, 155, 0.12); --selected-border: rgba(46, 120, 155, 0.55); --selected-text: #174b64;
}

:root[data-theme="cartridge-pop"] {
  color-scheme: light;
  --bg: #eef1f3; --panel: #fffefb; --panel-strong: #dff3ed; --panel-surface: rgba(255, 254, 251, 0.97);
  --control-bg: #ffffff; --native-control-bg: #ffffff; --native-control-text: #182633; --line: #9baab1; --text: #182633; --soft: #263946; --muted: #59666f;
  --teal: #d94b55; --teal-ink: #ffffff; --blue: #176b87; --amber: #b77700; --green: #25805f; --danger: #bd3542;
  --topbar-bg: rgba(238, 241, 243, 0.94); --nav-bg: rgba(255, 254, 251, 0.97); --focus-ring: #176b87;
  --selected-bg: rgba(217, 75, 85, 0.11); --selected-border: rgba(217, 75, 85, 0.58); --selected-text: #8f2330;
  --theme-pattern: linear-gradient(rgba(24, 38, 51, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(24, 38, 51, 0.025) 1px, transparent 1px);
  --theme-pattern-size: 24px 24px;
}

:root[data-theme="arcade-neon"] {
  --badge-radius: 3px;
  --bg: #0d0f13; --panel: #171b22; --panel-strong: #202b2c; --panel-surface: rgba(23, 27, 34, 0.97);
  --control-bg: #090b0f; --native-control-bg: #090b0f; --native-control-text: #f5f7f2; --line: #364248; --text: #f5f7f2; --soft: #dde5e2; --muted: #a5b0ad;
  --teal: #36e1d0; --teal-ink: #071b1a; --blue: #8a8fff; --amber: #ffd43b; --rose: #ff4fa3; --green: #65e69a;
  --topbar-bg: rgba(13, 15, 19, 0.94); --nav-bg: rgba(16, 20, 25, 0.97); --focus-ring: #ffd43b;
  --selected-bg: rgba(54, 225, 208, 0.12); --selected-border: rgba(54, 225, 208, 0.58); --selected-text: #9dfff5;
  --theme-pattern: linear-gradient(rgba(54, 225, 208, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 79, 163, 0.02) 1px, transparent 1px);
  --theme-pattern-size: 32px 32px;
}

:root[data-theme="mono-deck"] {
  color-scheme: light;
  --bg: #f1f1ef; --panel: #ffffff; --panel-strong: #eceff5; --panel-surface: rgba(255, 255, 255, 0.98);
  --control-bg: #ffffff; --native-control-bg: #ffffff; --native-control-text: #101114; --line: #a8aaaf; --text: #101114; --soft: #2b2d32; --muted: #5b5d63;
  --teal: #245eea; --teal-ink: #ffffff; --blue: #245eea; --amber: #a34b00; --green: #25754a; --danger: #b22e38;
  --topbar-bg: rgba(241, 241, 239, 0.95); --nav-bg: rgba(255, 255, 255, 0.98); --focus-ring: #ffb800;
  --selected-bg: rgba(36, 94, 234, 0.1); --selected-border: rgba(36, 94, 234, 0.55); --selected-text: #123b9b;
  --theme-pattern: radial-gradient(rgba(16, 17, 20, 0.07) 0.7px, transparent 0.7px);
  --theme-pattern-size: 8px 8px;
}

:root[data-theme="command-center"] {
  --badge-radius: 3px;
  --bg: #0b1015; --panel: #171c20; --panel-strong: #22282b; --panel-surface: rgba(23, 28, 32, 0.95);
  --control-bg: #090d11; --native-control-bg: #090d11; --native-control-text: #f1eee6; --line: #4c4b43; --text: #f1eee6; --soft: #ddd8cb; --muted: #aaa89f;
  --teal: #c99a4b; --teal-ink: #171006; --blue: #668fa0; --amber: #e2b665; --rose: #c87861; --green: #86aa82; --danger: #e06a5f;
  --topbar-bg: rgba(11, 16, 21, 0.94); --nav-bg: rgba(17, 22, 26, 0.97); --focus-ring: #e2b665;
  --selected-bg: rgba(201, 154, 75, 0.14); --selected-border: rgba(226, 182, 101, 0.68); --selected-text: #ffe0a0;
  --list-disclosure-radius: 3px; --list-disclosure-border: rgba(226, 182, 101, 0.78); --list-disclosure-background: rgba(9, 13, 17, 0.72); --list-disclosure-color: #e2b665;
  --list-disclosure-hover-border: #f2c979; --list-disclosure-hover-background: rgba(201, 154, 75, 0.16); --list-disclosure-icon-size: 18px; --list-disclosure-icon-stroke: 1.75;
  --theme-pattern: linear-gradient(rgba(201, 154, 75, 0.026) 1px, transparent 1px), linear-gradient(90deg, rgba(102, 143, 160, 0.022) 1px, transparent 1px);
  --theme-pattern-size: 42px 42px;
}

:root[data-theme="atlantis-expedition"] {
  --badge-radius: 4px;
  --bg: #07161c; --panel: #10252c; --panel-strong: #16313a; --panel-surface: rgba(16, 37, 44, 0.94);
  --control-bg: #061318; --native-control-bg: #061318; --native-control-text: #e9fbff; --line: #315866; --text: #e9fbff; --soft: #d1edf3; --muted: #9bbcc4;
  --teal: #59dbe8; --teal-ink: #041719; --blue: #75a9d0; --amber: #d8bf79; --rose: #d57f93; --green: #7ed7b5; --danger: #f07872;
  --topbar-bg: rgba(7, 22, 28, 0.93); --nav-bg: rgba(11, 28, 34, 0.96); --focus-ring: #9eeef4;
  --selected-bg: rgba(89, 219, 232, 0.12); --selected-border: rgba(89, 219, 232, 0.62); --selected-text: #c8faff;
  --theme-pattern: radial-gradient(rgba(89, 219, 232, 0.08) 0.7px, transparent 0.8px);
  --theme-pattern-size: 18px 18px;
}

:root[data-theme="tng-operations"] {
  --badge-radius: 10px 4px 10px 4px;
  --bg: #111117; --panel: #1b1a23; --panel-strong: #292637; --panel-surface: rgba(27, 26, 35, 0.95);
  --control-bg: #0d0d12; --native-control-bg: #0d0d12; --native-control-text: #f8f1e8; --line: #514d61; --text: #f8f1e8; --soft: #e5dce7; --muted: #b4aebd;
  --teal: #efaa50; --teal-ink: #231305; --blue: #7fa8d1; --amber: #efaa50; --rose: #d86773; --green: #8fbd8b; --danger: #ef6664;
  --topbar-bg: rgba(17, 17, 23, 0.93); --nav-bg: rgba(24, 23, 31, 0.97); --focus-ring: #f5c27d;
  --selected-bg: rgba(146, 133, 197, 0.18); --selected-border: rgba(239, 170, 80, 0.72); --selected-text: #ffe0aa;
  --theme-pattern: linear-gradient(90deg, rgba(216, 103, 115, 0.022) 0 2px, transparent 2px 48px, rgba(146, 133, 197, 0.02) 48px 50px, transparent 50px);
  --theme-pattern-size: 96px 100%;
}

:root[data-theme="living-tech"] {
  --badge-radius: 8px 3px 8px 3px;
  --bg: #101615; --panel: #1b2421; --panel-strong: #25302c; --panel-surface: rgba(27, 36, 33, 0.95);
  --control-bg: #0b100f; --native-control-bg: #0b100f; --native-control-text: #f0eee5; --line: #4c5c53; --text: #f0eee5; --soft: #dce2d8; --muted: #a8b3aa;
  --teal: #61a9a0; --teal-ink: #071817; --blue: #779ab1; --amber: #dda955; --rose: #ce7b4e; --green: #92b877; --danger: #e56f5e;
  --topbar-bg: rgba(16, 22, 21, 0.93); --nav-bg: rgba(20, 29, 26, 0.97); --focus-ring: #dda955;
  --selected-bg: rgba(97, 169, 160, 0.15); --selected-border: rgba(206, 123, 78, 0.68); --selected-text: #c8f0e9;
  --theme-pattern: radial-gradient(rgba(221, 169, 85, 0.048) 0.8px, transparent 0.9px);
  --theme-pattern-size: 22px 22px;
}

:root[data-theme="command-center"] :is(.panel, .setup-frame, .modal-panel),
:root[data-theme="atlantis-expedition"] :is(.panel, .setup-frame, .modal-panel),
:root[data-theme="tng-operations"] :is(.panel, .setup-frame, .modal-panel),
:root[data-theme="living-tech"] :is(.panel, .setup-frame, .modal-panel) {
  border-top-color: var(--selected-border);
}

:root[data-theme="tng-operations"] :is(.btn, .status-pill, .settings-nav-item, .account-view-tab) {
  border-radius: 10px 4px 10px 4px;
}

:root[data-theme="living-tech"] :is(.btn, .status-pill, .settings-nav-item, .account-view-tab) {
  border-radius: 8px 3px 8px 3px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

html.room-player-active,
body.room-player-active {
  height: 100%;
  overflow: hidden;
}

html.retro-player-active,
body.retro-player-active {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body.retro-player-active {
  /* Do not composite the theme's fixed artwork underneath a full-screen game.
     The game is opaque and owns every visible pixel until its menu opens. */
  background: #020304;
}

body.retro-player-active::before {
  display: none;
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  background-color: var(--bg);
  background-image: var(--theme-pattern);
  background-size: var(--theme-pattern-size);
  color: var(--text);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: var(--theme-artwork);
  background-repeat: no-repeat;
  background-position: var(--theme-artwork-position);
  background-size: var(--theme-artwork-size);
  content: "";
  opacity: var(--theme-artwork-opacity);
  pointer-events: none;
}

:is(h1, h2, h3, h4, .brand strong, .setup-brand strong) {
  font-family: var(--theme-heading-font-family);
  text-transform: var(--theme-heading-transform);
}

button,
input,
select,
textarea {
  font: inherit;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select {
  height: 44px;
  min-height: 44px;
  box-sizing: border-box;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100svh;
  padding: env(safe-area-inset-top) 0 calc(72px + env(safe-area-inset-bottom));
}

.setup-active { overflow: auto; }

.setup-shell {
  min-height: 100svh;
  padding: 0;
}

.setup-page {
  display: grid;
  min-height: 100svh;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  place-items: center;
}

.setup-frame {
  width: min(860px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.setup-header,
.setup-brand,
.setup-step-heading,
.setup-account-ready,
.setup-device-preview,
.setup-actions {
  display: flex;
  align-items: center;
}

.setup-header {
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.setup-brand { gap: 10px; }
.setup-brand img { width: 34px; height: 34px; }
.setup-brand span { display: grid; gap: 1px; }
.setup-brand strong { font-size: 15px; }
.setup-brand small,
.setup-count { color: var(--muted); font-size: 12px; }

.setup-count {
  padding: 5px 8px;
  border: 1px solid var(--subtle-border);
  border-radius: 7px;
  background: var(--subtle-bg);
}

.setup-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  padding: 13px 20px;
  list-style: none;
  border-bottom: 1px solid var(--line);
}

.setup-progress li {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--muted);
}

.setup-progress li:not(:last-child)::after {
  position: absolute;
  top: 13px;
  left: calc(50% + 18px);
  width: calc(100% - 36px);
  height: 1px;
  background: var(--line);
  content: "";
}

.setup-progress li.complete:not(:last-child)::after { background: var(--teal); }

.setup-progress li > span {
  z-index: 1;
  display: grid;
  width: 27px;
  height: 27px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

.setup-progress li > span .icon { width: 15px; height: 15px; }
.setup-progress li.active { color: var(--text); }
.setup-progress li.active > span { border-color: var(--selected-border); background: var(--selected-bg); color: var(--selected-text); }
.setup-progress li.complete > span { border-color: var(--teal); background: var(--teal); color: var(--teal-ink); }

.setup-content { padding: clamp(22px, 5vw, 42px); }
.setup-step { display: grid; gap: 22px; margin: 0; }

.setup-step-heading {
  align-items: flex-start;
  gap: 15px;
}

.setup-step-heading > div { min-width: 0; }
.setup-step-heading h1 { margin: 3px 0 5px; font-size: clamp(24px, 4vw, 34px); letter-spacing: 0; }
.setup-step-heading p { max-width: 62ch; margin: 0; color: var(--muted); line-height: 1.45; }

.setup-step-icon {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--selected-border);
  border-radius: 8px;
  background: var(--selected-bg);
  color: var(--selected-text);
  place-items: center;
}

.setup-step-icon .icon { width: 23px; height: 23px; }
.setup-eyebrow { color: var(--teal); font-size: 11px; font-weight: 850; text-transform: uppercase; }

.setup-terms {
  display: grid;
  border-block: 1px solid var(--line);
  scrollbar-color: var(--muted) transparent;
}

.setup-terms section { padding: 12px 2px; border-bottom: 1px solid var(--line); }
.setup-terms h2 { margin: 0 0 3px; font-size: 14px; }
.setup-terms p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.setup-terms > small { padding: 10px 2px; color: var(--muted); }

.setup-accept {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--soft);
  font-weight: 700;
}

.setup-accept input { width: 19px; height: 19px; accent-color: var(--teal); }

.setup-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.setup-login .check-row { grid-column: 1 / -1; }
.setup-login label,
.setup-primary-field { display: grid; gap: 7px; color: var(--soft); font-weight: 750; }
.setup-login input,
.setup-primary-field input { min-width: 0; }
.setup-primary-field small,
.setup-signup small { color: var(--muted); font-weight: 500; line-height: 1.4; }

.setup-signup,
.setup-account-ready,
.setup-device-preview {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.setup-signup > div,
.setup-account-ready > div,
.setup-device-preview > div { display: grid; flex: 1; gap: 2px; min-width: 0; }
.setup-signup .btn { flex: 0 0 auto; }
.setup-account-ready .account-avatar { width: 42px; height: 42px; }

.setup-device-preview > span {
  display: grid;
  width: 40px;
  height: 40px;
  color: var(--teal);
  place-items: center;
}

.setup-device-preview small,
.setup-account-ready small,
.setup-account-ready span { color: var(--muted); }

.setup-license-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.setup-license-summary > div {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 5px 9px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.setup-license-summary > div > span { grid-row: 1 / 3; color: var(--teal); }
.setup-license-summary strong { font-size: 13px; }
.setup-license-summary small { color: var(--muted); line-height: 1.4; }
.setup-license-note { margin: -4px 0 0; color: var(--soft); }

.setup-actions {
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
}

.setup-actions.three { display: grid; grid-template-columns: auto 1fr auto; }
.setup-actions.three > :nth-child(2) { justify-self: end; }

@media (max-width: 640px) {
  .setup-page { padding: 0; place-items: stretch; }
  .setup-frame { min-height: 100svh; border: 0; border-radius: 0; box-shadow: none; }
  .setup-header { padding-inline: 16px; }
  .setup-progress { padding-inline: 10px; }
  .setup-progress small { font-size: 10px; }
  .setup-content { padding: 22px 18px max(22px, env(safe-area-inset-bottom)); }
  .setup-login { grid-template-columns: minmax(0, 1fr); }
  .setup-login .check-row { grid-column: auto; }
  .setup-license-summary { grid-template-columns: minmax(0, 1fr); }
  .setup-actions.three { grid-template-columns: auto 1fr; }
  .setup-actions.three > :nth-child(2) { justify-self: end; }
  .setup-actions.three > :last-child { grid-column: 1 / -1; width: 100%; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .setup-page { padding: 8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); }
  .setup-header { padding-block: 9px; }
  .setup-brand img { width: 28px; height: 28px; }
  .setup-progress { padding-block: 7px; }
  .setup-progress li > span { width: 23px; height: 23px; }
  .setup-progress li:not(:last-child)::after { top: 11px; }
  .setup-content { padding: 16px 22px; }
  .setup-step { gap: 13px; }
  .setup-step-heading h1 { font-size: 24px; }
  .setup-step-icon { width: 38px; height: 38px; flex-basis: 38px; }
  .setup-terms { max-height: 145px; }
  .setup-license-summary > div { padding: 10px; }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 12px 16px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--subtle-border);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.brand strong,
.hero h1,
.section-title h2,
.entity-title {
  letter-spacing: 0;
}

.brand strong {
  display: block;
  font-size: 1rem;
}

.brand span {
  display: block;
  max-width: 46vw;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.service-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.service-state.good .service-dot {
  background: var(--green);
}

.service-state.bad .service-dot {
  background: var(--danger);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.inbox-button {
  position: relative;
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
  color: var(--soft);
}

.inbox-button .icon {
  width: 19px;
  height: 19px;
}

.inbox-count {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  place-items: center;
  border: 2px solid var(--panel);
  border-radius: 9px;
  background: var(--rose);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 1;
}

.status-pill,
.kind-pill,
.tiny-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--badge-min-height);
  padding: 4px var(--badge-padding-inline);
  border: 1px solid var(--line);
  border-radius: var(--badge-radius);
  background: rgba(255, 255, 255, 0.05);
  color: var(--soft);
  font-size: 0.76rem;
  font-weight: 700;
  align-self: center;
  flex: 0 0 auto;
  height: var(--badge-min-height);
  line-height: 1.05;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill.good {
  border-color: rgba(83, 214, 129, 0.55);
  background: rgba(83, 214, 129, 0.14);
  color: #b7f7c8;
}

.status-pill.warn {
  border-color: rgba(240, 193, 75, 0.58);
  background: rgba(240, 193, 75, 0.14);
  color: #ffe7a3;
}

.status-pill.bad {
  border-color: rgba(255, 105, 97, 0.58);
  background: rgba(255, 105, 97, 0.14);
  color: #ffc1bd;
}

.content {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 4px 0 16px;
  padding: 4px 2px;
}

.page-header h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.15;
}

.page-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.media-page-header {
  align-items: center;
}

.share-intent-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.share-intent-card {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow);
}

.share-intent-card:hover,
.share-intent-card:focus-visible {
  border-color: var(--selected-border);
  background: var(--panel-strong);
}

.share-intent-card.active {
  border-color: var(--teal);
  background: var(--selected-bg);
  box-shadow: inset 0 -3px 0 var(--teal), var(--shadow);
}

.share-intent-card > svg:first-child {
  width: 22px;
  height: 22px;
  padding: 8px;
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--teal);
  box-sizing: content-box;
}

.share-intent-card > span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.share-intent-card strong {
  font-size: .82rem;
  line-height: 1.2;
}

.share-intent-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.share-intent-card > svg:last-child { width: 16px; color: var(--muted); }
.share-intent-card > b { display: grid; place-items: center; min-width: 24px; height: 24px; border-radius: 999px; background: var(--teal); color: var(--teal-ink); font-size: .7rem; }

.share-watch-panel,
.share-download-panel {
  display: grid;
  gap: 14px;
}

.share-watch-panel .section-title,
.share-download-panel .section-title { margin: 0; }

.share-watch-picker-row,
.share-watch-actions,
.media-selection-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.share-watch-actions { justify-content: flex-end; }

.media-explore-summary {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 11px 13px;
  border: 1px solid var(--subtle-border);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.media-explore-summary > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--teal);
}

.media-explore-summary strong { font-size: .82rem; }
.media-explore-summary p { margin: 3px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.4; }
.media-explore-summary p b { color: var(--text); }

.media-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.media-toolbar .btn {
  min-height: 40px;
  white-space: nowrap;
}

.media-toolbar .btn[aria-pressed="true"] {
  border-color: var(--teal);
  background: var(--selected-bg);
  color: var(--selected-text);
}

.media-selection-panel {
  display: grid;
  gap: 12px;
}

.media-selection-panel .section-title {
  margin-top: 0;
}

.media-selection-tray { margin-bottom: 14px; }
.media-selection-tray .section-title { align-items: center; }
.media-selection-footer { justify-content: space-between; color: var(--muted); font-size: .74rem; }

.room-draft-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}

.hero {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(25, 194, 167, 0.18), rgba(108, 140, 255, 0.08)),
    var(--panel);
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.04;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.hero-actions,
.action-row,
.inline-row,
.filter-row,
.entity-actions,
.chat-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-row {
  margin: 0 0 12px;
}

.btn,
.tab-btn,
.icon-btn {
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 750;
  text-decoration: none;
}

.btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.icon-btn {
  width: 44px;
  padding: 9px;
}

.icon-btn.primary {
  border-color: rgba(25, 194, 167, 0.42);
  background: var(--teal);
  color: var(--teal-ink);
}

.icon-btn.danger {
  border-color: rgba(255, 105, 97, 0.5);
  color: #ffc1bd;
}

.icon {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
}

.compact-actions {
  justify-content: flex-end;
}

.compact-actions .btn {
  min-height: 40px;
  padding: 8px 11px;
}

.btn.primary {
  border-color: rgba(25, 194, 167, 0.42);
  background: var(--teal);
  color: var(--teal-ink);
}

.btn.blue {
  border-color: rgba(108, 140, 255, 0.55);
  background: rgba(108, 140, 255, 0.2);
}

.btn.warn {
  border-color: rgba(240, 193, 75, 0.55);
  background: rgba(240, 193, 75, 0.16);
}

.btn.danger {
  border-color: rgba(255, 105, 97, 0.64);
  background: rgba(255, 105, 97, 0.16);
}

.btn.ghost {
  background: var(--subtle-bg);
}

.btn:disabled,
.tab-btn:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

.btn[aria-busy="true"]::before,
:is(button, a[data-action])[aria-busy="true"]:not(.btn)::before,
.operation-spinner {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: operation-spin 0.72s linear infinite;
}

.btn[aria-busy="true"] > .icon,
:is(button, a[data-action])[aria-busy="true"]:not(.btn) > .icon { display: none; }

.icon-btn[aria-busy="true"] { position: relative; }
.icon-btn[aria-busy="true"]::before {
  position: absolute;
  inset: 50% auto auto 50%;
  margin: -8.5px 0 0 -8.5px;
}
.icon-btn[aria-busy="true"] > * { visibility: hidden; }

.operation-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 12px 14px;
  border: 1px solid rgba(25, 194, 167, 0.34);
  border-radius: 9px;
  background: rgba(25, 194, 167, 0.09);
  color: var(--text);
}

.operation-progress > span:last-child {
  display: grid;
  gap: 3px;
}

.operation-progress small {
  color: var(--muted);
  line-height: 1.35;
}

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

@media (prefers-reduced-motion: reduce) {
  .btn[aria-busy="true"]::before,
  :is(button, a[data-action])[aria-busy="true"]:not(.btn)::before,
  .operation-spinner { animation-duration: 1.5s; }
}

.btn:hover:not(:disabled),
.icon-btn:hover:not(:disabled),
.tab-btn:hover:not(:disabled) {
  border-color: rgba(215, 222, 232, 0.42);
  filter: brightness(1.06);
}

.btn:focus-visible,
.icon-btn:focus-visible,
.tab-btn:focus-visible,
.nav-btn:focus-visible,
.service-state:focus-visible,
.segment:focus-visible,
summary:focus-visible,
.connector-breadcrumbs button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

body.controller-input :is(button, a, input, select, textarea, summary, [tabindex]):focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(5, 6, 8, 0.72);
}

.host-profile-options {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.effect-settings {
  display: grid;
  gap: 10px;
  margin: 2px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.effect-settings legend {
  padding: 0 6px;
  font-weight: 700;
}

.effect-settings output {
  float: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.host-profile-options legend {
  margin-bottom: 8px;
  font-weight: 700;
}

.host-profile-choice {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--subtle-bg);
}

.host-profile-choice:has(input:checked) {
  border-color: var(--selected-border);
  background: var(--selected-bg);
}

.host-profile-choice input {
  margin-top: 3px;
}

.host-profile-choice span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.host-profile-choice small {
  color: var(--muted);
  line-height: 1.4;
}

.tab-btn.active {
  border-color: var(--selected-border);
  background: var(--selected-bg);
  color: var(--selected-text);
}

.grid,
.form-grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel,
.entity-card,
.player-panel {
  border: 1px solid var(--subtle-border);
  border-radius: 8px;
  background: var(--panel-surface);
}

.panel {
  padding: 14px;
}

.panel > .section-title:first-child {
  margin-top: 0;
}

.content > .grid + .panel,
.content > .panel + .grid,
.content > .panel + .panel,
.content > .split + .panel,
.content > .panel + .split {
  margin-top: 12px;
}

.entity-card + .panel,
.panel + .player-panel {
  margin-top: 12px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 10px;
}

.section-title-inline {
  align-items: center;
}

.section-title-inline > div:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.section-title-inline > div:first-child p {
  margin: 0;
}

.section-title > div:first-child,
.page-header > div:first-child,
.entity-head > div:first-child {
  min-width: 0;
}

.section-title h2 {
  margin: 0;
  font-size: 1rem;
}

.section-title p,
.muted,
.meta {
  color: var(--muted);
}

.section-title p {
  margin: 3px 0 0;
  font-size: 0.84rem;
}

.entity-list {
  display: grid;
  gap: 10px;
}

.entity-card {
  display: grid;
  gap: 10px;
  padding: 13px;
}

.entity-detail-card {
  gap: 9px;
}

.entity-detail-card + :is(.room-landing, .playlist-presentation-card) {
  margin-top: 12px;
}

.detail-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.playlist-presentation-card {
  position: relative;
  isolation: isolate;
  min-height: 168px;
  overflow: hidden;
  border: 1px solid var(--subtle-border);
  border-radius: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--teal) 17%, var(--panel-surface)), var(--panel-surface) 58%);
  box-shadow: 0 12px 32px rgb(0 0 0 / 16%);
}

.playlist-presentation-card.compact {
  min-height: 104px;
}

.playlist-presentation-card + :is(.panel, .room-landing) {
  margin-top: 12px;
}

.playlist-presentation-banner,
.playlist-presentation-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.playlist-presentation-banner {
  z-index: -2;
  object-fit: cover;
  object-position: center;
  transform: scale(1.045);
}

.playlist-presentation-shade {
  z-index: -1;
  background: linear-gradient(32deg, rgba(3, 8, 13, .98) 0%, rgba(3, 8, 13, .88) 38%, rgba(3, 8, 13, .22) 100%);
}

.playlist-presentation-card:not(.has-banner) .playlist-presentation-shade {
  background: radial-gradient(circle at 88% 0%, color-mix(in srgb, var(--teal) 20%, transparent), transparent 46%);
}

.playlist-presentation-card.header-artwork.has-banner {
  min-height: 220px;
}

.playlist-presentation-card.header-artwork .playlist-presentation-copy {
  min-height: 220px;
}

.playlist-presentation-copy {
  display: grid;
  align-content: center;
  gap: 7px;
  min-height: 168px;
  max-width: min(700px, 88%);
  padding: 24px;
}

.playlist-presentation-card.compact .playlist-presentation-copy {
  min-height: 104px;
  padding-block: 16px;
}

.playlist-presentation-eyebrow,
.sheet-eyebrow {
  color: var(--teal);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.playlist-presentation-copy h2,
.playlist-presentation-copy p {
  margin: 0;
}

.playlist-presentation-copy h2 {
  font-size: clamp(1.35rem, 3vw, 2.05rem);
  line-height: 1.04;
}

.playlist-presentation-copy p {
  max-width: 65ch;
  color: rgba(255, 255, 255, .86);
  font-size: .88rem;
  line-height: 1.5;
  white-space: pre-line;
}

.playlist-presentation-schedule,
.playlist-schedule-preview {
  display: flex;
  align-items: center;
  gap: 9px;
}

.playlist-presentation-schedule {
  justify-self: start;
  margin-top: 3px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  background: rgba(0, 0, 0, .32);
  backdrop-filter: blur(8px);
}

.playlist-presentation-schedule .icon,
.playlist-schedule-preview .icon {
  flex: 0 0 auto;
  width: 18px;
  color: var(--teal);
}

.playlist-presentation-schedule span,
.playlist-schedule-preview span {
  display: grid;
  gap: 1px;
}

.playlist-presentation-schedule small,
.playlist-schedule-preview small {
  color: var(--muted);
  font-size: .7rem;
}

.entity-link-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.entity-link-actions input {
  min-height: 40px;
  padding-block: 8px;
  font-size: 0.8rem;
  text-overflow: ellipsis;
}

.entity-link-actions .entity-actions {
  flex-wrap: nowrap;
}

.entity-link-actions .icon-btn {
  width: 40px;
  min-height: 40px;
  padding: 8px;
}

.entity-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.entity-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.2;
}

.entity-title + .entity-meta {
  margin-top: 4px;
}

.entity-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 6px;
  row-gap: 5px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.25;
}

.entity-meta:not(.room-sync-state) > span {
  display: inline-flex;
  align-items: center;
  min-height: var(--badge-min-height);
}

.empty {
  display: grid;
  place-items: center;
  min-height: 124px;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.file-picker {
  display: block;
}

.file-picker .btn {
  width: 100%;
  border-style: dashed;
}

label {
  display: grid;
  gap: 6px;
  color: var(--soft);
  font-size: 0.86rem;
  font-weight: 700;
}

.field-help {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.35;
}

input,
select,
textarea {
  min-width: 0;
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: var(--control-bg);
  color: var(--text);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(25, 194, 167, 0.7);
  box-shadow: 0 0 0 3px rgba(25, 194, 167, 0.16);
}

input[type="checkbox"] {
  width: auto;
  min-height: auto;
  accent-color: var(--teal);
}

.file-summary {
  display: grid;
  gap: 4px;
  min-height: 54px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.room-draft-playlist {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--selected-border);
  border-radius: 8px;
  background: var(--selected-bg);
}

.room-draft-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 3px;
}

.room-draft-heading strong { font-size: .82rem; }
.room-draft-heading span { color: var(--muted); font-size: .74rem; }
.room-draft-heading .btn { margin-left: auto; }
.room-draft-heading .btn span { color: inherit; font-size: inherit; }

.room-draft-item {
  display: grid;
  grid-template-columns: 20px 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 4px;
  border-top: 1px solid var(--subtle-border);
  cursor: grab;
}

.room-draft-item.dragging { opacity: .45; }
.room-draft-item > b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--control-bg); color: var(--text); font-size: .66rem; }
.room-draft-grip { display: grid; place-items: center; color: var(--muted); }
.room-draft-grip svg { width: 16px; height: 16px; }
.room-draft-name { display: grid; min-width: 0; gap: 2px; }
.room-draft-name strong { overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.room-draft-name small { overflow: hidden; color: var(--muted); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.room-draft-actions { display: flex; gap: 3px; }
.room-draft-actions .icon-btn { width: 30px; height: 30px; }

.room-create-modal-layer { align-items: center; }
.room-create-modal { width: min(680px, calc(100% - 24px)); max-height: calc(100dvh - 24px); border-bottom: 1px solid var(--line); border-radius: 8px; }
.room-create-modal .section-title { margin: 0; }
.room-create-modal .form-grid { gap: 14px; }
.room-create-modal-actions { justify-content: flex-end; }
.room-media-policy { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.room-media-policy legend { margin-bottom: 7px; color: var(--muted); font-size: .73rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.room-media-policy-option { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-strong); cursor: pointer; }
.room-media-policy-option:has(input:checked) { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.room-media-policy-option input { margin-top: 3px; accent-color: var(--accent); }
.room-media-policy-option span { display: grid; gap: 3px; }
.room-media-policy-option small { color: var(--muted); line-height: 1.35; }

@media (max-width: 720px) {
  .media-page-header { align-items: stretch; flex-direction: column; }
  .media-toolbar { justify-content: stretch; }
  .media-toolbar .btn { flex: 1 1 auto; }
  .media-toolbar .media-tool-btn { flex: 0 1 auto; }
  .share-intent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .share-intent-card { min-height: 74px; }
  .share-watch-picker-row > *,
  .share-watch-actions > * { flex: 1 1 auto; }
  .media-selection-tray .section-title { align-items: stretch; flex-direction: column; }
  .media-selection-tray .section-title .btn { width: 100%; }
}

@media (max-width: 420px) {
  .share-intent-grid { grid-template-columns: 1fr; gap: 7px; }
  .share-intent-card { min-height: 66px; }
}

.auth-gate {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 120px;
}

.auth-gate-icon,
.account-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: rgba(25, 194, 167, 0.12);
  color: var(--teal);
}

.auth-gate h2,
.auth-gate p,
.account-identity h2,
.account-identity p {
  margin: 0;
}

.auth-gate h2,
.account-identity h2 {
  font-size: 1rem;
}

.auth-gate p,
.account-identity p {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.42;
}

.account-login {
  width: min(620px, 100%);
}

.account-overview {
  align-items: stretch;
}

.account-turn-usage { display: grid; gap: 13px; }
.account-turn-usage-summary { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.account-turn-usage-summary > span { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--selected-border); border-radius: 10px; background: var(--selected-bg); color: var(--teal); }
.account-turn-usage-summary > span .icon { width: 21px; height: 21px; }
.account-turn-usage-summary > div { display: grid; min-width: 0; gap: 1px; }
.account-turn-usage-summary small { color: var(--muted); font-size: .65rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.account-turn-usage-summary strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.account-turn-usage-summary em { color: var(--muted); font-size: .7rem; font-style: normal; }
.account-turn-usage-summary > b { color: var(--soft); font-size: .86rem; font-variant-numeric: tabular-nums; }
.account-turn-usage-progress { height: 6px; }
.account-turn-usage-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.account-turn-usage-facts > span { display: grid; gap: 3px; padding: 9px 11px; background: var(--panel); }
.account-turn-usage-facts small { color: var(--muted); font-size: .62rem; }
.account-turn-usage-facts strong { font-size: .76rem; font-variant-numeric: tabular-nums; }

.account-identity {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  align-self: start;
}

.device-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.device-share-controls {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto;
  gap: 8px;
  width: min(420px, 100%);
}

.account-identity.compact {
  width: min(620px, 100%);
}

.account-identity .muted {
  display: block;
  margin-bottom: 3px;
  font-size: 0.76rem;
}

.settings-details {
  margin-top: 12px;
  padding: 0;
  overflow: hidden;
}

.settings-details > summary {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 11px 14px;
  color: var(--soft);
  cursor: pointer;
  list-style: none;
}

.settings-details > summary::-webkit-details-marker {
  display: none;
}

.settings-details > summary span {
  display: grid;
  gap: 2px;
}

.settings-details > summary small {
  color: var(--muted);
  font-weight: 500;
}

.settings-details > summary > .icon:last-child {
  transition: transform 160ms ease;
}

.settings-details[open] > summary > .icon:last-child {
  transform: rotate(90deg);
}

.settings-details-body {
  padding: 14px;
  border-top: 1px solid var(--line);
}

.account-view-tabs,
.settings-nav {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  border: 1px solid var(--subtle-border);
  border-radius: 8px;
  background: var(--panel);
}

.account-view-tabs::-webkit-scrollbar,
.settings-nav::-webkit-scrollbar {
  display: none;
}

.account-view-tabs {
  width: min(380px, 100%);
  padding: 5px;
}

.account-page-header .account-view-tabs {
  flex: 0 1 340px;
}

.account-view-tab,
.settings-nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
  white-space: nowrap;
}

.account-view-tab {
  flex: 1 1 0;
}

.legal-view { display: grid; gap: 10px; }

.legal-intro > p {
  max-width: 78ch;
  margin: 0;
  color: var(--soft);
  line-height: 1.5;
}

.legal-component-list { border-top: 1px solid var(--line); }

.legal-terms-details { padding: 0; }

.legal-terms-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

.legal-terms-details > summary::-webkit-details-marker { display: none; }
.legal-terms-details > summary > span:first-child { display: grid; gap: 2px; }
.legal-terms-details > summary small { color: var(--muted); }

.legal-terms-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.legal-terms-grid section { padding: 14px; border-bottom: 1px solid var(--line); }
.legal-terms-grid section:nth-child(odd) { border-right: 1px solid var(--line); }
.legal-terms-grid h3 { margin: 0 0 4px; font-size: 14px; }
.legal-terms-grid p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.legal-component {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(175px, auto) minmax(130px, auto);
  gap: 12px 20px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.legal-component:last-child { border-bottom: 0; }
.legal-component.not-included { opacity: .72; }

.legal-component-copy,
.legal-component-meta { display: flex; min-width: 0; }

.legal-component-copy { flex-direction: column; gap: 4px; }

.legal-component-copy small,
.legal-component-copy code,
.legal-component-source,
.legal-component-source a { color: var(--muted); }

.legal-component-copy small { line-height: 1.42; }

.legal-component-copy code {
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.legal-component-meta {
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}

.legal-component-source { text-align: right; font-size: 12px; }

.legal-component-source a,
.legal-license-links a { text-decoration: underline; text-underline-offset: 3px; }

.legal-callouts ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--soft);
  line-height: 1.45;
}

.legal-license-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

@media (max-width: 760px) {
  .legal-component { grid-template-columns: minmax(0, 1fr) auto; }
  .legal-component-source { grid-column: 1 / -1; text-align: left; }
  .legal-terms-grid { grid-template-columns: minmax(0, 1fr); }
  .legal-terms-grid section:nth-child(odd) { border-right: 0; }
}

@media (max-width: 420px) {
  .account-view-tab {
    min-width: 66px;
    gap: 4px;
    padding-inline: 6px;
    font-size: 12px;
  }

  .legal-component { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .legal-component-source { grid-column: auto; }
}

.settings-workspace {
  display: grid;
  gap: 10px;
  align-items: start;
}

.settings-nav {
  width: 100%;
  padding: 5px;
  scroll-snap-type: inline proximity;
}

.settings-nav-item {
  flex: 1 0 112px;
  scroll-snap-align: start;
}

.settings-nav-heading { display: none; }
.settings-pane :is(button, input, select, textarea, summary) { scroll-margin-top: var(--settings-nav-clearance, 0px); }

.settings-nav-item > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.settings-nav-item > span > strong { font: inherit; }
.settings-nav-item > span > small { display: none; color: var(--muted); font-size: .64rem; font-weight: 600; line-height: 1.25; }

.account-view-tab.active,
.settings-nav-item.active {
  border-color: var(--selected-border);
  background: var(--selected-bg);
  color: var(--selected-text);
}

.settings-pane,
.settings-panel {
  min-width: 0;
}

.settings-panel > .section-title:first-child {
  align-items: center;
  margin-bottom: 14px;
}

.about-panel {
  display: grid;
  gap: 14px;
}

.about-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 92px;
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: #0f1216;
  color: #aeb7bf;
}

.about-brand img {
  width: min(250px, 48%);
  height: auto;
}

.about-brand span {
  max-width: 390px;
  font-size: 0.84rem;
  line-height: 1.45;
  text-align: right;
}

@media (max-width: 560px) {
  .about-brand { align-items: flex-start; flex-direction: column; gap: 12px; }
  .about-brand img { width: min(230px, 78%); }
  .about-brand span { text-align: left; }
}

.controller-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.controller-shortcut {
  display: grid;
  grid-template-columns: minmax(78px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--subtle-border);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.controller-shortcut kbd {
  justify-self: start;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font: 750 0.78rem/1 system-ui, sans-serif;
  white-space: nowrap;
}

.controller-shortcut span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.controller-shortcut small {
  color: var(--muted);
  line-height: 1.35;
}

@media (max-width: 680px) {
  .controller-shortcuts {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* A phone cannot give seven settings categories useful hit targets at once.
   Keep one stable row and let the platform provide native, momentum-based
   touch dragging; television and handheld landscape rails retain their
   purpose-built D-pad layouts. */
@media (max-width: 560px) and (orientation: portrait) {
  body:not(.android-tv) .settings-nav {
    position: sticky;
    top: 0;
    z-index: 8;
    display: flex;
    grid-template-columns: none;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 5px;
    scroll-padding-inline: 5px;
    scroll-snap-type: x proximity;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }

  body:not(.android-tv) .settings-nav-item {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 7px;
    width: auto;
    min-width: 104px;
    min-height: 44px;
    padding: 7px 9px;
    scroll-snap-align: center;
    font-size: .7rem;
  }

  body:not(.android-tv) .settings-nav-item .icon {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
  }
}

/* Library card finish: artwork is supporting context, while titles, state and
   the open affordance retain a crisp and repeatable reading order. */
.entity-card-compact.library-art-row.artwork-ready .entity-head {
  align-content: start;
  align-items: start;
  grid-template-rows: auto auto;
}

.entity-card-compact.library-art-row.artwork-ready .entity-list-open {
  align-self: center;
}

.account-room-row.swipe-room-row {
  border-color: color-mix(in srgb, var(--subtle-border) 86%, var(--selected-border));
  border-radius: 12px;
  background: var(--panel-surface);
  box-shadow: 0 7px 24px rgb(0 0 0 / 10%);
}

.swipe-room-content.library-art-row {
  min-height: 108px;
  padding: 13px 12px;
  background-position: right center;
}

.swipe-room-content .account-room-main {
  display: grid;
  align-content: start;
  flex: 1 1 auto;
  gap: 6px;
}

.swipe-room-content .account-room-heading {
  align-items: flex-start;
  gap: 7px;
}

.swipe-room-content .account-room-heading strong {
  padding-top: 2px;
  font-size: .96rem;
  line-height: 1.22;
}

.swipe-room-content .account-room-media,
.swipe-room-content .account-room-meta {
  margin-top: 0;
}

.swipe-room-content .account-room-media {
  color: color-mix(in srgb, var(--soft) 92%, white);
}

.swipe-room-content .account-room-meta {
  gap: 5px 10px;
  padding-inline-start: 21px;
  font-size: .72rem;
}

.swipe-room-content .account-room-facts span {
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-surface) 64%, transparent);
  backdrop-filter: blur(5px);
}

.swipe-room-content .room-list-open {
  margin-inline-end: 2px;
  border-radius: 9px;
  box-shadow: 0 4px 14px rgb(0 0 0 / 18%);
}

@media (max-width: 600px) {
  .entity-card-compact.library-art-row.artwork-ready .entity-head {
    align-content: start;
    grid-template-rows: auto auto;
  }

  .entity-card-compact.library-art-row.artwork-ready .entity-title {
    align-self: start;
  }

  .swipe-room-content.library-art-row {
    min-height: 112px;
  }

  .swipe-room-content .account-room-heading strong {
    display: -webkit-box;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .swipe-room-content .account-room-media {
    display: grid;
    grid-template-columns: 15px minmax(0, 1fr);
    align-items: center;
  }

  .swipe-room-content .account-room-facts {
    grid-column: 2;
    justify-content: flex-start;
    margin: 1px 0 0;
  }

  .swipe-room-content .account-room-actions {
    width: auto;
  }
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
}

.theme-choice {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 64px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--subtle-bg);
  cursor: pointer;
}

.theme-choice:has(input:checked) {
  border-color: var(--selected-border);
  background: var(--selected-bg);
  box-shadow: inset 3px 0 var(--teal);
}

.theme-choice:has(input:focus-visible) {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.theme-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.theme-palette {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  width: 52px;
  height: 40px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 6px;
}

.theme-palette::after {
  position: absolute;
  inset: 0;
  background-image: var(--theme-preview-art, none);
  background-repeat: no-repeat;
  background-position: right center;
  background-size: cover;
  content: "";
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

.theme-palette i {
  display: block;
}

.theme-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.theme-copy strong {
  overflow: hidden;
  font-family: var(--theme-preview-font, inherit);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-form > .form-grid,
.settings-form > .settings-actions,
.settings-form > .check-row,
.wide-setting {
  grid-column: 1 / -1;
}

.settings-actions,
.settings-save-bar,
.settings-inline-status,
.hdr-device-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.viture-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -2px 0 14px;
}

.xr-device-overview {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin: -2px 0 14px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--teal) 8%, var(--subtle-bg)), var(--subtle-bg));
}

.xr-device-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--selected-border);
  border-radius: 8px;
  background: var(--selected-bg);
  color: var(--selected-text);
}

.xr-device-mark .icon {
  width: 23px;
  height: 23px;
}

.xr-device-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.xr-device-copy small {
  color: var(--teal);
  font-size: .67rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.xr-device-copy strong,
.xr-device-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xr-device-copy span {
  color: var(--muted);
  font-size: .75rem;
}

.xr-capabilities {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.xr-settings-form {
  gap: 9px;
}

.settings-page-groups,
.settings-page-form,
.settings-security-groups {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.settings-page-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-page-form > .settings-group,
.settings-page-form > .settings-save-bar {
  grid-column: 1 / -1;
}

.settings-page-form .check-row > span,
.settings-security-groups .check-row > span {
  display: grid;
  gap: 2px;
}

.settings-page-form .check-row small,
.settings-security-groups .check-row small {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.35;
}

.settings-sticky-actions {
  z-index: 5;
  justify-self: end;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  margin: 3px 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.settings-sticky-actions .settings-save-button {
  min-height: 44px;
  padding-inline: 16px;
  box-shadow: 0 10px 28px rgb(0 0 0 / 28%);
}

.settings-dirty .settings-sticky-actions .settings-save-button {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--orange) 52%, transparent), 0 10px 28px rgb(0 0 0 / 32%);
}

.settings-save-state {
  margin-right: auto;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
}

.settings-save-state.dirty {
  color: var(--orange);
}

.settings-discard-button { display: none; }
.settings-dirty .settings-discard-button { display: inline-flex; }
.settings-save-bar { flex-wrap: wrap; gap: 8px; }
.pwa-update-notice {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  right: 16px;
  margin-inline: auto;
  max-width: 520px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel, #191f27);
  color: var(--text, #eef1f6);
  box-shadow: 0 4px 20px rgb(0 0 0 / 25%);
  font-size: .85rem;
  z-index: 100;
  pointer-events: none;
}

.service-security-settings > .settings-security-groups {
  margin-top: 9px;
}

.media-settings .media-folder-settings {
  padding: 0;
}

.xr-settings-form .check-row > span {
  display: grid;
  gap: 2px;
}

.xr-settings-form .check-row small {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.35;
}

.xr-audio-route {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--subtle-bg);
}

.xr-audio-route > span:first-child {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.xr-audio-route > span:first-child > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.xr-audio-route strong,
.xr-audio-route small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xr-audio-route small {
  color: var(--muted);
  font-size: .72rem;
}

.xr-dependent-setting {
  transition: opacity 150ms ease;
}

.xr-dependent-setting[aria-disabled="true"] {
  opacity: .48;
}

.xr-settings-actions {
  z-index: 5;
  min-width: 0;
  box-shadow: 0 7px 24px rgb(0 0 0 / 12%);
}

.xr-save-state {
  margin-right: auto;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
}

.xr-save-state.dirty {
  color: var(--orange);
}

.viture-settings output {
  float: right;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.viture-settings input[type="range"] {
  width: 100%;
}

.external-display-section {
  display: grid;
  gap: 8px;
}

.external-display-section .section-title {
  margin: 0;
}

.external-display-route.active {
  border-color: var(--accent);
}

.external-display-route .route-buttons {
  flex-wrap: nowrap;
}

.fsr2-options,
.lighting-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 0 2px;
  border-top: 1px solid var(--line);
}

.settings-group {
  overflow: hidden;
  scroll-margin-top: calc(72px + env(safe-area-inset-top));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.settings-group > summary {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 11px;
  cursor: pointer;
  list-style: none;
}

.settings-group > summary::-webkit-details-marker {
  display: none;
}

.settings-group > summary span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.settings-group > summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-group > summary > .icon:last-child {
  transition: transform 160ms ease;
}

.settings-group[open] > summary > .icon:last-child {
  transform: rotate(90deg);
}

.settings-group-body {
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--panel-surface);
}

.settings-save-bar {
  position: static;
  justify-content: flex-end;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
}

.playback-apply-indicator {
  position: sticky;
  top: 8px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 42px;
  padding: 7px 9px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--topbar-bg);
  box-shadow: 0 5px 14px rgb(0 0 0 / 12%);
  backdrop-filter: blur(14px);
}

.playback-apply-indicator[data-phase="applied"] {
  border-color: var(--green);
}

.playback-apply-indicator[data-phase="failed"] {
  border-color: var(--danger);
}

.playback-apply-detail {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-inline-status,
.hdr-device-status {
  justify-content: space-between;
  min-height: 42px;
}

.service-security-settings .settings-inline-status .btn {
  min-height: 44px;
}

.processing-renderer-policy {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--teal) 34%, var(--line));
  border-radius: 9px;
  background: color-mix(in srgb, var(--teal) 5%, var(--panel-surface));
}

.processing-renderer-policy > .settings-inline-status {
  grid-column: 1 / -1;
  justify-content: flex-start;
  min-height: 0;
}

@media (max-width: 600px) {
  .processing-renderer-policy {
    grid-template-columns: minmax(0, 1fr);
  }
}

.progress {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--control-bg);
}

.progress > span {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--value, 0%);
  border-radius: inherit;
  background: var(--teal);
}

.transfer-status {
  display: grid;
  gap: 10px;
  padding: 10px 0 2px;
}

.btn.compact {
  justify-self: start;
  min-height: 36px;
  padding: 6px 10px;
}

.share-sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  align-items: end;
  justify-items: center;
  padding-top: max(8px, env(safe-area-inset-top));
}

.share-sheet-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgb(0 0 0 / 68%);
}

.share-sheet {
  position: relative;
  display: grid;
  gap: 12px;
  width: min(620px, 100%);
  max-width: 100%;
  max-height: min(720px, calc(100dvh - max(16px, env(safe-area-inset-top))));
  overflow-y: auto;
  padding: 15px 15px max(15px, env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--panel);
  box-shadow: 0 -16px 45px rgb(0 0 0 / 45%);
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.share-sheet-head {
  position: sticky;
  top: -15px;
  z-index: 4;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin: -15px -15px 0;
  padding: 12px 15px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-surface);
}

.share-sheet h2,
.share-sheet h3,
.share-sheet p {
  margin: 0;
}

.share-sheet h2 {
  font-size: 1.08rem;
}

.share-sheet h3 {
  font-size: 0.9rem;
}

.share-sheet-head p,
.share-friends .section-title p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.share-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.share-method,
.share-device {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-strong);
  text-align: left;
}

.share-method:hover,
.share-method:focus-visible,
.share-device:hover,
.share-device:focus-visible {
  border-color: var(--blue);
  background: var(--selected-bg);
}

.share-method > .icon {
  width: 22px;
  height: 22px;
  color: var(--blue);
  justify-self: center;
}

.share-method span,
.share-device span:not(.share-device-icon) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.share-method small,
.share-device small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cast-sync-control {
  display: grid;
  gap: 6px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.cast-sync-control > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.cast-sync-control output {
  color: var(--teal);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.cast-sync-control small {
  color: var(--muted);
  line-height: 1.35;
}

.lan-handoff-layer {
  z-index: 90;
}

.lan-handoff-prompt {
  width: min(440px, calc(100% - 24px));
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.lan-handoff-prompt .share-sheet-head > .icon {
  width: 26px;
  height: 26px;
  color: var(--teal);
}

.lan-handoff-media {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
}

.lan-handoff-media > .icon {
  width: 20px;
  height: 20px;
  padding: 9px;
  border-radius: 50%;
  color: var(--teal);
  background: rgb(29 196 176 / 12%);
  box-sizing: content-box;
}

.lan-handoff-media > span {
  display: grid;
  min-width: 0;
}

.lan-handoff-media small,
.lan-handoff-media em,
.lan-handoff-detail {
  color: var(--muted);
}

.lan-handoff-media small {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lan-handoff-media strong,
.lan-handoff-media em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lan-handoff-media em {
  font-size: 0.76rem;
  font-style: normal;
}

.lan-handoff-media > b {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  font-size: 0.68rem;
  white-space: nowrap;
}

.lan-handoff-detail {
  margin: 0;
  line-height: 1.45;
}

@media (max-width: 430px) {
  .lan-handoff-media { grid-template-columns: 38px minmax(0, 1fr); }
  .lan-handoff-media > b { grid-column: 2; justify-self: start; }
}

.cast-dual-output {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.cast-dual-output span,
.audio-route-summary > div:first-child {
  display: grid;
  gap: 3px;
}

.cast-dual-output small,
.audio-route-summary small {
  color: var(--muted);
}

.route-buttons {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.cast-session-actions,
.cast-ready {
  display: grid;
  gap: 10px;
}

.cast-ready {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.cast-system-route {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.cast-system-route > div {
  display: grid;
  gap: 3px;
}

.cast-system-route small {
  color: var(--muted);
}

.standard-lfe-route {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.standard-lfe-route.active {
  border-color: var(--teal);
}

.standard-lfe-route .bad-text {
  color: var(--bad);
}

.standard-lfe-route .cast-voice-note {
  color: var(--warning, #d6a84f);
}

.cast-surround-choice {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.direct-cast-picker {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.direct-cast-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.share-friends,
.share-device-list {
  display: grid;
  gap: 8px;
}

.share-device {
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  width: 100%;
  min-height: 56px;
}

.share-device.nearby-destination,
.share-device.cast-receiver {
  grid-template-columns: 34px minmax(0, 1fr) auto;
}

.cast-receiver.active {
  border-color: var(--teal);
  background: rgb(29 196 176 / 12%);
}

.cast-receiver .status-pill {
  justify-self: end;
}

.compact-empty {
  min-height: 54px;
  padding: 14px;
}

.cast-fallback-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.share-device-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: rgb(66 195 139 / 12%);
}

.share-device-icon .icon {
  width: 18px;
  height: 18px;
}

.share-device > .icon {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.destination-sheet {
  width: min(680px, 100%);
  gap: 14px;
}

.cast-sheet.destination-sheet {
  width: min(760px, 100%);
}

.destination-sheet .share-sheet-head .eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.destination-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel-strong) 82%, transparent);
}

.destination-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.destination-section-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.destination-section-head p {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.share-purpose-card,
.direct-connection-action,
.cast-intent {
  display: grid;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--panel-strong);
  text-align: left;
}

.share-purpose-card {
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  gap: 11px;
  min-height: 68px;
  padding: 10px 12px;
  border-color: color-mix(in srgb, var(--teal) 55%, var(--line));
  background: color-mix(in srgb, var(--teal) 9%, var(--panel-strong));
}

.share-purpose-card > .icon:first-child {
  width: 24px;
  height: 24px;
  color: var(--teal);
  justify-self: center;
}

.share-purpose-card > span,
.direct-connection-action > span:not(.status-pill),
.cast-intent > span,
.destination-empty > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.share-purpose-card small,
.direct-connection-action small,
.cast-intent small,
.destination-empty small {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.destination-empty {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.destination-empty > .icon {
  width: 20px;
  height: 20px;
  justify-self: center;
}

.direct-connection-action {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 58px;
  padding: 9px 10px;
}

.direct-connection-action > .icon {
  width: 20px;
  height: 20px;
  color: var(--teal);
  justify-self: center;
}

.direct-connection-action.preparing {
  border-style: dashed;
  opacity: 0.78;
}

.direct-connection-action.ready,
.share-purpose-card:hover,
.share-purpose-card:focus-visible,
.direct-connection-action:hover,
.direct-connection-action:focus-visible {
  border-color: var(--teal);
}

.cast-intent-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.cast-intent {
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  min-height: 66px;
  padding: 10px;
}

.cast-intent > .icon {
  width: 21px;
  height: 21px;
  color: var(--muted);
  justify-self: center;
}

.cast-intent.active {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 11%, var(--panel-strong));
}

.cast-intent.active > .icon {
  color: var(--teal);
}

.cast-content-select {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.55fr);
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.cast-content-select > span {
  display: grid;
  gap: 2px;
}

.cast-content-select small {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
}

.destination-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.destination-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
}

.destination-tabs button.active {
  color: var(--text);
  background: var(--selected-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--teal) 45%, var(--line));
}

.destination-tabs .icon {
  width: 17px;
  height: 17px;
}

.destination-advanced {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
  overflow: clip;
}

.destination-advanced > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 9px 12px;
  cursor: pointer;
  list-style: none;
}

.destination-advanced > summary::-webkit-details-marker { display: none; }

.destination-advanced > summary > span {
  display: flex;
  align-items: center;
  gap: 9px;
}

.destination-advanced > summary .icon {
  width: 18px;
  height: 18px;
  color: var(--teal);
  transition: transform 160ms ease;
}

.destination-advanced[open] > summary > .icon:last-child { transform: rotate(90deg); }

.destination-advanced-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.destination-advanced-body > :first-child { margin-top: 10px; }

.share-link-section {
  background: transparent;
}

.toast-region {
  position: fixed;
  right: 12px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  left: 12px;
  z-index: 140;
  display: grid;
  justify-items: end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  width: min(460px, 100%);
  padding: 11px 13px 11px 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
  animation: toast-enter 160ms ease-out;
}

.toast .icon {
  width: 19px;
  height: 19px;
  margin-top: 1px;
  color: var(--teal);
}

.toast:is(.bad, .error) {
  border-color: var(--danger);
  background: var(--panel-strong);
}

.toast:is(.bad, .error) .icon {
  color: var(--danger);
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}

.player-panel {
  overflow: hidden;
}

.active-room-dock {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 80;
  width: min(clamp(280px, 36vw, 390px), calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-surface);
  box-shadow: var(--shadow);
}

.active-room-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 46px;
  padding: 5px 6px 5px 9px;
  border-bottom: 1px solid var(--line);
  touch-action: none;
}

.active-room-dock.dragging {
  user-select: none;
  transition: none;
}

.dock-drag-handle {
  cursor: grab;
  touch-action: none;
}

.active-room-title {
  cursor: grab;
  touch-action: none;
}

.active-room-dock.dragging :is(.dock-drag-handle, .active-room-title) {
  cursor: grabbing;
}

.active-room-title {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 3px 4px 3px 1px;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.active-room-title-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.active-room-title strong,
.active-room-title small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-room-title small {
  color: var(--muted);
  font-size: .68rem;
}

.dock-restore-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 5px;
  color: var(--muted);
  background: var(--control-bg);
}

.dock-restore-icon .icon { width: 14px; height: 14px; }

.active-room-title:hover .dock-restore-icon,
.active-room-title:focus-visible .dock-restore-icon {
  color: var(--text);
  background: var(--selected-bg);
}

.active-room-title .status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent);
}

.active-room-dock #live-room {
  border: 0;
  border-radius: 0;
}

.active-room-dock #live-room > :not(.video-shell) {
  display: none;
}

.active-room-dock .video-shell {
  aspect-ratio: 16 / 9;
}

.active-room-dock .video-overlay {
  display: none;
}

.active-room-dock .stereo-controls {
  right: 6px;
  bottom: 6px;
  left: 6px;
  opacity: 1;
  visibility: visible;
  transform: none;
}

.active-room-dock .stereo-controls.on-demand {
  grid-template-columns: 36px minmax(60px, 1fr) 36px;
}

.active-room-dock .seek-action,
.active-room-dock .room-time,
.active-room-dock .room-ready-overlay :is(strong, small),
.active-room-dock .room-lifecycle-overlay[data-kind="ready"] :is(strong, small) {
  display: none;
}

.active-room-dock .room-ready-overlay .room-ready-icon,
.active-room-dock .room-lifecycle-overlay .room-ready-icon {
  width: 48px;
  height: 48px;
}

.active-room-dock [data-stats-context="dock"] {
  display: none;
}

/* Keep an active room reachable while leaving media browsing usable. The live
   media node stays mounted so WebRTC/audio state is not torn down; only its
   visual surface is reduced when the user is outside the room view. */
.active-room-dock.compact {
  width: min(390px, calc(100vw - 24px));
}

.active-room-dock.compact #active-room-slot {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.active-room-dock.compact #live-room {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.active-room-dock.compact .dock-drag-handle,
.active-room-dock.compact [data-stats-context="dock"] {
  display: none;
}

.active-room-dock.compact .active-room-dock-head {
  border-bottom: 0;
}

.room-background .content {
  padding-bottom: 270px;
}

@media (orientation: portrait) {
  .active-room-dock {
    width: min(300px, calc(100vw - 24px));
  }

  .room-background .content {
    padding-bottom: 230px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .active-room-dock {
    width: min(320px, calc(100vw - 100px));
  }

  .active-room-title small {
    display: none;
  }

  .active-room-dock-head .action-row {
    gap: 4px;
    flex-wrap: nowrap;
  }

  .active-room-dock-head .icon-btn {
    width: 34px;
    min-height: 34px;
    height: 34px;
    padding: 7px;
  }

  .active-room-dock.compact .active-room-title small {
    display: block;
  }
}

.app-shell.pip-active #live-room {
  position: fixed;
  inset: 0;
  z-index: 4000;
  width: 100vw;
  height: 100vh;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #000;
  overflow: visible;
  opacity: 1;
  pointer-events: auto;
}

.app-shell.pip-active #live-room > :not(.video-shell),
.app-shell.pip-active .video-overlay,
.app-shell.pip-active .stereo-controls,
.app-shell.pip-active .active-room-dock-head {
  display: none !important;
}

.app-shell.pip-active .video-shell,
.app-shell.pip-active .video-shell video,
.app-shell.pip-active .stereo-canvas,
.app-shell.pip-active .xr-canvas {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
}

.app-shell.pip-active .video-shell {
  position: fixed;
  inset: 0;
}

.app-shell.pip-active .video-shell video {
  object-fit: contain !important;
}

.video-window-actions {
  flex-wrap: nowrap;
}

.video-shell {
  --text: #f4f7fb;
  --soft: #d7dee8;
  --muted: #a8b2c0;
  --line: #46515e;
  --panel-strong: #202733;
  --subtle-bg: rgba(31, 39, 49, 0.9);
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  contain: layout paint;
  background: #050608;
  color: var(--text);
  aspect-ratio: 16 / 9;
  touch-action: none;
}

.video-unavailable-artwork {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: #000;
  background-image: var(--theme-player-unavailable-artwork, none);
  background-position: var(--theme-player-unavailable-position, center);
  background-size: var(--theme-player-unavailable-size, cover);
  background-repeat: no-repeat;
  opacity: var(--theme-player-unavailable-opacity, 0);
  pointer-events: none;
}

.video-shell.media-frame-ready .video-unavailable-artwork {
  background: #000;
  opacity: 0;
}

.video-shell.native-tv-preparing .video-unavailable-artwork {
  background: #000;
  opacity: 0;
}

.video-unavailable-artwork::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.video-shell video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: #000;
  object-fit: contain;
}

.video-shell:not(.media-frame-ready) video {
  visibility: hidden;
}

.video-shell video.upscale-native {
  image-rendering: auto;
  transform: none;
  will-change: auto;
}

.video-shell.shield-native-video[data-view-mode="native"] video,
.video-shell[data-upscaling="shield"][data-view-mode="native"] video {
  opacity: 1;
  image-rendering: auto;
  transform: none;
  will-change: auto;
}

.video-shell[data-upscaling="shield"][data-view-mode="native"] .stereo-canvas,
.video-shell[data-upscaling="shield"][data-view-mode="native"] .xr-canvas {
  display: none;
}

html.native-tv-surface-active,
body.native-primary-surface-active,
body.native-primary-surface-active #app,
body.native-primary-surface-active .app-shell,
body.native-primary-surface-active .app-shell .content,
body.native-primary-surface-active .app-shell #live-room,
body.native-primary-surface-active .app-shell .player-panel,
body.native-primary-surface-active .app-shell .video-shell {
  background: transparent !important;
  background-image: none !important;
}

/*
 * Media3's primary SurfaceView is composited below the transparent WebView.
 * Theme artwork is a viewport-sized body pseudo-element, so leaving it active
 * would tint the native video even though the video shell itself is clear.
 * The Android activity supplies a neutral dark backing color for the small
 * area outside the bounded surface (rounded corners, safe areas, and margins).
 */
html.native-tv-surface-active body.native-primary-surface-active::before,
html.native-tv-surface-active body.native-primary-surface-active::after {
  content: none !important;
  background: none !important;
  opacity: 0 !important;
}

/* Packaged themes can also mount real viewport layers (rather than body
 * pseudo-elements). Ambient artwork must not sit in the transparent WebView
 * above Media3, where it would become part of the apparent video picture. */
body.native-primary-surface-active [data-filepipe-theme-layer*="ambient"] {
  display: none !important;
}

/* The bounded SurfaceView intentionally follows the player panel rather than
 * the whole window. Paint its narrow gutter with the same neutral backing as
 * the Android host and suppress the light panel outline around moving video. */
body.native-primary-surface-active .player-panel {
  border-radius: 0 !important;
  border-color: #0b1115 !important;
  box-shadow: 0 0 0 8px #0b1115 !important;
}

body.native-primary-surface-active .video-unavailable-artwork,
body.native-primary-surface-active #room-video,
body.native-primary-surface-active .stereo-canvas,
body.native-primary-surface-active .xr-canvas {
  visibility: hidden !important;
  opacity: 0 !important;
}

body.android-tv :is(button, a, input, select, textarea, summary, [tabindex]):focus {
  outline: 4px solid var(--focus-ring);
  outline-offset: 3px;
}

body.android-tv .btn,
body.android-tv .icon-btn,
body.android-tv .nav-btn,
body.android-tv .segment,
body.android-tv .settings-nav-item {
  min-height: 44px;
}

body.android-tv .app-content {
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

body.android-tv .tv-page-content .settings-workspace {
  grid-template-columns: 260px minmax(0, 1fr);
  gap: clamp(24px, 2.5vw, 42px);
}

body.android-tv .tv-page-content .settings-nav {
  position: sticky;
  top: 94px;
  flex-direction: column;
  width: 260px;
  padding: 7px;
  overflow: visible;
}

body.android-tv .tv-page-content .settings-nav-item {
  flex: 0 0 auto;
  justify-content: flex-start;
  min-height: 54px;
  padding-inline: 15px;
  text-align: left;
}

body.android-tv .tv-page-content .settings-pane {
  min-width: 0;
}

body.android-tv .tv-page-content .settings-group {
  scroll-margin-top: 105px;
}

/* Android TV WebViews do not consistently paint the platform select popup.
   Keep selection visible and D-pad addressable inside the app instead. */
body.android-tv .tv-select-menu {
  position: fixed;
  z-index: 1200;
  inset: 10vh 12vw auto;
  max-height: 80vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-block: 12px;
  display: grid;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-surface);
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .62), 0 22px 70px rgba(0, 0, 0, .55);
}

body.android-tv .tv-select-menu-title {
  padding: 4px 8px 10px;
  color: var(--muted);
  font-size: .9rem;
}

body.android-tv .tv-select-menu-option {
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--control-bg);
  color: var(--text);
  text-align: left;
  font: inherit;
}

body.android-tv .tv-select-menu-option[aria-selected="true"] {
  border-color: var(--selected-border);
  background: var(--selected-bg);
  color: var(--selected-text);
}

body.android-tv .tv-select-menu-option:focus {
  position: relative;
  z-index: 1;
  border-color: var(--tv-focus, var(--focus-ring));
  background: var(--selected-bg);
  box-shadow: 0 0 0 3px var(--tv-focus-shadow, color-mix(in srgb, var(--focus-ring) 42%, transparent));
  color: var(--selected-text);
  transform: translateY(-1px);
}

.video-shell video::-webkit-media-controls-fullscreen-button {
  display: none !important;
}

body.video-fullscreen-open {
  overflow: hidden;
}

.app-shell.video-fullscreen {
  padding: 0;
  visibility: hidden;
}

.app-shell.video-fullscreen > .bottom-nav {
  display: none;
}

.app-shell.video-fullscreen .video-shell {
  --media-frame-half-height: min(28.125vw, 50dvh);
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  min-height: 0;
  aspect-ratio: auto;
  background: #000;
  visibility: visible;
}

.app-shell.video-fullscreen .video-shell video,
.app-shell.video-fullscreen .stereo-canvas,
.app-shell.video-fullscreen .xr-canvas {
  width: 100%;
  height: 100%;
}

.app-shell.video-fullscreen .video-overlay {
  right: max(12px, env(safe-area-inset-right));
  top: max(12px, env(safe-area-inset-top));
  bottom: auto;
  left: max(12px, env(safe-area-inset-left));
}

.app-shell.video-fullscreen > :is(.handheld-nav-trigger, .handheld-nav-scrim) {
  display: none !important;
}

/* A landscape movie in a portrait viewport occupies only the middle third of
   the screen. Keep its title and transport controls attached to that visible
   frame instead of marooning them at the bottom, while retaining a bounded
   fallback for portrait media. iOS does not always expose a non-zero safe-area
   inset while our custom fullscreen surface is active, hence the 54px floor. */
@media (orientation: portrait) and (max-width: 640px) {
  .web-client .app-shell.video-fullscreen .video-shell {
    --portrait-controls-top: min(
      calc(50dvh + var(--media-frame-half-height) + 46px),
      calc(100dvh - max(70px, calc(env(safe-area-inset-bottom) + 70px)))
    );
  }

  .web-client .app-shell.video-fullscreen .video-overlay {
    top: max(54px, calc(env(safe-area-inset-top) + 10px));
  }

  .web-client .app-shell.video-fullscreen .mobile-player-title {
    top: calc(var(--portrait-controls-top) - 34px);
    bottom: auto;
  }

  .web-client .app-shell.video-fullscreen .stereo-controls.on-demand {
    top: var(--portrait-controls-top);
    bottom: auto;
  }
}

.stereo-canvas,
.comparison-original-canvas,
.xr-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}

.video-shell video.source-hidden {
  opacity: 0;
  pointer-events: none;
}

.video-shell.processed-presentation-pending .stereo-canvas {
  opacity: 0;
  pointer-events: none;
}

.webxr-launch-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: clamp(20px, 5vw, 54px);
  color: #f4fbff;
  background: rgba(4, 9, 14, .9);
  text-align: center;
  backdrop-filter: blur(14px);
}

.webxr-launch-overlay::before {
  position: absolute;
  inset: 12%;
  border: 1px solid color-mix(in srgb, var(--accent) 46%, transparent);
  clip-path: polygon(0 10%, 7% 0, 93% 0, 100% 10%, 100% 90%, 93% 100%, 7% 100%, 0 90%);
  content: "";
  pointer-events: none;
}

.webxr-launch-overlay > * {
  position: relative;
}

.webxr-launch-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 62%, transparent);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  color: var(--accent);
}

.webxr-launch-mark .icon {
  width: 30px;
  height: 30px;
}

.webxr-launch-overlay strong {
  font-size: clamp(1.05rem, 3vw, 1.55rem);
}

.webxr-launch-overlay small,
.webxr-launch-overlay p {
  max-width: 580px;
  color: rgba(226, 239, 246, .76);
}

.webxr-launch-overlay p {
  margin: 4px 0 0;
  font-size: .78rem;
}

.webxr-launch-overlay .action-row {
  justify-content: center;
}

.video-shell.video-compare-active > .comparison-original-canvas {
  z-index: 1;
  display: block;
  visibility: visible;
  opacity: 1;
  pointer-events: none;
}

.video-shell.video-compare-active > .stereo-canvas {
  z-index: 2;
  display: block !important;
  visibility: visible;
  opacity: 1;
  pointer-events: none;
  clip-path: inset(0 calc(100% - var(--video-compare-position, 50%)) 0 0);
}

.video-shell.video-compare-active.processed-presentation-pending .stereo-canvas {
  opacity: 1;
  pointer-events: none;
}

.video-comparison-labels {
  position: absolute;
  inset: 12px 14px auto;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  color: rgba(255, 255, 255, .9);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .9);
  text-transform: uppercase;
}

.video-comparison-exit {
  position: absolute;
  top: 9px;
  right: 10px;
  z-index: 8;
  min-height: 34px;
  width: 34px;
  padding: 6px;
  border-color: rgba(255, 255, 255, .42);
  background: rgba(12, 16, 20, .86);
  pointer-events: auto;
}

.video-comparison-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--video-compare-position, 50%);
  z-index: 7;
  width: 2px;
  transform: translateX(-50%);
  cursor: ew-resize;
  touch-action: none;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45), 0 0 12px rgba(0, 0, 0, .65);
}

.video-comparison-divider span {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 30px;
  height: 46px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 7px;
  background: rgba(12, 16, 20, .9);
  color: #fff;
}

.video-comparison-divider .icon {
  width: 20px;
  height: 20px;
}

.video-shell.video-compare-active .video-comparison-divider:focus-visible {
  outline: 3px solid var(--focus-ring, #26d9c5);
  outline-offset: 4px;
}

.video-window-actions .video-action.active {
  border-color: var(--teal, #26d9c5);
  background: rgba(20, 105, 99, .9);
}

.cast-audio-only .video-shell video,
.cast-audio-only .stereo-canvas,
.cast-audio-only .xr-canvas {
  opacity: 0;
}

.cast-audio-only .video-shell::before {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  color: var(--soft);
  background: #090d11;
  content: "Synchronized audio receiver";
  font-size: 1rem;
  font-weight: 700;
}

.cast-audio-only .video-overlay,
.cast-audio-only .stereo-controls {
  z-index: 5;
}

.video-overlay {
  position: absolute;
  right: 10px;
  top: 10px;
  left: 10px;
  display: flex;
  z-index: 5;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}

.video-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.live-video-badge {
  flex: 0 0 auto;
}

.live-video-badge .status-pill {
  cursor: default;
  letter-spacing: 0;
}

.player-setting-badge {
  appearance: none;
  pointer-events: auto;
  cursor: pointer;
  font: inherit;
  transition: border-color 140ms ease, filter 140ms ease, transform 140ms ease;
}

.player-setting-badge:hover,
.player-setting-badge:focus-visible {
  filter: brightness(1.16);
  transform: translateY(-1px);
}

.player-setting-badge:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.audio-priority-badge {
  border-color: color-mix(in srgb, var(--warning, #d6a84f) 70%, transparent);
  color: var(--warning, #d6a84f);
  background: color-mix(in srgb, #101418 82%, var(--warning, #d6a84f));
}

.audio-priority-badge.risk {
  border-color: color-mix(in srgb, var(--warning, #d6a84f) 82%, transparent);
  color: var(--warning, #d6a84f);
}

.audio-priority-badge.fallback {
  border-color: color-mix(in srgb, var(--danger, #ff6961) 88%, transparent);
  color: var(--danger, #ff6961);
  background: color-mix(in srgb, #101418 78%, var(--danger, #ff6961));
}

.video-overlay .btn,
.video-overlay .icon-btn {
  min-height: 36px;
  padding: 7px 10px;
  pointer-events: auto;
}

.video-action {
  min-height: 38px;
  width: 38px;
  padding: 7px;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(12, 16, 20, 0.82);
  color: #f4f7fb;
}

.stereo-controls {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 4;
  display: grid;
  grid-template-columns: 38px minmax(80px, 1fr) auto 38px;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(12, 16, 20, 0.86);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}

.stereo-controls.live {
  grid-template-columns: 38px minmax(80px, 1fr) 38px;
}

.external-companion-control-surface {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  place-items: center;
  min-width: 0;
  padding: clamp(10px, 2.2vw, 24px);
  overflow: auto;
  color: var(--soft);
  background:
    radial-gradient(circle at 50% 44%, rgba(31, 50, 61, .36), transparent 54%),
    #080b10;
}

.external-companion-panel {
  display: grid;
  gap: 10px;
  width: min(900px, 100%);
  min-width: 0;
  padding: clamp(10px, 1.8vw, 16px);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 16px;
  background: rgba(13, 18, 23, .94);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .38);
  backdrop-filter: blur(18px);
}

.external-companion-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 1px 1px 3px;
}

.xr-device-disconnect-action,
.xr-device-reconnect-action {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--soft);
  background: rgba(20, 25, 31, .9);
  border-color: rgba(255, 255, 255, .2);
  pointer-events: auto;
}

.xr-device-reconnect-action {
  z-index: 7;
  top: max(72px, calc(env(safe-area-inset-top) + 64px));
}

.external-companion-corner-actions {
  position: static;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.external-companion-corner-actions .xr-device-disconnect-action,
.external-companion-controls-toggle,
.external-companion-stats {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding-inline: 11px;
  color: var(--soft);
  background: rgba(20, 25, 31, .9);
  border-color: rgba(255, 255, 255, .2);
  pointer-events: auto;
}

.xr-device-disconnect-action[hidden],
.xr-device-reconnect-action[hidden] {
  display: none;
}

@media (max-width: 560px) {
  .xr-device-disconnect-action span,
  .xr-device-reconnect-action span,
  .external-companion-controls-toggle span,
  .external-companion-stats span,
  .handoff-companion-actions .btn span {
    display: none;
  }

  .handoff-companion-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
  }

  .handoff-companion-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .handoff-companion-heading .xr-device-control-copy > span {
    white-space: normal;
  }

  .handoff-companion-actions {
    gap: 5px;
  }

  .handoff-companion-actions .btn {
    width: 40px;
    min-width: 40px;
    padding-inline: 8px;
  }

  .handoff-companion-utilities {
    grid-template-columns: 1fr;
    gap: 7px;
  }
}

.video-shell.external-companion-active .video-unavailable-artwork,
.video-shell.external-companion-active > video,
.video-shell.external-companion-active > .stereo-canvas,
.video-shell.external-companion-active > .xr-canvas {
  opacity: 0;
  pointer-events: none;
}

.video-shell.external-companion-active .video-overlay,
.video-shell.external-companion-active .stereo-controls {
  display: none;
}

.video-shell.external-companion-active .external-companion-control-surface:not([hidden]) {
  display: grid;
}

.xr-device-control-heading {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  text-align: left;
}

.xr-device-control-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.xr-device-control-description {
  overflow: hidden;
  color: var(--text);
  font-size: .86rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-companion-surface-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  min-height: 20px;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: .7rem;
  cursor: pointer;
}

.external-companion-surface-link:hover,
.external-companion-surface-link:focus-visible {
  color: var(--accent);
}

.external-companion-surface-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.external-companion-surface-link > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-companion-surface-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .05);
}

.external-companion-surface-link.good .external-companion-surface-dot { background: var(--green); }
.external-companion-surface-link.warn .external-companion-surface-dot { background: var(--amber); }

.external-companion-utilities {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(260px, .88fr);
  gap: 10px;
  min-width: 0;
}

.handoff-companion-header {
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.handoff-companion-heading .status-pill {
  flex: 0 0 auto;
  min-height: 28px;
  padding-inline: 10px;
}

.handoff-companion-heading .xr-device-control-copy > span {
  overflow: hidden;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.handoff-companion-actions .btn {
  min-height: 40px;
}

.video-shell.handoff-companion-active .xr-device-control-row {
  grid-template-columns: 42px 46px 42px minmax(120px, 1fr) auto;
  border-color: color-mix(in srgb, var(--accent) 30%, rgba(255, 255, 255, .14));
}

.handoff-companion-utilities {
  display: grid;
  grid-template-columns: minmax(180px, .72fr) minmax(260px, 1.28fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 11px;
  background: rgba(20, 25, 31, .66);
}

.handoff-companion-route {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.handoff-companion-route > .icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  color: var(--accent);
}

.handoff-companion-route > span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.handoff-companion-route small,
.handoff-companion-utilities p {
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.35;
}

.handoff-companion-route strong {
  overflow: hidden;
  color: var(--text);
  font-size: .86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.handoff-companion-utilities p {
  margin: 0;
}

.handoff-companion-header[hidden],
.external-companion-external-header[hidden],
.handoff-companion-utilities[hidden],
.external-companion-device-utilities[hidden],
.external-companion-local-audio-control[hidden] {
  display: none;
}

.xr-device-control-row {
  display: grid;
  grid-template-columns: 42px 46px 42px minmax(120px, 1fr) auto 42px;
  align-items: center;
  gap: clamp(6px, 1.2vw, 10px);
  width: 100%;
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 11px;
  background: rgba(20, 25, 31, .92);
}

.xr-device-control-row .icon-btn {
  min-width: 40px;
  min-height: 40px;
}

.xr-device-control-row .xr-play-button {
  min-width: 44px;
  min-height: 44px;
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 18%, rgba(20, 25, 31, .96));
  border-color: color-mix(in srgb, var(--accent) 58%, transparent);
}

.xr-device-control-row input[type="range"] {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.xr-device-settings-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  background: rgba(20, 25, 31, .72);
}

.xr-device-settings-label {
  margin: 0 3px 0 1px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.xr-device-settings-row .icon-btn {
  position: relative;
  min-width: 38px;
  min-height: 38px;
}

.xr-device-settings-row .icon-btn small {
  position: absolute;
  right: 4px;
  bottom: 2px;
  color: var(--teal);
  font-size: .68rem;
  line-height: 1;
}

.xr-lip-sync-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  width: 100%;
  min-width: 0;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  background: rgba(20, 25, 31, .72);
  color: var(--soft);
  font-size: .78rem;
  font-weight: 700;
}

.xr-lip-sync-control output {
  min-width: 52px;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.xr-lip-sync-control input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  margin: 0;
  accent-color: var(--teal);
}

.xr-lip-sync-control small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 500;
}

[data-lip-sync-calibration-status][data-source="profile"] {
  color: var(--green);
}

.lip-sync-calibration-status {
  align-items: center;
  gap: 10px;
}

.lip-sync-calibration-status > span {
  min-width: 0;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.35;
}

.lip-sync-calibration-status > .btn {
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .external-companion-header { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .external-companion-corner-actions { gap: 5px; }
  .external-companion-corner-actions .btn { min-width: 40px; padding-inline: 9px; }
  .external-companion-utilities { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .external-companion-control-surface { padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .external-companion-panel { gap: 8px; padding: 9px; border-radius: 13px; }
  .xr-device-control-type { display: none; }
  .xr-device-control-row { grid-template-columns: 42px 42px 42px minmax(80px, 1fr) 42px; }
  .xr-device-control-row .room-time { display: none; }
  .xr-device-settings-row { gap: 6px; }
  .xr-lip-sync-control small { display: none; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .external-companion-control-surface { place-items: center; padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left)); }
  .external-companion-panel { gap: 7px; max-width: 980px; padding: 8px 10px; }
  .external-companion-utilities { grid-template-columns: minmax(0, 1.3fr) minmax(230px, .7fr); gap: 7px; }
  .xr-device-control-row { padding: 6px 8px; }
  .xr-device-settings-row { padding: 6px 8px; }
  .xr-lip-sync-control { padding: 5px 9px; }
  .xr-lip-sync-control small { display: none; }
}

.video-shell.controls-visible .video-overlay,
.video-shell.controls-visible .stereo-controls {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

body.native-tv-surface-active .video-shell.controls-visible .video-overlay,
body.native-tv-surface-active .video-shell.controls-visible .stereo-controls {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

body.android-tv.native-tv-surface-active .stereo-controls {
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  left: max(24px, env(safe-area-inset-left));
  min-height: 66px;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(8, 12, 17, .94);
}

body.android-tv.native-tv-surface-active .stereo-controls.on-demand {
  grid-template-columns: 52px minmax(160px, 1fr) auto 52px;
}

body.android-tv.native-tv-surface-active .stereo-controls.live {
  grid-template-columns: 52px minmax(160px, 1fr) 52px;
}

body.android-tv.native-tv-surface-active .stereo-controls .video-action {
  width: 48px;
  min-height: 48px;
}

body.android-tv.native-tv-surface-active .stereo-controls input[type="range"] {
  min-height: 44px;
}

.stereo-controls .video-action {
  min-height: 36px;
}

.stereo-controls input[type="range"] {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.stereo-controls input[type="range"]::-webkit-slider-runnable-track,
.xr-device-control-row input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(to right, var(--teal) 0 var(--seek-progress, 0%), rgba(255, 255, 255, .22) var(--seek-progress, 0%) 100%);
}

.stereo-controls input[type="range"]::-webkit-slider-thumb,
.xr-device-control-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .45);
}

.stereo-controls input[type="range"]::-moz-range-track,
.xr-device-control-row input[type="range"]::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
}

.stereo-controls input[type="range"]::-moz-range-progress,
.xr-device-control-row input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--teal);
}

.stereo-controls input[type="range"]::-moz-range-thumb,
.xr-device-control-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .45);
}

.seek-action {
  position: relative;
}

.seek-action > svg {
  width: 22px;
  height: 22px;
}

.seek-action > span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: 1px;
  font-size: 0.5rem;
  font-weight: 850;
}

.room-ready-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 7px;
  border: 0;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  text-align: center;
  cursor: pointer;
}

.room-ready-overlay[hidden] { display: none; }
.room-ready-overlay .room-ready-icon { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: rgba(5, 8, 12, .82); border: 1px solid rgba(255,255,255,.42); }
.room-ready-overlay .room-ready-icon svg { width: 30px; height: 30px; margin-left: 3px; }
.room-ready-overlay strong { font-size: clamp(1.35rem, 3vw, 2.2rem); }
.room-ready-overlay small { color: rgba(255,255,255,.78); font-size: .78rem; }

.room-waiting-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  background: rgba(4, 7, 10, .56);
  color: #fff;
  text-align: center;
}

.room-waiting-overlay[hidden] { display: none; }
.video-shell video.interactive-pixel-stream {
  /* Pixel-art sources should not inherit the browser's soft video scaler. */
  object-fit: fill !important;
  image-rendering: crisp-edges !important;
  image-rendering: pixelated !important;
}
.room-waiting-overlay strong { font-size: clamp(1rem, 2.2vw, 1.4rem); }
.room-lifecycle-copy {
  display: grid;
  min-width: 0;
  max-width: 42ch;
  gap: 4px;
  justify-items: center;
  line-height: 1.35;
}
.room-lifecycle-copy strong,
.room-lifecycle-copy small { display: block; max-width: 100%; overflow-wrap: anywhere; }
.room-waiting-overlay small { color: rgba(255,255,255,.8); font-size: .78rem; }
.room-waiting-overlay .btn { margin-top: 6px; background: rgba(8, 12, 17, .88); color: #fff; border-color: rgba(255,255,255,.4); }
.room-lifecycle-overlay > #room-lifecycle-action {
  justify-self: center;
  margin-inline: auto;
  text-align: center;
}
.room-lifecycle-overlay .room-ready-icon { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: rgba(5, 8, 12, .82); border: 1px solid rgba(255,255,255,.42); }
.room-lifecycle-overlay .room-ready-icon svg { width: 30px; height: 30px; margin-left: 3px; }
.room-lifecycle-overlay :is(.room-ready-icon, .room-waiting-spinner, .btn)[hidden] { display: none; }
.room-lifecycle-overlay[data-kind="ready"] { background: rgba(0, 0, 0, .3); }
.room-lifecycle-overlay[data-kind="error"],
.room-lifecycle-overlay[data-kind="connection"],
.room-lifecycle-overlay[data-kind="terminal"],
.room-lifecycle-overlay[data-kind="offline"] { background: rgba(12, 7, 8, .68); }
.room-lifecycle-overlay[data-mode="compact"] {
  inset: auto 50% 76px auto;
  width: min(420px, calc(100% - 32px));
  min-height: 0;
  transform: translateX(50%);
  place-content: initial;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "indicator copy" "action action";
  align-items: center;
  column-gap: 12px;
  row-gap: 10px;
  justify-items: start;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 14px;
  background: rgba(4, 7, 10, .82);
  backdrop-filter: blur(12px);
  box-sizing: border-box;
  box-shadow: 0 10px 32px rgba(0,0,0,.34);
}
.room-lifecycle-overlay[data-mode="compact"] :is(.room-waiting-spinner, .room-ready-icon) { grid-area: indicator; }
.room-lifecycle-overlay[data-mode="compact"] .room-waiting-spinner { width: 28px; height: 28px; }
.room-lifecycle-overlay[data-mode="compact"] .room-lifecycle-copy { grid-area: copy; justify-items: start; text-align: left; }
.room-lifecycle-overlay[data-mode="compact"] > #room-lifecycle-action {
  grid-area: action;
  grid-column: 1 / -1;
}
.room-lifecycle-overlay[data-mode="compact"][data-indicator="none"] { grid-template-columns: minmax(0, 1fr); grid-template-areas: "copy" "action"; }
.room-lifecycle-overlay[data-mode="compact"][data-indicator="none"] .room-lifecycle-copy { justify-items: center; text-align: center; }
.room-lifecycle-overlay[data-mode="compact"] strong { font-size: .9rem; }
.room-lifecycle-overlay[data-mode="compact"] small { font-size: .72rem; }

@media (max-width: 560px) {
  .room-lifecycle-overlay[data-mode="compact"] {
    inset: auto 50% max(68px, calc(env(safe-area-inset-bottom) + 58px)) auto;
    width: calc(100% - 20px);
    padding: 10px 12px;
    border-radius: 12px;
  }
}

.room-waiting-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255,255,255,.24);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: room-waiting-spin .8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .room-waiting-spinner { animation-duration: 1.8s; }
}

.live-control-label {
  min-width: 0;
  overflow: hidden;
  color: #f4f7fb;
  font-size: 0.78rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segmented-control.room-source-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  max-width: none;
  margin-bottom: 10px;
}

.room-source-tabs .segment {
  min-height: 44px;
  color: var(--soft);
  font-size: 0.84rem;
}

.room-source-tabs .segment.active {
  color: var(--selected-text);
}

.live-room-create {
  max-width: 840px;
}

.live-source-summary,
.live-room-summary {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.live-source-summary > svg,
.live-room-summary > svg {
  width: 24px;
  height: 24px;
  justify-self: center;
  color: var(--teal);
}

.live-source-summary span,
.live-room-summary span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.live-source-summary small,
.live-room-summary small {
  color: var(--muted);
}

.live-preview-shell {
  position: relative;
  width: min(720px, 100%);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #090d11;
}

.live-preview-shell video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.live-preview-shell .status-pill {
  position: absolute;
  top: 8px;
  left: 8px;
}

.room-time {
  color: var(--soft);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.view-mode-bar {
  --text: #f4f7fb;
  --soft: #d7dee8;
  --muted: #a8b2c0;
  --line: #46515e;
  --panel-strong: #202733;
  --subtle-bg: #171d25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #11161c;
  color: var(--text);
  container-type: inline-size;
}

.room-view-picker {
  display: none;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  flex: 1 1 auto;
  gap: 7px;
  min-width: 0;
  color: var(--soft);
  font-size: 0.76rem;
  font-weight: 700;
}

.room-view-picker select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding-block: 6px;
  background: var(--native-control-bg);
  color: var(--native-control-text);
  color-scheme: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-view-picker option {
  background: var(--native-control-bg);
  color: var(--native-control-text);
}

/* Native WebView select arrows sit too close to the control edge on compact
   playback layouts. Draw the same affordance ourselves so its optical inset
   remains stable across Android versions and display densities. */
.native-client .room-active .room-view-picker {
  position: relative;
}

.native-client .room-active .room-view-picker select {
  appearance: none;
  padding-right: 34px;
}

.native-client .room-active .room-view-picker::after {
  position: absolute;
  top: 50%;
  right: 17px;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

@container (max-width: 430px) {
  .view-mode-bar .segmented-control {
    display: none;
  }

  .view-mode-bar .room-view-picker {
    display: grid;
  }
}

.cast-actions {
  flex-wrap: nowrap;
}

.cache-management {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.cache-management {
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.room-stream-settings {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.room-stream-settings summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  color: var(--soft);
  cursor: pointer;
  list-style: none;
}

.room-stream-settings summary::-webkit-details-marker {
  display: none;
}

.room-stream-settings summary small {
  margin-left: auto;
  color: var(--muted);
}

.room-runtime-strip {
  display: grid;
  align-content: center;
  gap: 3px;
  height: 48px;
  min-width: 0;
  overflow: hidden;
}

.room-runtime-detail {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-sync-state {
  min-height: 18px;
  flex-wrap: nowrap;
  overflow: hidden;
  white-space: nowrap;
}

.room-sync-state span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-sync-state span:first-child {
  flex: 0 0 58px;
  color: var(--soft);
  font-weight: 750;
}

.room-cache-summary {
  display: grid;
  width: 102px;
  min-width: 102px;
  gap: 2px;
  text-align: right;
}

.room-cache-summary > span {
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-cache-summary progress {
  width: 100%;
  height: 3px;
  overflow: hidden;
  border: 0;
  border-radius: 2px;
  background: var(--line);
  accent-color: var(--teal);
}

.stream-settings-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 2px 0 8px;
}

.stream-settings-body label {
  font-size: 0.76rem;
}

.stream-settings-body select {
  min-height: 38px;
  height: 38px;
  padding-block: 7px;
}

.stream-settings-body > .stream-settings-action {
  align-self: end;
  width: 100%;
  min-height: 38px;
  height: 38px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  flex: 1 1 auto;
  max-width: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 38px;
  padding: 6px 9px;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.segment:last-child {
  border-right: 0;
}

.segment.active {
  background: var(--selected-bg);
  color: var(--selected-text);
  box-shadow: inset 0 0 0 1px var(--selected-border);
}

.segment .icon {
  width: 16px;
  height: 16px;
}

.icon-btn.compact {
  width: 38px;
  min-height: 38px;
  padding: 7px;
}

.icon-btn.compact.active {
  border-color: rgba(240, 193, 75, 0.55);
  color: var(--amber);
}

.source-3d-label {
  color: var(--teal) !important;
  font-weight: 750;
}

.room-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.playlist-settings {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.playlist-settings summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--soft);
  cursor: pointer;
  font-weight: 750;
  list-style: none;
}

.playlist-settings summary::-webkit-details-marker {
  display: none;
}

.playlist-settings summary::after {
  content: "+";
  margin-left: auto;
  color: var(--muted);
  font-size: 1.25rem;
}

.playlist-settings[open] summary::after {
  content: "-";
}

.room-active .content > .entity-card {
  display: none;
}

.playlist-settings-body {
  display: grid;
  gap: 10px;
  padding: 2px 0 4px;
}

.room-preview {
  display: grid;
  gap: 9px;
}

.room-preview > .section-title {
  margin: 0;
}

.room-preview-playlist {
  border-top: 1px solid var(--line);
}

.room-preview-playlist summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--soft);
  cursor: pointer;
  font-weight: 750;
  list-style: none;
}

.room-preview-playlist summary::-webkit-details-marker {
  display: none;
}

.room-preview-playlist summary small {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
}

.room-preview-items {
  display: grid;
  gap: 5px;
  max-height: min(38vh, 360px);
  overflow: auto;
  overscroll-behavior: contain;
}

.private-room-playlist {
  display: grid;
  gap: 6px;
  max-height: min(42vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.private-room-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--control-bg);
}

.private-room-item.active {
  border-color: color-mix(in srgb, var(--teal) 55%, var(--line));
}

.private-room-item.watched {
  background: color-mix(in srgb, var(--green) 7%, var(--control-bg));
}

.private-room-item.watched .private-room-item-main strong {
  color: var(--muted);
}

.private-room-item-main {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.private-room-item-main > .icon {
  display: none;
}

.private-room-item-art {
  display: grid;
  place-items: center;
  width: 72px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 5px;
  background: var(--panel-strong) center / cover no-repeat;
  color: var(--teal);
}

.private-room-item-main span,
.private-room-item-main strong,
.private-room-item-main small {
  display: block;
  min-width: 0;
}

.private-room-item-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.private-room-item-main small {
  margin-top: 2px;
  color: var(--muted);
}

.playlist-item-compact-actions {
  flex-wrap: nowrap;
  gap: 4px;
}

.playlist-watch-marker {
  display: inline-grid;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-strong) 88%, transparent);
  color: var(--muted);
  place-items: center;
}

.playlist-watch-marker .icon {
  width: 15px;
  height: 15px;
}

.playlist-watch-marker.active {
  border-color: color-mix(in srgb, var(--green) 72%, var(--line));
  background: color-mix(in srgb, var(--green) 22%, var(--panel-strong));
  color: var(--green);
}

.playlist-watch-marker:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .private-room-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .private-room-item > .action-row {
    justify-content: flex-end;
  }
}

.account-room-row.swipe-room-row,
.recent-playback-row.swipe-room-row {
  position: relative;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--subtle-border) 88%, var(--selected-border));
  border-radius: 12px;
  background: var(--panel-surface);
  box-shadow: 0 7px 24px rgb(0 0 0 / 10%);
  touch-action: pan-y;
}

.swipe-room-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 100%;
  padding: 10px 10px 10px 12px;
  border-radius: inherit;
  background: var(--panel-surface);
  transition: transform 180ms ease;
  will-change: transform;
  -webkit-touch-callout: none;
}

.swipe-room-row.swiped .swipe-room-content { transform: translateX(-108px); }

.swipe-room-delete {
  position: absolute;
  z-index: 0;
  inset: 0 0 0 auto;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  width: 108px;
  border: 0;
  background: var(--danger);
  color: var(--danger-ink, #fff);
  font-size: .68rem;
  font-weight: 850;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 140ms ease, visibility 0s linear 180ms;
}

.swipe-room-row.swiped .swipe-room-delete {
  z-index: 2;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.swipe-room-delete svg { width: 22px; height: 22px; }
.room-title-origin { display: grid; place-items: center; flex: 0 0 26px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: var(--selected-bg); color: var(--selected-text); }
.room-title-origin svg { width: 14px; height: 14px; }
.room-list-open,
.entity-list-open {
  flex: 0 0 42px;
  width: 42px;
  min-height: 42px;
  margin-inline-end: 8px;
  border-radius: var(--list-disclosure-radius);
  border-color: var(--list-disclosure-border);
  background: var(--list-disclosure-background);
  color: var(--list-disclosure-color);
}
.room-list-open .icon,
.entity-list-open .icon {
  width: var(--list-disclosure-icon-size);
  height: var(--list-disclosure-icon-size);
  stroke-width: var(--list-disclosure-icon-stroke);
}
.room-list-open:hover,
.room-list-open:focus-visible,
.entity-list-open:hover,
.entity-list-open:focus-visible {
  border-color: var(--list-disclosure-hover-border);
  background: var(--list-disclosure-hover-background);
  transform: translateX(1px);
}

.home-library-tabs { position: sticky; top: 0; z-index: 8; margin-bottom: 1rem; padding: .35rem; border-radius: 16px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); }
.home-library-tabs .tab-btn { flex: 1 1 12rem; }
.home-library-list { margin-top: .75rem; }
.library-art-row {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background-color: var(--panel-surface);
  background-clip: padding-box;
}
.library-art-row::after {
  content: '';
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background-image: var(--library-artwork, none);
  background-position: right 42%;
  background-size: cover;
}
.library-art-row::before {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  /* Do not compose this gradient from an alpha-bearing custom color with
     color-mix(). Some Android WebViews accept the syntax but invalidate the
     whole declaration at computed-value time, leaving text directly on the
     image. These neutral values are deliberately surface-like and portable. */
  background:
    linear-gradient(90deg, rgba(12, 16, 20, .96) 0%, rgba(12, 16, 20, .91) 36%, rgba(12, 16, 20, .76) 68%, rgba(12, 16, 20, .52) 100%),
    linear-gradient(0deg, rgba(8, 11, 14, .38), rgba(8, 11, 14, 0) 62%);
  box-shadow: inset 0 0 0 1px rgba(12, 16, 20, .82);
}
.library-art-row > * { position: relative; z-index: 2; }
.library-art-row.artwork-ready { min-height: 82px; }
.library-art-row.artwork-ready :is(.entity-meta, .account-room-media, .muted) { text-shadow: 0 1px 2px color-mix(in srgb, var(--panel-surface) 90%, transparent); }
.library-art-row .account-room-actions,
.library-art-row .entity-actions { padding: 4px; border-radius: 12px; background: color-mix(in srgb, var(--panel-surface) 72%, transparent); backdrop-filter: blur(7px); }
.library-pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap; gap: 12px; margin: 16px 0 4px; padding: 8px 9px 8px 13px; border: 1px solid var(--subtle-border); border-radius: 14px; background: color-mix(in srgb, var(--panel-surface) 94%, var(--selected-bg)); }
.library-pagination-summary { min-width: 0; overflow: hidden; color: var(--muted); font-size: .68rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.library-pagination-summary strong { color: var(--text); font-size: .76rem; }
.library-pagination-controls { display: grid; grid-template-columns: 34px minmax(82px, auto) 34px; align-items: center; flex: 0 0 auto; gap: 0; overflow: hidden; padding: 2px; border: 1px solid var(--subtle-border); border-radius: 11px; background: var(--control-bg); }
.library-page-step { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: .72rem; font-weight: 800; cursor: pointer; }
.library-page-step svg { width: 16px; height: 16px; }
.library-page-step:hover:not(:disabled),
.library-page-step:focus-visible { border-color: var(--selected-border); color: var(--text); background: var(--selected-bg); }
.library-page-step:disabled { opacity: .34; cursor: default; }
.library-pagination-position { display: flex; align-items: baseline; justify-content: center; gap: 4px; min-width: 0; height: 28px; padding: 5px 8px; border-inline: 1px solid var(--subtle-border); color: var(--muted); font-size: .64rem; white-space: nowrap; }
.library-pagination-position strong { color: var(--text); font-size: .7rem; }
.recent-playback-list { gap: 8px; }
.recent-playback-row { overflow: hidden; border: 1px solid var(--subtle-border); border-radius: 13px; background: color-mix(in srgb, var(--panel-surface) 94%, var(--selected-bg)); transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.recent-playback-row:hover, .recent-playback-row:focus-within { border-color: var(--selected-border); background: color-mix(in srgb, var(--panel-surface) 88%, var(--selected-bg)); transform: translateY(-1px); }
.recent-playback-row.expired { opacity: .68; }
.recent-playback-swipe-content { display: block; padding: 0; background: transparent; }
.recent-playback-main { display: grid; grid-template-columns: clamp(92px, 18vw, 146px) minmax(0, 1fr) 52px; align-items: center; gap: 14px; width: 100%; min-width: 0; padding: 8px 10px 8px 8px; border: 0; color: var(--text); background: transparent; text-align: left; }
.recent-playback-art { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 9px; background: linear-gradient(135deg, color-mix(in srgb, var(--selected-bg) 72%, #111), #111); background-position: center; background-size: cover; color: #fff; }
.recent-playback-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(0,0,0,.64), rgba(0,0,0,.06)); }
.recent-playback-art i { position: relative; z-index: 1; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid rgba(255,255,255,.38); border-radius: 50%; background: rgba(0,0,0,.46); backdrop-filter: blur(5px); }
.recent-playback-art i svg { width: 14px; height: 14px; }
.recent-playback-copy { display: grid; min-width: 0; gap: 4px; }
.recent-playback-copy > strong { overflow: hidden; color: var(--text); font-size: .94rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.recent-playback-copy > small { overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.recent-playback-kicker { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: .61rem; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.recent-playback-kicker b { overflow: hidden; color: var(--selected-text); text-overflow: ellipsis; white-space: nowrap; }
.recent-playback-kicker time { flex: 0 0 auto; }
.recent-playback-action { display: grid; place-items: center; gap: 2px; color: var(--muted); font-size: .62rem; font-weight: 700; }
.recent-playback-action svg { width: 19px; height: 19px; }
.recent-playback-main:focus-visible { outline: 2px solid var(--selected-border); outline-offset: -2px; border-radius: 12px; }
.room-revival-sheet { width: min(620px, calc(100% - 24px)); }
.room-revival-summary,
.room-revival-access { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: start; gap: 12px; margin: 0 16px 12px; padding: 14px; border: 1px solid var(--subtle-border); border-radius: 14px; background: var(--subtle-bg); }
.room-revival-summary > span,
.room-revival-access > svg { display: grid; place-items: center; width: 42px; height: 42px; padding: 10px; border-radius: 12px; color: var(--selected-text); background: var(--selected-bg); }
.room-revival-summary > div,
.room-revival-access > span { display: grid; gap: 4px; min-width: 0; }
.room-revival-summary p,
.room-revival-access small { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.room-revival-access.shared { border-color: color-mix(in srgb, var(--selected-border) 72%, var(--subtle-border)); }
.room-revival-access.shared > svg { color: var(--warning-text, var(--selected-text)); background: color-mix(in srgb, var(--warning, var(--selected-bg)) 24%, var(--panel-surface)); }
.room-revival-error { margin: 0 16px 12px; padding: 10px 12px; border: 1px solid var(--danger); border-radius: 10px; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); font-size: .76rem; }
.room-revival-sheet .settings-actions { padding: 4px 16px 16px; }
.room-retention-choice span { display: grid; gap: .15rem; }
.room-retention-choice small { color: var(--muted); font-weight: 400; }
.room-library-methods { margin-bottom: 1rem; }
.account-room-heading .status-pill svg { width: 12px; height: 12px; }
.room-rename-layer { align-items: center; }
.room-rename-sheet { width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 24px); }
.room-rename-form { display: grid; gap: 16px; padding: 18px; }
.room-rename-form > label { display: grid; width: 100%; min-width: 0; gap: 7px; color: var(--muted); font-size: .72rem; font-weight: 750; }
.room-rename-form input { width: 100%; color: var(--text); background: var(--control-bg); }
.room-presented-title { display: grid; width: 100%; min-width: 0; gap: 4px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--subtle-bg); }
.room-presented-title span { color: var(--muted); font-size: .64rem; font-weight: 800; text-transform: uppercase; }
.room-presented-title strong { overflow-wrap: anywhere; }

@media (max-width: 560px) {
  .swipe-room-content { gap: 8px; }
  .swipe-room-content .account-room-main { flex: 1 1 auto; }
  .swipe-room-content .account-room-actions { flex: 0 0 auto; width: auto; }
  .recent-playback-main { grid-template-columns: 88px minmax(0, 1fr) 28px; gap: 10px; padding: 7px; }
  .recent-playback-action small { display: none; }
  .recent-playback-copy > strong { font-size: .84rem; }
  .recent-playback-kicker { font-size: .56rem; }
  .library-art-row { background-position: 64% center; }
  .library-art-row::before {
    background:
      linear-gradient(90deg, rgba(12, 16, 20, .97) 0%, rgba(12, 16, 20, .92) 50%, rgba(12, 16, 20, .68) 100%),
      linear-gradient(0deg, rgba(8, 11, 14, .42), rgba(8, 11, 14, 0) 64%);
  }
  .library-pagination { gap: 8px; padding: 7px 8px 7px 11px; }
  .library-pagination-controls { grid-template-columns: 34px minmax(72px, auto) 34px; }
  .library-pagination-position { padding-inline: 6px; }
}

/* Ten-foot Android TV home. The rest of the app keeps the compact handheld layout. */
body.android-tv.tv-home-active {
  overflow-x: hidden;
}

body.android-tv.tv-mode .topbar,
body.android-tv.tv-mode .bottom-nav {
  display: none;
}

body.android-tv.tv-mode .content {
  width: 100%;
  max-width: none;
  padding: 0 0 48px;
}

.tv-page {
  min-height: 100dvh;
  background-color: var(--tv-background, var(--bg));
  background-image: var(--theme-pattern);
  background-size: var(--theme-pattern-size);
  color: var(--text);
}

.tv-page-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 78px;
  padding: 12px clamp(32px, 4vw, 72px);
  border-bottom: 1px solid var(--tv-border, var(--subtle-border));
  background: color-mix(in srgb, var(--tv-surface, var(--topbar-bg)) 92%, transparent);
  backdrop-filter: blur(18px);
}

.tv-page-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 10px 6px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
}

.tv-page-brand img { width: 34px; height: 34px; }
.tv-page-location { padding-left: 22px; border-left: 1px solid var(--tv-border, var(--line)); color: var(--muted); font-size: .82rem; font-weight: 750; }
.tv-page-actions { display: flex; gap: 10px; }
.tv-page-actions > .icon-btn { width: 50px; height: 50px; }
.tv-source-back { min-height: 50px; padding-inline: 14px 17px; }
.tv-source-back svg { width: 19px; height: 19px; }
.tv-page-inbox { position: relative; }
.tv-page-service { display: flex; align-items: center; gap: 8px; min-height: 42px; margin-right: 4px; color: var(--muted); font-size: .7rem; font-weight: 750; }
.tv-page-service .service-dot { width: 8px; height: 8px; background: var(--danger); }
.tv-page-service .service-dot.good { background: var(--green); }

.tv-page-content {
  width: min(2240px, calc(100% - clamp(72px, 7.5vw, 220px)));
  margin-inline: auto;
  padding: 34px 0 64px;
}

.tv-page-content > .page-header { margin-bottom: 22px; }
.tv-page-content > .page-header h1 { font-size: 2rem; }
.tv-page-content > .page-header p { max-width: 72ch; font-size: .9rem; }
.tv-page-content > .panel,
.tv-page-content > .grid,
.tv-page-content > form { max-width: min(1800px, 100%); }
.tv-page-content .panel { box-shadow: none; }
.tv-page-content :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea, .btn, .segment) { min-height: 48px; }
.tv-page-content .settings-layout { align-items: start; }
.tv-page-content .settings-nav { position: sticky; top: 96px; }

.tv-sign-in {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, .8fr);
  min-height: min(620px, calc(100dvh - 190px));
  overflow: hidden;
  border: 1px solid var(--tv-border, var(--line));
  border-radius: var(--tv-radius, 8px);
  background: var(--tv-surface, var(--panel-surface));
}

.tv-sign-in-intro,
.tv-sign-in-form { display: grid; align-content: center; gap: 20px; padding: clamp(40px, 5vw, 76px); }
.tv-sign-in-intro { background: color-mix(in srgb, var(--selected-bg) 62%, var(--panel-surface)); }
.tv-sign-in-intro h2 { max-width: 15ch; margin: 0; font-size: clamp(2rem, 3.2vw, 3.4rem); line-height: 1.04; }
.tv-sign-in-intro > p { max-width: 48ch; margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.55; }
.tv-sign-in-mark { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 8px; background: var(--teal); color: var(--button-text); }
.tv-sign-in-mark svg { width: 30px; height: 30px; }
.tv-sign-in-device { display: flex; align-items: center; gap: 13px; margin-top: 12px; padding-top: 20px; border-top: 1px solid var(--subtle-border); }
.tv-sign-in-device > span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 7px; background: var(--control-bg); color: var(--teal); }
.tv-sign-in-device div { display: grid; gap: 2px; }
.tv-sign-in-device small { color: var(--muted); }
.tv-sign-in-form { align-content: center; }
.tv-sign-in-form > div:first-child { display: grid; gap: 5px; }
.tv-sign-in-form h2 { margin: 0; font-size: 2rem; }
.tv-sign-in-form p { margin: 0; color: var(--muted); }
.tv-sign-in-form label:not(.check-row) { display: grid; gap: 7px; color: var(--soft); font-size: .78rem; font-weight: 750; }
.tv-sign-in-form input:not([type="checkbox"]) { min-height: 58px; font-size: 1rem; }
.tv-sign-in-form .action-row { margin-top: 4px; }
.tv-sign-in-form .btn { min-width: 150px; }

.tv-home {
  display: grid;
  gap: 28px;
  min-height: 100dvh;
  padding: 24px 0 52px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--tv-surface-strong, var(--panel)) 66%, transparent), transparent 390px),
    var(--tv-background, var(--bg));
}

.tv-home [data-tv-home-shelf] {
  scroll-margin-block: 112px 72px;
}

.tv-home .tv-rail,
.tv-home .tv-recommendation-grid {
  overscroll-behavior-block: none;
}

.tv-playlist-card .tv-recommendation-copy > small:first-child {
  color: var(--teal);
  font-weight: 800;
  letter-spacing: .025em;
  text-transform: uppercase;
}

.tv-home-header,
.tv-rail-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-inline: clamp(32px, 4vw, 72px);
}

.tv-home-header {
  position: relative;
  z-index: 4;
  min-height: 54px;
}

.tv-home-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tv-home-identity {
  display: flex;
  align-items: end;
  gap: 12px;
  min-width: 0;
}

.tv-account-sync {
  position: relative;
  width: 40px;
  min-height: 40px;
  padding: 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--control-bg) 88%, transparent);
  backdrop-filter: blur(12px);
}

.tv-account-sync:hover:not(:disabled),
.tv-account-sync:focus-visible {
  color: var(--text);
}

.tv-account-sync.busy .icon {
  animation: processing-spin .9s linear infinite;
}

.tv-account-sync-count {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding-inline: 5px;
  border: 2px solid var(--bg);
  border-radius: 10px;
  background: var(--amber);
  color: var(--amber-ink, #15120a);
  font-size: .65rem;
  font-weight: 850;
  line-height: 1;
}

.tv-source-shortcut {
  min-height: 52px;
  background: color-mix(in srgb, var(--control-bg) 88%, transparent);
  backdrop-filter: blur(12px);
}

.tv-home-header strong {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
}

.tv-eyebrow {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tv-menu-button {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
}

.tv-hero {
  --tv-hero-overlap: 100px;
  --tv-hero-blend: var(--panel-strong);
  --tv-hero-glow: transparent;
  position: relative;
  display: grid;
  align-items: end;
  min-height: clamp(390px, 42vw, 570px);
  margin-top: calc(-1 * var(--tv-hero-overlap));
  overflow: hidden;
  background:
    radial-gradient(ellipse 75% 100% at 82% 8%, var(--tv-hero-glow), transparent 72%),
    linear-gradient(110deg, var(--tv-hero-shade, var(--bg)) 0 28%, var(--tv-hero-blend) 62%, var(--tv-surface-strong, var(--panel-strong)) 100%);
}

.tv-hero-image {
  position: absolute;
  inset: 0 0 0 21%;
  width: 79%;
  height: 100%;
  object-fit: cover;
  object-position: center 24%;
  opacity: 0;
  transform: scale(1.012);
  -webkit-mask-image: radial-gradient(ellipse 104% 132% at 100% 0%, #000 0 43%, rgba(0, 0, 0, 0.96) 55%, rgba(0, 0, 0, 0.68) 68%, rgba(0, 0, 0, 0.24) 83%, transparent 100%);
  mask-image: radial-gradient(ellipse 104% 132% at 100% 0%, #000 0 43%, rgba(0, 0, 0, 0.96) 55%, rgba(0, 0, 0, 0.68) 68%, rgba(0, 0, 0, 0.24) 83%, transparent 100%);
}

.tv-hero.artwork-ready .tv-hero-image {
  opacity: 1;
}

.tv-hero > .tv-art-placeholder {
  inset: 0 0 0 36%;
  opacity: .72;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 42%);
  mask-image: linear-gradient(90deg, transparent, #000 42%);
}

/* The hero already supplies a title. Keep fallback art decorative. */
.tv-hero > .tv-art-placeholder > :is(b, small, .tv-art-placeholder-mark) { visibility: hidden; }

.tv-hero::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg, var(--tv-hero-shade, var(--bg)) 0%, color-mix(in srgb, var(--tv-hero-shade, var(--bg)) 94%, var(--tv-hero-blend)) 27%, color-mix(in srgb, var(--tv-hero-shade, var(--bg)) 42%, transparent) 50%, transparent 74%),
    linear-gradient(0deg, var(--tv-hero-shade, var(--bg)) 0%, color-mix(in srgb, var(--tv-hero-shade, var(--bg)) 72%, transparent) 16%, transparent 53%),
    linear-gradient(180deg, color-mix(in srgb, var(--tv-hero-shade, var(--bg)) 44%, transparent) 0%, transparent 22%);
  content: "";
}

.tv-hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  align-self: center;
  width: var(--tv-hero-copy-width, min(680px, 43vw));
  padding: calc(var(--tv-hero-overlap) + 24px) clamp(32px, 4vw, 72px) 70px;
}

.tv-hero-copy p { margin: 0; }
.tv-hero-copy p { display: -webkit-box; max-width: 62ch; overflow: hidden; color: var(--muted); line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.tv-hero-title {
  position: absolute;
  right: clamp(32px, 4vw, 72px);
  bottom: clamp(194px, 16vw, 232px);
  z-index: 2;
  max-width: min(48vw, 760px);
  margin: 0;
  color: #fff;
  font-size: clamp(2.5rem, 4.6vw, 5.2rem);
  line-height: 0.98;
  text-align: right;
  -webkit-text-stroke: 2px rgba(0, 0, 0, 0.92);
  paint-order: stroke fill;
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.92), 0 10px 34px rgba(0, 0, 0, 0.78);
}
.tv-hero-facts,
.tv-playlist-facts { display: flex; flex-wrap: wrap; gap: 7px 14px; color: var(--muted); font-size: 0.78rem; }
.tv-hero-facts span + span::before,
.tv-playlist-facts em + em::before { margin-right: 14px; color: var(--teal); content: "\2022"; }
.tv-hero-cast { display: flex; gap: 9px; font-size: 0.78rem; }
.tv-hero-cast span { color: var(--muted); }
.tv-hero-actions { display: flex; gap: 10px; margin-top: 4px; }
.tv-hero-progress { position: relative; width: min(430px, 100%); height: 3px; overflow: hidden; background: var(--line); }
.tv-hero-progress::after { position: absolute; inset: 0 auto 0 0; width: var(--progress); background: var(--teal); content: ""; }

.tv-watching-with {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.tv-watching-with > strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-watching-avatars {
  display: flex;
  padding-left: 5px;
}

.tv-watching-avatars :is(i, img) {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: -6px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--selected-bg);
  color: var(--teal);
  font-style: normal;
  font-weight: 800;
  object-fit: cover;
}

.tv-recommendations {
  display: grid;
  gap: 12px;
}

.tv-recommendation-grid {
  display: grid;
  grid-auto-columns: minmax(250px, 24vw);
  grid-auto-flow: column;
  grid-template-columns: none;
  gap: 14px;
  padding: 4px clamp(32px, 4vw, 72px) 18px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scroll-padding-inline: clamp(32px, 4vw, 72px);
  scroll-snap-type: inline proximity;
  scrollbar-width: none;
}

.tv-recommendation-grid::-webkit-scrollbar { display: none; }

.tv-recommendation-tile {
  position: relative;
  display: grid;
  align-items: end;
  min-width: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--tv-border, var(--line));
  border-radius: var(--tv-radius, 8px);
  background: var(--tv-surface-strong, var(--panel-strong)) center / cover no-repeat;
  color: #fff;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
}

.tv-recommendation-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 54px 13px 12px;
}

.tv-recommendation-copy :is(strong, small) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-recommendation-copy small { color: rgba(255,255,255,.76); font-size: .7rem; }
.tv-recommendation-facts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tv-recommendation-facts b {
  padding: 2px 6px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  background: rgba(5, 10, 15, .58);
  color: rgba(255,255,255,.86);
  font-size: .58rem;
  font-weight: 750;
}
.tv-recommendation-copy i { position: relative; height: 3px; margin-top: 6px; overflow: hidden; background: rgba(255,255,255,.28); }
.tv-recommendation-copy i::after { position: absolute; inset: 0 auto 0 0; width: var(--progress); background: var(--teal); content: ""; }
.tv-recommendation-tile > .tv-art-placeholder :is(b, small) { display: none; }

body.android-tv .tv-recommendation-tile:focus {
  z-index: 2;
  border-color: var(--tv-focus, var(--focus-ring));
  box-shadow: 0 0 0 3px var(--tv-focus-shadow, color-mix(in srgb, var(--focus-ring) 42%, transparent)), 0 16px 34px rgba(0, 0, 0, .38);
  transform: translateY(var(--tv-tile-lift, -3px));
}

.tv-retro-library {
  display: grid;
  gap: clamp(26px, 3vw, 42px);
}

.tv-retro-tile {
  position: relative;
  display: grid;
  align-items: end;
  min-width: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--tv-border, var(--line));
  border-radius: var(--tv-radius, 8px);
  background: var(--tv-surface-strong, #10171c) center / cover no-repeat;
  color: #fff;
  text-align: left;
  scroll-snap-align: start;
}

.tv-retro-tile.active {
  border-color: color-mix(in srgb, var(--tv-focus, var(--teal)) 70%, white);
}

.tv-retro-tile.active::after {
  position: absolute;
  inset: 9px 9px auto auto;
  z-index: 3;
  width: 9px;
  height: 9px;
  border: 3px solid rgb(255 255 255 / 72%);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 14px color-mix(in srgb, var(--green) 70%, transparent);
  content: "";
}

.tv-retro-tile-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 18%, rgb(3 6 8 / 22%) 48%, rgb(3 6 8 / 95%) 100%);
}

.tv-retro-tile-copy {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 54px 14px 13px;
}

.tv-retro-tile-copy > :is(strong, small) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-retro-tile-copy > strong { font-size: .94rem; }
.tv-retro-tile-copy > small { color: rgb(255 255 255 / 68%); font-size: .66rem; }
.tv-retro-tile-kicker { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.tv-retro-tile-kicker b { display: inline-flex; align-items: center; gap: 5px; color: color-mix(in srgb, var(--teal) 72%, white); font-size: .62rem; text-transform: uppercase; }
.tv-retro-tile-kicker b .icon { width: 13px; height: 13px; }
.tv-retro-tile-kicker small { color: rgb(255 255 255 / 56%); font-size: .56rem; font-weight: 800; letter-spacing: .06em; }
.tv-retro-tile > .tv-art-placeholder small { display: none; }

body.android-tv .tv-retro-tile:focus {
  z-index: 2;
  border-color: var(--tv-focus, var(--focus-ring));
  box-shadow: 0 0 0 3px var(--tv-focus-shadow, color-mix(in srgb, var(--focus-ring) 42%, transparent)), 0 18px 42px rgb(0 0 0 / 46%);
  transform: translateY(var(--tv-tile-lift, -3px)) scale(1.012);
}

.tv-rail-section {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.tv-rail-heading h2,
.tv-rail-heading p {
  margin: 0;
}

.tv-rail-heading h2 {
  font-size: 1.22rem;
  letter-spacing: 0;
}

.tv-rail-heading p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.tv-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(270px, 22vw);
  gap: 14px;
  min-width: 0;
  overflow-x: auto;
  padding: 5px clamp(32px, 4vw, 72px) 10px;
  scroll-padding-inline: clamp(32px, 4vw, 72px);
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.tv-rail::-webkit-scrollbar {
  display: none;
}

.tv-media-tile,
.tv-source-tile {
  position: relative;
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--tv-border, var(--line));
  border-radius: var(--tv-radius, 8px);
  background: var(--tv-surface-strong, var(--panel-strong)) center / cover no-repeat;
  color: var(--text);
  text-align: left;
  scroll-snap-align: start;
  cursor: pointer;
}

.tv-media-tile {
  aspect-ratio: 16 / 9;
  align-items: end;
  padding: 0;
}

.tv-art-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  overflow: hidden;
  padding: 18px;
  background:
    radial-gradient(circle at 72% 24%, hsl(var(--placeholder-hue) 82% 58% / .34), transparent 34%),
    linear-gradient(135deg, hsl(var(--placeholder-hue) 42% 18%), var(--tv-surface-strong, var(--panel-strong)) 68%);
  color: rgba(255, 255, 255, .88);
  text-align: center;
}

.tv-art-placeholder::before,
.tv-art-placeholder::after {
  position: absolute;
  border: 1px solid hsl(var(--placeholder-hue) 80% 70% / .24);
  border-radius: 50%;
  content: "";
}

.tv-art-placeholder::before { width: 74%; aspect-ratio: 1; transform: rotate(18deg); }
.tv-art-placeholder::after { width: 48%; aspect-ratio: 1; transform: rotate(-27deg); }
.tv-art-placeholder-mark,
.tv-art-placeholder b,
.tv-art-placeholder small { position: relative; z-index: 1; }
.tv-art-placeholder-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid hsl(var(--placeholder-hue) 80% 78% / .55); border-radius: 50%; color: hsl(var(--placeholder-hue) 90% 82%); }
.tv-art-placeholder-mark .icon { width: 15px; height: 15px; }
.tv-art-placeholder b { max-width: 90%; color: rgba(255, 255, 255, .96); font-size: 1.65rem; letter-spacing: .08em; }
.tv-art-placeholder small { max-width: 88%; overflow: hidden; color: rgba(255, 255, 255, .68); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }

[data-tv-artwork] > .tv-art-placeholder { transition: opacity 180ms ease; }
[data-tv-artwork].artwork-ready > .tv-art-placeholder { opacity: 0; pointer-events: none; }

.tv-tile-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(0, 0, 0, 0.88));
}

.tv-tile-meta {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 2px;
  padding: 48px 14px 12px;
  color: #fff;
}

.tv-tile-meta strong,
.tv-tile-meta small,
.tv-source-copy strong,
.tv-source-copy small,
.tv-playlist-main strong,
.tv-playlist-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-tile-meta small,
.tv-source-copy small,
.tv-playlist-main small {
  color: var(--muted);
  font-size: 0.72rem;
}

.tv-tile-meta small {
  color: rgba(255, 255, 255, 0.78);
}

.tv-tile-meta i {
  position: relative;
  display: block;
  height: 3px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
}

.tv-tile-meta i::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--progress);
  background: var(--teal);
  content: "";
}

.tv-playlist-section {
  display: grid;
  gap: 12px;
}

.tv-playlist-list {
  display: grid;
  gap: 12px;
  padding-inline: clamp(32px, 4vw, 72px);
}

.tv-playlist-row {
  display: grid;
  grid-template-columns: minmax(230px, 25%) minmax(300px, 1fr) minmax(360px, 34%) 46px;
  gap: clamp(16px, 2vw, 32px);
  align-items: stretch;
  min-height: 184px;
  padding: 0 16px 0 0;
  overflow: hidden;
  border: 1px solid var(--tv-border, var(--line));
  border-radius: var(--tv-radius, 8px);
  background: var(--tv-surface, var(--panel-surface));
}

.tv-playlist-main {
  display: block;
  align-self: center;
  min-width: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.tv-playlist-copy,
.tv-source-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.tv-source-icon {
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--selected-bg);
  color: var(--teal);
}

.tv-playlist-copy > small { color: var(--teal); font-weight: 750; }
.tv-playlist-copy > strong { font-size: 1.2rem; }
.tv-playlist-copy p { display: -webkit-box; margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 0.78rem; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.tv-playlist-facts em { font-style: normal; }
.tv-playlist-cast { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }

.tv-playlist-resume {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 182px;
  overflow: hidden;
  border: 0;
  border-radius: 7px 0 0 7px;
  background: var(--control-bg) center / cover no-repeat;
  color: #fff;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line);
}

.tv-playlist-resume > span:not(.tv-art-placeholder) { position: relative; z-index: 2; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: rgba(0, 0, 0, 0.68); }
.tv-playlist-resume > .tv-art-placeholder { z-index: 0; }
.tv-playlist-resume > i { position: absolute; inset: auto 0 0; height: 4px; background: rgba(255,255,255,.28); }
.tv-playlist-resume > i::after { position: absolute; inset: 0 auto 0 0; width: var(--progress); background: var(--teal); content: ""; }

.tv-playlist-stack {
  position: relative;
  align-self: stretch;
  height: 100%;
  min-height: 182px;
  min-width: 0;
  overflow: hidden;
}

.tv-playlist-frame {
  position: absolute;
  inset-block: 0;
  right: calc(var(--stack-index) * 42px);
  z-index: calc(5 - var(--stack-index));
  display: grid;
  place-items: center;
  width: min(290px, 82%);
  border: 0;
  border-left: 2px solid color-mix(in srgb, var(--text) 38%, var(--line));
  background: var(--control-bg) center / cover no-repeat;
  color: var(--muted);
  clip-path: polygon(14% 0, 100% 0, 100% 100%, 0 100%);
  box-shadow: -12px 0 24px rgba(0,0,0,.42);
}

.tv-playlist-frame::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.28), transparent 34%);
  content: "";
}

.tv-playlist-frame b { position: relative; z-index: 1; }
.tv-playlist-frame.artwork-ready b { opacity: 0; }
.tv-playlist-frame > .tv-art-placeholder { padding: 10px; }
.tv-playlist-frame > .tv-art-placeholder :is(.tv-art-placeholder-mark, small) { display: none; }
.tv-playlist-frame > .tv-art-placeholder b { font-size: 1.1rem; }
.tv-playlist-open { align-self: center; width: 44px; height: 44px; }

body.android-tv .tv-playlist-row:focus-within {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus-ring) 42%, transparent);
}

.tv-source-tile {
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  min-height: 132px;
  padding: 48px 14px 14px;
  box-shadow: inset 0 -100px 70px -65px rgba(0, 0, 0, 0.86);
}

.tv-source-tile.empty {
  align-items: center;
  background: var(--panel-strong);
  box-shadow: none;
}

.tv-rail > .tv-source-tile-wide {
  grid-column: span 2;
}

.tv-source-tile.empty > .icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
}

.tv-source-tile.empty > strong,
.tv-source-tile.empty > span:not(.tv-source-icon):not(.tv-source-copy) {
  grid-column: 2;
  min-width: 0;
}

.tv-source-tile.empty > strong { align-self: end; }
.tv-source-tile.empty > span:not(.tv-source-icon):not(.tv-source-copy) { align-self: start; }

.tv-source-icon {
  width: 52px;
  height: 52px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
}

.tv-source-copy strong,
.tv-source-copy small {
  color: #fff;
}

.tv-source-copy small {
  color: rgba(255, 255, 255, 0.74);
}

.tv-source-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
}

.tv-source-facts b {
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.54);
  color: rgba(255,255,255,.84);
  font-size: .58rem;
  font-weight: 750;
}

.tv-source-browser {
  display: grid;
  gap: 18px;
}

.tv-source-browser-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
}

.tv-source-browser-head h1 { margin: 4px 0; font-size: 2rem; }
.tv-source-browser-head p { margin: 0; color: var(--muted); font-size: .8rem; }
.tv-source-search { position: relative; display: block; width: min(430px, 34vw); }
.tv-source-search > svg { position: absolute; z-index: 1; top: 15px; left: 15px; width: 19px; color: var(--muted); pointer-events: none; }
.tv-source-search input { min-height: 50px; padding-left: 44px; }

.tv-source-crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  overflow: hidden;
  border-block: 1px solid var(--subtle-border);
}

.tv-source-crumbs button { min-height: 44px; overflow: hidden; padding: 8px 8px; background: transparent; color: var(--muted); font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.tv-source-crumbs button[aria-current="page"] { color: var(--text); }
.tv-source-crumbs svg { width: 15px; flex: 0 0 auto; color: var(--muted); }

.tv-source-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(410px, 32%);
  gap: clamp(20px, 2.5vw, 38px);
  align-items: start;
}
.tv-source-workspace.folders-only { grid-template-columns: minmax(0, 1fr); }
.tv-source-workspace.folders-only .tv-source-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.tv-source-results { min-width: 0; }
.tv-source-sections { display: grid; gap: 24px; }
.tv-source-section { display: grid; gap: 10px; }
.tv-source-section > header { display: flex; align-items: center; justify-content: space-between; min-height: 30px; padding-inline: 2px; }
.tv-source-section > header strong { color: var(--soft); font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; }
.tv-source-section > header span { padding: 3px 7px; border: 1px solid var(--subtle-border); border-radius: 999px; color: var(--muted); font-size: .58rem; font-weight: 800; }
.tv-source-section.retro > header strong { color: color-mix(in srgb, var(--amber) 82%, white); }
.tv-source-section.retro > header span { border-color: color-mix(in srgb, var(--amber) 45%, transparent); background: color-mix(in srgb, var(--amber) 10%, transparent); color: color-mix(in srgb, var(--amber) 78%, white); }
.tv-source-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.tv-source-loading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: center;
  gap: 3px 10px;
  min-height: 104px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--soft);
}
.tv-source-loading .status-dot { grid-row: 1 / 3; align-self: center; }
.tv-source-loading small { color: var(--muted); }

@media (max-width: 980px) {
  .tv-sign-in { grid-template-columns: 1fr; }
  .tv-sign-in-intro { display: none; }
}

.tv-folder-tile {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 20px;
  grid-template-rows: auto auto;
  gap: 2px 11px;
  align-items: center;
  min-height: 104px;
  padding: 15px;
  border: 1px solid var(--tv-border, var(--line));
  border-radius: var(--tv-radius, 8px);
  background: var(--tv-surface, var(--panel-surface));
  color: var(--text);
  text-align: left;
  scroll-margin-block: 128px 72px;
}

.tv-folder-tile.has-art {
  background-image: var(--folder-art);
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 0 0 999px rgb(0 0 0 / 58%);
}

.tv-folder-tile > span { grid-row: 1 / 3; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 6px; background: var(--selected-bg); color: var(--teal); }
.tv-folder-tile > strong,
.tv-folder-tile > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-folder-tile > small { color: var(--muted); font-size: .68rem; }
.tv-folder-tile > svg { grid-column: 3; grid-row: 1 / 3; width: 18px; }

.tv-source-media {
  position: relative;
  display: grid;
  align-items: end;
  aspect-ratio: 16 / 9;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--tv-border, var(--line));
  border-radius: var(--tv-radius, 8px);
  background: var(--control-bg) center / cover no-repeat;
  color: #fff;
  text-align: left;
  scroll-margin-block: 128px 72px;
}

.tv-source-media.selected,
.tv-source-media.queued { border-color: var(--selected-border); box-shadow: 0 0 0 2px color-mix(in srgb, var(--selected-border) 55%, transparent); }
.tv-source-media.selected:not(:focus-visible) { box-shadow: 0 0 0 2px color-mix(in srgb, var(--selected-border) 34%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--selected-border) 26%, transparent); }
.tv-source-media.locally-available:not(.selected):not(.queued) { border-color: color-mix(in srgb, var(--teal) 68%, var(--tv-border, var(--line))); }
.tv-source-media.queued::after { position: absolute; top: 8px; right: 8px; z-index: 2; padding: 3px 6px; border-radius: 4px; background: var(--teal); color: #001614; font-size: .58rem; font-weight: 850; content: "ADDED"; }
.tv-source-media.retro { border-color: color-mix(in srgb, var(--amber) 32%, var(--tv-border, var(--line))); background-color: color-mix(in srgb, #28123a 76%, var(--control-bg)); }
.tv-source-media.retro:not(.has-art)::before { position: absolute; inset: 0; background: radial-gradient(circle at 76% 20%, color-mix(in srgb, var(--amber) 22%, transparent), transparent 42%), linear-gradient(135deg, rgba(92, 34, 119, .52), rgba(11, 14, 22, .16)); content: ""; }
.tv-source-kind { position: absolute; z-index: 3; top: 9px; left: 9px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border: 1px solid color-mix(in srgb, var(--amber) 55%, transparent); border-radius: 999px; background: rgba(10, 8, 14, .78); color: color-mix(in srgb, var(--amber) 82%, white); }
.tv-source-kind svg { width: 14px; height: 14px; }
.tv-source-kind b { font-size: .52rem; letter-spacing: .1em; }
.tv-source-media > .metadata-refresh-badge {
  position: absolute;
  z-index: 3;
  top: 8px;
  right: 8px;
}
.tv-source-media.queued > .metadata-refresh-badge { top: 35px; }
.tv-source-media-shade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 18%, rgba(0,0,0,.92)); }
.tv-source-media-copy { position: relative; display: grid; min-width: 0; gap: 3px; padding: 40px 12px 11px; }
.tv-source-media-copy strong,
.tv-source-media-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-source-media-copy strong { display: flex; align-items: baseline; gap: 7px; }
.tv-source-media-copy strong > span { overflow: hidden; flex: 1 1 auto; text-overflow: ellipsis; }
.tv-source-media-copy strong > i { color: rgba(255,255,255,.62); font-size: .72em; font-style: normal; font-variant-numeric: tabular-nums; }
.tv-source-media-copy strong > em { color: var(--amber); font-size: .7em; font-style: normal; }
.tv-source-media-copy strong > em.local-availability-badge { color: #b9fff2; }
.tv-source-media-copy small { color: rgba(255,255,255,.72); font-size: .64rem; }
.tv-source-media-copy > span { display: flex; flex-wrap: wrap; gap: 5px; }
.tv-source-media-copy b { padding: 2px 5px; border-radius: 3px; background: rgba(0,0,0,.58); font-size: .55rem; }

.tv-source-detail {
  position: sticky;
  top: 98px;
  min-height: min(610px, calc(100dvh - 132px));
  max-height: calc(100dvh - 122px);
  overflow: hidden;
  border: 1px solid var(--tv-border, var(--line));
  border-radius: var(--tv-radius, 8px);
  background: var(--tv-surface, var(--panel-surface));
}

.tv-source-detail.empty { display: grid; place-items: center; align-content: center; gap: 8px; padding: 30px; color: var(--muted); text-align: center; }
.tv-source-detail.empty > span { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: var(--selected-bg); color: var(--teal); }
.tv-source-detail.empty p { margin: 0; }
.tv-source-detail-art { position: absolute; inset: 0 0 auto; height: 46%; background: var(--tv-detail-art) center / cover no-repeat; }
.tv-source-detail-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.08), var(--panel) 42%, var(--panel) 100%); }
.tv-source-detail-content { position: relative; z-index: 1; display: grid; gap: 12px; min-width: 0; max-height: calc(100dvh - 122px); padding: 145px 22px 20px; overflow-y: auto; overscroll-behavior: contain; }
.tv-source-detail-content h2 { margin: 0; font-size: 1.5rem; }
.tv-source-detail.retro { border-color: color-mix(in srgb, var(--amber) 38%, var(--tv-border, var(--line))); }
.tv-source-detail.retro .tv-source-detail-art { background-color: #180d21; }
.tv-source-detail.retro .tv-eyebrow { display: inline-flex; align-items: center; gap: 7px; color: color-mix(in srgb, var(--amber) 82%, white); }
.tv-source-detail.retro .tv-eyebrow svg { width: 18px; height: 18px; }
.tv-source-detail-badges .retro-badge { border-color: color-mix(in srgb, var(--amber) 58%, transparent); background: color-mix(in srgb, var(--amber) 16%, transparent); color: color-mix(in srgb, var(--amber) 82%, white); }
.tv-source-detail .retro-launch { min-width: 0; }
.tv-source-detail-content > p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: .77rem; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.tv-source-detail-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.tv-source-detail-badges span { padding: 4px 7px; border: 1px solid var(--subtle-border); border-radius: 4px; background: var(--subtle-bg); color: var(--soft); font-size: .62rem; font-weight: 750; }
.tv-source-detail-badges span.local-availability-badge,
.local-availability-badge {
  border-color: color-mix(in srgb, var(--teal) 58%, transparent);
  background: color-mix(in srgb, var(--teal) 18%, transparent);
  color: color-mix(in srgb, var(--teal) 72%, white);
  font-style: normal;
  font-weight: 800;
}
.tv-source-detail dl { display: grid; gap: 0; margin: 0; border-top: 1px solid var(--subtle-border); }
.tv-source-detail dl > div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--subtle-border); font-size: .68rem; }
.tv-source-detail dt { color: var(--muted); }
.tv-source-detail dd { overflow: hidden; margin: 0; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.tv-source-detail-actions { display: flex; gap: 8px; }
.tv-source-detail-actions .btn { flex: 1 1 auto; }
.tv-source-detail-actions .icon-btn { flex: 0 0 48px; width: 48px; height: 48px; }
.tv-source-primary-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; }
.tv-source-primary-actions.no-private-play { grid-template-columns: minmax(0, 1fr) auto; }
.tv-source-primary-actions .btn { min-width: 0; padding-inline: 12px; }
.tv-source-primary-actions .icon-btn { width: 48px; min-width: 48px; height: 48px; }
.tv-source-primary-actions .btn:focus-visible,
.tv-source-primary-actions .icon-btn:focus-visible { z-index: 2; }
.tv-add-playlist { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.tv-add-playlist label { display: grid; gap: 5px; color: var(--muted); font-size: .66rem; font-weight: 750; }
.tv-add-playlist select { min-height: 46px; }
.tv-add-playlist .btn { min-height: 46px; }
.tv-source-action-note { color: var(--muted); font-size: .66rem; line-height: 1.4; }
.tv-source-empty { display: grid; place-items: center; align-content: center; gap: 9px; min-height: 360px; padding: 28px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); text-align: center; }
.tv-source-empty > span:first-child { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: var(--selected-bg); color: var(--teal); }
.tv-source-empty > span:first-child svg { width: 25px; height: 25px; }
.tv-source-empty > strong { color: var(--soft); }
.tv-source-empty > small { max-width: 440px; line-height: 1.5; }

.tv-rail-empty {
  display: grid;
  place-items: center;
  min-height: 112px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.tv-menu-layer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  grid-template-columns: var(--tv-menu-width, minmax(350px, 23vw)) 1fr;
}

.playback-menu-layer {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: grid;
  grid-template-columns: 1fr var(--tv-playback-menu-width, minmax(700px, 41vw));
  min-width: 0;
  overflow: hidden;
}

.playback-menu-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(2px);
}

.playback-menu {
  position: relative;
  z-index: 1;
  display: grid;
  grid-column: 2;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 100dvh;
  max-width: 100vw;
  overflow: hidden;
  border-left: 1px solid var(--tv-border, var(--line));
  background: var(--tv-surface, var(--panel-surface));
  box-shadow: var(--shadow);
  color: var(--text);
}

.playback-menu > * {
  min-width: 0;
  max-width: 100%;
}

.playback-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 26px 18px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  overflow: hidden;
}

.playback-menu-header-copy { min-width: 0; overflow: hidden; }
.playback-menu-header h2 { overflow: hidden; margin: 4px 0 0; font-size: 1.12rem; text-overflow: ellipsis; white-space: nowrap; }
.playback-menu-kicker { color: var(--muted); font-size: .66rem; font-weight: 850; text-transform: uppercase; }

.playback-menu-header-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  min-width: 0;
}

.playback-menu-header-actions > .icon-btn {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
}

.playback-menu-section { display: block; }
.playback-menu-section-select {
  width: min(210px, 28vw);
  min-height: 42px;
  padding: 8px 32px 8px 11px;
  border-color: var(--line);
  background-color: var(--control-bg);
  color: var(--text);
  font-weight: 800;
}

.playback-menu-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 9px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .76rem;
}

.playback-menu-status > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playback-menu-body { width: 100%; min-width: 0; min-height: 0; padding: 20px 24px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.playback-menu-grid { display: grid; width: 100%; min-width: 0; max-width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.playback-menu-grid label { display: grid; min-width: 0; max-width: 100%; gap: 7px; color: var(--muted); font-size: .72rem; font-weight: 750; }
.playback-menu-grid select { width: 100%; min-width: 0; max-width: 100%; min-height: 48px; color: var(--text); background: var(--control-bg); }
.playback-control-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.playback-control-label > b { padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .62rem; letter-spacing: .04em; text-transform: uppercase; }
.playback-menu-grid .processing-control-disabled { color: color-mix(in srgb, var(--muted) 72%, transparent); }
.playback-menu-grid .processing-control-disabled select { cursor: not-allowed; border-color: color-mix(in srgb, var(--line) 72%, transparent); color: color-mix(in srgb, var(--muted) 78%, transparent); background: color-mix(in srgb, var(--control-bg) 72%, transparent); opacity: .78; }
.quick-audio-output { display: grid; min-width: 0; gap: 7px; color: var(--muted); font-size: .72rem; font-weight: 750; }
.quick-audio-output .btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; min-height: 48px; color: var(--text); text-align: left; }
.quick-audio-output .btn > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-audio-output .icon { flex: 0 0 auto; width: 16px; height: 16px; }

.shader-library { display: grid; gap: 13px; }
.shader-library-head,
.shader-settings-tools { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.shader-library-head > div:first-child,
.shader-settings-tools > div:first-child { display: grid; min-width: 0; gap: 3px; }
.shader-library-head small,
.shader-settings-tools small { color: var(--muted); font-size: .68rem; line-height: 1.35; }
.shader-import-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.shader-import-actions .btn { cursor: pointer; }
.shader-contract-note { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 9px; align-items: start; padding: 10px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--subtle-bg); color: var(--muted); }
.shader-contract-note > span { color: var(--teal); }
.shader-contract-note p { margin: 0; font-size: .68rem; line-height: 1.45; }
.shader-contract-note code { color: var(--text); font-size: .64rem; }
.shader-profile-list { display: grid; gap: 7px; }
.shader-profile { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 11px; align-items: center; min-height: 76px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--subtle-bg); }
.shader-profile.active { border-color: var(--selected-border); background: var(--selected-bg); }
.shader-profile.unsupported { opacity: .7; }
.shader-profile-swatch { width: 52px; height: 52px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: linear-gradient(135deg, var(--accent) 0 25%, var(--panel) 25% 50%, var(--teal) 50% 75%, var(--control-bg) 75%); }
.shader-profile-swatch[data-shader-preview*="scanline"] { background: repeating-linear-gradient(0deg, #07111a 0 2px, color-mix(in srgb, var(--accent) 65%, #091018) 2px 3px); }
.shader-profile-swatch[data-shader-preview*="lcd"] { background: repeating-linear-gradient(90deg, #e05959 0 2px, #61b86b 2px 4px, #5887d9 4px 6px); filter: brightness(.72); }
.shader-profile-swatch[data-shader-preview*="crt"] { background: radial-gradient(ellipse at center, color-mix(in srgb, var(--accent) 55%, #78d8a2) 0 38%, #071018 76%); box-shadow: inset 0 0 14px #000; }
.shader-profile-swatch[data-shader-preview*="ntsc"] { background: repeating-linear-gradient(0deg, #203f56 0 3px, #b4876a 3px 5px, #24303a 5px 7px); filter: saturate(.78) blur(.35px); }
.shader-profile-swatch[data-shader-preview*="halftone"] { background-color: #e7dfcf; background-image: radial-gradient(circle, #d43f72 0 1px, transparent 1.5px), radial-gradient(circle, #26a7bd 0 1px, transparent 1.5px), radial-gradient(circle, #e2bd24 0 1px, transparent 1.5px); background-position: 0 0, 3px 3px, 6px 1px; background-size: 8px 8px; }
.shader-profile-swatch[data-shader-preview*="dither"] { background-color: #16222c; background-image: linear-gradient(45deg, #7fb3a4 25%, transparent 25%, transparent 75%, #7fb3a4 75%), linear-gradient(45deg, #d5c46b 25%, transparent 25%, transparent 75%, #d5c46b 75%); background-position: 0 0, 3px 3px; background-size: 6px 6px; }
.shader-profile-copy { display: grid; min-width: 0; gap: 4px; }
.shader-profile-copy > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.shader-profile-copy p { margin: 0; color: var(--muted); font-size: .68rem; line-height: 1.38; }
.shader-profile-copy small { color: var(--muted); font-size: .61rem; }
.shader-profile-copy a { color: var(--teal); }
.shader-profile-actions { display: flex; align-items: center; gap: 5px; }
.shader-settings-tools { padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--subtle-bg); }
@media (max-width: 620px) {
  .shader-library-head,
  .shader-settings-tools { align-items: stretch; flex-direction: column; }
  .shader-import-actions { justify-content: stretch; }
  .shader-import-actions .btn { flex: 1 1 120px; }
  .shader-profile { grid-template-columns: 44px minmax(0, 1fr); }
  .shader-profile-swatch { width: 44px; height: 44px; }
  .shader-profile-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
.processing-workspace { display: grid; gap: 13px; }
.processing-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 2px 2px 0; }
.processing-intro > div { display: grid; min-width: 0; gap: 3px; }
.processing-intro > .icon-btn { flex: 0 0 38px; width: 38px; min-width: 38px; min-height: 38px; }
.processing-intro strong { font-size: 1rem; letter-spacing: -.01em; }
.processing-intro small { color: var(--muted); font-size: .7rem; line-height: 1.35; }
.processing-pipeline-summary { display: flex; min-width: 0; flex-wrap: wrap; gap: 6px; }
.processing-pipeline-summary > span { display: inline-flex; align-items: baseline; gap: 4px; min-height: 27px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--subtle-bg); color: var(--muted); font-size: .62rem; font-weight: 750; }
.processing-pipeline-summary b { color: var(--text); font-size: .72rem; }
.processing-pipeline-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-inline: 2px; }
.processing-pipeline-heading > div { display: grid; min-width: 0; gap: 2px; }
.processing-pipeline-heading small { color: var(--muted); font-size: .64rem; line-height: 1.3; }
.processing-operation { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--subtle-bg); }
.processing-operation > span { color: var(--teal); }
.processing-operation > span svg { width: 20px; height: 20px; }
.processing-operation:is(.loading, .applying) > span svg { animation: processing-spin .9s linear infinite; }
@keyframes processing-spin { to { transform: rotate(360deg); } }
.processing-operation.failed { border-color: color-mix(in srgb, var(--danger) 58%, var(--line)); }
.processing-operation.failed > span { color: var(--danger); }
.processing-operation.success { border-color: color-mix(in srgb, var(--green) 52%, var(--line)); }
.processing-operation > div { display: grid; min-width: 0; gap: 2px; }
.processing-operation small { color: var(--muted); font-size: .68rem; line-height: 1.35; }
.processing-lanes { display: grid; grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr); gap: 7px; align-items: stretch; }
.processing-lane { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 7px; background: var(--subtle-bg); }
.processing-lane.device { border-top-color: var(--teal); }
.processing-lane > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 11px; border-bottom: 1px solid var(--line); }
.processing-lane > header > div { display: grid; min-width: 0; gap: 2px; }
.processing-lane > header small { overflow: hidden; color: var(--muted); font-size: .61rem; text-overflow: ellipsis; white-space: nowrap; }
.processing-lane > header > span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--control-bg); color: var(--muted); font-size: .62rem; font-weight: 850; }
.processing-stage-list { display: grid; gap: 6px; padding: 7px; }
.processing-stage { display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: center; min-height: 54px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--control-bg); }
.processing-stage.selected { border-color: var(--selected-border); background: var(--selected-bg); }
.processing-stage-main { display: grid; min-width: 0; height: 100%; gap: 2px; padding: 8px 9px; border: 0; background: transparent; color: var(--text); text-align: left; }
.processing-stage-main strong,
.processing-stage-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.processing-stage-main strong { font-size: .72rem; }
.processing-stage-main small { color: var(--muted); font-size: .6rem; }
.processing-stage-move { width: 30px; height: 30px; margin-right: 3px; }
.processing-stage-fixed { padding-right: 7px; color: var(--muted); font-size: .55rem; font-weight: 800; text-transform: uppercase; }
.processing-lane-empty { padding: 18px 10px; color: var(--muted); font-size: .68rem; text-align: center; }
.processing-flow-arrow { display: grid; place-items: center; color: var(--muted); }
.processing-flow-arrow svg { width: 17px; height: 17px; }
.processing-location-list { display: grid; gap: 7px; }
.processing-location-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(120px, .42fr);
  gap: 12px;
  align-items: center;
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.processing-location-row.selected { border-color: var(--selected-border); background: var(--selected-bg); }
.processing-location-row.locked { background: color-mix(in srgb, var(--subtle-bg) 78%, var(--muted)); }
.processing-location-row.locked .processing-location-copy { opacity: .68; }
.processing-location-copy { display: grid; min-width: 0; gap: 3px; padding: 4px; background: transparent; color: var(--text); text-align: left; }
.processing-location-copy strong,
.processing-location-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.processing-location-copy small { color: var(--muted); font-size: .66rem; }
.processing-location-toggle { display: grid; grid-template-columns: repeat(2, minmax(68px, 1fr)); gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--control-bg); }
.processing-location-toggle[data-layout="3"] { grid-template-columns: repeat(3, minmax(58px, 1fr)); }
.processing-location-toggle button { min-height: 44px; padding: 6px 11px; border-radius: 6px; background: transparent; color: var(--muted); font-size: .68rem; font-weight: 850; }
.processing-location-toggle button.active { background: var(--selected-bg); color: var(--selected-text); box-shadow: inset 0 0 0 1px var(--selected-border); }
.processing-location-toggle button:disabled { cursor: not-allowed; opacity: .38; }
.processing-location-toggle button.active:disabled { opacity: .7; filter: saturate(.35); }
.processing-location-state { color: var(--muted); font-size: .61rem; font-weight: 700; text-align: right; }
.processing-fixed-location { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--control-bg); color: var(--muted); font-size: .61rem; font-weight: 800; }
.processing-editor { display: grid; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--subtle-bg); }
.processing-editor > header { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.processing-editor > header > div { display: grid; gap: 2px; }
.processing-editor > header span { color: var(--muted); font-size: .6rem; font-weight: 850; text-transform: uppercase; }
.processing-editor > header h3 { margin: 0; font-size: .95rem; }
.processing-editor > header small { max-width: 55%; color: var(--muted); font-size: .62rem; line-height: 1.35; text-align: right; }
.processing-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.processing-editor-grid label { display: grid; gap: 6px; color: var(--muted); font-size: .68rem; font-weight: 750; }
.processing-editor-grid :is(select, input[type="number"]) { width: 100%; min-width: 0; min-height: 42px; color: var(--text); background: var(--control-bg); }
.processing-editor-grid input[type="range"] { width: 100%; }
.processing-editor-grid output { float: right; color: var(--text); }
.processing-editor-grid .processing-check { display: flex; align-items: center; gap: 9px; min-height: 42px; }
.processing-editor-grid .processing-check input { width: 18px; height: 18px; }
.processing-editor > .btn { justify-self: end; }
.processing-editor-empty { display: grid; gap: 4px; padding: 20px; border: 1px dashed var(--line); border-radius: 7px; color: var(--muted); text-align: center; }
.processing-editor-empty strong { color: var(--text); }
.processing-offline-card { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line)); border-radius: 9px; background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 8%, var(--subtle-bg)), var(--subtle-bg)); }
.processing-offline-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: var(--selected-bg); color: var(--selected-text); }
.processing-offline-icon .icon { width: 19px; height: 19px; }
.processing-offline-card > div { display: grid; min-width: 0; gap: 2px; }
.processing-offline-card small { color: var(--muted); font-size: .64rem; line-height: 1.35; }
.processing-offline-card .btn { white-space: nowrap; }
.connector-recipe-controls { display: grid; gap: 8px; }
.connector-recipe-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.connector-recipe-heading > div { display: grid; min-width: 0; gap: 3px; }
.connector-recipe-heading small { color: var(--muted); font-size: .72rem; line-height: 1.35; }
.connector-recipe-list { display: grid; gap: 7px; }
.connector-recipe-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 34%); gap: 8px; align-items: center; min-height: 50px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--subtle-bg); }
.connector-recipe-row.selected { border-color: var(--selected-border); background: var(--selected-bg); }
.connector-recipe-toggle { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; align-items: center; min-width: 0; }
.connector-recipe-toggle input { width: 18px; min-height: 18px; margin: 0; }
.connector-recipe-toggle > span { display: grid; min-width: 0; gap: 2px; }
.connector-recipe-toggle strong,
.connector-recipe-toggle small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connector-recipe-toggle small { color: var(--muted); font-size: .65rem; font-weight: 600; }
.connector-recipe-preset select { min-height: 36px; padding-block: 7px; }
.playback-menu-footer { display: flex; min-width: 0; flex-wrap: wrap; gap: 8px; padding: 14px 20px 20px; overflow: hidden; border-top: 1px solid var(--line); }
.playback-menu-footer .btn { min-width: 0; flex: 1 1 130px; }

body.android-tv.tv-mode .playback-menu-footer {
  display: grid;
  grid-template-columns: minmax(150px, 1.35fr) 50px minmax(105px, 1fr) minmax(88px, .85fr) 50px;
}

body.android-tv.tv-mode .playback-menu-footer .btn {
  min-width: 0;
  padding-inline: 10px;
  white-space: nowrap;
}

body.android-tv.tv-mode .playback-menu-footer .icon-btn {
  width: 50px;
  min-width: 50px;
  min-height: 48px;
}

body.android-tv.tv-mode :is(.playback-menu) :is(button, select):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.tv-menu-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(2px);
}

.tv-menu {
  position: relative;
  z-index: 1;
  display: grid;
  grid-column: 1;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  min-height: 100dvh;
  padding: 32px 22px 24px;
  border-right: 1px solid var(--tv-border, var(--line));
  background: var(--tv-surface, var(--panel-surface));
  box-shadow: var(--shadow);
}

.tv-menu-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 4px;
  font-size: 1.2rem;
}

.tv-menu-brand img {
  width: 34px;
  height: 34px;
}

.tv-menu-brand > span,
.tv-menu-footer > div > span:not(.service-dot) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.tv-menu-brand small,
.tv-menu-footer small {
  overflow: hidden;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-menu-groups {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.tv-menu-groups::-webkit-scrollbar { display: none; }
.tv-menu-group { display: grid; gap: 4px; margin-bottom: 15px; }
.tv-menu-group > span { margin: 0 12px 3px; color: var(--muted); font-size: .62rem; font-weight: 850; text-transform: uppercase; }

.tv-menu-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--tv-radius, 6px);
  background: transparent;
  color: var(--text);
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.tv-menu-item b {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--teal-ink);
  font-size: .66rem;
}

.tv-menu-item.active {
  border-color: var(--selected-border);
  background: var(--selected-bg);
  color: var(--selected-text);
}

.tv-menu-item.active::before {
  position: absolute;
  inset: 9px auto 9px -1px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--tv-focus, var(--focus-ring));
  content: "";
}

.tv-menu-item:hover,
.tv-menu-item:focus-visible {
  border-color: var(--selected-border);
  background: var(--selected-bg);
}

.tv-menu-footer {
  display: grid;
  gap: 13px;
  padding: 16px 10px 0;
  border-top: 1px solid var(--line);
}

.tv-menu-footer > div:first-child {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.tv-menu-footer .service-dot { width: 8px; height: 8px; background: var(--danger); }
.tv-menu-footer .service-dot.good { background: var(--green); }
.tv-menu-theme { display: grid; grid-template-columns: auto minmax(0, 1fr) 18px; align-items: center; gap: 10px; min-height: 52px; margin-inline: -6px; padding: 7px 6px; border: 1px solid transparent; border-radius: var(--tv-radius, 6px); background: transparent; color: var(--text); text-align: left; }
.tv-menu-theme > span:nth-child(2) { display: grid; min-width: 0; gap: 1px; }
.tv-menu-theme > svg { width: 17px; color: var(--muted); }
.tv-menu-theme:focus-visible { border-color: var(--selected-border); background: var(--selected-bg); }
.tv-menu-footer .tv-menu-theme .tv-theme-swatches { display: flex; grid-auto-flow: column; justify-content: start; }
.tv-theme-swatches i { width: 18px; height: 18px; margin-right: -3px; border: 1px solid var(--panel-surface); border-radius: 50%; }

body.android-tv .tv-rail :is(button, article):focus-within,
body.android-tv .tv-rail > button:focus {
  z-index: 2;
  border-color: var(--tv-focus, var(--focus-ring));
  box-shadow: 0 0 0 3px var(--tv-focus-shadow, color-mix(in srgb, var(--focus-ring) 42%, transparent)), 0 16px 34px rgba(0, 0, 0, .34);
  transform: translateY(var(--tv-tile-lift, -3px));
}

body.android-tv.tv-mode :is(.tv-page, .tv-menu, .tv-home) :is(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--tv-focus, var(--focus-ring));
  outline-offset: 3px;
}

body.android-tv.tv-mode :is(.tv-folder-tile, .tv-source-media, .tv-playlist-row, .tv-recommendation-tile, .tv-retro-tile, .tv-media-tile, .tv-source-tile) {
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

/* A density-scaled 1080p TV viewport still needs ten-foot typography and
   overscan-safe gutters. This keeps labels readable without inflating 4K twice. */
@media (min-width: 900px) and (max-width: 2559px) and (min-height: 600px) {
  html.android-tv-root { font-size: clamp(18px, 1.05vw, 20px); }
  .tv-page-bar { min-height: 90px; padding-inline: clamp(48px, 5vw, 96px); }
  .tv-page-content { width: min(2240px, calc(100% - clamp(96px, 10vw, 192px))); padding-block: 40px 76px; }
  .tv-home { gap: 34px; padding-block: 30px 68px; }
  .tv-home-header,
  .tv-rail-heading { padding-inline: clamp(48px, 5vw, 96px); }
  .tv-recommendation-grid,
  .tv-rail { padding-inline: clamp(48px, 5vw, 96px); scroll-padding-inline: clamp(48px, 5vw, 96px); }
  .tv-page-content :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea, .btn, .segment),
  .tv-hero-actions .btn,
  .tv-source-shortcut { min-height: 56px; }
  body.android-tv .tv-page-content .settings-nav-item { min-height: 58px; }
  .tv-menu-item { min-height: 58px; }
  .playback-menu-grid label > small,
  .playback-menu-grid .field-help,
  .audio-live-control small,
  .audio-select-control small { font-size: .76rem; line-height: 1.42; }
  body.android-tv.tv-mode .playback-menu-footer :is(.btn, .icon-btn) { min-height: 56px; }
}

body.android-tv.tv-mode .tv-source-grid :is(.tv-folder-tile, .tv-source-media):focus-visible {
  z-index: 2;
  border-color: var(--tv-focus, var(--focus-ring));
  box-shadow: 0 0 0 3px var(--tv-focus-shadow, color-mix(in srgb, var(--focus-ring) 42%, transparent)), 0 14px 30px rgba(0, 0, 0, .34);
  transform: translateY(var(--tv-tile-lift, -3px));
}

@media (prefers-reduced-motion: reduce) {
  body.android-tv.tv-mode :is(.tv-folder-tile, .tv-source-media, .tv-playlist-row, .tv-recommendation-tile, .tv-media-tile, .tv-source-tile) {
    transition: none;
  }
}

/* Some 4K televisions expose a true 3840px CSS viewport, while others expose a
   density-scaled 1080p viewport. Scale only the former; the latter already gets
   Android's density scaling and should retain the 1080p geometry. */
@media (min-width: 2560px) and (min-height: 1400px) {
  html.android-tv-root {
    font-size: clamp(18px, 0.625vw, 24px);
  }

  body.android-tv.tv-mode .content {
    padding-bottom: 72px;
  }

  .tv-page-bar {
    min-height: 108px;
    padding-block: 18px;
  }

  .tv-page-brand img { width: 48px; height: 48px; }
  .tv-page-actions > .icon-btn { width: 68px; height: 68px; }
  .tv-menu-button { width: 68px; height: 68px; flex-basis: 68px; }
  .tv-account-sync { width: 56px; min-height: 56px; }
  .tv-source-shortcut { min-height: 66px; }

  .tv-page-content {
    padding-block: 50px 96px;
  }

  .tv-page-content :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea, .btn, .segment) {
    min-height: 64px;
  }

  body.android-tv .tv-page-content .settings-workspace {
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 36px;
  }

  body.android-tv .tv-page-content .settings-nav {
    top: 130px;
    width: 330px;
    padding: 10px;
  }

  .tv-page-content .settings-nav-item {
    min-height: 72px;
    padding-inline: 22px;
  }

  .tv-home { gap: 42px; padding-block: 36px 80px; }
  .tv-hero { --tv-hero-overlap: 132px; min-height: clamp(620px, 34vw, 860px); }
  .tv-hero-copy { width: min(920px, 42vw); padding-bottom: 100px; }
  .tv-hero-title { max-width: min(48vw, 1120px); }
  .tv-recommendation-grid { grid-template-columns: none; grid-auto-columns: minmax(360px, 19vw); gap: 22px; }
  .tv-rail { grid-auto-columns: minmax(410px, 19vw); gap: 22px; padding-block: 8px 16px; }
  .tv-playlist-list { gap: 18px; }
  .tv-playlist-row { min-height: 260px; }
  .tv-playlist-resume, .tv-playlist-stack { min-height: 258px; }
  .tv-source-tile { min-height: 190px; }
  .tv-source-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
  .tv-source-workspace { grid-template-columns: minmax(0, 1fr) minmax(560px, 32%); }

  .tv-menu { gap: 26px; padding: 46px 34px 34px; }
  .tv-menu-brand img { width: 48px; height: 48px; }
  .tv-menu-item { min-height: 72px; padding: 14px 20px; }

  .playback-menu-header { padding: 38px 38px 26px; }
  .playback-menu-section-select { min-height: 58px; }
  .playback-menu-status { min-height: 64px; padding-inline: 36px; }
  .playback-menu-body { padding: 30px 36px; }
  .playback-menu-grid { gap: 22px; }
  .playback-menu-grid select { min-height: 64px; }
  .playback-menu-footer { gap: 12px; padding: 20px 30px 30px; }
  .playback-menu-footer .btn { min-height: 64px; }

  body.android-tv :is(button, a, input, select, textarea, summary, [tabindex]):focus,
  body.android-tv.tv-mode :is(.tv-page, .tv-menu, .tv-home, .playback-menu) :is(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
    outline-width: 5px;
    outline-offset: 5px;
  }
}

@media (max-width: 760px) {
  .tv-page-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding-inline: 16px;
  }

  .tv-page-brand {
    min-width: 0;
  }

  .tv-page-brand strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tv-page-location,
  .tv-page-inbox,
  .tv-page-service > span {
    display: none;
  }

  .tv-page-actions {
    min-width: 0;
    gap: 6px;
  }

  .tv-page-service {
    margin-right: 0;
  }

  .tv-home { gap: 24px; padding-top: 22px; }
  .tv-home-header,
  .tv-rail-heading { padding-inline: 22px; }
  .tv-rail { grid-auto-columns: minmax(250px, 72vw); padding-inline: 22px; }
  .tv-menu-layer { grid-template-columns: minmax(250px, 76vw) 1fr; }
  .playback-menu-layer { align-items: end; grid-template-columns: 1fr; }
  .playback-menu { grid-column: 1; width: 100%; min-height: 0; max-height: calc(100dvh - max(8px, env(safe-area-inset-top))); border-top: 1px solid var(--line); border-left: 0; border-radius: 8px 8px 0 0; }
  .playback-menu-header { padding: 18px 18px 13px; }
  .playback-menu-header-actions { gap: 6px; }
  .playback-menu-section-select { width: min(190px, 40vw); }
  .playback-menu-status { padding-inline: 16px; }
  .playback-menu-body { padding: 16px; }
  .playback-menu-grid { grid-template-columns: 1fr; gap: 12px; }
  .processing-lanes { grid-template-columns: 1fr; }
  .processing-flow-arrow { transform: rotate(90deg); }
  .processing-editor-grid { grid-template-columns: 1fr; }
  .processing-editor > header { display: grid; }
  .processing-editor > header small { max-width: none; text-align: left; }
  .connector-recipe-row { grid-template-columns: minmax(0, 1fr) auto; }
  .connector-recipe-preset { grid-column: 1 / -1; grid-row: 2; }
  .playback-menu-footer { padding: 12px 14px 16px; }
}

@media (max-width: 520px) {
  .playback-menu-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px 14px 10px;
  }

  .playback-menu-header-copy {
    grid-column: 1 / -1;
  }

  .playback-menu-header-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .playback-menu-section,
  .playback-menu-section-select {
    width: 100%;
  }

  .playback-menu-status {
    align-items: flex-start;
    min-height: 0;
    padding: 9px 14px;
  }

  .playback-menu-status > span:last-child {
    white-space: normal;
  }

  .playback-menu-body {
    padding: 12px 14px;
  }

  .playback-menu-footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 12px max(12px, env(safe-area-inset-bottom));
  }

  .playback-menu-footer .btn {
    min-width: 0;
    padding-inline: 10px;
  }
}

@media (max-width: 1100px) {
  .tv-playlist-row { grid-template-columns: minmax(190px, 30%) minmax(240px, 1fr) 42px; }
  .tv-playlist-stack { display: none; }
  .tv-hero-image { left: 15%; width: 85%; }
  .tv-hero-copy { width: min(610px, 62vw); }
  .tv-hero-title { max-width: 46vw; font-size: clamp(2.1rem, 5vw, 3.5rem); }
  /* Keep the TV recommendations as one horizontal rail. Combining two
     explicit fractional columns with column auto-flow collapses those first
     tracks when later cards create fixed-width implicit columns. */
  .tv-recommendation-grid { grid-template-columns: none; }
  .tv-source-workspace { grid-template-columns: minmax(0, 1fr) minmax(340px, 42%); }
  .tv-source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tv-source-workspace.folders-only .tv-source-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.room-preview-item {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--control-bg);
}

.room-preview-item.current {
  border-color: color-mix(in srgb, var(--teal) 52%, var(--line));
}

.room-preview-item.queue-previous {
  border-color: color-mix(in srgb, var(--blue) 58%, var(--line));
}

.room-preview-item.queue-current {
  border-color: color-mix(in srgb, var(--teal) 70%, var(--line));
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--teal) 76%, transparent);
}

.room-preview-item.queue-next {
  border-color: color-mix(in srgb, var(--amber) 62%, var(--line));
}

.room-preview-item.watched {
  background: color-mix(in srgb, var(--green) 7%, var(--control-bg));
}

.room-preview-item.watched .room-preview-copy strong {
  color: var(--muted);
}

.room-preview-item > .btn {
  min-height: 38px;
}

.room-preview-index,
.room-preview-art {
  display: grid;
  place-items: center;
  width: 148px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: var(--panel) center / cover no-repeat;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  min-height: 38px;
}

.room-preview-item.current .room-preview-index {
  color: var(--teal);
}

.room-preview-index .icon {
  width: 15px;
  height: 15px;
}

.room-preview-art-wrap {
  position: relative;
  width: 148px;
  overflow: hidden;
  border-radius: 5px;
}

.room-preview-art-wrap .playlist-watch-marker {
  position: absolute;
  right: 5px;
  bottom: 5px;
  z-index: 4;
  box-shadow: 0 3px 10px rgb(0 0 0 / 45%);
}

.room-preview-art-tags,
.room-preview-art-actions {
  position: absolute;
  z-index: 3;
  top: 5px;
  display: flex;
  max-width: calc(100% - 10px);
  gap: 4px;
  pointer-events: none;
}

.room-preview-art-tags {
  top: auto;
  bottom: 5px;
  left: 5px;
  right: 5px;
  flex-wrap: nowrap;
  padding-right: 34px;
}

.room-preview-art-tags span {
  overflow: hidden;
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 999px;
  background: rgb(5 8 12 / 82%);
  box-shadow: 0 2px 8px rgb(0 0 0 / 38%);
  color: #f5f7f8;
  font-size: .58rem;
  font-weight: 820;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(5px);
}

.room-preview-art-tags span.good {
  border-color: color-mix(in srgb, var(--green) 68%, transparent);
  color: color-mix(in srgb, var(--green) 82%, white);
}

.room-preview-art-actions {
  right: 5px;
  justify-content: flex-end;
  pointer-events: auto;
}

.room-preview-art-actions .icon-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 9px;
  border-color: rgb(255 255 255 / 20%);
  background: rgb(5 8 12 / 84%);
  box-shadow: 0 2px 8px rgb(0 0 0 / 42%);
  color: #fff;
  backdrop-filter: blur(5px);
}

.room-preview-art-tags span:nth-child(n + 3) {
  display: none;
}

.room-preview-copy {
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.room-preview-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
}

.room-preview-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.73rem;
}

.room-preview-facts span:not(:last-child)::after {
  content: "";
}

.room-preview-summary {
  display: -webkit-box;
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--soft);
  font-size: 0.7rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (max-width: 560px) {
  .room-preview-item {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .room-preview-item > .status-pill,
  .room-preview-item > .btn {
    grid-column: 2;
    justify-self: start;
  }

  .room-preview-copy strong {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

.chat-log {
  display: grid;
  align-content: start;
  gap: 8px;
  height: 190px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--text);
}

.chat-message {
  display: grid;
  gap: 2px;
}

.chat-message strong {
  font-size: 0.75rem;
  color: var(--amber);
}

.chat-message span {
  overflow-wrap: anywhere;
}

.chat-form {
  flex-wrap: nowrap;
}

.chat-form input {
  flex: 1 1 auto;
}

.chat-form button {
  flex: none;
}

.room-utility-panel {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.room-chat-button {
  position: relative;
}

.room-chat-button.has-unread {
  border-color: color-mix(in srgb, var(--amber) 68%, var(--line));
  color: var(--amber);
}

.chat-unread-count {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  padding: 0 4px;
  border: 2px solid var(--panel);
  border-radius: 9px;
  background: var(--amber);
  color: #171207;
  font-size: 0.6rem;
  font-weight: 850;
  line-height: 1;
}

.chat-sheet {
  grid-template-rows: auto minmax(160px, 1fr) auto;
  width: min(640px, 100%);
  height: min(720px, calc(100dvh - 20px));
  overflow: hidden;
}

.chat-sheet-log {
  height: auto;
  min-height: 0;
  padding: 10px;
  overscroll-behavior: contain;
}

.chat-message {
  justify-self: start;
  max-width: min(86%, 480px);
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.chat-message.local {
  justify-self: end;
  border-color: color-mix(in srgb, var(--teal) 45%, var(--line));
}

.chat-message > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.chat-message time {
  color: var(--muted);
  font-size: 0.68rem;
}

.chat-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  min-height: 100%;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.chat-empty strong {
  color: var(--soft);
}

.chat-sheet .chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  margin: 0;
}

.chat-sheet .chat-form input,
.chat-sheet .chat-form button {
  min-height: 42px;
}

.video-stats-sheet {
  width: min(920px, 100%);
  height: min(760px, calc(100dvh - 20px));
  overflow-x: hidden;
  overflow-anchor: none;
}

.video-stats-content {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.video-stats-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.video-stats-head-actions .btn {
  min-height: 40px;
}

.stats-loading {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.stats-surface-summary {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(110deg, color-mix(in srgb, var(--panel-strong) 92%, var(--accent) 8%), var(--panel-strong));
}

.stats-surface-summary.good { border-left-color: var(--green); }
.stats-surface-summary.warn { border-left-color: var(--amber); }

.stats-surface-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 9px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
}

.stats-surface-icon svg { width: 20px; height: 20px; }

.stats-surface-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.stats-surface-copy small,
.stats-surface-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: .7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-surface-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: .92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-health-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 6px;
  background: var(--panel-strong);
}

.processing-health-alert.warn { border-left-color: var(--amber); }
.processing-health-alert.bad { border-left-color: var(--danger); }
.processing-health-alert svg { width: 18px; height: 18px; flex: 0 0 auto; color: currentColor; }
.processing-health-alert.warn svg { color: var(--amber); }
.processing-health-alert.bad svg { color: var(--danger); }
.processing-health-alert div { display: grid; gap: 2px; min-width: 0; }
.processing-health-alert strong { color: var(--text); font-size: .82rem; }
.processing-health-alert small { color: var(--muted); font-size: .72rem; line-height: 1.35; }
.processing-health-action {
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.processing-health-action:hover strong,
.processing-health-action:focus-visible strong { color: var(--accent); text-decoration: underline; }
.processing-health-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stats-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.stats-kpi {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 78px;
  padding: 9px 11px;
  border-left: 3px solid var(--line);
  background: var(--panel-strong);
}

.stats-kpi + .stats-kpi {
  border-top: 0;
}

.stats-kpi.good { border-left-color: var(--green); }
.stats-kpi.warn { border-left-color: var(--amber); }
.stats-kpi.bad { border-left-color: var(--danger); }

.stats-kpi span,
.stats-kpi small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-kpi strong {
  overflow: hidden;
  color: var(--text);
  font-size: 1.06rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 22px;
  min-width: 0;
}

.stats-timeline {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 94%, var(--accent) 6%);
}

.stats-timeline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.stats-timeline-head h3 { margin: 0; color: var(--soft); }
.stats-timeline-head p { margin: 2px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.35; }
.stats-timeline ol { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.stats-timeline li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 6px 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.stats-timeline li:first-child { border-top: 0; }
.stats-timeline li > div { display: grid; min-width: 0; gap: 1px; }
.stats-timeline strong,
.stats-timeline small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-timeline strong { color: var(--text); font-size: .76rem; }
.stats-timeline small,
.stats-timeline time { color: var(--muted); font-size: .68rem; }
.stats-timeline time { padding-left: 8px; font-variant-numeric: tabular-nums; }
.stats-timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted) 14%, transparent); }
.stats-timeline-dot.good { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 16%, transparent); }
.stats-timeline-dot.warn { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 16%, transparent); }

.stats-section {
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.stats-section h3 {
  margin-bottom: 4px;
  color: var(--soft);
}

.stats-section dl,
.stats-section dl > div {
  margin: 0;
}

.stats-section dl > div {
  display: grid;
  grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 62%, transparent);
}

.stats-section dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.stats-section dd {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.76rem;
  text-align: right;
}

.stats-processing-notices {
  display: grid;
  gap: 4px;
  margin-top: 7px;
}

.stats-processing-notices span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--amber);
  font-size: .7rem;
}

.stats-processing-notices svg { width: 14px; height: 14px; flex: 0 0 auto; }

@media (max-width: 680px) {
  .stats-surface-summary { grid-template-columns: 36px minmax(0, 1fr); }
  .stats-surface-summary > .status-pill { display: none; }
  .stats-surface-icon { width: 36px; height: 36px; }
  .stats-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-sections { grid-template-columns: minmax(0, 1fr); }
  .video-stats-head-actions .btn span { display: none; }
  .video-stats-head-actions .btn { width: 40px; padding: 0; }
  .stats-timeline li { grid-template-columns: 10px minmax(0, 1fr); }
  .stats-timeline time { display: none; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .video-stats-layer { align-items: center; }
  .video-stats-sheet {
    width: min(920px, calc(100% - 16px));
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
    border: 1px solid var(--line);
    border-radius: 8px;
  }
}

/* Mid-height handhelds and tablets should read as one continuous theater surface. */
@media (orientation: landscape) and (min-width: 840px) and (min-height: 561px) and (max-height: 800px) {
  .playback-menu-layer {
    grid-template-columns: minmax(0, 24%) minmax(0, 76%);
  }

  .playback-menu {
    grid-column: 2;
    width: 100%;
    max-width: 100%;
  }

  .playback-menu-header {
    gap: 12px;
    padding: 14px 18px 10px;
  }

  .playback-menu-header-copy {
    flex: 1 1 auto;
  }

  .playback-menu-header-actions {
    flex: 0 1 min(230px, 42%);
    max-width: 42%;
  }

  .playback-menu-section,
  .playback-menu-section-select {
    width: 100%;
    min-width: 0;
  }

  .playback-menu-status {
    min-height: 40px;
    padding: 6px 18px;
  }

  .playback-menu-body {
    padding: 12px 18px;
  }

  .playback-menu-grid {
    gap: 10px 12px;
  }

  .playback-menu-grid select {
    min-height: 44px;
    height: 44px;
  }

  .playback-menu-footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 9px 18px max(9px, env(safe-area-inset-bottom));
  }

  .playback-menu-footer .btn {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .room-active .video-shell {
    height: 100%;
    aspect-ratio: auto;
    background: #000;
  }

  .room-active .video-shell :is(video, .stereo-canvas, .xr-canvas) {
    background: #000;
  }

  .room-active .room-audio-bar {
    border-top-color: color-mix(in srgb, var(--line) 78%, transparent);
  }
}

@media (min-width: 840px) {
  .room-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .room-active .chat-log {
    height: auto;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .room-active .room-body {
    grid-template-rows: minmax(0, 1fr);
  }

  .room-active .room-body > div:last-child {
    display: grid;
    grid-template-rows: auto;
  }

  .chat-sheet-layer {
    align-items: center;
  }

  .chat-sheet {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(100px, 1fr) auto;
    width: min(720px, calc(100% - 24px));
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
    border: 1px solid var(--line);
    border-radius: 8px;
  }
}

@media (max-width: 520px) {
  .chat-sheet {
    height: calc(100dvh - 8px);
    max-height: calc(100dvh - 8px);
  }
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--subtle-border);
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
}

.nav-btn {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 50px;
  padding: 5px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.nav-btn span:first-child {
  line-height: 1;
}

.nav-btn .icon {
  width: 20px;
  height: 20px;
}

.nav-btn.active {
  background: var(--selected-bg);
  color: var(--selected-text);
}

.split {
  display: grid;
  gap: 12px;
}

.connection-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.device-row {
  grid-template-columns: minmax(220px, .9fr) minmax(0, 1.7fr);
  gap: 16px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--panel-surface) 78%, var(--subtle-bg));
}

.people-device-list,
.people-list {
  display: grid;
  gap: 7px;
}

.people-primary-panel,
.people-secondary-panel {
  display: grid;
  gap: 12px;
}

.people-section-title { margin: 0; }

.people-device-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.people-filter {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(70px, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--subtle-border);
  border-radius: 8px;
  background: var(--control-bg);
}

.people-filter-option {
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
}

.people-filter-option.active {
  border-color: var(--selected-border);
  background: var(--selected-bg);
  color: var(--selected-text);
}

.people-result-count {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--subtle-border);
  border-radius: 999px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 750;
  white-space: nowrap;
}

.device-row-identity {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.device-row-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.device-row-copy strong,
.device-row-copy .meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-row-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.device-row-capabilities span {
  padding: 2px 6px;
  border: 1px solid var(--subtle-border);
  border-radius: var(--badge-radius, 5px);
  color: var(--muted);
  font-size: .62rem;
  font-weight: 750;
  line-height: 1.2;
}

.device-row-actions {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.device-row-quick-actions {
  justify-content: flex-end;
  gap: 6px;
}

.device-row-quick-actions .btn,
.device-row-share .btn { white-space: nowrap; }

.device-row-share {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  width: 100%;
}

.device-row-share select { min-width: 0; }

.appearance-interface-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.appearance-interface-choice > div { display: grid; gap: 3px; min-width: 0; }
.appearance-interface-choice p { margin: 0; color: var(--muted); font-size: .74rem; line-height: 1.4; }
.appearance-interface-help { margin-top: 7px; }

.toggle-choice {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  cursor: pointer;
}

.toggle-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-track {
  display: block;
  width: 46px;
  height: 26px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--control-bg);
  transition: background 150ms ease, border-color 150ms ease;
}

.toggle-track::after {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  transition: transform 150ms ease, background 150ms ease;
}

.toggle-choice input:checked + .toggle-track { border-color: var(--selected-border); background: var(--selected-bg); }
.toggle-choice input:checked + .toggle-track::after { background: var(--teal); transform: translateX(20px); }
.toggle-choice input:focus-visible + .toggle-track { outline: 3px solid var(--focus-ring); outline-offset: 3px; }

.device-row-icon,
.friend-row-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--selected-bg);
  color: var(--teal);
}

.device-row-icon .icon,
.friend-row-avatar .icon { width: 19px; height: 19px; }

.friend-row {
  grid-template-columns: 38px minmax(0, 1fr) auto 18px;
  width: 100%;
  background: var(--subtle-bg);
  color: var(--text);
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.friend-row:hover,
.friend-row:focus-visible {
  border-color: var(--selected-border);
  background: var(--selected-bg);
}

.friend-row:active { transform: scale(.995); }
.friend-row-copy { display: grid; min-width: 0; gap: 3px; }
.friend-row-copy strong,
.friend-row-copy .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-row > .icon { width: 17px; color: var(--muted); }
.provider-friend-badge { display: inline-flex; margin-left: 5px; padding: 2px 5px; border: 1px solid var(--selected-border); border-radius: 999px; color: var(--teal); font-size: .58rem; font-style: normal; vertical-align: middle; }
.provider-request-row { grid-template-columns: 38px minmax(0, 1fr) auto; }
.provider-request-actions { display: flex; gap: 6px; }
.people-provider-invites,
.people-provider-requests { display: grid; gap: 13px; }

.account-room-social-card { display: grid; gap: 13px; }
.account-room-social-control { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--subtle-bg); }
.account-room-social-control > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 9px; background: var(--selected-bg); color: var(--teal); }
.account-room-social-control > div { display: grid; min-width: 0; gap: 2px; }
.account-room-social-control small { color: var(--muted); }

.aligned-field-grid > label {
  grid-template-rows: auto 44px auto;
  align-content: start;
}

.aligned-field-grid .field-label { align-self: end; min-height: 1.2em; }
.field-help-placeholder { visibility: hidden; }

.account-access-overview { gap: 12px; }
.device-version-panel { display: grid; gap: 12px; }
.device-version-matrix { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.device-version-head,
.device-version-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(110px, .8fr) minmax(104px, .62fr) minmax(104px, .62fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 9px 12px;
}
.device-version-head { background: var(--panel-strong); color: var(--muted); font-size: .64rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.device-version-row { border-top: 1px solid color-mix(in srgb, var(--line) 68%, transparent); color: var(--soft); font-size: .74rem; }
.device-version-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-version-name { display: flex; align-items: center; gap: 9px; }
.device-version-name > i { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 7px; background: var(--selected-bg); color: var(--accent); }
.device-version-name > i svg { width: 17px; height: 17px; }
.device-version-name > span { display: grid; min-width: 0; gap: 1px; }
.device-version-name strong,
.device-version-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-version-name small { color: var(--muted); font-size: .64rem; }
.device-version-row code { color: var(--text); font: inherit; font-variant-numeric: tabular-nums; }
.device-version-row em { font-style: normal; }

@media (max-width: 680px) {
  .device-version-head { display: none; }
  .device-version-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px; }
  .device-version-name { grid-row: 1 / 3; }
  .device-version-row > span:nth-child(2) { display: none; }
  .device-version-row > span:nth-child(3),
  .device-version-row > span:nth-child(4) { justify-self: end; }
}
.account-access-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  min-height: 132px;
  overflow: hidden;
  position: relative;
}

.account-access-card::after {
  content: "";
  position: absolute;
  inset: auto -34px -50px auto;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--selected-bg);
  pointer-events: none;
}

.account-access-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--selected-border);
  border-radius: 10px;
  background: var(--selected-bg);
  color: var(--teal);
}

.account-access-copy { display: grid; min-width: 0; gap: 3px; }
.account-access-copy h2,
.account-access-copy p { margin: 0; }
.account-access-copy h2 { font-size: 1.04rem; }
.account-access-copy p { color: var(--muted); font-size: .76rem; line-height: 1.4; }
.account-access-eyebrow { color: var(--muted); font-size: .65rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.account-access-actions { display: grid; justify-items: end; gap: 8px; z-index: 1; }
.account-vault-form { display: grid; grid-template-columns: minmax(150px, 1fr) auto; gap: 7px; align-items: end; grid-column: 2 / -1; z-index: 1; }
.account-vault-form label { min-width: 0; }

.connector-authorization-card { display: grid; gap: 14px; }
.connector-authorization-card .section-title > .icon { width: 28px; height: 28px; color: var(--teal); }
.connector-code-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.connector-code-form .action-row { align-self: end; }
.connector-authorization-review { display: grid; gap: 12px; }
.connector-authorization-review h3,
.connector-authorization-review p { margin: 0; }
.connector-scope-list { display: flex; flex-wrap: wrap; gap: 6px; }

.connection-sheet { width: min(680px, calc(100vw - 28px)); }
.connection-sheet-body { display: grid; gap: 10px; }
.sheet-eyebrow { color: var(--muted); font-size: .64rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.connection-alias-form,
.connection-action-card,
.connection-danger-zone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.connection-action-card > div:first-child,
.connection-danger-zone > div:first-child { display: grid; gap: 3px; align-self: center; }
.connection-action-card > div:first-child > span,
.connection-danger-zone > div:first-child > span { color: var(--muted); font-size: .72rem; line-height: 1.35; }
.connection-action-card .device-share-controls { grid-column: 1 / -1; width: 100%; }
.connection-danger-zone { border-color: color-mix(in srgb, var(--danger) 28%, var(--line)); }

@media (max-width: 700px) {
  .people-header-actions { grid-template-columns: minmax(0, 1fr) 44px !important; width: 100%; }
  .people-section-title { align-items: flex-start; }
  .people-devices-panel .people-section-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .people-device-toolbar { width: 100%; justify-content: space-between; }
  .people-filter { flex: 1 1 auto; }
  .device-row { grid-template-columns: 1fr; }
  .device-actions { justify-items: stretch; }
  .device-actions .action-row { flex-wrap: nowrap; overflow-x: auto; }
  .account-access-card { grid-template-columns: 44px minmax(0, 1fr); min-height: 0; }
  .account-access-card > .status-pill,
  .account-access-actions { grid-column: 2; justify-self: start; }
  .account-vault-form { grid-column: 1 / -1; }
  .connector-code-form { grid-template-columns: 1fr; }
  .connection-alias-form,
  .connection-action-card,
  .connection-danger-zone { grid-template-columns: 1fr; align-items: stretch; }
  .processing-location-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 9px; }
  .processing-location-toggle { grid-column: 1 / -1; width: 100%; }
  .processing-location-toggle button { min-height: 44px; }
  .processing-location-state { grid-column: 1 / -1; text-align: left; }
  .processing-fixed-location { grid-column: 2; grid-row: 1; }
  .processing-offline-card { grid-template-columns: 34px minmax(0, 1fr); }
  .processing-offline-icon { width: 34px; height: 34px; }
  .processing-offline-card .btn { grid-column: 1 / -1; width: 100%; min-height: 44px; }
}

@media (max-width: 430px) {
  .processing-workspace { gap: 11px; }
  .processing-intro { gap: 10px; }
  .processing-intro small { max-width: 34ch; }
  .processing-location-copy small { white-space: normal; }
  .processing-editor { padding: 12px; }
  .processing-editor > header { align-items: start; flex-direction: column; gap: 5px; }
  .processing-editor > header small { max-width: none; text-align: left; }
  .processing-editor-grid { grid-template-columns: 1fr; }
}

.inbox-list {
  display: grid;
  gap: 0;
}

.inbox-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
}

.inbox-row.unread {
  background: var(--selected-bg);
}

.inbox-row-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--teal);
}

.inbox-row-icon .icon {
  width: 17px;
  height: 17px;
}

.inbox-row-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.inbox-row-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.inbox-row-heading strong,
.inbox-row-copy > span {
  overflow-wrap: anywhere;
}

.inbox-sender {
  color: var(--soft);
  font-size: 0.74rem;
}

.unread-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
}

.inbox-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.inbox-security {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--selected-border);
  border-radius: 8px;
  background: var(--selected-bg);
  color: var(--soft);
  font-size: 0.8rem;
}

.inbox-security .icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--teal);
}

.inbox-security.compact {
  font-size: 0.75rem;
}

.inbox-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
}

.inbox-diagnostics {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.inbox-diagnostics > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.inbox-diagnostics > summary::-webkit-details-marker { display: none; }
.inbox-diagnostics > summary > span { display: grid; gap: 2px; }
.inbox-diagnostics > summary small { font-size: .78rem; }
.inbox-diagnostics > summary > .icon { transition: transform .18s ease; }
.inbox-diagnostics[open] > summary > .icon { transform: rotate(90deg); }
.inbox-diagnostics > .inbox-list { margin-top: 10px; opacity: .82; }

.message-sheet {
  width: min(520px, 100%);
}

.inbox-row:last-child {
  border-bottom: 0;
}

.connector-sources {
  margin-top: 18px;
}

.connector-sources.is-browsing {
  margin-top: 0;
}

.connector-sources > .section-title {
  align-items: center;
}

.connector-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1 1 auto;
  min-width: min(100%, 22rem);
}

.connector-browse-toolbar {
  gap: 10px;
  margin-bottom: 9px;
}

.connector-browse-context {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 750;
  white-space: nowrap;
}

.connector-browse-context .icon {
  width: 17px;
  height: 17px;
}

.connector-search {
  display: flex;
  align-items: center;
  width: min(320px, 100%);
  flex: 1 1 220px;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--muted);
}

.connector-search:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(25, 194, 167, 0.13);
}

.connector-search .icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.connector-search input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0 0 0 9px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.connector-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-bottom: 9px;
  overflow-x: auto;
  color: var(--muted);
  white-space: nowrap;
  scrollbar-width: none;
}

.connector-breadcrumbs::-webkit-scrollbar {
  display: none;
}

.connector-breadcrumbs button {
  padding: 5px 3px;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  font-weight: 700;
}

body.android-tv.tv-mode .connector-breadcrumbs button {
  min-height: 44px;
  padding: 8px 6px;
}

.connector-breadcrumbs strong {
  overflow: hidden;
  color: var(--soft);
  text-overflow: ellipsis;
}

.connector-breadcrumbs .icon {
  width: 15px;
  height: 15px;
}

.connector-folder-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 22px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.connector-folder-row:hover,
.connector-folder-row:focus-visible {
  border-color: rgba(25, 194, 167, 0.65);
  background: rgba(25, 194, 167, 0.08);
}

.folder-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(240, 193, 75, 0.13);
  color: var(--amber);
}

.folder-icon.has-art {
  background-position: center;
  background-size: cover;
}

.connector-result-summary,
.connector-loading {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.82rem;
}

.connector-loading {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 2px;
}

.connector-loading.compact {
  padding: 4px 2px;
  font-size: .74rem;
}

.connector-list {
  display: grid;
  gap: 8px;
}

.connector-file-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-surface);
}

.connector-file-row.queued {
  border-color: var(--selected-border);
  background: var(--selected-bg);
}

.connector-file-row.locally-available:not(.queued) {
  border-color: color-mix(in srgb, var(--teal) 58%, var(--line));
  background: color-mix(in srgb, var(--teal) 4%, var(--panel-surface));
}

.connector-file-row.metadata-refreshing {
  background-image: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 3%, transparent), transparent);
}

.metadata-refresh-badge {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  width: max-content;
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--subtle-border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-strong) 90%, var(--accent) 10%);
  color: var(--soft);
  font-size: .57rem !important;
  font-style: normal;
  line-height: 1;
}

.metadata-refresh-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: metadata-refresh-pulse 1.6s ease-in-out infinite;
}

@keyframes metadata-refresh-pulse {
  0%, 100% { opacity: .42; transform: scale(.86); }
  50% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .metadata-refresh-badge i { animation: none; }
}

.connector-use-control {
  position: relative;
  display: inline-block;
}

.connector-use-control > summary { list-style: none; }
.connector-use-control > summary::-webkit-details-marker { display: none; }
.connector-use-trigger { cursor: pointer; }
.connector-use-trigger .icon { transition: transform 140ms ease; }
.connector-use-control[open] .connector-use-trigger {
  border-color: var(--selected-border);
  background: var(--selected-bg);
}
.connector-use-control[open] .connector-use-trigger .icon { transform: rotate(180deg); }
.connector-use-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  min-width: 148px;
  overflow: hidden;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .32);
}
.connector-use-control:not(.compact) .connector-use-menu { top: auto; bottom: calc(100% + 6px); }
.connector-use-menu button {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.connector-use-menu button:hover,
.connector-use-menu button:focus-visible { background: var(--selected-bg); }
.connector-use-menu button:disabled { opacity: .42; cursor: not-allowed; }
.connector-use-menu .icon { width: 17px; height: 17px; color: var(--teal); }

.connector-file-preview {
  display: grid;
  place-items: center;
  width: 72px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 6px;
  background: var(--panel-strong) center / cover no-repeat;
  color: var(--muted);
  border: 0;
  padding: 0;
  cursor: pointer;
}

.connector-file-preview .icon {
  width: 20px;
  height: 20px;
}

.connector-file-info {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.connector-folder-summary {
  color: var(--muted);
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
}

.connector-file-detail {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.media-folder-summary {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 178px;
  overflow: hidden;
  border-block: 1px solid var(--subtle-border);
  background: var(--panel-strong) center / cover no-repeat;
  background-image: var(--folder-summary-art);
}

.media-folder-summary.compact {
  min-height: 132px;
  margin-bottom: 10px;
}

.media-folder-summary-shade {
  position: absolute;
  /* Cover the one-pixel borders even after fractional Android/PWA layout. */
  inset: -1px 0;
  background: linear-gradient(90deg, rgb(0 0 0 / 88%) 0%, rgb(0 0 0 / 64%) 48%, rgb(0 0 0 / 22%) 100%), linear-gradient(0deg, rgb(0 0 0 / 58%), transparent 58%);
}

.media-folder-summary-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 6px;
  width: min(760px, 100%);
  padding: 22px;
}

.media-folder-summary.compact .media-folder-summary-copy {
  padding: 16px;
}

.media-folder-summary-copy > span {
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.media-folder-summary-copy h2,
.media-folder-summary-copy p {
  margin: 0;
}

.media-folder-summary-copy h2 {
  font-size: 1.55rem;
}

.media-folder-summary-copy > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.media-folder-summary-copy b,
.media-details-badges span {
  padding: 3px 6px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 4px;
  background: rgb(0 0 0 / 38%);
  color: var(--soft);
  font-size: 0.64rem;
}

.media-folder-summary-copy p {
  display: -webkit-box;
  overflow: hidden;
  color: var(--soft);
  font-size: 0.78rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.media-details-layer {
  align-items: center;
}

.media-details-sheet {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(960px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.media-details-sheet .share-sheet-head,
.media-details-actions {
  grid-column: 1 / -1;
}

.media-details-head-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.media-details-body {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  min-height: 0;
  gap: 14px;
  overflow: hidden;
}

.media-details-rail {
  display: grid;
  align-content: start;
  min-width: 0;
  min-height: 0;
  gap: 11px;
}

.media-details-scroll {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.media-details-kicker {
  color: var(--teal);
  font-size: 0.7rem;
  font-weight: 800;
}

.media-details-visual {
  position: relative;
  align-self: start;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 6px;
  background: var(--panel-strong);
}

.media-details-art-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--teal) 13%, transparent), transparent 42%),
    linear-gradient(145deg, var(--panel-strong), var(--panel));
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.media-details-art-placeholder .icon {
  width: 28px;
  height: 28px;
  color: var(--teal);
  opacity: 0.72;
}

.media-details-art {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-details-visual.artwork-missing .media-details-art {
  display: none;
}

.media-details-copy {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: 12px;
}

.media-details-still {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 46%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgb(255 255 255 / 42%);
  border-radius: 5px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgb(0 0 0 / 52%);
  z-index: 2;
}

.media-details-badges,
.media-details-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.media-details-actions {
  align-items: center;
  justify-content: flex-end;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--subtle-border);
  background: var(--panel);
}

.media-details-actions .btn {
  min-height: 42px;
}

.related-media-layer {
  align-items: center;
}

.related-media-sheet {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(980px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.related-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  min-height: 0;
  padding: 4px;
  overflow-y: auto;
}

.related-media-card {
  position: relative;
  display: grid;
  align-content: end;
  aspect-ratio: 16 / 10;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--subtle-border);
  border-radius: 7px;
  background: var(--panel-strong) center / cover no-repeat;
  color: var(--text);
  text-align: left;
}

.related-media-card.current {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal);
}

.related-media-card.previous {
  border-color: color-mix(in srgb, var(--blue) 68%, var(--subtle-border));
}

.related-media-card.next {
  border-color: color-mix(in srgb, var(--amber) 78%, var(--subtle-border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 45%, transparent);
}

.related-media-card.current:disabled {
  opacity: 1;
}

.related-media-card > span:last-child {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 3px;
  padding: 14px;
}

.related-media-card small,
.related-media-card em {
  overflow: hidden;
  color: var(--soft);
  font-size: 0.7rem;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-media-card strong {
  overflow: hidden;
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-media-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--subtle-border);
}

.home-next-episodes {
  display: grid;
  gap: 12px;
}

.home-next-episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.home-next-episode {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--subtle-border);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--text);
  text-align: left;
}

.home-next-episode-art {
  position: relative;
  align-self: stretch;
  min-height: 78px;
  background: center / cover no-repeat;
}

.home-next-episode > span:last-child {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 10px 12px;
}

.home-next-episode small,
.home-next-episode em {
  overflow: hidden;
  color: var(--soft);
  font-size: 0.7rem;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-next-episode strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-next-episode em {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--teal);
}

.home-next-episode em .icon {
  width: 13px;
  height: 13px;
}

.media-details-badges .rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-color: color-mix(in srgb, var(--amber) 45%, transparent);
  color: var(--amber);
}

.media-details-badges .rating svg {
  width: 12px;
  height: 12px;
}

.media-details-overview {
  margin: 0;
  color: var(--soft);
  line-height: 1.48;
}

.media-details-cast {
  display: grid;
  gap: 3px;
}

.media-details-cast span {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.media-details-variants {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.media-details-variants > span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  text-transform: uppercase;
}

.media-details-variants > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 5px;
  max-height: 176px;
  overflow-y: auto;
  padding-right: 2px;
}

.media-details-variants button {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--subtle-border);
  border-radius: 5px;
  background: var(--subtle-bg);
  color: var(--text);
  text-align: left;
}

.media-details-variants button.active {
  border-color: var(--selected-border);
  background: var(--selected-bg);
}

.media-details-variants button :is(strong, small) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-details-variants button small { color: var(--muted); }

.connector-file-variants {
  display: flex !important;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
  white-space: normal !important;
}

.connector-file-variants b {
  padding: 2px 5px;
  border: 1px solid var(--subtle-border);
  border-radius: 3px;
  background: var(--subtle-bg);
  color: var(--soft);
  font-size: 0.62rem;
}

.connector-file-variants .download-progress-badge,
.tv-source-media-copy .download-progress-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-color: color-mix(in srgb, var(--teal) 58%, var(--subtle-border));
  background: color-mix(in srgb, var(--teal) 14%, var(--panel-strong));
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}

.download-progress-badge .icon {
  width: 0.78rem;
  height: 0.78rem;
}

.media-download-summary {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--teal) 38%, var(--subtle-border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--teal) 7%, var(--panel-strong));
}

.media-download-summary-head,
.media-local-copy {
  display: flex;
  align-items: center;
  gap: 10px;
}

.media-download-summary-head > span:first-child {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--subtle-bg);
  color: var(--teal);
}

.media-download-summary-head > div,
.media-local-copy > div {
  display: grid;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
}

.media-download-summary :is(small, .media-local-copy span) {
  color: var(--muted);
  font-size: 0.72rem;
}

.media-download-summary-head > b {
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}

.media-local-copy {
  padding-top: 9px;
  border-top: 1px solid var(--subtle-border);
}

.local-system-workspace,
.local-download-list,
.local-copy-list {
  display: grid;
  gap: 14px;
}

.active-download-dock {
  position: fixed;
  z-index: 86;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(76px + env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
  width: min(520px, calc(100vw - 28px));
  padding: 10px;
  border: 1px solid var(--subtle-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 16px 48px rgb(0 0 0 / 34%);
  backdrop-filter: blur(18px);
}

.active-download-dock-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

.active-download-dock-row > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.active-download-dock-row :is(strong, span) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-download-dock-row small {
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.active-download-dock-row span,
.active-download-more {
  color: var(--muted);
  font-size: 0.74rem;
}

.active-download-dock-row .progress {
  height: 4px;
  margin-top: 3px;
}

.active-download-dock-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--teal);
  background: var(--subtle-bg);
}

.active-download-more {
  padding-left: 48px;
}

.local-system-workspace {
  grid-template-columns: minmax(0, 1fr);
}

.local-default-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.local-default-summary > span {
  display: grid;
  gap: 2px;
  padding: 11px 12px;
  border: 1px solid var(--subtle-border);
  border-radius: 8px;
  background: var(--panel-strong);
}

.local-default-summary small,
.local-download-row span,
.local-copy-row span {
  color: var(--muted);
  font-size: 0.75rem;
}

.local-download-row,
.local-copy-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px;
  border: 1px solid var(--subtle-border);
  border-radius: 9px;
  background: var(--panel-strong);
}

.local-copy-row {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

button.local-copy-art {
  border: 0;
  cursor: pointer;
}

.local-download-row > div,
.local-copy-row > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.local-download-icon,
.local-copy-art {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--subtle-bg);
  color: var(--teal);
}

.local-download-row .progress {
  height: 5px;
  margin-top: 3px;
}

@media (max-width: 560px) {
  .active-download-dock {
    right: 10px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    width: calc(100vw - 20px);
  }
  .active-download-dock-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .active-download-dock-row > b { display: none; }
  .active-download-dock-row > .btn { grid-column: 2; justify-self: start; }
  .local-default-summary { grid-template-columns: minmax(0, 1fr); }
  .local-download-row,
  .local-copy-row { grid-template-columns: auto minmax(0, 1fr); }
  .local-download-row > :last-child,
  .local-copy-row > .btn { grid-column: 2; justify-self: start; }
  .media-local-copy { align-items: flex-start; flex-direction: column; }
}

.media-details-facts {
  display: grid;
  margin: 0;
  border-top: 1px solid var(--subtle-border);
}

.media-details-facts > div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--subtle-border);
  font-size: 0.72rem;
}

.media-details-facts dt {
  color: var(--muted);
}

.media-details-facts dd {
  margin: 0;
  text-align: right;
}

@media (max-width: 720px), (orientation: landscape) and (max-height: 560px) {
  .media-details-sheet {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 12px);
    padding: 10px;
  }

  .media-details-body {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr);
    gap: 10px;
  }

  .media-details-sheet .share-sheet-head {
    top: -10px;
    margin: -10px -10px 0;
  }

  .media-folder-summary {
    min-height: 145px;
  }
}

@media (max-width: 560px) and (orientation: portrait) {
  .media-details-body {
    display: block;
    overflow-y: auto;
    padding-right: 2px;
  }

  .media-details-rail {
    margin-bottom: 13px;
  }

  .media-details-scroll {
    overflow: visible;
    padding-right: 0;
  }

  .media-details-variants > div {
    max-height: none;
  }

  .media-details-actions .btn {
    flex: 1 1 calc(50% - 4px);
  }
}

.connector-file-info strong,
.connector-file-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connector-file-title {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 8px;
}

.connector-file-title > span {
  overflow: hidden;
  flex: 1 1 auto;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connector-file-title > i {
  flex: 0 0 auto;
  color: color-mix(in srgb, var(--text) 58%, transparent);
  font-size: .78em;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.connector-file-title > em {
  flex: 0 0 auto;
  color: var(--amber);
  font-size: .72em;
  font-style: normal;
}

.connector-file-title > em.local-availability-badge { color: color-mix(in srgb, var(--teal) 72%, white); }

.connector-file-variants b.secondary {
  border-color: color-mix(in srgb, var(--muted) 38%, transparent);
  background: color-mix(in srgb, var(--muted) 12%, transparent);
  color: var(--muted);
}

.media-editor-layer { align-items: center; z-index: 90; }

.media-editor-sheet {
  grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr);
  width: min(980px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.media-editor-sheet .share-sheet-head,
.media-editor-alert,
.media-editor-loading,
.media-editor-form,
.media-editor-actions { grid-column: 1 / -1; }

.media-editor-form {
  display: grid;
  grid-template-columns: minmax(250px, .72fr) minmax(0, 1.28fr);
  gap: 16px;
}

.media-editor-artwork,
.media-editor-fields { display: grid; align-content: start; gap: 10px; min-width: 0; }

.media-editor-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
}

.media-editor-preview.selected { border-color: var(--selected-border); }
.media-editor-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-editor-preview > span { display: grid; place-items: center; gap: 7px; color: var(--muted); }
.media-editor-preview > span .icon { width: 28px; height: 28px; }
.media-editor-tool-row { display: flex; flex-wrap: wrap; gap: 7px; }
.media-editor-tool-row .btn { flex: 1 1 120px; }
.media-editor-artwork > p { color: var(--muted); font-size: .66rem; line-height: 1.45; }

.media-editor-candidates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.media-editor-candidates button { display: grid; gap: 4px; padding: 4px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--subtle-bg); color: var(--muted); font-size: .62rem; }
.media-editor-candidates button.selected { border-color: var(--selected-border); background: var(--selected-bg); color: var(--selected-text); }
.media-editor-candidates img { width: 100%; aspect-ratio: 16 / 9; border-radius: 3px; object-fit: cover; }

.media-editor-fields label { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: .68rem; font-weight: 750; }
.media-editor-fields :is(input, textarea) { width: 100%; min-width: 0; color: var(--text); background: var(--control-bg); }
.media-editor-fields textarea { resize: vertical; }
.media-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.media-editor-grid.thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.media-editor-origin { display: grid; gap: 9px; min-width: 0; margin: 2px 0 0; padding: 10px; border: 1px solid var(--line); border-radius: 7px; }
.media-editor-origin legend { padding: 0 5px; color: var(--text); font-size: .72rem; font-weight: 800; }
.media-editor-origin > p { color: var(--muted); font-size: .64rem; line-height: 1.4; }
.media-editor-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }

@media (max-width: 680px) and (orientation: portrait) {
  .media-editor-form { grid-template-columns: minmax(0, 1fr); }
}

@media (orientation: landscape) and (max-height: 560px) {
  .media-details-body {
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
  }

  .media-editor-sheet { width: calc(100% - 16px); }
  .media-editor-form { grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); }
}

.connector-file-info span {
  color: var(--muted);
  font-size: 0.8rem;
}

.connector-file-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.inline-alert {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--soft);
}

.inline-alert.bad {
  border-color: rgba(255, 105, 97, 0.58);
  background: rgba(255, 105, 97, 0.12);
  color: #ffc1bd;
}

.room-start-error {
  display: grid;
  gap: 4px;
}

.room-start-error span {
  color: inherit;
  opacity: 0.9;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  line-height: 1.3;
}

.check-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

:root[data-theme="field-manual"] :is(.status-pill.good, .status-pill.warn, .status-pill.bad),
:root[data-theme="lcd-blue"] :is(.status-pill.good, .status-pill.warn, .status-pill.bad),
:root[data-theme="cartridge-pop"] :is(.status-pill.good, .status-pill.warn, .status-pill.bad),
:root[data-theme="mono-deck"] :is(.status-pill.good, .status-pill.warn, .status-pill.bad) {
  color: var(--text);
}

@media (max-width: 760px) {
  .settings-nav-item {
    min-height: 42px;
    padding: 7px 9px;
  }

  .settings-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-form > * {
    grid-column: 1;
  }

  .fsr2-options,
  .lighting-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .xr-device-overview {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 9px;
  }

  .xr-device-mark {
    width: 40px;
    height: 40px;
  }

  .xr-capabilities {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .xr-audio-route {
    align-items: stretch;
    flex-direction: column;
  }

  .xr-audio-route .btn {
    width: 100%;
  }

  .xr-settings-actions {
    position: sticky;
    bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .settings-sticky-actions {
    position: sticky;
    bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .xr-settings-actions .xr-save-state {
    flex: 1 0 100%;
  }
}

@media (max-width: 560px) {
  .share-sheet {
    padding: 15px;
  }

  .share-methods {
    grid-template-columns: 1fr;
  }

  .destination-section {
    padding: 10px;
  }

  .cast-intent-picker,
  .cast-content-select {
    grid-template-columns: 1fr;
  }

  .direct-connection-action {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .direct-connection-action .status-pill {
    grid-column: 2;
    justify-self: start;
  }

  .theme-options {
    grid-template-columns: 1fr;
  }

  .settings-panel {
    padding: 12px;
  }

  .settings-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow: visible;
  }

  .settings-nav-item {
    flex: none;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    padding: 5px 2px;
    font-size: 0.68rem;
  }

  .settings-nav-item .icon {
    width: 18px;
    height: 18px;
  }

  .settings-save-bar:not(.settings-sticky-actions) .btn {
    width: 100%;
  }

  .content {
    padding: 10px 12px 12px;
  }

  .page-header {
    gap: 9px;
    margin-bottom: 11px;
  }

  .page-header h1 {
    font-size: 1.4rem;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .entity-head,
  .entity-head.detail-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .entity-card {
    padding: 11px 12px;
  }

  .entity-link-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .entity-link-actions .entity-actions {
    overflow-x: auto;
    padding: 1px 1px 3px;
    scrollbar-width: none;
  }

  .entity-link-actions .entity-actions::-webkit-scrollbar {
    display: none;
  }

  .account-page-header .account-view-tabs {
    width: 100%;
    flex-basis: auto;
  }

  .auth-gate {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .auth-gate-icon,
  .account-avatar {
    width: 44px;
    height: 44px;
  }

  .auth-gate .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .account-identity {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .account-identity > .status-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .connection-row {
    grid-template-columns: 1fr;
  }

  .inbox-row {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .inbox-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-left: 42px;
  }

  .inbox-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .connection-row > .action-row .btn {
    flex: 1 1 130px;
  }

  .device-actions {
    justify-items: stretch;
  }

  .device-share-controls {
    width: 100%;
  }

  .brand span {
    max-width: 38vw;
  }

  .page-header {
    align-items: start;
    flex-direction: column;
  }

  .page-header .compact-actions {
    width: 100%;
  }

  .page-header .compact-actions .btn {
    flex: 1 1 0;
  }

  .connector-file-row {
    grid-template-columns: 1fr;
  }

  .connector-file-row .btn {
    width: 100%;
  }

  .connector-file-actions {
    display: flex;
    justify-content: flex-end;
  }

  .connector-file-actions .icon-btn {
    flex: 0 0 40px;
    width: 40px;
  }

  .connector-file-actions .btn {
    flex: 1 1 auto;
  }

  .connector-sources > .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .connector-tools {
    width: 100%;
  }

  .connector-search {
    flex: 1 1 auto;
  }

  .connector-tools .btn {
    flex: 0 0 auto;
  }

  .btn,
  .tab-btn {
    flex: 1 1 auto;
  }

  .filter-row {
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .filter-row::-webkit-scrollbar {
    display: none;
  }

  .filter-row .tab-btn {
    flex: 0 0 auto;
    min-width: 60px;
  }

  .view-mode-bar {
    align-items: stretch;
  }

  .segment {
    padding-inline: 5px;
  }

  .segment .icon + span {
    display: none;
  }

  .room-time {
    display: none;
  }

  .stereo-controls {
    grid-template-columns: 36px 36px 36px minmax(70px, 1fr) 36px;
  }

  .stereo-controls.live { grid-template-columns: 38px minmax(70px, 1fr) 38px; }

  .stereo-controls.on-demand .room-time { display: none; }
}

@media (max-width: 380px) {
  .settings-nav-item {
    font-size: 0.62rem;
  }

  .settings-nav-item span {
    font-size: 0;
  }

  .settings-nav-item span::after {
    content: attr(data-short);
    font-size: 0.62rem;
  }

  .connector-tools .btn span {
    display: none;
  }
}

@media (min-width: 840px) {
  .split {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  }

  .room-body {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .chat-log {
    height: 340px;
  }

  .settings-workspace {
    grid-template-columns: 156px minmax(0, 1fr);
    gap: 12px;
  }

  .settings-nav {
    position: sticky;
    top: 72px;
    display: grid;
    gap: 3px;
    padding: 4px;
  }

  .settings-nav-item {
    justify-content: flex-start;
    min-height: 40px;
    padding: 7px 9px;
    text-align: left;
  }

  .room-active .player-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 344px;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .room-active .video-shell {
    grid-column: 1;
    grid-row: 1 / span 2;
    min-height: 0;
  }

  .room-active .view-mode-bar {
    grid-column: 2;
    grid-row: 1;
  }

  .room-active .room-body {
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: 1fr;
  }

  .room-active .chat-log {
    height: 220px;
  }
}

/* Handhelds such as the Retroid expose a wide but very short CSS viewport. */
@media (orientation: landscape) and (max-height: 560px) {
  .share-sheet {
    width: min(760px, calc(100% - max(16px, env(safe-area-inset-left)) - max(16px, env(safe-area-inset-right))));
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
    border-bottom: 1px solid var(--line);
    border-radius: 8px;
  }

  .cast-sheet {
    grid-template-columns: 1fr;
    width: min(900px, calc(100% - 24px));
  }

  .destination-sheet {
    gap: 10px;
  }

  .destination-section {
    gap: 8px;
    padding: 9px 10px;
  }

  .cast-intent {
    min-height: 56px;
    padding-block: 7px;
  }

  .share-methods { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .playback-menu-layer { align-items: stretch; }
  .playback-menu { max-height: 100dvh; border-radius: 0; }
  .playback-menu-header { padding-block: 10px 8px; }
  .playback-menu-status { min-height: 40px; padding-block: 6px; }
  .playback-menu-body { padding-block: 10px; }
  .playback-menu-footer { padding-block: 8px max(8px, env(safe-area-inset-bottom)); }

  .app-shell {
    min-height: 100vh;
    padding: 0 0 0 76px;
  }

  .topbar {
    min-height: 48px;
    padding: 7px 14px;
  }

  .brand img {
    width: 30px;
    height: 30px;
  }

  .brand strong {
    font-size: 0.92rem;
  }

  .brand span {
    font-size: 0.7rem;
  }

  .service-state {
    min-height: 34px;
    padding: 6px 9px;
  }

  .content {
    width: min(1180px, 100%);
    padding: 10px 14px 14px;
  }

  .account-page-header {
    margin-bottom: 8px;
  }

  .account-page-header .account-view-tabs {
    flex-basis: 280px;
    padding: 3px;
  }

  .account-page-header .account-view-tab {
    min-height: 38px;
    padding: 6px 9px;
  }

  .settings-workspace {
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 8px;
  }

  .settings-nav {
    top: 8px;
  }

  .settings-panel {
    padding: 10px;
  }

  .settings-panel > .section-title:first-child {
    margin-bottom: 10px;
  }

  .settings-form,
  .settings-group-body {
    gap: 8px;
  }

  .settings-group > summary {
    min-height: 46px;
    padding-block: 6px;
  }

  .page-header {
    align-items: center;
    margin: 0 0 9px;
    padding: 0;
  }

  .page-header h1 {
    font-size: 1.28rem;
  }

  .page-header p {
    margin-top: 1px;
    font-size: 0.76rem;
  }

  .page-header .btn,
  .page-header .icon-btn {
    min-height: 38px;
    padding-block: 7px;
  }

  .panel,
  .entity-card {
    padding: 10px;
  }

  .section-title {
    margin: 10px 0 7px;
  }

  .empty {
    min-height: 80px;
    padding: 14px;
  }

  .link-panel .form-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .link-panel .action-row {
    flex-wrap: nowrap;
  }

  .link-panel .btn {
    min-height: 42px;
  }

  .filter-row {
    margin-bottom: 8px;
  }

  .filter-row .tab-btn {
    min-height: 36px;
    padding: 7px 11px;
  }

  .bottom-nav {
    top: 0;
    right: auto;
    width: 76px;
    grid-template: repeat(5, minmax(0, 1fr)) / 1fr;
    gap: 3px;
    padding: 7px;
    border-top: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.09);
  }

  .active-room-dock {
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .nav-btn {
    min-height: 0;
    padding: 4px 2px;
    font-size: 0.65rem;
  }

  .nav-btn .icon {
    width: 19px;
    height: 19px;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
    left: 88px;
  }

  .room-active .topbar,
  .room-active .content > .entity-card {
    display: none;
  }

  .room-active .content {
    height: 100vh;
    padding: 8px;
  }

  .room-controls.active {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 6px 8px;
  }

  .room-controls:not(.active) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .room-controls:not(.active) > .section-title {
    grid-column: 1;
    grid-row: 1;
    align-items: center;
    margin: 0;
  }

  .room-controls:not(.active) > .action-row {
    grid-column: 2;
    grid-row: 1;
    flex-wrap: nowrap;
  }

  .room-controls:not(.active) > :is(.room-start-error, .playlist-settings, .private-room-playlist) {
    grid-column: 1 / -1;
  }

  .room-controls.active > .section-title {
    display: none;
  }

  .room-controls.active > .action-row {
    flex: none;
  }

  .room-controls.active .btn {
    min-height: 36px;
    padding: 6px 10px;
  }

  .room-controls.active .playlist-settings {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    border: 0;
  }

  .room-controls.active .playlist-settings summary {
    min-height: 36px;
    padding: 0 8px;
  }

  .room-controls.active .playlist-settings[open] {
    position: relative;
  }

  .room-controls.active .playlist-settings-body {
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    z-index: 25;
    width: min(420px, 70vw);
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
  }

  .room-active .player-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(230px, 32%);
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: calc(100vh - 89px);
    height: calc(100dvh - 89px);
  }

  .room-active .video-shell {
    grid-column: 1;
    grid-row: 1 / span 2;
    height: 100%;
    min-height: 0;
    aspect-ratio: auto;
  }

  .room-active .view-mode-bar {
    grid-column: 2;
    grid-row: 1;
    padding: 6px 8px;
  }

  .room-active .room-body {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 8px;
  }

  .room-active .room-body > div:last-child {
    display: grid;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .room-active .chat-log {
    height: auto;
    min-height: 0;
  }

  .room-active .room-audio-bar {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .room-active .view-mode-bar .segment span {
    display: none;
  }
}

.retro-controls {
  display: grid;
  gap: 14px;
}

.retro-create-panel {
  overflow: hidden;
  padding: 0;
}

.retro-create-intro {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--amber) 13%, transparent), transparent 36%), color-mix(in srgb, var(--panel-strong) 90%, transparent);
}

.retro-create-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--amber) 14%, var(--control-bg));
  color: var(--amber);
}

.retro-create-mark .icon { width: 27px; height: 27px; }
.retro-create-intro > div { min-width: 0; }
.retro-create-intro .eyebrow { color: var(--amber); font-size: .62rem; font-weight: 850; letter-spacing: .12em; }
.retro-create-intro h2 { margin: 3px 0 2px; font-size: 1.15rem; }
.retro-create-intro p { max-width: 82ch; margin: 0; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.retro-create-state { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .68rem; font-weight: 800; white-space: nowrap; }
.retro-create-state.ready { border-color: color-mix(in srgb, var(--green) 52%, var(--line)); background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); }
.retro-create-state .icon { width: 15px; height: 15px; }

.retro-create-panel > .form-grid { gap: 16px; padding: 20px 22px 22px; }
.retro-create-source-step,
.retro-create-room-step { display: grid; align-content: start; gap: 13px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--subtle-bg) 78%, transparent); }
.retro-step-heading { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; gap: 10px; }
.retro-step-heading > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: color-mix(in srgb, var(--amber) 18%, var(--control-bg)); color: var(--amber); font-size: .72rem; font-weight: 900; }
.retro-step-heading > div { display: grid; min-width: 0; gap: 2px; }
.retro-step-heading strong { color: var(--text); font-size: .82rem; }
.retro-step-heading small { color: var(--muted); font-size: .66rem; font-weight: 500; }
.retro-create-source-step .file-summary { min-height: 66px; }

.retro-create-privacy { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 11px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--teal) 28%, var(--line)); border-radius: 10px; background: color-mix(in srgb, var(--teal) 7%, transparent); }
.retro-create-privacy > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: color-mix(in srgb, var(--teal) 14%, var(--control-bg)); color: var(--teal); }
.retro-create-privacy > div { display: grid; gap: 2px; }
.retro-create-privacy strong { font-size: .74rem; }
.retro-create-privacy small { color: var(--muted); font-size: .66rem; line-height: 1.45; }

.retro-game-sources { padding-top: 4px; }
.retro-game-sources > .section-title h2 { display: flex; align-items: center; gap: 9px; }

@media (min-width: 900px) {
  .retro-create-panel > .form-grid {
    grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
    align-items: start;
  }
  .retro-create-panel > .form-grid > :is(.retro-create-privacy, .retro-library-status, .operation-progress, .action-row) { grid-column: 1 / -1; }
}

body.android-tv.tv-mode .tv-retro-create > .form-grid {
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  align-items: start;
}

body.android-tv.tv-mode .tv-retro-create :is(.retro-create-privacy, .retro-library-status, .operation-progress, .action-row) { grid-column: 1 / -1; }
body.android-tv.tv-mode .tv-retro-create .file-picker { position: relative; }
body.android-tv.tv-mode .tv-retro-create .file-picker input.sr-only {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
  clip: auto;
  opacity: 0;
  cursor: pointer;
}
body.android-tv.tv-mode .tv-retro-create .file-picker:focus-within .btn {
  border-color: var(--tv-focus, var(--focus-ring));
  outline: 4px solid var(--tv-focus, var(--focus-ring));
  outline-offset: 3px;
  background: color-mix(in srgb, var(--tv-focus, var(--focus-ring)) 16%, var(--control-bg));
  color: var(--text);
}
body.android-tv.tv-mode .tv-retro-create .retro-create-source-step,
body.android-tv.tv-mode .tv-retro-create .retro-create-room-step { min-height: 286px; }

@media (max-width: 760px) {
  .retro-create-intro { grid-template-columns: auto minmax(0, 1fr); }
  .retro-create-state { grid-column: 1 / -1; justify-self: start; }
}

.retro-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.retro-facts span {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--muted);
}

.retro-facts strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.retro-hash {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
}

.retro-hash code {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.retro-session-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.retro-launch-checklist {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.retro-launch-check {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--subtle-bg) 82%, transparent);
}

.retro-launch-check > span:first-child {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--control-bg);
  color: var(--muted);
}

.retro-launch-check.ready > span:first-child { background: color-mix(in srgb, var(--green) 20%, var(--control-bg)); color: var(--green); }
.retro-launch-check.blocked > span:first-child { background: color-mix(in srgb, var(--danger) 18%, var(--control-bg)); color: var(--danger); }
.retro-launch-check > span:last-child { display: grid; min-width: 0; gap: 2px; }
.retro-launch-check small { color: var(--muted); font-size: .65rem; }
.retro-launch-check strong { overflow: hidden; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }

.retro-player-panel {
  position: relative;
  width: 100%;
  min-height: min(72vh, 720px);
  background: #050607;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.retro-player-hud {
  position: absolute;
  inset: 14px 14px auto;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 8px 8px 13px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 13px;
  background: rgb(4 7 9 / 72%);
  color: #f4f7f8;
  box-shadow: 0 12px 38px rgb(0 0 0 / 28%);
  backdrop-filter: blur(13px);
  opacity: .2;
  transition: opacity 180ms ease;
}

.retro-player-hud:hover,
.retro-player-hud:focus-within,
.retro-player-panel.menu-open .retro-player-hud { opacity: 1; }
.retro-player-hud > div { display: flex; align-items: center; gap: 9px; min-width: 0; }
.retro-player-hud > div > span:last-child { display: grid; min-width: 0; }
.retro-player-hud small { overflow: hidden; color: rgb(255 255 255 / 62%); font-size: .62rem; text-overflow: ellipsis; white-space: nowrap; }
.retro-player-hud strong { overflow: hidden; font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.retro-player-hud .status-dot { width: 8px; height: 8px; background: var(--green); box-shadow: 0 0 12px color-mix(in srgb, var(--green) 70%, transparent); }
.retro-player-hud .icon-btn { width: 42px; min-width: 42px; min-height: 42px; color: #fff; }

.retro-library-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
}

.retro-library-status > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.retro-byom-note {
  margin: 0;
}

.retro-game-menu {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(0 0 0 / 72%);
  backdrop-filter: blur(8px);
}

.retro-game-menu[hidden] {
  display: none;
}

.retro-game-menu-card {
  width: min(100%, 460px);
  max-height: calc(100dvh - 40px);
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: 0 24px 80px rgb(0 0 0 / 45%);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.retro-game-menu-card h2,
.retro-game-menu-card p {
  margin: 3px 0 0;
}

.retro-game-menu-card p,
.retro-game-menu-card small {
  color: var(--muted);
}

.retro-game-menu-actions {
  display: grid;
  gap: 14px;
}

.retro-menu-group {
  min-width: 0;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 13px;
}

.retro-menu-group legend {
  padding: 0 7px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.retro-menu-button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.retro-menu-button-grid > .btn.danger:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.retro-game-menu-actions label {
  display: grid;
  gap: 6px;
}

.retro-game-menu-status {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: .68rem;
}

/* A running game owns the viewport on every form factor. The app menu remains
   available as a compact overlay and through the configured controller hotkey. */
body.retro-player-active .app-shell.retro-active {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body.retro-player-active .app-shell.retro-active > :is(.topbar, .bottom-nav),
body.retro-player-active .app-shell.retro-active > .content > :not(.retro-player-panel) {
  display: none;
}

body.retro-player-active .app-shell.retro-active > .content,
body.retro-player-active .retro-player-panel,
body.retro-player-active .retro-game-surface,
body.retro-player-active .retro-game-surface > div,
body.retro-player-active .retro-game-surface .ejs_parent {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
}

body.retro-player-active .retro-game-surface {
  display: grid;
  place-items: center;
  outline: none;
  contain: strict;
  background: #020304;
}

/* Fullscreen owns the viewport, while fitted and integer modes preserve the
   emulated system's display aspect. Stretch remains an explicit opt-in. */
body.retro-player-active .retro-player-panel:not([data-display-mode="stretch"]) .retro-game-surface .ejs_parent {
  width: min(100vw, calc(100dvh * var(--retro-aspect-ratio, 1.333333))) !important;
  height: min(100dvh, calc(100vw / var(--retro-aspect-ratio, 1.333333))) !important;
  min-height: 0 !important;
  max-width: 100vw;
  max-height: 100dvh;
}

body.retro-player-active .retro-player-panel:not([data-display-mode="stretch"]) .retro-game-surface .ejs_parent canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

.retro-player-panel.touch-controls-hidden .ejs_virtualGamepad_parent {
  display: none !important;
}

/* External Retro presentation keeps the one live emulator canvas mounted for
   capture while turning the primary device into a familiar companion surface. */
.retro-external-companion {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--text);
  background:
    radial-gradient(circle at 82% 4%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 32%),
    linear-gradient(165deg, color-mix(in srgb, var(--panel-strong) 98%, #030506), #050708 70%);
  touch-action: pan-y;
}

.external-retro-companion > .retro-player-hud { display: none; }

.retro-companion-hero {
  position: relative;
  isolation: isolate;
  min-height: 184px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, .65fr);
  align-items: end;
  gap: 18px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--panel) 94%, #0b1517), color-mix(in srgb, var(--panel-strong) 96%, #020304));
  box-shadow: 0 22px 65px rgb(0 0 0 / 28%);
}

.retro-companion-art,
.retro-companion-hero-shade {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
}

.retro-companion-art { object-fit: cover; opacity: .54; }
.retro-companion-hero-shade {
  z-index: -1;
  background: linear-gradient(90deg, rgb(2 4 5 / 96%) 0%, rgb(2 4 5 / 74%) 48%, rgb(2 4 5 / 48%) 100%);
}

.retro-companion-heading { min-width: 0; align-self: center; }
.retro-companion-heading h1 { max-width: 21ch; margin: 5px 0; overflow-wrap: anywhere; font-size: clamp(1.4rem, 3.4vw, 2.4rem); line-height: 1.02; }
.retro-companion-heading p { margin: 0; color: rgb(255 255 255 / 70%); }

.retro-companion-route {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 15px;
  background: rgb(2 5 6 / 68%);
  backdrop-filter: blur(12px);
}

.retro-companion-display-icon,
.retro-companion-card-title > span:first-child {
  width: 43px;
  height: 43px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--control-bg));
}

.retro-companion-route > span:nth-child(2),
.retro-companion-card-title > span:last-child { display: grid; min-width: 0; gap: 2px; }
.retro-companion-route :is(small, em) { overflow: hidden; color: rgb(255 255 255 / 62%); font-size: .65rem; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.retro-companion-route strong { overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }

.retro-companion-primary-actions {
  display: grid;
  grid-template-columns: 1.25fr repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.retro-companion-primary-actions .btn { min-height: 54px; }
.retro-companion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.retro-companion-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}

.retro-companion-display-card { grid-column: 1 / -1; }
.retro-companion-card-title { display: flex; align-items: center; gap: 11px; }
.retro-companion-card-title strong { font-size: .86rem; }
.retro-companion-card-title small { color: var(--muted); font-size: .67rem; }
.retro-companion-card label { display: grid; gap: 6px; color: var(--muted); font-size: .7rem; }
.retro-companion-card select { min-height: 46px; }
.retro-companion-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.retro-companion-facts > span { min-width: 0; display: grid; gap: 3px; padding: 10px; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: 11px; background: var(--control-bg); }
.retro-companion-facts small { color: var(--muted); font-size: .62rem; }
.retro-companion-facts strong { overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.retro-companion-display-card .action-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.retro-companion-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px; }
.retro-companion-footer > span { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .72rem; }

@media (max-width: 620px), (max-height: 560px) {
  .retro-external-companion { gap: 10px; }
  .retro-companion-hero { min-height: 142px; grid-template-columns: 1fr; align-content: end; padding: 16px; }
  .retro-companion-heading h1 { max-width: none; font-size: 1.35rem; }
  .retro-companion-heading p { display: none; }
  .retro-companion-route { padding: 9px; }
  .retro-companion-primary-actions .btn span { font-size: .7rem; }
  .retro-companion-grid { grid-template-columns: 1fr; }
  .retro-companion-display-card { grid-column: auto; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .retro-external-companion { grid-template-columns: minmax(260px, .8fr) minmax(360px, 1.2fr); align-content: start; }
  .retro-companion-hero { grid-row: span 2; min-height: calc(100dvh - 28px); align-content: end; }
  .retro-companion-primary-actions { grid-column: 2; }
  .retro-companion-grid { grid-column: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .retro-companion-display-card { grid-column: 1 / -1; }
  .retro-companion-footer { grid-column: 2; }
}

body:not(.android-tv).retro-player-active .retro-player-hud {
  inset: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) auto auto;
  width: auto;
  padding: 3px;
  border-color: transparent;
  background: rgb(4 7 9 / 42%);
  opacity: .72;
}

body:not(.android-tv).retro-player-active .retro-player-hud > div {
  display: none;
}

body.android-tv.tv-mode.retro-player-active .content {
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
}

body.android-tv.tv-mode.retro-player-active .tv-page-bar,
body.android-tv.tv-mode.retro-player-active .tv-page-content > :not(.retro-player-panel) {
  display: none;
}

body.android-tv.tv-mode.retro-player-active :is(.tv-page, .tv-page-content) {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  padding: 0;
}

body.android-tv.tv-mode.retro-player-active .retro-player-panel,
body.android-tv.tv-mode.retro-player-active .retro-game-surface,
body.android-tv.tv-mode.retro-player-active .retro-game-surface > div,
body.android-tv.tv-mode.retro-player-active .retro-game-surface .ejs_parent {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  max-height: none;
  margin: 0;
  border: 0;
}

body.android-tv.tv-mode.retro-player-active .retro-player-panel { background: #020304; }
body.android-tv.tv-mode.retro-player-active .retro-game-surface { display: grid; place-items: center; outline: none; }
body.android-tv.tv-mode.retro-player-active .retro-game-surface canvas { max-width: 100%; max-height: 100%; image-rendering: auto; }
body.android-tv.tv-mode.retro-player-active .retro-player-panel[data-display-mode="integer"] .retro-game-surface canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
body.android-tv.tv-mode.retro-player-active .retro-player-panel[data-display-mode="stretch"] .retro-game-surface canvas { width: 100% !important; height: 100% !important; object-fit: fill; }

body.android-tv.tv-mode.retro-player-active .retro-game-menu {
  position: fixed;
  padding: max(42px, 5vh) max(56px, 6vw);
  background: radial-gradient(circle at 50% 35%, rgb(19 31 35 / 72%), rgb(0 0 0 / 88%));
}

body.android-tv.tv-mode.retro-player-active .retro-game-menu-card {
  width: min(720px, 82vw);
  gap: 22px;
  padding: 30px;
  border-color: color-mix(in srgb, var(--tv-focus, var(--focus-ring)) 24%, var(--line));
  border-radius: var(--tv-radius, 14px);
  background: color-mix(in srgb, var(--tv-surface-strong, var(--panel-strong)) 95%, black);
}

body.android-tv.tv-mode.retro-player-active .retro-game-menu-card h2 { font-size: 1.7rem; }
body.android-tv.tv-mode.retro-player-active .retro-game-menu-actions { gap: 12px; }
body.android-tv.tv-mode.retro-player-active .retro-game-menu-actions :is(.btn, select) { min-height: 58px; font-size: .86rem; }
body.android-tv.tv-mode.retro-player-active .retro-game-menu-actions > .btn.danger:last-child { grid-column: 1 / -1; }
body.android-tv.tv-mode.retro-player-active .retro-game-menu-actions :is(button, select):focus-visible { outline: 4px solid var(--tv-focus, var(--focus-ring)); outline-offset: 3px; }

@media (min-width: 2560px) and (min-height: 1400px) {
  body.android-tv.tv-mode.retro-player-active .retro-game-menu-card {
    width: min(920px, 76vw);
    gap: 28px;
    padding: 42px;
  }

  body.android-tv.tv-mode.retro-player-active .retro-game-menu-card h2 { font-size: 2rem; }
  body.android-tv.tv-mode.retro-player-active .retro-game-menu-actions { gap: 16px; }
  body.android-tv.tv-mode.retro-player-active .retro-game-menu-actions :is(.btn, select) { min-height: 72px; }
  body.android-tv.tv-mode.retro-player-active .retro-player-hud { inset: 24px 28px auto; padding: 12px 12px 12px 18px; }
}

.entity-card-compact[data-retro-art="true"] {
  display: grid;
  grid-template-columns: minmax(112px, 22%) minmax(0, 1fr);
  gap: 14px;
}

.retro-card-art {
  min-height: 90px;
  border-radius: 10px;
  background-color: #050607;
  background-position: center;
  background-size: cover;
}

.retro-game-surface,
.retro-game-surface > div {
  width: 100%;
  min-height: min(72vh, 720px);
}

.retro-game-surface {
  position: relative;
  z-index: 0;
}

.retro-game-surface .ejs_parent {
  min-height: min(72vh, 720px);
}

@media (max-width: 720px) {
  .retro-launch-checklist {
    grid-template-columns: 1fr;
  }
  .retro-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .retro-player-panel,
  .retro-game-surface,
  .retro-game-surface > div,
  .retro-game-surface .ejs_parent {
    min-height: 62vh;
  }

  .retro-game-menu-actions {
    grid-template-columns: 1fr;
  }

  .retro-game-menu-actions label {
    grid-column: auto;
  }

  body.android-tv.tv-mode.retro-player-active .retro-game-menu-actions > .btn.danger:last-child {
    grid-column: auto;
  }
}

/* Compact handheld polish: preserve useful density without shrinking touch targets. */
@media (max-width: 560px) {
  .entity-card-compact .entity-head {
    grid-template-areas:
      "title action"
      "meta meta";
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 4px;
  }

  .entity-card-compact .entity-head > div:first-child {
    display: contents;
  }

  .entity-card-compact .entity-title {
    grid-area: title;
    align-self: end;
  }

  .entity-card-compact .entity-title + .entity-meta {
    grid-area: meta;
    margin-top: 0;
  }

  .entity-card-compact .entity-head > .btn {
    grid-area: action;
    align-self: center;
  }

  .page-header .compact-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) 44px;
  }

  .page-header .compact-actions .btn {
    min-width: 0;
    padding-inline: 7px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .page-header .compact-actions .icon-btn {
    width: 44px;
  }

  .grid.two.compact-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .compact-field-grid > label {
    align-content: start;
  }

  .settings-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .settings-nav-item {
    min-height: 50px;
    padding-inline: 1px;
    font-size: 0.62rem;
  }

  .settings-nav-item .icon {
    width: 17px;
    height: 17px;
  }

  .account-identity {
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }

  .account-identity > .status-pill {
    grid-column: 3;
    justify-self: end;
  }

  .account-room-row {
    align-items: center;
    flex-direction: row;
    gap: 8px;
  }

  .account-room-main {
    flex: 1 1 auto;
  }

  .account-room-actions {
    width: auto;
    flex: 0 0 auto;
    gap: 5px;
  }

  .account-room-actions .btn {
    flex: 0 0 42px;
    width: 42px;
    min-height: 42px;
    padding: 8px;
  }

  .account-room-actions .btn span {
    display: none;
  }
}

/* Player layout: media remains primary and every persistent control stays below it. */
.playback-control-bar {
  display: contents;
}

.playback-control-separator {
  display: none;
}

.room-controls.active {
  display: none !important;
}

.room-active .player-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto auto;
  overflow: hidden;
  background: #080b0f;
}

.room-active .video-shell {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 16 / 9;
}

.room-active .view-mode-bar {
  grid-column: 1;
  grid-row: 2;
  border-top: 1px solid var(--line);
}

.room-active .room-audio-bar {
  grid-column: 1;
  grid-row: 3;
  border-top: 0;
}

.room-active .room-body {
  grid-column: 1;
  grid-row: 4;
  display: block;
  min-width: 0;
  min-height: 0;
  padding: 6px 10px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.room-active .room-body .room-utility-panel {
  display: block;
}

.room-active .room-body .room-runtime-strip {
  height: 38px;
}

.room-queue-button {
  position: relative;
  flex: 0 0 auto;
  white-space: nowrap;
}

.room-queue-count {
  position: absolute;
  top: -4px;
  right: -4px;
  display: grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  padding: 0 5px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--teal) 18%, transparent);
  color: var(--teal);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.room-playlist-sheet {
  width: min(780px, 100%);
}

.external-media-sheet { max-width: 620px; }
.external-media-form { display: grid; gap: 18px; }
.external-link-field { display: grid; gap: 7px; color: var(--muted); font-size: .76rem; font-weight: 750; }
.inline-link-control { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.inline-link-control input { min-height: 46px; }
.playlist-destination { display: grid; gap: 9px; margin: 0; padding: 0; border: 0; }
.playlist-destination legend { margin-bottom: 9px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.destination-card { display: grid; grid-template-columns: 20px 42px minmax(0, 1fr); gap: 11px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--panel) 88%, transparent); cursor: pointer; }
.destination-card:has(input[type="radio"]:checked) { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 10%, var(--panel)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--teal) 35%, transparent); }
.destination-card.disabled { opacity: .48; cursor: default; }
.destination-card > input[type="radio"] { margin-top: 12px; }
.destination-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--teal); background: color-mix(in srgb, var(--teal) 14%, transparent); }
.destination-card > span:last-child { display: grid; gap: 3px; min-width: 0; }
.destination-card strong { color: var(--text); }
.destination-card small { color: var(--muted); line-height: 1.35; }
.destination-card select, .destination-card input[type="text"], .destination-card input[name="playlistTitle"] { min-height: 42px; margin-top: 7px; width: 100%; }
.external-share-choice { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: start; gap: 10px; margin: 0; }
.external-share-choice > input { margin-top: 4px; }
.external-share-choice > span { display: grid; gap: 3px; }
.external-share-choice small { color: var(--muted); line-height: 1.35; }
.portable-playlist-share { max-width: 580px; }
.private-room-item-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 520px) {
  .external-media-sheet { width: min(100%, 620px); }
  .destination-card { grid-template-columns: 18px 38px minmax(0, 1fr); padding: 11px; }
  .destination-icon { width: 38px; height: 38px; }
}

.playlist-sheet-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.playlist-sheet-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.playlist-sheet-section-head > div {
  min-width: 0;
}

.playlist-sheet-heading-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.playlist-sheet-section-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.playlist-sheet-section .room-playlist-picker {
  flex: 0 1 300px;
  min-width: min(240px, 45vw);
  margin: 0;
}

.room-playlist-sheet-items {
  display: grid;
  gap: 7px;
  max-height: min(310px, 40dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.queue-series-context {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.queue-series-context-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.7rem;
}

.queue-series-context-head strong {
  color: var(--soft);
  font-size: 0.76rem;
}

.queue-series-position {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.queue-series-card {
  position: relative;
  display: grid;
  align-content: end;
  min-width: 160px;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--subtle-border);
  border-radius: 7px;
  background: var(--panel-strong) center / cover no-repeat;
  color: var(--text);
  text-align: left;
}

.queue-series-card.previous { border-color: color-mix(in srgb, var(--blue) 72%, var(--line)); }
.queue-series-card.current { border-color: color-mix(in srgb, var(--teal) 76%, var(--line)); }
.queue-series-card.next { border-color: color-mix(in srgb, var(--amber) 76%, var(--line)); }
.queue-series-card.current:disabled { opacity: 1; }

.queue-series-role {
  position: absolute;
  z-index: 3;
  top: 6px;
  left: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  color: var(--soft);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.queue-series-card.previous .queue-series-role { color: var(--blue); }
.queue-series-card.current .queue-series-role { color: var(--teal); }
.queue-series-card.next .queue-series-role { color: var(--amber); }

.queue-series-copy {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 25px 9px 8px;
}

.queue-series-copy strong,
.queue-series-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-series-copy strong { font-size: 0.8rem; }
.queue-series-copy small { color: var(--muted); font-size: 0.66rem; }

.playlist-stream-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
}

.playlist-stream-grid > label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.playlist-stream-grid > label[hidden] {
  display: none;
}

.playlist-stream-grid select,
.playlist-sheet-section .room-playlist-picker select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
}

.playlist-stream-grid .stream-settings-action {
  min-height: 42px;
}

.playlist-sheet-section .room-cache-summary {
  flex: 0 0 auto;
}

@media (min-width: 840px) {
  .room-active .player-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto auto;
    height: calc(100dvh - 157px);
    min-height: 420px;
  }

  .room-active .video-shell {
    height: 100%;
    aspect-ratio: auto;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .room-active .player-panel {
    grid-template-rows: minmax(0, 1fr) auto auto;
    height: calc(100dvh - max(16px, env(safe-area-inset-bottom)));
    min-height: 0;
    margin-top: 0;
  }

  .room-active .video-shell {
    height: 100%;
    aspect-ratio: auto;
  }

  .room-active .room-body {
    display: none;
  }

  .room-active .view-mode-bar,
  .room-active .room-audio-bar {
    min-height: 48px;
    padding: 5px 8px;
  }

  .room-active .room-audio-bar {
    padding-bottom: max(5px, env(safe-area-inset-bottom));
  }

  .room-queue-button > span,
  .room-recipes-button > span {
    display: none;
  }

  .room-playlist-sheet-layer {
    align-items: center;
    padding: 6px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  }

  .room-playlist-sheet {
    width: min(900px, 100%);
    max-height: calc(100dvh - 12px);
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .room-playlist-sheet-items {
    max-height: 180px;
  }
}

@media (max-width: 640px) {
  .playlist-sheet-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .playlist-sheet-section .room-playlist-picker {
    flex-basis: auto;
    min-width: 0;
  }

  .playlist-stream-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 390px) and (max-width: 560px) {
  .theme-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-choice {
    grid-template-columns: 44px minmax(0, 1fr);
    min-height: 66px;
    gap: 8px;
    padding: 7px;
  }

  .theme-palette {
    width: 44px;
    height: 36px;
  }

  .theme-copy strong,
  .theme-copy small {
    overflow: visible;
    line-height: 1.12;
    text-overflow: clip;
    white-space: normal;
  }

  .theme-copy strong { font-size: 0.82rem; }
  .theme-copy small { font-size: 0.62rem; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .account-page-header .account-view-tabs {
    flex-basis: 380px;
    width: min(380px, 100%);
  }

  .account-page-header .account-view-tab {
    min-width: 0;
    gap: 6px;
    padding-inline: 7px;
  }
}

.account-rooms {
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.account-room-list {
  display: grid;
  gap: 6px;
}

.account-room-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.account-room-main {
  min-width: 0;
}

.account-room-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.account-room-heading strong {
  min-width: 0;
  flex: 0 1 auto;
  font-size: .92rem;
  line-height: 1.25;
}

.account-room-heading .status-pill {
  flex: 0 0 auto;
  min-height: 22px;
  padding: 2px 7px;
  font-size: 0.7rem;
}

.account-room-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.prepare-sheet {
  grid-template-columns: minmax(0, 1fr);
  width: min(920px, 100%);
  max-height: min(780px, calc(100vh - 16px));
  overflow-x: hidden;
  scrollbar-gutter: auto;
}

.prepare-form {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(340px, 1.1fr);
  gap: 16px;
  width: 100%;
  min-width: 0;
  align-items: start;
}

.download-choice-row,
.prepared-profile-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.offline-copy-item-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.55fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.offline-copy-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.download-decision-sheet {
  width: min(520px, calc(100vw - 28px));
  padding: 22px;
  gap: 16px;
}

.download-decision-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 13px;
}

.download-decision-head h2,
.download-decision-head p,
.download-decision-reason {
  margin: 0;
}

.download-decision-head p,
.download-decision-reason,
.download-decision-option em {
  color: var(--muted);
}

.download-decision-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: var(--teal);
  background: color-mix(in srgb, var(--teal) 13%, var(--panel-strong));
}

.download-decision-options {
  display: grid;
  gap: 9px;
}

.download-decision-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px;
  border: 1px solid var(--subtle-border);
  border-radius: 11px;
  color: var(--text);
  background: var(--panel-strong);
  text-align: left;
  cursor: pointer;
}

.download-decision-option.recommended {
  border-color: color-mix(in srgb, var(--teal) 55%, var(--subtle-border));
  background: color-mix(in srgb, var(--teal) 7%, var(--panel-strong));
}

.download-decision-option:disabled {
  cursor: not-allowed;
  filter: saturate(0.35);
  opacity: 0.58;
}

.download-decision-option > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.download-decision-option small {
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.download-decision-option em {
  font-size: 0.78rem;
  font-style: normal;
  line-height: 1.35;
}

.offline-copy-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 104px;
  padding: 16px;
  color: var(--text);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
}

.offline-copy-choice:hover,
.offline-copy-choice:focus-visible {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--panel-strong) 88%, var(--teal));
}

.offline-copy-choice > .icon:first-child {
  width: 28px;
  height: 28px;
  color: var(--teal);
}

.offline-copy-choice span {
  display: grid;
  gap: 5px;
}

.offline-copy-choice small,
.offline-copy-empty span {
  color: var(--muted);
  line-height: 1.35;
}

.offline-copy-mode-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.offline-copy-mode-heading h3 {
  margin: 2px 0 0;
}

.offline-copy-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.offline-copy-empty > .icon {
  flex: 0 0 auto;
  color: var(--muted);
}

.offline-copy-empty > div {
  display: grid;
  gap: 3px;
}

.offline-copy-config {
  border-color: color-mix(in srgb, var(--line) 70%, var(--teal));
}

.download-choice-row > div,
.prepared-profile-notice > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.download-choice-row span,
.prepared-profile-notice span {
  color: var(--muted);
  font-size: 0.8rem;
}

.prepared-profile-notice strong {
  display: flex;
  align-items: center;
  gap: 7px;
}

.download-choice-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.download-choice-divider::before,
.download-choice-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.profile-locked-setting {
  opacity: 0.68;
}

.profile-locked-setting select,
.profile-locked-setting input {
  cursor: not-allowed;
}

.prepare-preview-shell {
  position: sticky;
  top: 58px;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.prepare-preview-shell canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  background: #050608;
}

.prepare-preview-caption,
.prepare-storage-note,
.prepared-row,
.prepare-progress > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.prepare-preview-caption span,
.prepare-storage-note span,
.prepared-row span,
.prepare-progress span {
  color: var(--muted);
  font-size: 0.78rem;
}

.prepare-controls {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.compact-grid {
  gap: 10px;
}

.prepare-advanced {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.prepare-advanced summary {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-weight: 700;
}

.prepare-advanced[open] summary {
  margin-bottom: 10px;
}

.prepare-storage-note {
  padding: 10px 12px;
  border-left: 3px solid var(--teal);
  background: var(--panel-strong);
}

.prepare-progress,
.prepared-row {
  grid-column: 1 / -1;
}

.prepare-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
}

.prepare-progress .progress {
  grid-column: 1 / -1;
}

.prepare-form > .settings-actions {
  grid-column: 1 / -1;
}

.prepared-list {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.prepared-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

@media (max-width: 720px) {
  .prepare-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .prepare-preview-shell {
    position: static;
  }

  .download-choice-row,
  .prepared-profile-notice {
    align-items: stretch;
    flex-direction: column;
  }

  .offline-copy-choices {
    grid-template-columns: minmax(0, 1fr);
  }

  .offline-copy-item-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  .prepare-progress,
  .prepared-row,
  .prepare-form > .settings-actions {
    grid-column: 1;
  }
}

@media (max-width: 520px) {
  .account-room-actions {
    width: 100%;
  }

  .account-room-actions .btn {
    flex: 1 1 0;
  }

  .prepare-sheet {
    max-height: calc(100vh - 8px);
  }

  .prepare-sheet .share-sheet-head {
    top: -15px;
    margin-right: -15px;
    margin-left: -15px;
  }

  .prepare-form .grid.two {
    grid-template-columns: minmax(0, 1fr);
  }
}

.account-room-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-room-media {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-top: 3px;
  color: var(--soft);
  font-size: 0.86rem;
}

.account-room-media .icon {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: var(--teal);
}

.account-room-media span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-room-media > span {
  min-width: 0;
}

.account-room-meta {
  padding-inline-start: 21px;
}

.account-room-facts {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.75rem;
}

.account-room-empty {
  color: var(--muted);
  padding: 10px 0;
}

.connector-auth-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.connector-auth-alert > span {
  min-width: 0;
}

.connector-auth-alert .btn {
  flex: 0 0 auto;
}

.room-playlist-picker {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.room-playlist-picker[hidden] {
  display: none;
}

.room-playlist-picker select {
  min-width: 0;
  width: 100%;
}

.room-audio-bar {
  display: grid;
  grid-template-columns: auto auto minmax(80px, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.room-audio-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.audio-track-button {
  position: relative;
}

.audio-track-code {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 24px;
  padding: 1px 4px;
  border: 1px solid var(--selected-border);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--selected-text);
  font-size: .52rem;
  font-weight: 850;
  line-height: 1.25;
  letter-spacing: .04em;
}

.room-recipes-button {
  min-height: 38px;
  padding: 7px 10px;
}

.room-recipes-button .icon {
  width: 17px;
  height: 17px;
}

.participants-button {
  position: relative;
}

.icon-count {
  position: absolute;
  top: -4px;
  right: -4px;
  display: grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  padding: 0 4px;
  border: 2px solid var(--panel);
  border-radius: 9px;
  background: var(--teal);
  color: #071313;
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 1;
}

/* Playback command rail ---------------------------------------------------
   Keep every command on the shared 44/38px interaction grid, while giving
   the visually different SVGs one optical size and one badge anchor. */
.room-active .playback-control-bar :is(.btn, .icon-btn) {
  --playback-command-accent: var(--text);
  border-color: color-mix(in srgb, var(--line) 86%, transparent);
  background: color-mix(in srgb, var(--panel-strong) 94%, #000);
  color: var(--playback-command-accent);
  box-shadow: inset 0 1px color-mix(in srgb, #fff 4%, transparent);
}

.room-active .playback-control-bar :is(.btn, .icon-btn) > :is(.icon, span > .icon),
.room-active .playback-control-bar :is(.btn, .icon-btn) > span:has(> .icon) {
  width: 18px;
  height: 18px;
}

.room-active .playback-control-bar :is(.btn, .icon-btn) .icon {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.room-active .playback-control-bar [data-action="open-cast"] {
  --playback-command-accent: var(--blue);
}

.room-active .playback-control-bar [data-action="open-cast"].active {
  border-color: color-mix(in srgb, var(--blue) 62%, transparent);
  background: color-mix(in srgb, var(--blue) 17%, var(--panel-strong));
}

.room-active .playback-control-bar :is(
  [data-action="toggle-room-voice-output"].active,
  .audio-track-button
) {
  --playback-command-accent: var(--amber);
}

.room-active .playback-control-bar [data-action="toggle-room-mic"]:not(.active) {
  --playback-command-accent: var(--muted);
}

.room-active .playback-control-bar [data-action="stop-room"] {
  --playback-command-accent: var(--danger);
  border-color: var(--danger) !important;
  background: rgba(255, 105, 97, .08) !important;
  color: var(--danger) !important;
}

.room-active .playback-control-bar :is(.btn, .icon-btn):active {
  background: color-mix(in srgb, var(--playback-command-accent) 12%, var(--panel-strong));
  transform: translateY(1px);
}

.room-active .playback-control-bar :is(.room-queue-count, .icon-count, .audio-track-code) {
  top: -4px;
  right: -4px;
  bottom: auto;
  display: grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  padding: 0 4px;
  border: 1px solid var(--panel);
  border-radius: 9px;
  background: var(--teal);
  color: var(--teal-ink);
  font-size: .56rem;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: 0 1px 3px color-mix(in srgb, #000 38%, transparent);
}

.room-active .playback-control-bar .audio-track-code {
  right: -6px;
  min-width: 23px;
  padding-inline: 3px;
  background: var(--amber);
  color: #171006;
  font-size: .48rem;
  letter-spacing: .025em;
}

.participant-sheet {
  grid-template-columns: minmax(0, 1fr);
  width: min(620px, 100%);
  overflow-x: hidden;
}

.participant-list {
  display: grid;
  gap: 7px;
}

.audio-sheet-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
}

.audio-sheet-tab {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 750;
}

.audio-sheet-tab.active {
  color: var(--text);
  background: var(--panel-strong);
  box-shadow: 0 1px 3px color-mix(in srgb, #000 24%, transparent);
}

.audio-playback-panel {
  display: grid;
  gap: 9px;
}

.audio-live-control,
.audio-select-control,
.audio-output-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.audio-live-control > span,
.audio-select-control > span,
.audio-output-control > span {
  display: grid;
  gap: 2px;
}

.audio-live-control small,
.audio-select-control small,
.audio-output-control small,
.audio-effective-timing {
  color: var(--muted);
  font-size: 0.72rem;
}

.audio-live-control output {
  font-variant-numeric: tabular-nums;
}

.audio-live-control input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
}

.audio-select-control select {
  width: min(190px, 42vw);
}

.audio-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.audio-effective-timing {
  margin: 0;
  padding: 2px 3px;
}

.audio-apm-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
}

.audio-apm-note > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.audio-apm-note strong {
  color: var(--text);
  font-size: 0.76rem;
}

.audio-apm-note small {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.participant-row {
  display: grid;
  grid-template-columns: 36px minmax(150px, 1fr) minmax(180px, 44%);
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.participant-row.speaking {
  border-color: color-mix(in srgb, var(--green) 58%, var(--line));
  box-shadow: inset 3px 0 0 var(--green);
}

.participant-row.compact {
  width: 100%;
  appearance: none;
  grid-template-columns: 36px minmax(0, 1fr) 24px;
  min-height: 52px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.participant-row.compact .participant-presence {
  flex-wrap: nowrap;
  overflow: hidden;
}

.participant-row.compact .participant-disclosure {
  display: grid;
  color: var(--muted);
  place-items: center;
}

.participant-row.compact .participant-disclosure .icon {
  width: 18px;
  height: 18px;
}

.participant-row.compact:focus-visible {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 42%, transparent);
  outline-offset: 1px;
}

.participant-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: var(--soft);
  background: var(--control-bg);
}

.participant-row.speaking .participant-avatar {
  color: var(--green);
}

.participant-identity {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.participant-name,
.participant-presence {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.participant-name strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-name > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
}

.participant-presence small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-presence small,
.participant-ping {
  color: var(--muted);
  font-size: 0.68rem;
}

.participant-health {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 750;
}

.participant-health i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.participant-health.good { color: var(--green); }
.participant-health.warn { color: var(--warning, #d99a2b); }
.participant-health.bad { color: var(--danger, #db5662); }
.participant-health.pending { color: var(--soft); }

.participant-ping {
  flex: 0 0 auto;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.participant-meter {
  display: block;
  width: min(112px, 100%);
  height: 3px;
  margin-top: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}

.participant-meter i {
  display: block;
  height: 100%;
  background: var(--green);
  transition: width 80ms linear;
}

.participant-volume {
  display: grid;
  grid-template-columns: minmax(70px, 1fr) 38px;
  align-items: center;
  gap: 7px;
}

.participant-volume input {
  min-width: 0;
  width: 100%;
}

.participant-volume output {
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.participant-controls {
  display: flex;
  grid-column: 3;
  align-self: start;
  align-items: center;
  min-width: 0;
  gap: 5px;
}

.participant-controls > .participant-mic {
  margin-left: auto;
}

.participant-controls .participant-volume { flex: 1 1 140px; }
.participant-friend { width: auto; white-space: nowrap; }
.participant-details-sheet > .participant-friend { align-self: end; margin-top: 4px; }
.room-social-members { display: grid; gap: 7px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.room-social-members > div { display: grid; gap: 2px; }
.room-social-members > div small,
.room-social-member small { color: var(--muted); }
.room-social-member { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--subtle-bg); }
.room-social-member > span:nth-child(2) { display: grid; min-width: 0; gap: 2px; }

.participant-enhancement {
  width: auto;
  min-width: 76px;
  min-height: 28px;
  justify-content: center;
  font-size: 0.68rem;
}

.participant-mic {
  justify-self: end;
  color: var(--green);
}

.participant-mic.muted {
  color: var(--muted);
}

.participant-details-sheet { max-width: 520px; }

.video-frame-actions-sheet { max-width: 620px; }

.video-frame-actions-preview {
  display: block;
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #000;
}

.participant-detail-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.participant-detail-facts > div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
}

.participant-detail-facts span,
.participant-detail-volume small { color: var(--muted); font-size: .7rem; }
.participant-detail-facts strong { font-size: .82rem; }

.participant-detail-volume {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
}

.participant-detail-volume > span { display: grid; gap: 2px; }
.participant-detail-volume input { grid-column: 1 / -1; width: 100%; }
.participant-detail-volume output { color: var(--muted); text-align: right; }

.voice-control {
  display: grid;
  grid-template-columns: 36px auto 48px;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.metered-voice-control {
  grid-template-columns: 36px 48px;
  gap: 5px;
}

.mic-activity-icon {
  position: relative;
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
}

.mic-activity-outline,
.mic-activity-fill {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.mic-activity-fill {
  clip-path: inset(calc(100% - var(--mic-level, 0%)) 0 0);
  transition: clip-path 80ms linear;
}

.mic-activity-fill .icon path:first-child {
  fill: currentColor;
}

.room-audio-bar > input[type="range"] {
  width: 100%;
  min-width: 64px;
}

@media (min-width: 701px) and (max-width: 980px) {
  .room-audio-bar {
    gap: 6px;
  }

  .room-audio-bar .voice-control {
    grid-template-columns: 34px 36px;
    gap: 4px;
    font-size: 0.72rem;
  }

  .room-audio-bar .metered-voice-control {
    grid-template-columns: 34px;
  }

  .room-audio-bar .voice-meter {
    display: none;
  }
}

.voice-meter {
  display: block;
  width: 48px;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}

.voice-meter i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 80ms linear;
}

.playback-settings output {
  float: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 700px) {
  .room-audio-bar {
    grid-template-columns: 1fr 1fr;
  }

  .room-audio-bar > input,
  .room-audio-bar > .btn,
  .room-audio-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .room-audio-actions {
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .room-audio-actions::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 480px) {
  .participant-row {
    grid-template-columns: 34px minmax(0, 1fr);
    min-height: 64px;
  }

  .participant-volume,
  .participant-mic,
  .participant-controls {
    grid-column: 2;
    justify-self: stretch;
  }

  .participant-presence {
    flex-wrap: wrap;
  }

  .participant-ping {
    margin-left: 0;
  }

  .participant-row.compact {
    grid-template-columns: 34px minmax(0, 1fr) 22px;
    min-height: 54px;
  }
}

@media (max-width: 520px) {
  .cast-system-route {
    align-items: stretch;
    flex-direction: column;
  }

  /* Keep receiver and audio actions on one compact row on handhelds. */
  .cast-system-route.cast-app-route,
  .cast-system-route.standard-lfe-route,
  .cast-system-route.audio-route-summary {
    align-items: center;
    flex-direction: row;
  }

  .cast-system-route.cast-app-route > div,
  .cast-system-route.standard-lfe-route > div,
  .cast-system-route.audio-route-summary > div {
    min-width: 0;
  }

  .audio-route-summary .route-buttons {
    flex-wrap: nowrap;
  }

  .account-room-row {
    align-items: stretch;
    flex-direction: column;
  }

  .account-room-row .btn {
    width: 100%;
  }
}

/* Active-room utility rail stays compact; conversation lives in its sheet. */
@media (orientation: landscape) and (max-height: 560px) {
  .share-sheet.video-stats-sheet {
    grid-template-columns: minmax(0, 1fr);
    width: min(920px, calc(100% - 16px));
  }

  .video-stats-content {
    grid-column: 1 / -1;
  }
}

.room-controls.active.viewer {
  display: none;
}

.room-controls.active.host {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 6px 8px;
}

.room-controls.active.host > .section-title,
.room-controls.active.host > .action-row {
  display: none;
}

.room-controls.active.host .playlist-settings {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  border: 0;
}

.room-controls.active.host .playlist-settings summary {
  min-height: 36px;
  padding: 0 8px;
}

.room-controls.active.host .playlist-settings[open] {
  position: relative;
}

.room-controls.active.host .playlist-settings-body {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 25;
  width: min(420px, 70vw);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.room-playlist-picker {
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.room-active .room-body {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.room-sync-state span:first-child {
  flex-basis: 84px;
}

.room-playlist-picker select {
  min-height: 38px;
}

@media (min-width: 840px) {
  .room-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .room-active .player-panel {
    height: calc(100dvh - 157px);
    min-height: 420px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .room-active .player-panel {
    height: calc(100dvh - 16px);
    min-height: 0;
    margin-top: 0;
  }

  .room-active .room-body {
    grid-template-rows: minmax(0, 1fr);
  }

  .room-active .room-body > div:last-child {
    display: grid;
    grid-template-rows: auto;
  }

  .room-active .chat-log {
    height: auto;
  }

  .chat-sheet-layer {
    align-items: center;
  }

  .chat-sheet {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(100px, 1fr) auto;
    width: min(720px, calc(100% - 24px));
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
    border: 1px solid var(--line);
    border-radius: 8px;
  }
}
.room-preview-item-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.room-preview-item-actions .btn,
.room-preview-item-actions .icon-btn {
  min-height: 38px;
}

.room-landing .room-preview-item-actions .playlist-item-more {
  width: 32px;
  min-height: 32px;
  padding: 5px;
}

.playlist-item-actions-sheet {
  width: min(460px, 100%);
}

.playlist-item-action-list {
  display: grid;
  gap: 5px;
}

.playlist-item-action {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--control-bg);
  color: var(--text);
  text-align: left;
}

.playlist-item-action > .icon {
  justify-self: center;
}

.playlist-item-action > span:not(.status-pill) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.playlist-item-action small {
  color: var(--muted);
  font-size: .75rem;
}

.playlist-item-action.active {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
}

.playlist-item-action.danger:not(:disabled) {
  color: var(--danger);
}

.playlist-item-action:disabled {
  opacity: .42;
}

@media (orientation: landscape) and (max-height: 560px) {
  .playlist-item-actions-layer {
    align-items: center;
  }

  .playlist-item-actions-sheet {
    grid-template-columns: minmax(0, 1fr);
    width: min(680px, calc(100% - 20px));
    max-height: calc(100dvh - 16px);
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .playlist-item-action-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

.playlist-item-action[data-command="play"] {
    grid-column: 1 / -1;
  }
}

.media-folder-settings,
.media-folder-list {
  display: grid;
  gap: 8px;
}

.media-folder-settings {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.media-folder-head,
.media-folder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.media-folder-head > div,
.media-folder-row > label {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 2px;
}

.media-folder-row > label input {
  min-width: 0;
  height: 34px;
}

.media-folder-head small,
.media-folder-row small {
  color: var(--muted);
}

.media-folder-row {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.local-media-offer-layer {
  align-items: center;
}

.local-media-offer {
  width: min(580px, calc(100% - 24px));
  height: auto;
  max-height: calc(100dvh - 24px);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.local-media-match {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.local-media-match > svg {
  width: 24px;
  height: 24px;
}

.local-media-match p,
.local-media-offer-copy {
  color: var(--muted);
}

.local-media-match p {
  margin: 3px 0 8px;
  overflow-wrap: anywhere;
}

.local-media-offer-copy {
  margin: 0;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .room-preview-item-actions {
    grid-column: 2 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  .account-room-row {
    align-items: center;
    flex-direction: row;
    gap: 8px;
  }

  .account-room-main {
    flex: 1 1 auto;
  }

  .account-room-actions {
    width: auto;
    flex: 0 0 auto;
    gap: 5px;
  }

  .account-room-actions .btn {
    flex: 0 0 42px;
    width: 42px;
    min-height: 42px;
    padding: 8px;
  }

  .account-room-actions .btn span {
    display: none;
  }
}

/* PWA responsive shell -----------------------------------------------------
   The web app shares its UI with Android, so web-only selectors keep the
   desktop workspace and phone browser polish from changing native layouts. */

body.web-client {
  scrollbar-gutter: stable;
}

.web-client .service-state {
  max-width: min(42vw, 260px);
}

.mobile-player-corner-actions,
.mobile-player-picture-button,
.mobile-player-fullscreen-button,
.mobile-player-title,
.mobile-player-action-label,
.mobile-room-audio-label {
  display: none;
}

@media (max-width: 640px) {
  .web-client .app-shell {
    min-height: 100dvh;
    padding-top: 0;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  html.web-client.room-player-active,
  body.web-client.room-player-active {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .web-client .topbar {
    min-height: 58px;
    padding: max(9px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 9px max(12px, env(safe-area-inset-left));
  }

  .web-client .brand {
    gap: 8px;
  }

  .web-client .brand img {
    width: 32px;
    height: 32px;
  }

  .web-client .brand span {
    max-width: 31vw;
  }

  .web-client .service-state {
    max-width: 128px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .web-client .content {
    padding: 12px max(12px, env(safe-area-inset-right)) 18px max(12px, env(safe-area-inset-left));
  }

  .web-client .page-header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
  }

  .web-client .page-header h1 {
    font-size: clamp(1.38rem, 7vw, 1.65rem);
  }

  .web-client .page-header .compact-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .web-client .page-header .compact-actions .btn {
    width: 100%;
    padding-inline: 10px;
    font-size: 0.82rem;
  }

  .web-client .page-header .compact-actions .icon-btn {
    width: 44px;
    justify-self: end;
  }

  .web-client .view-home .page-header .compact-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 44px;
    gap: 6px;
  }

  .web-client .view-home .page-header .compact-actions .btn {
    gap: 5px;
    padding-inline: 7px;
    font-size: .76rem;
  }

  .web-client .link-panel .action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .web-client .filter-row {
    flex-wrap: nowrap;
    margin-inline: -12px;
    padding: 0 12px 4px;
    overflow-x: auto;
    scroll-padding-inline: 12px;
    scrollbar-width: none;
  }

  .web-client .filter-row::-webkit-scrollbar {
    display: none;
  }

  .web-client .filter-row .tab-btn {
    flex: 0 0 auto;
  }

  .web-client .bottom-nav {
    padding-inline: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right));
  }

  .web-client .entity-card {
    padding: 12px;
  }

  .web-client .room-active .content {
    padding: 10px max(10px, env(safe-area-inset-right)) 14px max(10px, env(safe-area-inset-left));
  }

  .web-client .room-active .player-panel {
    grid-template-rows: auto auto auto auto;
    overflow: visible;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
  }

  .web-client .room-active .video-shell {
    overflow: hidden;
    border-radius: 13px 13px 0 0;
  }

  .web-client .room-active .video-overlay {
    right: 9px;
    top: 9px;
    left: 9px;
    align-items: flex-start;
  }

  .web-client .room-active .video-badges {
    max-width: calc(100% - 54px);
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .web-client .room-active .video-badges > :is(#field-status-badge, #aspect-status-badge, #depth-status-badge, #cast-status-badge),
  .web-client .room-active .video-window-actions {
    display: none;
  }

  .web-client .room-active .mobile-player-corner-actions {
    display: flex;
    flex: 0 0 42px;
    margin-left: auto;
    gap: 6px;
    pointer-events: auto;
  }

  .web-client .room-active :is(.mobile-player-picture-button, .mobile-player-fullscreen-button) {
    display: grid;
    width: 42px;
    min-height: 42px;
    place-items: center;
  }

  .web-client .room-active .mobile-player-title {
    position: absolute;
    right: 12px;
    bottom: 14px;
    left: 12px;
    z-index: 3;
    display: grid;
    gap: 2px;
    min-width: 0;
    pointer-events: none;
    text-shadow: 0 1px 4px #000;
  }

  .web-client .room-active .video-shell.controls-visible .mobile-player-title {
    bottom: 66px;
  }

  .web-client .room-active .mobile-player-title::before {
    position: absolute;
    z-index: -1;
    right: -12px;
    bottom: -14px;
    left: -12px;
    height: 72px;
    background: linear-gradient(to top, rgba(0, 0, 0, .7), transparent);
    content: "";
  }

  .web-client .room-active .mobile-player-title strong,
  .web-client .room-active .mobile-player-title small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .web-client .room-active .mobile-player-title strong { font-size: .82rem; }
  .web-client .room-active .mobile-player-title small { color: var(--muted); font-size: .68rem; }

  .web-client .room-active .stereo-controls.on-demand {
    right: 8px;
    bottom: 8px;
    left: 8px;
    grid-template-columns: 38px minmax(42px, 1fr) auto 38px;
    grid-template-rows: 38px;
    gap: 5px;
    padding: 7px;
    border-radius: 11px;
  }

  .web-client .room-active .stereo-controls.on-demand > input[type="range"] {
    grid-column: 2;
    grid-row: 1;
  }

  .web-client .room-active .stereo-controls.on-demand > [data-action="toggle-room-playback"] { grid-column: 1; grid-row: 1; }
  .web-client .room-active .stereo-controls.on-demand > .room-time {
    display: block;
    grid-column: 3;
    grid-row: 1;
    justify-self: center;
    font-size: .66rem;
  }
  .web-client .room-active .stereo-controls.on-demand > [data-action="toggle-room-muted"] { grid-column: 4; grid-row: 1; }
  .web-client .room-active .stereo-controls.on-demand .video-action { width: 38px; min-height: 38px; }

  .web-client .room-active .view-mode-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    margin: 9px 9px 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 11px 11px 0 0;
    background: var(--panel-strong);
  }

  .web-client .room-active .view-mode-bar .segmented-control { display: none; }
  .web-client .room-active .view-mode-bar .room-view-picker { display: grid; }
  .web-client .room-active .view-mode-bar .cast-actions { gap: 5px; }
  .web-client .room-active .view-mode-bar .cast-actions .icon-btn { width: 42px; min-height: 42px; }

  .web-client .room-active .room-audio-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 9px 9px;
    padding: 8px;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 11px 11px;
    background: var(--panel-strong);
  }

  .web-client .room-active .room-audio-bar > .voice-control {
    display: block;
    min-width: 0;
  }

  .web-client .room-active .room-audio-bar > .voice-control > .icon-btn {
    display: flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 10px;
  }

  .web-client .room-active .mobile-room-audio-label {
    display: block;
    min-width: 0;
    overflow: hidden;
    font-size: .76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .web-client .room-active .room-audio-bar .voice-meter { display: none; }
  .web-client .room-active .room-audio-bar > input[type="range"] {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 28px;
  }

  .web-client .room-active .room-audio-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 3;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
    overflow: visible;
  }

  .web-client .room-active .room-audio-actions > :is(.btn, .icon-btn) {
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 56px;
    place-items: center;
    align-content: center;
    gap: 3px;
    padding: 6px 3px;
  }

  .web-client .room-active .room-audio-actions > :is(.btn, .icon-btn) > .icon {
    width: 18px;
    height: 18px;
  }

  .web-client .room-active .room-audio-actions .mobile-player-action-label,
  .web-client .room-active .room-audio-actions .room-queue-button > span,
  .web-client .room-active .room-audio-actions .room-recipes-button > span {
    display: block;
    overflow: hidden;
    font-size: .68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .web-client .room-active .room-body {
    margin: 0 9px 8px;
    padding: 7px 2px 2px;
    border-top: 1px solid var(--line);
    background: transparent;
  }

  .web-client .room-active .room-body .room-runtime-strip { height: 36px; }
  .web-client .room-active .room-runtime-detail,
  .web-client .room-active .room-sync-state { font-size: .7rem; }
}

@media (max-width: 360px) {
  .web-client .brand > div {
    min-width: 0;
  }

  .web-client .brand strong {
    white-space: nowrap;
  }

  .web-client .brand span {
    display: none;
  }

  .web-client .service-state {
    width: 38px;
    padding-inline: 14px;
    font-size: 0;
  }

  .web-client .service-dot {
    flex: 0 0 8px;
  }

  .web-client .nav-btn {
    font-size: 0.68rem;
  }

  .web-client .account-view-tabs {
    scroll-snap-type: inline proximity;
  }

  .web-client .account-view-tab {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }
}

@media (min-width: 641px) and (max-width: 959px) {
  .web-client .content {
    width: min(1120px, 100%);
    padding: 20px 24px;
  }

  .web-client .link-panel .form-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .web-client .link-panel .action-row {
    flex-wrap: nowrap;
  }
}

@media (min-width: 960px) and (min-height: 620px) {
  .web-client .app-shell {
    --web-nav-width: 92px;
    min-height: 100vh;
    padding: 0 0 0 var(--web-nav-width);
  }

  .web-client .topbar {
    min-height: 64px;
    padding: 12px clamp(24px, 3vw, 42px);
  }

  .web-client .brand img {
    width: 38px;
    height: 38px;
  }

  .web-client .brand strong {
    font-size: 1.05rem;
  }

  .web-client .content {
    width: min(1440px, 100%);
    padding: 24px clamp(24px, 3vw, 44px) 40px;
  }

  .web-client .page-header {
    gap: 24px;
    margin: 0 0 22px;
    padding: 2px 0;
  }

  .web-client .page-header h1 {
    font-size: clamp(1.65rem, 2.3vw, 2.05rem);
  }

  .web-client .page-header p {
    margin-top: 5px;
    font-size: 0.92rem;
  }

  .web-client .account-page-header .account-view-tabs {
    width: min(600px, 100%);
    flex-basis: 600px;
  }

  .web-client .account-page-header .account-view-tab {
    min-width: 0;
    gap: 7px;
    padding-inline: 8px;
  }

  .web-client .compact-actions {
    flex-wrap: nowrap;
  }

  .web-client .panel,
  .web-client .entity-card,
  .web-client .player-panel {
    border-radius: 10px;
  }

  .web-client .panel {
    padding: 18px;
  }

  .web-client .link-panel .form-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 16px;
  }

  .web-client .link-panel .action-row {
    flex-wrap: nowrap;
  }

  .web-client .library-heading {
    margin-top: 24px;
  }

  .web-client .bottom-nav {
    top: 64px;
    right: auto;
    bottom: 0;
    width: var(--web-nav-width);
    grid-template: repeat(5, 68px) / 1fr;
    align-content: start;
    gap: 8px;
    padding: 18px 10px;
    border-top: 0;
    border-right: 1px solid var(--subtle-border);
  }

  .web-client .nav-btn {
    position: relative;
    min-height: 68px;
    padding: 9px 5px;
    border: 1px solid transparent;
    font-size: 0.72rem;
  }

  .web-client .nav-btn .icon {
    width: 22px;
    height: 22px;
  }

  .web-client .nav-btn.active {
    border-color: var(--selected-border);
  }

  .web-client .nav-btn.active::before {
    position: absolute;
    top: 17px;
    bottom: 17px;
    left: -11px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--teal);
    content: "";
  }

  .web-client .toast-region {
    right: 20px;
    bottom: 20px;
    left: calc(var(--web-nav-width) + 20px);
  }

  .web-client .active-room-dock {
    bottom: 20px;
  }

  .web-client .settings-workspace {
    grid-template-columns: 228px minmax(0, 1fr);
    gap: 22px;
  }

  .web-client .settings-nav {
    top: 88px;
    gap: 4px;
    padding: 8px;
  }

  .web-client .settings-nav-heading {
    display: grid;
    gap: 2px;
    padding: 5px 8px 9px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2px;
  }

  .web-client .settings-nav-heading strong { font-size: .76rem; letter-spacing: .03em; text-transform: uppercase; }
  .web-client .settings-nav-heading small { color: var(--muted); font-size: .66rem; }

  .web-client .settings-nav-item {
    position: relative;
    min-height: 54px;
    gap: 11px;
    padding: 8px 10px;
  }

  .web-client .settings-nav-item > .icon {
    flex: 0 0 auto;
    width: 19px;
    height: 19px;
  }

  .web-client .settings-nav-item > span { gap: 2px; }
  .web-client .settings-nav-item > span > small { display: block; }

  .web-client .settings-nav-item.active::before {
    position: absolute;
    top: 9px;
    bottom: 9px;
    left: -9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--teal);
    content: "";
  }

  .web-client .settings-pane {
    width: min(100%, 1080px);
  }

  .web-client .people-friends-panel .people-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1180px) and (min-height: 620px) {
  .web-client .view-home .entity-list,
  .web-client .view-home .account-room-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .web-client .view-home .entity-card {
    min-height: 88px;
    padding: 15px 16px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .web-client .entity-card,
  .web-client .account-room-row,
  .web-client .connection-row,
  .web-client .nav-btn {
    transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
  }

  .web-client .entity-card:hover,
  .web-client .account-room-row:hover,
  .web-client .connection-row:hover {
    border-color: rgba(215, 222, 232, 0.28);
    background: var(--panel-strong);
  }

  .web-client .nav-btn:hover:not(.active) {
    background: var(--subtle-bg);
    color: var(--soft);
  }
}

/* Deliberate handheld profiles. These rules stay last so broad phone/tablet
   breakpoints cannot change the geometry of the primary Retroid targets. */
:root[data-viewport-profile="handheld-wide"],
:root[data-viewport-profile="handheld-4x3"] {
  --handheld-rail: 68px;
  --handheld-control: 40px;
  --handheld-gap: 6px;
}

:root[data-viewport-profile="handheld-wide"] .app-shell,
:root[data-viewport-profile="handheld-4x3"] .app-shell {
  min-height: 100dvh;
  padding: 0 0 0 var(--handheld-rail);
}

:root[data-viewport-profile="handheld-wide"] .topbar,
:root[data-viewport-profile="handheld-4x3"] .topbar {
  min-height: 44px;
  padding: 5px 10px;
}

:root[data-viewport-profile="handheld-wide"] .brand img,
:root[data-viewport-profile="handheld-4x3"] .brand img {
  width: 28px;
  height: 28px;
}

:root[data-viewport-profile="handheld-wide"] .brand strong,
:root[data-viewport-profile="handheld-4x3"] .brand strong { font-size: .84rem; }
:root[data-viewport-profile="handheld-wide"] .brand span,
:root[data-viewport-profile="handheld-4x3"] .brand span { font-size: .65rem; }

:root[data-viewport-profile="handheld-wide"] :is(.inbox-button, .service-state),
:root[data-viewport-profile="handheld-4x3"] :is(.inbox-button, .service-state) {
  min-height: 34px;
  height: 34px;
}

:root[data-viewport-profile="handheld-wide"] .inbox-button,
:root[data-viewport-profile="handheld-4x3"] .inbox-button { width: 34px; }

:root[data-viewport-profile="handheld-wide"] .content,
:root[data-viewport-profile="handheld-4x3"] .content {
  width: min(1180px, 100%);
  padding: 8px 10px 12px;
}

:is(:root[data-viewport-profile="handheld-wide"], :root[data-viewport-profile="handheld-4x3"]) :is(.xr-settings-actions, .settings-sticky-actions) {
  position: sticky;
  bottom: 8px;
}

:root[data-viewport-profile="handheld-wide"] .bottom-nav,
:root[data-viewport-profile="handheld-4x3"] .bottom-nav {
  top: 0;
  right: auto;
  bottom: 0;
  left: 0;
  width: var(--handheld-rail);
  grid-template: repeat(5, minmax(0, 1fr)) / 1fr;
  gap: 2px;
  padding: 5px;
  border-top: 0;
  border-right: 1px solid var(--subtle-border);
}

:root[data-viewport-profile="handheld-wide"] .nav-btn,
:root[data-viewport-profile="handheld-4x3"] .nav-btn {
  min-height: 0;
  gap: 1px;
  padding: 3px 2px;
  font-size: .61rem;
}

:root[data-viewport-profile="handheld-wide"] .nav-btn .icon,
:root[data-viewport-profile="handheld-4x3"] .nav-btn .icon {
  width: 18px;
  height: 18px;
}

:root[data-viewport-profile="handheld-wide"] :is(.page-header, .account-page-header),
:root[data-viewport-profile="handheld-4x3"] :is(.page-header, .account-page-header) {
  min-width: 0;
  margin: 0 0 7px;
  padding: 0;
}

:root[data-viewport-profile="handheld-wide"] .page-header h1,
:root[data-viewport-profile="handheld-4x3"] .page-header h1 { font-size: 1.18rem; }
:root[data-viewport-profile="handheld-wide"] .page-header p,
:root[data-viewport-profile="handheld-4x3"] .page-header p { margin-top: 1px; font-size: .7rem; }

:root[data-viewport-profile="handheld-wide"] :is(.btn, .tab-btn, .icon-btn),
:root[data-viewport-profile="handheld-4x3"] :is(.btn, .tab-btn, .icon-btn) {
  min-height: var(--handheld-control);
}

:root[data-viewport-profile="handheld-wide"] :is(.panel, .entity-card),
:root[data-viewport-profile="handheld-4x3"] :is(.panel, .entity-card) { padding: 9px 10px; }

:root[data-viewport-profile="handheld-wide"] .section-title,
:root[data-viewport-profile="handheld-4x3"] .section-title { margin: 8px 0 6px; }

:root[data-viewport-profile="handheld-wide"] .filter-row,
:root[data-viewport-profile="handheld-4x3"] .filter-row { margin-bottom: 7px; }

:root[data-viewport-profile="handheld-4x3"].web-client .filter-row {
  margin-inline: 0;
  padding-inline: 0;
}

:root[data-viewport-profile="handheld-wide"] .filter-row .tab-btn,
:root[data-viewport-profile="handheld-4x3"] .filter-row .tab-btn {
  min-height: 34px;
  padding: 6px 10px;
}

:root[data-viewport-profile="handheld-wide"] .entity-list,
:root[data-viewport-profile="handheld-4x3"] .entity-list { gap: 6px; }

:root[data-viewport-profile="handheld-wide"] .entity-card,
:root[data-viewport-profile="handheld-4x3"] .entity-card { gap: 6px; }

:root[data-viewport-profile="handheld-wide"] .entity-title,
:root[data-viewport-profile="handheld-4x3"] .entity-title { font-size: .88rem; }

:root[data-viewport-profile="handheld-wide"] .entity-meta,
:root[data-viewport-profile="handheld-4x3"] .entity-meta { font-size: .68rem; }

:root[data-viewport-profile="handheld-wide"] :is(.status-pill, .kind-pill, .tiny-pill),
:root[data-viewport-profile="handheld-4x3"] :is(.status-pill, .kind-pill, .tiny-pill) {
  min-height: 23px;
  padding-block: 3px;
  font-size: .66rem;
}

:root[data-viewport-profile="handheld-wide"] .toast-region,
:root[data-viewport-profile="handheld-4x3"] .toast-region {
  right: 10px;
  bottom: 10px;
  left: calc(var(--handheld-rail) + 10px);
}

/* Pocket 5/6: preserve one-line commands and use a single compact control
   rail below the theater surface. */
:root[data-viewport-profile="handheld-wide"] .view-home .page-header {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(430px, auto);
  align-items: center;
  gap: 10px;
}

:root[data-viewport-profile="handheld-wide"] .view-home .compact-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 40px;
  gap: 6px;
  width: 100%;
}

:root[data-viewport-profile="handheld-wide"] .view-home .compact-actions.has-playlist-create {
  grid-template-columns: minmax(116px, 1.4fr) repeat(3, minmax(68px, 1fr)) 40px;
}

:root[data-viewport-profile="handheld-wide"] .view-home .compact-actions :is(.btn, .icon-btn) {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 6px 9px;
  white-space: nowrap;
}

:root[data-viewport-profile="handheld-wide"] .link-panel .form-grid {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

:root[data-viewport-profile="handheld-wide"] .link-panel .action-row { flex-wrap: nowrap; }

:root[data-viewport-profile="handheld-wide"] .room-active .content,
:root[data-viewport-profile="handheld-4x3"] .room-active .content {
  height: 100dvh;
  padding: 6px;
}

:root[data-viewport-profile="handheld-wide"] .room-active .player-panel {
  height: calc(100dvh - 12px);
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 46px;
}

:root[data-viewport-profile="handheld-wide"] .room-active .video-shell {
  grid-column: 1 / -1;
  grid-row: 1;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

:root[data-viewport-profile="handheld-wide"] .room-active .playback-control-bar {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  min-width: 0;
  min-height: 46px;
  height: 46px;
  padding: 6px;
  background: var(--panel);
}

:root[data-viewport-profile="handheld-wide"] .room-active .view-mode-bar,
:root[data-viewport-profile="handheld-wide"] .room-active .room-audio-bar {
  display: contents;
}

:root[data-viewport-profile="handheld-wide"] .room-active .room-view-picker {
  display: grid;
  flex: 0 0 114px;
  width: 114px;
  max-width: 114px;
  height: 34px;
}

:root[data-viewport-profile="handheld-wide"] .room-active .view-mode-bar .segmented-control {
  display: none;
}

:root[data-viewport-profile="handheld-wide"] .room-active .room-view-picker select {
  height: 34px;
  min-height: 34px;
  max-width: 100%;
  padding-block: 4px;
}

:root[data-viewport-profile="handheld-wide"] .room-active .cast-actions,
:root[data-viewport-profile="handheld-wide"] .room-active .room-audio-actions,
:root[data-viewport-profile="handheld-wide"] .room-active .voice-control {
  display: contents;
}

:root[data-viewport-profile="handheld-wide"] .room-active .room-audio-bar > input[type="range"] {
  flex: 0 1 150px;
  box-sizing: border-box;
  width: 150px;
  min-width: 72px;
  max-width: 150px;
  min-height: 34px;
  height: 34px;
  max-height: 34px;
  margin: 0;
  padding: 0;
}

:root[data-viewport-profile="handheld-wide"] .room-active .playback-control-separator {
  display: block;
  flex: 0 0 1px;
  width: 1px;
  height: 22px;
  margin-inline: 1px;
  background: color-mix(in srgb, var(--line) 72%, transparent);
}

:root[data-viewport-profile="handheld-wide"] .room-active .room-body { display: none; }
:root[data-viewport-profile="handheld-wide"] .room-active .view-mode-bar .segment span,
:root[data-viewport-profile="handheld-wide"] .room-active .room-audio-actions .btn > span { display: none; }
:root[data-viewport-profile="handheld-wide"] .room-active .playback-control-bar :is(.btn, .icon-btn) {
  flex: 0 0 34px;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  height: 34px;
  padding: 6px;
  border-radius: 8px;
}

:root[data-viewport-profile="handheld-wide"] .room-active .playback-control-bar :is(.room-queue-count, .icon-count, .audio-track-code) {
  top: -3px;
  right: -3px;
  border-width: 1px;
}

:root[data-viewport-profile="handheld-wide"] .room-active .playback-control-bar .audio-track-code {
  right: -5px;
}

/* Nova 4:3: keep navigation beside the content, put all home commands on one
   predictable row, and preserve a true 16:9 media frame when possible. */
:root[data-viewport-profile="handheld-4x3"] .view-home .page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 6px;
}

:root[data-viewport-profile="handheld-4x3"] .view-home .compact-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 40px;
  gap: 6px;
  width: 100%;
}

:root[data-viewport-profile="handheld-4x3"] .view-home .compact-actions.has-playlist-create {
  grid-template-columns: minmax(104px, 1.35fr) repeat(3, minmax(56px, 1fr)) 40px;
}

:root[data-viewport-profile="handheld-4x3"] .view-home .compact-actions :is(.btn, .icon-btn) {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 6px 7px;
  font-size: .72rem;
  white-space: nowrap;
}

:root[data-viewport-profile="handheld-4x3"] .link-panel .form-grid {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

:root[data-viewport-profile="handheld-4x3"] .link-panel .action-row {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) auto;
  flex-wrap: nowrap;
}

:root[data-viewport-profile="handheld-4x3"] .link-panel .action-row .btn {
  min-width: 0;
  padding-inline: 9px;
}

:root[data-viewport-profile="handheld-4x3"] .room-active .player-panel {
  height: calc(100dvh - 12px);
  min-height: 0;
  grid-template-columns: minmax(0, .46fr) minmax(0, .54fr);
  grid-template-rows: minmax(0, 1fr) 46px;
}

:root[data-viewport-profile="handheld-4x3"] .room-active .video-shell {
  grid-column: 1 / -1;
  grid-row: 1;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

:root[data-viewport-profile="handheld-4x3"] .room-active .view-mode-bar,
:root[data-viewport-profile="handheld-4x3"] .room-active .room-audio-bar {
  min-width: 0;
  min-height: 46px;
  height: 46px;
  padding: 4px 6px;
  border-top: 1px solid var(--line);
}

:root[data-viewport-profile="handheld-4x3"] .room-active .view-mode-bar {
  grid-column: 1;
  grid-row: 2;
  border: 0;
}

:root[data-viewport-profile="handheld-4x3"] .room-active .room-audio-bar {
  grid-column: 2;
  grid-row: 2;
  grid-template-columns: auto auto minmax(48px, 1fr) auto;
  position: relative;
  border: 0;
}

/* The native surface and the two compact control halves can settle on
   adjacent fractional pixels while tap-to-show chrome is repainting. Keep an
   opaque cap over that boundary so theme artwork cannot flash through it. */
:root[data-viewport-profile="handheld-4x3"] .room-active .room-audio-bar::before {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--panel);
  content: "";
  pointer-events: none;
}

:root[data-viewport-profile="handheld-4x3"] .room-active .room-audio-bar > * {
  position: relative;
  z-index: 1;
}

:root[data-viewport-profile="handheld-4x3"] .room-active .room-view-picker {
  align-self: center;
  height: 36px;
  min-height: 36px;
}

:root[data-viewport-profile="handheld-4x3"] .room-active .room-view-picker select {
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding-block: 4px;
}

:root[data-viewport-profile="handheld-4x3"] .room-active .room-body {
  display: none;
  grid-column: 1 / -1;
  grid-row: 3;
  height: 38px;
  padding: 0 8px;
}

:root[data-viewport-profile="handheld-4x3"] .room-active .view-mode-bar .segment span,
:root[data-viewport-profile="handheld-4x3"] .room-active .room-audio-actions .btn > span { display: none; }
:root[data-viewport-profile="handheld-4x3"] .room-active .room-audio-actions { gap: 3px; overflow: visible; }
:root[data-viewport-profile="handheld-4x3"] .room-active .room-audio-bar > input[type="range"],
:root[data-viewport-profile="handheld-4x3"] .room-active .room-audio-bar .voice-meter { display: none; }
:root[data-viewport-profile="handheld-4x3"] .room-active .room-audio-bar .metered-voice-control {
  display: block;
  width: 36px;
}
:root[data-viewport-profile="handheld-4x3"] .room-active .room-audio-bar {
  grid-template-columns: 36px 36px minmax(0, 1fr);
}
:root[data-viewport-profile="handheld-4x3"] .room-active .room-audio-actions {
  grid-column: 3;
  justify-content: flex-end;
}
:root[data-viewport-profile="handheld-4x3"] .room-active .room-audio-actions :is(.btn, .icon-btn) {
  width: 36px;
  min-height: 36px;
  height: 36px;
  padding: 6px;
}

:root[data-viewport-profile="handheld-4x3"] .room-active .playback-control-bar .view-mode-bar :is(.btn, .icon-btn),
:root[data-viewport-profile="handheld-4x3"] .room-active .playback-control-bar .voice-control > .icon-btn {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  height: 36px;
  padding: 7px;
}

/* Settings keep every category visible on 4:3 and retain a compact rail on
   16:9, while the selected pane owns the vertical scroll. */
:root[data-viewport-profile="handheld-wide"] .settings-workspace {
  grid-template-columns: 164px minmax(0, 1fr);
  gap: 8px;
}

:root[data-viewport-profile="handheld-wide"] .settings-nav {
  top: 6px;
  gap: 2px;
}

:root[data-viewport-profile="handheld-wide"] .settings-nav-item {
  min-height: 36px;
  padding: 5px 7px;
  font-size: .7rem;
}

/* The Pocket landscape viewport has enough width for a dense two-column
   theme grid. Keep the cards easy to hit while letting the complete picker
   and the Android TV switch fit in one comfortable scroll region. */
:root[data-viewport-profile="handheld-wide"] .theme-options {
  gap: 6px;
}

:root[data-viewport-profile="handheld-wide"] .theme-choice {
  grid-template-columns: 44px minmax(0, 1fr);
  min-height: 54px;
  gap: 8px;
  padding: 7px;
}

:root[data-viewport-profile="handheld-wide"] .theme-palette {
  width: 44px;
  height: 34px;
}

:root[data-viewport-profile="handheld-wide"] .theme-copy strong { font-size: .78rem; }
:root[data-viewport-profile="handheld-wide"] .theme-copy small { font-size: .62rem; }

:root[data-viewport-profile="handheld-4x3"] .account-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 6px;
}

:root[data-viewport-profile="handheld-4x3"] .settings-workspace {
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
}
:root[data-viewport-profile="handheld-4x3"] .settings-nav {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  padding: 3px;
  overflow: visible;
}

:root[data-viewport-profile="handheld-4x3"] .settings-nav-item {
  min-width: 0;
  min-height: 44px;
  padding: 4px 1px;
  flex-direction: column;
  gap: 2px;
}

:root[data-viewport-profile="handheld-4x3"] .settings-nav-item .icon { width: 16px; height: 16px; }
:root[data-viewport-profile="handheld-4x3"] .settings-nav-item span { font-size: 0; }
:root[data-viewport-profile="handheld-4x3"] .settings-nav-item span::after {
  content: attr(data-short);
  font-size: .56rem;
}

:root[data-viewport-profile="handheld-wide"] .account-page-header .account-view-tabs,
:root[data-viewport-profile="handheld-4x3"] .account-page-header .account-view-tabs {
  width: min(330px, 100%);
  flex-basis: 330px;
  padding: 3px;
}

:root[data-viewport-profile="handheld-4x3"] .account-page-header .account-view-tabs {
  width: 100%;
  flex: none;
}

:root[data-viewport-profile="handheld-wide"] .account-view-tab,
:root[data-viewport-profile="handheld-4x3"] .account-view-tab {
  min-height: 36px;
  padding: 5px 6px;
  gap: 5px;
  font-size: .68rem;
}

:root[data-viewport-profile="handheld-wide"] .settings-panel,
:root[data-viewport-profile="handheld-4x3"] .settings-panel { padding: 9px 10px; }

/* Handheld overlays use the whole available height but retain two columns in
   landscape, avoiding the tall phone layout at 640px wide. */
:root[data-viewport-profile="handheld-wide"] .playback-menu-layer,
:root[data-viewport-profile="handheld-4x3"] .playback-menu-layer {
  align-items: stretch;
  grid-template-columns: minmax(0, 18%) minmax(0, 82%);
}

:root[data-viewport-profile="handheld-wide"] .playback-menu,
:root[data-viewport-profile="handheld-4x3"] .playback-menu {
  grid-column: 2;
  width: 100%;
  min-height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
}

:root[data-viewport-profile="handheld-wide"] .playback-menu-header,
:root[data-viewport-profile="handheld-4x3"] .playback-menu-header {
  display: flex;
  gap: 8px;
  padding: 8px 10px 6px;
}

:root[data-viewport-profile="handheld-wide"] .playback-menu-header-copy,
:root[data-viewport-profile="handheld-4x3"] .playback-menu-header-copy { grid-column: auto; }
:root[data-viewport-profile="handheld-wide"] .playback-menu-header-actions,
:root[data-viewport-profile="handheld-4x3"] .playback-menu-header-actions {
  grid-column: auto;
  display: flex;
}

:root[data-viewport-profile="handheld-wide"] :is(.playback-menu-section, .playback-menu-section-select),
:root[data-viewport-profile="handheld-4x3"] :is(.playback-menu-section, .playback-menu-section-select) {
  width: min(190px, 32vw);
  min-height: 38px;
}

:root[data-viewport-profile="handheld-wide"] .playback-menu-status,
:root[data-viewport-profile="handheld-4x3"] .playback-menu-status {
  min-height: 38px;
  padding: 5px 10px;
}

:root[data-viewport-profile="handheld-wide"] .playback-menu-body,
:root[data-viewport-profile="handheld-4x3"] .playback-menu-body { padding: 8px 10px; }

:root[data-viewport-profile="handheld-wide"] .playback-menu-grid,
:root[data-viewport-profile="handheld-4x3"] .playback-menu-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}

:root[data-viewport-profile="handheld-wide"] .playback-menu-grid select,
:root[data-viewport-profile="handheld-4x3"] .playback-menu-grid select {
  min-height: 40px;
  height: 40px;
}

:root[data-viewport-profile="handheld-wide"] .playback-menu-footer,
:root[data-viewport-profile="handheld-4x3"] .playback-menu-footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 7px 10px;
}

:root[data-viewport-profile="handheld-wide"] .playback-menu-footer .btn,
:root[data-viewport-profile="handheld-4x3"] .playback-menu-footer .btn {
  width: 100%;
  min-height: 38px;
  padding: 6px 8px;
}

@media (prefers-reduced-motion: reduce) {
  :root[data-viewport-profile="handheld-wide"] *,
  :root[data-viewport-profile="handheld-4x3"] * { scroll-behavior: auto !important; }
}

/* Android TV owns the full display even when exercised through the PWA QA shell. */
body.android-tv.tv-mode .app-shell {
  padding: 0;
}

/* Ten-foot controls should read as a short list of decisions, not a dense
   desktop form. Keep the handheld form unchanged. */
body.android-tv .playback-menu-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

body.android-tv .playback-menu-grid label,
body.android-tv .audio-live-control,
body.android-tv .audio-select-control {
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--tv-border, var(--line));
  border-radius: var(--tv-radius, 8px);
  background: color-mix(in srgb, var(--control-bg) 82%, transparent);
}

body.android-tv .playback-menu-grid label > small,
body.android-tv .playback-menu-grid .field-help,
body.android-tv .audio-live-control small,
body.android-tv .audio-select-control small {
  display: none;
}

body.android-tv .playback-menu-grid input[type="range"],
body.android-tv .audio-live-control input[type="range"] {
  min-height: 42px;
  height: 42px;
  padding: 0;
  accent-color: var(--tv-focus, var(--teal));
}

body.android-tv .playback-menu-grid output,
body.android-tv .audio-live-control output {
  justify-self: end;
  color: var(--teal);
  font-size: .82rem;
  font-weight: 850;
}

body.android-tv .playback-menu-grid label:focus-within,
body.android-tv .audio-live-control:focus-within,
body.android-tv .audio-select-control:focus-within {
  border-color: var(--tv-focus, var(--focus-ring));
  box-shadow: 0 0 0 3px var(--tv-focus-shadow, color-mix(in srgb, var(--focus-ring) 42%, transparent));
}

.tv-picture-format {
  display: grid;
  gap: 18px;
}

.tv-picture-format-heading {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.tv-picture-format-heading > span {
  display: grid;
  width: 46px;
  height: 46px;
  border-radius: 9px;
  background: var(--selected-bg);
  color: var(--selected-text);
  place-items: center;
}

.tv-picture-format-heading > span .icon { width: 24px; height: 24px; }
.tv-picture-format-heading > div { display: grid; min-width: 0; gap: 3px; }
.tv-picture-format-heading strong { font-size: 1.05rem; }
.tv-picture-format-heading small,
.tv-picture-format-hint { color: var(--muted); line-height: 1.4; }

.tv-picture-format-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tv-picture-format-option {
  display: grid;
  min-height: 116px;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  align-items: center;
  gap: 4px 12px;
  padding: 16px;
  border: 1px solid var(--tv-border, var(--line));
  border-radius: var(--tv-radius, 9px);
  background: var(--control-bg);
  color: var(--text);
  text-align: left;
}

.tv-picture-format-option > span { grid-row: 1 / 3; color: var(--muted); }
.tv-picture-format-option > span .icon { width: 30px; height: 30px; }
.tv-picture-format-option strong { font-size: .94rem; }
.tv-picture-format-option small { color: var(--muted); font-size: .7rem; line-height: 1.35; }
.tv-picture-format-option.active { border-color: var(--selected-border); background: var(--selected-bg); }
.tv-picture-format-option.active > span,
.tv-picture-format-option.active strong { color: var(--selected-text); }
.tv-picture-format-option:focus-visible { border-color: var(--tv-focus, var(--focus-ring)); outline: 3px solid var(--tv-focus, var(--focus-ring)); outline-offset: 3px; }
.tv-picture-format-hint { margin: 0; font-size: .72rem; }

body.android-tv.tv-mode .tv-picture-format-option {
  min-height: 142px;
  padding: 20px;
}

body.android-tv.tv-mode .tv-picture-format-option strong { font-size: 1.12rem; }
body.android-tv.tv-mode .tv-picture-format-option small { font-size: .78rem; }

/* Watch Room landing: communications and queue are available before playback. */
.room-landing {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(310px, .72fr);
  gap: 14px;
  margin-bottom: 14px;
}

.room-landing-main,
.room-landing-people,
.room-landing-queue {
  min-width: 0;
}

.room-landing-main {
  display: grid;
  gap: 12px;
}

.room-landing-stage,
.room-landing-queue,
.room-landing-people {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.room-landing-stage {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  display: grid;
  min-height: clamp(250px, 34vw, 430px);
  align-items: end;
  background:
    radial-gradient(circle at 78% 28%, color-mix(in srgb, var(--teal) 13%, transparent), transparent 34%),
    var(--panel-strong);
  background-position: center;
  background-size: cover;
}

.room-landing-stage-image {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
  opacity: 0;
  transform: scale(1.1);
  transition: opacity 220ms ease;
}

.room-landing-stage.artwork-ready .room-landing-stage-image {
  opacity: 1;
}

.room-landing-stage::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(to top right, rgb(5 8 12 / 98%) 0%, rgb(5 8 12 / 90%) 24%, rgb(5 8 12 / 57%) 52%, rgb(5 8 12 / 18%) 78%, rgb(5 8 12 / 6%) 100%),
    linear-gradient(to top, rgb(5 8 12 / 48%), transparent 48%);
  content: "";
  pointer-events: none;
}

.room-landing-stage-copy {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(860px, calc(100% - clamp(44px, 8vw, 92px)));
  max-width: 94%;
  gap: 10px;
  padding: clamp(22px, 4vw, 46px);
}

.room-landing-kicker,
.room-landing-section-head > div > span {
  color: var(--teal);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.room-landing-stage h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3.4vw, 3rem);
  line-height: 1.02;
  paint-order: stroke fill;
  text-shadow: 0 1px 2px rgb(0 0 0 / 92%), 0 0 8px rgb(0 0 0 / 58%);
  text-wrap: pretty;
  -webkit-text-stroke: .7px rgb(0 0 0 / 78%);
}

.room-landing-stage h2.room-landing-title-single {
  overflow: hidden;
  font-size: clamp(1.45rem, 5.1cqw, 3rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-landing-stage h2.room-landing-title-single.room-landing-title-compact {
  font-size: clamp(1.4rem, 4.45cqw, 2.55rem);
}

.room-landing-stage p {
  max-width: 60ch;
  margin: 0;
  color: var(--soft);
  line-height: 1.45;
}

.room-landing-facts,
.room-landing-actions,
.room-landing-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.room-landing-actions { flex-wrap: nowrap; }
.room-action-label-short { display: none; }

.room-landing-facts span {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 720;
}

.room-landing-facts span:not(:last-child)::after {
  margin-left: 8px;
  color: var(--line-strong, var(--line));
  content: "\00b7";
}

.room-landing-play {
  min-width: 156px;
}

@container (max-width: 700px) {
  .room-landing-actions .btn {
    min-width: 0;
    flex: 1 1 0;
    padding-inline: 10px;
  }

  .room-action-label-full { display: none; }
  .room-action-label-short { display: inline; }
}

.room-landing-queue,
.room-landing-people {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
}

.room-landing-queue {
  container-name: room-playlist-queue;
  container-type: inline-size;
}

.room-landing-section-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.room-landing-section-head > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.room-landing-section-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.room-landing-queue-items {
  max-height: 330px;
}

.room-landing-queue-items .room-preview-item {
  box-shadow: none;
}

.room-landing-people > audio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.room-landing-connection {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--control-bg);
}

.room-landing-connection > i {
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--muted) 14%, transparent);
}

.room-landing-connection > i.good { background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 16%, transparent); }
.room-landing-connection > i.warn { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 16%, transparent); }
.room-landing-connection > i.bad { background: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 16%, transparent); }

.room-landing-connection > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.room-landing-connection span,
.room-landing-empty span {
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.35;
}

.room-landing-participant-list {
  max-height: 300px;
  overflow: auto;
  overscroll-behavior: contain;
}

.room-landing-participant-list .participant-row {
  grid-template-columns: 34px minmax(0, 1fr) 22px;
  min-height: 58px;
}

.room-landing-participant-list .participant-avatar {
  width: 34px;
  height: 34px;
}

.room-landing-participant-list .participant-presence { flex-wrap: nowrap; }

.room-landing-audio {
  display: grid;
  gap: 7px;
  padding-top: 2px;
}

.room-landing-audio-button {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 46px;
  min-height: 58px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--control-bg);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.room-landing-audio-button:disabled {
  cursor: wait;
  opacity: .58;
}

.room-landing-audio-button.active {
  border-color: color-mix(in srgb, var(--green) 55%, var(--line));
  background: color-mix(in srgb, var(--green) 10%, var(--control-bg));
}

.room-landing-audio-button > :first-child {
  display: grid;
  place-items: center;
  color: var(--teal);
}

.room-landing-audio-button > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.room-landing-audio-button small {
  overflow: hidden;
  color: var(--muted);
  font-size: .68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-landing-audio-button .voice-meter {
  width: 46px;
}

.room-landing-volume {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
}

.room-landing-volume output {
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}

.room-landing-volume input {
  grid-column: 1 / -1;
  width: 100%;
}

.room-landing-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
}

.room-landing-tools .btn { width: 100%; }
.room-landing-tools .room-chat-button { width: 44px; height: 44px; }

.room-landing-empty {
  display: grid;
  gap: 3px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  text-align: center;
}

@media (max-width: 880px) {
  .room-landing { grid-template-columns: minmax(0, 1fr); }
  .room-landing-people { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .room-landing-people > .room-landing-section-head,
  .room-landing-people > .room-landing-connection,
  .room-landing-people > .room-landing-tools { grid-column: 1 / -1; }
  .room-landing-participant-list,
  .room-landing-audio { min-height: 0; }
}

@media (max-width: 600px) {
  .room-landing-stage { min-height: 310px; }
  .room-landing-stage-copy { max-width: 100%; padding: 22px; }
  .room-landing-people { grid-template-columns: minmax(0, 1fr); }
  .room-landing-people > * { grid-column: 1; }
  .room-landing-actions .btn { min-width: 0; flex: 1 1 0; }
}

/* Compact 4:3 handhelds have enough vertical room to move playlist artwork
   above its metadata. This returns the full row width to titles and facts. */
[data-viewport-profile="handheld-4x3"] .room-landing-queue-items .room-preview-item {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

[data-viewport-profile="handheld-4x3"] .room-landing-queue-items .room-preview-art-wrap {
  grid-column: 1 / -1;
  width: 100%;
}

[data-viewport-profile="handheld-4x3"] .room-landing-queue-items .room-preview-art {
  width: 100%;
  height: clamp(116px, 18vw, 170px);
  aspect-ratio: auto;
}

[data-viewport-profile="handheld-4x3"] .room-landing-queue-items .room-preview-copy {
  grid-column: 1;
  padding: 3px 2px 1px;
}

[data-viewport-profile="handheld-4x3"] .room-landing-queue-items .room-preview-item-actions {
  grid-column: 1;
  align-self: start;
}

[data-viewport-profile="handheld-4x3"] .room-landing-stage-copy {
  width: calc(100% - 40px);
  max-width: none;
}

[data-viewport-profile="handheld-4x3"] .room-landing-queue-items .room-preview-art-tags span {
  padding: 4px 7px;
  font-size: .64rem;
}

[data-viewport-profile="handheld-4x3"] .room-landing-queue-items .room-preview-art-tags span:nth-child(n + 3) {
  display: inline-block;
}

body.android-tv.tv-mode .room-landing {
  grid-template-columns: minmax(0, 1.48fr) minmax(390px, .68fr);
  gap: 22px;
  margin-bottom: 24px;
}

body.android-tv.tv-mode .room-landing-stage,
body.android-tv.tv-mode .room-landing-queue,
body.android-tv.tv-mode .room-landing-people {
  border-radius: var(--tv-radius, 10px);
  box-shadow: none;
}

body.android-tv.tv-mode .room-landing-stage { min-height: min(48vh, 520px); }
body.android-tv.tv-mode .room-landing-stage-copy { padding: clamp(34px, 4vw, 68px); }
body.android-tv.tv-mode .room-landing-stage h2 { font-size: clamp(2.3rem, 4vw, 4.2rem); }
body.android-tv.tv-mode .room-landing-stage p { font-size: 1rem; }
body.android-tv.tv-mode .room-landing-queue,
body.android-tv.tv-mode .room-landing-people { padding: 20px; }
body.android-tv.tv-mode .room-landing :is(.btn, .icon-btn, .room-landing-audio-button) { min-height: 54px; }
body.android-tv.tv-mode .room-landing .room-preview-item-actions .playlist-item-more {
  width: 34px;
  min-height: 34px;
  padding: 6px;
}
body.android-tv.tv-mode .room-landing .room-preview-art-actions .icon-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 7px;
}
body.android-tv.tv-mode .room-landing :is(button, input):focus-visible {
  outline: 3px solid var(--tv-focus, var(--focus-ring));
  outline-offset: 3px;
}

/* Retroid Pocket 5 and similar short, wide Android handhelds. */
@media (orientation: landscape) and (max-height: 560px) {
  .room-landing {
    grid-template-columns: minmax(0, 1.35fr) minmax(285px, .75fr);
    gap: 8px;
    margin-bottom: 8px;
  }

  .room-landing-main { gap: 8px; }
  .room-landing-stage { min-height: 196px; }
  .room-landing-stage-copy { max-width: 76%; gap: 6px; padding: 16px 18px; }
  .room-landing-stage h2 { font-size: clamp(1.35rem, 3.4vw, 2rem); }
  .room-landing-stage p { display: -webkit-box; overflow: hidden; font-size: .72rem; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .room-landing-actions .btn { min-height: 38px; padding: 7px 10px; }
  .room-landing-queue,
  .room-landing-people { gap: 6px; padding: 8px; }
  .room-landing-queue-items { max-height: 170px; }
  .room-landing-participant-list { max-height: 132px; }
  .room-landing-people { grid-template-columns: minmax(0, 1fr); }
  .room-landing-people > * { grid-column: 1; }
  .room-landing-audio-button { min-height: 44px; padding: 5px 8px; }
  .room-landing-audio-button small { display: none; }
  .room-landing-volume { padding: 3px 7px; }
  .room-landing-tools .btn { min-height: 38px; padding: 6px 8px; }
}

/* Chrome 109-based Android WebViews can split glyph rasters into horizontal
   bands when a heading's size resolves to a fractional cqw value. Keep the
   landing title on whole CSS pixels in native clients; the stepped sizes also
   preserve the existing single-line ellipsis contract for long episode names. */
body.native-client .room-landing-stage h2 {
  font-size: 28px;
  line-height: 30px;
  paint-order: normal;
  -webkit-text-stroke: 0;
}

body.native-client .room-landing-stage h2.room-landing-title-single { font-size: 28px; }
body.native-client .room-landing-stage h2.room-landing-title-compact { font-size: 24px; line-height: 26px; }

@media (orientation: landscape) and (max-height: 560px) {
  body.native-client .room-landing-stage h2,
  body.native-client .room-landing-stage h2.room-landing-title-single {
    font-size: 23px;
    line-height: 24px;
  }

  body.native-client .room-landing-stage h2.room-landing-title-compact {
    font-size: 21px;
    line-height: 22px;
  }
}

body.native-client.android-tv.tv-mode .room-landing-stage h2,
body.native-client.android-tv.tv-mode .room-landing-stage h2.room-landing-title-single {
  font-size: 48px;
  line-height: 52px;
}

body.native-client.android-tv.tv-mode .room-landing-stage h2.room-landing-title-compact {
  font-size: 44px;
  line-height: 48px;
}

/* Modal layers always own the viewport, including themes and handheld rails
   that establish their own stacking contexts. */
.app-shell > .share-sheet-layer { z-index: 1300; }
.toast-region { z-index: 1400; }
body.android-tv .tv-select-menu { z-index: 1350; }

.playlist-settings-sheet {
  width: min(760px, 100%);
  max-height: min(860px, calc(100dvh - max(16px, env(safe-area-inset-top))));
}

.playlist-presentation-form,
.playlist-presentation-fields,
.playlist-schedule-editor,
.playlist-display-editor {
  display: grid;
  gap: 12px;
}

.playlist-banner-editor {
  position: relative;
  display: grid;
  gap: 8px;
}

.playlist-banner-preview,
.playlist-banner-actions label { cursor: pointer; }

.playlist-banner-editor input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.playlist-banner-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 172px;
  overflow: hidden;
  border: 1px dashed color-mix(in srgb, var(--teal) 54%, var(--line));
  border-radius: 10px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--teal) 10%, var(--panel-surface)), var(--panel-surface));
}

.playlist-banner-preview::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(30deg, rgba(0, 0, 0, .68), transparent 70%);
  content: "";
  pointer-events: none;
}

.playlist-banner-preview img {
  width: 100%;
  height: 172px;
  object-fit: cover;
}

.playlist-banner-preview > span {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 5px;
  color: var(--muted);
}

.playlist-banner-preview > span .icon {
  width: 32px;
  height: 32px;
  color: var(--teal);
}

.playlist-banner-preview > span strong { color: var(--text); }
.playlist-banner-preview > span small { font-size: .72rem; }

.playlist-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.playlist-presentation-fields label,
.playlist-schedule-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 750;
}

.playlist-presentation-fields textarea {
  min-height: 104px;
  resize: vertical;
}

.playlist-presentation-fields label:has(textarea) { position: relative; }
.playlist-presentation-fields label:has(textarea) > small { position: absolute; right: 8px; bottom: 7px; font-size: .62rem; }

.playlist-schedule-editor,
.playlist-display-editor {
  margin: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--panel-surface) 72%, transparent);
}

.playlist-schedule-editor legend,
.playlist-display-editor legend {
  padding: 0 5px;
  font-size: .9rem;
  font-weight: 850;
}

.playlist-schedule-editor > p,
.playlist-display-editor > p {
  color: var(--muted);
  font-size: .76rem;
}

.playlist-schedule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.playlist-schedule-grid > [hidden] { display: none; }

.playlist-schedule-preview {
  padding: 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--teal) 9%, var(--panel));
}

.playlist-settings-actions {
  position: sticky;
  bottom: calc(-1 * max(15px, env(safe-area-inset-bottom)));
  margin: 0 -15px calc(-1 * max(15px, env(safe-area-inset-bottom)));
  padding: 11px 15px max(15px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--panel-surface);
}

.hosted-playlist-controls {
  margin-top: 10px;
}

.hosted-playlist-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.hosted-playlist-summary .entity-meta { margin-top: 6px; }

.hosted-playlist-actions,
.hosted-playlist-footer {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hosted-playlist-grid {
  display: grid;
  gap: 8px;
}

.hosted-playlist-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  min-height: 92px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--panel-surface) 82%, transparent);
}

.hosted-playlist-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 92px;
  overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--teal) 15%, var(--panel)), var(--panel));
  color: var(--teal);
  font-size: 1.15rem;
  font-weight: 850;
}

.hosted-playlist-art img { width: 100%; height: 100%; min-height: 92px; object-fit: cover; }
.hosted-playlist-art b { position: absolute; left: 6px; bottom: 6px; display: grid; min-width: 24px; min-height: 24px; padding: 2px 5px; place-items: center; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; background: rgba(2,6,10,.78); color: white; font-size: .68rem; }
.hosted-playlist-item:not(.has-artwork) .hosted-playlist-art b { display: none; }
.hosted-playlist-more { position: absolute; top: 7px; right: 7px; z-index: 2; width: 31px; min-width: 31px; height: 31px; min-height: 31px; padding: 6px; border-color: rgb(255 255 255 / 20%); background: rgb(5 8 12 / 84%); box-shadow: 0 2px 8px rgb(0 0 0 / 42%); color: #fff; backdrop-filter: blur(5px); }

.hosted-playlist-copy {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  padding: 11px 12px;
}

.hosted-playlist-copy strong,
.hosted-playlist-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hosted-playlist-copy small { color: var(--muted); font-size: .72rem; }
.hosted-playlist-copy p { display: -webkit-box; overflow: hidden; margin: 1px 0; color: var(--soft); font-size: .72rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }

.hosted-playlist-facts { display: flex; flex-wrap: wrap; gap: 5px; }
.hosted-playlist-facts span { padding: 2px 6px; border: 1px solid var(--line); border-radius: 999px; color: var(--soft); font-size: .61rem; white-space: nowrap; }
.hosted-playlist-footer { justify-content: flex-end; margin-top: 12px; }
.short-label { display: none; }

.hosted-playlist-items.layout-compact .hosted-playlist-item { grid-template-columns: 52px minmax(0, 1fr); min-height: 54px; }
.hosted-playlist-items.layout-compact .hosted-playlist-art,
.hosted-playlist-items.layout-compact .hosted-playlist-art img { min-height: 54px; }
.hosted-playlist-items.layout-compact .hosted-playlist-copy p,
.hosted-playlist-items.layout-compact .hosted-playlist-facts { display: none; }

@media (max-width: 700px) {
  .hosted-playlist-summary { grid-template-columns: minmax(0, 1fr); }
  .hosted-playlist-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 42px; }
  .hosted-playlist-actions :is(.btn, .icon-btn) { width: 100%; min-width: 0; }
  .hosted-playlist-actions .wide-label { display: none; }
  .hosted-playlist-actions .short-label { display: inline; }
  .hosted-playlist-item,
  .hosted-playlist-items.layout-compact .hosted-playlist-item { grid-template-columns: minmax(0, 1fr); }
  .hosted-playlist-art,
  .hosted-playlist-items.layout-compact .hosted-playlist-art { width: 100%; min-height: 0; aspect-ratio: 16 / 9; }
  .hosted-playlist-art img,
  .hosted-playlist-items.layout-compact .hosted-playlist-art img { min-height: 0; aspect-ratio: 16 / 9; object-fit: cover; }
  .hosted-playlist-copy { align-content: start; padding: 10px 11px 12px; }
  .hosted-playlist-copy strong { white-space: normal; overflow-wrap: anywhere; }
  .hosted-playlist-items.layout-compact .hosted-playlist-copy small { display: block; }
}

:root[data-viewport-profile="handheld-wide"] .hosted-playlist-summary {
  grid-template-columns: minmax(0, 1fr) auto;
}

:root[data-viewport-profile="handheld-wide"] .hosted-playlist-actions {
  display: grid;
  grid-template-columns: minmax(132px, 1fr) minmax(104px, .8fr) 40px;
  gap: 6px;
}

:root[data-viewport-profile="handheld-wide"] .hosted-playlist-actions :is(.btn, .icon-btn) {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .playlist-presentation-copy { min-height: 150px; max-width: 96%; padding: 17px; }
  .playlist-presentation-card { min-height: 150px; }
  .playlist-presentation-card.compact,
  .playlist-presentation-card.compact .playlist-presentation-copy { min-height: 92px; }
  .playlist-schedule-grid { grid-template-columns: minmax(0, 1fr); }
  .playlist-banner-preview, .playlist-banner-preview img { min-height: 130px; height: 130px; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .playlist-settings-layer { align-items: stretch; padding: 5px; }
  .playlist-settings-sheet { align-self: stretch; width: min(900px, 100%); max-height: 100%; border: 1px solid var(--line); border-radius: 8px; }
  .playlist-presentation-form { grid-template-columns: minmax(240px, .8fr) minmax(320px, 1.2fr); align-items: start; }
  .playlist-banner-editor { grid-row: 1 / span 2; }
  .playlist-banner-preview, .playlist-banner-preview img { min-height: 132px; height: 132px; }
  .playlist-schedule-editor { grid-column: 2; }
  .playlist-settings-actions { grid-column: 1 / -1; }
}

body.android-tv.tv-mode .playlist-settings-sheet {
  width: min(920px, calc(100vw - 84px));
}

body.android-tv.tv-mode .playlist-settings-sheet :is(button, input, select, textarea):focus-visible {
  outline: 3px solid var(--tv-focus, var(--focus-ring));
  outline-offset: 3px;
}

.handheld-navigation-choice label {
  min-width: min(230px, 100%);
}

.handheld-navigation-choice select {
  width: 100%;
}

/* Retroid handhelds recover the permanent rail width and expose primary
   navigation as a left-edge drawer. The classic rail remains a persisted
   Appearance option. */
:is(:root[data-viewport-profile="handheld-wide"], :root[data-viewport-profile="handheld-4x3"]) .app-shell.handheld-nav-drawer {
  padding-left: 0;
}

:is(:root[data-viewport-profile="handheld-wide"], :root[data-viewport-profile="handheld-4x3"]) .app-shell.handheld-nav-drawer > .bottom-nav {
  right: auto;
  left: 0;
  z-index: 72;
  border-right: 0;
  border-left: 0;
  background: linear-gradient(to right, var(--nav-bg) 0%, color-mix(in srgb, var(--nav-bg) 88%, transparent) 76%, transparent 100%);
  box-shadow: none;
  transform: translateX(calc(-100% - 8px));
  visibility: hidden;
  pointer-events: none;
  transition: transform 180ms ease, visibility 0s linear 180ms;
}

:is(:root[data-viewport-profile="handheld-wide"], :root[data-viewport-profile="handheld-4x3"]) .app-shell.handheld-nav-drawer.handheld-nav-open > .bottom-nav {
  z-index: 74;
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.handheld-nav-trigger,
.handheld-nav-scrim {
  position: fixed;
  border: 0;
}

.handheld-nav-trigger {
  top: 50%;
  right: auto;
  left: max(0px, env(safe-area-inset-left));
  z-index: 71;
  display: grid;
  width: 34px;
  min-height: 64px;
  padding: 7px;
  border: 1px solid var(--selected-border);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--panel-surface) 94%, transparent);
  box-shadow: 8px 0 24px rgb(0 0 0 / 26%);
  color: var(--selected-text);
  place-items: center;
  transform: translateY(-50%);
  transition: left 180ms ease, background-color 140ms ease;
  backdrop-filter: blur(14px);
}

.handheld-nav-trigger .icon {
  width: 19px;
  height: 19px;
}

.app-shell.handheld-nav-open > .handheld-nav-trigger {
  left: calc(var(--handheld-rail) + env(safe-area-inset-left));
}

:is(:root[data-viewport-profile="handheld-wide"], :root[data-viewport-profile="handheld-4x3"]) .app-shell.handheld-nav-corner .topbar .handheld-nav-trigger-inline {
  position: relative;
  top: auto;
  right: auto;
  left: auto;
  z-index: 73;
  width: 34px;
  min-height: 34px;
  height: 34px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
  box-shadow: none;
  color: var(--soft);
  transform: none;
  backdrop-filter: none;
}

:is(:root[data-viewport-profile="handheld-wide"], :root[data-viewport-profile="handheld-4x3"]) .app-shell.handheld-nav-corner > .topbar {
  z-index: 73;
}

:is(:root[data-viewport-profile="handheld-wide"], :root[data-viewport-profile="handheld-4x3"]) .app-shell.handheld-nav-corner.handheld-nav-open .topbar .handheld-nav-trigger-inline {
  right: auto;
  left: auto;
  background: color-mix(in srgb, var(--selected-bg) 82%, var(--subtle-bg));
  color: var(--selected-text);
}

.handheld-nav-scrim {
  z-index: 70;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: 0;
  background: rgb(0 0 0 / 48%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  touch-action: pan-y;
  transition: opacity 180ms ease, visibility 0s linear 180ms;
}

.app-shell.handheld-nav-open > .handheld-nav-scrim {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

@media (prefers-reduced-motion: reduce) {
  :is(:root[data-viewport-profile="handheld-wide"], :root[data-viewport-profile="handheld-4x3"]) .app-shell.handheld-nav-drawer > .bottom-nav,
  .handheld-nav-trigger,
  .handheld-nav-scrim { transition: none; }
}

/* Browsing chrome must not consume the ten-foot player viewport. Keep only
   the player panel mounted visually so video and controls remain one D-pad
   focus surface and every persistent control fits below the picture. */
body.android-tv.tv-mode.room-player-active .tv-page-bar,
body.android-tv.tv-mode.room-player-active .tv-page-content > :not(.player-panel) {
  display: none;
}

body.android-tv.tv-mode.room-player-active :is(.tv-page, .tv-page-content) {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  padding: 0;
}

body.android-tv.tv-mode.room-player-active .room-active .player-panel {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
}
html.app-locked,
body.app-locked {
  background: #070b0e !important;
  overflow: hidden;
}

body.app-locked #app.app-lock-shell {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  color: var(--text, #f4f7f8);
  background: radial-gradient(circle at 50% 15%, rgba(72, 186, 177, .12), transparent 42%), #070b0e;
}

.app-lock-card {
  width: min(430px, 100%);
  display: grid;
  gap: 16px;
  padding: clamp(24px, 6vw, 40px);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 24px;
  background: rgba(16, 23, 28, .97);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
}

.app-lock-card h1,
.app-lock-card p { margin: 0; }
.app-lock-card p,
.app-lock-card small { color: var(--muted, #a8b2b7); }
.app-lock-mark { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto; border-radius: 20px; color: var(--accent, #78d7c9); background: rgba(83, 194, 178, .12); }
.app-lock-mark svg { width: 30px; height: 30px; }
.app-lock-form { display: grid; gap: 12px; }
.app-lock-form input { width: 100%; min-height: 56px; text-align: center; font-size: 1.4rem; letter-spacing: .45em; }
.app-lock-form .btn { min-height: 50px; justify-content: center; }
.app-security-settings { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border, rgba(255,255,255,.12)); }
.recent-playback-choice-sheet { max-width: 42rem; }
.recent-playback-choices { display: grid; gap: .65rem; margin: .25rem 0 1rem; }
.recent-playback-choice {
  display: grid; grid-template-columns: 2.7rem minmax(0, 1fr) auto; align-items: center; gap: .8rem;
  width: 100%; padding: .8rem; color: inherit; text-align: left; background: color-mix(in srgb, var(--panel, #11171c) 92%, white 8%);
  border: 1px solid var(--line, rgba(255,255,255,.14)); border-radius: .8rem;
}
.recent-playback-choice:hover, .recent-playback-choice:focus-visible { border-color: var(--accent, #e9b453); background: color-mix(in srgb, var(--panel, #11171c) 84%, var(--accent, #e9b453) 16%); }
.recent-playback-choice-icon { display: grid; place-items: center; width: 2.7rem; aspect-ratio: 1; border-radius: 50%; background: color-mix(in srgb, var(--accent, #e9b453) 20%, transparent); color: var(--accent, #e9b453); }
.recent-playback-choice-icon.saved { background: color-mix(in srgb, #f0c14b 24%, transparent); color: #ffe39a; }
.retro-progress-protected { border-color: color-mix(in srgb, #f0c14b 62%, var(--line)); background: color-mix(in srgb, #f0c14b 16%, transparent); color: #ffe39a; }
.retro-progress-protected svg { width: 12px; height: 12px; }
.recent-playback-choice > span:nth-child(2) { display: grid; min-width: 0; gap: .28rem; }
.recent-playback-choice strong, .recent-playback-choice small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-playback-choice small { color: var(--muted, #9ca7ad); }
.recent-playback-choice i { display: block; height: .22rem; overflow: hidden; background: rgba(255,255,255,.12); border-radius: 1rem; }
.recent-playback-choice i b { display: block; height: 100%; background: var(--accent, #e9b453); border-radius: inherit; }

@media (max-width: 520px) {
  .recent-playback-choice-sheet .settings-actions { display: grid; grid-template-columns: 1fr; }
  .recent-playback-choice-sheet .settings-actions .btn { width: 100%; }
}

/* Artwork-first cards keep Watch Room and hosted-playlist metadata readable
   on narrow touch displays. Card actions stay on the artwork, not in a rail. */
@media (max-width: 600px) {
  .room-preview-item,
  .room-landing-queue-items .room-preview-item {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 0;
    padding: 7px;
    border-radius: 10px;
  }

  .room-preview-art-wrap,
  .room-preview-index,
  .room-preview-art { width: 100%; }
  .room-preview-art-wrap { grid-column: 1; border-radius: 7px; }
  .room-preview-art { min-height: 0; aspect-ratio: 16 / 9; border-radius: 7px; }

  .room-preview-copy {
    grid-column: 1;
    width: 100%;
    padding: 10px 4px 5px;
  }

  .room-preview-copy strong {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .room-preview-facts { margin-top: 5px; }
  .room-preview-summary { font-size: .73rem; -webkit-line-clamp: 3; }
  .room-preview-item-actions { grid-column: 1; width: 100%; padding: 3px 4px 5px; }

  .active-room-dock.compact {
    right: 12px;
    left: 12px;
    width: auto;
  }

  .active-room-dock.compact .active-room-dock-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .active-room-dock.compact .active-room-dock-head .action-row {
    flex-wrap: nowrap;
    gap: 5px;
  }

  .active-room-dock.compact .active-room-dock-head .icon-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 8px;
  }

  .view-home .page-header { position: relative; }
  .view-home .page-header > div:first-child { padding-right: 50px; }

  .view-home .page-header .compact-actions,
  .view-home .page-header .compact-actions.has-playlist-create {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding-right: 0;
  }

  .view-home .home-library-refresh {
    position: absolute;
    top: 0;
    right: 0;
    width: 42px;
    height: 42px;
  }

  .home-library-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    top: max(8px, env(safe-area-inset-top));
    gap: 5px;
    overflow: visible;
    box-shadow: 0 8px 22px rgb(0 0 0 / 16%);
  }
  .home-library-tabs .tab-btn {
    min-width: 0;
    padding-inline: 5px;
    font-size: clamp(.63rem, 2.8vw, .72rem);
    white-space: nowrap;
  }
}

/* The playlist column can be narrow even on a wider device. Query the card's
   actual container so artwork-first composition is reliable on phones, Nova's
   4:3 display, split-screen, and future compact layouts. */
@container room-playlist-queue (max-width: 520px) {
  .room-landing-queue-items .room-preview-item {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 0;
    padding: 7px;
    border-radius: 10px;
  }

  .room-landing-queue-items .room-preview-art-wrap,
  .room-landing-queue-items .room-preview-art {
    grid-column: 1;
    width: 100%;
  }

  .room-landing-queue-items .room-preview-art-wrap,
  .room-landing-queue-items .room-preview-art {
    border-radius: 7px;
  }

  .room-landing-queue-items .room-preview-art {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .room-landing-queue-items .room-preview-copy {
    grid-column: 1;
    width: 100%;
    padding: 10px 4px 5px;
  }

  .room-landing-queue-items .room-preview-copy strong {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .room-landing-queue-items .room-preview-item-actions {
    grid-column: 1;
    width: 100%;
    padding: 3px 4px 5px;
  }
}

@media (min-width: 480px) and (max-width: 600px) {
  .web-client .view-home .page-header h1 {
    max-width: none;
    font-size: clamp(1.28rem, 4.4vw, 1.52rem);
    letter-spacing: .015em;
    white-space: nowrap;
  }
}

@media (max-width: 420px) {
  .active-room-dock.compact .active-room-title small,
  .active-room-dock.compact .dock-restore-icon { display: none; }

  .active-room-dock.compact .active-room-dock-head .icon-btn {
    width: 35px;
    min-width: 35px;
    height: 35px;
    min-height: 35px;
    padding: 7px;
  }

  .web-client .view-home .page-header .compact-actions .btn {
    gap: 4px;
    padding-inline: 5px;
    font-size: .7rem;
  }

  .web-client .view-home .page-header .compact-actions .btn .icon {
    width: 15px;
    height: 15px;
  }
}
/* Loach Studio Account device authorization */
.account-enrollment,
.account-enrollment-start {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.account-enrollment.connected {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--good, #54c77a) 48%, var(--border));
  border-radius: var(--radius, 14px);
  background: color-mix(in srgb, var(--good, #54c77a) 8%, var(--panel));
}

.account-enrollment-icon,
.account-enrollment-assurance > span,
.settings-account-session > span:first-child {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  color: var(--good, #54c77a);
  background: color-mix(in srgb, currentColor 12%, transparent);
}

.account-enrollment-copy,
.account-enrollment-code,
.account-enrollment-assurance > div,
.settings-account-session > div {
  display: grid;
  gap: .2rem;
  min-width: 0;
}

.account-enrollment-copy small,
.account-enrollment-code small {
  color: var(--muted);
  font-size: .74rem;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.account-enrollment-copy strong,
.settings-account-session strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-enrollment-copy span,
.account-enrollment-code span,
.account-enrollment-assurance small,
.settings-account-session small {
  color: var(--muted);
}

.account-enrollment-assurance {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .85rem;
  align-items: center;
  padding: .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 14px);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
}

.account-enrollment-code {
  padding: 1.1rem;
  border: 1px solid color-mix(in srgb, var(--accent) 52%, var(--border));
  border-radius: var(--radius, 14px);
  text-align: center;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
}

.account-enrollment-code strong {
  font-size: clamp(1.65rem, 6vw, 2.5rem);
  letter-spacing: .15em;
  line-height: 1.1;
}

.account-enrollment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}

.settings-account-session {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .8rem;
  align-items: center;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 14px);
}

@media (max-width: 520px) {
  .account-enrollment.connected,
  .settings-account-session { grid-template-columns: auto minmax(0, 1fr); }
  .account-enrollment.connected > .status-pill,
  .settings-account-session > .status-pill { grid-column: 2; justify-self: start; }
  .account-enrollment-actions > .btn { flex: 1 1 auto; }
}
.retro-handoff-sheet{max-width:720px}
.retro-execution-picker{grid-template-columns:repeat(3,minmax(0,1fr))}
.retro-stream-summary{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:start;gap:12px;margin-top:12px;padding:13px 14px;border:1px solid color-mix(in srgb,var(--teal) 42%,var(--line));border-radius:14px;background:color-mix(in srgb,var(--teal) 8%,var(--panel))}
.retro-stream-summary>div{display:grid;gap:3px;min-width:0}.retro-stream-summary small{color:var(--muted);line-height:1.4}
.retro-handoff-options{display:grid;gap:10px;margin-top:12px}
.retro-handoff-options .check-row{margin:0;border:1px solid var(--line);border-radius:14px;background:color-mix(in srgb,var(--panel) 86%,transparent)}
.retro-transfer-security-note{margin:12px 2px 0;color:var(--muted);font-size:.82rem;line-height:1.45}
.retro-transfer-active{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:14px;padding:14px;border:1px solid color-mix(in srgb,var(--good) 45%,var(--line));border-radius:16px;background:color-mix(in srgb,var(--good) 8%,var(--panel))}
.retro-transfer-active div{display:grid;gap:3px;min-width:0}.retro-transfer-active strong,.retro-transfer-active small{overflow:hidden;text-overflow:ellipsis}.retro-transfer-active small{color:var(--muted)}
.retro-handoff-controller .retro-game-surface{opacity:0;pointer-events:none}
.retro-handoff-controller .retro-player-hud{z-index:5}
.retro-handoff-companion{position:absolute;inset:0;z-index:4;display:grid;align-content:center;justify-items:center;gap:18px;padding:clamp(24px,6vw,64px);text-align:center;background:radial-gradient(circle at 50% 32%,color-mix(in srgb,var(--accent) 18%,transparent),transparent 46%),linear-gradient(180deg,var(--page),color-mix(in srgb,var(--panel) 94%,black));color:var(--text)}
.retro-handoff-companion>div:not(.retro-handoff-companion-art):not(.retro-handoff-companion-facts):not(.action-row){max-width:620px}.retro-handoff-companion h2{margin:6px 0 8px}.retro-handoff-companion p{margin:0;color:var(--muted);line-height:1.5}
.retro-handoff-companion-art{display:grid;place-items:center;width:76px;height:76px;border-radius:24px;background:color-mix(in srgb,var(--accent) 18%,var(--panel));border:1px solid color-mix(in srgb,var(--accent) 55%,var(--line));color:var(--accent)}
.retro-handoff-companion-art svg{width:38px;height:38px}.retro-handoff-companion-facts{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}.retro-handoff-companion-facts span{display:grid;gap:2px;min-width:130px;padding:10px 14px;border:1px solid var(--line);border-radius:12px;background:var(--panel)}.retro-handoff-companion-facts small{color:var(--muted)}
.retro-output-video-hidden canvas{visibility:hidden!important}
@media(max-width:600px){.retro-execution-picker{grid-template-columns:1fr}.retro-transfer-active{grid-template-columns:auto minmax(0,1fr)}.retro-transfer-active .btn{grid-column:1/-1;width:100%}.retro-handoff-companion{padding:24px 18px}.retro-handoff-companion .action-row{width:100%}.retro-handoff-companion .action-row .btn{flex:1}}
/* Retro save management keeps room progress visually distinct from portable
   save files, while using the same sheet rhythm as handoff and playback. */
.retro-save-sheet {
  width: min(680px, calc(100vw - 24px));
  max-height: min(820px, calc(100dvh - 28px));
  overflow: auto;
}

.retro-save-working,
.retro-save-library-summary,
.retro-save-candidate {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line, rgba(255, 255, 255, .18));
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
  color: inherit;
  text-align: left;
}

.retro-save-library-summary { grid-template-columns: auto minmax(0, 1fr); margin-top: 10px; }
.retro-save-working strong,
.retro-save-library-summary strong,
.retro-save-candidate strong { display: block; }
.retro-save-working small,
.retro-save-library-summary small,
.retro-save-candidate small { display: block; margin-top: 3px; color: var(--muted, #a9a9a9); }
.retro-save-candidates { display: grid; gap: 8px; margin: 14px 0; }
.retro-save-candidate { cursor: pointer; appearance: none; }
.retro-save-candidate:hover,
.retro-save-candidate:focus-visible { border-color: var(--accent, #d6a64d); background: rgba(214, 166, 77, .08); }
.retro-save-candidate.selected { border-color: var(--accent, #d6a64d); box-shadow: inset 3px 0 0 var(--accent, #d6a64d); }
.retro-save-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.retro-save-actions .btn { flex: 1 1 150px; }
.retro-save-actions .icon-btn { flex: 0 0 auto; }

@media (max-width: 560px) {
  .retro-save-sheet { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .retro-save-working,
  .retro-save-library-summary,
  .retro-save-candidate { padding: 12px; gap: 9px; }
  .retro-save-actions .btn { flex-basis: calc(50% - 6px); }
}
.media-folder-origins {
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid var(--line, rgba(255,255,255,.12));
  border-radius: 18px;
  background: var(--panel, rgba(20,24,32,.88));
}

.media-folder-origins > header,
.media-folder-origins > header > div,
.media-folder-origins article { display: flex; }
.media-folder-origins > header { align-items: center; gap: .7rem; margin-bottom: .75rem; }
.media-folder-origins > header > div,
.media-folder-origins article { flex-direction: column; gap: .15rem; }
.media-folder-origins > div { display: grid; gap: .5rem; }
.media-folder-origins article { padding: .7rem; border-radius: 12px; background: rgba(255,255,255,.05); }
.media-folder-origins small { color: var(--muted, #aab2c0); }
.commentary-track-summary {
  align-items: center;
  display: flex;
  gap: .5rem;
  margin-top: .45rem;
  min-width: 0;
}
.commentary-track-summary b {
  background: color-mix(in srgb, var(--accent, #68a9ff) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, #68a9ff) 44%, transparent);
  border-radius: 999px;
  color: var(--accent, #8fc0ff);
  flex: 0 0 auto;
  font-size: .68rem;
  letter-spacing: .06em;
  padding: .18rem .45rem;
  text-transform: uppercase;
}
.commentary-track-summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.release-capture-sheet { max-width: 42rem; }
.release-capture-form { display: grid; gap: 1rem; overflow: auto; padding: 0 1.1rem 1.1rem; }
.release-capture-identifier { display: grid; gap: .65rem; }
.release-barcode-photo { cursor: pointer; position: relative; }
.release-barcode-photo input, .release-capture-attachment input { inset: 0; opacity: 0; position: absolute; width: 100%; }
.release-capture-results { display: grid; gap: .45rem; }
.release-capture-result { align-items: center; background: var(--panel, rgba(255,255,255,.04)); border: 1px solid var(--border, rgba(255,255,255,.12)); border-radius: .8rem; color: inherit; display: grid; gap: .6rem; grid-template-columns: minmax(0,1fr) auto auto; padding: .75rem; text-align: left; }
.release-capture-result.selected { border-color: var(--accent, #68a9ff); box-shadow: 0 0 0 1px var(--accent, #68a9ff); }
.release-capture-result span { display: grid; min-width: 0; }
.release-capture-result small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.release-capture-result b { color: var(--accent, #8fc0ff); font-size: .72rem; white-space: nowrap; }
.release-copy-fields, .release-capture-attachments { display: grid; gap: .75rem; }
.release-capture-attachments { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.release-capture-attachment { border: 1px dashed var(--border, rgba(255,255,255,.2)); border-radius: .8rem; cursor: pointer; min-width: 0; padding: .8rem; position: relative; }
.release-capture-attachment > span { align-items: center; display: grid; gap: .15rem; grid-template-columns: auto minmax(0,1fr); }
.release-capture-attachment svg { grid-row: 1 / 3; }
.release-capture-attachment small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.release-capture-save { align-items: center; display: flex; gap: 1rem; justify-content: space-between; }
@media (max-width: 560px) {
  .release-capture-sheet { border-radius: 1.1rem 1.1rem 0 0; inset: auto 0 0; max-height: min(92dvh, 52rem); max-width: none; position: fixed; width: 100%; }
  .release-capture-attachments { grid-template-columns: 1fr; }
  .release-capture-save { align-items: stretch; flex-direction: column; }
  .release-capture-save .btn { justify-content: center; width: 100%; }
}

/* TV readability: override compact handheld rules at density-scaled TV sizes. */
html.android-tv-root { scroll-padding-block: 110px 24px; }
body.android-tv.tv-mode .account-page-header { flex-wrap: wrap; gap: 16px; }
body.android-tv.tv-mode .account-page-header .account-view-tabs {
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
  padding: 6px;
  gap: 6px;
}
body.android-tv.tv-mode .account-page-header .account-view-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 14px;
  gap: 8px;
  font-size: .85rem;
}
body.android-tv.tv-mode .settings-group-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  padding: 18px;
}
body.android-tv.tv-mode .settings-group-body > label {
  display: grid;
  min-width: 0;
  gap: 8px;
}
body.android-tv.tv-mode .settings-group-body small {
  font-size: .8rem;
  font-weight: 400;
  line-height: 1.5;
}
body.android-tv.tv-mode .settings-sticky-actions {
  position: static;
  width: 100%;
  margin: 16px 0 0;
  padding: 14px;
  justify-content: flex-end;
  background: var(--panel);
}
body.android-tv.tv-mode .room-landing-stage-copy {
  width: 100%;
  max-width: 100%;
  padding: clamp(24px, 3vw, 48px);
}
body.android-tv.tv-mode .room-landing-stage h2.room-landing-title-single,
body.native-client.android-tv.tv-mode .room-landing-stage h2.room-landing-title-single {
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: clamp(1.75rem, 3vw, 3rem);
  line-height: 1.15;
  text-overflow: clip;
}
body.android-tv.tv-mode .room-landing-stage h2.room-landing-title-single.room-landing-title-compact,
body.native-client.android-tv.tv-mode .room-landing-stage h2.room-landing-title-single.room-landing-title-compact {
  font-size: clamp(1.6rem, 2.6vw, 2.75rem);
  line-height: 1.15;
}
body.android-tv.tv-mode .tv-source-browser-head { scroll-margin-top: 110px; }
body.android-tv.tv-mode .tv-source-browser-head :is(h1, p) { overflow-wrap: anywhere; }
body.android-tv.tv-mode .tv-source-browser-head > div { min-width: 0; }
body.android-tv.tv-mode .share-intent-card small,
body.android-tv.tv-mode .page-header > div > p,
body.android-tv.tv-mode .settings-group > summary small { font-size: .8rem; line-height: 1.45; }
body.android-tv.tv-mode .tv-page-content .settings-nav {
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  scroll-padding-block: 8px;
}
@media (min-width: 2560px) and (min-height: 1400px) {
  html.android-tv-root { scroll-padding-top: 140px; }
}
body.android-tv.tv-mode .people-invites { margin-bottom: 16px; }
body.android-tv.tv-mode .playback-menu-grid > label { font-size: .85rem; line-height: 1.4; }
body.android-tv.tv-mode .playback-menu-grid :is(select, input) { font-size: .9rem; }
body.android-tv.tv-mode .tv-menu :is(.tv-menu-brand small, .tv-menu-footer small),
body.android-tv.tv-mode .tv-folder-tile small { font-size: .8rem; line-height: 1.4; }
@media (max-width: 1100px) {
  body.android-tv.tv-mode .tv-hero-copy { width: min(610px, 55vw); }
  body.android-tv.tv-mode .tv-hero-title { max-width: 42vw; }
}

/* Keep Watch Room controls together without a separate invitation URL row. */
.compact-watch-header { position: relative; }
.compact-watch-header .detail-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.compact-watch-header .entity-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-watch-header .entity-meta { display: none; }
.compact-watch-header .detail-head-actions { flex-wrap: nowrap; }
.watch-header-menu { position: relative; }
.watch-header-menu summary { list-style: none; cursor: pointer; }
.watch-header-menu summary::-webkit-details-marker { display: none; }
.watch-header-menu-items { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; display: grid; gap: 6px; width: 230px; max-width: 80vw; padding: 10px; border: 1px solid var(--subtle-border); border-radius: 14px; background: var(--panel, #171d29); box-shadow: 0 12px 30px #0008; }
.watch-header-menu-items .btn { justify-content: flex-start; }
.compact-watch-header[data-pull-label]::after { content: attr(data-pull-label); position: absolute; top: 100%; left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: 20px; background: var(--panel, #171d29); color: var(--text); z-index: 31; white-space: nowrap; }
@media (max-width: 480px) {
  .compact-watch-header .detail-head-actions { gap: 3px; }
  .compact-watch-header .icon-btn { width: 36px; height: 40px; min-width: 36px; }
}

/* Cross-platform UX: opaque sheets, unobstructed forms, consistent content density. */
.share-sheet,
.share-sheet .share-sheet-head,
.watch-header-menu-items { background: var(--control-bg); }
.share-sheet-head { padding-bottom: 12px; }
.share-link-section { flex-shrink: 0; }
:root[data-viewport-profile] body .settings-sticky-actions,
body.android-tv.tv-mode .settings-sticky-actions {
  position: static;
  margin-top: 16px;
  padding: 12px 0 0;
  width: 100%;
  justify-content: flex-end;
  background: transparent;
}
.home-resume-section { margin: 0 0 24px; }
.home-resume-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 12px; }
.home-resume-card { position: relative; isolation: isolate; display: block; aspect-ratio: 16 / 9; min-height: 156px; min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: #fff; text-align: left; }
.home-resume-art { position: relative; display: grid; place-items: center; height: 120px; background: linear-gradient(135deg,color-mix(in srgb,var(--teal) 20%,var(--control-bg)),var(--control-bg)); }
.home-resume-art.has-art { background-image: var(--tv-artwork); background-size: cover; background-position: center; }
.home-resume-art > svg { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; padding: 8px; border-radius: 50%; color: #fff; background: rgb(0 0 0 / 48%); }
.home-resume-card::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(to bottom, transparent 20%, rgb(0 0 0 / 20%) 40%, rgb(0 0 0 / 82%) 76%, rgb(0 0 0 / 94%) 100%); }
:root[data-viewport-profile] .home-resume-card .home-resume-art { position: absolute; inset: 0; height: 100%; background-size: cover; background-position: center; }
.home-resume-copy { position: absolute; right: 14px; bottom: 17px; left: 14px; z-index: 2; display: grid; gap: 6px; color: #fff; text-shadow: 0 1px 3px #000; }
.home-resume-copy strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:1rem; }
.home-resume-copy small { color: rgb(255 255 255 / 88%); }
.home-resume-progress { position: absolute; right: 0; bottom: 0; left: 0; z-index: 3; height: 4px; background: rgb(255 255 255 / 28%); }
.home-resume-progress > i { display: block; height: 100%; width: var(--progress); background: #50dfcb; }
.home-resume-empty { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:24px; padding:20px; border:1px solid var(--line); border-radius:14px; background:var(--panel); }
.home-resume-empty h2 { margin:0 0 6px; }
.home-resume-empty p { margin:0; color:var(--muted); }
.people-add-person { margin-bottom:16px; }
.people-add-person > summary { width:fit-content; min-height:44px; cursor:pointer; }
.people-add-person-body { padding-top:14px; }
.media-explore-summary { display:block; padding:12px 16px; }
.media-explore-summary summary { cursor:pointer; color:var(--muted); min-height:24px; }
.media-explore-summary p { margin:12px 0 0; }
.quick-picture-shortcut { display:grid; gap:8px; min-width:0; color:var(--muted); }
.quick-fit-buttons { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
.quick-fit-buttons .btn { white-space:normal; min-height:44px; font-size:.8rem; }
.quick-fit-buttons [aria-pressed="true"] { color:var(--teal); border-color:var(--teal); background:color-mix(in srgb,var(--teal) 12%,var(--control-bg)); }
body.android-tv .playback-menu-grid { grid-template-columns:minmax(0,1fr); }
body.android-tv .playback-menu-grid > label { gap:10px; font-size:.95rem; }
body.android-tv .playback-menu-grid select { min-height:48px; }
body.android-tv .playback-menu-layer { grid-template-columns:minmax(0,1fr) minmax(0,min(620px,72vw)); }
body.android-tv .playback-menu-header-actions { min-width:0; }
@media (max-width:600px) {
  .home-resume-grid { grid-auto-flow:column; grid-auto-columns:min(76vw,300px); grid-template-columns:none; overflow-x:auto; scroll-snap-type:x proximity; padding-bottom:8px; }
  .home-resume-card { scroll-snap-align:start; }
  .home-resume-empty { align-items:stretch; flex-direction:column; }
  .media-toolbar { flex-wrap:wrap; }
  .media-toolbar .btn { flex:1 1 auto; }
  .compact-watch-header .icon-btn { width:40px; min-width:40px; height:44px; }
}
:is(:root[data-viewport-profile="handheld-wide"],:root[data-viewport-profile="handheld-4x3"]) .home-resume-art { height:90px; }
:is(:root[data-viewport-profile="handheld-wide"],:root[data-viewport-profile="handheld-4x3"]) .people-add-person > summary { min-height:44px; }
/* Dialogs stay opaque even while the stock theme animates their entrance. */
.share-sheet { opacity: 1 !important; }
:root[data-viewport-profile] body.android-tv .playback-menu-grid { grid-template-columns: minmax(0,1fr); }
:root[data-viewport-profile] body.android-tv .playback-menu-layer { grid-template-columns:minmax(0,1fr) minmax(0,min(620px,72vw)); }
.web-client .view-home .page-header .compact-actions,
.web-client .view-home .page-header .compact-actions.has-playlist-create { display:flex; flex-wrap:wrap; }
.web-client .view-home .page-header .compact-actions .btn { flex:1 1 auto; width:auto; min-width:0; }
@media (max-width:600px) {
  .home-resume-grid { grid-auto-columns:min(82vw,320px); }
  .page-header .compact-actions .btn { white-space:normal; }
}
.account-app-menu { min-width:0; }
.account-app-menu > summary { min-height:44px; cursor:pointer; width:fit-content; margin-left:auto; }
.account-app-menu[open] > summary { margin-bottom:10px; }
.account-app-menu .account-view-tabs { max-width:100%; }
.device-group-heading { color:var(--muted); font-size:.85rem; margin:4px 0; }
:root[data-viewport-profile="handheld-4x3"] .account-page-header,
:root[data-viewport-profile="handheld-wide"] .account-page-header { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:center; }
:root[data-viewport-profile] .account-app-menu[open] { grid-column:1 / -1; }
.home-resume-grid { align-items:start; }
.home-resume-card:focus-visible { outline:3px solid var(--teal); outline-offset:3px; }
.home-resume-grid { padding:4px; margin-inline:-4px; }
.account-app-menu .account-view-tabs { display:flex; flex-wrap:wrap; gap:6px; }
.account-app-menu .account-view-tab { flex:1 1 100px; min-width:100px; white-space:nowrap; min-height:44px; }
@media (max-width:600px) {
  .account-app-menu .account-view-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
}
.home-resume-grid { grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); }
.settings-group-body.settings-form { display:grid; gap:16px; }
.settings-group-body.settings-form > label { display:grid; gap:7px; }
.settings-group-body.settings-form > label.inline-row { display:flex; }
@media (max-width:600px) {
  .home-resume-grid { grid-template-columns:none; }
  .view-rooms .page-header { position:relative; }
  .view-rooms .page-header > div:first-child { padding-right:50px; }
  .view-rooms .home-library-refresh { position:absolute; top:0; right:0; width:44px; height:44px; }
  .view-rooms .page-header .compact-actions { display:flex; flex-wrap:wrap; }
  .view-rooms .page-header .compact-actions .btn { flex:1 1 auto; }
  .home-library-tabs { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
:root[data-viewport-profile] .view-home .page-header .compact-actions,
:root[data-viewport-profile] .view-rooms .page-header .compact-actions { display:flex; flex-wrap:wrap; }
:root[data-viewport-profile] .view-home .page-header .compact-actions .btn,
:root[data-viewport-profile] .view-rooms .page-header .compact-actions .btn { flex:1 1 auto; width:auto; }
:root[data-viewport-profile] .home-library-refresh { flex:0 0 44px; width:44px; min-width:44px; height:44px; }
:is(:root[data-viewport-profile="handheld-wide"],:root[data-viewport-profile="handheld-4x3"]) .home-resume-grid {
  display:grid; grid-auto-flow:column; grid-auto-columns:min(46vw,300px); grid-template-columns:none;
  overflow-x:auto; scroll-snap-type:x proximity; padding-bottom:8px;
}
:is(:root[data-viewport-profile="handheld-wide"],:root[data-viewport-profile="handheld-4x3"]) .home-resume-card { scroll-snap-align:start; }

/* Deep menus: prioritize the task, keep secondary settings within reach. */
.share-sheet-head > div { min-width: 0; }
.share-sheet-head > .icon-btn { flex: 0 0 44px; min-width: 44px; min-height: 44px; }
.menu-disclosure { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.menu-disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 12px 14px; cursor: pointer; list-style: none; }
.menu-disclosure > summary::-webkit-details-marker { display: none; }
.menu-disclosure > summary > span { display: grid; gap: 4px; min-width: 0; }
.menu-disclosure > summary small { color: var(--muted); font-size: .76rem; font-weight: 400; }
.menu-disclosure > summary > .icon { flex-shrink: 0; transition: transform .15s; }
.menu-disclosure[open] > summary > .icon { transform: rotate(180deg); }
.menu-disclosure-body { padding: 0 14px 14px; }
.menu-disclosure > fieldset { border: 0; background: transparent; }
.menu-disclosure > fieldset > legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.playlist-presentation-form { grid-template-columns: minmax(0, 1fr); }
.playlist-presentation-form > * { min-width: 0; grid-column: 1; }
.playlist-presentation-fields textarea { padding-bottom: 24px; }
.playlist-settings-actions { z-index: 3; background: var(--control-bg); }
.playlist-settings-sheet { scroll-padding-bottom: 88px; scroll-padding-top: 110px; }
.playlist-banner-editor { grid-row: auto; }
.playlist-banner-editor:focus-within .playlist-banner-preview { outline: 3px solid var(--teal); outline-offset: 3px; }
.menu-action-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; grid-column: 1 / -1; border-block: 1px solid var(--line); padding-block: 8px; }
.playlist-item-actions-sheet .playlist-item-action.danger { grid-column: 1 / -1; margin-top: 6px; border-top-color: var(--line); }
.room-library-methods .share-method :is(strong, small) { white-space: normal; overflow: visible; text-overflow: clip; }
.room-rename-form { padding: 0; }
.room-library-methods { margin-bottom: 0; }
.download-decision-head.share-sheet-head { grid-template-columns: minmax(0, 1fr) auto; top: -22px; margin: -22px -22px 0; padding: 16px 22px; }
.download-decision-head > .download-decision-icon { display: none; }
.cast-track-disclosure { margin-top: 12px; }
.cast-track-disclosure .cast-content-select { margin-top: 0; padding-top: 0; border-top: 0; }
.video-frame-actions-preview { max-height: min(32dvh, 220px); width: 100%; object-fit: contain; background: #000; }
.video-frame-actions-sheet .playlist-item-action-list { grid-template-columns: minmax(0, 1fr); }
.prepare-form { grid-template-columns: minmax(0, 1fr); }
.prepare-preview-disclosure .prepare-preview-shell { position: static; }
.prepare-preview-disclosure canvas { max-height: 220px; object-fit: contain; }
input[data-controller-editing="true"] { outline: 3px solid var(--amber); outline-offset: 4px; }
.controller-adjustment-hint { position: fixed; z-index: 1500; max-width: calc(100vw - 16px); padding: 7px 12px; border: 1px solid var(--amber); border-radius: 8px; background: var(--control-bg); color: var(--text); font-size: .8rem; pointer-events: none; box-shadow: 0 3px 12px #0008; }
@media (orientation: landscape) and (max-height: 560px) {
  .video-frame-actions-sheet { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: start; width: min(820px, calc(100vw - 24px)); }
  .video-frame-actions-sheet .share-sheet-head { grid-column: 1 / -1; }
  .video-frame-actions-preview { max-height: 55dvh; margin: 0; align-self: center; }
  .video-frame-actions-sheet .playlist-item-action { grid-template-columns: 24px minmax(0, 1fr); padding: 10px 8px; }
}
