:root {
  --ui-scale:      1.25;
  --bg-deep:       #0d0d0f;
  --bg-panel:      #121214;
  --bg-card:       #18181c;
  --bg-card-hover: #1e1e24;
  --border:        #242430;
  --border-bright: #30303d;
  /* Light blue site chrome */
  --accent:        #7ec8e8;
  --accent-muted:  #4a8fb0;
  --accent-dim:    #1a3a4a;
  --accent-stream-hover: var(--accent);
  --accent-drag-target: #9fdcf5;
  /* LIVE (streaming) — distinct red */
  --status-live:       #e8344a;
  --status-live-dim:   #4a1020;
  --green-live:    #3ddc84;
  --green-dim:     #1a4a30;
  --red-danger:    #ff6b6b;
  --text-primary:  #e0e0e8;
  --text-secondary:#7a8090;
  --text-dim:      #3a3a48;
  --cell-bar-muted:#8f98ab;
  --amber-ghost:   #f59e0b;
  --amber-dim:     #3d2a08;
  --blue-live:     #38bdf8;
  --blue-dim:      #0c2a3d;
  --purple-variety:#a78bfa;
  --purple-dim:    #3b2f55;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  min-height: 100vh;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
body.body--modal-open {
  overflow: hidden;
}
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(126,200,232,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126,200,232,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

header {
  position: relative;
  z-index: 10;
  /* Flex: logo left, config right; global toolbar is position:absolute true center (see .header-stream-toolbar). */
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Same inset top as start (left in LTR): 11px + safe-area on the inline axis only. */
  padding-block: 11px;
  padding-inline: max(11px, env(safe-area-inset-left, 0px)) max(11px, env(safe-area-inset-right, 0px));
  height: 56px;
  /* Match sidebar / modals: scale chrome with Config → Sidebar Scale (--ui-scale). */
  zoom: var(--ui-scale, 1.25);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  padding: 0;
}

.header-stream-toolbar {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  min-width: 0;
  max-width: min(100%, calc(100vw - 200px));
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 8px;
  box-sizing: border-box;
  pointer-events: none;
}
.header-stream-toolbar .stream-global-toolbar {
  pointer-events: auto;
}
.stream-global-toolbar--header {
  flex-direction: row;
  flex-wrap: nowrap;
  width: auto;
  max-width: 100%;
  gap: 6px 10px;
}
.stream-global-toolbar--header .stream-global-toolbar-heading {
  display: none;
}

/* Toggle + radar only — aligns two 32px-tall marks without the wordmark affecting vertical center. */
.header-logo-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  line-height: 1;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  cursor: default;
  user-select: none;
  transform: translateY(0.07em);
}
.logo__accent { color: var(--accent); }

.header-logo-tv-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  color: var(--text-secondary);
  transform: translateY(-2.5px);
}
.header-logo-tv {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
  font-size: 14px;
  padding: 8px 18px;
}
.settings-btn__icon {
  display: block;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  align-self: center;
}
.settings-btn__label {
  display: inline-flex;
  align-items: center;
  height: 22px;
  line-height: 1;
}

/* ── Chat panel button ────────────────────────────────────────────── */
.chat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1;
}
.chat-btn__icon {
  display: block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  align-self: center;
}
.chat-btn__label {
  font-size: inherit;
  line-height: 1;
  height: 20px;
  display: inline-flex;
  align-items: center;
}
/* Slash is hidden by default; shown when chat is open to indicate "close chat" */
.chat-btn__slash {
  display: none;
}
.chat-btn--active .chat-btn__slash {
  display: block;
}
.chat-btn--active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(126, 200, 232, 0.10);
}
.chat-btn--active:hover {
  background: rgba(126, 200, 232, 0.18);
}

/* ── Side chat panel ─────────────────────────────────────────────── */
/*
 * The panel is a direct child of #streamArea (preserved across full rebuilds).
 * It is absolutely positioned over the side column area — the stream-area must
 * be the containing block (position: relative is set below).
 * Two modifier classes control positioning:
 *   --focused  : focused mode — panel aligns with the side column on the right
 *   --single   : single-stream mode — panel is also right-side, grid handles room
 */
.stream-area {
  position: relative;
}

#sideChatPanel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--chat-side-w, 340px);
  display: flex;
  flex-direction: column;
  background: #0e0e10;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  z-index: 10;
}

#sideChatPanel[hidden] {
  display: none !important;
}

/* Inset the panel to align with the stream-area's padding so it sits flush with the grid content.
 * Equal layout (default): 12px padding all sides.
 * Focused layout: 0 vertical, 6px horizontal (from the focused overrides). */
.stream-area:not(:has(.stream-unified--focused)) #sideChatPanel {
  top: 12px;
  right: 12px;
  bottom: 12px;
}
/* Focused mode: 4px top/bottom (= border-radius) so the rounded corners render cleanly
   without a large gap vs the stream; 6px right matches the stream-area's horizontal padding. */
.stream-area:has(.stream-unified--focused) #sideChatPanel {
  top: 4px;
  right: 6px;
  bottom: 4px;
}

/* ── Custom chat renderer ─────────────────────────────────────────── */
/* Header */
.chat-header {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  padding: calc(6px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: #111113;
}

.chat-header__icon {
  width: calc(18px * var(--ui-scale, 1));
  height: calc(18px * var(--ui-scale, 1));
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.85;
}

.chat-header__title {
  flex: 1;
  min-width: 0;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: calc(15px * var(--ui-scale, 1));
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header__channel {
  font-weight: 700;
  color: var(--accent);
}

.chat-header__emote-status {
  flex-shrink: 0;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: calc(10px * var(--ui-scale, 1));
  letter-spacing: 0.04em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.38);
  margin-right: calc(4px * var(--ui-scale, 1));
}

/* Gear/tune button — right side of header, turns accent on hover */
.chat-gear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(32px * var(--ui-scale, 1));
  height: calc(32px * var(--ui-scale, 1));
  flex-shrink: 0;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  transition: color 0.15s;
  padding: 0;
}
.chat-gear-btn:hover { color: var(--accent); background: transparent; }
.chat-gear-btn--active { color: var(--accent) !important; background: transparent !important; }

/* Body — flex container that holds one .chat-messages per channel */
.chat-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Scrollable message list (one per channel; only the active one is shown) */
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.22);
}

/* Scroll-to-bottom resume pill — floats inside .chat-body near the bottom */
.chat-resume-btn {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px 5px 10px;
  background: rgba(18, 18, 20, 0.92);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  color: rgba(255,255,255,0.75);
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}
.chat-resume-btn:hover {
  background: rgba(126,200,232,0.18);
  border-color: var(--accent);
  color: var(--accent);
}

/* Individual message row — font size driven by --chat-font-sz set by settings */
.chat-msg {
  padding: 2px 10px;
  font-size: var(--chat-font-sz, 14px);
  line-height: 1.55;
  color: #efeff1;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.chat-msg:hover {
  background: rgba(255,255,255,0.04);
}

/* @mention highlight */
.chat-msg--mention {
  background: rgba(126,200,232,0.10);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}
.chat-msg--mention:hover {
  background: rgba(126,200,232,0.16);
}

/* Room-state / system notice (follower-only, sub-only, etc.) */
.chat-notice {
  padding: 5px 12px;
  font-family: 'Rajdhani', sans-serif;
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.38);
  text-align: center;
  font-style: italic;
  user-select: none;
}

/* Badge row before username */
.chat-badges {
  display: inline;
  margin-right: 3px;
}

/* Image badge */
img.chat-badge {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: middle;
  object-fit: contain;
  margin-right: 2px;
  border-radius: 2px;
  position: relative;
  top: -1px;
}

