@font-face {
  font-family: 'Stefan';
  src: url('../fonts/ABCStefan-Simple.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

/* ── stacked background lyric duplicates (single shared filter) ── */
#lyrics-bg-group {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  filter: url(#lyrics-turb);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  opacity: 0.5;
  transition: opacity 1.2s ease;
}

#lyrics-bg-group.song-ended { opacity: 0; }

.lyric-bg-line {
  width: 100%;
  text-align: center;
  color: #fff;
  opacity: 1;
  font-family: 'Stefan', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 300;
  letter-spacing: 0.06em;
  line-height: 1;
  font-size: var(--step-3);
  white-space: nowrap;
}

.lyric-bg-line.exiting {
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* ── lyrics ── */
#lyrics {
  position: fixed;
  top: 2%;
  left: 0;
  width: 100%;
  text-align: center;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
  padding: 0 24px;
  filter: url(#lyrics-turb);
  opacity: 0.5;
  transition: opacity 1.2s ease;
}

#lyrics.song-ended { opacity: 0; }

.lyric-line {
  font-family: 'Stefan', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0,0,0,0.6);
  line-height: 1.6;
  font-size: var(--step-3);
  white-space: nowrap;
}

.lyric-fit {
  display: inline-block;
  vertical-align: top;
  transform-origin: center top;
  white-space: nowrap;
  line-height: 1;
}

#lyric-current.exiting {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lyric-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(var(--slide, 14px));
  animation: word-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes word-in {
  from { opacity: 0; transform: translateY(var(--slide, 14px)); }
  to   { opacity: .9; transform: translateY(0); }
}

.lyric-word-static {
  opacity: .9;
  transform: none;
  animation: none;
}

.lyric-emoji-placeholder {
  visibility: hidden;
}

#lyrics-emoji-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
}

.lyric-emoji {
  position: fixed;
  font-family: 'Stefan', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 300;
  letter-spacing: 0.06em;
  line-height: 1.6;
  white-space: nowrap;
  color: #fff;
  -webkit-text-fill-color: #fff;
}

#lyric-next { display: none; }

/* ── lyric timing controls ── */
#lyric-controls {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 12px 16px;
  color: #fff;
  font-family: monospace;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 260px;
}

.lc-title {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

#lyric-controls label { display: flex; flex-direction: column; gap: 3px; }

.lc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#lyric-controls input[type=range] { width: 100%; accent-color: #f60; cursor: pointer; }

#lyric-controls input[type=number] {
  width: 55px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  color: #fff;
  font-family: monospace;
  font-size: 11px;
  padding: 2px 5px;
  text-align: right;
}

/* ── player ── */
#player {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 20;
  font-family: 'Stefan', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: var(--step--1);
  color: #fff;
  width: 100%;
  height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 100%);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              height 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.2s ease;
}

#player.visible {
  transform: translateY(0);
}

#player:hover,
#player.playlist-active {
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
}

#player-mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: transparent;
  padding: 14px 24px;
}

#player-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

#btn-play,
#btn-prev,
#btn-next {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
  touch-action: manipulation;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

#btn-play { width: 64px; height: 64px; min-width: 64px; font-size: var(--step-2); }
#btn-prev, #btn-next { width: 48px; height: 48px; min-width: 48px; font-size: var(--step-1); }

#btn-play:hover,
#btn-prev:not(:disabled):hover,
#btn-next:not(:disabled):hover {
  transform: scale(1.08);
  border-color: rgba(255,255,255,0.15);
}

#player-mini button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#player-title {
  position: fixed;
  bottom: 112px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 21;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90vw;
  text-align: center;
  font-family: 'Stefan', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: var(--step-2);
  letter-spacing: 0.03em;
  color: #fff;
  opacity: 0.9;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#player-title.hidden {
  opacity: 0;
}

#autoplay-fallback-btn {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 100px;
  padding: 18px 36px;
  font-family: 'Stefan', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: var(--step-1);
  letter-spacing: 0.03em;
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

#autoplay-fallback-btn.visible {
  display: block;
}

#autoplay-fallback-btn:hover {
  transform: translate(-50%, -50%) scale(1.05);
  border-color: rgba(255,255,255,0.4);
}

#player-progress-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

#player-progress-bar {
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.4);
  background-clip: content-box;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  /* large invisible tap area above and below */
  padding: 14px 0;
  margin: -14px 0;
  box-sizing: content-box;
  touch-action: none;
  transition: height 0.2s ease;
}

#player-progress-bar:hover {
  height: 16px;
}

#player-time-row {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  font-size: var(--step--2);
  opacity: 0;
  pointer-events: none;
  padding-bottom: 6px;
  transition: opacity 0.2s ease;
}

#player-progress-bar:hover ~ #player-time-row {
  opacity: 0.7;
}

#player-progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 4px;
  pointer-events: none;
  transition: width 0.25s linear;
}

#player-playhead {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: left 0.25s linear, width 0.2s ease, height 0.2s ease;
}

#player-progress-bar:hover #player-playhead {
  width: 24px;
  height: 24px;
}

#btn-expand {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-family: 'Stefan', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: var(--step-1);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s, transform 0.3s;
  line-height: 1;
  padding: 4px;
}

#btn-expand:hover { color: #fff; transform: scale(1.1); }
#btn-expand.open { color: #fff; }

#volume-control {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  max-width: 44px;
  overflow: hidden;
  transition: max-width 0.2s ease;
}

#volume-control:hover {
  max-width: 132px;
}

#btn-volume {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

#btn-volume:hover {
  transform: scale(1.08);
  border-color: rgba(255,255,255,0.15);
}

#volume-icon {
  width: 26px;
  height: 26px;
  opacity: 0.85;
}

#volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 28px;
  background: transparent;
  accent-color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 8px;
  touch-action: none;
}

#volume-slider::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 4px;
  background: rgba(255,255,255,0.4);
}

#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  margin-top: -6px;
  cursor: pointer;
}

#volume-slider::-moz-range-track {
  height: 2px;
  border-radius: 4px;
  background: rgba(255,255,255,0.4);
}

#volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}

/* ── playlist ── */
#player-playlist {
  background: transparent;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

#player-playlist.open {
  max-height: 420px;
}

.playlist-item {
  padding: 14px 14px;
  cursor: pointer;
  text-align: center;
  font-family: 'Stefan', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  letter-spacing: 0.03em;
  font-size: var(--step-2);
  color: #fff;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.playlist-item:hover { opacity: 0.85; }
.playlist-item.active { opacity: 1; }
