:root {
  color-scheme: dark;
  --bg-deep: #141018;
  --bg-panel: rgba(32, 24, 36, 0.52);
  --bg-panel-strong: rgba(48, 36, 52, 0.72);
  --line: rgba(255, 236, 210, 0.14);
  --line-strong: rgba(255, 236, 210, 0.22);
  --text: #faf3e8;
  --text-soft: rgba(250, 243, 232, 0.72);
  --gold: #d4a96a;
  --gold-bright: #e8c992;
  --gold-soft: rgba(212, 169, 106, 0.22);
  --ember: rgba(255, 160, 90, 0.35);
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-ui: "Inter", system-ui, sans-serif;
  /* Matched to photoreal frame alpha cutout (+ ~0.8% bleed under bezel) */
  --screen-x: 6.75%;
  --screen-y: 8.45%;
  --screen-w: 69.65%;
  --screen-h: 77%;
  --screen-r: 2%;
  /* Volume — lower-right on TV overlay (% of .tv box, scales with frame art) */
  --vol-deck-right: 6.68%;
  --vol-deck-bottom: 3.55%;
  --fs-btn-right: 1.6%;
  --fs-btn-top: 2.4%;
  /* Status LED — center of lower knob inner lens (measured on acsTV v2 art) */
  --tv-led-x: 83.52%;
  --tv-led-y: 88.76%;
  --tv-led-size: 1.26%;
  --parallax-x: 0px;
  --parallax-y: 0px;
  --scrollbar-size: 8px;
  --scrollbar-track: rgba(255, 236, 210, 0.06);
  --scrollbar-thumb: rgba(212, 169, 106, 0.42);
  --scrollbar-thumb-hover: rgba(232, 201, 146, 0.62);
  --catalog-panel-h: min(40vh, 420px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

body {
  overflow-x: hidden;
  max-width: 100%;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
}

/* Styled scrollbars (page + in-panel lists) */
html,
.now-queue-scroll,
.lib-table-scroll,
.leaderboard-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

html::-webkit-scrollbar,
.now-queue-scroll::-webkit-scrollbar,
.lib-table-scroll::-webkit-scrollbar,
.leaderboard-scroll::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: 0;
}

html::-webkit-scrollbar-track,
.now-queue-scroll::-webkit-scrollbar-track,
.lib-table-scroll::-webkit-scrollbar-track,
.leaderboard-scroll::-webkit-scrollbar-track {
  margin: 6px 0;
  border-radius: 999px;
  background: var(--scrollbar-track);
  box-shadow: inset 0 0 0 1px rgba(255, 236, 210, 0.05);
}

html::-webkit-scrollbar-thumb,
.now-queue-scroll::-webkit-scrollbar-thumb,
.lib-table-scroll::-webkit-scrollbar-thumb,
.leaderboard-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  background: linear-gradient(180deg, rgba(232, 201, 146, 0.58), var(--scrollbar-thumb));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

html::-webkit-scrollbar-thumb:hover,
.now-queue-scroll::-webkit-scrollbar-thumb:hover,
.lib-table-scroll::-webkit-scrollbar-thumb:hover,
.leaderboard-scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--scrollbar-thumb-hover), rgba(212, 169, 106, 0.52));
}

html::-webkit-scrollbar-corner {
  background: transparent;
}

body.room-live .scene-glow {
  opacity: 1;
}

button,
input {
  font: inherit;
}

/* --- Full-screen illustrated environment --- */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #1c1424;
}

.scene-bg {
  position: absolute;
  inset: -4%;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0;
  transform: translate3d(var(--parallax-x), var(--parallax-y), 0) scale(1.06);
  transition: opacity 1.4s ease;
  will-change: opacity, transform;
}

.scene-bg.is-visible {
  opacity: 1;
}

.scene-wash {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(20, 12, 28, 0.35) 0%, rgba(20, 12, 28, 0.55) 45%, rgba(12, 8, 18, 0.82) 100%),
    radial-gradient(ellipse 90% 60% at 50% 100%, rgba(212, 169, 106, 0.12), transparent 55%);
  pointer-events: none;
}