/* Fallback text badge (when image fails to load) — override sizing */
span.chat-badge {
  display: inline-block;
  width: auto;
  height: auto;
  font-size: 0.58em;
  font-weight: 700;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.04em;
  padding: 1px 4px;
  border-radius: 2px;
  vertical-align: middle;
  position: relative;
  top: -1px;
  margin-right: 2px;
  line-height: 1.4;
  white-space: nowrap;
}
span.chat-badge--broadcaster { background: #38bdf8; color: #fff; }
span.chat-badge--moderator   { background: #00ad03; color: #fff; }
span.chat-badge--vip         { background: #e005b9; color: #fff; }
span.chat-badge--staff       { background: #8a2be2; color: #fff; }
span.chat-badge--admin       { background: #faaf19; color: #000; }
span.chat-badge--partner     { background: #9147ff; color: #fff; }

.chat-msg__name {
  font-weight: 700;
  cursor: default;
  word-break: normal;
}

/* Emote wrapper — hover tooltip is a fixed-position panel in chat.js (avoids overflow clipping). */
.emote-wrap {
  display: inline-block;
  position: relative;
  vertical-align: middle;
}

/* 7TV zero-width / overlay emotes (flags & 256) — pin to bottom-right of previous emote */
.chat-emote-stack {
  display: inline-block;
  position: relative;
  vertical-align: middle;
}

.emote-wrap.emote-wrap--overlay {
  position: absolute;
  right: 0;
  bottom: 0;
  pointer-events: auto;
}

.emote-wrap.emote-wrap--overlay .chat-emote {
  margin: 0;
  vertical-align: bottom;
}

/* Floating emote tooltip (appended to document.body; scales with chat --chat-emote-h) */
.chat-emote-tooltip {
  --emote-tooltip-scale: 2.15;
  position: fixed;
  z-index: 10050;
  pointer-events: none;
  max-width: min(280px, 92vw);
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.55));
}

.chat-emote-tooltip__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(20, 20, 22, 0.97);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.chat-emote-tooltip__preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--chat-emote-h, 1.7em) * var(--emote-tooltip-scale));
}

.chat-emote-tooltip .chat-emote {
  height: calc(var(--chat-emote-h, 1.7em) * var(--emote-tooltip-scale));
  width: auto;
  max-width: 100%;
  vertical-align: bottom;
  display: inline-block;
  object-fit: contain;
  margin: 0;
}

.chat-emote-tooltip-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-emote-tooltip-preview-stack {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  line-height: 0;
}

.chat-emote-tooltip-preview-slot {
  display: inline-block;
  vertical-align: bottom;
  line-height: 0;
}

.chat-emote-tooltip-preview-slot--overlay {
  position: absolute;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.chat-emote-tooltip__text {
  font-family: 'Rajdhani', sans-serif;
  font-size: calc(12px * var(--ui-scale, 1));
  letter-spacing: 0.04em;
  color: #efeff1;
  text-align: center;
  max-width: 240px;
  line-height: 1.35;
}

.chat-emote-tooltip__line--primary {
  font-weight: 700;
  word-break: break-word;
}

.chat-emote-tooltip__divider {
  width: 100%;
  height: 1px;
  margin: 3px 0 1px;
  background: rgba(255, 255, 255, 0.15);
}

.chat-emote-tooltip__line--source {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.84em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(239, 239, 241, 0.82);
}

.chat-emote-tooltip__line--mod {
  font-weight: 600;
  font-size: 0.94em;
  color: rgba(239, 239, 241, 0.88);
  margin-top: 3px;
}

/* Inline 7TV emote images — height driven by --chat-emote-h set by settings */
.chat-emote {
  height: var(--chat-emote-h, 1.7em);
  width: auto;
  vertical-align: middle;
  display: inline-block;
  object-fit: contain;
  margin: 0 1px;
}

/* ── Settings dropdown (absolute, overlays top of .chat-body only) ── */
.chat-settings-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  /* bottom intentionally unset — only as tall as content */
  background: rgba(10, 10, 12, 0.98);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 28px rgba(0,0,0,0.6);
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 16px;
  gap: 14px;
}

/* Vertical slider section: label on top, full-width slider + ticks below */
.chat-settings-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-settings-lbl {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: calc(13px * var(--ui-scale, 1));
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
}

.chat-settings-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 2px 0;
}

.chat-settings-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.chat-settings-slider {
  --chat-slider-track-h: calc(3px * var(--ui-scale, 1));
  --chat-slider-thumb-h: calc(18px * var(--ui-scale, 1));
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  /* Match thumb height so Blink/WebKit vertically centers thumb on the track (thin input + tall thumb looks “dropped”). */
  height: var(--chat-slider-thumb-h);
  border-radius: 99px;
  background: transparent;
  outline: none;
  cursor: pointer;
}
/* Chromium/WebKit: paint fill on the runnable track only (not the full input box). */
.chat-settings-slider::-webkit-slider-runnable-track {
  height: var(--chat-slider-track-h);
  border-radius: 99px;
  background: linear-gradient(
    to right,
    var(--accent) 0%, var(--accent) var(--prog, 0%),
    rgba(255,255,255,0.14) var(--prog, 0%), rgba(255,255,255,0.14) 100%
  );
}
.chat-settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: calc(10px * var(--ui-scale, 1));
  height: var(--chat-slider-thumb-h);
  /* Blink/WebKit: without this, the thumb sits low vs. the track; (track − thumb) / 2 centers it on the line. */
  margin-top: calc((var(--chat-slider-track-h) - var(--chat-slider-thumb-h)) / 2);
  border-radius: 3px;
  background: var(--accent);
  border: none;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(126,200,232,0.4), 0 1px 4px rgba(0,0,0,0.5);
}
.chat-settings-slider::-moz-range-track {
  height: var(--chat-slider-track-h);
  border-radius: 99px;
  background: rgba(255,255,255,0.14);
}
.chat-settings-slider::-moz-range-progress {
  height: var(--chat-slider-track-h);
  border-radius: 99px;
  background: var(--accent);
}
.chat-settings-slider::-moz-range-thumb {
  width: calc(10px * var(--ui-scale, 1));
  height: var(--chat-slider-thumb-h);
  border-radius: 3px;
  background: var(--accent);
  border: none;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(126,200,232,0.4), 0 1px 4px rgba(0,0,0,0.5);
}

/* Notch labels: each span has width:0 so its center aligns exactly with the thumb snap position.
   padding mirrors half the thumb size so the first/last labels land on the track endpoints.
   margin-top pushes labels clear of the rectangular thumb (extends ~7.5px below the 3px track). */
.chat-settings-ticks {
  display: flex;
  justify-content: space-between;
  padding: 0 calc(7px * var(--ui-scale, 1));
  margin-top: calc(10px * var(--ui-scale, 1));
}
.chat-settings-ticks span {
  width: 0;
  display: flex;
  justify-content: center;
  overflow: visible;
  white-space: nowrap;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: calc(10px * var(--ui-scale, 1));
  color: rgba(255,255,255,0.38);
}

/* Logout row inside settings — username left, button right, vertically centered */
.chat-settings-logout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.chat-settings-logged-as {
  font-size: calc(11px * var(--ui-scale, 1));
  color: rgba(255,255,255,0.55);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* ── Chat footer ─────────────────────────────────────────────── */
.chat-footer {
  flex-shrink: 0;
  padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border-top: 1px solid var(--border);
  background: #111113;
  display: flex;
  flex-direction: column;
  gap: calc(6px * var(--ui-scale, 1));
}

/* Read-only state placeholder */
.chat-footer__input {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 9px 12px;
  font-size: 13px;
  color: rgba(255,255,255,0.3);
  cursor: default;
  user-select: none;
}

/* Logout button (used inside settings panel) */
.chat-logout-btn {
  font-size: calc(11px * var(--ui-scale, 1));
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: calc(5px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  flex-shrink: 0;
  align-self: center;
  transition: all 0.12s;
}
.chat-logout-btn:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

/* Input row (send message) */
.chat-input-row {
  display: flex;
  gap: 7px;
}

.chat-input {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: calc(8px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));
  font-size: calc(14px * var(--ui-scale, 1));
  font-family: inherit;
  color: #efeff1;
  outline: none;
  transition: border-color 0.12s;
}
.chat-input::placeholder { color: rgba(255,255,255,0.3); }
.chat-input:focus { border-color: var(--accent-dim); }

.chat-send-btn {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: calc(13px * var(--ui-scale, 1));
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: calc(8px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s;
}
.chat-send-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(126,200,232,0.08);
}

/* Login button */
.chat-login-btn {
  width: 100%;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: calc(13px * var(--ui-scale, 1));
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  background: rgba(145,71,255,0.12);
  color: #bf94ff;
  cursor: pointer;
  transition: all 0.12s;
}
.chat-login-btn:hover {
  background: rgba(145,71,255,0.22);
  border-color: #bf94ff;
}

.btn {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 16px;
  border-radius: 3px;
  border: 1px solid var(--border-bright);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { border-color: var(--accent-dim); color: var(--accent); background: rgba(126,200,232,0.06); }
.btn.primary { border-color: var(--accent); color: var(--accent); }
.btn.primary:hover { background: rgba(126,200,232,0.16); }
.btn:disabled { opacity: 0.6; cursor: default; }

.app {
  position: relative;
  z-index: 1;
  display: flex;
  height: calc(100vh - 56px * var(--ui-scale, 1.25));
  transform-origin: top left;
}

/* Sidebar width only — toggle is position:absolute so main/stream fills edge-to-edge. */
.sidebar-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;
  align-self: stretch;
  overflow: visible;
}

.sidebar {
  flex: 1;
  min-height: 0;
  width: 300px;
  min-width: 300px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s, min-width 0.3s;
}
.sidebar.collapsed { width: 0; min-width: 0; border-right-width: 0; }

.sidebar-inner {
  width: 300px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Add streamer, global controls, sort/filters — stays pinned; list scrolls below */
.sidebar-top-fixed {
  flex-shrink: 0;
}

.sidebar-streamers-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-bright) transparent;
}
.sidebar-streamers-scroll::-webkit-scrollbar {
  width: 6px;
}
.sidebar-streamers-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-streamers-scroll::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 3px;
}
.sidebar-bottom-strip {
  flex-shrink: 0;
  height: calc(20px * var(--cell-bar-zoom, 1));
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
}

.sidebar-section.sidebar-streamers-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-streamers-toolbar .sort-bar-wrap {
  margin-bottom: 0;
}

.sidebar-empty-list-hint {
  margin-top: 10px;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
}

.sidebar-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-actions {
  padding-top: 10px;
  padding-bottom: 10px;
}

.sidebar-actions-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.sidebar-actions-row--add {
  flex-wrap: nowrap;
}
.sidebar-actions-row--add .btn-sidebar-add-full {
  width: 100%;
}

/* Primary slot: #headerStreamToolbarHost; legacy equal layout no longer moves this into #streamArea. */
.stream-global-toolbar {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  width: 100%;
  box-sizing: border-box;
}
.stream-global-toolbar-heading.section-label {
  color: var(--text-secondary);
  letter-spacing: 0.2em;
  font-size: 12px;
  font-weight: 500;
  margin: 0;
  width: auto;
  flex: 0 0 auto;
  text-align: center;
}
.stream-global-toolbar--focus-pair {
  flex-direction: column;
  align-items: center;
  gap: 0;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(220px, 46vw);
  width: auto;
}
.stream-global-toolbar--focus-pair .stream-global-toolbar-heading.section-label {
  margin-bottom: 8px;
  width: 100%;
}
.sidebar-sel-ic-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sidebar-sel-ic-btn {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  flex-shrink: 0;
}
.sidebar-sel-ic-btn svg {
  display: block;
}
.sidebar-sel-ic-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
  border-color: var(--border);
  color: var(--text-dim);
  background: transparent;
}
.sidebar-sel-ic-btn:disabled:hover {
  background: transparent;
}
.stream-global-toolbar .sidebar-sel-ic-btn,
.focus-dual-toolbar .sidebar-sel-ic-btn {
  min-width: 30px;
  min-height: 30px;
}
.stream-global-toolbar .sidebar-sel-ic-btn svg,
.focus-dual-toolbar .sidebar-sel-ic-btn svg {
  transform: scale(0.92);
  transform-origin: center;
}

