:root {
  --accent: 183 148 246;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.66);
  --faint: rgba(255, 255, 255, 0.38);
  --font: -apple-system, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", "Microsoft JhengHei UI",
    "Microsoft JhengHei", "PingFang TC", "Yu Gothic UI", "Noto Sans CJK TC", sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #0b0918;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

[hidden] {
  display: none !important;
}

.defs {
  position: absolute;
  width: 0;
  height: 0;
}

/* ------------------------------------------------------------------ 背景 */

.bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.bg-art {
  position: absolute;
  inset: -18%;
  background-size: cover;
  background-position: center;
  filter: blur(46px) saturate(1.7) brightness(0.8);
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 1.2s ease;
  animation: drift 38s ease-in-out infinite alternate;
}

.bg-art.show {
  opacity: 1;
}

.bg-blob {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  mix-blend-mode: screen;
  animation: float 26s ease-in-out infinite alternate;
}

.b1 {
  background: rgb(var(--accent));
  top: -25vmax;
  left: -15vmax;
}

.b2 {
  background: #ff5caa;
  bottom: -30vmax;
  right: -20vmax;
  opacity: 0.35;
  animation-duration: 32s;
}

.b3 {
  background: #46aaff;
  top: 20%;
  right: -25vmax;
  opacity: 0.25;
  animation-duration: 40s;
}

.bg-shade {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 0%, rgba(10, 8, 24, 0.05), rgba(10, 8, 24, 0.55));
}

@keyframes drift {
  from {
    transform: scale(1.08) translate(-2%, -1%) rotate(-1deg);
  }
  to {
    transform: scale(1.16) translate(2%, 1.5%) rotate(1deg);
  }
}

@keyframes float {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(8vmax, 6vmax);
  }
}

/* ------------------------------------------------------------------ Liquid Glass */

.glass {
  --r: 32px;
  position: relative;
  border-radius: var(--r);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04) 45%, rgba(255, 255, 255, 0.09));
  -webkit-backdrop-filter: blur(22px) saturate(185%);
  backdrop-filter: blur(22px) saturate(185%);
  box-shadow:
    inset 0 1px 0.5px rgba(255, 255, 255, 0.6),
    inset 0 -1px 1px rgba(255, 255, 255, 0.14),
    inset 0 0 22px rgba(255, 255, 255, 0.07),
    0 18px 50px -14px rgba(0, 0, 0, 0.5);
  isolation: isolate;
}

/* 邊緣的亮邊（上亮下暗，像玻璃反光） */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.2px;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.75),
    rgba(255, 255, 255, 0.12) 30%,
    rgba(255, 255, 255, 0.02) 55%,
    rgba(255, 255, 255, 0.3)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}

/* 跟著滑鼠移動的高光 */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    220px 160px at var(--mx, 25%) var(--my, 0%),
    rgba(255, 255, 255, 0.2),
    rgba(255, 255, 255, 0) 70%
  );
  pointer-events: none;
  mix-blend-mode: soft-light;
  z-index: 1;
}

.glass > * {
  position: relative;
  z-index: 3;
}

/* ------------------------------------------------------------------ 版面 */

.stage {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(280px, 400px);
  justify-content: center;
  align-items: center;
  gap: 28px;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
}

@media (max-width: 820px) {
  .stage {
    grid-template-columns: minmax(0, 520px);
    align-items: start;
    gap: 18px;
    padding: 16px 14px 28px;
  }
}

/* ------------------------------------------------------------------ 播放器 */

.player {
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.eq {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}

.eq i {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: rgb(var(--accent));
  transform-origin: center;
  animation: eq 1.1s ease-in-out infinite;
}

.eq i:nth-child(2) {
  animation-delay: -0.4s;
}
.eq i:nth-child(3) {
  animation-delay: -0.8s;
}
.eq i:nth-child(4) {
  animation-delay: -0.2s;
}
.eq i:nth-child(5) {
  animation-delay: -0.6s;
}

.paused .eq i,
.idle .eq i {
  animation-play-state: paused;
  transform: scaleY(0.35);
}

@keyframes eq {
  0%,
  100% {
    transform: scaleY(0.35);
  }
  50% {
    transform: scaleY(1);
  }
}

.pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.status.playing {
  color: #6ff0a0;
  background: rgba(87, 242, 135, 0.14);
}
.status.paused {
  color: #ffe476;
  background: rgba(254, 231, 92, 0.14);
}
.status.loading {
  color: #9db8ff;
  background: rgba(122, 162, 255, 0.16);
}
.status.error {
  color: #ff8d8d;
  background: rgba(255, 107, 107, 0.16);
}

.art-wrap {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
  box-shadow:
    0 22px 40px -18px rgba(0, 0, 0, 0.7),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.paused .art-wrap {
  transform: scale(0.94);
}

.art-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.art-wrap img.show {
  opacity: 1;
}

.art-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 84px;
  color: rgba(255, 255, 255, 0.85);
  background:
    radial-gradient(60% 80% at 20% 20%, rgb(var(--accent) / 0.75), transparent 70%),
    radial-gradient(60% 80% at 85% 90%, rgba(255, 92, 170, 0.6), transparent 70%),
    #171334;
}

.chip {
  --r: 999px;
  position: absolute !important;
  left: 12px;
  bottom: 12px;
  font-size: 12px;
  padding: 7px 13px;
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgb(var(--accent));
  filter: brightness(1.25);
}

.meta h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta p {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------------ 滑桿（iOS 風格：拖曳時變粗） */

input[type="range"] {
  --p: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.95) var(--p), rgba(255, 255, 255, 0.2) var(--p));
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.2);
  transition: height 0.2s ease;
}