.scene-grain {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  mix-blend-mode: soft-light;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

.scene-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Top/bottom only; tight spread so UI gutters between panels stay clean */
  box-shadow:
    inset 0 48px 72px -56px rgba(8, 4, 12, 0.4),
    inset 0 -56px 100px -48px rgba(8, 4, 12, 0.65);
}

.scene-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
  background: radial-gradient(ellipse 55% 40% at 38% 42%, rgba(255, 190, 120, 0.18), transparent 60%);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100% - 40px));
  max-width: 100%;
  margin: 0 auto;
  padding: 16px 0 52px;
  overflow-x: clip;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  padding: 10px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-glyph-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
}

.brand-glyph {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: cover;
  object-position: center center;
  border-radius: 12px;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.32),
    0 1px 0 rgba(255, 255, 255, 0.35) inset;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.2vw, 1.95rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.1;
}

.brand-sub {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-soft);
  max-width: 28rem;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.chip-header {
  min-height: 34px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 500;
}

.hero {
  display: grid;
  /* Trial: 350px rail (Twitch recommends ≥400px — revert if chat breaks) */
  grid-template-columns: minmax(0, 1fr) minmax(350px, 350px);
  gap: 10px;
  align-items: stretch;
}

.broadcast {
  display: grid;
  gap: 10px;
  min-width: 0;
}

/* Frosted panels — gradient tint over semi-opaque fill (blur needs both layers) */
.broadcast .now-card,
.broadcast .card.card-library {
  background:
    linear-gradient(165deg, rgba(255, 248, 235, 0.1), rgba(20, 14, 26, 0.35)),
    var(--bg-panel);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.tv-stage {
  position: relative;
  padding: 0;
  border: none;
  border-radius: 16px;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  overflow: hidden;
}

.tv {
  position: relative;
  display: grid;
  grid-template-areas: "stack";
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  /* No outer shadow — it painted dark bands in the 10px panel gutters */
  filter: none;
  box-shadow: none;
}

.tv-frame,
.tv-viewport,
.tv-volume-deck,
.tv-fullscreen-btn,
.tv-audio-led {
  grid-area: stack;
}

/* Status LED — lit from inside the lower knob lens (inset only, no outer halo) */
.tv-audio-led {
  position: absolute;
  left: var(--tv-led-x);
  top: var(--tv-led-y);
  width: var(--tv-led-size);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  mix-blend-mode: screen;
  clip-path: circle(50% at 50% 50%);
  cursor: pointer;
  background: radial-gradient(
    circle at 50% 44%,
    var(--tv-led-hot, transparent) 0%,
    var(--tv-led-core, transparent) 38%,
    var(--tv-led-fade, transparent) 72%,
    transparent 88%
  );
  box-shadow:
    inset 0 0 5px 2px var(--tv-led-inset, transparent),
    inset 0 0 14px 6px var(--tv-led-deep, transparent);
  transition:
    opacity 0.35s ease,
    background 0.45s ease,
    box-shadow 0.45s ease;
}

.tv-audio-led::before {
  content: "";
  position: absolute;
  inset: -200% -200% -35% -200%;
  border-radius: 50%;
}

.tv-audio-led:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

.tv:not(.tv-frame-ready) .tv-audio-led {
  visibility: hidden;
}

.tv[data-audio-led="standby"] .tv-audio-led,
.tv[data-audio-led="muted"] .tv-audio-led,
.tv[data-audio-led="live"] .tv-audio-led {
  pointer-events: auto;
}

.tv.tv-frame-ready[data-audio-led="standby"] .tv-audio-led,
.tv.tv-frame-ready[data-audio-led="muted"] .tv-audio-led,
.tv.tv-frame-ready[data-audio-led="live"] .tv-audio-led {
  visibility: visible;
}

.tv[data-audio-led="standby"] .tv-audio-led {
  opacity: 0.92;
  --tv-led-hot: rgba(255, 120, 110, 0.95);
  --tv-led-core: rgba(230, 45, 45, 0.72);
  --tv-led-fade: rgba(160, 25, 25, 0.38);
  --tv-led-inset: rgba(255, 90, 90, 0.55);
  --tv-led-deep: rgba(120, 15, 15, 0.45);
}

.tv[data-audio-led="muted"] .tv-audio-led {
  opacity: 0.94;
  --tv-led-hot: rgba(255, 230, 120, 0.92);
  --tv-led-core: rgba(220, 170, 35, 0.7);
  --tv-led-fade: rgba(150, 100, 10, 0.4);
  --tv-led-inset: rgba(255, 210, 80, 0.5);
  --tv-led-deep: rgba(100, 70, 5, 0.42);
}

.tv[data-audio-led="live"] .tv-audio-led {
  opacity: 0.94;
  --tv-led-hot: rgba(170, 255, 195, 0.9);
  --tv-led-core: rgba(55, 210, 100, 0.68);
  --tv-led-fade: rgba(25, 120, 55, 0.38);
  --tv-led-inset: rgba(90, 240, 140, 0.48);
  --tv-led-deep: rgba(15, 80, 40, 0.42);
}

@media (prefers-reduced-motion: no-preference) {
  .tv[data-audio-led="standby"] .tv-audio-led,
  .tv[data-audio-led="live"] .tv-audio-led,
  .tv[data-audio-led="muted"] .tv-audio-led {
    animation: tv-led-glow-pulse 3.6s ease-in-out infinite;
  }
}

@keyframes tv-led-glow-pulse {
  0%,
  100% {
    opacity: 0.86;
    filter: brightness(0.93) saturate(0.92);
  }
  50% {
    opacity: 0.97;
    filter: brightness(1.07) saturate(1.08);
  }
}

.tv-shelf {
  position: absolute;
  left: 10%;
  right: 10%;
  top: calc(100% - 10px);
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.45), transparent 72%);
  opacity: 0.75;
  pointer-events: none;
}