.btn-sidebar-action {
  width: auto;
  max-width: 100%;
  font-size: 12px;
  padding: 6px 14px;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}

.section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
}
.section-header .section-label { margin-bottom: 0; }
.section-chevron {
  font-size: 9px;
  color: var(--text-dim);
  transition: transform 0.2s;
  line-height: 1;
}
.section-chevron.open { transform: rotate(180deg); }
.section-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease, margin-top 0.25s ease;
  margin-top: 0;
}
.section-body.open {
  max-height: 300px;
  margin-top: 12px;
}

.layout-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.layout-btn {
  padding: 8px 6px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}
.layout-btn:hover { border-color: var(--border-bright); }
.layout-btn.active { border-color: var(--accent); background: rgba(126,200,232,0.08); }
.layout-btn svg { color: var(--text-dim); }
.layout-btn.active svg { color: var(--accent); }
.layout-btn span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.layout-btn.active span { color: var(--accent); }

.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* Config modal: ON / OFF — both visible; active segment uses theme accent */
.config-bool-toggle {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-deep);
}
.config-bool-toggle__opt {
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 5px 14px;
  min-width: 44px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.config-bool-toggle__opt + .config-bool-toggle__opt {
  border-left: 1px solid var(--border);
}
.config-bool-toggle__opt:hover:not(.config-bool-toggle__opt--active) {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}
.config-bool-toggle__opt--active {
  background: rgba(126, 200, 232, 0.18);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-dim);
}
.config-bool-toggle__opt:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  z-index: 1;
}
.config-bool-toggle--triple {
  flex: 1 1 auto;
  max-width: 100%;
}
.modal--config .config-bool-toggle--triple .config-bool-toggle__opt {
  flex: 1 1 0;
  min-width: 0;
  padding: 5px 8px;
  letter-spacing: 0.08em;
}
.slider-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--accent);
}
input[type=range] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.streamer-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-label.streamers-heading {
  color: var(--text-secondary);
  letter-spacing: 0.2em;
  font-size: 12px;
  font-weight: 500;
  margin: 0;
}

.sort-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
}
.sort-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.sort-by-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.sort-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.filter-actions-row {
  display: flex;
  gap: 6px;
  width: 100%;
}
.filter-actions-row .sort-btn {
  flex: 1;
  min-width: 0;
  justify-content: center;
  text-align: center;
}
.sidebar-streamer-search {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.sidebar-streamer-search::placeholder {
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0.04em;
}
.online-filter-btn,
.deselect-all-btn {
  display: flex;
  align-items: center;
}
.sort-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.sort-btn:hover { border-color: var(--border-bright); color: var(--text-secondary); }
.sort-btn.active { border-color: var(--accent-dim); color: var(--accent); background: rgba(126,200,232,0.08); }

.streamer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 9px;
  position: relative;
  transition: border-color 0.2s;
}
.streamer-card.in-game { border-color: var(--green-dim); }
.streamer-card.in-game::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--green-live);
  border-radius: 4px 0 0 4px;
}
.streamer-card.live { border-color: var(--status-live-dim); }
.streamer-card.live::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--status-live);
  border-radius: 4px 0 0 4px;
}

.streamer-top {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  margin-bottom: 8px;
  min-width: 0;
}
.streamer-top__main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.streamer-top__main > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}
.streamer-identity-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.streamer-status-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: min-content;
}
.streamer-status-col {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: 0 0 auto;
}

/* First sweep: per-streamer status lane (Spectator) not finished yet — three bars, L→R pulse */
.streamer-status-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 14px;
  flex: 0 0 auto;
  vertical-align: middle;
  box-sizing: border-box;
}
.streamer-status-loading__bar {
  display: block;
  width: 2px;
  height: 8px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.22);
  transform-origin: center center;
  animation: streamer-status-bar-wave 0.95s ease-in-out infinite;
}
.streamer-status-loading__bar:nth-child(1) {
  animation-delay: 0s;
}
.streamer-status-loading__bar:nth-child(2) {
  animation-delay: 0.16s;
}
.streamer-status-loading__bar:nth-child(3) {
  animation-delay: 0.32s;
}
@keyframes streamer-status-bar-wave {
  0%,
  100% {
    transform: scaleY(0.62) scaleX(1);
    background: rgba(255, 255, 255, 0.22);
  }
  40% {
    transform: scaleY(1.45) scaleX(1.65);
    background: var(--accent, #7ec8e8);
  }
  55% {
    transform: scaleY(0.62) scaleX(1);
    background: rgba(255, 255, 255, 0.22);
  }
}
/* Timer + label as one horizontal pill (shared chrome; modifiers set border + segment colors). */
.status-badge-split {
  display: inline-flex;
  flex-direction: row;
  align-items: stretch;
  flex: 0 0 auto;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 2px;
  overflow: hidden;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
}
.status-badge-split__time,
.status-badge-split__label {
  display: grid;
  place-items: center;
  align-self: stretch;
  min-width: 0;
  padding-block: 3px;
  box-sizing: border-box;
  line-height: 1;
  white-space: nowrap;
  /* Plex Mono: grid center is correct; caps still read ~1px low in the cell */
  transform: translateY(-1px);
}
.status-badge-split__time {
  min-width: max(44px, min-content);
  padding-inline: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
.status-badge-split__label {
  padding-inline: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
/* LIVE — red */
.status-badge-split--live {
  border-color: var(--status-live);
}
.status-badge-split--live .status-badge-split__label {
  background: var(--status-live-dim);
  color: var(--status-live);
  border-left: 1px solid rgba(56, 189, 248, 0.35);
}
.sidebar-live-uptime-timer {
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  color: inherit;
}

.streamer-favorite-btn {
  flex-shrink: 0;
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 0;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.streamer-favorite-btn .streamer-favorite-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.streamer-favorite-btn .streamer-favorite-svg {
  display: block;
  flex-shrink: 0;
}
.streamer-favorite-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-dim);
  background: rgba(126, 200, 232, 0.08);
}
.streamer-favorite-btn--on {
  border-color: var(--accent-dim);
  background: rgba(126, 200, 232, 0.12);
}
.streamer-favorite-btn--on .streamer-favorite-icon {
  color: #fff;
}
.streamer-favorite-btn--on:hover {
  border-color: var(--accent);
  background: rgba(126, 200, 232, 0.18);
}
.streamer-favorite-btn--on:hover .streamer-favorite-icon {
  color: #fff;
}

.streamer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  margin-top: 6px;
}
.streamer-actions__buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.icon-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 3px 6px;
  font-size: 11px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-family: 'IBM Plex Mono', monospace;
}
.icon-btn:hover:not(.danger) {
  border-color: var(--accent-dim);
  color: var(--text-primary);
  background: rgba(126, 200, 232, 0.08);
}
.icon-btn.danger {
  color: var(--text-secondary);
}
.icon-btn.danger:hover {
  border-color: var(--red-danger);
  color: var(--red-danger);
}

.streamer-name {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.15;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  min-width: 0;
}

/* Same box model for every chip — VARIETY used to have translateY(-1px) alone, which made LIVE look “lower” */
.status-badge {
  display: inline-grid;
  place-items: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 2px;
  box-sizing: border-box;
  vertical-align: middle;
  transform: translateY(-1px);
}
.status-badge.live             { background: var(--status-live-dim);       color: var(--status-live); }
.status-badge.offline          { background: rgba(255,255,255,0.04);        color: var(--text-dim); }
.status-badge.loading          { background: rgba(255,255,255,0.04);        color: var(--text-dim); }



/* Sidebar: category under name (Twitch directory). */
.streamer-name-block {
  min-width: 0;
}
.streamer-subline {
  min-width: 0;
  max-width: 100%;
  line-height: 1.25;
  padding-bottom: 1px;
}
.streamer-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.streamer-category--muted {
  opacity: 0.65;
}
.streamer-last-live {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  opacity: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.streamer-last-live__prefix {
  letter-spacing: 0.04em;
  font-size: 10px;
  color: inherit;
}
.streamer-last-live--unknown {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-style: italic;
}
.streamer-viewer-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--status-live);
  flex: 0 0 auto;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.streamer-category {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  opacity: 0.92;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.streamer-remove-confirm-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgba(10, 10, 14, 0.94);
  border: 1px solid var(--red-danger);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px;
}
.streamer-remove-confirm-text {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #ffe6e6;
  text-transform: uppercase;
}
.streamer-remove-confirm-actions {
  display: flex;
  gap: 8px;
}
.streamer-remove-confirm-btn {
  min-height: 0;
  padding: 5px 10px;
  font-size: 11px;
}
.streamer-remove-confirm-btn--yes {
  border-color: var(--red-danger);
  color: #fff2f2;
  background: rgba(255, 107, 107, 0.2);
}
.streamer-remove-confirm-btn--yes:hover {
  border-color: var(--red-danger);
  color: #fff;
  background: rgba(255, 107, 107, 0.28);
}