input[type="range"]:hover::-webkit-slider-runnable-track,
input[type="range"]:active::-webkit-slider-runnable-track {
  height: 10px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 0;
  height: 0;
  margin-top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: all 0.2s ease;
}

input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:active::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -4px;
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: #fff;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

.times {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* ------------------------------------------------------------------ 控制按鈕 */

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.ctl {
  --r: 999px;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1), background 0.3s;
}

.ctl svg {
  width: 22px;
  height: 22px;
}

.ctl.play {
  width: 76px;
  height: 76px;
  background: linear-gradient(140deg, rgb(var(--accent) / 0.85), rgb(var(--accent) / 0.45));
}

.ctl.play svg {
  width: 30px;
  height: 30px;
}

.ctl:hover {
  transform: scale(1.07);
}

.ctl:active {
  transform: scale(0.9);
}

.ctl.on {
  background: linear-gradient(140deg, rgb(var(--accent) / 0.6), rgb(var(--accent) / 0.25));
}

.ctl.small-badge::after {
  content: "1";
}

.volume {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vicon svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  display: block;
}

.vval {
  width: 42px;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.toggle {
  --r: 999px;
  font-size: 12px;
  padding: 7px 13px;
  white-space: nowrap;
  color: var(--muted);
  transition: color 0.2s, background 0.3s;
}

.toggle.on {
  color: #fff;
  background: linear-gradient(140deg, rgb(var(--accent) / 0.65), rgb(var(--accent) / 0.3));
}

/* ------------------------------------------------------------------ 側邊：佇列 / 搜尋 */

.side {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: min(640px, calc(100vh - 48px));
  min-height: 360px;
}

@media (max-width: 820px) {
  .side {
    height: auto;
    min-height: 0;
  }
}

.tabs {
  --r: 999px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  flex-shrink: 0;
}

.tab {
  padding: 9px 0;
  border-radius: 999px;
  font-size: 14px;
  color: var(--muted);
  transition: color 0.25s;
}

.tab.active {
  color: #fff;
}

.tab-glider {
  position: absolute !important;
  z-index: 2 !important;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 4px 14px rgba(0, 0, 0, 0.2);
  transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.tabs[data-active="search"] .tab-glider {
  transform: translateX(100%);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  padding: 0 4px;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0 2px 4px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 16px;
  transition: background 0.2s;
}

.row:hover {
  background: rgba(255, 255, 255, 0.08);
}

.row img,
.row .thumb {
  width: 64px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
}

.row .info {
  flex: 1;
  min-width: 0;
}

.row .t {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row .a {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row .actions {
  display: flex;
  gap: 4px;
  opacity: 0.55;
  transition: opacity 0.2s;
}

.row:hover .actions {
  opacity: 1;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.icon-btn:active {
  transform: scale(0.88);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.empty {
  text-align: center;
  color: var(--faint);
  font-size: 13px;
  padding: 36px 0;
}

.search {
  --r: 999px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  flex-shrink: 0;
}

.search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  height: 44px;
  font-size: 15px;
}

.search input::placeholder {
  color: var(--faint);
}

.sicon svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  display: block;
}

/* ------------------------------------------------------------------ 提示 / 啟動畫面 */

.toast {
  --r: 999px;
  position: fixed !important;
  z-index: 20;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 30px) scale(0.96);
  opacity: 0;
  padding: 12px 20px;
  font-size: 14px;
  max-width: min(90vw, 520px);
  text-align: center;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.toast.error {
  color: #ffb3b3;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  transition: opacity 0.5s ease;
}

.splash.hide {
  opacity: 0;
  pointer-events: none;
}

.splash-card {
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font-size: 15px;
  color: var(--muted);
  text-align: center;
  max-width: 86vw;
}

.splash-card p {
  margin: 0;
}

.eq.big {
  height: 30px;
  gap: 5px;
}

.eq.big i {
  width: 5px;
}
