/* KantaNa — visual identity rooted in the Pinoy videoke machine:
   neon-on-dark, segmented LED readouts, and a queue laid out like a songbook.

   Full-screen layout: no page scroll, player + queue always visible.
   Poppins font, sized for smart TV readability. */

:root {
  /* Surfaces — neutral near-black canvas + layered card surfaces */
  --bg:      #0b0d0c;                  /* near-black canvas      */
  --card:    #16191b;                  /* card surface           */
  --card-hi: #1c2023;                  /* elevated card          */
  --line:    rgba(255,255,255,0.07);   /* hairline borders       */

  /* Legacy aliases — keep existing var(--ink*) references working */
  --ink:    var(--bg);
  --ink-2:  var(--card);
  --ink-3:  var(--card-hi);

  /* Neon accents (unchanged) */
  --hot:    #FF2E97;
  --volt:   #18E0E8;
  --gold:   #FFC53D;

  /* Text — neutral ramp */
  --text-hi:  #f3f6f4;        /* primary text       */
  --text-mid: #9aa3a0;        /* secondary / labels */
  --text-lo:  #6a716e;        /* tertiary / dim     */
  --text:   var(--text-hi);   /* legacy alias       */
  --muted:  var(--text-mid);  /* legacy alias       */

  --danger: #FF5C7A;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 12px 34px rgba(0,0,0,.40), 0 2px 8px rgba(0,0,0,.28);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.30);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background:
    radial-gradient(1100px 700px at 78% -8%, rgba(255,46,151,.16), transparent 60%),
    radial-gradient(900px 600px at -5% 110%, rgba(24,224,232,.14), transparent 55%),
    var(--ink);
  color: var(--text);
  font-family: "Poppins", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  font-size: 18px;
}
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
img { display: block; }
ol { list-style: none; margin: 0; padding: 0; }

/* ---------- wordmark ---------- */
.wordmark {
  font-family: "Poppins", sans-serif; font-weight: 800;
  font-size: clamp(32px, 3.4vw, 48px);
  letter-spacing: .5px;
  line-height: 1;
  color: var(--text);
  text-transform: uppercase;
}
.wordmark span { color: var(--hot); text-shadow: 0 0 22px rgba(255,46,151,.55); }
.wordmark.small { font-size: 24px; }

