/* 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;
}
/* Persisted collapsed state: avoid animating width on first paint (see index.html + main.js). */
html.sidebar-init-collapsed .sidebar {
  transition: none !important;
}
.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;
}
/* Header global toolbar: explicit header glyph size — do not shrink with .stream-global-toolbar rule above. */
header .stream-global-toolbar .sidebar-sel-ic-btn svg {
  transform: none;
}

.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]:not(.chat-input), select:not(.chat-send-target-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]:not(.chat-input):focus, select:not(.chat-send-target-select):focus { border-color: var(--accent-dim); }
select:not(.chat-send-target-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;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.stream-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px;
  gap: 8px;
}
