:root {
  /* Bearded Tortle theme — "The Shell". Pulled straight from the BT logo:
     shell-green + graffiti-purple + orange outline, on a warm green-black. */
  --bg: #0a0d0a;          /* green-tinted near-black */
  --bg-2: #0e120d;
  --fg: #ecf1e8;
  --muted: #8c9a86;
  --accent: #82c341;      /* shell green (primary) */
  --accent-hi: #a4e05c;   /* brighter green for glows/hover */
  --accent-2: #9a5cf0;    /* graffiti purple (secondary / links) */
  --tan: #f3a02c;         /* orange outline (highlights, dividers) */
  --panel: #14181300;     /* base tint; real fill set on `section` below */
  --panel-fill: #141813;
  --border: #26301f;
  --border-hi: #38491f;
  --danger: #e0645f;
  --font-display: "Bahnschrift", "Archivo Narrow", "Segoe UI Semibold",
                  system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-family: var(--font-body);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--fg);
  line-height: 1.45;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(130, 195, 65, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 340px);
  background-attachment: fixed;
  min-height: 100vh;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* Wide screens: flow the section tiles into two masonry columns. Same tiles,
   just packed — collapse/hide/tabs all keep working per-tile. */
@media (min-width: 1100px) {
  main { max-width: 1200px; }
  #tiles {
    columns: 2;
    column-gap: 14px;
    margin-top: 14px;
  }
  #tiles > section {
    break-inside: avoid;
    margin: 0 0 14px;
  }
}

/* ── Header: a "shell plate" with the three-color logo edge ─────────────── */
header {
  position: relative;
  margin-bottom: 22px;
  padding: 20px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(130, 195, 65, 0.08), rgba(0, 0, 0, 0)) ,
    var(--panel-fill);
  overflow: hidden;
}
/* The scute edge — green→purple→orange fused, straight off the logo. */
header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2) 55%, var(--tan));
}
.brand-row { display: flex; align-items: center; gap: 14px; }
.bt-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.55));
}
.brand-copy { flex: 1 1 auto; min-width: 0; }
h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
h1 .bt-accent { color: var(--accent); }
h1 .bt-accent-2 { color: var(--accent-2); }
/* The wordmark links to the stream — keep the brand colors, no underline. */
h1 .brand-link { text-decoration: none; }
h1 .brand-link:hover .bt-accent,
h1 .brand-link:hover .bt-accent-2 { filter: brightness(1.2); }
h1 .brand-link:hover::after {
  content: " ↗";
  font-size: 0.5em;
  color: var(--tan);
  vertical-align: super;
}
h1 .brand-link:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; border-radius: 4px; }
h2 {
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 0.3px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}
/* Scute marker before every section heading. */
h2::before {
  content: "";
  flex: 0 0 auto;
  width: 13px;
  height: 15px;
  background: linear-gradient(160deg, var(--accent-hi), var(--accent));
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}
.subtitle { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
.subtitle .bt-dot { color: var(--tan); }

section {
  position: relative;
  background: var(--panel-fill);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 16px 16px 16px 18px;
  margin-top: 14px;
  transition: border-color 0.15s ease;
}
section:hover { border-color: var(--border-hi); border-left-color: var(--accent-hi); }
/* Flash target when the Quick Start wizard jumps you to a section. */
@keyframes sb-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(130, 195, 65, 0); }
  30%      { box-shadow: 0 0 0 3px rgba(130, 195, 65, 0.45); }
}
section.sb-highlight { animation: sb-flash 1.1s ease-out 2; }

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  background: #0e0e0e;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  margin-top: 4px;
}

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.transport-row { margin-bottom: 8px; }

button {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  color: #08120a;
  border: 0;
  padding: 8px 15px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.06s ease;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
button:disabled { opacity: 0.45; cursor: default; filter: none; }
button[hidden] { display: none; }
button.secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border-hi);
}
button.secondary:hover { border-color: var(--accent); color: var(--accent-hi); filter: none; }

a { color: var(--accent-2); }
a:hover { color: var(--accent-hi); }

/* ── Header action buttons ─────────────────────────────────────────────── */
.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

/* Read-only badge — this window is a follower (another window polls Spotify). */
#poll-role-badge {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 150;
  padding: 7px 12px;
  border-radius: 999px;
  background: #16181d;
  border: 1px solid var(--border-hi);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