.tv-frame {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  z-index: 2;
}

/* Fallback when art/acsTV v2.png is missing */
.tv.tv--no-frame {
  background:
    linear-gradient(165deg, rgba(255, 248, 235, 0.07), rgba(20, 14, 26, 0.5)),
    linear-gradient(145deg, #4a3a52 0%, #2a2034 45%, #1a1220 100%);
  border: 2px solid rgba(212, 169, 106, 0.35);
  box-shadow:
    inset 0 0 0 3px rgba(0, 0, 0, 0.45),
    inset 0 2px 12px rgba(255, 236, 210, 0.08),
    0 28px 48px rgba(0, 0, 0, 0.5);
}

.tv.tv--no-frame .tv-viewport {
  left: 5.5%;
  top: 7%;
  width: 89%;
  height: 72%;
  border-radius: 3%;
}

.tv.tv--no-frame .tv-volume-deck {
  opacity: 1;
}

.tv-viewport {
  position: absolute;
  left: var(--screen-x);
  top: var(--screen-y);
  width: var(--screen-w);
  height: var(--screen-h);
  border-radius: var(--screen-r);
  overflow: hidden;
  background: #0a080c;
  z-index: 1;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.65);
}

.tv-fullscreen-btn {
  position: absolute;
  right: var(--fs-btn-right);
  top: var(--fs-btn-top);
  bottom: auto;
  z-index: 14;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 236, 210, 0.22);
  border-radius: 10px;
  background: rgba(12, 10, 16, 0.72);
  color: rgba(250, 243, 232, 0.92);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  transition:
    opacity 0.2s ease,
    background 0.15s ease,
    transform 0.12s ease;
}

.tv:hover .tv-fullscreen-btn,
.tv.tv-is-hovered .tv-fullscreen-btn,
.tv.is-fullscreen.tv-is-hovered .tv-fullscreen-btn,
.tv-fullscreen-btn:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.tv-fullscreen-btn:hover {
  background: rgba(24, 20, 30, 0.88);
  transform: scale(1.04);
}

.tv-fullscreen-btn:active {
  transform: scale(0.96);
}

.tv-fs-icon {
  display: block;
  grid-area: 1 / 1;
}

.tv-fs-exit {
  display: none;
}

.tv.is-fullscreen .tv-fs-enter {
  display: none;
}

.tv.is-fullscreen .tv-fs-exit {
  display: block;
}

.tv:fullscreen,
.tv:-webkit-full-screen {
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  max-width: 100vw;
  max-height: 100vh;
  margin: auto;
  border-radius: 12px;
  filter: drop-shadow(0 28px 56px rgba(0, 0, 0, 0.65));
}

