/* ==========================================================================
   PerfectPitch Party Hub — editorial party-magazine voice.
   Paper bedrock, coral hero, lime live indicator, mono kickers, serif headlines.
   ========================================================================== */

/* ------------------------ Type system (Google Fonts) ------------------------ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..900;1,9..144,300..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500;600&display=swap');

/* ------------------------------- Tokens ------------------------------------ */

:root {
  /* Bedrock */
  --paper: #F7F4EE;
  --paper-warm: #EFEAE0;
  --paper-surface: #FFFFFF;
  --ink: #0B0B0F;
  --ink-55: rgba(11, 11, 15, 0.55);
  --ink-35: rgba(11, 11, 15, 0.35);
  --ink-20: rgba(11, 11, 15, 0.20);
  --ink-10: rgba(11, 11, 15, 0.10);
  --ink-08: rgba(11, 11, 15, 0.08);

  /* Accents */
  --coral:        #FF6B4D;
  --coral-deep:   #C74530;
  --lime:         #C7F26B;
  --lime-deep:    #66A028;
  --sky:          #6BBDF0;
  --plum:         #803375;
  --amber:        #E1BD3B;
  --error:        #EB3333;

  /* Type */
  --serif: "Fraunces", "Source Serif Pro", Georgia, serif;
  --sans:  "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono:  "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  /* Surfaces */
  --bg: var(--paper);
  --surface: var(--paper-surface);
  --text: var(--ink);
  --text-secondary: var(--ink-55);
  --text-tertiary: var(--ink-35);
  --separator: var(--ink-08);
  --separator-strong: var(--ink-20);

  /* Shape */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0B0F;
    --surface: #16161C;
    --text: #F7F4EE;
    --text-secondary: rgba(247, 244, 238, 0.55);
    --text-tertiary: rgba(247, 244, 238, 0.35);
    --separator: rgba(247, 244, 238, 0.10);
    --separator-strong: rgba(247, 244, 238, 0.20);
  }
}

/* ------------------------------ Reset & base ------------------------------- */

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

html, body {
  height: 100%;
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

/* Screen swapping ----------------------------------------------------------- */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow-y: auto;
  background: var(--bg);
}

.screen.active {
  display: flex;
}

/* ------------------------------- Helpers ----------------------------------- */

.kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.empty-message {
  color: var(--text-tertiary);
  font-size: 0.95rem;
  text-align: center;
}

/* =========================================================================
   SETUP SCREEN — minimal editorial cover
   ========================================================================= */

#screen-setup {
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.setup-container {
  text-align: center;
  padding: 3rem;
  max-width: 540px;
  position: relative;
}

.setup-container::before {
  content: "PARTY HUB · WEB EDITION";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--coral);
  font-weight: 600;
}

.logo {
  font-family: var(--serif);
  font-size: clamp(3.25rem, 7vw, 5.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 0.95;
  color: var(--text);
  margin-top: 2.5rem;
  font-feature-settings: "ss01";
}

.logo::after {
  content: "";
  display: block;
  width: 64px;
  height: 3px;
  background: var(--coral);
  margin: 1.25rem auto 0;
}

.subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--coral);
  margin-top: 1rem;
  margin-bottom: 2.5rem;
}

/* =========================================================================
   BUTTONS
   ========================================================================= */

.btn {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.85rem 1.6rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--coral);
  color: white;
  box-shadow: 0 6px 18px rgba(255, 107, 77, 0.28);
}
.btn-primary:hover:not(:disabled) {
  background: var(--coral-deep);
  box-shadow: 0 8px 22px rgba(199, 69, 48, 0.32);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--separator);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--paper-warm);
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid currentColor;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(235, 51, 51, 0.08);
}

.btn-large {
  font-size: 1.05rem;
  padding: 1rem 2.4rem;
}

/* =========================================================================
   LOBBY SCREEN
   ========================================================================= */