.add-form { display: flex; flex-direction: column; gap: 8px; }
.field-group { display: flex; flex-direction: column; gap: 4px; }
/* HTML [hidden] loses to .field-group { display:flex } without this */
.field-group[hidden] {
  display: none !important;
}
.field-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.field-label .field-label__paren {
  color: color-mix(in srgb, var(--text-dim) 78%, black);
  letter-spacing: 0.06em;
}
input[type=text], select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-primary);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
input[type=text]:focus, select:focus { border-color: var(--accent-dim); }
select option { background: var(--bg-card); }

.account-entry {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
/* Needs double-class specificity to beat input[type=text] { width: 100% } */
.account-entry .acc-name { flex: 1; min-width: 0; width: auto; max-width: 160px; }
.account-entry .acc-tag  { width: 58px; flex-shrink: 0; }
.account-entry .acc-tag::placeholder {
  color: var(--text-dim);
  opacity: 0.85;
}
.acc-hash {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 0;
  user-select: none;
}
.account-entry select { width: 60px; flex-shrink: 0; }

.accounts-list { display: flex; flex-direction: column; gap: 4px; }

.config-error {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--red-danger);
  margin-top: 6px;
  display: none;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.stream-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px;
  gap: 8px;
}
/* Focus mode: tight margins; dvh uses dynamic viewport when supported for a bit more usable height. */
.stream-area:has(.focus-wrapper),
.stream-area:has(.stream-unified--focused) {
  padding: 4px 6px 8px;
  gap: 3px;
  --focus-under-player-reserve: 4.35rem;
}
@media (min-height: 1180px) {
  .stream-area:has(.focus-wrapper),
  .stream-area:has(.stream-unified--focused) {
    --focus-under-player-reserve: 4rem;
  }
}
/* Unified focus: no toolbar row under main — use every pixel of vertical space.
 * Reserve is kept at a bare minimum (just a few px for rounding/border safety); the stream area
 * vertical padding is also zeroed so the tile can grow as tall as the viewport allows. */
.stream-area:has(.stream-unified--focused) {
  padding-top: 0;
  padding-bottom: 0;
  --focus-under-player-reserve: 0.25rem;
}
@media (min-height: 1180px) {
  .stream-area:has(.stream-unified--focused) {
    --focus-under-player-reserve: 0.2rem;
  }
}
/* Out of flow when hidden — some resets strip [hidden]; keeps gap from leaving a strip */
#globalStreamToolbar[hidden] {
  display: none !important;
}