.tv:fullscreen::backdrop,
.tv:-webkit-full-screen::backdrop {
  background: #050408;
}

.tv-volume-deck {
  position: absolute;
  right: var(--vol-deck-right);
  bottom: var(--vol-deck-bottom);
  left: auto;
  top: auto;
  width: 9.2%;
  min-width: 0;
  max-width: 74px;
  z-index: 13;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0;
  box-sizing: border-box;
  pointer-events: none;
}

.tv-volume {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  height: 18px;
  margin: 0;
  display: flex;
  align-items: center;
  padding: 0;
  box-sizing: border-box;
  pointer-events: auto;
  background: transparent;
  border: none;
  box-shadow: none;
}

.tv-volume input[type="range"] {
  width: 100%;
  height: 100%;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.tv-volume input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  min-height: 5px;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.tv-volume input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 0.85em;
  height: 1.15em;
  margin-top: -0.28em;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.45);
  background: linear-gradient(180deg, #4a4a4a, #2a2a2a);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.tv-volume input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.tv-volume input[type="range"]::-moz-range-thumb {
  width: 8px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.45);
  background: linear-gradient(180deg, #4a4a4a, #2a2a2a);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.tv-viewport video,
.tv-viewport .tv-standby,
.tv-viewport .tv-bump,
.tv-viewport .viewport-shade {
  position: absolute;
  inset: 0;
}

.tv-viewport video {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: center center;
  background: #0a080c;
  opacity: 1;
  transition: opacity 0.55s ease;
}

.tv-viewport video.is-faded {
  opacity: 0;
}

.tv-bump {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-content: center;
  padding: 14px;
  background: rgba(6, 4, 10, 0.72);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.45s ease,
    visibility 0.45s ease;
  pointer-events: none;
}

.tv-bump.is-active {
  opacity: 1;
  visibility: visible;
}

.tv-bump[hidden] {
  display: none !important;
}

.tv-bump-card {
  width: min(92%, 22rem);
  padding: 16px 18px 14px;
  border-radius: 14px;
  border: 1px solid rgba(212, 169, 106, 0.28);
  background: linear-gradient(165deg, rgba(36, 28, 44, 0.94), rgba(12, 8, 16, 0.96));
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 236, 210, 0.1);
  text-align: center;
}

.tv-bump-kicker {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(212, 169, 106, 0.95);
}

.tv-bump-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.8vw, 1.55rem);
  font-weight: 600;
  line-height: 1.2;
  color: rgba(250, 243, 232, 0.96);
}

.tv-bump-detail {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-soft);
}

.tv-bump-extra {
  margin: 4px 0 0;
  font-size: 11px;
  color: rgba(212, 169, 106, 0.85);
}

.tv-bump-countdown {
  margin: 10px 0 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(250, 243, 232, 0.78);
}

/* CRT-style standby when nothing is on air */
.tv-standby {
  z-index: 5;
  display: grid;
  place-content: center;
  padding: 18px;
  background-color: #0a080c;
  background-image: radial-gradient(ellipse 85% 75% at 50% 45%, #1a1422 0%, #0a080c 78%);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.6s ease,
    visibility 0.6s ease;
}

.tv-standby.is-active {
  opacity: 1;
  visibility: visible;
}

.tv-standby[hidden] {
  display: none !important;
}

.tv-standby-static {
  position: absolute;
  inset: -30%;
  opacity: 0.2;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: soft-light;
  animation: tv-standby-static 0.14s steps(3) infinite;
}

.tv-standby-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px,
    rgba(0, 0, 0, 0.18) 4px
  );
  opacity: 0.55;
}

.tv-standby-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, rgba(212, 169, 106, 0.12), transparent 55%);
  animation: tv-standby-glow 3.2s ease-in-out infinite;
}

.tv-standby-content {
  position: relative;
  z-index: 1;
  max-width: 20rem;
  text-align: center;
  animation: tv-standby-flicker 5s linear infinite;
}

.tv-standby-kicker {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(212, 169, 106, 0.9);
}

.tv-standby-copy {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  line-height: 1.35;
  font-style: italic;
  color: rgba(250, 243, 232, 0.92);
}

