/* ==========================================================================
   Jukely — player stylesheet
   Built on the Jukely design system: near-black canvas, deep navy surfaces,
   electric-cyan brand, restrained violet accent, generous spacing.

   Accent colours (--accent / --accent2 / --accent3) are driven at runtime by
   app.js (theme presets, custom pickers, or auto-extracted from artwork), so
   everything branded is expressed through those vars rather than hard-coded.
   ========================================================================== */

:root {
  /* Surfaces */
  --bg-primary: #010206;
  --bg-secondary: #07111D;
  --bg-tertiary: #0C1A29;
  --bg-elevated: #101D2B;
  --bg-hover: #142333;

  /* Text */
  --text-primary: #F4F6F8;
  --text-secondary: #B5BBC4;
  --text-muted: #9299A5;
  --text-disabled: #59616D;

  /* Borders */
  --border-default: #182331;
  --border-hover: #26384A;

  /* Semantic */
  --success: #32D583;
  --warning: #FDB022;
  --danger: #F04438;
  --live: #FF4D6D;

  /* Brand accents — overwritten by app.js theming */
  --accent: #1FE2F8;
  --accent-rgb: 31, 226, 248;
  --accent2: #665CFF;
  --accent2-rgb: 102, 92, 255;
  --accent3: #65F1F8;
  --accent3-rgb: 101, 241, 248;

  /* Panel opacity: 0 = see the artwork background through panels, .9 = solid */
  --surface-dark: 0;

  /* ---- Glass recipe ----------------------------------------------------
     Every raised surface is built from the same three layers so the whole UI
     reads as one material: a soft top-lit sheen, a wash of the current accent
     (which follows the artwork), and a translucent base that --surface-dark
     can push toward solid. Backdrop blur does the rest. */
  --glass-sheen: linear-gradient(157deg, rgba(255, 255, 255, .07) 0%, rgba(255, 255, 255, .022) 38%, rgba(255, 255, 255, 0) 72%);
  --glass-tint: linear-gradient(157deg, rgba(var(--accent-rgb), .10) 0%, rgba(var(--accent2-rgb), .05) 55%, rgba(var(--accent2-rgb), .02) 100%);
  --glass-base: rgba(7, 17, 29, calc(.34 + var(--surface-dark) * .62));
  --glass: var(--glass-sheen), var(--glass-tint), linear-gradient(var(--glass-base), var(--glass-base));
  --glass-edge: 1px solid rgba(255, 255, 255, .075);
  --glass-blur: saturate(150%) blur(26px);
  /* Hairline of light along the top edge — what sells it as glass rather than a flat panel. */
  --glass-lip: inset 0 1px 0 rgba(255, 255, 255, .10);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-pill: 999px;

  /* Elevation */
  --shadow-card: 0 8px 30px rgba(0, 0, 0, .30);
  --shadow-elevated: 0 18px 60px rgba(0, 0, 0, .42);
  --shadow-brand: 0 0 24px rgba(var(--accent-rgb), .12);

  /* Motion */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-micro: 140ms;
  --t-ui: 200ms;

  /* Chrome sizes */
  --sidebar-w: 264px;
  --player-h: 92px;

  /* Beat pulse (0..1), set on .art-wrap by app.js each frame */
  --beat: 0;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

/* app.js drives visibility with the `hidden` attribute on elements this sheet
   also gives a display value to. An id/class rule outranks the UA's
   [hidden]{display:none}, so pin it down once here rather than repeating
   `[hidden]` guards on every component. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; }
ul { list-style: none; margin: 0; padding: 0; }
svg { width: 1em; height: 1em; display: block; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: var(--radius-pill); border: 2px solid var(--bg-secondary); }
::-webkit-scrollbar-thumb:hover { background: #33485f; }
* { scrollbar-color: var(--border-hover) var(--bg-secondary); scrollbar-width: thin; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Reactive background ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg-primary); }

.bg-art {
  position: absolute; inset: -8%;
  background-size: cover; background-position: center;
  filter: blur(64px) saturate(1.25) brightness(.5);
  opacity: 0; transition: opacity 900ms var(--ease);
  transform: scale(1.08);
}
.bg-art.show { opacity: .5; }

.bg-scrim {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(var(--accent-rgb), .10), transparent 60%),
    linear-gradient(180deg, rgba(1, 2, 6, .58) 0%, rgba(1, 2, 6, .82) 55%, var(--bg-primary) 100%);
}

.bgfx { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .34; }
body.light-mode .bgfx { display: none; }
body.light-mode .bg-art { filter: blur(70px) brightness(.34); opacity: .3; }

/* ==========================================================================
   Spot-key gate — split screen: editorial artwork panel + sign-in panel
   ========================================================================== */
.gate {
  position: relative; z-index: 2;
  min-height: 100vh; min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
}

/* ---------- Artwork half ---------- */
.gate-art {
  position: relative;
  overflow: hidden;
  background-image: url("/login-bg.jpg");
  background-size: cover;
  /* Keep the subject in frame as the panel narrows. */
  background-position: 36% 26%;
}
/* Two scrims: one grounds the copy, one melts the seam into the form panel. */
.gate-art::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(1, 2, 6, .62) 0%, rgba(1, 2, 6, .12) 34%, rgba(1, 2, 6, .88) 100%),
    linear-gradient(90deg, rgba(1, 2, 6, .30) 0%, transparent 42%, rgba(1, 2, 6, .55) 100%);
}
/* A restrained brand wash so the photo belongs to Jukely. */
.gate-art::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(150deg, rgba(var(--accent-rgb), .16), transparent 46%, rgba(var(--accent2-rgb), .22));
  mix-blend-mode: soft-light;
}

.gate-art-copy {
  position: relative; z-index: 1;
  height: 100%;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(28px, 4vw, 56px);
}

.gate-brand {
  display: flex; align-items: center; gap: 12px;
  font-size: clamp(22px, 2vw, 27px);
}
.gate-brand .logo-ic { width: 1.35em; height: 1.35em; flex: none; }

.gate-hero { max-width: 34ch; }
.gate-hero h1 {
  margin: 0 0 16px;
  max-width: 15ch;
  font-size: clamp(30px, 3.3vw, 46px);
  font-weight: 700; line-height: 1.08; letter-spacing: -.03em;
  text-shadow: 0 2px 30px rgba(0, 0, 0, .55);
}
.gate-hero p {
  margin: 0 0 26px;
  font-size: clamp(14.5px, 1.15vw, 16.5px);
  line-height: 1.6; color: rgba(244, 246, 248, .78);
  max-width: 42ch;
}
.gate-points { display: grid; gap: 11px; }
.gate-points li {
  display: flex; align-items: center; gap: 11px;
  font-size: 14px; color: rgba(244, 246, 248, .72);
}
.gate-points svg {
  width: 17px; height: 17px; flex: none;
  color: var(--accent);
}

/* ---------- Sign-in half ---------- */
.gate-panel {
  display: grid; place-items: center;
  padding: clamp(24px, 4vw, 48px);
  background: var(--bg-primary);
  position: relative;
}
/* Faint aura so the flat panel isn't dead next to the photograph. */
.gate-panel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(70% 44% at 50% 0%, rgba(var(--accent-rgb), .10), transparent 62%),
    radial-gradient(60% 40% at 50% 100%, rgba(var(--accent2-rgb), .10), transparent 60%);
}

.gate-card {
  position: relative; z-index: 1;
  width: min(400px, 100%);
}

.gate-brand-sm { display: none; margin-bottom: 26px; font-size: 24px; }

.gate-title {
  margin: 0 0 8px;
  font-size: 33px; font-weight: 700; letter-spacing: -.025em;
}
.tagline { color: var(--text-muted); font-size: 15px; margin: 0 0 30px; line-height: 1.55; }

#pin-form { display: grid; gap: 12px; }

#pin-input {
  width: 100%; padding: 17px 16px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-align: center; font-size: 23px; font-weight: 600;
  letter-spacing: .38em; text-indent: .38em; text-transform: uppercase;
  transition: border-color var(--t-ui) var(--ease), box-shadow var(--t-ui) var(--ease), background var(--t-ui) var(--ease);
}
#pin-input::placeholder { color: var(--text-disabled); letter-spacing: .3em; font-weight: 500; font-size: 16px; }
#pin-input:focus {
  outline: none; border-color: var(--accent);
  background: rgba(255, 255, 255, .055);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .12);
}

