:root {
  --maxw: 1080px;
  --radius: 18px;
  --radius-sm: 10px;
  --gap: 18px;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", var(--font-body);
  /* 默认（蒸汽波）变量，主题文件会覆盖 */
  --bg: #160d2e;
  --bg-solid: #160d2e;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.1);
  --text: #f3e9ff;
  --text-dim: rgba(243, 233, 255, 0.62);
  --accent: #ff6ad5;
  --accent-2: #26e6ff;
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.3);
  --glow: 0 0 22px rgba(255, 106, 213, 0.55);
  --item-rot: 0deg;
  --deco-opacity: 1;
  --scrollbar: rgba(255, 255, 255, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.3s ease;
}

a { color: var(--accent-2); }

/* 背景装饰层（蒸汽波用，手帐下隐藏对应元素） */
.bg-deco {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: var(--deco-opacity);
  transition: opacity 0.4s ease;
}
.deco-sun {
  position: absolute;
  left: 50%;
  top: 8%;
  width: 340px;
  height: 340px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(180deg, #ffd36e 0%, #ff6ad5 55%, #b14bff 100%);
  filter: blur(0.5px);
  box-shadow: 0 0 90px rgba(255, 106, 213, 0.45);
}
.deco-grid {
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: -10%;
  height: 55vh;
  background-image:
    linear-gradient(rgba(38, 230, 255, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(38, 230, 255, 0.5) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(420px) rotateX(68deg);
  transform-origin: bottom center;
  mask-image: linear-gradient(to top, #000 10%, transparent 90%);
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 90%);
}
.deco-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.25) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.4;
}

/* 顶栏 */
.topbar {
  position: relative;
  z-index: 2;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 56px; height: 56px; border-radius: 16px;
  object-fit: cover; box-shadow: var(--shadow-sm);
  border: 2px solid var(--border);
}
.brand-text h1 {
  font-family: var(--font-display);
  font-size: clamp(20px, 4vw, 28px);
  margin: 0; letter-spacing: 1px; font-weight: 800;
}
.brand-en { font-size: 0.55em; opacity: 0.7; font-weight: 600; letter-spacing: 2px; }
.brand-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-dim); }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.live-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600;
}
.live-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #ff4d6d; box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.7);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.6); }
  70% { box-shadow: 0 0 0 9px rgba(255, 77, 109, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0); }
}

.theme-switch { display: inline-flex; gap: 6px; background: var(--surface); padding: 5px; border-radius: 999px; border: 1px solid var(--border); }
.theme-btn {
  border: 0; background: transparent; color: var(--text-dim);
  padding: 8px 13px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 700; font-family: var(--font-body);
  transition: all 0.2s ease;
}
.theme-btn:hover { color: var(--text); }
.theme-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #111; box-shadow: var(--glow);
}

