:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1b1d22;
  --sub: #8a8f99;
  --line: #ececf0;
  --accent: #ff5b4a;
  --accent-2: #ff8a3c;
  --ok: #2bbf6a;
  --player-1: #23252e;
  --player-2: #34384a;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(20, 22, 30, 0.06);
  --safe: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(76px + var(--safe));
  -webkit-font-smoothing: antialiased;
}

/* 顶部栏 */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-top, 0px));
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  background: rgba(244, 245, 247, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; display: grid; place-items: center;
  font-size: 22px; border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 12px rgba(255, 91, 74, 0.35);
}
.brand-txt .title { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand-txt .sub { font-size: 11px; color: var(--sub); margin-top: 2px; }

/* 国家切换条 */
.country-bar {
  position: sticky; top: 64px; z-index: 15;
  display: flex; align-items: center; justify-content: space-between;
  margin: 10px 12px; padding: 10px 14px;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
}
.country-bar .cur { display: flex; align-items: center; gap: 10px; min-width: 0; }
.country-bar .flag { font-size: 22px; }
.country-bar .curname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch {
  border: none; background: #fff0ee; color: var(--accent);
  font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 20px;
  cursor: pointer; white-space: nowrap;
}

/* 列表 */
.list { padding: 0 12px; }
.state { text-align: center; color: var(--sub); padding: 48px 0; font-size: 14px; }

.station {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius);
  padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow);
  cursor: pointer; transition: transform .12s ease, box-shadow .12s ease;
  position: relative; overflow: hidden;
}
.station:active { transform: scale(.985); }
.station.active { box-shadow: 0 0 0 2px var(--accent) inset, var(--shadow); }
.station .favwrap {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 12px; overflow: hidden;
  display: grid; place-items: center; background: #eef0f3; color: #b9bdc7; font-weight: 700; font-size: 18px;
}
.station .favwrap img { width: 100%; height: 100%; object-fit: cover; }
.station .meta { min-width: 0; flex: 1; }
.station .name {
  font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.station .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.chip {
  font-size: 11px; color: var(--sub); background: #f1f2f5; padding: 2px 8px; border-radius: 10px;
  white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis;
}
.chip.bit { color: #4a6cf7; background: #eef1ff; }
.chip.hls { color: #b65cff; background: #f6efff; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #cfd3da; flex: 0 0 7px; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(43,191,106,.15); }
.station .play-ic {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.station.active .play-ic { background: #e9ebef; color: var(--accent); }
.station .play-ic .bars { display: flex; gap: 2px; align-items: flex-end; height: 14px; }
.station .play-ic .bars i { width: 3px; background: var(--accent); border-radius: 2px; animation: eq 0.9s ease-in-out infinite; }
.station .play-ic .bars i:nth-child(2){ animation-delay:.2s } .station .play-ic .bars i:nth-child(3){ animation-delay:.4s }

@keyframes eq { 0%,100%{height:4px} 50%{height:14px} }

.more { text-align:center; color: var(--accent); font-weight:600; padding: 14px 0 24px; cursor:pointer; }

/* 国家弹层 */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.sheet-backdrop.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  background: var(--card); border-radius: 22px 22px 0 0;
  max-height: 82vh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1);
  padding-bottom: var(--safe);
}
.sheet.show { transform: translateY(0); }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: #d9dce3; margin: 10px auto 4px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 18px 10px; font-weight: 700; font-size: 16px; }
.sheet-head .close { border: none; background: #f1f2f5; width: 30px; height: 30px; border-radius: 50%; color: var(--sub); font-size: 14px; cursor: pointer; }
.search {
  margin: 0 16px 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 14px; outline: none; background: #fafbfc;
}
.search:focus { border-color: var(--accent); }
.popular { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 10px; scrollbar-width: none; }
.popular::-webkit-scrollbar { display: none; }
.popular .pc {
  flex: 0 0 auto; display: flex; align-items: center; gap: 5px; padding: 7px 12px;
  background: #f1f2f5; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; border: none;
}
.popular .pc .pf { font-size: 16px; }
.popular .pc .pnm { white-space: nowrap; }
.country-grid {
  overflow-y: auto; padding: 4px 12px 18px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.cc {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 4px;
  background: #fafbfc; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; text-align: center;
}
.cc:active { background: #fff0ee; border-color: var(--accent); }
.cc .cf { font-size: 26px; line-height: 1; }
.cc .cn { font-size: 11px; color: var(--sub); line-height: 1.25; width: 100%; }
.cc .cn .cn-zh { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc .cn .cn-en { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc.sel { border-color: var(--accent); background: #fff0ee; }
.cc.sel .cn .cn-zh { color: var(--accent); }

/* 底部播放条 */
.now-playing {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px calc(10px + var(--safe));
  background: linear-gradient(135deg, var(--player-1), var(--player-2));
  color: #fff; box-shadow: 0 -6px 24px rgba(0,0,0,.18);
}
.np-favwrap { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; overflow: hidden; background: rgba(255,255,255,.1); display: grid; place-items: center; }
.np-fav { width: 100%; height: 100%; object-fit: cover; }
.np-meta { min-width: 0; flex: 1; }
.np-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-sub { font-size: 11px; color: rgba(255,255,255,.6); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-play {
  flex: 0 0 46px; width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  background: #fff; color: var(--accent); font-size: 17px; display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

/* 均衡器动画 */
.eq { display: flex; align-items: flex-end; gap: 3px; height: 22px; width: 26px; flex: 0 0 26px; }
.eq i { width: 4px; background: rgba(255,255,255,.85); border-radius: 2px; height: 6px; }
.now-playing.playing .eq i { animation: eqp 0.9s ease-in-out infinite; }
.eq i:nth-child(2){ animation-delay:.15s } .eq i:nth-child(3){ animation-delay:.3s } .eq i:nth-child(4){ animation-delay:.45s }
@keyframes eqp { 0%,100%{height:5px} 50%{height:22px} }

/* 加载小圈 */
.spin { display:inline-block; width:16px; height:16px; border:2px solid #d9dce3; border-top-color: var(--accent); border-radius:50%; animation: rot .8s linear infinite; vertical-align:-3px; margin-right:8px; }
@keyframes rot { to { transform: rotate(360deg) } }
