:root {
  --bg: #0e0e10;
  --surface: #18181b;
  --surface-2: #1f1f23;
  --surface-3: #26262c;
  --border: #2f2f35;
  --text: #efeff1;
  --muted: #adadb8;
  --faint: #6e6e78;
  --purple: #9147ff;
  --purple-hover: #772ce8;
  --purple-soft: rgba(145, 71, 255, .18);
  --live: #eb0400;
  --topbar-h: 50px;
  --sidebar-w: 240px;
  --chat-w: 340px;
  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
kbd {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 4px;
  background: var(--surface-3); border: 1px solid var(--border); border-bottom-width: 2px;
  font: 600 11px/16px Inter, sans-serif; text-align: center; color: var(--text);
}
code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 10px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(0,0,0,.6), 0 1px 3px rgba(0,0,0,.5);
  position: relative; z-index: 20;
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 6px; }
.tb-left { flex: 1 1 0; min-width: 0; }
.tb-right { flex: 1 1 0; justify-content: flex-end; }

.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); margin-left: 4px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px; background: var(--purple);
  display: grid; place-items: center;
}
.brand-mark svg { width: 22px; height: 22px; fill: #fff; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.2px; }

.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: var(--radius); color: var(--text);
}
.icon-btn:hover { background: rgba(83,83,95,.48); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.icon-btn.on { color: var(--purple); }

.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border: 0; border-radius: var(--radius);
  background: var(--purple); color: #fff; font-weight: 600; font-size: 13px;
}
.btn-primary:hover { background: var(--purple-hover); }
.btn-primary svg { width: 16px; height: 16px; }
.btn-primary.off { background: var(--surface-3); color: var(--text); }
.btn-primary.off:hover { background: #35353b; }
.btn-primary.big { height: 40px; padding: 0 20px; font-size: 14px; }

.add-form {
  flex: 0 1 420px; display: flex; height: 36px;
  border-radius: var(--radius); overflow: hidden;
}
.add-form input {
  flex: 1; min-width: 0; border: 2px solid transparent; border-right: 0;
  background: #2a2a2d; padding: 0 12px; border-radius: var(--radius) 0 0 var(--radius);
  outline: none; transition: border-color .12s, background .12s;
}
.add-form input:hover { border-color: #47474f; }
.add-form input:focus { border-color: var(--purple); background: var(--bg); }
.add-form input::placeholder { color: var(--faint); }
.add-btn {
  width: 38px; border: 0; background: var(--surface-3); display: grid; place-items: center;
}
.add-btn:hover { background: #35353b; }
.add-btn svg { width: 18px; height: 18px; }

.seg { display: flex; background: var(--surface-3); border-radius: var(--radius); padding: 2px; }
.seg-btn {
  display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  background: transparent; border: 0; border-radius: 4px; color: var(--muted); font-weight: 600; font-size: 13px;
}
.seg-btn svg { width: 16px; height: 16px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--purple); color: #fff; }

.size-ctl { display: flex; align-items: center; gap: 6px; color: var(--muted); padding: 0 6px; }
.size-ctl svg { width: 16px; height: 16px; }
.size-ctl.disabled { opacity: .35; pointer-events: none; }
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; width: 90px; height: 20px; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--purple) var(--p, 50%), #4b4b54 var(--p, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; margin-top: -5px; border: 0; }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: #4b4b54; }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--purple); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }

/* Menu */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 300px;
  background: var(--surface-2); border-radius: 8px; padding: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
}
.menu-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 4px 6px 8px; }
.menu-sep { height: 1px; background: var(--border); margin: 8px 0; }
.menu-row { display: flex; flex-direction: column; gap: 6px; padding: 6px; }
.menu-row select {
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 4px; height: 30px; padding: 0 8px;
}
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 6px; border-radius: 4px; cursor: pointer; }
.toggle-row:hover { background: var(--surface-3); }
.toggle-row small { display: block; color: var(--faint); font-size: 11px; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-row i { width: 34px; height: 18px; border-radius: 9px; background: #4b4b54; position: relative; flex: none; transition: background .15s; }
.toggle-row i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle-row input:checked + i { background: var(--purple); }
.toggle-row input:checked + i::after { transform: translateX(16px); }
.keys { list-style: none; margin: 0; padding: 0 6px; display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.hint { color: var(--faint); font-size: 11px; margin: 10px 6px 2px; }

/* ---------- Layout ---------- */
.app { display: flex; height: calc(100% - var(--topbar-h)); }

.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width .2s ease;
}
body.sb-collapsed .sidebar { width: 50px; }
.sb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 12px 8px; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
}
.sb-count { color: var(--muted); font-weight: 600; }
body.sb-collapsed .sb-title, body.sb-collapsed .sb-empty, body.sb-collapsed .sb-foot { display: none; }
.sb-list { list-style: none; margin: 0; padding: 0 0 8px; overflow-y: auto; flex: 1; }
.sb-item {
  display: flex; align-items: center; gap: 10px; padding: 5px 10px; height: 46px;
  cursor: pointer; position: relative; user-select: none;
}
.sb-item:hover { background: var(--surface-3); }
.sb-item.focused { background: var(--purple-soft); }
.sb-item.focused::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--purple); }
.sb-item.dragging { opacity: .4; }
.sb-item.drop-before { box-shadow: inset 0 2px 0 var(--purple); }
.sb-item.drop-after { box-shadow: inset 0 -2px 0 var(--purple); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
  position: relative;
}
.avatar .num {
  position: absolute; right: -4px; bottom: -4px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--surface); color: var(--muted); font-size: 9px; display: grid; place-items: center;
  border: 1px solid var(--border);
}
.sb-meta { flex: 1; min-width: 0; }
body.sb-collapsed .sb-meta, body.sb-collapsed .sb-audio { display: none; }
body.sb-collapsed .sb-item { justify-content: center; padding: 5px; }
.sb-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-status { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.live { background: var(--live); }
.sb-audio {
  width: 30px; height: 30px; border: 0; border-radius: 4px; background: transparent;
  color: var(--faint); display: grid; place-items: center;
}
.sb-audio svg { width: 18px; height: 18px; }
.sb-audio:hover { background: #3a3a40; color: var(--text); }
.sb-audio.on { color: var(--purple); }
.sb-empty { color: var(--faint); font-size: 13px; padding: 4px 12px; }
.sb-foot { padding: 10px; border-top: 1px solid var(--border); }
.sb-clear { width: 100%; height: 30px; border: 0; border-radius: 4px; background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 600; }
.sb-clear:hover { background: #35353b; color: var(--text); }

.stage-wrap { flex: 1; min-width: 0; position: relative; background: var(--bg); }
.stage { position: absolute; inset: 6px; }

/* ---------- Tiles ---------- */
.tile {
  position: absolute; background: #000; border-radius: 4px; overflow: hidden;
  transition: left .28s cubic-bezier(.2,.8,.2,1), top .28s cubic-bezier(.2,.8,.2,1), width .28s cubic-bezier(.2,.8,.2,1), height .28s cubic-bezier(.2,.8,.2,1);
  outline: 2px solid transparent; outline-offset: -2px;
}
.tile.no-anim { transition: none; }
.tile .player, .tile .player iframe { position: absolute; inset: 0; width: 100% !important; height: 100% !important; border: 0; }

.tile-bar {
  position: absolute; left: 0; right: 0; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 4px; padding: 6px;
  background: linear-gradient(rgba(0,0,0,.85), rgba(0,0,0,0));
  opacity: 0; transform: translateY(-4px); transition: opacity .15s, transform .15s;
  pointer-events: none;
}
.tile:hover .tile-bar, .tile.menu-open .tile-bar { opacity: 1; transform: none; pointer-events: auto; }
.tile-name {
  display: flex; align-items: center; gap: 6px; min-width: 0; margin-right: auto;
  background: rgba(0,0,0,.55); border: 0; border-radius: 4px; padding: 3px 8px 3px 4px; font-weight: 700; font-size: 13px;
}
.tile-name:hover { background: var(--purple); }
.tile-name .n { background: rgba(255,255,255,.16); border-radius: 3px; font-size: 11px; padding: 0 5px; line-height: 17px; }
.tile-name .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb {
  width: 30px; height: 30px; display: grid; place-items: center; flex: none;
  background: rgba(0,0,0,.55); border: 0; border-radius: 4px; color: #fff;
}
.tb svg { width: 17px; height: 17px; }
.tb:hover { background: rgba(255,255,255,.22); }
.tb.on { background: var(--purple); }
.vol {
  display: flex; align-items: center; background: rgba(0,0,0,.55); border-radius: 4px; height: 30px; padding: 0 8px;
}
.vol input { width: 70px; }


/* Click catcher for thumbnails in focus mode */
.catcher {
  position: absolute; inset: 0; z-index: 2; display: none;
  background: transparent; border: 0; padding: 0;
}
body.mode-focus .tile:not(.focused) .catcher { display: block; }
.catcher::after {
  content: "Klicken zum Fokussieren"; position: absolute; inset: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: rgba(14,14,16,.55); opacity: 0; transition: opacity .15s;
}
.catcher:hover::after { opacity: 1; }
.tile.tiny .catcher::after { content: ""; }

.offline {
  position: absolute; inset: 0; z-index: 1; display: none; place-items: center; text-align: center;
  background: radial-gradient(circle at 50% 40%, #1f1f23, #0e0e10); color: var(--muted);
  pointer-events: none;
}
.tile.is-offline .offline { display: grid; }
.offline b { display: block; color: var(--text); font-size: 15px; margin-bottom: 2px; }

/* ---------- Empty state ---------- */
.empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; overflow: auto; }
.empty[hidden] { display: none; }
.empty-card { width: min(560px, 100%); text-align: center; }
.empty-icon { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 14px; background: var(--purple); display: grid; place-items: center; }
.empty-icon svg { width: 44px; height: 44px; fill: #fff; }
.empty h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.4px; }
.empty p { margin: 0 0 20px; color: var(--muted); }
.empty-form { display: flex; gap: 8px; }
.empty-form input {
  flex: 1; min-width: 0; height: 40px; padding: 0 14px; border-radius: var(--radius);
  background: #2a2a2d; border: 2px solid transparent; outline: none;
}
.empty-form input:focus { border-color: var(--purple); background: var(--bg); }
.empty-tips { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 8px; text-align: left; }
.empty-tips li { background: var(--surface); border-radius: var(--radius); padding: 10px 14px; color: var(--muted); font-size: 13px; }
.empty-tips b { color: var(--text); }

.file-warn {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 10;
  background: #3a2a00; color: #ffd37a; border: 1px solid #7a5a00; padding: 8px 14px; border-radius: var(--radius); font-size: 13px;
}

/* ---------- Chat ---------- */
.chat {
  width: var(--chat-w); flex: none; background: var(--surface); display: flex; flex-direction: column;
  border-left: 1px solid var(--border); transition: width .2s ease, border-color .2s;
  overflow: hidden;
}
body.chat-closed .chat { width: 0; border-left-color: transparent; }
.chat-head { height: 50px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 10px; border-bottom: 1px solid var(--border); min-width: var(--chat-w); }
.chat-head select {
  flex: 1; height: 32px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 4px; padding: 0 8px; font-weight: 600;
}
.chat-body { flex: 1; position: relative; min-width: var(--chat-w); }
.chat-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: none; }
.chat-body iframe.show { display: block; }
.chat-empty { color: var(--faint); padding: 20px; text-align: center; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--surface-2); color: var(--text); padding: 10px 16px; border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06); font-weight: 600; font-size: 13px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1400px) {
  .ghost-btn span { display: none; }
  .ghost-btn { padding: 0 8px; }
}
@media (max-width: 1150px) {
  .seg-btn span, .btn-primary span { display: none; }
}
@media (max-width: 800px) {
  :root { --chat-w: 280px; }
  .brand-name { display: none; }
  body:not(.sb-forced) .sidebar { width: 50px; }
  body .sb-meta, body .sb-audio, .sb-head, .sb-empty, .sb-foot { display: none; }
  .sb-item { justify-content: center; padding: 5px; }
}