#pin-btn, .resume-btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 16px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #010206; font-weight: 600; font-size: 15.5px;
  box-shadow: 0 8px 26px rgba(var(--accent-rgb), .18);
  transition: filter var(--t-micro) var(--ease), transform var(--t-micro) var(--ease), box-shadow var(--t-micro) var(--ease);
}
#pin-btn:hover, .resume-btn:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 12px 32px rgba(var(--accent-rgb), .28); }
#pin-btn:disabled { opacity: .55; cursor: default; transform: none; }
.resume-btn { width: 100%; }
.btn-ic { width: 17px; height: 17px; }

.error { color: var(--danger); font-size: 14px; margin: 14px 0 0; text-align: center; }

.gate-hint {
  margin-top: 18px; text-align: center;
  font-size: 12.5px; color: var(--text-disabled); line-height: 1.5;
}

.gate-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 34px; padding-top: 22px;
  border-top: 1px solid var(--border-default);
}
.dl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 10px 16px; border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .045); color: var(--text-secondary);
  border: 1px solid var(--border-hover); font-size: 13.5px; font-weight: 500;
  transition: background var(--t-ui) var(--ease), border-color var(--t-ui) var(--ease), color var(--t-ui) var(--ease), transform var(--t-ui) var(--ease);
}
.dl-btn:hover { background: rgba(255, 255, 255, .08); border-color: var(--accent); color: var(--text-primary); transform: translateY(-1px); }
.dl-ic { width: 16px; height: 16px; }

/* ---------- Download picker (Windows/Linux, x64 + arm64) ---------- */
.gate-dl, .footer-dl { display: grid; gap: 8px; }
.dl-ic { flex: none; }

/* Promoted build for the visitor's own platform. */
.dl-primary { border-color: var(--accent); color: var(--text-primary); }
.dl-arch {
  margin-left: auto; padding-left: 10px;
  color: var(--text-muted); font-size: 12px; font-weight: 400;
}

.dl-more { position: relative; }
.dl-more > summary { list-style: none; cursor: pointer; width: 100%; }
.dl-more > summary::-webkit-details-marker { display: none; }
.dl-more[open] > summary { border-color: var(--accent); color: var(--text-primary); }

/* Floats above the layout so the gate and sidebar don't reflow when opened. */
.dl-menu {
  /* Default downward; downloads.js flips to .up and sets max-height to fit. */
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 40;
  display: grid; gap: 2px; padding: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover); border-radius: var(--radius-md);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
  max-height: 62vh; overflow-y: auto;
}
.dl-group {
  padding: 8px 8px 4px; color: var(--text-muted);
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.dl-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--text-secondary); font-size: 13.5px;
  transition: background var(--t-ui) var(--ease), color var(--t-ui) var(--ease);
}
.dl-item:hover { background: rgba(255, 255, 255, .07); color: var(--text-primary); }
.dl-item-t { font-weight: 500; }
.dl-item-n { margin-left: auto; padding-left: 12px; color: var(--text-muted); font-size: 12px; }

.dl-menu.up { top: auto; bottom: calc(100% + 8px); }

body.no-downloads .gate-dl, body.no-downloads .footer-dl { display: none; }

.gate-admin {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--text-muted); font-size: 13.5px;
  transition: color var(--t-ui) var(--ease);
}
.gate-admin:hover { color: var(--accent); }

/* ---------- Narrow: artwork becomes the backdrop ---------- */
@media (max-width: 900px) {
  .gate { grid-template-columns: 1fr; }
  .gate-art { position: fixed; inset: 0; background-position: 42% center; }
  .gate-art::before {
    background: linear-gradient(180deg, rgba(1, 2, 6, .74) 0%, rgba(1, 2, 6, .86) 55%, rgba(1, 2, 6, .95) 100%);
  }
  .gate-art-copy { display: none; }
  .gate-panel { background: none; }
  .gate-panel::before { display: none; }
  .gate-brand-sm { display: flex; justify-content: center; }
  /* On the photo the card needs its own body to stay legible. */
  .gate-card {
    padding: 32px 26px 26px;
    background: rgba(7, 17, 29, .72);
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-edge);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-elevated), var(--glass-lip);
    text-align: center;
  }
  .gate-title { font-size: 27px; }
  .gate-foot { flex-direction: column; }
  .dl-btn { width: 100%; }
}
/* ==========================================================================
   App shell — sidebar · content · persistent player
   ========================================================================== */
.jk-app {
  position: relative; z-index: 1;
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr var(--player-h);
  grid-template-areas: "side content" "player player";
}
.jk-app[hidden] { display: none; }

/* ---------- Sidebar ---------- */
.jk-sidebar {
  grid-area: side;
  display: flex; flex-direction: column;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid rgba(255, 255, 255, .06);
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, .3);
  padding: 22px 14px 14px;
  overflow-y: auto;
}

.jk-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 0 10px 22px;
  font-size: 23px;
}
.jk-brand .brand-ic { width: 34px; height: 34px; }

.jk-navlabel {
  padding: 16px 12px 7px;
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-disabled);
}

.jk-nav { display: flex; flex-direction: column; gap: 2px; }

.jk-navitem {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 15px; font-weight: 500;
  text-align: left; width: 100%;
  border-left: 3px solid transparent;
  transition: background var(--t-ui) var(--ease), color var(--t-ui) var(--ease);
}
.jk-navitem svg { width: 20px; height: 20px; flex: none; color: var(--text-muted); transition: color var(--t-ui) var(--ease); }
.jk-navitem:hover { background: rgba(255, 255, 255, .04); color: var(--text-primary); }
.jk-navitem:hover svg { color: var(--text-secondary); }
.jk-navitem.active {
  background: rgba(var(--accent-rgb), .09);
  color: var(--text-primary);
  border-left-color: var(--accent);
}
.jk-navitem.active svg { color: var(--accent); }
.jk-navcount {
  margin-left: auto;
  min-width: 22px; padding: 1px 7px;
  background: rgba(255, 255, 255, .06);
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; text-align: center; color: var(--text-muted);
}
.jk-navitem.active .jk-navcount { background: rgba(var(--accent-rgb), .16); color: var(--accent3); }

.jk-side-foot { margin-top: auto; padding-top: 18px; display: grid; gap: 8px; }
.jk-side-foot .dl-btn { width: 100%; }

.jk-credit {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 4px 2px; color: var(--text-disabled); font-size: 12px;
}
.footer-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; }

/* ---------- Content column ---------- */
.jk-content {
  grid-area: content;
  display: flex; flex-direction: column;
  min-width: 0; overflow: hidden;
}

.jk-topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  background: var(--glass-sheen), linear-gradient(rgba(3, 8, 15, .42), rgba(3, 8, 15, .42));
  backdrop-filter: saturate(140%) blur(20px);
  -webkit-backdrop-filter: saturate(140%) blur(20px);
  flex: none;
  -webkit-app-region: drag;
}
.jk-topbar button, .jk-topbar input, .jk-topbar a { -webkit-app-region: no-drag; }

.jk-viewtitle { font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin-right: auto; }

.spot-label {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px; border-radius: var(--radius-pill);
  background: rgba(var(--accent-rgb), .10);
  border: 1px solid rgba(var(--accent-rgb), .28);
  color: var(--accent3); font-size: 13px; font-weight: 600;
}

.conn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border-default);
  color: var(--text-muted); font-size: 12px; font-weight: 600;
}
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-disabled); flex: none; }
.conn.ok { color: var(--success); border-color: rgba(50, 213, 131, .3); }
.conn.ok .conn-dot { background: var(--success); box-shadow: 0 0 8px rgba(50, 213, 131, .8); }

.gear, .icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: var(--radius-md);
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: background var(--t-ui) var(--ease), color var(--t-ui) var(--ease), border-color var(--t-ui) var(--ease);
}
.gear svg, .icon-btn svg { width: 19px; height: 19px; }
.gear:hover, .icon-btn:hover { background: rgba(255, 255, 255, .05); color: var(--text-primary); border-color: var(--border-hover); }