.tv-standby-sub,
.tv-standby-hint {
  margin: 10px 0 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(212, 169, 106, 0.88);
}

.tv-standby-hint:empty {
  display: none;
}

@keyframes tv-standby-static {
  0% {
    transform: translate(0, 0);
  }
  33% {
    transform: translate(-3%, 2%);
  }
  66% {
    transform: translate(2%, -2%);
  }
  100% {
    transform: translate(0, 0);
  }
}

@keyframes tv-standby-glow {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

@keyframes tv-standby-flicker {
  0%,
  96%,
  100% {
    opacity: 1;
  }
  97% {
    opacity: 0.88;
  }
  98% {
    opacity: 0.96;
  }
}

.viewport-shade {
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 220, 180, 0.06), transparent 32%);
}

.now-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 16px 22px;
  align-items: start;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
}

.now-col {
  min-width: 0;
}

.now-col-next {
  padding-left: 20px;
  border-left: 1px solid rgba(255, 236, 210, 0.1);
}

.now-next-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.now-next-head .now-kicker {
  margin-bottom: 0;
}

.now-queue-stat {
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-soft);
  white-space: nowrap;
}

.now-queue-scroll {
  max-height: 10.5rem;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 6px;
  margin-right: -2px;
}

.now-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.now-col-play .now-kicker {
  background: linear-gradient(
    105deg,
    rgba(204, 162, 108, 0.94) 0%,
    rgba(218, 178, 122, 0.98) 46%,
    rgba(228, 194, 138, 1) 50%,
    rgba(218, 178, 122, 0.98) 54%,
    rgba(204, 162, 108, 0.94) 100%
  );
  background-size: 180% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 4px rgba(212, 169, 106, 0.1));
  animation: now-kicker-shimmer 9s ease-in-out infinite;
}

@keyframes now-kicker-shimmer {
  0%,
  100% {
    background-position: 105% 50%;
    filter: drop-shadow(0 0 3px rgba(212, 169, 106, 0.08));
  }
  50% {
    background-position: 15% 50%;
    filter: drop-shadow(0 0 6px rgba(212, 169, 106, 0.14));
  }
}

@media (prefers-reduced-motion: reduce) {
  .now-col-play .now-kicker {
    animation: none;
    color: var(--gold);
    background: none;
    filter: none;
  }
}

.now-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.28rem, 2.2vw, 1.75rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.35);
}

.now-details {
  display: grid;
  gap: 2px;
  margin-top: 6px;
}

.now-details .lib-artist {
  margin-top: 0;
}

.now-progress {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  max-width: 22rem;
}

.now-progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

.now-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(212, 169, 106, 0.85), rgba(232, 201, 146, 0.95));
  box-shadow: 0 0 12px rgba(212, 169, 106, 0.35);
  transition: width 0.15s linear;
}

.now-progress-label {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

.now-meta {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 14px;
}

.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.chip {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.chip:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.11);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.chip:active:not(:disabled) {
  transform: translateY(0);
}

.chip:disabled {
  opacity: 0.45;
  cursor: default;
}

.vol-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.15);
  color: var(--text-soft);
  font-size: 12px;
}

.vol-bar input[type="range"] {
  flex: 1;
  accent-color: var(--gold);
}

.rail {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 16px;
  align-self: start;
  min-height: calc(100vh - 88px);
  max-height: calc(100vh - 88px);
  gap: 10px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  padding: 16px 16px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.card-library,
.card-leaderboard {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: var(--catalog-panel-h);
  min-height: var(--catalog-panel-h);
  max-height: var(--catalog-panel-h);
  min-width: 0;
  overflow: hidden;
}

.card-leaderboard {
  flex: 0 0 auto;
}

.card-library .card-head,
.card-head--library {
  align-items: flex-start;
  gap: 10px 14px;
  flex-wrap: wrap;
}

.card-head-lead {
  flex: 1 1 auto;
  min-width: min(100%, 220px);
}

.library-priority-hint {
  margin: 4px 0 0;
  max-width: 36rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-soft);
}

.library-priority-hint[hidden] {
  display: none;
}

.card-head--library .lib-search {
  align-self: center;
}

.library-status {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--accent-warm, #ffb86c);
}

.library-status[hidden] {
  display: none;
}