/* Spotify rate-limit banner — fixed at the top, unmissable. */
#spotify-limit-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 14px;
  background: #3a2f10;
  color: #ffcf5c;
  border-bottom: 1px solid #e0b341;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
#spotify-limit-banner #slb-retry {
  background: #e0b341;
  color: #201700;
  border: 0;
  padding: 5px 14px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

/* Cross-links to the other BeardedTortle apps. */
.bt-apps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
}
.bt-apps-label { color: var(--muted); }
.bt-apps a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border-hi);
  border-radius: 999px;
  background: #10140f;
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.bt-apps a:hover { border-color: var(--accent); color: var(--accent-hi); }

/* Ko-fi donate button — Ko-fi coral, cup icon. */
.kofi-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  background: #ff5e5b;
  color: #fff;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-weight: 700;
  text-decoration: none;
  transition: filter 0.12s ease, transform 0.06s ease;
}
.kofi-btn::before { content: "☕"; font-size: 15px; }
.kofi-btn:hover { filter: brightness(1.08); color: #fff; }
.kofi-btn:active { transform: translateY(1px); }
.kofi-btn:focus-visible { outline: 2px solid #ffb3b1; outline-offset: 2px; }

/* ── Quick Start button (in the header) ────────────────────────────────── */
.quickstart-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  box-shadow: 0 0 0 0 rgba(130, 195, 65, 0.5);
  animation: qs-pulse 2.6s ease-in-out infinite;
}
.quickstart-btn::before { content: "🐢"; font-size: 16px; }
@keyframes qs-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(130, 195, 65, 0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(130, 195, 65, 0); }
}
@media (prefers-reduced-motion: reduce) { .quickstart-btn { animation: none; } }

/* ── Quick Start wizard (modal) ────────────────────────────────────────── */
.qs-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  background: rgba(5, 8, 5, 0.72);
  backdrop-filter: blur(3px);
}
.qs-overlay[hidden] { display: none; }
.qs-modal {
  width: 100%;
  max-width: 560px;
  background: var(--panel-fill);
  border: 1px solid var(--border-hi);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: qs-rise 0.22s ease-out;
}
@keyframes qs-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.qs-head {
  position: relative;
  padding: 18px 20px 16px;
  background: linear-gradient(180deg, rgba(130, 195, 65, 0.10), transparent);
  border-bottom: 1px solid var(--border);
}
.qs-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2) 55%, var(--tan));
}
.qs-head h2 { margin: 0; font-size: 22px; }
.qs-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.qs-close {
  position: absolute; top: 14px; right: 14px;
  background: transparent; border: 1px solid var(--border-hi); color: var(--muted);
  width: 30px; height: 30px; padding: 0; border-radius: 8px; font-size: 16px; line-height: 1;
}
.qs-progress { padding: 14px 20px 4px; }
.qs-progress-bar { height: 8px; background: #0c110b; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.qs-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); border-radius: 999px; transition: width 0.35s ease; }
.qs-progress-label { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.qs-steps { list-style: none; margin: 0; padding: 10px 16px 18px; }
.qs-step {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px;
  background: #10140f;
}
.qs-step.done { border-color: rgba(130, 195, 65, 0.35); }
.qs-step-num {
  flex: 0 0 auto; width: 26px; height: 30px; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 14px; font-weight: 700; color: #08120a;
  background: linear-gradient(160deg, var(--accent-hi), var(--accent));
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}
.qs-step.todo .qs-step-num { background: #1c231a; color: var(--muted); }
.qs-step-body { flex: 1 1 auto; min-width: 0; }
.qs-step-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.qs-step-title .qs-tick { color: var(--accent-hi); }
.qs-step-why { color: var(--muted); font-size: 13px; margin: 3px 0 8px; }
.qs-step-go { font-size: 13px; padding: 6px 12px; }
.qs-step.done .qs-step-go { background: transparent; color: var(--muted); border: 1px solid var(--border-hi); }
.qs-optional { font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--tan); border: 1px solid rgba(243, 160, 44, 0.4); border-radius: 999px; padding: 1px 6px; }
.qs-foot { padding: 0 20px 18px; }
.qs-done-msg { text-align: center; color: var(--accent-hi); font-weight: 700; padding: 6px 0 2px; }
#qs-start-tour { margin-top: 12px; font-family: var(--font-display); letter-spacing: 0.3px; }

/* ── Guided tour — Raidshell-style spotlight coach mark ─────────────────── */
/* The spot dims the whole page and lights the target section. It's
   pointer-events:none with NO blocking overlay, so the section stays clickable
   (Song Bot's tour is interactive setup, not a read-only feature tour). */
.qs-spot {
  position: fixed;
  z-index: 88;
  border: 2px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(5, 7, 5, 0.74), 0 0 18px rgba(163, 201, 74, 0.5);
  pointer-events: none;
  transition: all 0.22s ease;
}
#qs-tour {
  position: fixed;
  z-index: 90;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: rgba(12, 15, 11, 0.98);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
  font-size: 13px;
  animation: qs-rise 0.18s ease-out;
}
.qs-tour-dots { display: flex; gap: 5px; margin-bottom: 10px; }
.qs-tour-dot {
  width: 20px;
  height: 7px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border-hi);
  background: #10140f;
  cursor: pointer;
}
.qs-tour-dot:hover { border-color: var(--accent); filter: none; }
.qs-tour-dot.done { background: var(--accent); border-color: transparent; }
.qs-tour-dot.current { outline: 2px solid var(--accent-hi); outline-offset: 1px; }
.qs-tour-title {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent);
}
.qs-tour-title .qs-tick { color: var(--accent-hi); }
.qs-tour-why { color: var(--fg); margin: 0 0 10px; font-size: 12.5px; line-height: 1.55; }
.qs-tour-status { font-size: 11px; margin: 0 0 12px; letter-spacing: 0.4px; }
.qs-tour-status.ok { color: var(--accent-hi); font-weight: 700; }
.qs-tour-status.todo { color: #e0b341; }
.qs-tour-btns { display: flex; gap: 8px; align-items: center; }
#qs-tour .qs-tour-btns button {
  padding: 5px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg);
  background: var(--panel-fill);
  border: 1px solid var(--border-hi);
  border-radius: 3px;
}
#qs-tour .qs-tour-btns .qs-tour-skip { color: var(--muted); border-color: transparent; }
#qs-tour .qs-tour-btns .qs-tour-count { font-size: 10px; color: var(--muted); letter-spacing: 0; }
#qs-tour .qs-tour-btns .qs-tour-next {
  margin-left: auto;
  color: #14170f;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}