#screen-lobby {
  flex-direction: column;
  background: var(--bg);
  padding: 0;
}

.lobby-bg {
  display: none; /* No more dark gradient backdrop — paper is the hero */
}

.lobby-content {
  position: relative;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem clamp(1.5rem, 4vw, 3.5rem) 8rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.lobby-title {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 4.25rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 0.95;
  color: var(--text);
}

.lobby-title::before {
  content: "TONIGHT'S ROOM";
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--coral);
  margin-bottom: 0.65rem;
  text-transform: uppercase;
}

.lobby-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  flex: 1;
}

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

.lobby-left,
.lobby-right {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Room code section ------------------------------------------------------- */

.room-code-section {
  position: relative;
  background: linear-gradient(135deg, var(--coral) 0%, var(--plum) 100%);
  border-radius: var(--radius-xl);
  padding: 2rem;
  color: white;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Decorative waveform overlay */
.room-code-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 8px,
      rgba(255, 255, 255, 0.05) 8px,
      rgba(255, 255, 255, 0.05) 9px
    );
  pointer-events: none;
}

.room-code-section::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(255, 255, 255, 0.18), transparent 60%);
  pointer-events: none;
}

.room-code-label {
  position: relative;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.room-code-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 12px var(--lime);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.35); }
}

.room-code-cards {
  position: relative;
  display: flex;
  gap: 0.85rem;
  margin: 0.5rem 0 0.25rem;
}

.code-letter {
  font-family: var(--mono);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 600;
  color: white;
  letter-spacing: 0.06em;
  min-width: 1ch;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Editorial: just the typography itself, no boxes or glow */
}

.room-code-hint {
  position: relative;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
}

/* Player avatars ---------------------------------------------------------- */

.players-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--separator);
  padding: 1.25rem;
}

.player-avatars {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  min-height: 56px;
  align-items: center;
}

.player-avatar {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.75rem 0.4rem 0.4rem;
  background: var(--paper-warm);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--separator);
  transition: transform 120ms ease;
}

.player-avatar:hover { transform: translateY(-1px); }

.avatar-initial {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.75rem;
  font-family: var(--mono);
}

.player-count-line {
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* Singing mode ------------------------------------------------------------ */

.singing-mode-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.singing-mode-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.singing-mode-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.mode-btn {
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--sans);
  color: var(--text);
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.mode-btn:hover { border-color: var(--separator-strong); }
.mode-btn:active { transform: translateY(1px); }

.mode-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.mode-btn .mode-icon { font-size: 1.4rem; line-height: 1; }
.mode-btn .mode-text { font-size: 0.8rem; font-weight: 500; }

/* Song queue -------------------------------------------------------------- */

.queue-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.queue-header h2 {
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}

.queue-counter {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  background: var(--paper-warm);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.song-queue {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--separator);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 200px;
  max-height: 540px;
  overflow-y: auto;
}

.queue-empty-state {
  margin: auto;
  text-align: center;
  color: var(--text-tertiary);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.queue-empty-icon { font-size: 2.4rem; }

.queue-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  background: var(--paper-warm);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: border-color 120ms ease;
}

.queue-item:hover { border-color: var(--separator); }

.queue-item.current {
  border-color: var(--coral);
  background: rgba(255, 107, 77, 0.06);
}

.queue-item-number {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-tertiary);
  width: 22px;
  flex-shrink: 0;
}

.queue-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.queue-item-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.queue-item-suggester {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

/* Lobby actions ----------------------------------------------------------- */

.lobby-actions {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--separator);
  padding: 0.5rem;
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10);
  z-index: 10;
}

.action-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.action-pill:active { transform: translateY(1px); }
.action-pill:disabled { opacity: 0.4; cursor: not-allowed; }

.action-start {
  background: var(--coral);
  color: white;
}
.action-start:hover:not(:disabled) { background: var(--coral-deep); }