/* Electron window controls */
.winctl { display: flex; gap: 2px; margin-left: 4px; }
.wc { width: 40px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--text-muted); transition: background var(--t-micro) var(--ease), color var(--t-micro) var(--ease); }
.wc svg { width: 15px; height: 15px; }
.wc:hover { background: rgba(255, 255, 255, .07); color: var(--text-primary); }
.wc-close:hover { background: var(--danger); color: #fff; }

.admin-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 28px;
  background: rgba(var(--accent2-rgb), .12);
  border-bottom: 1px solid rgba(var(--accent2-rgb), .25);
  font-size: 13px; color: var(--text-secondary); flex: none;
}
.admin-bar a { font-weight: 600; }
.admin-bar-l { color: var(--text-muted); }

/* ---------- Views ---------- */
.jk-views { flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.view { display: none; padding: 26px 28px 34px; max-width: 1440px; }
.view.active { display: block; animation: viewIn 260ms var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
body.light-mode .view.active { animation: none; }

.view-head {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 18px;
}
.view-head h2 { font-size: 24px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.view-head .count, .count {
  display: inline-block; min-width: 22px; padding: 1px 8px;
  background: rgba(255, 255, 255, .06); border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; color: var(--text-muted); text-align: center;
}
.view-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ==========================================================================
   Now Playing stage
   ========================================================================== */
.stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, 360px) 1fr;
  gap: 34px; align-items: center;
  padding: 30px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-edge);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-elevated), var(--glass-lip);
  overflow: hidden;
  min-height: 380px;
}

.viz { position: absolute; inset: auto 0 0 0; width: 100%; height: 46%; opacity: .38; pointer-events: none; }
body.light-mode .viz { display: none; }

.art-wrap {
  position: relative; z-index: 1;
  aspect-ratio: 1; width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-tertiary);
  box-shadow: var(--shadow-elevated);
}
/* Blurred, over-scaled copy of the artwork. Lets the real thumbnail sit in the
   frame at its true aspect ratio (YouTube art is 16:9) instead of being cropped
   to a square, without leaving dead letterbox bars. */
.art-blur {
  position: absolute; inset: -12%;
  background-size: cover; background-position: center;
  filter: blur(26px) saturate(1.55) brightness(.62);
  transform: scale(1.12);
  opacity: 0; transition: opacity 420ms var(--ease);
}
.art-ring {
  position: absolute; inset: -2px; border-radius: inherit; pointer-events: none; z-index: 3;
  border: 1px solid rgba(var(--accent-rgb), calc(.20 + var(--beat) * .5));
  box-shadow: 0 0 calc(14px + var(--beat) * 34px) rgba(var(--accent-rgb), calc(.10 + var(--beat) * .30));
  transition: border-color 90ms linear;
}
.art {
  position: relative; z-index: 2;
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, .5));
}
.art.empty { display: grid; place-items: center; background: var(--bg-tertiary); color: var(--text-disabled); }
.art-empty-ic { width: 38%; height: 38%; }
#art[hidden], #art-empty[hidden] { display: none; }

.now-meta { position: relative; z-index: 1; min-width: 0; }

.np-title {
  font-size: 36px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15;
  margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.np-sub { color: var(--text-muted); font-size: 16px; margin-bottom: 26px; }

.stage-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.stage-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: var(--radius-pill);
  /* Opaque enough to stay readable where the visualiser rises behind it. */
  background: rgba(7, 17, 29, .74);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-default);
  color: var(--text-secondary); font-size: 12.5px; font-weight: 500;
}
.stage-badge svg { width: 14px; height: 14px; color: var(--text-muted); }
.stage-badge.live { background: rgba(255, 77, 109, .1); border-color: rgba(255, 77, 109, .32); color: #ff8098; }
.stage-badge.live .ann-dot,
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: livePulse 2.6s var(--ease) infinite; }
@keyframes livePulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
body.light-mode .live-dot { animation: none; }


/* ==========================================================================
   Persistent player bar
   ========================================================================== */
.jk-player {
  grid-area: player;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(320px, 2.2fr) minmax(180px, 1fr);
  align-items: center; gap: 18px;
  padding: 0 22px;
  background:
    var(--glass-sheen),
    var(--glass-tint),
    linear-gradient(rgba(5, 12, 21, calc(.62 + var(--surface-dark) * .35)), rgba(5, 12, 21, calc(.62 + var(--surface-dark) * .35)));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid rgba(255, 255, 255, .075);
  box-shadow: var(--glass-lip), 0 -18px 50px rgba(0, 0, 0, .38);
  z-index: 5;
}

.pl-track { display: flex; align-items: center; gap: 13px; min-width: 0; }
.pl-art {
  width: 56px; height: 56px; flex: none;
  border-radius: var(--radius-md);
  object-fit: cover; background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
}
.pl-art-empty { display: grid; place-items: center; color: var(--text-disabled); }
.pl-art-empty svg { width: 24px; height: 24px; }
.pl-meta { min-width: 0; }
.pl-title { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sub { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-expand { display: none; }

.pl-center { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; width: 100%; }

.controls { display: flex; align-items: center; justify-content: center; gap: 8px; }

.ctl {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  color: var(--text-secondary);
  transition: background var(--t-micro) var(--ease), color var(--t-micro) var(--ease), transform var(--t-micro) var(--ease);
}
.ctl-ic { width: 19px; height: 19px; }
.ctl:hover { background: rgba(255, 255, 255, .07); color: var(--text-primary); transform: translateY(-1px); }
.ctl.active { color: var(--accent); background: rgba(var(--accent-rgb), .12); }

.ctl.skip, .ofl-play-btn {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #010206;
  box-shadow: var(--shadow-brand);
}
.ctl.skip .ctl-ic, .ofl-play-btn .ctl-ic { width: 21px; height: 21px; }
.ctl.skip:hover, .ofl-play-btn:hover { filter: brightness(1.09); transform: translateY(-1px); background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #010206; }

/* ---------- Progress ---------- */
.pl-progress { display: flex; align-items: center; gap: 11px; width: 100%; }
.times { display: flex; gap: 11px; font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pl-progress .times { gap: 0; }
#t-cur, #t-dur { min-width: 38px; }
#t-dur { text-align: right; }

.progress {
  position: relative; flex: 1;
  height: 5px; border-radius: var(--radius-pill);
  background: var(--border-hover);
  cursor: pointer; touch-action: none;
}
.progress::before { content: ""; position: absolute; inset: -8px 0; }
.bar {
  position: absolute; inset: 0 auto 0 0; width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 220ms linear;
}
.progress.scrubbing .bar { transition: none; }
.seek-handle {
  position: absolute; right: -6px; top: 50%;
  width: 12px; height: 12px; margin-top: -6px;
  border-radius: 50%; background: var(--text-primary);
  opacity: 0; transition: opacity var(--t-micro) var(--ease), box-shadow var(--t-micro) var(--ease);
}
.progress:hover .seek-handle, .progress.scrubbing .seek-handle { opacity: 1; box-shadow: 0 0 10px rgba(var(--accent-rgb), .6); }

/* ---------- Volume + right cluster ---------- */
.pl-right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

/* Matches the seek bar: same 5px rail, same accent→accent2 fill, same handle.
   Native ranges don't paint a filled portion, so the fill is a sized gradient
   layer driven by --vol, which jukely-shell.js keeps in sync. */
.vol {
  -webkit-appearance: none; appearance: none;
  width: 96px; height: 5px; border-radius: var(--radius-pill);
  cursor: pointer;
  background:
    linear-gradient(90deg, var(--accent), var(--accent2)) 0 0 / var(--vol, 100%) 100% no-repeat,
    var(--border-hover);
  transition: filter var(--t-ui) var(--ease), opacity var(--t-ui) var(--ease);
}
.vol::-webkit-slider-runnable-track { height: 5px; border-radius: var(--radius-pill); background: transparent; }
.vol::-moz-range-track { height: 5px; border-radius: var(--radius-pill); background: transparent; }
.vol::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; margin-top: -3.5px; border-radius: 50%;
  background: var(--text-primary); border: none;
  transition: box-shadow var(--t-micro) var(--ease), transform var(--t-micro) var(--ease);
}
.vol:hover::-webkit-slider-thumb { box-shadow: 0 0 10px rgba(var(--accent-rgb), .6); transform: scale(1.12); }
.vol::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--text-primary); border: none; }
.vol:hover::-moz-range-thumb { box-shadow: 0 0 10px rgba(var(--accent-rgb), .6); }
/* Muted (or at zero): the fill recedes so the control reads as inactive. */
.vol.is-muted { filter: grayscale(1); opacity: .55; }

/* ==========================================================================
   Mobile bottom navigation
   ========================================================================== */
.jk-mobilenav { display: none; }

/* ==========================================================================
   Equalizer
   ========================================================================== */
.eq {
  margin-top: 20px; padding: 22px 24px 20px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-edge);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card), var(--glass-lip);
}