#search-form { display: flex; gap: 8px; }
#search-form input { flex: 1; }

#manual-queue-form .row input { flex: 1; }

#search-results {
  margin: 12px 0 0;
  padding-left: 20px;
}
#search-results li { margin-bottom: 6px; font-size: 14px; }
#search-results .artist { color: var(--muted); }
#search-results .track-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

#device-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
#device-list li.device {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  background: #0e0e0e;
}
#device-list li.device.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
#device-list li.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0 0;
  list-style: none;
}
.device-info { min-width: 0; }
.device-name { font-weight: 600; font-size: 14px; }
.device-meta { color: var(--muted); font-size: 12px; margin-top: 2px; word-break: break-all; }

.badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
  font-weight: 700;
}
.badge.active { background: var(--accent); color: #000; }
.badge.warn   { background: #3a2f10; color: #e0b341; }

#last-queued { font-size: 13px; margin: 4px 0 12px; }
.muted { color: var(--muted); }
.hint  { color: var(--muted); font-size: 13px; margin: 0 0 8px; }

#log {
  margin: 0;
  background: #0a0a0a;
  border-radius: 6px;
  padding: 12px;
  font-size: 12px;
  color: #cfcfcf;
  white-space: pre-wrap;
  max-height: 240px;
  overflow: auto;
}

code {
  background: #0a0a0a;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

#auth-status.ok, #active-device-label.ok, #twitch-status.ok, #twitch-auth-status.ok, #obs-status.ok { color: var(--accent); }
#auth-status.warn, #active-device-label.warn, #twitch-status.warn, #twitch-auth-status.warn, #obs-status.warn { color: #e0b341; }
#auth-status.err, #obs-status.err { color: var(--danger); }

/* ── Twitch identity (follower check) panel ─────────────────────────────── */
.twitch-identity {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.twitch-identity h3 { font-size: 14px; margin: 0 0 4px; }
#twitch-config-row { margin-bottom: 8px; }
#twitch-config-row .row input { flex: 1; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--fg);
  font-size: 14px;
}
.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.checkbox-row input[type="checkbox"]:disabled + span { color: var(--muted); }
#follower-only-hint { margin-top: 4px; }

/* ── Requests & limits panel ───────────────────────────────────────────── */
.limits-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: 13px;
}
.limits-table th, .limits-table td {
  text-align: left;
  padding: 5px 6px;
  border-bottom: 1px solid var(--border);
}
.limits-table th { color: var(--muted); font-weight: 600; }
.limits-table td:first-child { text-transform: capitalize; }
.limits-table input[type="number"] {
  width: 72px;
  padding: 4px 6px;
  background: #0e0e0e;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.stats-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.stats-block h3 { font-size: 14px; margin: 0 0 4px; }
#stats-lists { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 8px; }
.stats-col h4 {
  font-size: 11px;
  margin: 6px 0 4px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.stats-col ol { margin: 0; padding-left: 18px; font-size: 13px; }
.stats-col li { margin-bottom: 2px; }

/* ── Overlay theme panel ───────────────────────────────────────────────── */
.theme-preset-label { margin: 0; }
#theme-preset {
  background: #0e0e0e;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
}
.theme-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 18px;
  margin: 12px 0;
}
.theme-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  min-width: 0;
}
.theme-row label {
  margin: 0;
  color: var(--muted);
  flex: 0 0 auto;
  min-width: 96px;
}
.theme-row input[type="color"] {
  width: 46px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0e0e0e;
  cursor: pointer;
}
.theme-row input[type="range"] { flex: 1 1 auto; accent-color: var(--accent); min-width: 70px; }
.theme-row select {
  flex: 1 1 auto;
  background: #0e0e0e;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 13px;
}
.theme-val {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
}
.theme-row .theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--fg);
  min-width: 0;
}
.theme-row .theme-toggle input { accent-color: var(--accent); width: 15px; height: 15px; }
@media (max-width: 560px) { .theme-controls { grid-template-columns: 1fr; } }

