/* Music Deck — dark "listening room" shell, with a vinyl deck for the player. */

:root {
  --bg: #0e0c16;
  --bg-2: #171326;
  --panel: rgba(255, 255, 255, 0.05);
  --panel-2: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --ink: #f3f0ff;
  --ink-dim: #a79fc4;
  --hot: #ff4d8d;
  --hot-2: #7c5cff;
  --gold: #ffcc57;
  --good: #47e08b;
  --bad: #ff5a6a;
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 700px at 12% -10%, #2a1c4d 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 0%, #4a1436 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100%;
  padding-bottom: 40px;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* ============ Top bar ============ */

#topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px max(14px, 3vw);
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(14, 12, 22, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.back-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 10px;
}
.back-link:hover { background: var(--panel-2); }

#brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  display: flex;
  gap: 8px;
  align-items: center;
}
#brand span {
  background: linear-gradient(90deg, var(--hot), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

#topbar-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

select, .ghost-btn, .big-btn, input, button { font-family: inherit; }

#country-select {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 0.85rem;
  cursor: pointer;
}
#country-select option { background: #1b1730; color: var(--ink); }

.ghost-btn {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.ghost-btn:hover { background: var(--panel-2); }

#btn-quiz {
  background: linear-gradient(90deg, var(--hot), var(--hot-2));
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(255, 77, 141, 0.3);
}

/* ============ Browse ============ */

#browse { max-width: 1080px; margin: 0 auto; padding: 18px max(14px, 3vw) 0; }

#search-row { display: flex; gap: 8px; align-items: center; }

#search-input {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 13px 18px;
  color: var(--ink);
  font-size: 1rem;
  outline: none;
}
#search-input::placeholder { color: var(--ink-dim); }
#search-input:focus { border-color: var(--hot); background: var(--panel-2); }

#genre-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 2px 4px;
  scrollbar-width: none;
}
#genre-bar::-webkit-scrollbar { display: none; }

.genre-chip {
  flex: 0 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.genre-chip:hover { transform: translateY(-2px); color: var(--ink); }
.genre-chip.active {
  background: linear-gradient(90deg, var(--hot), var(--hot-2));
  border-color: transparent;
  color: #fff;
}

#list-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 18px 2px 12px;
}
#list-title { font-size: 1.5rem; letter-spacing: -0.02em; }
#list-sub { color: var(--ink-dim); font-size: 0.85rem; }

.status { color: var(--ink-dim); padding: 26px 4px; text-align: center; }
.status.error { color: var(--bad); }

#track-list { display: flex; flex-direction: column; gap: 6px; }

.track {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 8px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  width: 100%;
}
.track:hover { background: var(--panel-2); border-color: var(--line); }
.track.playing { border-color: var(--hot); background: rgba(255, 77, 141, 0.12); }

.track-rank {
  width: 26px;
  text-align: center;
  font-weight: 800;
  color: var(--ink-dim);
  font-size: 0.9rem;
  flex: 0 0 auto;
}
.track.playing .track-rank { color: var(--hot); }

.track-art {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  object-fit: cover;
  background: #221c38;
  flex: 0 0 auto;
}

.track-meta { min-width: 0; flex: 1; }
.track-name {
  font-weight: 700;
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-artist {
  color: var(--ink-dim);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-genre {
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
}
@media (max-width: 560px) { .track-genre { display: none; } }

/* ============ The deck (player) ============ */

#player {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(14px, 3vw);
  background: rgba(8, 6, 14, 0.72);
  backdrop-filter: blur(10px);
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } }

/* The sketch: one wide rounded box, record on the left, everything else
   stacked on the right — title up top, transport in the middle, tags along
   the bottom. */
#deck {
  position: relative;
  width: min(920px, 100%);
  display: grid;
  /* Never below 240px: YouTube's terms require an embedded player be visible
     and at least 200x200, and this column is what holds it. */
  grid-template-columns: minmax(240px, 40%) 1fr;
  gap: clamp(16px, 4vw, 40px);
  align-items: center;
  padding: clamp(20px, 4vw, 40px);
  border-radius: 26px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(150deg, #1d1730, #241635 60%, #30162e);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: pop 0.25s cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }

#deck-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
#deck-close:hover { color: var(--ink); background: var(--panel-2); }

#stage { position: relative; min-width: 0; }

#record-wrap { position: relative; aspect-ratio: 1; }

/* --- full-song panel --- */

#video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}
#yt-frame, #yt-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 1;
  /* The player takes no mouse input at all: no hover chrome, no click-through
     to YouTube. The deck's own ▶/⏸ drives it through the IFrame API. */
  pointer-events: none;
}
/* Second layer of the wall: even if a browser ignores pointer-events on the
   frame, this catches the event first. It does nothing with it. */
