:root {
  --bg: #12100e;
  --bg-2: #1b1815;
  --card: #211d18;
  --card-2: #2a2520;
  --line: #383026;
  --ink: #f2ece0;
  --ink-2: #a89c88;
  --ink-3: #6f6555;
  --amber: #e8b545;
  --amber-2: #c8912b;
  --red: #e05b4a;
  --green: #5fc27e;
  --r: 12px;
  --player-h: 132px;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
  overscroll-behavior-y: none;
}

button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
svg { width: 22px; height: 22px; display: block; }

/* ---------- 顶栏 ---------- */
.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(env(safe-area-inset-top), 10px) 14px 8px;
  background: linear-gradient(#181512, var(--bg));
}

.brand { display: flex; align-items: center; gap: 9px; }

.brand-mark {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--amber) 0 22%, #1b1815 23% 100%);
  box-shadow: inset 0 0 0 2px var(--amber-2), 0 0 10px #e8b54533;
}

.brand-text { font-size: 16px; font-weight: 700; letter-spacing: .5px; }

.modes { display: flex; gap: 4px; padding: 3px; background: var(--bg-2); border-radius: 999px; }

.mode {
  padding: 6px 14px; border-radius: 999px; font-size: 13px; color: var(--ink-2);
}
.mode.is-on { background: var(--amber); color: #201808; font-weight: 700; }
.mode span { font-variant-numeric: tabular-nums; opacity: .75; }

/* ---------- 搜索与分类 ---------- */
.tools { flex: none; padding: 0 14px 8px; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 0 10px;
}
.search svg { flex: none; width: 17px; height: 17px; color: var(--ink-3); }
.search input {
  flex: 1; min-width: 0; padding: 10px 0; background: none; border: 0; outline: none; font-size: 15px;
}
.search input::-webkit-search-cancel-button { display: none; }
.clear { color: var(--ink-3); font-size: 20px; line-height: 1; padding: 0 4px; }

.cats, .regions {
  flex: none;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 14px 10px;
  scroll-snap-type: x proximity;
}
.cats::-webkit-scrollbar, .regions::-webkit-scrollbar { display: none; }
.cats-loading { color: var(--ink-3); font-size: 13px; }

.chip {
  flex: none; scroll-snap-align: center;
  padding: 7px 15px; border-radius: 999px; font-size: 14px;
  background: var(--card); color: var(--ink-2); border: 1px solid var(--line);
  transition: background .15s, color .15s;
}
.chip.is-on { background: var(--amber); color: #201808; border-color: var(--amber); font-weight: 700; }
.chip:active { transform: translateY(1px); }

.regions { padding-top: 0; }
.regions .chip { padding: 5px 12px; font-size: 13px; }

/* ---------- 列表 ---------- */
.stage {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 14px calc(var(--player-h) + env(safe-area-inset-bottom) + 12px);
}

.meta-line { color: var(--ink-3); font-size: 12px; padding: 2px 2px 8px; min-height: 18px; }
.meta-line b { color: var(--ink-2); font-weight: 600; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.item {
  display: grid; grid-template-columns: 48px 1fr auto auto; align-items: center; gap: 9px;
  padding: 10px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--line);
}
.item.is-on { border-color: var(--amber-2); background: linear-gradient(90deg, #2c2417, var(--card) 60%); }

.cover {
  position: relative;
  width: 48px; height: 48px; border-radius: 9px; overflow: hidden; flex: none;
  background: var(--card-2); display: grid; place-items: center;
  font-size: 19px; font-weight: 700; color: var(--amber-2);
}
/* 台标加载成功就盖住首字母，失败或没有台标时露出兜底字。 */
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

.info { min-width: 0; }
.name {
  font-size: 15px; font-weight: 600; margin: 0 0 2px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.sub {
  font-size: 12px; color: var(--ink-3);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.sub .on { color: var(--green); }

.play-btn {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--amber);
}
.play-btn svg { width: 17px; height: 17px; }
.item.is-on .play-btn { background: var(--amber); color: #201808; border-color: var(--amber); }

.fav { width: 34px; height: 34px; display: grid; place-items: center; color: var(--ink-3); }
.fav svg { width: 19px; height: 19px; }
.fav.is-fav { color: var(--red); }
.fav.is-fav path { fill: currentColor; }

.notice { padding: 26px 14px; text-align: center; color: var(--ink-2); font-size: 14px; }
.notice h3 { margin: 0 0 8px; font-size: 16px; color: var(--ink); }
.notice p { margin: 0 0 14px; color: var(--ink-3); font-size: 13px; line-height: 1.7; }
.notice button { padding: 8px 20px; border-radius: 999px; background: var(--amber); color: #201808; font-weight: 700; }

.more { width: 100%; margin-top: 10px; padding: 11px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 14px; }
.more[disabled] { color: var(--ink-3); }

/* ---------- 播放条 ---------- */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
  background: rgba(24, 21, 18, .96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

.now { display: flex; align-items: center; gap: 10px; }
.now .cover { width: 38px; height: 38px; border-radius: 8px; font-size: 15px; }
.now-text { flex: 1; min-width: 0; }
.now-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-sub { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-now { color: var(--ink-3); padding: 6px; }
.fav-now svg { width: 20px; height: 20px; }
.fav-now.is-fav { color: var(--red); }
.fav-now.is-fav path { fill: currentColor; }

.controls { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.controls > button { width: 38px; height: 38px; display: grid; place-items: center; color: var(--ink-2); border-radius: 10px; }
.play { width: 46px !important; height: 42px !important; background: var(--amber) !important; color: #201808 !important; border-radius: 12px !important; }
.play svg { width: 21px; height: 21px; }
.vol { flex: 1; display: flex; align-items: center; gap: 8px; margin-left: 6px; }
.vol button { width: 30px; height: 30px; display: grid; place-items: center; color: var(--ink-3); }
.vol button svg { width: 18px; height: 18px; }
.vol button.is-mute #wave { opacity: 0; }
.vol input { flex: 1; min-width: 40px; accent-color: var(--amber); height: 22px; }

.signal { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 11px; color: var(--ink-3); }
.signal .sep { color: var(--line); }
.dots { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.dots i { width: 3px; background: var(--ink-3); border-radius: 1px; }
.dots i:nth-child(1) { height: 4px; }
.dots i:nth-child(2) { height: 6px; }
.dots i:nth-child(3) { height: 8px; }
.dots i:nth-child(4) { height: 11px; }
.dots.l1 i:nth-child(-n+1),
.dots.l2 i:nth-child(-n+2),
.dots.l3 i:nth-child(-n+3),
.dots.l4 i { background: var(--green); }
.dots.l0 { opacity: .5; }
.dots.is-live i { animation: bounce .9s ease-in-out infinite; }
.dots.is-live i:nth-child(2) { animation-delay: .15s; }
.dots.is-live i:nth-child(3) { animation-delay: .3s; }
.dots.is-live i:nth-child(4) { animation-delay: .45s; }
@keyframes bounce { 0%, 100% { transform: scaleY(.45); } 50% { transform: scaleY(1); } }

.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--amber); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { height: 69px; border-radius: var(--r); background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 37%, var(--card) 63%); background-size: 400% 100%; animation: shine 1.4s ease infinite; }
@keyframes shine { from { background-position: 100% 0; } to { background-position: 0 0; } }

@media (min-width: 640px) {
  body { max-width: 720px; margin: 0 auto; box-shadow: 0 0 60px #00000066; }
  .player { max-width: 720px; margin: 0 auto; }
  .list { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .dots.is-live i, .spinner, .skeleton { animation: none; }
}
