:root {
  --bg0: #120e0c;
  --bg1: #1c1511;
  --ink: #f4ebe2;
  --mute: #9a8776;
  --line: rgba(244, 235, 226, 0.08);
  --accent: #e8a24a;
  --accent-hot: #ff6b3d;
  --active: #ffe6b8;
  --rail: 380px;
  --font-display: "Unbounded", sans-serif;
  --font-body: "Onest", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--bg0);
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}

.stage {
  position: relative;
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  height: 100%;
  background:
    radial-gradient(120% 80% at 70% -10%, rgba(232, 162, 74, 0.18), transparent 55%),
    radial-gradient(80% 60% at 10% 100%, rgba(255, 107, 61, 0.12), transparent 50%),
    linear-gradient(180deg, #1a1310 0%, #0e0b09 100%);
  transition: grid-template-columns 280ms ease;
}

.glow {
  pointer-events: none;
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  animation: drift 12s ease-in-out infinite alternate;
}
.glow-a {
  width: 42vw; height: 42vw;
  left: 35%; top: -18%;
  background: rgba(232, 162, 74, 0.22);
}
.glow-b {
  width: 28vw; height: 28vw;
  right: -5%; bottom: 10%;
  background: rgba(255, 107, 61, 0.16);
  animation-delay: -4s;
}
.scan {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.045) 2px,
    rgba(0,0,0,0.045) 4px
  );
  opacity: 0.35;
  mix-blend-mode: multiply;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(3%, 4%, 0) scale(1.08); }
}

.rail {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 12px 10px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18,14,12,0.72), rgba(18,14,12,0.4));
  backdrop-filter: blur(10px);
  min-height: 0;
  transition: opacity 220ms ease, transform 280ms ease;
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: 0.06em;
  line-height: 1;
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-hot) 70%, #fff1d6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: brand-pulse 4.5s ease-in-out infinite;
}
.brand-sub {
  margin-top: 2px;
  color: var(--mute);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
@keyframes brand-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}

.search-wrap input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.9rem;
  outline: none;
}
.search-wrap input:focus {
  border-color: rgba(232, 162, 74, 0.55);
  box-shadow: 0 0 0 3px rgba(232, 162, 74, 0.12);
}

.library-meta {
  color: var(--mute);
  font-size: 0.68rem;
  padding: 0 2px;
  line-height: 1.25;
}
.cloud-panel {
  display: block;
  padding: 2px 2px;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cloud-panel summary,
.queue-panel > summary {
  cursor: pointer;
  list-style: none;
  color: var(--mute);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 0;
  user-select: none;
}
.cloud-panel summary::-webkit-details-marker,
.queue-panel > summary::-webkit-details-marker {
  display: none;
}
.cloud-panel summary::before,
.queue-panel > summary::before {
  content: "▸ ";
  color: var(--accent);
}
.cloud-panel[open] summary::before,
.queue-panel[open] > summary::before {
  content: "▾ ";
}
.cloud-body {
  display: grid;
  gap: 4px;
  padding-bottom: 4px;
}
.cloud-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cloud-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}
.cloud-status {
  color: var(--mute);
  font-size: 0.72rem;
  line-height: 1.35;
  min-height: 1.35em;
}
.cloud-status.is-running { color: rgba(232, 162, 74, 0.95); }
.cloud-status.is-error { color: #ff8a7a; }
#source-filter {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.78rem;
}
.list-hint {
  display: none;
}
.queue-hint {
  margin: 0 0 4px;
  color: var(--mute);
  font-size: 0.66rem;
  line-height: 1.3;
}