.lib-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(300px, 58%);
  margin-left: auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 236, 210, 0.16);
  background: rgba(8, 6, 12, 0.35);
  color: var(--text-soft);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 14px rgba(0, 0, 0, 0.18);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.lib-search:focus-within {
  border-color: rgba(212, 169, 106, 0.42);
  background: rgba(12, 10, 16, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 2px rgba(212, 169, 106, 0.12);
  color: var(--gold-bright);
}

.lib-search-icon {
  flex-shrink: 0;
  opacity: 0.72;
}

.lib-search:focus-within .lib-search-icon {
  opacity: 0.95;
}

.lib-search input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.3;
}

.lib-search input::placeholder {
  color: rgba(250, 243, 232, 0.45);
}

.lib-search input:focus {
  outline: none;
}

.lib-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 14px;
  width: 14px;
  border-radius: 50%;
  background: rgba(212, 169, 106, 0.35);
  cursor: pointer;
}

.lib-empty {
  padding: 14px 8px;
  font-size: 13px;
  font-style: italic;
  color: var(--text-soft);
  list-style: none;
}

.lib-table {
  display: grid;
  grid-template-columns:
    minmax(0, 1.22fr)
    minmax(0, 0.86fr)
    minmax(0, 0.8fr)
    minmax(5.15rem, 5.5rem);
  column-gap: 10px;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  padding: 0 8px;
  box-sizing: border-box;
}

.lib-sort-head {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
  padding: 2px 0 10px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255, 236, 210, 0.1);
}

.lib-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  margin: 0;
  padding: 4px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}

.lib-sort:hover {
  color: var(--gold-bright);
  background: rgba(255, 255, 255, 0.04);
}

.lib-sort.is-active {
  color: var(--gold-bright);
}

.lib-sort-caret {
  display: inline-flex;
  width: 10px;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
  opacity: 0.35;
}

.lib-sort.is-active .lib-sort-caret {
  opacity: 0.95;
  color: var(--gold);
}

.lib-sort.is-active[data-dir="asc"] .lib-sort-caret::before {
  content: "▲";
}

.lib-sort.is-active[data-dir="desc"] .lib-sort-caret::before {
  content: "▼";
}

.lib-sort:not(.is-active) .lib-sort-caret::before {
  content: "↕";
  font-size: 8px;
  opacity: 0.7;
}

.lib-sort-gap {
  display: block;
}

.lib-table-scroll {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-content: start;
  align-items: start;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 12px;
}

.catalog {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-content: start;
  align-items: start;
  grid-auto-rows: auto;
  width: 100%;
  min-width: 0;
  height: auto;
}

.auth-bar {
  display: flex;
  align-items: center;
  gap: 0;
  max-width: min(100%, 340px);
  padding: 3px 4px 3px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 236, 210, 0.14);
  background: rgba(8, 6, 12, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.auth-user-label {
  flex: 0 1 auto;
  min-width: 0;
  padding-right: 12px;
  margin-right: 4px;
  border-right: 1px solid rgba(255, 236, 210, 0.12);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--gold-bright);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-action-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.topbar-btn {
  margin: 0;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.topbar-btn--ghost {
  padding: 7px 11px;
  background: transparent;
  color: rgba(250, 243, 232, 0.62);
}

.topbar-btn--ghost:hover {
  color: var(--text);
  background: rgba(255, 236, 210, 0.08);
}

.topbar-btn--primary {
  padding: 7px 14px;
  color: #1a1220;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  box-shadow: 0 2px 10px rgba(212, 169, 106, 0.28);
}

.topbar-btn--primary:hover {
  box-shadow: 0 4px 14px rgba(212, 169, 106, 0.38);
}

.topbar-btn--skip {
  padding: 8px 16px;
  color: var(--gold-bright);
  background: rgba(212, 169, 106, 0.1);
  border: 1px solid rgba(212, 169, 106, 0.35);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar-btn--skip:hover {
  background: rgba(212, 169, 106, 0.18);
  border-color: rgba(232, 201, 146, 0.5);
}

.auth-dialog {
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 0;
  max-width: min(420px, calc(100vw - 32px));
  background: #1a1220;
  color: var(--text);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
}

.auth-dialog::backdrop {
  background: rgba(5, 4, 8, 0.72);
}

.auth-dialog-inner {
  padding: 22px 20px 18px;
  margin: 0;
}

.auth-dialog-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
}

.auth-dialog-copy {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-soft);
}

.auth-provider-row {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.auth-provider-row .auth-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 236, 210, 0.08);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  overflow: visible;
}

