/* 扫码试听 · 移动优先 */
:root {
  --brand: #7c5cff;
  --bg: #0a0b0f;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-hi: rgba(255, 255, 255, 0.085);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f3f4f7;
  --muted: #8d919c;
  --muted-2: #6b6f79;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { min-height: 100dvh; }

/* 关键：类选择器里的 display（如 .controls{display:flex}）会盖掉 UA 的 [hidden]{display:none}，
   必须显式提升优先级，否则 hidden 属性形同虚设。 */
[hidden] { display: none !important; }

.glow {
  position: fixed;
  inset: -20% -20% auto -20%;
  height: 62vh;
  background:
    radial-gradient(46% 52% at 50% 0%, color-mix(in srgb, var(--brand) 34%, transparent) 0%, transparent 70%),
    radial-gradient(34% 40% at 82% 12%, rgba(255, 255, 255, 0.07) 0%, transparent 72%);
  filter: blur(12px);
  pointer-events: none;
  z-index: 0;
}

.view {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 20px calc(28px + var(--safe-b));
}

/* ---------- 列表 ---------- */
/* 列表页刻意不放标题与页脚：扫码进来直接就是曲目清单 */
#listView { padding-top: calc(44px + env(safe-area-inset-top, 0px)); }

.tracks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.track {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 16px 13px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.track:active { transform: scale(0.988); }

@media (hover: hover) {
  .track:hover { background: var(--panel-hi); border-color: rgba(255, 255, 255, 0.16); }
}

.track .idx {
  flex: 0 0 26px;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted-2);
  letter-spacing: 0.02em;
}

.track .meta { flex: 1 1 auto; min-width: 0; }

.track .t {
  display: block;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track .a {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track .badge {
  flex: 0 0 auto;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
}

.track .dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.track.is-current { background: var(--panel-hi); border-color: color-mix(in srgb, var(--brand) 52%, transparent); }
.track.is-current .dot { opacity: 1; }
.track.is-current .idx { color: var(--brand); }

/* ---------- 单曲 ---------- */
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 4px 0 18px -6px;
  padding: 8px 10px 8px 6px;
  background: none;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.back:active { color: var(--text); }

.single { text-align: center; }

.art {
  width: min(62vw, 230px);
  aspect-ratio: 1;
  margin: 6px auto 24px;
  border-radius: 22px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--brand) 62%, #2a2140), #14151d 72%);
  background-size: cover;
  background-position: center;
  box-shadow: 0 22px 60px -22px rgba(0, 0, 0, 0.9),
              0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 62px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  position: relative;
}

.art.has-img::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  border-radius: inherit;
}

.single .title {
  margin: 0;
  font-size: 23px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 700;
  word-break: break-word;
}

.single .artist {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  min-height: 20px;
}

.stage { margin: 26px 0 0; }

/* 视频模式：没有封面块，标题以下直接是视频，让画面成为绝对主体 */
#singleView.is-video .title { margin-top: 6px; }
#singleView.is-video .artist { margin-bottom: 2px; }
#singleView.is-video .stage { margin-top: 18px; }
.stage video {
  width: 100%;
  max-height: 62vh;
  min-height: 160px;
  border-radius: 14px;
  background: #000;
  display: block;
  object-fit: contain;
}

.controls {
  margin-top: 26px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 4px;
}

.play {
  flex: 0 0 auto;
  position: relative;
  width: 66px;
  height: 66px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 92%, #fff), var(--brand));
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 14px 34px -12px color-mix(in srgb, var(--brand) 90%, transparent);
  transition: transform 0.12s ease, opacity 0.2s ease;
}
.play:active { transform: scale(0.94); }
.play:disabled { opacity: 0.4; cursor: default; }
.play svg { position: relative; z-index: 1; }
.play .ico-pause { margin-left: 1px; }

.spinner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  opacity: 0;
  animation: spin 0.8s linear infinite;
}
.play.loading .spinner { opacity: 1; }
.play.loading svg { opacity: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.timeline { flex: 1 1 auto; min-width: 0; }

#seek {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
  display: block;
}
#seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--brand) 0%,
    var(--brand) var(--p, 0%),
    rgba(255, 255, 255, 0.14) var(--p, 0%),
    rgba(255, 255, 255, 0.14) 100%
  );
}
#seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
#seek::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}
#seek::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--brand); }
#seek::-moz-range-thumb {
  width: 13px; height: 13px; border: 0; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

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

.hint {
  margin: 22px 0 0;
  font-size: 12.5px;
  color: var(--muted-2);
  letter-spacing: 0.04em;
}

/* SVG 不响应 [hidden]，统一用这个类控制显隐 */
.hide { display: none !important; }

.err {
  margin: 16px auto 0;
  max-width: 320px;
  font-size: 13px;
  line-height: 1.6;
  color: #ff9b9b;
  background: rgba(255, 90, 90, 0.1);
  border: 1px solid rgba(255, 90, 90, 0.25);
  border-radius: 12px;
  padding: 10px 14px;
}

.loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.1em;
  z-index: 5;
  background: var(--bg);
}
.loading[hidden] { display: none; }

::-moz-selection { background: color-mix(in srgb, var(--brand) 55%, transparent); }
::selection { background: color-mix(in srgb, var(--brand) 55%, transparent); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