.track-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  min-height: min(52vh, 520px);
  flex: 1 1 auto;
}
.track-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px;
  align-items: center;
  padding: 4px 4px 4px 6px;
  border-radius: 8px;
  transition: background 160ms ease;
}
.track-row:hover,
.track-row.active {
  background: rgba(232, 162, 74, 0.08);
}
.track-row.active {
  background: linear-gradient(90deg, rgba(232,162,74,0.22), rgba(232,162,74,0.05));
}
.track-main {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
  font: inherit;
  min-width: 0;
}
.track-list .t-title {
  font-weight: 600;
  font-size: 0.86rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-list .t-artist {
  color: var(--mute);
  font-size: 0.68rem;
  margin-top: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-list .t-badges {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  margin-top: 1px;
  overflow: hidden;
}
.track-list .t-badge {
  display: inline-block;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,107,61,0.9);
  flex-shrink: 0;
}
.track-list .t-badge.fmt-emp { color: rgba(232, 162, 74, 0.95); }
.track-list .t-badge.fmt-kfn { color: rgba(120, 200, 255, 0.95); }
.track-list .t-badge.yd {
  color: #1a1310;
  background: rgba(252, 214, 120, 0.92);
  border-radius: 4px;
  padding: 0 4px;
}
.track-list .t-badge.clip {
  color: #0e1a14;
  background: rgba(120, 220, 180, 0.9);
  border-radius: 4px;
  padding: 0 4px;
}
.track-list .t-badge.drm {
  color: #ffe6e0;
  background: rgba(160, 60, 50, 0.75);
  border-radius: 4px;
  padding: 0 4px;
}
.track-row.unplayable {
  opacity: 0.55;
}
.track-row.unplayable .t-title {
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.25);
}
.queue-add {
  align-self: center;
  height: 28px;
  min-width: 28px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.queue-add:hover {
  border-color: rgba(232,162,74,0.5);
  background: rgba(232,162,74,0.15);
  transform: scale(1.03);
}

.queue-panel {
  border-top: 1px solid var(--line);
  padding-top: 4px;
  max-height: 16vh;
  min-height: 0;
  flex: 0 0 auto;
}
.queue-panel[open] {
  max-height: 22vh;
  display: flex;
  flex-direction: column;
}
.queue-panel .queue-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.queue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--mute);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.text-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0;
}
.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  counter-reset: q;
}
.queue-empty {
  color: var(--mute);
  font-size: 0.78rem;
  padding: 4px 2px 8px;
}
.queue-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px 4px;
  border-radius: 8px;
}
.queue-item.next {
  background: rgba(232, 162, 74, 0.12);
}
.up-next {
  margin-top: 8px;
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.toast {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 5;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(28, 21, 17, 0.92);
  border: 1px solid rgba(232, 162, 74, 0.35);
  color: var(--active);
  font-size: 0.85rem;
  white-space: nowrap;
  animation: toast-in 180ms ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.queue-item .qi-num {
  color: var(--mute);
  font-size: 0.72rem;
  width: 1.2em;
}
.queue-item .qi-text {
  min-width: 0;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-item .qi-text b { font-weight: 600; }
.queue-item .qi-text span { color: var(--mute); font-weight: 400; }
.queue-item button {
  border: 0;
  background: transparent;
  color: var(--mute);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 6px;
}
.queue-item button:hover { color: var(--accent-hot); }

.screen {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
  padding: 28px 36px 18px;
}

.now-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.now-artist {
  color: var(--mute);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-height: 1.2em;
}
.now-title {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.now-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.tool-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.tool-btn:hover {
  border-color: rgba(232,162,74,0.45);
}
.tool-btn.on {
  background: linear-gradient(145deg, rgba(232,162,74,0.28), rgba(255,107,61,0.22));
  border-color: transparent;
  color: #fff1d6;
}

.mic-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}
.mic-meter {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.mic-meter i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-hot));
  transition: width 50ms linear;
}
.mic-gain {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mute);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mic-gain input { width: 90px; accent-color: var(--accent); }
.mic-status {
  color: var(--mute);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-width: 3.5em;
}
.mic-status.live { color: var(--accent-hot); }

.fx-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,0.28);
  animation: toast-in 180ms ease;
  max-height: min(42vh, 420px);
  overflow: auto;
}
.fx-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.fx-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fx-presets button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.fx-presets button.on,
.fx-presets button:hover {
  border-color: transparent;
  background: linear-gradient(145deg, rgba(232,162,74,0.35), rgba(255,107,61,0.28));
  color: #fff1d6;
}
.fx-meter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mute);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  min-width: 140px;
}
.gr-meter {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.gr-meter i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #5ad07a, var(--accent), var(--accent-hot));
  transition: width 40ms linear;
}
.fx-sections { display: grid; gap: 8px; }
.fx-sec {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 10px 10px;
  background: rgba(255,255,255,0.02);
}
.fx-sec summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 2px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--active);
}
.fx-sec summary::-webkit-details-marker { display: none; }
.fx-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px 12px;
}
.fx-knob, .fx-select {
  display: grid;
  gap: 4px;
  color: var(--mute);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.fx-knob span, .fx-select span {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: baseline;
}
.fx-knob b, .fx-select b {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
}
.fx-knob input, .fx-select select {
  width: 100%;
  accent-color: var(--accent);
}
.fx-select select {
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.35);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.78rem;
}
@media (max-width: 1200px) {
  .fx-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .fx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-panel { max-height: 34vh; }
}