.auth-provider-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: visible;
}

.auth-provider-icon svg {
  display: block;
  overflow: visible;
}

.auth-provider-icon--twitch {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
}

.auth-provider--google {
  background: #f8f9fa;
  color: #3c4043;
  border-color: rgba(255, 255, 255, 0.12);
}

.auth-provider--google:hover {
  background: #fff;
}

.auth-provider--twitch {
  border-color: rgba(145, 70, 255, 0.55);
  background: #9146ff;
  color: #fff;
}

.auth-provider--twitch:hover {
  background: #7c3aed;
}

.auth-dialog-close {
  width: 100%;
  margin: 0;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  cursor: pointer;
}

.auth-nick-label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--text-soft);
}

.auth-nick-label input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(8, 6, 12, 0.55);
  color: var(--text);
  font: inherit;
}

.auth-error {
  margin: 8px 0 0;
  font-size: 12px;
  color: #f0a0a0;
}

.auth-dialog-actions {
  margin-top: 14px;
}

.leaderboard-scroll {
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}

.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 236, 210, 0.1);
}

.leaderboard-row:first-child {
  padding-top: 4px;
}

.leaderboard-row:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.leaderboard-rank {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: rgba(212, 169, 106, 0.55);
  padding-top: 1px;
}

.leaderboard-row:first-child .leaderboard-rank {
  color: rgba(232, 201, 146, 0.88);
}

.leaderboard-body {
  min-width: 0;
}

.leaderboard-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.12rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: rgba(250, 243, 232, 0.95);
}

.leaderboard-stats {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0.02em;
  color: var(--text-soft);
}

.leaderboard-fav {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-soft);
}

.leaderboard-fav--empty {
  font-style: italic;
  opacity: 0.75;
}

.leaderboard-fav-label {
  letter-spacing: 0.02em;
}

.leaderboard-fav-song {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  color: rgba(250, 243, 232, 0.88);
}

.leaderboard-empty {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-soft);
}

.card-chat {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

/* One unit: translucent header + opaque Twitch iframe only (blur stays off iframe ancestors) */
.chat-panel {
  flex: 0 0 auto;
  height: min(calc(100vh - 280px), 714px);
  min-height: 360px;
  display: grid;
  grid-template-rows: auto minmax(300px, 1fr);
  border-radius: 20px;
  overflow: hidden;
  background: transparent;
  opacity: 1;
}

.chat-panel-head {
  margin: 0;
  padding: 14px 16px 12px;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.chat-panel-head.card-head {
  margin-bottom: 0;
  padding-bottom: 12px;
}

.chat-embed-wrap {
  position: relative;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--line);
  border-top: 1px solid rgba(255, 236, 210, 0.1);
  border-radius: 0 0 20px 20px;
  background: #0e0e10;
  opacity: 1;
  visibility: visible;
}

.chat-embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 300px;
  border: 0;
  opacity: 1;
  visibility: visible;
  background: #0e0e10;
}

.card-link {
  text-decoration: none;
  color: var(--gold);
  transition: color 0.15s ease;
}

.card-link:hover {
  color: var(--gold-bright);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 236, 210, 0.08);
}

.card-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--gold-bright);
}

.card-stat {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
}

#queue-count {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 12px;
}

.queue,
.catalog {
  list-style: none;
  margin: 0;
  padding: 0;
}

.queue:empty::before {
  content: "Nothing queued - request a clip to watch live";
  display: block;
  padding: 10px 6px;
  color: var(--text-soft);
  font-size: 13px;
  font-style: italic;
}

.catalog:empty::before {
  content: "Preparing the library…";
  display: block;
  padding: 10px 6px;
  color: var(--text-soft);
  font-size: 13px;
  font-style: italic;
}

.queue-row,
.lib-row {
  border-top: 1px solid rgba(255, 236, 210, 0.07);
}

.queue-row:first-child,
.lib-row:first-child {
  border-top: 0;
}