#video-shield {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: transparent;
  cursor: default;
}

#video-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px;
  font-size: 0.85rem;
  color: var(--ink-dim);
  background: #0d0b14;
}
#video-wrap.ready #video-loading { display: none; }

#title-row { display: flex; align-items: center; gap: 12px; }

/* The vinyl motif survives in full-song mode as a small spinning disc. */
#mini-record {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  display: none;
  background:
    repeating-radial-gradient(circle at 50% 50%, #0a0a0d 0 2px, #17171e 2px 3px, #0a0a0d 3px 5px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 4px 12px rgba(0, 0, 0, 0.5);
  animation: spin 4s linear infinite;
  animation-play-state: paused;
  cursor: pointer;
}
#mini-record.on { display: block; }
#mini-record.spinning { animation-play-state: running; }
#mini-art {
  width: 46%;
  height: 46%;
  margin: 27%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

#source-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: -4px; }

.src-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.src-btn:hover { background: var(--panel-2); }
.src-btn.full { border-color: rgba(255, 77, 141, 0.6); color: #ff9dbe; }

#source-note { font-size: 0.75rem; color: var(--ink-dim); min-width: 0; }

/* ---- lyrics ---- */

#lyrics-panel {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  max-height: 210px;
  overflow-y: auto;
  scrollbar-width: thin;
}
#lyrics-status { color: var(--ink-dim); font-size: 0.85rem; text-align: center; padding: 8px 0; }
#lyrics-lines { display: flex; flex-direction: column; gap: 2px; text-align: center; }

.lyric {
  font-size: 1rem;
  line-height: 1.5;
  padding: 3px 6px;
  border-radius: 8px;
  color: var(--ink-dim);
  transition: color 0.25s ease, transform 0.25s ease;
}
.lyric.blank { min-height: 10px; }
/* Only the synced view marks a line; a plain lyric sheet stays evenly lit. */
.lyric.active {
  color: var(--ink);
  font-weight: 700;
  transform: scale(1.04);
  text-shadow: 0 0 22px rgba(255, 77, 141, 0.45);
}
.lyric.sung { color: rgba(167, 159, 196, 0.55); }
#lyrics-lines.plain .lyric { color: var(--ink); opacity: 0.85; }

#record {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 50% 50%,
      #0a0a0d 0 3px, #16161c 3px 4px, #0a0a0d 4px 7px),
    #0a0a0d;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 18px 40px rgba(0, 0, 0, 0.55),
    inset 0 0 60px rgba(0, 0, 0, 0.7);
  display: grid;
  place-items: center;
  animation: spin 4s linear infinite;
  animation-play-state: paused;
  cursor: pointer;
}
#record.spinning { animation-play-state: running; }
#record-wrap:hover #record,
#mini-record:hover { box-shadow: 0 0 0 2px var(--hot), 0 18px 40px rgba(0, 0, 0, 0.55); }
@keyframes spin { to { transform: rotate(360deg); } }

/* The sheen that makes it read as vinyl rather than a black circle. It has to
   sit outside the spin so the highlight stays put while the record turns. */
#record-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: linear-gradient(115deg,
    rgba(255, 255, 255, 0.16) 0%, transparent 28%,
    transparent 62%, rgba(255, 255, 255, 0.09) 78%, transparent 92%);
}

#record-label {
  width: 44%;
  height: 44%;
  border-radius: 50%;
  overflow: hidden;
  background: #2a2340;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6), 0 0 22px rgba(0, 0, 0, 0.5);
}
#record-art { width: 100%; height: 100%; object-fit: cover; display: block; }

#record-hole {
  position: absolute;
  width: 6%;
  height: 6%;
  border-radius: 50%;
  background: #16121f;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.9);
}

/* The arm pivots from the top-right of the platter. Parked it swings clear of
   the disc; playing, the tip comes to rest about two-thirds out from the
   centre — roughly where a needle actually sits. z-index lifts it above the
   sheen, which is a later sibling and would otherwise wash it out. */