/* ---------- Avatars ---------- */
.avatar { overflow: visible; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar.off img { filter: grayscale(1); opacity: .6; }
.sb-status .vc { color: var(--muted); }
.sb-status .game { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sb-status .vc + .game::before { content: "·"; margin-right: 5px; }
.tava { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }

/* ---------- Own player controls (Twitch overlay hidden) ---------- */
.tile .own { display: none; }
.tile.own-controls .own { display: grid; }
.tile.own-controls .q.own { display: block; }
.q {
  height: 30px; background: rgba(0,0,0,.55); border: 0; border-radius: 4px; padding: 0 6px;
  font-size: 12px; font-weight: 600; color: #fff; cursor: pointer;
}
.q option { background: var(--surface-2); }
.tile:fullscreen { border-radius: 0; outline: 0; }
.tile:fullscreen .catcher { display: none !important; }

/* ---------- Splitter ---------- */
.splitter { position: absolute; z-index: 5; touch-action: none; }
.splitter.vertical { width: 14px; height: 100%; margin-left: -7px; cursor: col-resize; }
.splitter.horizontal { height: 14px; width: 100%; margin-top: -7px; cursor: row-resize; }
.splitter span { position: absolute; border-radius: 3px; background: var(--purple); opacity: 0; transition: opacity .15s; }
.splitter.vertical span { left: 5px; width: 4px; top: 50%; height: 64px; margin-top: -32px; }
.splitter.horizontal span { top: 5px; height: 4px; left: 50%; width: 64px; margin-left: -32px; }
.splitter:hover span, body.resizing .splitter span { opacity: 1; }
.splitter.vertical:hover span, body.resizing .splitter.vertical span { top: 0; height: 100%; margin-top: 0; opacity: .8; }
.splitter.horizontal:hover span, body.resizing .splitter.horizontal span { left: 0; width: 100%; margin-left: 0; opacity: .8; }
body.resizing { user-select: none; }
body.resizing .tile { transition: none; }
body.resizing .tile iframe, body.resizing .chat iframe { pointer-events: none; }

/* ---------- Search history dropdown ---------- */
.add-form { position: relative; overflow: visible; }
.add-btn { border-radius: 0 var(--radius) var(--radius) 0; }
.hist {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--surface-2); border-radius: 8px; padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
  max-height: 60vh; overflow-y: auto;
}
.hist-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.hist-clear { background: none; border: 0; color: var(--purple); font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; padding: 2px 4px; border-radius: 4px; }
.hist-clear:hover { background: var(--surface-3); }
.hist-item { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 4px; cursor: pointer; }
.hist-item:hover, .hist-item.hi { background: var(--surface-3); }
.hist-av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; overflow: hidden; }
.hist-av img { width: 100%; height: 100%; object-fit: cover; }
.hist-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hist-tag { font-size: 11px; font-weight: 700; color: var(--purple); background: var(--purple-soft); padding: 1px 6px; border-radius: 3px; }
.hist-del { width: 24px; height: 24px; border: 0; background: none; color: var(--faint); border-radius: 4px; display: grid; place-items: center; opacity: 0; }
.hist-del svg { width: 14px; height: 14px; }
.hist-item:hover .hist-del, .hist-item.hi .hist-del { opacity: 1; }
.hist-del:hover { background: #3a3a40; color: var(--text); }

.menu-btn { width: calc(100% - 12px); margin: 8px 6px 2px; height: 32px; border: 0; border-radius: 4px; background: var(--surface-3); font-weight: 600; font-size: 13px; }
.menu-btn:hover { background: #35353b; }

/* ---------- Fullscreen mode ---------- */
body.fs { --topbar-h: 0px; }
body.fs .topbar { display: none; }
.fs-bar {
  position: fixed; left: 50%; top: 12px; z-index: 40;
  display: none; align-items: center; gap: 2px; padding: 4px;
  background: rgba(24,24,27,.92); backdrop-filter: blur(8px);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08);
  transform: translate(-50%, -8px); opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s;
}
body.fs .fs-bar { display: flex; }
.fs-bar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.fs-b { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--text); }
.fs-b:hover { background: rgba(83,83,95,.6); }
.fs-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