.lib-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-self: start;
  min-width: 0;
}

.lib-row-group .lib-main-group {
  margin: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  background: rgba(255, 255, 255, 0.02);
}

.lib-row-group .lib-main-group:focus {
  outline: none;
}

.lib-row-group .lib-main-group:focus-visible {
  outline: 2px solid rgba(212, 169, 106, 0.55);
  outline-offset: 1px;
}

.lib-row-group.is-expanded .lib-main-group {
  background: rgba(212, 169, 106, 0.06);
  box-shadow: inset 0 0 0 1px rgba(212, 169, 106, 0.14);
}

.lib-row-group .lib-action {
  color: var(--gold-bright);
  letter-spacing: 0.06em;
}

.lib-row-variant .lib-main {
  padding: 7px 0 7px 12px;
}

.lib-row-variant .lib-col-date {
  color: var(--text);
}

.lib-row-variant + .lib-row-variant .lib-main,
.lib-row-group + .lib-row-variant .lib-main {
  border-top: 1px dashed rgba(255, 236, 210, 0.08);
}

.queue-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px 10px;
  align-items: start;
  padding: 7px 4px;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.queue--compact .queue-row {
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 4px 8px;
  padding: 5px 2px;
}

.queue--compact .queue-row .row-time {
  display: none;
}

.queue--compact .queue-index {
  padding-top: 2px;
  font-size: 11px;
}

.queue--compact .row-title {
  font-size: 0.95rem;
  line-height: 1.15;
}

.queue--compact .lib-artist,
.queue--compact .lib-date {
  font-size: 11px;
  line-height: 1.3;
}

.queue-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.queue-row .row-title {
  font-size: 1.02rem;
}

.queue-row .lib-artist {
  margin-top: 0;
}

.queue-index {
  padding-top: 3px;
  line-height: 1.2;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}

.queue-row .row-time {
  padding-top: 2px;
  white-space: nowrap;
}

.queue-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.row-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.2;
}

.row-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-soft);
}

.row-time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
}

.lib-main {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
  align-self: start;
  width: 100%;
  min-width: 0;
  height: auto;
  padding: 10px 0;
  border-radius: 12px;
  text-align: left;
}

.lib-col-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  justify-self: end;
  margin-right: 4px;
}

.lib-action {
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 236, 210, 0.16);
  background: rgba(8, 6, 12, 0.35);
  color: var(--text-soft);
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.lib-action--free:hover:not(:disabled) {
  background: rgba(212, 169, 106, 0.12);
  border-color: rgba(212, 169, 106, 0.28);
  color: var(--text);
}

.lib-action--priority {
  border-color: rgba(212, 169, 106, 0.35);
  color: var(--gold-bright);
  background: rgba(212, 169, 106, 0.1);
}

.lib-action--priority:hover:not(:disabled) {
  background: rgba(212, 169, 106, 0.18);
  border-color: rgba(232, 201, 146, 0.45);
}

.lib-action:disabled {
  opacity: 0.5;
  cursor: default;
}

.queue-row--priority .row-title {
  color: var(--gold-bright);
}

.lib-col {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lib-col-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.lib-col-artist {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-soft);
}

.lib-col-date {
  font-size: 11px;
  line-height: 1.35;
  color: rgba(232, 201, 146, 0.85);
}

.lib-artist {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-soft);
}

.lib-date {
  display: block;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(232, 201, 146, 0.85);
}

[data-tip] {
  position: relative;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: 220px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(32, 24, 36, 0.95);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 11px;
  line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 30;
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Tooltips use position: relative; keep overlay controls pinned to the TV */
.tv-volume-deck[data-tip],
.tv-fullscreen-btn[data-tip] {
  position: absolute;
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    min-height: 0;
    max-height: none;
  }

  .card-chat {
    min-height: 360px;
  }

  .chat-panel {
    height: min(52vh, 520px);
  }

  :root {
    --catalog-panel-h: min(50vh, 480px);
  }

  .now-card {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .now-col-next {
    padding-left: 0;
    border-left: 0;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 236, 210, 0.1);
  }

  .now-queue-scroll {
    max-height: 11rem;
  }

  .brand-sub {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 24px, 1320px);
    padding-top: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

}