/* ---- Presets ---- */
.eq-presets { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.eq-chip {
  padding: 7px 15px; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
  color: var(--text-muted); font-size: 12.5px; font-weight: 500;
  transition: all var(--t-ui) var(--ease);
}
.eq-chip:hover { background: rgba(255, 255, 255, .08); color: var(--text-primary); border-color: rgba(255, 255, 255, .14); }
.eq-chip.active {
  background: linear-gradient(135deg, rgba(var(--accent-rgb), .22), rgba(var(--accent2-rgb), .16));
  border-color: rgba(var(--accent-rgb), .45);
  color: var(--text-primary);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), .16);
}

/* ---- Response curve ----
   Classed by app.js so the filled area and the line are styled independently. */
.eq-curve {
  width: 100%; height: 92px;
  margin: 0 0 6px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(rgba(255, 255, 255, .018), rgba(255, 255, 255, .018)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .045) 0 1px, transparent 1px 10%);
  overflow: hidden;
}
.eq-curve .eq-zero { stroke: rgba(255, 255, 255, .1); stroke-width: 1; stroke-dasharray: 3 4; }
.eq-curve .eq-fill { fill: rgba(var(--accent-rgb), .16); stroke: none; }
.eq-curve .eq-line {
  fill: none;
  stroke: var(--accent); stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(var(--accent-rgb), .55));
}
.eq-curve .eq-dot {
  fill: var(--text-primary);
  stroke: rgba(1, 2, 6, .75); stroke-width: 1.5;
}

/* ---- Bands ---- */
.eq-bands {
  display: flex; gap: 6px; justify-content: space-between;
  padding-top: 6px;
}
.eq-band {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 10px 2px 8px; border-radius: var(--radius-md);
  transition: background var(--t-ui) var(--ease);
}
.eq-band:hover { background: rgba(255, 255, 255, .035); }

.eq-band input[type="range"] {
  -webkit-appearance: none; appearance: none;
  writing-mode: vertical-lr; direction: rtl;
  width: 22px; height: 116px;
  background: none; cursor: ns-resize;
}
/* Slot */
.eq-band input[type="range"]::-webkit-slider-runnable-track {
  width: 4px; height: 116px; border-radius: var(--radius-pill);
  background: linear-gradient(to top, rgba(255, 255, 255, .05), rgba(255, 255, 255, .12), rgba(255, 255, 255, .05));
}
.eq-band input[type="range"]::-moz-range-track {
  width: 4px; height: 116px; border-radius: var(--radius-pill);
  background: linear-gradient(to top, rgba(255, 255, 255, .05), rgba(255, 255, 255, .12), rgba(255, 255, 255, .05));
}
/* Handle — a small capsule, brand-gradient, lifted */
.eq-band input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 12px; border-radius: var(--radius-pill);
  margin-left: -8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: 1px solid rgba(255, 255, 255, .3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .55), 0 0 12px rgba(var(--accent-rgb), .35);
  transition: box-shadow var(--t-micro) var(--ease);
}
.eq-band input[type="range"]:hover::-webkit-slider-thumb,
.eq-band input[type="range"]:focus::-webkit-slider-thumb { box-shadow: 0 2px 10px rgba(0, 0, 0, .6), 0 0 20px rgba(var(--accent-rgb), .6); }
.eq-band input[type="range"]::-moz-range-thumb {
  width: 20px; height: 12px; border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: 1px solid rgba(255, 255, 255, .3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .55);
}

.eq-freq { font-size: 10.5px; font-weight: 500; color: var(--text-muted); letter-spacing: .02em; }
.eq-gain {
  font-size: 11px; font-weight: 600; color: var(--text-disabled);
  font-variant-numeric: tabular-nums;
  min-width: 30px; text-align: center;
  padding: 1px 0; border-radius: 5px;
  transition: color var(--t-ui) var(--ease), background var(--t-ui) var(--ease);
}
/* Any band that isn't flat reads as active. */
.eq-band:hover .eq-gain { color: var(--text-secondary); }
.eq-gain:not(:empty) { color: var(--text-muted); }

/* ==========================================================================
   Search + results
   ========================================================================== */
.add { margin-bottom: 4px; }
#add-form {
  position: relative; display: flex; align-items: center;
  background: linear-gradient(160deg, rgba(255,255,255,.045), rgba(255,255,255,.012)),
              rgba(7, 17, 29, calc(.30 + var(--surface-dark) * .62));
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-edge);
  box-shadow: var(--glass-lip);
  border-radius: 14px;
  transition: border-color var(--t-ui) var(--ease), box-shadow var(--t-ui) var(--ease);
}
#add-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .10); }
.add-ic { display: grid; place-items: center; padding-left: 16px; color: var(--text-muted); }
.add-ic svg { width: 19px; height: 19px; }
#add-input { flex: 1; padding: 15px 14px; background: none; border: none; outline: none; font-size: 15px; min-width: 0; }
#add-input::placeholder { color: var(--text-disabled); }
#add-btn {
  display: grid; place-items: center;
  width: 42px; height: 42px; margin-right: 6px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #010206; flex: none;
  transition: filter var(--t-micro) var(--ease), transform var(--t-micro) var(--ease);
}
#add-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.add-btn-ic { width: 19px; height: 19px; }

.add-msg { margin: 12px 0 0; font-size: 14px; color: var(--text-muted); }
.add-msg.err { color: var(--danger); }
.add-msg.ok { color: var(--success); }

.results-head {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 12px;
}
.results-title { font-size: 15px; font-weight: 600; }
.results-actions { margin-left: auto; display: flex; gap: 4px; }
.chev { width: 18px; height: 18px; transition: transform var(--t-ui) var(--ease); }
.results-head.collapsed .chev { transform: rotate(-90deg); }

.results { display: grid; gap: 8px; }
.results[hidden] { display: none; }

.result {
  display: flex; align-items: center; gap: 13px;
  padding: 10px; border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(255,255,255,.045), rgba(255,255,255,.012)),
              rgba(7, 17, 29, calc(.30 + var(--surface-dark) * .62));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.05);
  transition: background var(--t-ui) var(--ease), border-color var(--t-ui) var(--ease), transform var(--t-ui) var(--ease);
}
.result:hover { background: linear-gradient(160deg, rgba(255,255,255,.075), rgba(255,255,255,.02)),
              rgba(12, 26, 41, calc(.42 + var(--surface-dark) * .5)); border-color: rgba(var(--accent-rgb), .3); transform: translateY(-2px); }
.result img, .result-thumb {
  width: 62px; height: 46px; flex: none;
  border-radius: var(--radius-sm); object-fit: cover; background: var(--bg-tertiary);
}
.result-meta { flex: 1; min-width: 0; }
.result-title { font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-sub { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-add {
  flex: none; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: var(--radius-md);
  background: rgba(var(--accent-rgb), .12); color: var(--accent);
  transition: background var(--t-micro) var(--ease), transform var(--t-micro) var(--ease);
}
.result-add svg { width: 18px; height: 18px; }
.result-add:hover { background: var(--accent); color: #010206; transform: scale(1.06); }

/* ==========================================================================
   Queue
   ========================================================================== */
.queue-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.queue-bar[hidden] { display: none; }

.qtab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border-default);
  color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
  transition: all var(--t-ui) var(--ease);
}
.qtab:hover { border-color: var(--border-hover); color: var(--text-primary); }
.qtab.active { background: rgba(var(--accent-rgb), .10); border-color: rgba(var(--accent-rgb), .30); color: var(--accent3); }
.qtab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.qtab-count { font-size: 11.5px; color: var(--text-muted); }
.qtab.active .qtab-count { color: var(--accent3); }
.qtab-del { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--text-disabled); font-size: 15px; line-height: 1; }
.qtab-del:hover { background: rgba(240, 68, 56, .16); color: var(--danger); }
.qtab-new { border-style: dashed; color: var(--text-muted); }
.qtab-new:hover { border-color: var(--accent); color: var(--accent); }

.queue-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.queue-title { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 600; }
.qh-ic { width: 19px; height: 19px; color: var(--text-muted); }
.queue-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }

.qh-btn, .mini-btn, .clear-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 13px; border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  transition: all var(--t-ui) var(--ease);
}
.qh-btn { width: 36px; padding: 0; }
.qh-btn svg { width: 17px; height: 17px; }
.qh-btn:hover, .mini-btn:hover { background: var(--bg-hover); border-color: var(--border-hover); color: var(--text-primary); }
.clear-btn:hover { background: rgba(240, 68, 56, .14); border-color: rgba(240, 68, 56, .4); color: var(--danger); }
.clear-btn[hidden], .juke-btn[hidden], #btn-cast[hidden] { display: none; }

.juke-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 15px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #010206; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-brand);
  transition: filter var(--t-micro) var(--ease), transform var(--t-micro) var(--ease);
}
.juke-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.juke-ic { width: 15px; height: 15px; }
.juke-btn .count { background: rgba(1, 2, 6, .22); color: #010206; }

.list { display: grid; gap: 6px; }

.row {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .012)),
              rgba(7, 17, 29, calc(.30 + var(--surface-dark) * .62));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .045);
  transition: background var(--t-ui) var(--ease), border-color var(--t-ui) var(--ease), transform var(--t-ui) var(--ease);
}
.row:hover {
  background: linear-gradient(160deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02)),
              rgba(12, 26, 41, calc(.42 + var(--surface-dark) * .5));
  border-color: rgba(255, 255, 255, .10);
  transform: translateY(-1px);
}
/* The live track: accent wash + a lit rail down the leading edge. */
.row.current, .row.now {
  background: linear-gradient(160deg, rgba(var(--accent-rgb), .16), rgba(var(--accent2-rgb), .07)),
              rgba(7, 17, 29, calc(.34 + var(--surface-dark) * .58));
  border-color: rgba(var(--accent-rgb), .34);
  box-shadow: 0 0 22px rgba(var(--accent-rgb), .10), var(--glass-lip);
}
.row.current::before, .row.now::before {
  content: ""; position: absolute; left: 0; top: 10%; bottom: 10%;
  width: 3px; border-radius: var(--radius-pill);
  background: linear-gradient(var(--accent), var(--accent2));
  box-shadow: 0 0 10px rgba(var(--accent-rgb), .7);
}
.row.selected { border-color: rgba(var(--accent-rgb), .4); }
.row.ph { opacity: .4; }

.row-handle { color: var(--text-disabled); cursor: grab; flex: none; touch-action: none; }
.row-handle svg { width: 11px; height: 17px; }
.row-handle:active { cursor: grabbing; }

/* Custom checkbox: the native input stays for a11y/behaviour, .cb is the visual. */
.row-check { display: grid; place-items: center; flex: none; cursor: pointer; }
.row-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.cb {
  display: block; width: 17px; height: 17px;
  border: 1.5px solid var(--border-hover); border-radius: 5px;
  background: rgba(255, 255, 255, .03);
  transition: background var(--t-micro) var(--ease), border-color var(--t-micro) var(--ease);
}
.row-check:hover .cb { border-color: var(--accent); }
.row-check input:checked + .cb {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  background-image:
    linear-gradient(135deg, var(--accent), var(--accent2)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23010206' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-size: cover, 12px 12px;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

/* Artwork tile with a play affordance revealed on hover (style guide §13). */
.row-thumb {
  position: relative; flex: none;
  width: 46px; height: 46px;
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--bg-tertiary);
}
.row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row-play {
  position: absolute; inset: 0; width: auto; height: auto;
  display: grid; place-items: center; border-radius: 0;
  background: rgba(1, 2, 6, .6); color: var(--text-primary);
  opacity: 0; transition: opacity var(--t-micro) var(--ease);
}
.row-play svg { width: 15px; height: 15px; }
.row:hover .row-play, .row-play:focus-visible { opacity: 1; }
.row-play:hover { background: rgba(1, 2, 6, .72); color: var(--accent); }

/* Already-played entries stay legible but recede. */
.row.played .row-thumb, .row.played .row-meta { opacity: .5; }
.row.played:hover .row-thumb, .row.played:hover .row-meta { opacity: .8; }

/* Uploads with no artwork fall back to an icon tile. */
.lib-thumb.ph, svg.lib-thumb {
  display: grid; place-items: center; padding: 12px;
  color: var(--text-disabled); background: var(--bg-tertiary);
}
.row-meta { flex: 1; min-width: 0; }
.row-title { font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.current .row-title, .row.now .row-title { color: var(--accent3); }
.row-sub { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.current .row-sub, .row.now .row-sub { color: var(--accent3); font-weight: 500; }

/* Animated level meter next to "Now playing" (app.js injects .eqbars there). */
.eqbars {
  display: inline-flex; align-items: flex-end; gap: 2px;
  height: 11px; margin-right: 7px; vertical-align: -1px;
}
.eqbars i {
  width: 2.5px; border-radius: 1px;
  background: linear-gradient(to top, var(--accent2), var(--accent));
  animation: eqbar 900ms var(--ease) infinite alternate;
}
.eqbars i:nth-child(1) { height: 60%; animation-duration: 720ms; }
.eqbars i:nth-child(2) { height: 100%; animation-duration: 990ms; animation-delay: -320ms; }
.eqbars i:nth-child(3) { height: 45%; animation-duration: 840ms; animation-delay: -600ms; }
@keyframes eqbar { from { height: 22%; opacity: .65; } to { height: 100%; opacity: 1; } }
body.light-mode .eqbars i { animation: none; height: 70%; }


.row-actions { display: flex; align-items: center; gap: 3px; flex: none; }
.row-mv { display: flex; flex-direction: column; }
.mv-up, .mv-down { width: 22px; height: 17px; display: grid; place-items: center; color: var(--text-disabled); border-radius: 4px; }
.mv-up svg, .mv-down svg { width: 13px; height: 13px; }
.mv-up:hover, .mv-down:hover { background: rgba(255, 255, 255, .07); color: var(--text-primary); }

.row-play, .row-fav, .row-dl, .row-x, .row-offline, .l-add, .l-del, .c-add, .c-del, .c-dl, .ofl-rx {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--t-micro) var(--ease), color var(--t-micro) var(--ease);
}
.row-play svg, .row-fav svg, .row-dl svg, .row-x svg, .row-offline svg,
.l-add svg, .l-del svg, .c-add svg, .c-del svg, .c-dl svg, .ofl-rx svg { width: 16px; height: 16px; }
.row-play:hover, .row-dl:hover, .row-offline:hover, .l-add:hover, .c-add:hover, .c-dl:hover { background: rgba(var(--accent-rgb), .14); color: var(--accent); }
.row-fav:hover { background: rgba(255, 77, 109, .14); color: var(--live); }
.row-fav.on { color: var(--live); }
.row-x:hover, .l-del:hover, .c-del:hover, .ofl-rx:hover { background: rgba(240, 68, 56, .14); color: var(--danger); }
.row-offline.on { color: var(--success); }

.list-empty, .lib-empty, .cache-empty, .cast-empty, .trivia-empty {
  padding: 34px 20px; text-align: center;
  color: var(--text-disabled); font-size: 14px;
}
.list-empty[hidden], .lib-empty[hidden] { display: none; }

/* ==========================================================================
   Library (favorites + uploads) & cache
   ========================================================================== */
.lib-list { display: grid; gap: 6px; }
.lib-item, .cache-item, .ofl-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(255,255,255,.045), rgba(255,255,255,.012)),
              rgba(7, 17, 29, calc(.30 + var(--surface-dark) * .62));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.045);
  transition: background var(--t-ui) var(--ease), border-color var(--t-ui) var(--ease);
}
.lib-item:hover, .cache-item:hover, .ofl-row:hover { background: linear-gradient(160deg, rgba(255,255,255,.075), rgba(255,255,255,.02)),
              rgba(12, 26, 41, calc(.42 + var(--surface-dark) * .5)); border-color: rgba(255,255,255,.10); }