/* ---------- logo (mic mark + sequential neon-glow wordmark) ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-mark { height: clamp(30px, 3.4vw, 46px); width: auto; display: block; }
.logo-text {
  font-family: "Poppins", sans-serif; font-weight: 800;
  letter-spacing: .5px; line-height: 1;
  font-size: clamp(26px, 3vw, 40px); white-space: nowrap;
}
.logo-text i {
  font-style: normal; color: var(--text);
  animation: logoGlow 3.6s ease-in-out infinite;
}
.logo-text i.g1 { color: #FF2E97; }
.logo-text i.g2 { color: #FB57B2; }
.logo-text i.g3 { color: #7FA9D9; }
.logo-text i.g4 { color: #18E0E8; }
.logo-text i:nth-child(1) { animation-delay: 0s; }
.logo-text i:nth-child(2) { animation-delay: .18s; }
.logo-text i:nth-child(3) { animation-delay: .36s; }
.logo-text i:nth-child(4) { animation-delay: .54s; }
.logo-text i:nth-child(5) { animation-delay: .72s; }
.logo-text i:nth-child(6) { animation-delay: .90s; }
.logo-text i:nth-child(7) { animation-delay: 1.08s; }
.logo-text i:nth-child(8) { animation-delay: 1.26s; }
.logo-text i:nth-child(9) { animation-delay: 1.44s; }
@keyframes logoGlow {
  0%        { text-shadow: none; }
  12%       { text-shadow: 0 0 8px currentColor, 0 0 22px currentColor; }
  32%, 100% { text-shadow: none; }
}
.logo.small { gap: 8px; }
.logo.small .logo-mark { height: 28px; }
.logo.small .logo-text { font-size: 22px; }
@media (prefers-reduced-motion: reduce) {
  .logo-text i { animation: none; }
}

/* ---------- shared bits ---------- */
.pill {
  font-size: 15px; font-weight: 600; letter-spacing: .4px;
  padding: 8px 16px; border-radius: 999px;
  background: rgba(24,224,232,.1); color: var(--volt);
  border: 1px solid rgba(24,224,232,.32);
  white-space: nowrap;
}
/* "Live" emphasis — pulsing dot + expanding radar ripple */
.pill.live {
  position: relative;
  background: rgba(24,224,232,.16);
  border-color: rgba(24,224,232,.55);
  animation: liveRipple 2s ease-out infinite;
}
.pill.live::before {
  content: ""; display: inline-block; vertical-align: middle;
  width: 8px; height: 8px; margin: -2px 8px 0 0;
  border-radius: 50%; background: var(--volt);
  box-shadow: 0 0 8px var(--volt);
  animation: liveDot 2s ease-in-out infinite;
}
@keyframes liveRipple {
  0%   { box-shadow: 0 0 0 0 rgba(24,224,232,.5); }
  70%  { box-shadow: 0 0 0 14px rgba(24,224,232,0); }
  100% { box-shadow: 0 0 0 0 rgba(24,224,232,0); }
}
@keyframes liveDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(.82); }
}
@media (prefers-reduced-motion: reduce) {
  .pill.live, .pill.live::before { animation: none; }
}
.led {
  font-family: "Poppins", sans-serif; font-weight: 700;
  color: var(--gold); letter-spacing: .22em;
  text-shadow: 0 0 14px rgba(255,197,61,.6);
}
.count {
  font-family: "Poppins", sans-serif; font-size: 14px; font-weight: 600;
  background: rgba(255,197,61,.12); color: var(--gold);
  border: 1px solid rgba(255,197,61,.22);
  padding: 1px 11px; border-radius: 999px; margin-left: 10px;
}
.primary {
  background: var(--hot); color: #fff; border: none;
  font-weight: 700; letter-spacing: .3px;
  padding: 14px 22px; border-radius: 12px; font-size: 17px;
  box-shadow: 0 8px 24px rgba(255,46,151,.35);
  transition: transform .08s ease, filter .15s ease;
}
.primary:hover { filter: brightness(1.08); }
.primary:active { transform: translateY(1px); }
.primary.big { width: 100%; padding: 18px; font-size: 18px; margin-top: 14px; }
.ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 16px; font-weight: 600; font-size: 16px;
  transition: border-color .15s ease, background .15s ease;
}
.ghost:hover { border-color: var(--hot); background: rgba(255,46,151,.08); }
.empty { color: var(--muted); font-size: 16px; padding: 10px 2px; }