#tonearm {
  position: absolute;
  top: 6%;
  left: 78%;
  width: 6%;
  height: 58%;
  z-index: 2;
  border-radius: 999px;
  background: linear-gradient(180deg, #e6e3f2, #8e88a8);
  transform-origin: 50% 6%;
  transform: rotate(24deg);
  transition: transform 0.55s cubic-bezier(0.3, 1.3, 0.5, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
}
#tonearm.down { transform: rotate(-4deg); }

/* pivot bearing */
#tonearm::before {
  content: "";
  position: absolute;
  top: -18%;
  left: -55%;
  width: 210%;
  height: 26%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #f2f0f8, #7d7796);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

/* headshell + needle */
#tonearm::after {
  content: "";
  position: absolute;
  bottom: -6%;
  left: -35%;
  width: 170%;
  height: 14%;
  border-radius: 3px;
  background: linear-gradient(180deg, #cfcbe0, #6f6a88);
  transform: rotate(-14deg);
}

#deck-info { min-width: 0; display: flex; flex-direction: column; gap: clamp(10px, 2vw, 18px); }

#deck-title {
  font-size: clamp(1.3rem, 3.6vw, 2.3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
#deck-underline {
  height: 4px;
  margin-top: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--hot));
}

#transport { display: flex; align-items: center; justify-content: center; gap: clamp(10px, 3vw, 22px); }

#transport button {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 50%;
  width: 46px;
  height: 46px;
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease;
}
#transport button:hover { transform: scale(1.08); background: var(--panel-2); }

#btn-play {
  width: 68px !important;
  height: 68px !important;
  font-size: 1.6rem !important;
  background: linear-gradient(140deg, var(--hot), var(--hot-2)) !important;
  border-color: transparent !important;
  box-shadow: 0 10px 26px rgba(255, 77, 141, 0.35);
  /* The play glyph is optically left-heavy; nudge it back to centre. */
  padding-left: 4px;
}
#btn-play.playing { padding-left: 0; }

#seek-row { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
#time-now, #time-total { font-size: 0.8rem; color: var(--ink-dim); min-width: 34px; }
#time-total { text-align: right; }

#seek {
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
}
#seek-buf { position: absolute; inset: 0; width: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.1); }
#seek-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--hot));
}
#seek-knob {
  position: absolute;
  right: -6px;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

#preview-note { font-size: 0.72rem; color: var(--ink-dim); text-align: center; margin-top: -6px; }

#deck-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-dim);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-topic { border-color: rgba(255, 204, 87, 0.5); color: var(--gold); }
.tag-genre { border-color: rgba(124, 92, 255, 0.6); color: #b8a6ff; }
.tag-artist { border-color: rgba(255, 77, 141, 0.5); color: #ff9dbe; }

/* Phones: the record goes on top, everything keeps the same order otherwise. */
@media (max-width: 620px) {
  #deck { grid-template-columns: 1fr; }
  #record-wrap { width: min(58vw, 240px); margin: 0 auto; }
  #tonearm { display: none; }
  #title-row { justify-content: center; }
  #deck-title { text-align: center; }
  #source-row { justify-content: center; }
  #deck-tags { justify-content: center; }
}

/* ============ Guess the Track ============ */

#quiz {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, 3vw);
  background: rgba(8, 6, 14, 0.85);
  backdrop-filter: blur(12px);
  overflow-y: auto;
}

#quiz-card {
  position: relative;
  width: min(620px, 100%);
  background: linear-gradient(160deg, #1d1730, #2a1533);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: clamp(20px, 4vw, 34px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  margin: auto;
}

#quiz-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font-size: 1.3rem;
  cursor: pointer;
}
#quiz-close:hover { color: var(--ink); }

#quiz h2 { font-size: 1.6rem; letter-spacing: -0.02em; }
.quiz-tag { color: var(--ink-dim); font-size: 0.92rem; margin: 8px 0 18px; }
.quiz-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  margin: 16px 0 8px;
}

#quiz-genres { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button, #quiz-genres button {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
}
.seg button.active, #quiz-genres button.active {
  background: linear-gradient(90deg, var(--hot), var(--hot-2));
  border-color: transparent;
  color: #fff;
}

.big-btn {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 15px;
  border: none;
  border-radius: 16px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(90deg, var(--hot), var(--hot-2));
  box-shadow: 0 12px 30px rgba(255, 77, 141, 0.3);
}
.big-btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }

.quiz-best { margin-top: 12px; text-align: center; color: var(--gold); font-size: 0.86rem; }

#quiz-hud { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pill {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.82rem;
  font-weight: 700;
}

/* While the clip plays, the artwork is a blur behind a spinning blank record —
   enough motion to feel alive, not enough to give the answer away. */
#q-artwrap {
  position: relative;
  width: min(190px, 46vw);
  aspect-ratio: 1;
  margin: 20px auto 14px;
}
#q-art {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  filter: blur(22px) saturate(1.5);
  opacity: 0.55;
  transition: filter 0.6s ease, opacity 0.6s ease;
}
#q-artwrap.revealed #q-art { filter: none; opacity: 1; }
#q-vinyl {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at 50% 50%,
    rgba(10, 10, 13, 0.92) 0 3px, rgba(30, 30, 40, 0.92) 3px 4px, rgba(10, 10, 13, 0.92) 4px 7px);
  animation: spin 3s linear infinite;
  transition: opacity 0.5s ease;
}
#q-artwrap.revealed #q-vinyl { opacity: 0; }

#q-timerbar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-bottom: 16px;
}
#q-timerfill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--good), var(--gold), var(--bad));
}

#q-choices { display: grid; gap: 9px; }
.choice {
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.3;
}
.choice:hover:not(:disabled) { background: var(--panel-2); border-color: var(--hot); }
.choice:disabled { cursor: default; }
.choice.right { background: rgba(71, 224, 139, 0.18); border-color: var(--good); color: #b6ffd6; }
.choice.wrong { background: rgba(255, 90, 106, 0.16); border-color: var(--bad); color: #ffc3c9; }

#q-feedback { text-align: center; min-height: 26px; margin-top: 12px; font-weight: 700; }
#q-feedback.good { color: var(--good); }
#q-feedback.bad { color: var(--bad); }

#qr-detail { color: var(--ink-dim); margin: 8px 0 16px; }
#qr-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.qr-row {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.86rem;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--panel);
}
.qr-row img { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; }
.qr-row .qr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quiz-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
.quiz-actions .big-btn { margin-top: 0; }

/* ============ Toast ============ */

#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 90;
  background: rgba(20, 16, 34, 0.96);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  #record, #q-vinyl { animation: none; }
  #deck, #player { animation: none; }
}

/* ================= mini player =================

   Closing the deck while something is playing shrinks it into a corner card
   instead of stopping the music. The deck is restyled where it stands rather
   than moved in the DOM: reparenting the YouTube iframe reloads it, which
   would restart the song. The video stays visible and no smaller than
   200x200, which is what YouTube's terms require of an embedded player. */

#player.mini {
  position: fixed;
  inset: auto 14px 14px auto;
  padding: 0;
  background: none;
  backdrop-filter: none;
  pointer-events: none;            /* the list behind stays clickable */
  animation: none;
}
#player.mini #deck {
  pointer-events: auto;
  width: min(360px, calc(100vw - 28px));
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
  border-width: 2px;
  border-radius: 16px;
  animation: none;
}
#player.mini #video-wrap { min-height: 202px; }
#player.mini #record-wrap { width: 92px; margin: 0 auto; }
#player.mini #tonearm { display: none; }

/* Only the title and the transport survive the shrink. */
#player.mini #deck-underline,
#player.mini #source-row,
#player.mini #seek-row,
#player.mini #preview-note,
#player.mini #deck-tags,
#player.mini #lyrics-panel,
#player.mini #mini-record { display: none !important; }

#player.mini #deck-info { gap: 6px; }
#player.mini #deck-title {
  font-size: 0.92rem;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#player.mini #transport { gap: 10px; justify-content: flex-start; }
#player.mini #transport button { width: 34px; height: 34px; font-size: 0.8rem; }
#player.mini #btn-play {
  width: 42px !important;
  height: 42px !important;
  font-size: 1rem !important;
}
#player.mini #deck-close { top: 6px; right: 8px; font-size: 1rem; }

#btn-expand {
  position: absolute;
  top: 6px;
  right: 34px;
  display: none;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  z-index: 5;
}
#player.mini #btn-expand { display: block; }
#btn-expand:hover { color: var(--ink); background: var(--panel-2); }

@media (max-width: 620px) {
  #player.mini { inset: auto 10px 10px 10px; }
  #player.mini #deck { width: 100%; }
}