.lib-thumb, .cache-thumb { width: 44px; height: 44px; flex: none; border-radius: var(--radius-sm); object-fit: cover; background: var(--bg-tertiary); }
.lib-meta, .cache-meta, .ofl-rmeta { flex: 1; min-width: 0; }
.lib-title, .cache-title, .ofl-rtitle { font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-sub, .cache-sub, .ofl-rsub { font-size: 12.5px; color: var(--text-muted); }
.lib-actions, .cache-actions { display: flex; gap: 3px; flex: none; }

.cache-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cache-total { color: var(--text-muted); font-size: 13.5px; }
.cache-tools .mini-btn { margin-left: auto; }

.cache-controls { display: flex; gap: 10px; margin-bottom: 14px; }
.cache-search-wrap { position: relative; flex: 1; display: flex; align-items: center; }
.cache-search-ic { position: absolute; left: 13px; width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.cache-search, .cache-sort {
  width: 100%; padding: 10px 13px 10px 38px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 14px; outline: none;
  transition: border-color var(--t-ui) var(--ease), box-shadow var(--t-ui) var(--ease);
}
.cache-sort { width: auto; padding: 10px 13px; flex: none; cursor: pointer; }
.cache-search:focus, .cache-sort:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .10); }
.cache-search::placeholder { color: var(--text-disabled); }
.cache-list { display: grid; gap: 6px; max-height: 60vh; overflow-y: auto; }

.upload-tools { margin-bottom: 14px; }
.upload-msg { margin: 0 0 12px; font-size: 14px; color: var(--text-muted); }
.upload-msg.err { color: var(--danger); }
.upload-msg.ok { color: var(--success); }

/* ==========================================================================
   Live status — stats + devices
   ========================================================================== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat {
  display: flex; align-items: center; gap: 13px;
  padding: 15px; border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  transition: border-color var(--t-ui) var(--ease), transform var(--t-ui) var(--ease);
}
.stat:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.stat-ic {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: rgba(var(--accent-rgb), .10); color: var(--accent);
}
.stat-ic svg { width: 19px; height: 19px; }
.stat-val { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.stat-lbl { font-size: 12px; color: var(--text-muted); }

.devices-head { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .09em; margin-bottom: 12px; }
.devices { display: grid; gap: 8px; }
.device {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px; border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(255,255,255,.045), rgba(255,255,255,.012)),
              rgba(7, 17, 29, calc(.30 + var(--surface-dark) * .62));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.05);
}
.device-ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .05); color: var(--text-muted); }
.device-ic svg { width: 18px; height: 18px; }
.device-meta { flex: 1; min-width: 0; }
.device-name { font-size: 14.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.device-sub { font-size: 12.5px; color: var(--text-muted); }
.device-you { padding: 1px 8px; border-radius: var(--radius-pill); background: rgba(var(--accent-rgb), .14); color: var(--accent3); font-size: 11px; font-weight: 600; }
.device-edit { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-sm); color: var(--text-disabled); }
.device-edit svg { width: 14px; height: 14px; }
.device-edit:hover { background: rgba(255, 255, 255, .07); color: var(--text-primary); }

.dev-knob { width: 46px; height: 46px; flex: none; cursor: pointer; touch-action: none; }
.dev-knob circle, .dev-knob path { transition: stroke var(--t-ui) var(--ease); }

/* ==========================================================================
   Song info / trivia
   ========================================================================== */
/* ==========================================================================
   Lyrics
   ========================================================================== */
.lyrics-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 22px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-edge);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-lip);
  position: sticky; top: 0; z-index: 3;
}
.lyrics-match { font-size: 14.5px; font-weight: 600; min-width: 0; }
.lyrics-badges { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.lyrics-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border-default);
  color: var(--text-muted); font-size: 11.5px; font-weight: 600;
  letter-spacing: .04em;
}
.lyrics-badge svg { width: 12px; height: 12px; }
.lyrics-badge.synced {
  background: rgba(var(--accent-rgb), .12);
  border-color: rgba(var(--accent-rgb), .30);
  color: var(--accent3);
}
a.lyrics-badge:hover { color: var(--text-primary); border-color: var(--border-hover); }

.lyrics { padding-bottom: 42vh; }         /* room for the last line to reach centre */
.lyric {
  margin: 0 0 4px;
  padding: 7px 2px;
  font-size: 17px; line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
}
.lyric-gap { min-height: 12px; color: var(--text-disabled); }

/* Synced mode: the whole column dims and the live line lifts out of it. */
.lyrics.is-synced .lyric {
  font-size: 20px; font-weight: 600; line-height: 1.45;
  color: var(--text-disabled);
  transition: color 260ms var(--ease), transform 260ms var(--ease), opacity 260ms var(--ease);
  transform-origin: left center;
  opacity: .75;
}
.lyrics.is-synced .lyric.is-past { color: var(--text-disabled); opacity: .38; }
.lyrics.is-synced .lyric.is-active {
  color: var(--text-primary);
  opacity: 1;
  transform: scale(1.045);
  text-shadow: 0 0 26px rgba(var(--accent-rgb), .30);
}
body.light-mode .lyrics.is-synced .lyric { transition: none; transform: none; }

.lyrics-empty {
  display: grid; place-items: center; gap: 10px;
  padding: 64px 20px; text-align: center;
}
.lyrics-empty-ic { width: 34px; height: 34px; color: var(--text-disabled); }
.lyrics-empty p { margin: 0; font-size: 16px; font-weight: 500; color: var(--text-secondary); }
.lyrics-empty span { font-size: 13.5px; color: var(--text-disabled); }

@media (max-width: 640px) {
  .lyric { font-size: 16px; }
  .lyrics.is-synced .lyric { font-size: 18px; }
  .lyrics-head { padding: 12px 14px; }
}

/* ---------- Wikipedia cards ---------- */
.wiki { display: grid; gap: 14px; margin-bottom: 26px; }

.wiki-card {
  display: flex; gap: 18px; align-items: flex-start;
  padding: 18px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-edge);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), var(--glass-lip);
  transition: border-color var(--t-ui) var(--ease), transform var(--t-ui) var(--ease);
}
.wiki-card:hover { border-color: rgba(var(--accent-rgb), .28); transform: translateY(-2px); }

.wiki-img {
  width: 116px; height: 116px; flex: none;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, .07);
}

.wiki-body { flex: 1; min-width: 0; }

.wiki-kind {
  display: inline-block; margin-bottom: 7px;
  padding: 2px 10px; border-radius: var(--radius-pill);
  background: rgba(var(--accent-rgb), .12);
  border: 1px solid rgba(var(--accent-rgb), .26);
  color: var(--accent3);
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.wiki-title { margin: 0 0 3px; font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.wiki-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.wiki-extract {
  margin: 0 0 12px;
  font-size: 14px; line-height: 1.65; color: var(--text-secondary);
}
.wiki-link {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; color: var(--accent);
  transition: color var(--t-ui) var(--ease);
}
.wiki-link:hover { color: var(--accent3); text-decoration: underline; }

.wiki-credit { font-size: 11.5px; color: var(--text-disabled); padding-left: 2px; }

/* Loading skeleton — same footprint as a real card, so nothing jumps on arrival. */
.wiki-skel { pointer-events: none; }
.wiki-skel .wiki-img { background: rgba(255, 255, 255, .05); }
.skel {
  display: block; height: 11px; border-radius: 5px;
  background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.10), rgba(255,255,255,.05));
  background-size: 200% 100%;
  animation: skelShimmer 1.3s linear infinite;
  margin-bottom: 10px;
}
.skel-a { width: 34%; height: 14px; }
.skel-b { width: 62%; }
.skel-c { width: 100%; }
@keyframes skelShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
body.light-mode .skel { animation: none; }

@media (max-width: 640px) {
  .wiki-card { flex-direction: column; gap: 14px; }
  .wiki-img { width: 100%; height: 180px; }
}

.trivia { display: grid; gap: 14px; }
.trivia-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.trivia-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border-default);
  color: var(--text-secondary); font-size: 12.5px;
}
.trivia-ic { width: 14px; height: 14px; color: var(--text-muted); }
.trivia-channel { font-size: 15px; font-weight: 600; }
.trivia-desc { color: var(--text-secondary); font-size: 14px; line-height: 1.65; white-space: pre-wrap; max-height: 320px; overflow-y: auto; }

/* ==========================================================================
   Panels (legacy collapsible sections, now used as view bodies)
   ========================================================================== */
.panel { display: block; }
.panel-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 13px 0; color: var(--text-primary);
  font-size: 16px; font-weight: 600; text-align: left;
}
.panel-title { display: flex; align-items: center; gap: 10px; }
.ph-ic { width: 19px; height: 19px; color: var(--text-muted); }
.panel-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .06);
  font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.badge-ic { width: 13px; height: 13px; }