/* search field with inline icon */
.search-field {
  position: relative;
  margin-bottom: 14px;
}
.search-field input {
  width: 100%; background: var(--ink-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 48px 14px 16px; font-size: 18px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-field input::placeholder { color: var(--muted); }
.search-field input:focus { outline: none; border-color: var(--volt); box-shadow: 0 0 0 3px rgba(24,224,232,.18); }
.search-icon {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted);
  padding: 8px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  transition: color .15s ease;
}
.search-icon:hover { color: var(--volt); }
.search-field.sticky {
  position: sticky; top: 0; z-index: 5; padding: 10px 0;
  background: linear-gradient(var(--ink) 70%, transparent);
  margin-bottom: 10px;
}


/* results (shared) — flat list rows with hairline dividers, no cards */
.results { display: flex; flex-direction: column; }
.result {
  display: grid; grid-template-columns: 140px 1fr auto; gap: 14px; align-items: center;
  background: transparent; border: none; border-bottom: 1px solid rgba(255,255,255,.04); border-radius: 0;
  padding: 12px 6px; text-align: left; color: var(--text); width: 100%;
  transition: background .14s ease;
}
.result:last-child { border-bottom: none; }
.result:hover { background: rgba(255,255,255,.045); }
.result .r-add { transition: transform .14s ease; }
.result:hover .r-add { transform: scale(1.12); }
.result img { width: 140px; height: 79px; object-fit: cover; border-radius: 8px; }
.r-meta { display: flex; flex-direction: column; min-width: 0; }
.r-title { font-weight: 600; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-chan { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-add { font-size: 30px; color: var(--hot); font-weight: 700; padding-right: 10px; }
.load-more {
  width: 100%; padding: 14px; margin-top: 4px;
  background: var(--ink-3); color: var(--muted); border: 1px solid var(--line);
  border-radius: 12px; font-size: 15px; font-weight: 600;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.load-more:hover { color: var(--text); border-color: var(--volt); background: rgba(24,224,232,.08); }

/* queue (shared — remote uses vertical list) */
.rail-title {
  font-family: "Poppins", sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: .18em;
  font-size: 15px; color: var(--text-mid); margin-bottom: 14px; display: flex; align-items: center;
}
.queue { display: flex; flex-direction: column; gap: 8px; }
.queue li {
  display: grid; grid-template-columns: auto auto 1fr auto; gap: 12px; align-items: center;
  background: var(--ink-2); border-radius: 12px; padding: 10px 12px;
  border-left: 3px solid transparent;
}
.queue li:first-child { border-left-color: var(--volt); }
.queue li img { width: 80px; height: 45px; object-fit: cover; border-radius: 6px; }
.q-num { font-family: "Poppins", sans-serif; font-weight: 700; color: var(--gold); font-size: 16px; min-width: 28px; }
.q-meta { display: flex; flex-direction: column; min-width: 0; }
.q-title { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-by { color: var(--muted); font-size: 14px; }
.q-drag {
  cursor: grab; color: var(--muted); font-size: 18px; line-height: 1;
  touch-action: none; user-select: none; -webkit-user-select: none;
  padding: 4px 2px; opacity: .55; transition: opacity .15s ease, color .15s ease;
}
.q-drag:hover { opacity: 1; color: var(--volt); }
.dragging {
  opacity: .88; box-shadow: 0 12px 36px rgba(0,0,0,.6); z-index: 100;
}
.q-x { background: none; border: none; color: var(--muted); font-size: 16px; padding: 6px 8px; border-radius: 8px; }
.q-x:hover { color: var(--danger); background: rgba(255,92,122,.12); }

/* ======================= HOST — full viewport, no scroll ======================= */
#host {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px clamp(16px, 2.5vw, 36px);
}

.bar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.bar-right { display: flex; align-items: center; gap: 16px; }

/* QR toggle button in header */
.qr-toggle {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 16px;
  color: var(--text); font-size: 16px;
  transition: border-color .15s ease, background .15s ease;
}
.qr-toggle:hover { border-color: var(--volt); background: var(--ink-3); }
.qr-toggle svg { flex-shrink: 0; }
.qr-toggle-label { font-size: 15px; color: var(--muted); white-space: nowrap; }
.qr-toggle-label .led { font-size: 20px; margin-left: 2px; }

/* QR popup overlay */
.qr-popup-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(10,4,16,.8); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.qr-popup-overlay[hidden] { display: none; }
.qr-popup {
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 20px; padding: 40px 48px; text-align: center;
  position: relative; min-width: 340px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
.qr-popup-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; color: var(--muted); font-size: 20px;
  padding: 6px 10px; border-radius: 8px;
  transition: color .15s ease, background .15s ease;
}
.qr-popup-close:hover { color: var(--text); background: var(--ink-3); }
.qr-popup-title {
  font-weight: 800; font-size: 24px; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 24px; color: var(--text);
}
.qr-popup-code {
  display: inline-block; padding: 16px;
  background: #fff; border-radius: 14px;
  margin-bottom: 20px;
}
.qr-popup-code img, .qr-popup-code canvas { width: 200px !important; height: 200px !important; }
.qr-popup-room {
  font-size: 18px; color: var(--muted); margin-bottom: 24px;
}
.qr-popup-room .led { font-size: 32px; margin-left: 6px; }
.qr-popup-actions {
  display: flex; gap: 10px; justify-content: center;
}
.qr-popup-actions .ghost { font-size: 15px; padding: 12px 20px; }

/* --- Stage: fills all remaining height --- */
.stage {
  flex: 1 1 0;
  min-height: 0;          /* crucial — lets flex child shrink below content size */
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 22px;
}

/* --- Search panel (left, search field pinned, results scroll) --- */
.search-panel {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.search-panel .search-field {
  flex: 0 0 auto;
}
.search-panel .results {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-3) transparent;
}
.search-panel .results::-webkit-scrollbar { width: 6px; }
.search-panel .results::-webkit-scrollbar-track { background: transparent; }
.search-panel .results::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 3px; }
.search-panel .result {
  grid-template-columns: 120px 1fr auto;
}
.search-panel .result img { width: 120px; height: 68px; }

/* --- Screen column: player fills, queue pinned --- */
.screen {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}


.player-frame {
  position: relative;
  flex: 1 1 0;
  min-height: 0;             /* allow shrinking */
  width: 100%;
  background: #000; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.player-frame::before {
  content: ""; position: absolute; inset: 0; bottom: auto; height: 60px; z-index: 3;
  background: linear-gradient(to bottom, rgba(0,0,0,.85), transparent);
  pointer-events: none; opacity: 0;
  transition: opacity .25s ease;
}
.player-frame.transport-visible::before { opacity: 1; }
.player-frame::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: auto;
  opacity: .14;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.06) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}
#player, #player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; }
.idle {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: row;
  align-items: center; justify-content: center; gap: clamp(28px, 6vw, 84px);
  background: radial-gradient(600px 400px at 50% 40%, rgba(255,46,151,.12), transparent), var(--bg);
}
.idle-main {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
}
.idle-art { font-size: 72px; filter: drop-shadow(0 0 18px rgba(255,46,151,.5)); }
.idle h2 { font-family: "Poppins", sans-serif; font-weight: 800; font-size: 36px; margin: 8px 0 0; letter-spacing: .5px; }
.idle p { color: var(--muted); margin: 0; max-width: 420px; font-size: 18px; }

/* QR shown beside the idle text — invites phones to join while nothing plays */
.idle-qr { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.idle-qr-title {
  font-family: "Poppins", sans-serif; font-weight: 700; text-transform: uppercase;
  letter-spacing: .18em; font-size: 18px; color: var(--text-mid);
}
.idle-qr-code {
  background: #fff; padding: 14px; border-radius: 16px; line-height: 0;
  box-shadow: var(--shadow);
}
.idle-qr-code img, .idle-qr-code canvas { display: block; width: 180px !important; height: 180px !important; }
.idle-qr-room { font-size: 16px; color: var(--text-mid); }
.idle-qr-room .led { font-size: 26px; margin-left: 6px; }
.idle-qr-actions { display: flex; gap: 10px; margin-top: 4px; }
.idle-qr-actions .ghost { font-size: 14px; padding: 9px 16px; }

/* small legal / privacy link */
.legal { margin: 14px 0 0; text-align: center; }
.legal a { color: var(--text-mid); font-size: 13px; text-decoration: none; }
.legal a:hover { color: var(--volt); text-decoration: underline; }

/* Stack to text-only when the player is small/short (mobile/landscape phone) */
@media (max-width: 900px), (max-height: 560px) {
  .idle { flex-direction: column; gap: 8px; }
  .idle-qr { display: none; }
}


/* "Added by" / "Skipped by" floating label */
.added-by {
  position: absolute; top: 14px; left: 16px; z-index: 5;
  font-size: 15px; font-weight: 600; color: rgba(255,255,255,.85);
  text-shadow: 0 1px 6px rgba(0,0,0,.7);
  pointer-events: none;
  opacity: 0; transition: opacity .4s ease;
}
.added-by.visible { opacity: 1; }

/* transport overlay */
.transport-overlay {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 4; display: flex; gap: 10px;
  padding: 10px 16px; border-radius: 14px;
  background: rgba(11,13,12,.65); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.08);
  opacity: 0; transition: opacity .25s ease;
  pointer-events: none;
}
.player-frame.transport-visible .transport-overlay { opacity: 1; pointer-events: auto; }
.t-btn-float {
  background: rgba(28,32,35,.7); color: var(--text); border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; padding: 12px 20px; font-size: 18px; font-weight: 700;
  min-width: 56px; backdrop-filter: blur(6px);
  transition: border-color .14s ease, background .14s ease;
}
.t-btn-float:hover { border-color: var(--volt); background: rgba(28,32,35,.9); }
.t-btn-float.accent { background: var(--hot); border-color: transparent; color: #fff; letter-spacing: .6px; }
.t-btn-float.accent:hover { filter: brightness(1.12); }
.t-btn-float.active { border-color: var(--volt); background: rgba(24,224,232,.15); }

/* --- Queue strip — fixed at bottom of screen column --- */
.queue-strip {
  flex: 0 0 auto;
  margin-top: 10px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.queue-strip .rail-title { margin-bottom: 10px; }
.queue-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-3) transparent;
}
.queue-scroll::-webkit-scrollbar { height: 6px; }
.queue-scroll::-webkit-scrollbar-track { background: transparent; }
.queue-scroll::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 3px; }