.action-reset {
  background: transparent;
  color: var(--text-secondary);
}
.action-reset:hover { background: var(--paper-warm); color: var(--text); }

.pill-icon { font-size: 1.05rem; }

/* =========================================================================
   PLAYING SCREEN
   ========================================================================= */

#screen-playing {
  flex-direction: column;
  background: var(--bg);
  padding: 1.5rem clamp(1.5rem, 3vw, 3rem) 0;
}

.playing-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--separator);
}

.now-playing-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.now-playing-info::before {
  content: "NOW PLAYING";
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--coral);
}

.now-playing-title {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--text);
}

.now-playing-artist {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--coral);
}

.playback-time {
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.playing-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  padding-top: 1.5rem;
  min-height: 0;
}

@media (max-width: 920px) {
  .playing-body { grid-template-columns: 1fr; }
}

/* Lyrics ------------------------------------------------------------------ */

.lyrics-container {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  border-radius: var(--radius-lg);
}

.lyrics-display {
  font-family: var(--serif);
  text-align: center;
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.5rem;
}

.lyric-line {
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  font-weight: 400;
  line-height: 1.25;
  color: var(--text-tertiary);
  transition: opacity 250ms ease, color 250ms ease, font-size 250ms ease, transform 250ms ease;
  opacity: 0.5;
}

.lyric-line.active {
  font-size: clamp(2rem, 3.6vw, 3rem);
  font-weight: 500;
  color: var(--text);
  opacity: 1;
}

.lyric-line.active em,
.lyric-line.active .accent {
  font-style: italic;
  color: var(--coral);
}

/* Scoreboard sidebar ------------------------------------------------------ */

.scoreboard-sidebar {
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.scoreboard-sidebar h3,
.scoreboard-sidebar h4 {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.live-scores {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: var(--paper-warm);
  border-radius: var(--radius-md);
}

.score-row .name {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.score-row .score {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--coral);
}

/* Stem mixer (compact) ---------------------------------------------------- */

.stem-mixer h4 { margin-top: 0; }

.stem-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
}

.stem-row .stem-name {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  min-width: 4.5rem;
}

.stem-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: var(--separator);
  border-radius: 2px;
  outline: none;
}

.stem-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--coral);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(255, 107, 77, 0.4);
}

.stem-row input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--coral);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(255, 107, 77, 0.4);
}

.stem-row .stem-mute {
  background: transparent;
  border: 1px solid var(--separator);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 120ms ease;
}

.stem-row .stem-mute.muted {
  background: var(--ink-08);
  color: var(--text);
}

/* Playing controls -------------------------------------------------------- */

.playing-controls {
  padding: 1rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-top: 1px solid var(--separator);
}

.progress-bar-container { width: 100%; }

.progress-bar {
  height: 4px;
  background: var(--separator);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--coral) 0%, var(--plum) 100%);
  border-radius: 2px;
  width: 0%;
  transition: width 100ms linear;
}

.control-buttons {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* =========================================================================
   RESULTS SCREEN
   ========================================================================= */

#screen-results {
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.results-container {
  text-align: center;
  max-width: 720px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.results-container h2 {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
}

.results-container h2::before {
  content: "EDITION CLOSED";
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--coral);
  margin-bottom: 0.5rem;
}

.final-scores {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.final-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  text-align: left;
}

.final-score-row.top-1 {
  background: linear-gradient(135deg, rgba(255, 107, 77, 0.10) 0%, rgba(128, 51, 117, 0.10) 100%);
  border-color: var(--coral);
}

.final-score-row .rank {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  min-width: 2.5rem;
}

.final-score-row .name {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  flex: 1;
  margin-left: 1rem;
  color: var(--text);
}

.final-score-row .score {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--coral);
}

.results-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* =========================================================================
   JS-EMITTED CLASSES — match exact class names produced by app.js / stem-mixer.js
   ========================================================================= */