.lyrics {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  padding: 24px 8px 36px;
  overflow: hidden;
}
.viz-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.55;
  mask-image: linear-gradient(
    180deg,
    transparent 0%,
    #000 16%,
    #000 78%,
    transparent 100%
  );
}
#viz {
  display: block;
  width: 100%;
  height: 100%;
}
.lyrics-track {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.72rem;
  will-change: transform;
  padding: 18vh 0 28vh;
  mask-image: linear-gradient(
    180deg,
    transparent 0%,
    #000 10%,
    #000 78%,
    transparent 100%
  );
}
.lyrics-hint {
  position: relative;
  z-index: 1;
  color: var(--mute);
  font-size: 1.1rem;
  text-align: center;
  margin: auto;
}
.line {
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.6vw, 2rem);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.45;
  color: rgba(244, 235, 226, 0.22);
  transform: scale(0.94);
  filter: blur(0.2px);
  opacity: 0.55;
  transition:
    color 320ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 380ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 320ms ease,
    filter 320ms ease,
    text-shadow 320ms ease;
  max-width: min(920px, 92%);
}
.line.past {
  color: rgba(255, 230, 184, 0.38);
  opacity: 0.62;
  filter: none;
}
.line.near {
  color: rgba(244, 235, 226, 0.48);
  opacity: 0.86;
  transform: scale(0.98);
  filter: none;
}
.line.ahead.near {
  color: rgba(244, 235, 226, 0.42);
}
.line.active {
  color: rgba(244, 235, 226, 0.42);
  font-weight: 600;
  transform: scale(1.06);
  opacity: 1;
  filter: none;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

/* Karaoke wipe: dim base + fill clipped by progress */
.line .syl {
  --p: 0;
  position: relative;
  display: inline-block;
  white-space: pre;
  vertical-align: baseline;
}
.syl-base {
  color: inherit;
  transition: color 240ms ease;
}
.syl-fill {
  position: absolute;
  left: 0;
  top: 0;
  color: #ffe2b0;
  pointer-events: none;
  white-space: pre;
  clip-path: inset(0 calc((1 - var(--p)) * 100%) 0 0);
  will-change: clip-path;
}
.syl-fill-inner {
  display: inline-block;
  white-space: pre;
}
.syl.sung .syl-base {
  color: transparent;
}
.syl.sung .syl-fill {
  color: #ffe2b0;
  text-shadow: 0 0 20px rgba(232, 162, 74, 0.2);
  clip-path: inset(0 0 0 0);
}
.line.active .syl.hot .syl-base {
  color: rgba(244, 235, 226, 0.36);
}
.line.active .syl.hot .syl-fill {
  color: #fff4dc;
  text-shadow:
    0 0 12px rgba(255, 190, 110, 0.55),
    0 0 28px rgba(255, 120, 60, 0.28);
}
.line.active .syl.hot {
  filter: drop-shadow(0 0 10px rgba(255, 160, 80, 0.18));
}
.line.past .syl-fill {
  color: rgba(255, 226, 176, 0.7);
  text-shadow: none;
}

.deck {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: auto auto auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 8px 6px;
  border-top: 1px solid var(--line);
}
.sync-nudge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--mute);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sync-btn {
  width: 34px;
  height: 34px;
  font-size: 1.05rem;
}
.play-btn, .icon-btn {
  border: 0;
  cursor: pointer;
  color: var(--ink);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}