/* Holds .grid-equal / .grid-3 / .focus-wrapper so layout roots are not direct children of .stream-area. */
#streamLayoutHost.stream-layout-host {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* One parent for all tiles — equal vs focus toggles CSS grid on .stream-cells-plane only (no iframe reparent). */
.stream-unified-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}
.stream-unified-layout .stream-cells-plane {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 8px;
}
/* Vertically center the plane’s content in the column when shorter than the area (grid itself stays flex:1 for definite 1fr / CQ sizes). */
.stream-unified-layout.stream-unified--focused {
  justify-content: center;
  /* Paused overlay: same --ui-scale as smaller displays, extra multipliers on wide viewports only (focus main + minis). */
  --focus-main-paused-scale: 1;
  --focus-mini-paused-scale: 0.82;
}
@media (min-width: 1800px) {
  .stream-unified-layout.stream-unified--focused {
    --focus-main-paused-scale: 1.06;
    --focus-mini-paused-scale: 0.88;
  }
}
@media (min-width: 2200px) {
  .stream-unified-layout.stream-unified--focused {
    --focus-main-paused-scale: 1.12;
    --focus-mini-paused-scale: 0.92;
  }
}
@media (min-width: 2560px) {
  .stream-unified-layout.stream-unified--focused {
    --focus-main-paused-scale: 1.18;
    --focus-mini-paused-scale: 0.96;
  }
}
.stream-unified-layout.stream-unified--focused .stream-cells-plane {
  overflow: auto;
}
.stream-unified--equal .stream-cells-plane[data-count="1"] {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
/* 2-stream: keep each cell at exactly 16:9 and center the row vertically.
 * aspect-ratio on the .stream-cell (not the body) gives a definite height that satisfies
 * container-type:size; grid-template-rows:auto then sizes the row to that computed height
 * instead of stretching cells to fill the full container. */
.stream-unified--equal .stream-cells-plane[data-count="2"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  align-content: center;
}
.stream-unified--equal .stream-cells-plane[data-count="2"] .stream-cell {
  aspect-ratio: 16 / 9;
}
.stream-unified--equal .stream-cells-plane[data-count="4"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.stream-unified--focused .stream-cells-plane {
  container-type: size;
  container-name: unified-focus-plane;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream {
  width: 100%;
  flex-shrink: 0;
  flex-grow: 0;
  /* Height = video height + bar height, computed in JS and set as --side-cell-h on the plane.
   * Provides a definite block size so container-query cqh works inside the cell.
   * Falls back to auto when the variable is not yet set (first paint / non-focus). */
  height: var(--side-cell-h, auto);
  min-height: 0;
}
/* 16:9 aspect ratio on the video host only — the bar is excluded from the ratio. */
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .twitch-embed-host {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 16 / 9;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .cell-bar {
  cursor: grab;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .cell-bar:active {
  cursor: grabbing;
}
/* Outer cell: stretch for grid + definite CQ height; border/background on .stream-cell-body only. */
.stream-unified--focused .stream-cells-plane .stream-cell.focused {
  flex-shrink: 0;
  max-width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  overflow: visible;
}
.stream-unified--focused .stream-cells-plane .stream-cell.focused .stream-cell-body {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
/* Hover the actual frame+bar only: outer .stream-cell spans spacer rows (see grid row span in streams.js). */
.stream-unified--focused .stream-cells-plane .stream-cell.focused .stream-cell-body:hover {
  border-color: var(--accent-stream-hover);
}
/* Default .twitch-embed-host { flex:1 } — fixed-aspect main tile inside the inner frame. */
.stream-unified--focused .stream-cells-plane .stream-cell.focused .stream-cell-body .twitch-embed-host {
  flex: 0 0 auto;
  min-height: 4.5rem;
  width: 100%;
  aspect-ratio: 16 / 9;
}
@supports (width: 1cqw) {
  .stream-unified--focused .stream-cells-plane .stream-cell.focused .stream-cell-body {
    --focus-dvh-cap: 100dvh;
    --focus-tile-max-h: min(
      var(--focus-dvh-cap),
      max(5.5rem, calc(100cqh - var(--focus-under-player-reserve, 4.35rem)))
    );
    /* Cap body width to (focusTileMaxH − barH) × 16/9 so the video host is always exactly 16:9
     * on any monitor aspect ratio.  Without this cap, a viewport wider than its height × 16/9
     * (e.g. 2560×1080 ultra-wide) makes the body wider than the host's max-height allows, the
     * host's max-height then breaks the aspect-ratio, and Twitch letterboxes internally.
     * Applied unconditionally — not gated on min-height — so all viewport sizes are covered. */
    --focus-slot-w: min(100cqw, calc(100dvw - 16px));
    --focus-body-max-w: calc((var(--focus-tile-max-h) - 32px * var(--ui-scale, 1.25)) * 16 / 9);
    width: min(var(--focus-slot-w), var(--focus-body-max-w));
    max-width: min(var(--focus-slot-w), var(--focus-body-max-w));
    max-height: var(--focus-tile-max-h);
    height: auto;
    box-sizing: border-box;
  }
  .stream-unified--focused .stream-cells-plane .stream-cell.focused .stream-cell-body .twitch-embed-host {
    max-height: max(0px, calc(var(--focus-tile-max-h) - 32px * var(--ui-scale, 1.25)));
  }
}
@supports not (width: 1cqw) {
  .stream-unified--focused .stream-cells-plane .stream-cell.focused .stream-cell-body {
    width: 100%;
    max-height: calc(100dvh - 12rem);
  }
  .stream-area:has(.stream-unified--focused) .stream-cells-plane .stream-cell.focused .stream-cell-body {
    max-height: calc(100dvh - 56px * var(--ui-scale, 1.25) - 6.5rem);
  }
  .stream-unified--focused .stream-cells-plane .stream-cell.focused .stream-cell-body .twitch-embed-host {
    max-height: calc(100% - 32px * var(--ui-scale, 1.25));
  }
}
.unified-focus-chrome {
  min-width: 0;
  box-sizing: border-box;
}
.stream-unified--focused .unified-focus-chrome .focus-dual-toolbar {
  margin-top: 0;
}

.grid-equal {
  display: grid;
  gap: 8px;
  flex: 1;
  min-height: 0;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
.grid-equal[data-count="2"] { grid-template-columns: 1fr 1fr; }
.grid-equal[data-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.grid-equal[data-count="6"] { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; }
.grid-equal[data-count="8"] { grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr 1fr; }
.grid-equal[data-count="9"] { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr 1fr; }

/* Three streams: single grid parent (cells are direct children); row layout from JS
   so drag-reorder stays in one DOM parent like mini-stream column — no embed reload. */
.grid-3 {
  display: grid;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

/* ── Focus mode ─────────────────────────────────────── */

/* Outer wrapper: stacks main row + optional bottom strip */
.focus-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 8px;
}
.stream-area:has(.focus-wrapper) .focus-wrapper {
  gap: 2px;
}

/* Main row: left column (focused + aux controls) + side column (right) */
.focus-main-row {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 8px;
  align-items: stretch;
}
.stream-area:has(.focus-wrapper) .focus-main-row {
  gap: 6px;
}

.focus-main-column {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  align-self: stretch;
}
.focus-wrapper .focus-main-column {
  box-sizing: border-box;
}

/* Slot fills column height; stack (player + toolbars); scroll if a tight viewport still overflows. */
.focus-stream-slot {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  container-type: size;
  container-name: focus-stream-slot;
}
/* Vertically center main player + toolbars in the slot (collapsed or expanded sidebar). */
.stream-area:has(.focus-wrapper) .focus-stream-slot {
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
  box-sizing: border-box;
}

.focus-stream-slot > .focus-main-stack {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  align-self: center;
}

/* Stage wraps the tile only — do not flex-grow or the toolbar is pushed to the bottom of the viewport. */
.focus-main-stage {
  flex: 0 0 auto;
  max-width: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.focus-main-stage-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  width: 100%;
  max-width: 100%;
  min-height: 0;
}

/* 16:9 tile — dvh cap alone overflows at ~1080p: dual toolbar + gap sit below player inside the slot. */
.focus-stream-slot .stream-cell.focused {
  flex-shrink: 0;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}
@supports (width: 1cqw) {
  .focus-stream-slot .stream-cell.focused {
    /*
     * cqh/cqw — .focus-stream-slot. Reserve: dual toolbar + stack gap (slot scrolls if they wrap).
     * --focus-under-player-reserve inherited from .stream-area:has(.focus-wrapper) (tunable).
     */
    --focus-dvh-cap: 100dvh;
    --focus-tile-max-h: min(
      var(--focus-dvh-cap),
      max(5.5rem, calc(100cqh - var(--focus-under-player-reserve, 4.35rem)))
    );
    width: min(100cqw, calc(100dvw - 16px));
    max-width: min(100cqw, calc(100dvw - 16px));
    max-height: var(--focus-tile-max-h);
    height: auto;
    box-sizing: border-box;
  }

  /* Tall windows only: fit largest 16×9 in slot height (uses vertical “black bar” as video). */
  @media (min-height: 1040px) {
    .stream-area:has(.focus-wrapper) .focus-stream-slot .stream-cell.focused {
      --focus-slot-w: min(100cqw, calc(100dvw - 16px));
      width: min(var(--focus-slot-w), calc(var(--focus-tile-max-h) * 16 / 9));
      max-width: min(var(--focus-slot-w), calc(var(--focus-tile-max-h) * 16 / 9));
    }
  }
}
@supports not (width: 1cqw) {
  .focus-stream-slot .stream-cell.focused {
    width: 100%;
    max-height: calc(100dvh - 12rem);
  }
  .stream-area:has(.focus-wrapper) .focus-stream-slot .stream-cell.focused {
    max-height: calc(100dvh - 56px * var(--ui-scale, 1.25) - 6.5rem);
  }
}

.focus-main-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}
.stream-area:has(.focus-wrapper) .focus-main-stack {
  gap: 6px;
}
.focus-stream-slot .focus-main-stack > .focus-dual-toolbar {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
}

.focus-dual-toolbar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 12px 28px;
  width: 100%;
  margin-top: 4px;
  box-sizing: border-box;
  zoom: var(--ui-scale, 1.25);
}
.stream-area:has(.focus-wrapper) .focus-dual-toolbar {
  margin-top: 0;
}
.focus-mini-stream-controls {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(220px, 46vw);
  width: auto;
}
.focus-mini-stream-controls-heading.section-label {
  color: var(--text-secondary);
  letter-spacing: 0.2em;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 8px;
  width: 100%;
  text-align: center;
}
.focus-mini-stream-sel-ic-row {
  width: 100%;
}

/* Right-side column: width derived from video dimensions so 3 minis fill the column height.
   gap = 8px, barH = 32px; for 3 minis: videoH = (H − 2×8 − 3×32) / 3
   colW = videoH × 16/9 = (H − 112px) × 16/27 */
.side-col {
  --focus-row-h: calc(100dvh - (56px + 28px) * var(--ui-scale, 1.25));
  --side-w-from-height: calc((var(--focus-row-h) - 112px) * 16 / 27);
  width: clamp(380px, min(36vw, var(--side-w-from-height)), 860px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  align-self: stretch;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}
/* 16:9 on the video host only — bar sits below and is excluded from the ratio. */
.side-col .stream-cell {
  width: 100%;
  flex-shrink: 0;
  flex-grow: 0;
  height: auto;
  min-height: 0;
}
.side-col .stream-cell .twitch-embed-host {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.stream-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  /* Toast uses cqw/cqh — size of this cell (focus / grid / side column). */
  container-type: size;
  container-name: stream-cell;
}
/* Focus main: neutral frame by default; accent edge on hover (same idea as .side-stream:hover). */
.stream-cell.focused { border-color: var(--border); }
.stream-cell.focused:hover { border-color: var(--accent-stream-hover); }

/* Drag-over rules live after .side-stream:hover (they must win :hover border-color on minis). */

/* Embeds + bar live here so the outer .stream-cell can stretch (grid) while an inner frame sizes to the video. */
.stream-cell-body {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

/* Game-ended swap prompt — above cell bar, width follows copy (not full cell) */
.stream-game-finished-toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(32px * var(--ui-scale, 1.25));
  z-index: 35;
  zoom: var(--ui-scale, 1.25);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  max-width: calc(100% - 12px);
  box-sizing: border-box;
}
@supports (width: 1cqw) {
  .stream-game-finished-toast {
    padding: 0 clamp(4px, 1.8cqw, 14px) clamp(3px, 1.2cqh, 10px);
  }
  .stream-game-finished-toast__inner {
    padding: clamp(6px, 1.6cqh, 14px) clamp(7px, 2.4cqw, 18px) clamp(7px, 1.8cqh, 14px);
    border-radius: clamp(4px, 1cqw, 10px);
    box-shadow: 0 clamp(2px, 0.8cqh, 8px) clamp(12px, 3cqh, 28px) rgba(0,0,0,0.5);
  }
  .stream-game-finished-toast__text {
    font-size: clamp(10px, 3.1cqw, 18px);
    margin: 0 0 clamp(4px, 1.2cqh, 10px);
    line-height: 1.35;
    max-width: 100%;
  }
  .stream-game-finished-toast__bar {
    height: clamp(2px, 0.85cqw, 5px);
    border-radius: clamp(1px, 0.4cqw, 3px);
    margin-bottom: clamp(4px, 1.2cqh, 10px);
  }
  .stream-game-finished-toast__actions {
    gap: clamp(4px, 1.5cqw, 12px);
  }
  .stream-game-finished-toast__btn {
    font-size: clamp(10px, 2.8cqw, 16px);
    padding: clamp(2px, 0.9cqh, 8px) clamp(8px, 2.5cqw, 16px);
  }
}
@supports not (width: 1cqw) {
  .stream-game-finished-toast {
    padding: 0 6px 4px;
  }
  .stream-game-finished-toast__inner {
    padding: 7px 9px 8px;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  }
  .stream-game-finished-toast__text {
    font-size: clamp(10px, 1.6vmin, 18px);
    margin: 0 0 6px;
    line-height: 1.35;
    max-width: 100%;
  }
  .stream-game-finished-toast__bar {
    height: 3px;
    border-radius: 2px;
    margin-bottom: 6px;
  }
  .stream-game-finished-toast__actions {
    gap: 6px;
  }
  .stream-game-finished-toast__btn {
    font-size: clamp(10px, 1.5vmin, 16px);
    padding: 3px 10px;
  }
}
.stream-game-finished-toast__inner {
  pointer-events: auto;
  display: table;
  width: auto;
  max-width: 100%;
  margin-inline: auto;
  box-sizing: border-box;
  background: rgba(16,16,20,0.94);
  border: 1px solid var(--border-bright);
}
.stream-game-finished-toast__text {
  color: var(--text-primary);
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  letter-spacing: 0.02em;
}
.stream-game-finished-toast__bar {
  background: var(--border);
  overflow: hidden;
}
.stream-game-finished-toast__bar-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}
.stream-game-finished-toast__actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}
.stream-game-finished-toast__btn {
  min-height: 0;
  line-height: 1.2;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
}

.twitch-embed-host {
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  z-index: 0; /* below .play-overlay (2) and .cell-bar (3) inside .stream-cell-body */
}
.twitch-embed-host iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Chrome: cross-origin Twitch iframe wins hit-testing during drag; pointer goes to the host/cell instead of sticking on the iframe edge. */
body.stream-cell-dragging .twitch-embed-host iframe {
  pointer-events: none;
}

.cell-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  --cell-bar-gap-hit: 6px;
  --cell-bar-pad-x: 9px;
  padding: 0 9px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  height: 32px;
  position: relative;
  z-index: 3; /* above .play-overlay (2) if layout rounds into the bar strip */
  user-select: none;
  zoom: var(--cell-bar-zoom, 1);
}
/* Reserve space so focus icons are not clipped (narrow side column + overflow:hidden on .stream-cell) */
.cell-bar:has(.focus-swap-btn),
.cell-bar:has(.exit-focus-btn) {
  /* 2px top + 24px btn + 2px right — match vertical inset of absolute focus controls */
  padding-right: 28px;
}
/* Main tile: exit in flex flow + full bar height — neutral vertical center vs status text everywhere. */
.stream-cell.focused .cell-bar:has(.exit-focus-btn) {
  padding-right: 2px;
}
.stream-cell.focused .cell-bar .exit-focus-btn {
  position: relative;
  inset: auto;
  transform: none; /* cancel translateY(-50%) from base rule; flex align-items handles centering */
  margin: 0 0 0 auto;
  flex-shrink: 0;
  align-self: stretch;
  width: 24px;
  min-width: 24px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
}
/* Default: no nudge (1440p, sidebar open, etc.). */
.stream-cell.focused .cell-bar .exit-focus-btn svg {
  display: block;
  transform: none;
}
/*
 * ~1080p-class viewport + collapsed sidebar: wide stream column + subpixel rounding made the bracket read low;
 * keep the lift scoped so other layouts stay centered.
 */
@media (max-width: 2100px) {
  body:has(#sidebar.collapsed) .stream-cell.focused .cell-bar .exit-focus-btn svg {
    transform: translateY(-1.5px);
  }
}
/* Side mini-streams + equal / grid-3: bar is the drag handle (see initStreamCellDrag) */
.side-col .stream-cell .cell-bar { cursor: grab; }
.side-col .stream-cell .cell-bar:active { cursor: grabbing; }
.grid-equal .cell-bar,
.grid-3 .stream-cell .cell-bar,
.stream-unified--equal .stream-cells-plane .stream-cell .cell-bar {
  cursor: grab;
}
.grid-equal .cell-bar:active,
.grid-3 .stream-cell .cell-bar:active,
.stream-unified--equal .stream-cells-plane .stream-cell .cell-bar:active {
  cursor: grabbing;
}
.stream-cell.focused .cell-bar { cursor: grab; }
.stream-cell.focused .cell-bar:active { cursor: grabbing; }
/* Real controls use pointer; bar + pause cluster (incl. drag shield) inherit grab from .cell-bar. */
.side-col .stream-cell .cell-bar button,
.grid-equal .cell-bar button,
.grid-3 .stream-cell .cell-bar button,
.stream-unified--equal .stream-cells-plane .stream-cell .cell-bar button,
.stream-cell.focused .cell-bar button,
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .cell-bar button {
  cursor: pointer;
}
.cell-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  height: 100%;
}
/* Single flex child of .cell-meta — keeps streamer|rank and WR from splitting across free space. */
.cell-meta-cluster {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
}
/* Ellipsis when tight; shrink inside cluster only. */
.cell-meta-lead {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-meta-acc-name {
  color: #959eb0;
}
.cell-meta-category {
  color: var(--accent-muted, #7ec8e8);
  font-weight: 500;
}
.play-panel-category {
  color: var(--accent-muted, #7ec8e8);
  font-size: 12px;
}
.play-panel-category-muted {
  color: #6b7280;
  font-size: 12px;
}
.cell-meta-sep {
  color: var(--text-secondary);
  font-size: 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  line-height: 1.05;
  opacity: 0.88;
  display: inline-flex;
  align-items: center;
  transform: translateY(-1px);
  margin: 0 4px;
}
.cell-meta .cell-rank {
  font-weight: 400;
}
.cell-meta .cell-rank-pending {
  color: #8a93a6;
  font-weight: 400;
}
/* Solo ranked win rate (league entry W/L) — bands: under 50%, 50–55, 55–60, 60–70, 70+ */
.cell-meta .cell-wr {
  flex-shrink: 0;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.02em;
}
.cell-meta .cell-wr--wr-na {
  color: #6b7280;
  font-weight: 400;
}
.cell-meta .cell-wr--wr-bad {
  color: #b86b70;
}
.cell-meta .cell-wr--wr-near50 {
  color: #9aa3b2;
}
.cell-meta .cell-wr--wr-fiftys {
  color: #89b4e8;
}
.cell-meta .cell-wr--wr-green {
  color: #7dcea0;
}
.cell-meta .cell-wr--wr-yellow {
  color: #e8d55d;
}
.cell-meta .cell-wr--wr-gold {
  color: #d4a84b;
}
/* In-flow “● LIVE” etc. under each tile (not Twitch’s in-player chrome — that’s inside the iframe). */
.cell-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--green-live);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  height: 100%;
  margin-left: auto;
}
/*
 * Pulls under .cell-bar horizontal padding so real spans (not ::before) own hit-testing.
 * [pad-left][cluster+shield][pad-right] — all inside closest(.cell-bar-pause-lead) drag-exempt.
 */
.cell-bar-pause-lead {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  flex-shrink: 0;
  margin-left: calc(-1 * var(--cell-bar-pad-x, 9px));
  cursor: default;
}
.cell-bar-pause-pad-left {
  flex: 0 0 var(--cell-bar-pad-x, 9px);
  width: var(--cell-bar-pad-x, 9px);
  min-width: var(--cell-bar-pad-x, 9px);
  align-self: stretch;
  flex-shrink: 0;
}
.cell-bar-pause-pad-right {
  flex: 0 0 var(--cell-bar-gap-hit, 6px);
  width: var(--cell-bar-gap-hit, 6px);
  min-width: var(--cell-bar-gap-hit, 6px);
  align-self: stretch;
  flex-shrink: 0;
}
/* Non-drag band inside lead; shield pads flex gap before meta (see streams.js). */
.cell-bar-pause-cluster {
  display: flex;
  align-items: center;
  align-self: stretch;
  flex-shrink: 0;
  /* Left inset only — matches bar pad + icon breathing room; avoid extra gap before meta */
  padding: 0 0 0 2px;
  margin: 0;
}
.cell-bar-pause-cluster__shield {
  flex: 0 0 4px;
  min-width: 4px;
  align-self: stretch;
}
/* Pull meta toward pause so pause-to-text gap reads like pause-to-edge (cluster pad + bar pad). */
.cell-bar-pause-lead + .cell-meta {
  margin-left: -3px;
}
.cell-pause-btn {
  position: relative;
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--cell-bar-muted);
  cursor: pointer;
  padding: 0 1px 0 2px;
  margin: 0;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: color 0.15s;
  font-size: 10px;
}
.cell-pause-btn:hover {
  color: var(--text-primary);
}
.cell-pause-btn:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 1px;
}

.placeholder-cell {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0.45;
  position: relative;
  overflow: hidden;
}
.placeholder-cell::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 8px,
    rgba(255,255,255,0.012) 8px,
    rgba(255,255,255,0.012) 9px
  );
}
.ph-icon {
  width: 36px; height: 36px;
  border: 1px solid var(--text-dim);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  overflow: hidden;
  flex-shrink: 0;
}
.ph-icon img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.streamer-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-bright);
  flex-shrink: 0;
}
.ph-name {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.ph-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.placeholder-cell.live {
  border-color: var(--status-live-dim);
  opacity: 0.85;
}
.placeholder-cell.live .ph-icon   { border-color: var(--status-live); color: var(--status-live); }
.placeholder-cell.live .ph-name   { color: var(--status-live); }
.placeholder-cell.live .ph-status { color: var(--status-live); }

.empty-state {
  flex: 1;
  width: 100%;
  min-height: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 1.6vmin, 28px);
  color: var(--text-dim);
}
.empty-state-tv-wrap {
  width: clamp(calc(96px * var(--ui-scale, 1.25)), 18vmin, calc(220px * var(--ui-scale, 1.25)));
  height: clamp(calc(96px * var(--ui-scale, 1.25)), 18vmin, calc(220px * var(--ui-scale, 1.25)));
  flex-shrink: 0;
  color: var(--text-secondary);
  filter: none;
}
.empty-state-tv {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
@media (prefers-reduced-motion: reduce) {
  .streamer-status-loading__bar {
    animation: none;
    transform: none;
    opacity: 0.55;
  }
}
.empty-state > p:first-of-type {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(calc(13px * var(--ui-scale, 1.25)), 1.6vmin, calc(21px * var(--ui-scale, 1.25)));
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.empty-state-hint {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(calc(9px * var(--ui-scale, 1.25)), 1.1vmin, calc(14px * var(--ui-scale, 1.25)));
  letter-spacing: 0.04em;
  text-transform: none;
  color: #6e7685;
  max-width: clamp(calc(220px * var(--ui-scale, 1.25)), 28vmin, calc(420px * var(--ui-scale, 1.25)));
  text-align: center;
  line-height: 1.5;
}

.modal-overlay {
  position: fixed; inset: 0;
  /* Solid dim only — backdrop-filter over Twitch/video is very expensive and causes long jank while open */
  background: rgba(0,0,0,0.82);
  z-index: 100;
  display: flex;
  align-items: center;
  align-items: safe center;
  justify-content: center;
  /* When config zoom fills the screen, allow scrolling the overlay instead of clipping */
  overflow-y: auto;
  overflow-x: hidden;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(12px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease-out;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  width: 440px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-title {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text-primary); }
.modal-divider { height: 1px; background: var(--border); }

.modal-rate-limit .modal-title {
  color: var(--amber-ghost);
}

/* Twitch rate limit — same modal shell, purple accent (vs amber for Riot). */
.modal-rate-limit.modal-rate-limit--twitch .modal-title {
  color: #c4b5fd;
}
.modal-rate-limit.modal-rate-limit--twitch .rate-limit-lead {
  color: #ddd6fe;
}
.modal-rate-limit.modal-rate-limit--twitch .rate-limit-lead strong {
  color: #a78bfa;
}
.modal-rate-limit.modal-rate-limit--twitch .info-box {
  border-color: rgba(167, 139, 250, 0.5);
  color: #e9d5ff;
  background: rgba(88, 28, 135, 0.2);
}

/*
 * Config modal: zoom from ui.js (see computeConfigModalZoom). Fixed authored width keeps the original
 * layout ratio; resolution-based zoom scales width and height together (not extra CSS width).
 */
.modal.modal--config {
  width: min(calc(100vw - 24px), 34rem);
  max-height: min(86dvh, calc(100dvh - 40px));
  padding: 0;
  gap: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.config-modal__header {
  flex-shrink: 0;
  padding: 14px 18px 0;
}
.config-modal__header .modal-divider {
  margin-top: 12px;
}
/* Config copy: same blue-gray as sidebar “STREAMERS” (`.section-label.streamers-heading`). */
.modal.modal--config .config-modal__header .modal-title {
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.modal.modal--config .modal-close {
  color: var(--text-secondary);
}
.modal.modal--config .modal-close:hover {
  color: var(--text-primary);
}
.config-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 18px 6px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.config-modal__body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.config-modal__sweep-intro {
  flex-shrink: 0;
  margin: 0 0 14px;
  padding: 10px 12px 11px;
  border-radius: 4px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dim);
  background: var(--bg-card);
  box-shadow: none;
}
/* Direct child of column grid: vertical rhythm from grid gap only */
.config-modal__grid > .config-modal__sweep-intro {
  margin: 0;
}
/* Same scale as other section labels; accent color so it stays the focal heading. */
.config-modal__sweep-intro__title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 8px;
  padding-bottom: 7px;
  line-height: 1.3;
  border-bottom: 1px solid var(--border);
}
.config-modal__sweep-intro__copy {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}
/* Match config .info-box emphasis (accent) without heavier weight */
.config-modal__sweep-intro__copy strong {
  color: var(--accent);
  font-weight: 400;
}
.config-modal__sweep-intro__copy hr {
  border: 0;
  height: 1px;
  margin: 10px 0;
  background: var(--border);
}
/* Nested “How sweeping works” shell (e.g. Swap priority): field-group already spaces sections. */
#cfgSwapPriorityGroup {
  margin-bottom: 10px;
}
#cfgSwapPriorityGroup .config-modal__sweep-intro {
  margin: 0;
}
.config-modal__field-inline--ui-scale-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-bottom: 0;
}
.config-modal__field-inline--ui-scale-row .field-label {
  flex: 0 1 auto;
  margin: 0;
  padding-right: 0;
}
.config-modal__field-inline--ui-scale-row .config-bool-toggle--triple {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}
.config-modal__field-inline--swap-select select {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 11.5rem;
  width: auto;
}
.modal--config .config-modal__swap-prompt-select {
  color: var(--accent);
}
.modal--config .config-modal__swap-prompt-select option {
  color: var(--text-primary);
  background: var(--bg-card);
}
.info-box__paren {
  color: var(--text-dim);
  font-weight: 400;
}
.modal--config .field-label .field-label__paren {
  color: var(--text-dim);
}
.config-modal__footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 18px max(16px, env(safe-area-inset-bottom, 0px));
  min-height: 52px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.14);
}
.config-modal__save-feedback {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 2px 8px 0 0;
  text-align: right;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  line-height: 1.42;
  white-space: pre-line;
  color: var(--text-secondary);
  align-self: flex-end;
}
.config-modal__save-feedback--ok {
  color: var(--green-live);
}
/*
 * Grid + min-height: content wins when tall; when short, row is at least ~40dvh so the divider reads full-height
 * without flex-basis:0 (which capped the row and hid overflow from body scroll).
 */