/* ── Channel Points + sync ─────────────────────────────────────────────── */
.cp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  margin-bottom: 6px;
}
#cp-add-form { margin-top: 8px; }
#cp-add-form .row input { flex: 1; }
#cp-reward-action, #sync-key-input {
  background: #0e0e0e;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 14px;
}
#sync-section .row input { flex: 1; }

/* ── Now-playing quick-ban panel ───────────────────────────────────────── */
.now-playing-wrap {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.now-playing-wrap h3 { font-size: 14px; margin: 0 0 4px; }
.now-playing-track {
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 14px;
}
.now-playing-track .artist { color: var(--muted); }
.np-actions { margin-top: 8px; }
.np-actions .ban-track-btn {
  background: var(--danger);
  color: #fff;
}
.np-actions .ban-track-btn:disabled {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ── Ban-list management ───────────────────────────────────────────────── */
#ban-section h3 { font-size: 14px; margin: 12px 0 4px; }
#ban-section .ban-block + .ban-block { margin-top: 8px; }
#ban-track-list, #ban-artist-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}
#ban-track-list li, #ban-artist-list li {
  margin-bottom: 6px;
}
#ban-track-list li.empty, #ban-artist-list li.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 4px 0;
}
.ban-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
}
.ban-row .artist { color: var(--muted); }
.ban-row .ban-uri {
  display: inline-block;
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
}

/* ── OBS auto-pause panel ──────────────────────────────────────────────── */
#obs-config-row { margin-bottom: 8px; }
#obs-config-row input[type="text"],
#obs-config-row input[type="password"] {
  width: 100%;
  padding: 8px 10px;
  background: #0e0e0e;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  margin-top: 4px;
}
#obs-current-scene { font-size: 13px; margin: 8px 0 0; }
.obs-block { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.obs-block h3 { font-size: 14px; margin: 0 0 4px; }
#obs-scene-list, #obs-source-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}
#obs-scene-list li, #obs-source-list li {
  margin-bottom: 6px;
}
#obs-scene-list li.empty, #obs-source-list li.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 4px 0;
}
.obs-row {
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
}
.obs-row.current { border-color: var(--accent); }
.obs-row .checkbox-row { margin-top: 0; }