.play-btn {
  width: 56px;
  height: 56px;
  background: linear-gradient(145deg, var(--accent), var(--accent-hot));
  border: 0;
  color: #1a1008;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(255, 107, 61, 0.28);
}
.play-btn:hover, .icon-btn:hover {
  transform: translateY(-1px);
}
.scrub {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.scrub input[type="range"], .vol input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.times {
  display: flex;
  justify-content: space-between;
  color: var(--mute);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.vol { width: 90px; }

/* Cinema / fullscreen stage mode */
body.is-fs .stage {
  grid-template-columns: 0 1fr;
}
body.is-fs .rail {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-12px);
  overflow: hidden;
  padding: 0;
  border: 0;
}
body.is-fs .screen {
  padding: 40px 8vw 24px;
}
body.is-fs .now-title {
  font-size: clamp(2rem, 5vw, 3.4rem);
}
body.is-fs .line {
  font-size: clamp(1.5rem, 3.6vw, 2.6rem);
}
body.is-fs .deck {
  opacity: 0.92;
}
body.is-fs .viz-bg {
  opacity: 0.16;
}

/* —— Mobile chrome (hidden on desktop) —— */
.mobile-top,
.mobile-nav,
.rail-backdrop,
.mobile-rail-close {
  display: none;
}

.brand {
  position: relative;
}
.brand .mobile-rail-close {
  display: none;
}

@media (max-width: 860px) {
  .viz-bg {
    opacity: 0.12;
  }

  html, body {
    overflow: hidden;
    height: 100%;
    height: 100dvh;
  }

  .stage {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    height: 100dvh;
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px calc(8px + env(safe-area-inset-top, 0px));
    margin: 0 0 4px;
  }

  .mobile-icon-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    color: var(--ink);
    font: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
  }

  .mobile-top-brand {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 2px;
  }

  .mobile-top-mark {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    background: linear-gradient(120deg, var(--accent), var(--accent-hot));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  .mobile-now-mini {
    color: var(--mute);
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    background: rgba(14, 11, 9, 0.94);
    backdrop-filter: blur(14px);
  }

  .mobile-nav-btn {
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--mute);
    font: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 8px 4px;
    display: grid;
    gap: 2px;
    place-items: center;
  }

  .mobile-nav-btn.is-active {
    color: var(--accent);
    background: rgba(232, 162, 74, 0.12);
  }

  .mobile-nav-ico {
    font-size: 1.05rem;
    line-height: 1;
  }

  .rail-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    border: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }

  body.rail-open .rail-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .rail {
    position: fixed;
    z-index: 50;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(100vw, 380px);
    max-width: 100vw;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    padding: calc(14px + env(safe-area-inset-top, 0px)) 14px calc(72px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(22, 17, 14, 0.98), rgba(14, 11, 9, 0.98));
    transform: translateX(-105%);
    transition: transform 280ms ease;
    box-shadow: 12px 0 40px rgba(0,0,0,0.35);
  }

  body.rail-open .rail {
    transform: translateX(0);
  }

  .mobile-rail-close {
    display: inline-flex !important;
    position: absolute;
    right: 0;
    top: 0;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
  }

  .screen {
    padding: 6px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    min-height: 0;
  }

  .now-top {
    flex-direction: column;
    gap: 10px;
  }

  .now-title {
    font-size: clamp(1.15rem, 5.5vw, 1.55rem);
  }

  .now-artist {
    font-size: 0.78rem;
  }

  .now-actions {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .now-actions::-webkit-scrollbar { display: none; }

  body.mobile-actions-collapsed .now-actions {
    display: none;
  }

  body:not(.mobile-actions-collapsed) .now-actions {
    display: flex;
  }

  .party-bar {
    gap: 8px;
  }

  .party-bar .pitch-tempo,
  .party-bar .lyric-style,
  .party-bar .countdown-toggle,
  .party-bar #video-bg {
    font-size: 0.7rem;
  }

  .lyrics {
    min-height: 0;
  }

  .line {
    font-size: clamp(1.05rem, 4.6vw, 1.45rem);
  }

  .deck {
    grid-template-columns: auto auto auto 1fr;
    gap: 8px;
    padding: 8px 0 4px;
  }

  .vol,
  .sync-nudge {
    display: none;
  }

  .play-btn {
    width: 52px;
    height: 52px;
  }

  .queue-panel {
    max-height: none;
    flex: 0 0 auto;
  }

  body.rail-focus-queue .track-list,
  body.rail-focus-queue .list-hint,
  body.rail-focus-queue .cloud-panel,
  body.rail-focus-queue .lib-tools,
  body.rail-focus-queue .roots-panel,
  body.rail-focus-queue .library-meta,
  body.rail-focus-queue .search-wrap {
    display: none;
  }

  body.rail-focus-queue .queue-panel {
    flex: 1;
    min-height: 0;
    max-height: none;
  }

  body.rail-focus-queue .queue-panel[open] {
    display: flex;
    flex-direction: column;
  }

  body.rail-focus-queue .queue-panel > summary {
    display: none;
  }

  body.rail-focus-queue .queue-body {
    flex: 1;
    min-height: 0;
  }

  body.rail-focus-queue .queue-list {
    flex: 1;
    overflow: auto;
  }

  .track-list {
    min-height: 0;
  }

  body.is-fs .stage {
    padding-bottom: 0;
  }

  body.is-fs .mobile-top,
  body.is-fs .mobile-nav {
    display: none;
  }

  body.is-fs .rail,
  body.is-fs .rail-backdrop {
    display: none !important;
  }

  body.is-fs .screen {
    padding: 16px 4vw 12px;
  }

  .fx-panel {
    max-height: 42vh;
    overflow: auto;
  }

  .toast {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 420px) {
  .now-title {
    font-size: 1.1rem;
  }
  .brand-mark {
    font-size: 1.45rem;
  }
}