.add-form.config-modal__columns {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}
.config-modal__col {
  min-width: 0;
  min-height: 0;
}
.config-modal__vdivider {
  display: none;
}
.config-modal__grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}
.config-modal__grid .field-group {
  min-width: 0;
}
.config-modal__grid .info-box {
  margin-top: 4px;
  line-height: 1.45;
  font-size: 13px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-secondary);
}
.modal--config .field-label {
  font-size: 13px;
  letter-spacing: 0.09em;
  color: var(--text-secondary);
}
.modal--config .field-label--plain {
  font-size: 14px;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}
.modal--config .config-modal__toggle-row .field-label {
  color: var(--text-secondary);
}
.modal--config input[type='text'] {
  color: var(--text-secondary);
}
.config-modal__field-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.config-modal__field-inline .field-label {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
  padding-right: 4px;
  margin: 0;
  cursor: default;
}
.config-modal__field-inline--poll-mode .config-bool-toggle {
  flex-shrink: 0;
}
.modal--config .config-modal__input-narrow {
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 2.6rem;
  min-width: 2.6rem;
  max-width: 2.6rem;
  font-size: 12px;
  padding: 4px 4px;
  text-align: center;
}
.modal--config .config-poll-interval-auto-line {
  margin: 8px 0 0 0;
  padding: 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  line-height: 1.45;
  font-weight: inherit;
  color: var(--text-secondary);
}
.modal--config .config-poll-interval-auto-line__label {
  margin-right: 6px;
}
.modal--config .config-poll-interval-auto-line strong {
  color: var(--accent);
  font-weight: 500;
}
.config-poll-interval-manual-wrap {
  margin-top: 10px;
}
/* Floating value tracks native range thumb (position set in JS from layout + thumb width). */
.config-range-slider-rail {
  position: relative;
  padding-top: 22px;
  margin-bottom: 2px;
}
.config-range-slider-val {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateX(-50%);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  line-height: 1.2;
  color: var(--text-secondary);
  pointer-events: none;
  white-space: nowrap;
}
.modal--config .config-range-slider-rail input[type='range'] {
  width: 100%;
  max-width: 100%;
  display: block;
}
.modal--config input[type='range'] {
  max-width: 100%;
  color: var(--text-secondary);
}
.modal--config .slider-val {
  font-size: 14px;
  color: var(--text-secondary);
}
.modal--config .slider-endpoints {
  font-size: 10px;
  margin-top: 4px;
  color: var(--text-secondary);
}
.modal--config .config-bool-toggle__opt {
  font-size: 12px;
  padding: 6px 15px;
  min-width: 48px;
  color: var(--text-secondary);
}
.modal--config .config-modal__footer .btn {
  font-size: 14px;
  padding: 8px 18px;
  color: var(--text-secondary);
}
.modal--config .config-modal__footer .btn.primary {
  color: var(--accent);
}
.field-label--plain {
  text-transform: none;
  letter-spacing: 0.04em;
}
.config-modal__toggle-row {
  margin-bottom: 0;
  gap: 12px;
  align-items: center;
}
.config-modal__toggle-row .field-label {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
  padding-right: 4px;
}
.config-api-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.config-api-status__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
}
.config-api-status__label--twitch {
  color: var(--purple-variety);
}
.config-api-status__val {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .add-form.config-modal__columns {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
  }
  .config-modal__vdivider {
    display: none;
  }
  .config-modal__col--left {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }
  .config-modal__field-inline--swap-select select {
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
  }
}
@media (max-width: 560px) {
  .modal.modal--config {
    width: min(100vw - 16px, calc(56rem * 1.1));
    max-height: min(88dvh, calc(100dvh - 32px));
  }
  .config-modal__footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .config-modal__save-feedback {
    text-align: left;
    align-self: stretch;
    padding: 0 0 2px 0;
  }
  .config-modal__footer .btn.primary {
    width: 100%;
    text-align: center;
  }
}