/* ── Now-playing overlay panel ─────────────────────────────────────────── */
#overlay-section .overlay-row {
  align-items: center;
  margin-top: 8px;
}
#overlay-url {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 10px;
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Embedded OBS preview. The iframe loads overlay.html, which is transparent —
   we paint a dark backdrop so the translucent card has contrast like it will
   over a real OBS scene. Sized roughly to match the card's natural dimensions. */
.overlay-preview-wrap {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  width: 100%;
}
.overlay-preview-wrap .hint { margin-bottom: 6px; }
#overlay-preview {
  width: 100%;
  max-width: 100%;
  margin: 0;
  height: 160px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background:
    /* faint checkerboard so transparent areas are visible */
    linear-gradient(45deg, #1a1a1a 25%, transparent 25%, transparent 75%, #1a1a1a 75%) 0 0 / 16px 16px,
    linear-gradient(45deg, #1a1a1a 25%, transparent 25%, transparent 75%, #1a1a1a 75%) 8px 8px / 16px 16px,
    #0e0e0e;
  display: block;
}

/* ── Up next (queue) list ──────────────────────────────────────────────── */
.queue-wrap {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.queue-wrap h3 { font-size: 14px; margin: 0 0 4px; }
#upcoming-queue { margin: 6px 0 0; padding-left: 22px; }
#upcoming-queue li { margin-bottom: 5px; font-size: 14px; }
#upcoming-queue li::marker { color: var(--accent); font-weight: 700; }
#upcoming-queue .artist { color: var(--muted); }
#upcoming-queue li.empty { color: var(--muted); font-size: 13px; list-style: none; margin-left: -22px; }

/* ── Volume slider ─────────────────────────────────────────────────────── */
.volume-row { margin: 4px 0 12px; }
.volume-label {
  margin: 0;
  color: var(--fg);
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#volume-slider {
  flex: 1 1 auto;
  min-width: 160px;
  accent-color: var(--accent);
}
#volume-slider:disabled { opacity: 0.4; }

/* ── Now-playing card (live) ───────────────────────────────────────────── */
.now-playing-card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 6px;
}
.np-art {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
  flex: 0 0 auto;
  background: #1a1a1a;
}
.np-art-empty { background: #1a1a1a; }
.np-meta { min-width: 0; flex: 1 1 auto; }
.np-title {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.np-artist {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Search-to-ban results ─────────────────────────────────────────────── */
#ban-search-form { margin-top: 4px; }
#ban-search-form .row input { flex: 1; }
#ban-search-results {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
#ban-search-results li { margin-bottom: 6px; }
#ban-search-results li.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 4px 0;
}
#ban-search-results .ban-add-track-btn,
#ban-search-results .ban-add-artist-btn {
  background: var(--danger);
  color: #fff;
}
#ban-search-results .ban-add-track-btn:disabled,
#ban-search-results .ban-add-artist-btn:disabled {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ── Collapsible / hideable sections (see sections.js) ─────────────────────
   sections.js wraps each <section>'s <h2> in a .bt-head row with a caret and a
   Hide button. We style that row and the two state classes it toggles:
   .bt-collapsed (fold the body away) and .bt-user-hidden (remove entirely). */
.bt-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.bt-head h2 { margin: 0; flex: 1 1 auto; min-width: 0; }

/* Connection-status flag in the header — set live by sections.js from the
   section's status element (.ok / .warn / .err). Visible even when collapsed. */
.bt-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
  white-space: nowrap;
}
.bt-status .bt-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.bt-status.ok   { color: var(--accent); }
.bt-status.ok   .bt-dot { background: var(--accent); }
.bt-status.warn { color: #e0b341; }
.bt-status.warn .bt-dot { background: #e0b341; }
.bt-status.err  { color: var(--danger); }
.bt-status.err  .bt-dot { background: var(--danger); }

.bt-caret {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
}
.bt-caret:hover { color: var(--fg); filter: none; }
/* Caret points right when collapsed, down when expanded. */
section:not(.bt-collapsed) > .bt-head > .bt-caret { transform: rotate(90deg); }

.bt-hide {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.bt-hide:hover { color: var(--fg); filter: none; }

/* Collapsed: keep only the header row, hide the rest of the section body. */
section.bt-collapsed > *:not(.bt-head) { display: none !important; }

/* Hidden by the user. A class — NOT the [hidden] attribute — so it doesn't
   collide with app.js toggling `hidden` on some sections from app state. */
section.bt-user-hidden { display: none !important; }

/* Toolbar under the page title: Expand all / Collapse all + restore chips. */
/* Command bar — sticky so live status + big reconnect are always in view. */
#bt-section-bar {
  position: sticky;
  top: 8px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 12px;
  background: var(--panel-fill);
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
#bt-section-bar .bt-bar-label { color: var(--muted); }
#bt-section-bar .bt-bar-spacer { flex: 1 1 auto; }
#bt-section-bar .bt-tools-row button { font-size: 12px; padding: 5px 10px; }
.bt-health-row, .bt-tools-row, .bt-tab-row, .bt-np-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.bt-health-row:empty { display: none; }

/* Sections filtered out by the active tab. */
section.bt-tab-hidden { display: none !important; }

/* Tab buttons */
.bt-tab-row { gap: 6px; }
#bt-section-bar .bt-tab-row .bt-tab-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 16px;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
#bt-section-bar .bt-tab-row .bt-tab-btn:hover { color: var(--fg); border-color: var(--border-hi); filter: none; }
#bt-section-bar .bt-tab-row .bt-tab-btn.active {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  color: #08120a;
  border-color: transparent;
}

/* Now-playing strip */
.bt-np-row { font-size: 13px; min-height: 20px; }
.bt-np-icon { flex: 0 0 auto; }
#bt-np-text { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
#bt-np-text.muted { font-weight: 400; }
.bt-np-lastsr {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 38%;
}

/* Connection chips: dot + name, click to jump to that section. */
.bt-health-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #10140f;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}
.bt-health-chip:hover { filter: none; border-color: var(--border-hi); }
.bt-health-chip .bt-dot { width: 9px; height: 9px; border-radius: 50%; }
.bt-health-chip.ok   .bt-dot { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.bt-health-chip.warn { border-color: rgba(224, 179, 65, 0.5); }
.bt-health-chip.warn .bt-dot { background: #e0b341; box-shadow: 0 0 6px #e0b341; }
.bt-health-chip.err  { border-color: rgba(224, 100, 95, 0.6); }
.bt-health-chip.err  .bt-dot { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

.bt-all-ok { color: var(--accent-hi); font-weight: 700; font-size: 12px; }

/* THE big reconnect button. Unmissable when something is down. */
#bt-section-bar .bt-health-row .bt-reconnect-big {
  flex: 1 1 auto;
  min-width: 180px;
  padding: 12px 20px;
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.6px;
  border-radius: 10px;
  text-align: center;
}
.bt-reconnect-big.idle {
  background: linear-gradient(180deg, #e8b64a, #d99b26);
  color: #170f02;
  animation: qs-pulse 1.6s ease-in-out infinite;
}
.bt-reconnect-big.connecting {
  background: #2a2410;
  color: #e0b341;
  border: 1px solid rgba(224, 179, 65, 0.6);
  animation: bt-connecting 1s ease-in-out infinite;
}
.bt-reconnect-big.connected {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  color: #08120a;
}
.bt-reconnect-big:disabled { opacity: 1; cursor: default; }
@keyframes bt-connecting {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .bt-reconnect-big.idle, .bt-reconnect-big.connecting { animation: none; }
}
.bt-restore-chip {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}
.bt-restore-chip::before { content: "＋ "; color: var(--accent); }
/* A trailing dot warns that a hidden section is still disconnected / erroring. */
.bt-restore-chip.status-warn::after,
.bt-restore-chip.status-err::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
}
.bt-restore-chip.status-warn::after { background: #e0b341; }
.bt-restore-chip.status-err::after  { background: var(--danger); }

/* ── Connect-setup walkthroughs (Spotify / Twitch API apps) ─────────────── */
.redirect-callout {
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 10px 0;
}
.redirect-callout p { margin: 0 0 6px; font-size: 13px; }
/* The redirect URI can be long — let it wrap instead of overflowing the panel. */
#redirect-display, #twitch-redirect-display {
  word-break: break-all;
  flex: 1 1 auto;
}
.setup-steps {
  margin: 10px 0 14px;
  padding-left: 22px;
  font-size: 13px;
  line-height: 1.7;
}
.setup-steps li { margin: 2px 0; }
.setup-steps a { color: var(--accent); }