/* viewer count in tile hover bar */
.tvc { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 12px; color: #fff; opacity: .9; white-space: nowrap; }
.tvc[hidden] { display: none; }
.tvc i { width: 7px; height: 7px; border-radius: 50%; background: var(--live); }

/* ---------- Topbar v2 ---------- */
.tb-div { width: 1px; height: 24px; background: var(--border); margin: 0 6px; }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px;
  background: transparent; border: 0; border-radius: var(--radius); color: var(--text); font-weight: 600; font-size: 13px;
  white-space: nowrap;
}
.ghost-btn svg { width: 18px; height: 18px; }
.ghost-btn:hover, .ghost-btn.open { background: rgba(83,83,95,.48); }
.tb-right .btn-primary { margin-left: 6px; }

/* settings menu v2 */
.menu { width: 320px; max-height: calc(100vh - 70px); overflow-y: auto; padding: 6px; }
.menu-sec { padding: 6px 0; border-bottom: 1px solid var(--border); }
.menu-sec:last-of-type { border-bottom: 0; }
.menu-sec .menu-title { padding: 4px 8px 6px; }
.menu .size-ctl { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 4px 8px; color: var(--text); }
.menu .size-ctl input { width: 100%; }
.menu .hint { margin: 4px 8px 2px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 4px;
  background: transparent; text-align: left; font-size: 14px;
}
.menu-item:hover { background: var(--surface-3); }
.menu-item svg { width: 18px; height: 18px; color: var(--muted); }
.menu-item span { flex: 1; }
.menu-keys { border-top: 1px solid var(--border); padding: 6px 0 2px; }
.menu-keys summary { cursor: pointer; padding: 6px 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); border-radius: 4px; list-style: none; }
.menu-keys summary::-webkit-details-marker { display: none; }
.menu-keys summary::after { content: "▾"; float: right; }
.menu-keys[open] summary::after { content: "▴"; }
.menu-keys summary:hover { background: var(--surface-3); color: var(--text); }
.menu-keys .keys { padding: 6px 8px; }

