:root {
  --bg: #07070c;
  --panel: rgba(16, 16, 26, 0.72);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f6f6fb;
  --muted: #9aa0b8;
  --red: #ff1a1a;
  --gold: #ffe14a;
  --pink: #ff6dad;
  --green: #4caf50;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Outfit", "Noto Sans TC", sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

.glow-bg {
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(circle at 50% 35%, hsla(var(--song-hue, 210), 80%, 42%, 0.28), transparent 42%),
    radial-gradient(circle at 20% 80%, rgba(255, 109, 173, 0.12), transparent 36%),
    radial-gradient(circle at 80% 10%, rgba(255, 225, 74, 0.08), transparent 28%);
  filter: blur(8px);
  pointer-events: none;
  z-index: 0;
  transition: background 0.8s ease;
}

.flag-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px 12px 14px;
  background: #fff;
  color: #143318;
  font: 700 18px/1 "Noto Sans TC", sans-serif;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(76, 175, 80, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.flag-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 16px 36px rgba(76, 175, 80, 0.45);
}

.flag-btn:active {
  transform: scale(1);
}

.skip-btn {
  padding: 14px 28px;
}

.topbar,
.layout,
.credits {
  position: relative;
  z-index: 1;
}

.topbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 20px 6px;
}

.volume-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 12px;
  width: fit-content;
  backdrop-filter: blur(12px);
}

.volume-box span,
.volume-box b {
  font-size: 14px;
  white-space: nowrap;
}

.volume-box input,
.progress-wrap input {
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8be58b, #ffe14a);
  outline: none;
}

.volume-box input {
  width: 120px;
}

.volume-box input::-webkit-slider-thumb,
.progress-wrap input::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #222;
  cursor: pointer;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "ZCOOL KuaiLe", "Noto Sans TC", sans-serif;
  font-size: 24px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.72fr);
  gap: 14px;
  padding: 4px 20px 8px;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.stage {
  min-height: 0;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 22px 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.eq {
  display: flex;
  gap: 5px;
  height: 32px;
  align-items: flex-end;
  margin-bottom: 10px;
  opacity: 0.35;
}

.eq span {
  width: 6px;
  height: 12px;
  border-radius: 99px;
  background: #fff;
}

body.is-playing .eq span {
  animation: eq 0.9s ease-in-out infinite;
}

body.is-playing .eq span:nth-child(1) { animation-delay: 0.05s; }
body.is-playing .eq span:nth-child(2) { animation-delay: 0.18s; }
body.is-playing .eq span:nth-child(3) { animation-delay: 0.02s; }
body.is-playing .eq span:nth-child(4) { animation-delay: 0.28s; }
body.is-playing .eq span:nth-child(5) { animation-delay: 0.12s; }
body.is-playing .eq span:nth-child(6) { animation-delay: 0.33s; }
body.is-playing .eq span:nth-child(7) { animation-delay: 0.08s; }
body.is-playing .eq span:nth-child(8) { animation-delay: 0.22s; }
body.is-playing .eq span:nth-child(9) { animation-delay: 0.16s; }
body.is-playing .eq span:nth-child(10) { animation-delay: 0.3s; }

@keyframes eq {
  0%, 100% { height: 8px; }
  50% { height: 32px; }
}

.now-label {
  margin: 0 0 8px;
  color: var(--muted);
  letter-spacing: 0.2em;
  font-size: 12px;
  text-transform: uppercase;
}

.song-title {
  margin: 0;
  min-height: 1.2em;
  font-family: "Permanent Marker", "ZCOOL KuaiLe", "Noto Sans TC", cursive;
  font-size: clamp(28px, 4.4vw, 52px);
  font-weight: 400;
  line-height: 1.15;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.song-artist {
  min-height: 1.4em;
  margin: 6px 0 0;
  color: #d8d8e8;
  font-size: 16px;
}

.progress-wrap {
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.progress-wrap input {
  background: rgba(255, 255, 255, 0.18);
  width: 100%;
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.playlist-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.playlist-head {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 16px 8px;
}

.playlist-head h3 {
  margin: 0;
  font-size: 16px;
}

.playlist-head span {
  color: var(--muted);
  font-size: 12px;
}

.playlist-scroll {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
  --playlist-fade: linear-gradient(
    to bottom,
    transparent,
    #000 18px,
    #000 calc(100% - 18px),
    transparent
  );
  mask-image: var(--playlist-fade);
  -webkit-mask-image: var(--playlist-fade);
}

.playlist {
  margin: 0;
  padding: 4px 8px 14px 10px;
  list-style: none;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #ffe14a rgba(255, 255, 255, 0.12);
}

.playlist::-webkit-scrollbar {
  width: 8px;
}

.playlist::-webkit-scrollbar-track {
  margin: 8px 0;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
}

.playlist::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ffe14a, #ff6dad);
  border-radius: 99px;
}

.playlist li button {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 12px;
  padding: 7px 10px;
  cursor: pointer;
  font: 500 13px/1.3 "Noto Sans TC", sans-serif;
}

.playlist li button:hover,
.playlist li.is-current button {
  background: rgba(255, 255, 255, 0.08);
}

.playlist .idx {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.playlist .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist .dur {
  color: var(--muted);
  font-size: 12px;
}

.playlist li.is-current .name {
  color: var(--gold);
}

.credits {
  flex: 0 0 auto;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 0 20px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.credits a {
  color: #ead98b;
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 8px 12px 4px;
  }

  .brand {
    display: none;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1.15fr) minmax(160px, 0.85fr);
    padding: 4px 12px 6px;
    gap: 10px;
  }

  .song-title {
    font-size: clamp(24px, 7vw, 36px);
  }

  .credits {
    font-size: 11px;
    padding-bottom: 8px;
  }
}
