/* ============ 随身收音机 ============ */
:root {
  --bg: #0c0d10;
  --bg-soft: #12141a;
  --panel: #181b22;
  --panel-hi: #1f232b;
  --line: #2a2f39;
  --line-hi: #3d444f;
  --text: #eceae6;
  --dim: #8c919d;
  --dim-2: #666c78;
  --accent: #ff9a3c;
  --accent-2: #ffcb7d;
  --accent-soft: rgba(255, 154, 60, .13);
  --danger: #ff6b5e;
  --radius: 14px;
  --player-h: 88px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  padding-bottom: calc(var(--player-h) + 28px + env(safe-area-inset-bottom));
  background-image:
    radial-gradient(900px 420px at 12% -8%, rgba(255, 154, 60, .07), transparent 65%),
    radial-gradient(700px 380px at 92% 0%, rgba(96, 132, 255, .06), transparent 60%);
  background-repeat: no-repeat;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 20px; height: 20px; fill: currentColor; display: block; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------------- 顶栏 ---------------- */
.app { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.hdr {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 0 14px;
  background: linear-gradient(180deg, var(--bg) 62%, rgba(12, 13, 16, 0));
  backdrop-filter: blur(6px);
}

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

.mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: #1b1204;
  background: linear-gradient(150deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 18px -8px rgba(255, 154, 60, .9);
}
.mark svg { width: 21px; height: 21px; }

.bt { display: flex; flex-direction: column; line-height: 1.25; }
.bt b { font-size: 16px; letter-spacing: .3px; }
.bt i { font-style: normal; font-size: 11.5px; color: var(--dim-2); }

.search {
  position: relative;
  flex: 1 1 auto;
  max-width: 420px;
  margin-left: auto;
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  transition: border-color .18s, background .18s;
}
.search:focus-within { border-color: var(--line-hi); background: var(--panel-hi); }
.search .sicon { width: 17px; height: 17px; color: var(--dim-2); margin-left: 12px; flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  padding: 10px 8px;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 13.5px;
}
.search input::placeholder { color: var(--dim-2); }
.search input::-webkit-search-cancel-button { display: none; }
.clear { padding: 8px; color: var(--dim-2); }
.clear:hover { color: var(--text); }
.clear svg { width: 14px; height: 14px; }

.ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  font-size: 13px;
  color: var(--dim);
  transition: .18s;
}
.ghost:hover { color: var(--text); border-color: var(--line-hi); background: var(--panel-hi); }
.ghost svg { width: 15px; height: 15px; }

/* ---------------- 分类 ---------------- */
.cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cats::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 13px;
  color: var(--dim);
  white-space: nowrap;
  transition: .16s;
}
.chip:hover { color: var(--text); border-color: var(--line-hi); }
.chip.on {
  color: #1b1204;
  background: linear-gradient(150deg, var(--accent-2), var(--accent));
  border-color: transparent;
  font-weight: 600;
}
.chip .n { opacity: .55; margin-left: 5px; font-size: 11px; }

/* ---------------- 电台网格 ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 10px;
  padding-bottom: 8px;
}

.grid > * { min-width: 0; }

.card {
  position: relative;
  min-width: 0;
  content-visibility: auto;
  contain-intrinsic-size: auto 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: transform .16s, border-color .16s, background .16s;
  overflow: hidden;
}
.card:hover { transform: translateY(-2px); border-color: var(--line-hi); background: var(--panel-hi); }
.card:active { transform: translateY(0) scale(.99); }
.card.on {
  border-color: rgba(255, 154, 60, .55);
  background: linear-gradient(160deg, var(--accent-soft), rgba(255, 154, 60, .02));
}

.avatar {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 11px;
  display: grid; place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #0b0c0f;
  letter-spacing: -.5px;
  overflow: hidden;
}

.card .txt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.card b {
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card i {
  font-style: normal;
  font-size: 11px;
  color: var(--dim-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card .del {
  position: absolute;
  top: 4px; right: 4px;
  padding: 5px;
  border-radius: 8px;
  color: var(--dim-2);
  opacity: 0;
  transition: .15s;
}
.card:hover .del { opacity: 1; }
.card .del:hover { color: var(--danger); background: rgba(255, 107, 94, .12); }
.card .del svg { width: 13px; height: 13px; }

/* 正在播放的跳动指示 */
.eq { display: none; gap: 2px; align-items: flex-end; height: 13px; flex: none; }
.eq i { width: 2.5px; border-radius: 2px; background: var(--accent); height: 30%; }
.card.on .eq { display: flex; }
.card.on.playing .eq i { animation: eqb .9s ease-in-out infinite; }
.eq i:nth-child(1) { animation-delay: -.15s; }
.eq i:nth-child(2) { animation-delay: -.45s; }
.eq i:nth-child(3) { animation-delay: -.75s; }
.eq i:nth-child(4) { animation-delay: -.3s; }
@keyframes eqb {
  0%, 100% { height: 22%; opacity: .7; }
  50% { height: 100%; opacity: 1; }
}