.ic-bottom { display: none; }
.pos-bottom .ic-right { display: none; }
.pos-bottom .ic-bottom { display: block; }
.fs-b.active { color: var(--purple); }
.seg-btn { white-space: nowrap; }
.seg-btn span { white-space: nowrap; }
.tb-right { flex-shrink: 0; }
.tb-left { flex-shrink: 1; }

/* ---------- Tile bar v2: priorities, never overlaps ---------- */
.tile { container: tile / inline-size; }
.tile-bar { gap: 8px; overflow: hidden; }
.tile-name { flex: 0 1 auto; min-width: 0; overflow: hidden; margin-right: auto; }
.tile-name .n { flex: none; }
.tile-name .tava { flex: none; }
.tile-name .t { min-width: 0; }
.tile-name .tvc { flex: none; padding-left: 2px; }
.tb-ctrls { display: flex; align-items: center; gap: 4px; flex: none; }
.tb-gap { width: 4px; flex: none; }
.vol { padding: 0 8px; }
.vol input { width: 64px; }

/* hide by priority as the tile gets narrower (p5 first) */
@container tile (max-width: 700px) { .tile-bar .p5 { display: none !important; } }
@container tile (max-width: 560px) { .tile-bar .p4 { display: none !important; } }
@container tile (max-width: 400px) { .tile-bar .p3 { display: none !important; } .tile-bar { padding: 4px; } }
@container tile (max-width: 250px) { .tile-bar .p2 { display: none !important; } }

/* ---------- Audio stream: soft purple frame ---------- */
.tile::after {
  content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: inherit;
  box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .2s;
}
.tile.audio::after { box-shadow: inset 0 0 0 1px var(--purple); }
.tile:fullscreen::after { display: none; }

/* ---------- Fullscreen: same background as normal view ---------- */
body.fs .stage-wrap { background: var(--bg); }

/* ---------- Sidebar collapse button (works in fullscreen too) ---------- */
.sb-head { padding: 8px 6px 6px 12px; min-height: 42px; }
.sb-title { display: flex; align-items: center; gap: 8px; }
.sb-toggle {
  width: 30px; height: 30px; display: grid; place-items: center; flex: none;
  border: 0; border-radius: 4px; background: transparent; color: var(--muted);
}
.sb-toggle:hover { background: var(--surface-3); color: var(--text); }
.sb-toggle svg { width: 18px; height: 18px; transition: transform .2s; }
body.sb-collapsed .sb-head { justify-content: center; padding: 8px 0 6px; }
body.sb-collapsed .sb-toggle svg { transform: rotate(180deg); }
@media (max-width: 800px) { .sb-head { display: flex !important; justify-content: center; padding: 8px 0 6px; } .sb-title { display: none; } }