/* Player avatars (lobby) — circle + emoji + status badge */
.avatar-circle {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  border: 1px solid var(--separator);
}
.avatar-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: white;
  border: 2px solid var(--surface);
}
.avatar-badge.ready { background: var(--lime-deep); }
.avatar-badge.receiving { background: var(--coral); }
.avatar-name {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  text-align: center;
}

/* Queue-counter "full" warning state */
.queue-counter.full {
  color: white;
  background: var(--coral);
}

/* Song queue rows — new editorial markup */
.song-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  background: var(--paper-warm);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: border-color 120ms ease;
}
.song-row:hover { border-color: var(--separator); }

.song-position {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-tertiary);
  width: 22px;
  flex-shrink: 0;
}
.song-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.song-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.song-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.song-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.song-status-icon {
  width: 24px;
  text-align: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.song-status-icon.ready { color: var(--lime-deep); }
.song-status-icon.transferring { color: var(--coral); }
.song-status-icon.playing { color: var(--plum); }
.song-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}
.song-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--separator);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.song-action-btn:hover {
  border-color: var(--coral);
  color: var(--coral);
}
.song-action-btn.move:hover { color: var(--text); border-color: var(--separator-strong); }

/* Stem mixer — match JS-emitted class names */
.stem-mute-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--separator);
  background: var(--surface);
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 120ms ease, opacity 120ms ease, border-color 120ms ease;
}
.stem-mute-btn:hover { border-color: var(--separator-strong); }
.stem-mute-btn.muted {
  background: var(--ink-08);
  border-color: var(--separator-strong);
  opacity: 0.45;
}
.stem-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.stem-label {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}
.stem-sublabel {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}
.stem-slider { flex: 1.4; }
.stem-value {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  min-width: 28px;
  text-align: right;
}

/* Live scoreboard rows */
.score-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--paper-warm);
}
.score-name {
  flex: 1;
  font-family: var(--sans);
  font-weight: 500;
  color: var(--text);
}
.score-grade {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 0.95rem;
  color: white;
}
.score-grade.S, .score-grade.A { background: var(--lime-deep); }
.score-grade.B { background: var(--plum); }
.score-grade.C { background: var(--coral); }
.score-grade.D, .score-grade.F { background: var(--ink-55); }
.score-value {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--text);
  min-width: 56px;
  text-align: right;
}

/* Final results — JS uses .final-score-rank/.first/.second/.third + .final-score-name + .final-score-points */
.final-score-rank {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  min-width: 2.5rem;
}
.final-score-rank.first { color: var(--coral); font-size: 1.1rem; }
.final-score-rank.second { color: var(--plum); }
.final-score-rank.third { color: var(--lime-deep); }
.final-score-name {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  flex: 1;
  margin-left: 1rem;
  color: var(--text);
}
.final-score-points {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--coral);
}

/* =========================================================================
   FOCUS — keyboard accessibility (WCAG 2.4.7)
   ========================================================================= */

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.btn:focus-visible,
.action-pill:focus-visible,
.mode-btn:focus-visible,
.song-action-btn:focus-visible,
.stem-mute-btn:focus-visible {
  outline-offset: 3px;
}
.stem-row input[type="range"]:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 4px;
}

/* =========================================================================
   SCROLLBARS — soft, on-paper
   ========================================================================= */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-10); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-20); }

/* ---- Room QR code (TV screens: phones scan to join) ---- */
.room-qr {
  width: 140px;
  height: 140px;
  margin: 14px auto 0;
  padding: 8px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}
.room-qr:empty {
  display: none;
}
.room-qr svg {
  display: block;
  width: 100%;
  height: 100%;
}
.room-qr:empty + .room-qr-hint {
  display: none;
}

/* Dark mode: --paper-warm stays light, so chips that pair it with --text need
   a dark fill. Kept last so it outranks the base rules above. */
@media (prefers-color-scheme: dark) {
  .player-avatar,
  .queue-counter:not(.full) { background: rgba(247, 244, 238, 0.08); }
}