.queue-card {
  flex: 0 0 180px;
  background: var(--ink-3);
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color .14s ease;
  position: relative;
}
.queue-card:first-child { border-color: var(--volt); }
.queue-card:hover { border-color: var(--hot); }
.queue-card img { width: 180px; height: 101px; object-fit: cover; }
.queue-card-info { padding: 8px 10px; }
.queue-card-num {
  font-family: "Poppins", sans-serif; font-weight: 700;
  color: var(--gold); font-size: 12px; margin-bottom: 2px;
}
.queue-card-title {
  font-weight: 600; font-size: 13px; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.queue-card-by {
  color: var(--muted); font-size: 12px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.queue-card .q-drag {
  position: absolute; top: 6px; left: 6px;
  background: rgba(11,13,12,.75); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px; padding: 2px 5px; font-size: 16px;
  opacity: 0; transition: opacity .15s ease;
}
.queue-card:hover .q-drag { opacity: .7; }
.queue-card .q-drag:hover { opacity: 1; }
.queue-card .q-x {
  position: absolute; top: 6px; right: 6px;
  background: rgba(11,13,12,.75); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px; padding: 4px 7px; font-size: 14px;
  opacity: 0; transition: opacity .15s ease;
}
.queue-card:hover .q-x { opacity: 1; }

/* theater mode */
.stage.theater { position: fixed; inset: 0; z-index: 30; background: #000; display: block; }
.stage.theater .search-panel { display: none; }
.stage.theater .queue-strip { display: none; }
#host.theater-active > .bar { display: none; }
.stage.theater .screen { height: 100%; }
.stage.theater .player-frame {
  flex: none; width: 100%; height: 100%;
  border-radius: 0; border: none;
}

/* backward compat */
.sheet { display: none; }
.sheet[hidden] { display: none; }
.idle[hidden] { display: none; }
#host[hidden], #remote[hidden] { display: none; }

/* ======================= REMOTE (phone — flex viewport, results scroll) ======================= */
#remote {
  max-width: 560px; margin: 0 auto; padding: 14px 16px 0;
  height: 100vh; overflow: hidden;
  display: flex; flex-direction: column;
}
.console {
  flex: 1 1 0; min-height: 0;
  display: flex; flex-direction: column;
}
.console > .np,
.console > .r-transport,
.console > .search-field { flex: 0 0 auto; }
#remote .results {
  flex: 1 1 0; min-height: 0; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent;
}
#remote .results::-webkit-scrollbar { width: 6px; }
#remote .results::-webkit-scrollbar-track { background: transparent; }
#remote .results::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 3px; }
.rbar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

.gate { text-align: center; padding: 12vh 6px 0; }
.gate h1 { font-family: "Poppins", sans-serif; font-weight: 800; font-size: 38px; letter-spacing: .5px; margin: 0 0 6px; }
.gate .muted { color: var(--muted); margin: 0 0 22px; font-size: 17px; }
.gate input {
  width: 100%; background: var(--ink-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; font-size: 19px; text-align: center;
}
.gate input:focus { outline: none; border-color: var(--hot); box-shadow: 0 0 0 3px rgba(255,46,151,.18); }
.gate-room { margin-top: 22px; color: var(--muted); font-size: 16px; }
.gate-room .led { font-size: 26px; margin-left: 6px; }

.np {
  background: linear-gradient(120deg, rgba(255,46,151,.14), rgba(24,224,232,.1));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 10px;
}
.np-k { font-family: "Poppins", sans-serif; font-size: 13px; letter-spacing: .2em; color: var(--volt); }
.np.paused .np-k::after { content: " · paused"; color: var(--muted); }
.np-title { font-family: "Poppins", sans-serif; font-weight: 800; font-size: 24px; line-height: 1.15; margin-top: 4px; }
.np-next { color: var(--muted); font-size: 15px; margin-top: 4px; }

.r-transport {
  display: flex; gap: 10px; margin-bottom: 14px;
}
.r-transport .t-btn {
  flex: 1; padding: 14px; font-size: 20px;
  background: var(--ink-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  font-weight: 700; transition: border-color .15s ease, background .15s ease;
}
.r-transport .t-btn:hover { border-color: var(--volt); background: var(--ink-3); }
.r-transport .t-btn:active { transform: translateY(1px); }
.r-transport .t-btn.accent { background: var(--hot); border-color: transparent; color: #fff; }
.r-transport .t-btn.accent:hover { filter: brightness(1.12); border-color: transparent; }

.r-queue-strip {
  flex: 0 0 auto;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  padding: 10px 14px;
  box-shadow: 0 -8px 30px rgba(0,0,0,.5);
}
.r-queue-strip .rail-title { font-size: 14px; margin-bottom: 6px; }
.r-queue-strip .empty { font-size: 13px; padding: 4px 0; }
.muted { color: var(--muted); }

/* ---------- replaced-session overlay ---------- */
.replaced-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(11,13,12,.92); backdrop-filter: blur(10px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 24px; padding: 24px;
}
.replaced-overlay p {
  color: var(--muted); font-size: 18px; line-height: 1.6; max-width: 400px;
}

/* ---------- idle-mode overlay ---------- */
.idle-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10,4,16,.94); backdrop-filter: blur(14px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 16px; padding: 24px;
}
.idle-overlay[hidden] { display: none; }
.idle-overlay-art { font-size: 80px; filter: drop-shadow(0 0 24px rgba(255,197,61,.4)); }
.idle-overlay h2 {
  font-family: "Poppins", sans-serif; font-weight: 800; font-size: 32px;
  color: var(--gold); margin: 0; letter-spacing: .5px;
}
.idle-overlay p { color: var(--muted); font-size: 18px; margin: 0; max-width: 400px; }
.idle-overlay .primary { margin-top: 10px; max-width: 320px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--ink-3); color: var(--text); border: 1px solid var(--hot);
  padding: 14px 22px; border-radius: 12px; font-size: 17px; font-weight: 600;
  z-index: 80; box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}

/* ---------- responsive ---------- */

/* Tablet-ish */
@media (max-width: 1200px) {
  .stage { grid-template-columns: 300px 1fr; }
  .queue-card { flex: 0 0 160px; }
  .queue-card img { width: 160px; height: 90px; }
}

/* Small tablet / large phone — stacked column: Player → Search → Queue */
@media (max-width: 900px) {
  #host { padding: 10px; padding-bottom: 72px; overflow: hidden; height: 100vh; }
  .stage {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 0;
  }
  .screen { display: contents; }

  /* Player — compact */
  .player-frame {
    order: 1;
    flex: none;
    aspect-ratio: 16 / 9;
    max-height: 40vh;
  }

  /* Smaller idle screen text */
  .idle-art { font-size: 48px; }
  .idle h2 { font-size: 22px; }
  .idle p { font-size: 14px; max-width: 280px; }

  /* Smaller transport buttons */
  .transport-overlay { padding: 6px 10px; gap: 6px; border-radius: 10px; bottom: 10px; }
  .t-btn-float { padding: 8px 14px; font-size: 14px; min-width: 40px; border-radius: 8px; }

  /* Search / Popular songs — prominent, fills remaining space */
  .search-panel {
    order: 2;
    display: flex;
    margin-top: 10px;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    border: none;
    background: transparent;
    padding: 0;
  }
  .search-panel .search-field input { font-size: 16px; padding: 12px 42px 12px 14px; }
  .search-panel .results {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
  }
  .search-panel .result {
    grid-template-columns: 100px 1fr auto;
  }
  .search-panel .result img { width: 100px; height: 56px; }

  /* Up Next — small, sticky at bottom */
  .queue-strip {
    order: 3;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    margin: 0;
    padding: 8px 12px;
    border-radius: 14px 14px 0 0;
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-bottom: none;
    box-shadow: 0 -8px 30px rgba(0,0,0,.5);
  }
  .queue-strip .rail-title { font-size: 14px; margin-bottom: 6px; }
  .queue-strip .count { font-size: 12px; padding: 1px 7px; }
  .queue-strip .empty { font-size: 13px; padding: 4px 0; }
  .queue-scroll { gap: 8px; }
  .queue-card { flex: 0 0 100px; }
  .queue-card img { width: 100px; height: 56px; }
  .queue-card-info { padding: 4px 6px; }
  .queue-card-title { font-size: 10px; }
  .queue-card-by { font-size: 9px; }
  .queue-card-num { font-size: 9px; }

  .wordmark { font-size: 28px; }
  .qr-toggle { padding: 8px 12px; }
  .qr-toggle-label { font-size: 13px; }
  .qr-toggle-label .led { font-size: 17px; }
}

/* Landscape phones — player-only (auto theater) */
@media (orientation: landscape) and (max-height: 500px) {
  #host { padding: 0; overflow: hidden; height: 100vh; }
  .bar { display: none; }
  .stage {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .screen { display: contents; }
  .search-panel { display: none !important; }
  .queue-strip { display: none; }
  .player-frame {
    width: 100%;
    height: 100vh;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
    border: none;
    flex: none;
  }
}

/* Phone */
@media (max-width: 600px) {
  /* Host */
  #host { padding: 8px; }
  .bar { margin-bottom: 8px; }
  .bar-right { gap: 8px; }
  .wordmark { font-size: 24px; }
  .pill { font-size: 12px; padding: 6px 10px; }
  .qr-toggle { padding: 6px 10px; gap: 6px; }
  .qr-toggle svg { width: 18px; height: 18px; }
  .qr-toggle-label { font-size: 12px; }
  .qr-toggle-label .led { font-size: 15px; }
  .queue-strip { padding: 6px 10px; }
  .queue-strip .rail-title { font-size: 13px; margin-bottom: 4px; }
  .queue-card { flex: 0 0 90px; }
  .queue-card img { width: 90px; height: 51px; }
  .queue-card-info { padding: 3px 5px; }
  .queue-card-title { font-size: 10px; }
  .queue-card-by { font-size: 9px; }
  .queue-card-num { font-size: 9px; }

  /* QR popup */
  .qr-popup { padding: 28px 24px; min-width: 0; width: calc(100vw - 32px); }
  .qr-popup-title { font-size: 20px; margin-bottom: 18px; }
  .qr-popup-code { padding: 12px; }
  .qr-popup-code img, .qr-popup-code canvas { width: 160px !important; height: 160px !important; }
  .qr-popup-room .led { font-size: 26px; }
  .qr-popup-actions { flex-direction: column; }
  .qr-popup-actions .ghost { width: 100%; text-align: center; }

  /* Remote */
  #remote { padding: 10px 12px 0; }
  .r-queue-strip { padding: 8px 10px; }
  .r-queue-strip .queue-scroll { gap: 8px; }
  .r-queue-strip .queue-card { flex: 0 0 100px; }
  .r-queue-strip .queue-card img { width: 100px; height: 56px; }
  .r-queue-strip .queue-card-info { padding: 4px 6px; }
  .r-queue-strip .queue-card-title { font-size: 10px; }
  .r-queue-strip .queue-card-by { font-size: 9px; }
  .r-queue-strip .queue-card-num { font-size: 9px; }
  .wordmark.small { font-size: 20px; }
  .rbar { margin-bottom: 10px; }
  .gate h1 { font-size: 30px; }
  .gate .muted { font-size: 15px; margin-bottom: 16px; }
  .gate input { padding: 14px; font-size: 17px; }
  .primary.big { padding: 16px; font-size: 16px; }
  .gate-room .led { font-size: 22px; }
  .np { padding: 12px 14px; }
  .np-title { font-size: 20px; }
  .np-next { font-size: 13px; }
  .r-transport .t-btn { padding: 12px; font-size: 18px; }
  .search-field input { padding: 12px 42px 12px 14px; font-size: 16px; }
  .result { grid-template-columns: 90px 1fr auto; gap: 10px; padding: 8px; }
  .result img { width: 90px; height: 51px; border-radius: 6px; }
  .r-title { font-size: 14px; }
  .r-chan { font-size: 12px; }
  .r-add { font-size: 24px; padding-right: 6px; }
  .load-more { padding: 12px; font-size: 14px; }
  .rail-title { font-size: 18px; }
  .queue li { gap: 8px; padding: 8px 10px; }
  .q-title { font-size: 14px; }
  .q-by { font-size: 12px; }
  .q-num { font-size: 14px; }
  .toast { font-size: 15px; padding: 12px 18px; bottom: 16px; }
}

/* ---------- accessibility ---------- */
:focus-visible { outline: 2px solid var(--volt); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .primary { transition: none; }
}