.panel.collapsed .panel-body { display: none; }
.panel.collapsed .chev { transform: rotate(-90deg); }
/* Inside a view the panel header is redundant chrome — the view has its own title. */
.view .panel > .panel-head { display: none; }
.view .panel.collapsed .panel-body { display: block; }

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 22px;
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade 200ms var(--ease);
}
.modal-overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(560px, 100%);
  max-height: 88vh; overflow-y: auto;
  padding: 26px;
  background: var(--glass-sheen), var(--glass-tint), linear-gradient(rgba(9, 20, 33, .93), rgba(9, 20, 33, .93));
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-edge);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
  animation: modalIn 240ms var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }

.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.modal-title { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 600; }
.modal-title svg { width: 20px; height: 20px; color: var(--accent); }
.warn-ic { color: var(--warning) !important; }
.modal-x {
  margin-left: auto; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 17px;
}
.modal-x:hover { background: rgba(255, 255, 255, .07); color: var(--text-primary); }
.modal-sub { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; }

.modal-section {
  margin: 26px 0 12px;
  font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-disabled);
}

.modal input[type="text"] {
  width: 100%; padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 15px; outline: none;
  transition: border-color var(--t-ui) var(--ease), box-shadow var(--t-ui) var(--ease);
}
.modal input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .10); }
.modal input[type="text"]::placeholder { color: var(--text-disabled); }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.modal-btn {
  padding: 10px 18px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600;
  transition: all var(--t-ui) var(--ease);
}
.modal-btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #010206; }
.modal-btn.primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.modal-btn.ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-hover); }
.modal-btn.ghost:hover { background: rgba(255, 255, 255, .05); color: var(--text-primary); }

/* Switch rows */
.switch-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; cursor: pointer; }
.switch-label { flex: 1; min-width: 0; }
.switch-name { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 500; }
.switch-ic { width: 17px; height: 17px; color: var(--text-muted); }
.switch-hint { display: block; margin-top: 4px; color: var(--text-muted); font-size: 12.5px; line-height: 1.5; }
.switch { position: relative; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  display: block; width: 46px; height: 26px; border-radius: var(--radius-pill);
  background: var(--border-hover); transition: background var(--t-ui) var(--ease);
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--text-primary);
  transition: transform var(--t-ui) var(--ease);
}
.switch input:checked + .switch-track { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }

/* Colour pickers + swatches */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 42px; height: 42px; border-radius: var(--radius-md);
  border: 2px solid transparent;
  transition: transform var(--t-micro) var(--ease), border-color var(--t-micro) var(--ease);
}
.swatch:hover { transform: scale(1.07); }
.swatch.active { border-color: var(--text-primary); }

.color-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; }
.color-pick { width: 46px; height: 34px; padding: 0; border: 1px solid var(--border-hover); border-radius: var(--radius-sm); background: none; cursor: pointer; }
.cr-name { font-size: 14.5px; font-weight: 500; }
.cr-hint { font-size: 12.5px; color: var(--text-muted); }

.range-row { padding: 12px 0; }
.range-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.opacity-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 5px; border-radius: var(--radius-pill);
  background: var(--border-hover); cursor: pointer; margin-bottom: 8px;
}
.opacity-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent);
}
.opacity-range::-moz-range-thumb { width: 16px; height: 16px; border: none; border-radius: 50%; background: var(--accent); }

/* Stream / Sonos link */
.stream-row { display: grid; gap: 14px; }
.stream-hint { color: var(--text-muted); font-size: 12.5px; line-height: 1.6; }
.stream-field[hidden] { display: none; }
.stream-flabel { font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.stream-fnote { color: var(--text-disabled); font-weight: 400; }
.stream-url-wrap { display: flex; gap: 8px; }
.stream-url {
  flex: 1; min-width: 0; padding: 10px 12px;
  background: var(--bg-secondary); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
}
.stream-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.stream-actions button[hidden] { display: none; }
.stream-msg { font-size: 13px; color: var(--success); }
.stream-msg.err { color: var(--danger); }

.offl-storage { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: var(--text-muted); padding: 8px 0; }
.offl-storage .modal-btn { margin-left: auto; }
.offl-budget, .offl-protect { font-size: 12.5px; color: var(--text-muted); padding: 8px 12px; background: rgba(255, 255, 255, .04); border-radius: var(--radius-sm); margin-top: 8px; }
.offl-install { width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 14px; }

.update-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; }
.update-info { flex: 1; }
.update-name { display: flex; align-items: center; gap: 9px; font-size: 14.5px; font-weight: 500; }
.update-hint { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
body:not(.desktop) .desktop-only { display: none !important; }

.addq-list { display: grid; gap: 8px; }
.addq-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 15px; border-radius: var(--radius-md);
  background: var(--bg-secondary); border: 1px solid var(--border-default);
  color: var(--text-primary); text-align: left;
  transition: all var(--t-ui) var(--ease);
}
.addq-item:hover { background: var(--bg-hover); border-color: var(--accent); transform: translateY(-2px); }
.addq-name { flex: 1; font-size: 15px; font-weight: 500; }
.addq-count { font-size: 12.5px; color: var(--text-muted); }

/* Cast / audio-output picker */
.cast-panel {
  position: fixed; z-index: 70;
  width: min(300px, calc(100vw - 32px));
  padding: 8px;
  background: rgba(12, 26, 41, .96);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
}
.cast-panel[hidden] { display: none; }
.cast-panel-head { padding: 9px 12px; font-size: 12px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--text-disabled); }
.cast-device {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 12px; border-radius: var(--radius-md);
  color: var(--text-secondary); text-align: left; font-size: 14px;
  transition: background var(--t-micro) var(--ease), color var(--t-micro) var(--ease);
}
.cast-device:hover { background: rgba(255, 255, 255, .06); color: var(--text-primary); }
.cast-device-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cast-check { color: var(--accent); flex: none; }
.cast-check svg { width: 16px; height: 16px; }

/* Karaoke */
.karaoke-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; }
.karaoke-modal[hidden] { display: none; }
.karaoke-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .88); backdrop-filter: blur(8px); }
.karaoke-box { position: relative; width: min(1100px, 100%); }
.karaoke-close {
  position: absolute; top: -46px; right: 0;
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: var(--radius-md); background: rgba(255, 255, 255, .09); color: var(--text-primary);
}
.karaoke-close:hover { background: rgba(255, 255, 255, .16); }
.karaoke-frame-wrap { position: relative; aspect-ratio: 16/9; border-radius: var(--radius-lg); overflow: hidden; background: #000; box-shadow: var(--shadow-elevated); }
.karaoke-iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.karaoke-title { margin-top: 14px; text-align: center; font-size: 16px; font-weight: 600; }

/* ==========================================================================
   Toasts + announce banner
   ========================================================================== */
.jb-toast, .sfx-toast {
  position: fixed; left: 50%; bottom: calc(var(--player-h) + 22px);
  transform: translateX(-50%); z-index: 90;
  padding: 12px 20px; border-radius: var(--radius-pill);
  background: rgba(12, 26, 41, .96);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-hover);
  box-shadow: var(--shadow-elevated);
  font-size: 14px; font-weight: 500;
  animation: toastIn 240ms var(--ease);
}
.jb-toast[hidden], .sfx-toast[hidden] { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.announce-banner {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 11px;
  padding: 12px 22px; border-radius: var(--radius-pill);
  background: rgba(255, 77, 109, .16);
  border: 1px solid rgba(255, 77, 109, .42);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  color: #ffc0cc; font-size: 14px; font-weight: 600;
}
.announce-banner[hidden] { display: none; }
.ann-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--live); animation: livePulse 1.4s var(--ease) infinite; }

/* ==========================================================================
   Offline view
   ========================================================================== */
#offline-view { position: fixed; inset: 0; z-index: 40; background: var(--bg-primary); overflow-y: auto; }
#offline-view[hidden] { display: none; }
.ofl-wrap { max-width: 900px; margin: 0 auto; padding: 26px 22px 60px; }
.ofl-top { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.ofl-badge {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 15px; border-radius: var(--radius-pill);
  background: rgba(253, 176, 34, .12); border: 1px solid rgba(253, 176, 34, .34);
  color: var(--warning); font-size: 13px; font-weight: 600;
}
.ofl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }
.ofl-online-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }

.ofl-evicted {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 20px;
  background: rgba(240, 68, 56, .1); border: 1px solid rgba(240, 68, 56, .3);
  border-radius: var(--radius-md); font-size: 13.5px;
}
.ofl-evicted[hidden] { display: none; }
.ofl-evicted-actions { margin-left: auto; display: flex; gap: 10px; }

.ofl-now { padding: 22px; background: var(--bg-secondary); border: 1px solid var(--border-default); border-radius: var(--radius-xl); margin-bottom: 26px; }
.ofl-now-inner { display: flex; align-items: center; gap: 22px; margin-bottom: 20px; }
.ofl-now-inner .art { width: 128px; height: 128px; flex: none; border-radius: var(--radius-md); }
.ofl-meta { flex: 1; min-width: 0; }
.ofl-now .np-title { font-size: 22px; margin-bottom: 6px; }
.ofl-now .np-sub { font-size: 14px; margin-bottom: 16px; }
.ofl-progress { margin-bottom: 8px; }
.ofl-now .times { justify-content: space-between; }
.ofl-controls { justify-content: center; }

.ofl-list-head { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.ofl-store { margin-left: auto; font-size: 12.5px; color: var(--text-muted); font-weight: 400; }
.ofl-list { display: grid; gap: 6px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1180px) {
  :root { --sidebar-w: 78px; }
  /* Collapsed rail: the mark stands alone — hide the whole wordmark, not just its
     accent half, or "Juke" is left stranded and forces the rail to scroll. */
  .jk-brand .wordmark, .jk-navitem span:not(.jk-navcount), .jk-navlabel, .jk-side-foot .dl-btn span, .jk-credit span { display: none; }
  .jk-sidebar { overflow-x: hidden; }
  .jk-brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .jk-navitem { justify-content: center; padding: 12px 0; border-left: none; border-radius: var(--radius-md); }
  .jk-navitem.active { box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .3); }
  .jk-navcount { position: absolute; margin: 0; transform: translate(16px, -14px); }
  .jk-navitem { position: relative; }
  .stage { grid-template-columns: 1fr; text-align: center; }
  .stage .art-wrap { max-width: 300px; margin: 0 auto; }
  .np-title { font-size: 28px; }
}

@media (max-width: 860px) {
  :root { --player-h: 76px; }
  .jk-app { grid-template-columns: 1fr; grid-template-rows: 1fr auto auto; grid-template-areas: "content" "player" "mobilenav"; }
  .jk-sidebar { display: none; }
  .jk-topbar { padding: 12px 16px; }
  .jk-viewtitle { font-size: 17px; }
  .view { padding: 18px 16px 26px; }
  .conn .conn-label { display: none; }

  /* Compact mini-player; tapping it expands the Now Playing stage */
  .jk-player { grid-template-columns: 1fr auto; gap: 12px; padding: 0 14px; }
  .jk-player .pl-center .controls { gap: 4px; }
  .pl-progress { display: none; }
  .pl-right { display: none; }
  .pl-art { width: 44px; height: 44px; }
  .pl-track { cursor: pointer; }
  .pl-expand { display: grid; place-items: center; width: 30px; height: 30px; color: var(--text-muted); flex: none; }
  /* Chevron points the way the sheet will travel: up to expand, down to close. */
  .pl-expand svg { width: 18px; height: 18px; transform: rotate(180deg); transition: transform var(--t-ui) var(--ease); }
  .ctl { width: 36px; height: 36px; }
  .ctl.skip { width: 42px; height: 42px; }
  #btn-eq, #btn-sync, #btn-karaoke, #btn-cast { display: none; }

  .jk-mobilenav {
    grid-area: mobilenav;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    background: rgba(7, 17, 29, .95);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-default);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    z-index: 6;
  }
  .jk-mobitem {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 2px; border-radius: var(--radius-sm);
    color: var(--text-muted); font-size: 10.5px; font-weight: 500;
  }
  .jk-mobitem svg { width: 21px; height: 21px; }
  .jk-mobitem.active { color: var(--accent); }

  /* Expanded full-screen Now Playing */
  body.np-expanded .jk-topbar,
  body.np-expanded .jk-mobilenav { display: none; }
  body.np-expanded .jk-app { grid-template-rows: 1fr auto; grid-template-areas: "content" "player"; }
  body.np-expanded .jk-player { grid-template-columns: 1fr; --player-h: 150px; padding-bottom: env(safe-area-inset-bottom, 0px); }
  body.np-expanded .pl-progress { display: flex; }

  /* Keep the chevron reachable — it's the only way back on touch, where Esc isn't. */
  body.np-expanded .jk-player .pl-track { justify-content: center; cursor: default; }
  body.np-expanded .jk-player .pl-art,
  body.np-expanded .jk-player .pl-meta { display: none; }
  body.np-expanded .pl-expand { width: 56px; height: 30px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, .06); }
  body.np-expanded .pl-expand svg { transform: none; }

  /* Centre the artwork stack; the visualiser has no room to breathe here so it steps aside. */
  body.np-expanded .view.active { display: flex; flex-direction: column; justify-content: center; min-height: 100%; padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
  body.np-expanded .stage { min-height: auto; border: none; background: none; box-shadow: none; padding: 0; }
  body.np-expanded .viz, body.np-expanded .eq { display: none; }
  body.np-expanded .np-title { font-size: 26px; }
  body.np-expanded .stage-badges { justify-content: center; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .cache-controls { flex-direction: column; }
  .cache-sort { width: 100%; }
  .modal { padding: 20px; border-radius: var(--radius-lg); }
  .ofl-now-inner { flex-direction: column; text-align: center; }
  .jb-toast, .sfx-toast { bottom: calc(var(--player-h) + 78px); }
}

@media (max-width: 460px) {
  .np-title { font-size: 21px; }
  .stat-grid { grid-template-columns: 1fr; }
  .gate-card { padding: 30px 20px 22px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Transient row states
   The JS has always toggled these classes; the Jukely restyle never gave them
   rules, so drag-reorder and the offline button ran with no visible feedback.
   ========================================================================== */

/* Dragging a queue row: the original dims and lifts so the cursor's copy reads
   as the thing being moved. */
.row.dragging {
  opacity: .4;
  transform: scale(.99);
  cursor: grabbing;
}

/* Drop indicator — a bright rule on the edge the row will land against. */
.row.drop-above::before,
.row.drop-below::before {
  content: '';
  position: absolute; left: 8px; right: 8px; height: 2px;
  background: var(--accent);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), .8);
  pointer-events: none;
}
.row.drop-above::before { top: -2px; }
.row.drop-below::before { bottom: -2px; }

/* A download in flight: the icon spins and the button stops taking taps
   (the JS ignores them too, but the cursor should say so). */
.row-offline.busy, #btn-dl-queue.busy {
  pointer-events: none;
  color: var(--accent);
}
.row-offline.busy svg, #btn-dl-queue.busy svg {
  animation: dlSpin 900ms linear infinite;
}
@keyframes dlSpin { to { transform: rotate(360deg); } }

/* Cached song whose real title hasn't resolved yet — showing the raw video id
   as if it were a title is a lie, so mark it as provisional. */
.cache-title.loading {
  color: var(--text-muted);
  font-style: italic;
  opacity: .75;
}

/* Off air: the venue is closed on a schedule, not broken. Warm amber rather than the
   live-red dot, so it reads as "resting" instead of "error". */
.stage-badge.offair {
  background: rgba(253, 176, 34, .13);
  border-color: rgba(253, 176, 34, .38);
  color: #FFD98A;
}
.stage-badge.offair svg { width: 14px; height: 14px; }
/* Dim the artwork while nothing is playing — a bright cover over silence looks broken. */
body.is-offair #art,
body.is-offair .pl-art { filter: saturate(.4) brightness(.62); }

/* A queue item the server could not download. Amber, not red: it usually means the video
   went away or yt-dlp needs a nudge, not that the app is broken. */
.row-bad {
  display: inline-flex; align-items: center;
  padding: 1px 7px; margin-right: 6px;
  border-radius: var(--radius-pill);
  background: rgba(253, 176, 34, .14);
  border: 1px solid rgba(253, 176, 34, .34);
  color: #FFD98A;
  font-size: 11px; font-weight: 600;
  cursor: help;
}