/* sidebar quick add */
.sb-foot { display: flex; flex-direction: column; gap: 8px; }
.sb-add { display: flex; height: 32px; border-radius: 4px; overflow: hidden; }
.sb-add input {
  flex: 1; min-width: 0; border: 2px solid transparent; border-right: 0; border-radius: 4px 0 0 4px;
  background: #2a2a2d; padding: 0 10px; font-size: 13px; outline: none; transition: border-color .12s, background .12s;
}
.sb-add input:hover { border-color: #47474f; }
.sb-add input:focus { border-color: var(--purple); background: var(--bg); }
.sb-add input::placeholder { color: var(--faint); }
.sb-add button { width: 32px; border: 0; background: var(--surface-3); display: grid; place-items: center; color: var(--text); }
.sb-add button:hover { background: var(--purple); }
.sb-add button svg { width: 16px; height: 16px; }

/* ---------- Sidebar volume ---------- */
.sb-item { height: auto; min-height: 46px; padding-top: 6px; padding-bottom: 6px; align-items: flex-start; }
.sb-item .avatar, .sb-item .sb-audio { margin-top: 3px; }
.sb-vol { display: block; width: 100%; height: 14px; margin-top: 4px; }
.sb-vol::-webkit-slider-runnable-track { height: 3px; }
.sb-vol::-webkit-slider-thumb { width: 11px; height: 11px; margin-top: -4px; }
.sb-vol::-moz-range-thumb { width: 11px; height: 11px; }
.sb-vol.muted { opacity: .4; }
.sb-vol.muted:hover { opacity: .8; }
body.sb-collapsed .sb-item { align-items: center; }
body.sb-collapsed .sb-item .avatar { margin-top: 0; }

/* ---------- Recently watched ---------- */
.hist-more, .sbr-more {
  width: 100%; margin-top: 4px; padding: 7px 8px; border: 0; border-radius: 4px; background: transparent;
  color: var(--purple); font-size: 12px; font-weight: 600; text-align: left;
}
.hist-more:hover, .sbr-more:hover { background: var(--surface-3); }
.sb-recent { max-height: 38vh; overflow-y: auto; margin: -2px -4px 0; }
.sb-recent[hidden] { display: none; }
.sbr-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 2px 6px 6px; }
.sbr-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 4px 6px; border: 0; border-radius: 4px;
  background: transparent; text-align: left;
}
.sbr-item:hover { background: var(--surface-3); }
.sbr-item .hist-av { width: 24px; height: 24px; font-size: 11px; }
.sbr-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sbr-item:hover .sbr-name { color: var(--text); }
.sbr-add { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 4px; color: var(--faint); }
.sbr-add svg { width: 14px; height: 14px; }
.sbr-item:hover .sbr-add { background: var(--purple); color: #fff; }
.sbr-more { margin-top: 2px; padding: 5px 6px; }

/* sidebar: remove stream */
.sb-actions { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.sb-item .sb-audio { margin-top: 0; }
.sb-remove {
  width: 30px; height: 22px; border: 0; border-radius: 4px; background: transparent; color: var(--faint);
  display: grid; place-items: center; opacity: 0; transition: opacity .12s;
}
.sb-remove svg { width: 13px; height: 13px; }
.sb-item:hover .sb-remove, .sb-remove:focus-visible { opacity: 1; }
.sb-remove:hover { background: #3a3a40; color: var(--text); }
body.sb-collapsed .sb-actions { display: none; }
@media (max-width: 800px) { .sb-actions { display: none; } }

/* ---------- Sidebar volume as hover popup on the sound icon ---------- */
.sb-item { min-height: 46px; padding-top: 5px; padding-bottom: 5px; align-items: center; }
.sb-item .avatar { margin-top: 0; }
.sb-sound { position: relative; }
.sb-vol-pop {
  position: absolute; right: 100%; top: 50%; z-index: 5;
  display: flex; align-items: center; height: 30px; padding: 0 10px; margin-right: 2px;
  background: var(--surface-2); border-radius: 15px;
  box-shadow: 0 4px 14px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06);
  opacity: 0; pointer-events: none; transform: translate(6px, -50%); transition: opacity .12s, transform .12s;
}
/* invisible bridge so the mouse can move from icon to slider without closing it */
.sb-vol-pop::after { content: ""; position: absolute; right: -6px; top: 0; width: 8px; height: 100%; }
.sb-sound:hover .sb-vol-pop, .sb-item.vol-active .sb-vol-pop { opacity: 1; pointer-events: auto; transform: translate(0, -50%); }
.sb-vol-pop .sb-vol { width: 96px; height: 16px; margin: 0; display: block; }
.sb-vol-pop .sb-vol.muted { opacity: .5; }

/* ---------- Fullscreen bar v2: top right, always visible ---------- */
body.fs .stage { top: 50px; }
body.fs .fs-bar {
  left: auto; right: 12px; top: 7px;
  opacity: 1; transform: none; pointer-events: auto;
  background: var(--surface); box-shadow: 0 0 0 1px rgba(255,255,255,.06);
}
body.fs:not(.chat-closed) .fs-bar { right: calc(var(--chat-w) + 12px); }
.fs-b { position: relative; }
.fs-b.active { color: #fff; background: var(--purple); }
.fs-b.active:hover { background: var(--purple-hover); }
/* tooltips */
.fs-b[data-tip]::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 8px); right: 0;
  white-space: nowrap; padding: 5px 8px; border-radius: 4px;
  background: #fff; color: #0e0e10; font-size: 12px; font-weight: 600;
  opacity: 0; transform: translateY(-3px); pointer-events: none; transition: opacity .12s, transform .12s;
}
.fs-b[data-tip]:hover::after { opacity: 1; transform: none; transition-delay: .25s; }

/* ---------- Sidebar item v3: row 1 avatar/name/remove, row 2 mute + volume ---------- */
.sb-item { flex-direction: column; align-items: stretch; gap: 3px; padding: 7px 8px 6px 10px; min-height: 0; }
.sb-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sb-row .sb-meta { flex: 1; min-width: 0; }
.sb-remove { opacity: .55; width: 26px; height: 26px; flex: none; }
.sb-remove svg { width: 14px; height: 14px; }
.sb-item:hover .sb-remove { opacity: 1; }
.sb-volrow { display: flex; align-items: center; gap: 6px; padding-left: 36px; padding-right: 4px; }
.sb-volrow .sb-audio { width: 26px; height: 24px; flex: none; margin: 0; }
.sb-volrow .sb-audio svg { width: 16px; height: 16px; }
.sb-volrow .sb-vol { flex: 1; min-width: 0; width: auto; height: 16px; margin: 0; display: block; }
.sb-volrow .sb-vol.muted { opacity: .4; }
.sb-volrow:hover .sb-vol.muted { opacity: .75; }
body.sb-collapsed .sb-item { padding: 5px; align-items: center; }
body.sb-collapsed .sb-row { justify-content: center; }
body.sb-collapsed .sb-volrow, body.sb-collapsed .sb-remove { display: none; }
@media (max-width: 800px) { .sb-volrow, .sb-remove { display: none !important; } .sb-row { justify-content: center; } }

/* ---------- Fullscreen bar v3: vertical, top right ---------- */
body.fs .stage { top: 6px; right: 56px; }
body.fs .fs-bar { flex-direction: column; top: 6px; right: 6px; padding: 4px; gap: 2px; }
body.fs:not(.chat-closed) .fs-bar { right: calc(var(--chat-w) + 6px); }
.fs-b[data-tip]::after { top: 50%; right: calc(100% + 8px); transform: translate(3px, -50%); }
.fs-b[data-tip]:hover::after { transform: translate(0, -50%); }

/* recent list: delete from history */
.sbr-item { cursor: pointer; }
.sbr-del {
  width: 22px; height: 22px; display: grid; place-items: center; flex: none;
  border: 0; border-radius: 4px; background: transparent; color: var(--faint); opacity: 0; transition: opacity .12s;
}
.sbr-del svg { width: 12px; height: 12px; }
.sbr-item:hover .sbr-del, .sbr-del:focus-visible { opacity: 1; }
.sbr-del:hover { background: #3a3a40; color: var(--text); }
.sbr-item:has(.sbr-del:hover) .sbr-add { background: transparent; color: var(--faint); }

/* ---------- Grid: click a stream to switch the sound to it ---------- */
body:not(.mode-focus) .tile .catcher { display: block; cursor: pointer; }
/* with Twitch's own overlay shown, keep its control bar clickable */
body:not(.mode-focus) .tile:not(.own-controls) .catcher { bottom: 52px; }
body:not(.mode-focus) .tile .catcher::after {
  content: "Fokus & Ton auf diesen Stream"; inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: block; padding: 7px 12px; border-radius: 6px; white-space: nowrap;
  background: rgba(14,14,16,.75); color: #fff; font-size: 13px;
}
body:not(.mode-focus) .tile.is-pick .catcher::after { content: none; }
body:not(.mode-focus) .tile.is-pick .catcher { cursor: default; }
body:not(.mode-focus) .tile.tiny .catcher::after { content: none; }
body.mode-focus .tile:not(.focused) .catcher { cursor: pointer; }

/* Twitch overlay shown -> Twitch's own controls replace our tile bar */
.tile:not(.own-controls) .tile-bar { display: none; }

/* ---------- Fullscreen controls v4: fixed row inside the sidebar ---------- */
.fs-bar, body.fs .fs-bar { display: none; }
body.fs .stage { top: 6px; right: 6px; }
body.fs .sidebar .fs-bar {
  position: static; display: flex; flex-direction: row; justify-content: space-between; gap: 4px;
  margin: 0 10px 8px; padding: 4px; transform: none; opacity: 1; pointer-events: auto;
  background: var(--surface-2); border-radius: 8px; box-shadow: none; backdrop-filter: none;
}
body.fs .sidebar .fs-b { flex: 1; width: auto; height: 34px; }
.fs-b[data-tip]::after, .fs-b::after { content: none !important; }
/* collapsed sidebar: buttons stacked in the narrow column */
body.fs.sb-collapsed .sidebar .fs-bar { flex-direction: column; margin: 0 5px 8px; padding: 3px; }
body.fs.sb-collapsed .sidebar .fs-b { flex: none; width: 34px; height: 32px; }

/* ---------- Tooltips ---------- */
.tip {
  position: fixed; left: 0; top: 0; z-index: 100; max-width: 260px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 9px; border-radius: 6px;
  background: #fff; color: #0e0e10; font-size: 12.5px; line-height: 1.35;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
  opacity: 0; transform: scale(.97); transform-origin: center; pointer-events: none;
  transition: opacity .1s ease, transform .1s ease;
}
.tip.show { opacity: 1; transform: none; }
.tip-main { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.tip-sub { color: #53535f; font-size: 12px; }
.tip kbd { margin-left: auto; background: #efeff1; border-color: #d3d3d9; color: #0e0e10; }

/* ---------- Sidebar controls: always visible (not only in fullscreen) ---------- */
.sidebar .fs-bar {
  position: static; display: flex; flex-direction: row; justify-content: space-between; gap: 4px;
  margin: 0 10px 8px; padding: 4px; transform: none; opacity: 1; pointer-events: auto;
  background: var(--surface-2); border-radius: 8px; box-shadow: none; backdrop-filter: none;
}
.sidebar .fs-b { flex: 1; width: auto; height: 34px; }
body.sb-collapsed .sidebar .fs-bar { flex-direction: column; margin: 0 5px 8px; padding: 3px; }
body.sb-collapsed .sidebar .fs-b { flex: none; width: 34px; height: 32px; }
@media (max-width: 800px) { .sidebar .fs-bar { flex-direction: column; margin: 0 5px 8px; padding: 3px; } .sidebar .fs-b { flex: none; width: 34px; height: 32px; } }

/* ---------- Offline streams hidden from the stage ---------- */
.tile.off-hidden { visibility: hidden; width: 0 !important; height: 0 !important; pointer-events: none; }
.sb-item.off-hidden .sb-row { opacity: .55; }
.sb-item.off-hidden .sb-status::after { content: "· ausgeblendet"; color: var(--faint); }
.all-offline { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; text-align: center; color: var(--muted); }
.all-offline[hidden] { display: none; }
.all-offline b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* ---------- Live badge (history) ---------- */
.live-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; flex: none; }
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--live); }
.sbr-item .live-badge { margin-right: 2px; }

/* ---------- Groups menu ---------- */
.groups-menu { width: 340px; }
.group-list { display: flex; flex-direction: column; gap: 2px; padding: 0 2px 6px; }
.group-empty { color: var(--faint); font-size: 13px; padding: 4px 8px 8px; }
.group-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.group-item:hover { background: var(--surface-3); }
.group-item.active { background: var(--purple-soft); }
.group-avs { display: flex; flex: none; }
.group-avs .hist-av { width: 24px; height: 24px; font-size: 11px; border: 2px solid var(--surface-2); margin-left: -8px; }
.group-avs .hist-av:first-child { margin-left: 0; }
.group-meta { flex: 1; min-width: 0; }
.group-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-del { width: 26px; height: 26px; flex: none; border: 0; border-radius: 4px; background: transparent; color: var(--faint); display: grid; place-items: center; opacity: 0; }
.group-del svg { width: 13px; height: 13px; }
.group-item:hover .group-del { opacity: 1; }
.group-del:hover { background: #3a3a40; color: var(--text); }
.group-form { display: flex; gap: 6px; padding: 8px 6px 2px; border-top: 1px solid var(--border); }
.group-form input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border-radius: 4px; border: 2px solid transparent; background: #2a2a2d; outline: none; font-size: 13px; }
.group-form input:focus { border-color: var(--purple); background: var(--bg); }
.group-form .btn-primary { flex: none; }

/* ---------- Drag & drop on the stage ---------- */
body.tile-dragging, body.tile-dragging * { cursor: grabbing !important; user-select: none; }
body.tile-dragging .tile iframe { pointer-events: none; }
body.tile-dragging .tile-bar { opacity: 0 !important; }
body.tile-dragging .catcher { display: block !important; }
body.tile-dragging .catcher::after { content: none !important; }
.tile.drag-src { opacity: .45; }
.tile.drop-target::before {
  content: ""; position: absolute; inset: 0; z-index: 6; pointer-events: none; border-radius: inherit;
  background: rgba(145, 71, 255, .22); box-shadow: inset 0 0 0 2px var(--purple);
}
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 120; pointer-events: none;
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 20px;
  background: var(--purple); color: #fff; font-weight: 700; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.drag-ghost img { width: 22px; height: 22px; border-radius: 50%; }
.tile-name { cursor: grab; }

/* ---------- Combined chat ---------- */
.allchat { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--surface); }
.allchat[hidden] { display: none; }
.allchat-filter { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.cf {
  border: 0; border-radius: 10px; padding: 2px 8px; font-size: 11px; font-weight: 700;
  background: hsl(var(--h) 45% 30%); color: #fff;
}
.cf.off { background: var(--surface-3); color: var(--faint); text-decoration: line-through; }
.allchat-log { flex: 1; overflow-y: auto; padding: 6px 10px 10px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.cm { padding: 3px 4px; border-radius: 4px; }
.cm:hover { background: rgba(255,255,255,.04); }
.cm-hidden { display: none; }
.cm-ch {
  display: inline-block; margin-right: 6px; padding: 0 5px; border-radius: 3px; vertical-align: 1px;
  font-size: 10px; font-weight: 700; line-height: 16px; color: #fff; background: hsl(var(--h) 45% 32%);
}
.cm-user { font-weight: 700; }
.cm-action .cm-text { font-style: italic; }
.cm-notice { background: rgba(145, 71, 255, .12); border-left: 3px solid var(--purple); color: var(--muted); }
.cm-emote { height: 24px; vertical-align: middle; margin: -4px 1px; }
.allchat-more {
  position: absolute; left: 50%; bottom: 46px; transform: translateX(-50%);
  border: 0; border-radius: 16px; padding: 6px 14px; background: var(--purple); color: #fff; font-weight: 600; font-size: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
}
.allchat-more[hidden] { display: none; }
.allchat-foot { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--border); font-size: 11px; color: var(--faint); }
.allchat-status { color: var(--muted); font-weight: 600; white-space: nowrap; }
.allchat-status.ok { color: #00c853; }
.allchat-status.err { color: #ff6b6b; }

/* ---------- Topbar v3: purple buttons, groups next to search ---------- */
.btn-primary.icon-only { width: 32px; padding: 0; justify-content: center; }
.btn-primary.icon-only svg { width: 18px; height: 18px; }
.btn-primary.open { background: var(--purple-hover); }
#groupsWrap { margin-left: auto; margin-right: 6px; }
.menu.menu-left { left: 0; right: auto; }
@media (max-width: 1150px) { #btnGroups span { display: none; } #btnGroups { padding: 0 8px; } }

/* settings + groups: grey like the closed chat button, purple only while open */
#btnGroups, #btnSettings { background: var(--surface-3); color: var(--text); }
#btnGroups:hover, #btnSettings:hover { background: #35353b; }
#btnGroups.open, #btnSettings.open { background: var(--purple); color: #fff; }
#btnGroups.open:hover, #btnSettings.open:hover { background: var(--purple-hover); }

#groupsWrap { margin-right: 2px; }
#settingsWrap { margin-left: 6px; }
.tb-right .btn-primary#btnChat { margin-left: 0; }
#groupsWrap { margin-right: -8px; }
#settingsWrap { margin-left: 0; }
.tb-right .btn-primary#btnChat { margin-left: 8px; }

/* group share link */
.group-link { width: 26px; height: 26px; flex: none; border: 0; border-radius: 4px; background: transparent; color: var(--faint); display: grid; place-items: center; }
.group-link svg { width: 15px; height: 15px; }
.group-link:hover { background: #3a3a40; color: var(--text); }
.group-item .group-del { margin-left: -4px; }
/* right topbar: same 8px spacing as between groups and search */
.tb-right { gap: 8px; }
.tb-right .btn-primary#btnChat { margin-left: 0; }
.tb-right .tb-div { margin: 0; }
.tb-right .btn-primary#btnSettings { margin-left: 0; }

/* group link icon: only on hover, like delete */
.group-link { opacity: 0; transition: opacity .12s; }
.group-item:hover .group-link, .group-link:focus-visible { opacity: 1; }

/* confirm bar */
.ask {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 8px;
  background: var(--surface-2); box-shadow: 0 8px 24px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08);
  font-weight: 600; font-size: 13px; max-width: calc(100vw - 32px);
}
.ask[hidden] { display: none; }
.ask-text { flex: 1; min-width: 0; }
.ask-no { height: 32px; padding: 0 12px; border: 0; border-radius: var(--radius); background: var(--surface-3); color: var(--text); font-weight: 600; font-size: 13px; }
.ask-no:hover { background: #35353b; }

/* confirm bar + toast: centered in the player area (not the whole window) */
.stage-wrap > .ask, .stage-wrap > .toast { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); }
.stage-wrap > .ask { z-index: 60; }
.stage-wrap > .toast { z-index: 61; }

/* combined chat: channel avatars */
.cm-av {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  margin-right: 6px; vertical-align: -4px; object-fit: cover;
  font-size: 10px; font-weight: 700; color: #fff;
}
.cf { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 2px; border-radius: 12px; background: var(--surface-3); color: var(--text); }
.cf img, .cf > span { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-size: 10px; color: #fff; }
.cf:hover { background: #35353b; }
.cf.off { background: transparent; color: var(--faint); text-decoration: line-through; box-shadow: inset 0 0 0 1px var(--border); }
.cf.off img, .cf.off > span { filter: grayscale(1); opacity: .5; }

/* ---------- Chat picker ---------- */
.csel { position: relative; flex: 1; min-width: 0; }
.csel-btn {
  width: 100%; height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 5px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface-3); color: var(--text);
  font-weight: 700; font-size: 14px; text-align: left;
}
.csel-btn:hover { background: #35353b; }
.csel-btn[aria-expanded="true"] { border-color: var(--purple); }
.csel-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.csel-chev { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.csel-btn[aria-expanded="true"] .csel-chev { transform: rotate(180deg); }
.csel-av {
  width: 24px; height: 24px; border-radius: 50%; flex: none; object-fit: cover;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
}
.csel-all { background: var(--purple); }
.csel-all svg { width: 14px; height: 14px; }
.csel-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--surface-2); border-radius: 8px; padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
  max-height: 60vh; overflow-y: auto;
}
.csel-menu[hidden] { display: none; }
.csel-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: 4px;
  background: transparent; color: var(--text); font-weight: 600; font-size: 14px; text-align: left;
}
.csel-item:hover, .csel-item:focus-visible { background: var(--surface-3); outline: none; }
.csel-item.active { background: var(--purple-soft); }
.csel-item.all { border-bottom: 1px solid var(--border); border-radius: 4px 4px 0 0; margin-bottom: 4px; padding-bottom: 8px; }
.csel-item .live-badge i { width: 8px; height: 8px; }
.csel-btn:disabled { opacity: .5; cursor: default; }

/* combined chat: links + 7TV zero-width emotes */
.cm-link { color: #bf94ff; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.cm-link:hover { color: #d7b8ff; }
.cm-stack { position: relative; display: inline-grid; vertical-align: middle; margin: -4px 1px; }
.cm-stack > img { grid-area: 1 / 1; margin: 0; justify-self: center; align-self: center; }
.cm-emote { max-width: 112px; object-fit: contain; }

.tip-live { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--live); margin-right: 6px; vertical-align: 1px; }