.empty { text-align: center; color: var(--dim-2); font-size: 13.5px; padding: 60px 0; }
.more { height: 2px; }
.tips {
  margin: 26px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.8;
  color: #4e545f;
}

/* ---------------- 播放器 ---------------- */
.player {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  background: rgba(15, 17, 21, .92);
  backdrop-filter: blur(18px) saturate(1.3);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.viz {
  display: block;
  width: 100%;
  height: 30px;
  opacity: .55;
  pointer-events: none;
}
.p-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 14px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.now { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 34%; }
.art {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 13px;
  display: grid; place-items: center;
  font-size: 16px; font-weight: 700;
  color: #0b0c0f;
  background: linear-gradient(150deg, #3a4048, #23272e);
  transition: .3s;
}
.now .txt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.now b {
  font-size: 14.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.now i {
  font-style: normal; font-size: 11.5px; color: var(--dim-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player.playing .art { box-shadow: 0 0 0 1px rgba(255, 154, 60, .45), 0 8px 22px -12px rgba(255, 154, 60, .8); }

.ctl { display: flex; align-items: center; gap: 8px; flex: none; }

.ico {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--dim);
  transition: .15s;
}
.ico:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.ico svg { width: 18px; height: 18px; }

.play {
  position: relative;
  width: 46px; height: 46px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #1b1204;
  background: linear-gradient(150deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 22px -10px rgba(255, 154, 60, .95);
  transition: transform .14s, box-shadow .2s;
}
.play:hover { transform: scale(1.05); }
.play:active { transform: scale(.96); }
.play svg { width: 22px; height: 22px; }
.play .g-pause { display: none; }
.player.playing .play .g-play { display: none; }
.player.playing .play .g-pause { display: block; }

.play .spinner {
  display: none;
  width: 19px; height: 19px;
  border-radius: 50%;
  border: 2px solid rgba(27, 18, 4, .3);
  border-top-color: #1b1204;
  animation: spin .8s linear infinite;
}
.player.loading .play svg { display: none; }
.player.loading .play .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.right { display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }

.vol {
  -webkit-appearance: none;
  appearance: none;
  width: 84px;
  height: 4px;
  border-radius: 999px;
  background: #2b3038;
  outline: none;
  cursor: pointer;
}
.vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
  transition: transform .12s;
}
.vol::-webkit-slider-thumb:hover { transform: scale(1.15); }
.vol::-moz-range-thumb {
  width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--text);
}

#fav.on { color: var(--accent); }
#fav.on svg use { pointer-events: none; }

.sleep-wrap { position: relative; display: flex; align-items: center; }
.sleep-left {
  font-size: 11px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-left: -2px;
  margin-right: 2px;
}
.menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  min-width: 132px;
  padding: 6px;
  border: 1px solid var(--line-hi);
  border-radius: 13px;
  background: #14161b;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .8);
  display: flex;
  flex-direction: column;
  gap: 1px;
  animation: pop .16s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.97); } }
.menu button {
  padding: 8px 10px;
  text-align: left;
  border-radius: 9px;
  font-size: 13px;
  color: var(--dim);
}
.menu button:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.menu button.danger { color: var(--danger); }

/* ---------------- 提示条 ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-h) + 26px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 60;
  max-width: min(88vw, 460px);
  padding: 10px 16px;
  border-radius: 11px;
  border: 1px solid var(--line-hi);
  background: #1b1e25;
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, .9);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 弹窗 ---------------- */
.dlg {
  padding: 0;
  border: 1px solid var(--line-hi);
  border-radius: 18px;
  background: var(--bg-soft);
  color: var(--text);
  width: min(92vw, 400px);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .95);
}
.dlg::backdrop { background: rgba(4, 5, 7, .68); backdrop-filter: blur(3px); }
.dlg form { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg h2 { margin: 0; font-size: 16.5px; font-weight: 600; }
.dlg .hint { margin: -6px 0 2px; font-size: 12px; line-height: 1.6; color: var(--dim-2); }
.dlg label { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--dim); }
.dlg input, .dlg select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color .16s;
}
.dlg input:focus, .dlg select:focus { border-color: rgba(255, 154, 60, .6); }
.dlg-act { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dlg-act .primary {
  padding: 9px 18px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 600;
  color: #1b1204;
  background: linear-gradient(150deg, var(--accent-2), var(--accent));
}
.dlg-act .ghost { padding: 9px 16px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .vol { width: 64px; }
  .now { flex-basis: 30%; }
}

@media (max-width: 720px) {
  :root { --player-h: 132px; }
  .app { padding: 0 14px; }
  .hdr { flex-wrap: wrap; gap: 10px; padding: 14px 0 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
  .ghost span { display: none; }
  .ghost { padding: 9px 11px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 8px; }  .p-inner { flex-wrap: wrap; gap: 10px; padding: 0 14px 12px; }
  .now { flex-basis: calc(100% - 150px); }
  .ctl { margin-left: auto; }
  .right { flex-basis: 100%; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 8px; }
  .vol { width: 110px; }
  .viz { height: 24px; }
  .tips { font-size: 11px; }
}

@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card b { font-size: 13px; }
  .hdr .ghost { margin-left: auto; }
  .bt b { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}