/* 布局 */
.layout {
  position: relative; z-index: 2;
  max-width: var(--maxw); margin: 0 auto; padding: 10px 20px 40px;
  display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: var(--gap); align-items: start;
}
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* 播放器 */
.player { padding: 22px; position: sticky; top: 14px; }
.player-cover-wrap { position: relative; width: 100%; aspect-ratio: 1 / 1; max-width: 260px; margin: 0 auto 16px; }
.player-cover {
  width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.player-eq { position: absolute; bottom: 12px; right: 12px; display: flex; gap: 3px; align-items: flex-end; height: 22px; opacity: 0; transition: opacity 0.3s; }
.player-eq span { width: 4px; background: var(--accent); border-radius: 2px; height: 100%; animation: eq 0.9s ease-in-out infinite; }
.player-eq span:nth-child(2) { animation-delay: 0.15s; }
.player-eq span:nth-child(3) { animation-delay: 0.3s; }
.player-eq span:nth-child(4) { animation-delay: 0.45s; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }
body.playing .player-eq { opacity: 1; }

.player-meta { text-align: center; margin-bottom: 14px; }
.now-series {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: var(--accent-2); background: var(--surface-2); padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
}
.now-title { font-family: var(--font-display); font-size: 19px; margin: 0 0 4px; line-height: 1.3; }
.now-date { font-size: 12px; color: var(--text-dim); }

.progress { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; }
.time { font-size: 12px; color: var(--text-dim); min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.seek { flex: 1; }

.controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.ctrl {
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 18px; display: grid; place-items: center; transition: transform 0.15s, box-shadow 0.2s;
}
.ctrl:hover { transform: scale(1.06); }
.ctrl-play {
  width: 62px; height: 62px; font-size: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #111; border: 0; box-shadow: var(--glow);
}
.ctrl-extra { display: flex; gap: 14px; align-items: center; margin-top: 10px; width: 100%; justify-content: center; flex-wrap: wrap; }
.ctrl-extra label { font-size: 12px; color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; }
.ctrl-extra select, .ctrl-extra input[type="range"] { accent-color: var(--accent); }
.ctrl-extra select {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 6px; font-family: var(--font-body);
}

/* 列表 */
.list { padding: 18px; display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.list-head { margin-bottom: 12px; }
.search {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 14px; font-family: var(--font-body); outline: none;
}
.search:focus { border-color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 600;
  transition: all 0.18s;
}
.chip:hover { color: var(--text); }
.chip.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #111; border-color: transparent; }

.shows { list-style: none; margin: 0; padding: 0 4px 0 0; overflow-y: auto; flex: 1; }
.shows::-webkit-scrollbar { width: 8px; }
.shows::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 8px; }

.show-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border-radius: var(--radius-sm); cursor: pointer; transition: background 0.15s, transform 0.15s;
  position: relative;
}
.show-item:hover { background: var(--surface-2); }
.show-item.active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.show-num {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); font-size: 12px; color: var(--text-dim); font-weight: 700;
}
.show-info { min-width: 0; flex: 1; }
.show-title { font-size: 14.5px; font-weight: 600; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.show-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }
.show-play-ic { color: var(--accent); font-size: 16px; opacity: 0; transition: opacity 0.15s; }
.show-item:hover .show-play-ic, .show-item.active .show-play-ic { opacity: 1; }
.list-empty { text-align: center; color: var(--text-dim); padding: 30px 0; font-size: 14px; }

/* 页脚 */
.foot { position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto; padding: 8px 20px 40px; text-align: center; }
.foot p { font-size: 12.5px; color: var(--text-dim); margin: 0; line-height: 1.7; }

/* range 美化 */
input[type="range"] { accent-color: var(--accent); cursor: pointer; }

/* 频道切换条 */
.channels {
  position: relative; z-index: 2;
  max-width: var(--maxw); margin: 0 auto; padding: 4px 20px 0;
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}
.chan-btn {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); padding: 9px 16px; border-radius: 999px; cursor: pointer;
  font-size: 14px; font-weight: 700; font-family: var(--font-body);
  display: inline-flex; align-items: center; gap: 8px; transition: all 0.2s ease;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.chan-btn:hover { color: var(--text); transform: translateY(-1px); }
.chan-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #111; border-color: transparent; box-shadow: var(--glow);
}
.chan-count {
  font-size: 11px; font-weight: 700; opacity: 0.8;
  background: rgba(0, 0, 0, 0.12); padding: 1px 7px; border-radius: 999px;
}
.chan-btn.active .chan-count { background: rgba(0, 0, 0, 0.18); }

/* B站播放器 */
.bili-frame-wrap {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm); overflow: hidden; background: #000;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 14px;
}
#biliFrame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.bili-now { text-align: center; padding: 0 6px; }
.bili-now .now-series { display: inline-block; }
.bili-now .now-title { margin: 6px 0 4px; }
.bili-audio-btn {
  margin-top: 12px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); padding: 8px 16px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 700; font-family: var(--font-body); transition: all 0.2s ease;
}
.bili-audio-btn:hover { color: var(--text); transform: translateY(-1px); }
.bili-audio-btn.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #111; border-color: transparent; box-shadow: var(--glow); }
body.theme-scrapbook .bili-frame-wrap { border: 6px solid #fff; box-shadow: var(--shadow-sm); transform: rotate(0.5deg); }

/* 听音频：浮动小窗模式 */
body.bili-mini .bili-frame-wrap {
  position: fixed; right: 14px; bottom: 14px; width: 240px; aspect-ratio: 16 / 9;
  margin: 0; z-index: 60; box-shadow: 0 14px 40px rgba(0,0,0,0.5);
  border: 2px solid var(--border); transform: none !important; border-radius: 12px;
}
body.bili-mini .bili-now { display: none; }
@media (max-width: 860px) {
  body.bili-mini .bili-frame-wrap { width: 160px; right: 10px; bottom: 10px; }
}


@media (max-width: 860px) {
  .player { position: static; }
  .list { max-height: none; }
  .shows { max-height: 60vh; }
}