.rate-limit-lead {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.rate-limit-snooze {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.rate-limit-snooze input {
  margin: 2px 0 0;
  flex-shrink: 0;
}
.rate-limit-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.stream-cell.side-stream { cursor: pointer; }
.stream-cell.side-stream:hover { border-color: var(--accent-stream-hover); }

/* Drag-over: color only (1px border). No outline — inset outline + overflow:hidden + pause/iframe painted odd corner slivers. */
.stream-cell.side-stream.stream-cell--drop-target,
.stream-cell.stream-cell--drop-target:not(.side-stream) {
  border: 1px solid var(--accent-drag-target);
}
.stream-unified--focused .stream-cells-plane .stream-cell.focused .stream-cell-body.stream-cell--drop-target {
  border: 1px solid var(--accent-drag-target);
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 3px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-toggle:hover { color: var(--text-primary); }

/* Header toggle: hit target fits scaled SVG; uniform scale keeps 34:32 proportions vs 32px radar (non-scaling-stroke). */
.sidebar-toggle--header {
  flex-shrink: 0;
  width: 46px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  transition: color 0.15s ease;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-toggle--header:hover {
  color: var(--accent);
  background: transparent;
}
.sidebar-toggle-tab-icon {
  display: block;
  overflow: visible;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  transform: scale(1.4);
  transform-origin: center center;
}
.sidebar-toggle-icon-outline,
.sidebar-toggle-icon-divider {
  fill: none;
}
.sidebar-toggle-icon-chevron {
  transition: opacity 0.2s ease, transform 0.22s ease;
}
.sidebar-toggle--header[aria-expanded="true"] .sidebar-toggle-icon-chevron--collapse {
  opacity: 1;
  transform: translateX(0);
}
.sidebar-toggle--header[aria-expanded="true"] .sidebar-toggle-icon-chevron--expand {
  opacity: 0;
  transform: translateX(5px);
}
.sidebar-toggle--header[aria-expanded="false"] .sidebar-toggle-icon-chevron--collapse {
  opacity: 0;
  transform: translateX(-5px);
}
.sidebar-toggle--header[aria-expanded="false"] .sidebar-toggle-icon-chevron--expand {
  opacity: 1;
  transform: translateX(0);
}
@media (prefers-reduced-motion: reduce) {
  .sidebar-toggle-icon-chevron {
    transition: opacity 0.1s ease;
  }
  .sidebar-toggle--header[aria-expanded="true"] .sidebar-toggle-icon-chevron--collapse,
  .sidebar-toggle--header[aria-expanded="false"] .sidebar-toggle-icon-chevron--expand {
    transform: none;
  }
  .sidebar-toggle--header[aria-expanded="true"] .sidebar-toggle-icon-chevron--expand,
  .sidebar-toggle--header[aria-expanded="false"] .sidebar-toggle-icon-chevron--collapse {
    transform: none;
  }
}

.info-box {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.6;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 10px;
  margin-top: 4px;
}
.info-box strong { color: var(--accent); font-weight: 500; }
.info-box i {
  font-style: italic;
  color: var(--text-dim);
}
/* Same 1px color as .config-modal__vdivider between config columns */
.info-box hr {
  border: 0;
  height: 1px;
  margin: 10px 0;
  background: var(--border);
}

.slider-endpoints {
  display: flex;
  justify-content: space-between;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Selection slot button in sidebar streamer cards */
.select-slot-btn {
  min-width: 26px;
  height: 22px;
  border-radius: 3px;
  border: 1px solid var(--border-bright);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 6px;
  transition: all 0.15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.select-slot-btn:hover:not(:disabled) { border-color: var(--accent-dim); color: var(--text-primary); background: rgba(126,200,232,0.06); }
.select-slot-btn.slot-selected:hover:not(:disabled) {
  color: #fff;
}
.select-slot-btn.slot-selected {
  border-color: var(--accent-dim);
  color: #fff;
  background: rgba(126, 200, 232, 0.08);
}
.select-slot-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Focused-stream selector button in focus mode (crosshair icon) */
.focus-slot-btn {
  min-width: 26px;
  height: 22px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0 5px;
  transition: all 0.15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.focus-slot-btn:hover { border-color: var(--accent-dim); color: var(--accent); }
.focus-slot-btn.slot-focused {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(126,200,232,0.15);
}

/* Enter / exit focus — square control tucked in the bar corner (32px bar → 24×24 + 4px inset). */
.exit-focus-btn,
.focus-swap-btn {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  margin: 0;
  border-radius: 3px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 0;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  z-index: 1;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}
.exit-focus-btn svg,
.focus-swap-btn svg {
  display: block;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
/* Stroke caps on the exit brackets read slightly left in the box; nudge for optical center. */
.exit-focus-btn svg {
  transform: translateX(1px);
}
.exit-focus-btn:hover,
.focus-swap-btn:hover {
  color: var(--accent);
  background: transparent;
}

/* Play-to-load overlay inside each selected stream cell */
.play-overlay {
  position: absolute;
  inset: 0;
  bottom: calc(32px * var(--ui-scale, 1.25)); /* above scaled cell-bar */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-card);
  z-index: 2;
  box-sizing: border-box;
  /* Tight 16×9 tiles (focus main): centered block can exceed height; without clip the Watch button’s
     accent border paints a thin line above the bar (bar z-index wins except the top edge). */
  padding: 6px 10px;
  overflow: hidden;
  zoom: var(--ui-scale, 1.25);
}

.stream-unified-layout.stream-unified--focused .stream-cells-plane > .stream-cell.focused:not(.side-stream) .play-overlay {
  zoom: calc(var(--ui-scale, 1.25) * var(--focus-main-paused-scale, 1));
}

.play-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-bright);
  opacity: 0.85;
}
.play-name {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}
.play-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.play-panel-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(9px, calc(10px * 1.25 / var(--ui-scale, 1.25)), 11px);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  text-align: center;
  width: 100%;
  max-width: 100%;
  line-height: 1.35;
  padding: 0 4px;
  box-sizing: border-box;
}
.play-panel-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-width: 0;
}
.play-panel-lead {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.play-panel-acc {
  color: #959eb0;
}
.play-panel-sep {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  opacity: 0.88;
  margin: 0 5px;
}
.play-panel-rank {
  font-weight: 400;
}
.play-panel-rank-pending {
  color: #8a93a6;
  font-weight: 400;
}
.play-panel-wr {
  flex-shrink: 0;
  font-weight: 400;
  font-size: 1em;
}
.play-panel-wr--wr-na {
  color: #6b7280;
  font-weight: 400;
}
.play-panel-wr--wr-bad {
  color: #b86b70;
}
.play-panel-wr--wr-near50 {
  color: #9aa3b2;
}
.play-panel-wr--wr-fiftys {
  color: #89b4e8;
}
.play-panel-wr--wr-green {
  color: #7dcea0;
}
.play-panel-wr--wr-yellow {
  color: #e8d55d;
}
.play-panel-wr--wr-gold {
  color: #d4a84b;
}
.play-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 22px;
  background: rgba(126,200,232,0.1);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
.play-btn:hover { background: rgba(126,200,232,0.22); }

/* Paused overlay × — match sidebar + / ☆ / Edit */
.play-overlay-remove-btn,
.stream-cell-playing-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 5;
  /* Fallback when cqw unavailable — box unchanged; larger × via font-size only */
  width: 25px;
  height: 25px;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  color: var(--text-secondary);
  font-family: 'Rajdhani', sans-serif;
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.12s ease;
}
.play-overlay-remove-btn {
  background: rgba(255, 255, 255, 0.04);
}
.play-overlay-remove-btn:hover,
.stream-cell-playing-remove:hover {
  border-color: var(--accent);
  color: #fff;
  background: rgba(126, 200, 232, 0.28);
}
/* Tile-aware scaling — capped lower so wide focus / grid tiles don’t get an oversized × */
@supports (width: 1cqw) {
  .play-overlay-remove-btn,
  .stream-cell-playing-remove {
    width: clamp(24px, calc(3.6cqw + 6px), 30px);
    height: clamp(24px, calc(3.6cqw + 6px), 30px);
    font-size: clamp(20px, calc(2.85cqw + 8px), 24px);
    top: clamp(3px, calc(0.55cqw + 2px), 7px);
    right: clamp(3px, calc(0.55cqw + 2px), 7px);
    border-radius: clamp(3px, 0.65cqw, 5px);
  }
}

/* Compact overlay + bar chrome for mini side streams in focus layout. */
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .play-overlay {
  gap: 8px;
  padding: 6px 8px;
  zoom: calc(var(--ui-scale, 1.25) * var(--focus-mini-paused-scale, 0.82));
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .play-avatar {
  width: 56px;
  height: 56px;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .play-name {
  font-size: 14px;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .play-status {
  font-size: 9px;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .play-panel-meta {
  font-size: 9px;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .play-panel-sep {
  font-size: 10px;
  margin: 0 3px;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .play-panel-wr {
  font-size: 9px;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .play-btn {
  padding: 7px 14px;
  font-size: 11px;
  gap: 6px;
}
/* Minis: slightly smaller base + milder cqw (overlay zoom still shrinks the panel) */
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .play-overlay-remove-btn,
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .stream-cell-playing-remove {
  width: 26px;
  height: 26px;
  top: 3px;
  right: 3px;
  font-size: 22px;
  font-weight: 500;
  /* Zoom + Rajdhani × reads right/low in minis — optical center */
  line-height: 0;
  transform: translate(-0.65px, -0.45px);
}
@supports (width: 1cqw) {
  .stream-unified--focused .stream-cells-plane .stream-cell.side-stream .play-overlay-remove-btn,
  .stream-unified--focused .stream-cells-plane .stream-cell.side-stream .stream-cell-playing-remove {
    width: clamp(24px, calc(7.5cqw + 4px), 34px);
    height: clamp(24px, calc(7.5cqw + 4px), 34px);
    font-size: clamp(20px, calc(5.25cqw + 7px), 26px);
    top: clamp(3px, calc(0.95cqw + 1px), 7px);
    right: clamp(3px, calc(0.95cqw + 1px), 7px);
  }
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .stream-cell-playing-remove {
  zoom: calc(var(--ui-scale, 1.25) * var(--focus-mini-paused-scale, 0.82));
}

/* Live embed: hide × until cell hover or × itself :focus-visible (not :focus-within on .stream-cell — pause / bar controls would keep × stuck after click). */
.stream-cell-playing-remove {
  opacity: 0;
  pointer-events: none;
  /* Match visual size of .play-overlay-remove-btn (overlay uses zoom: var(--ui-scale)). */
  zoom: var(--ui-scale, 1.25);
  /* Opaque chip on video; :hover still uses sidebar-style accent above */
  background: rgba(10, 10, 14, 0.94);
  color: rgba(248, 248, 252, 0.96);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    opacity 0.12s ease,
    box-shadow 0.15s ease;
}
body:not(.stream-cell-dragging) .stream-cell:not(.focused):hover .stream-cell-playing-remove,
body:not(.stream-cell-dragging) .stream-cell:not(.focused) .stream-cell-playing-remove:focus-visible {
  opacity: 1;
  pointer-events: auto;
}
/* Focus main tile: outer cell is taller than the video (grid spacers); only body is the hover target */
body:not(.stream-cell-dragging) .stream-cell.focused .stream-cell-body:hover .stream-cell-playing-remove,
body:not(.stream-cell-dragging) .stream-cell.focused .stream-cell-playing-remove:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .cell-bar {
  zoom: var(--cell-bar-zoom, 1);
  gap: 4px;
  --cell-bar-gap-hit: 4px;
  --cell-bar-pad-x: 8px;
  padding: 0 8px;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .cell-bar:has(.focus-swap-btn),
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .cell-bar:has(.exit-focus-btn) {
  padding-right: 28px;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .cell-meta {
  font-size: 10px;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .cell-status {
  font-size: 10px;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .cell-bar:has(.focus-swap-btn) .cell-status,
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .cell-bar:has(.exit-focus-btn) .cell-status {
  padding-right: 2px;
}
.stream-unified--focused .stream-cells-plane .stream-cell.side-stream .cell-pause-btn {
  font-size: 10px;
  padding: 0 1px;
  margin: 0;
}

.site-footer {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 20px 28px;
  font-size: 10px;
  line-height: 1.55;
  color: var(--text-dim);
  text-align: center;
}
.site-footer a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.site-footer a:hover { color: var(--text-primary); }
.site-footer-riot { margin-bottom: 10px; }
.site-footer-fine { font-size: 9px; letter-spacing: 0.02em; }