/* —— Phase 0–4 party UI —— */
.lib-tools {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 4px;
  margin: 2px 0;
}
.lib-tools select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.72rem;
}
.roots-panel {
  margin: 2px 0 4px;
  color: var(--mute);
  font-size: 0.68rem;
}
.roots-list {
  list-style: none;
  margin: 6px 0;
  padding: 0;
  max-height: 9vh;
  overflow: auto;
}
.roots-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 3px 0;
  word-break: break-all;
}
.roots-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}
.roots-form input {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.72rem;
}
.roots-hint { opacity: 0.7; margin: 4px 0 0; }
.track-row {
  grid-template-columns: auto 1fr auto;
}
.fav-btn {
  border: 0;
  background: transparent;
  color: var(--mute);
  cursor: pointer;
  font-size: 0.85rem;
  width: 22px;
  padding: 0;
}
.fav-btn.on { color: var(--accent); }
.party-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-top: 12px;
  color: var(--mute);
  font-size: 0.75rem;
}
.pitch-tempo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.vocal-mix, .lyric-style, .countdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lyric-style select, #video-bg {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  border-radius: 8px;
  padding: 4px 8px;
  font: inherit;
  font-size: 0.72rem;
}
.video-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0.35;
  pointer-events: none;
}
.video-bg.is-clip {
  opacity: 0.62;
  filter: saturate(1.05) contrast(1.05);
}
.countdown {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: clamp(4rem, 18vw, 9rem);
  font-weight: 800;
  color: #fff1d4;
  text-shadow: 0 0 40px rgba(255,140,60,0.55);
  pointer-events: none;
}
.score-modal, .remote-modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(8,6,5,0.55);
  backdrop-filter: blur(8px);
}
.score-modal[hidden], .remote-modal[hidden] { display: none !important; }
.score-card, .remote-card {
  background: linear-gradient(180deg, #241a14, #120e0c);
  border: 1px solid rgba(232,162,74,0.25);
  border-radius: 18px;
  padding: 28px 32px;
  text-align: center;
  min-width: min(360px, 90vw);
}
.score-stars { font-size: 2rem; color: var(--accent); letter-spacing: 0.12em; }
.score-label { margin-top: 10px; font-family: var(--font-display); font-size: 1.4rem; }
.score-detail { color: var(--mute); margin: 8px 0 16px; font-size: 0.85rem; }
.remote-url { word-break: break-all; color: var(--accent); font-size: 0.85rem; }
.remote-hint { color: var(--mute); font-size: 0.78rem; }

/* lyric style presets */
.lyric-neon .line.active .syl.hot .syl-fill {
  color: #7ef0ff;
  text-shadow: 0 0 16px rgba(80,220,255,0.7), 0 0 32px rgba(255,60,160,0.35);
}
.lyric-neon .syl.sung .syl-fill { color: #ff9ad8; }
.lyric-minimal .line {
  font-family: var(--font-body);
  letter-spacing: 0.02em;
}
.lyric-minimal .line.active { transform: scale(1.02); text-shadow: none; }
.lyric-minimal .syl.hot .syl-fill,
.lyric-minimal .syl.sung .syl-fill {
  color: #fff;
  text-shadow: none;
}
