:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #2b2f36;
  --muted: #5a626e;        /* 适老：白底对比度 6.2:1（原 #8a919c 仅 3.2:1，不达标） */
  --accent: #6a5ae0;
  --accent-deep: #4f42b8;  /* 适老：accent-soft 底上徽标/选中 Tab 文字 6.4:1（勿在 accent-soft 底用 --accent 文字，仅 4.35:1） */
  --accent-soft: #efecfb;
  --gold: #8a6d1a;         /* 适老：已收藏星标 4.9:1（原 #e8b04b 仅 1.9:1，严重不达标） */
  --border: #d8dce4;       /* 适老：描边加深，提升控件辨识 */
  --radius: 12px;
  --bar-h: 72px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
  padding: 12px 28px; background: var(--card);
  border-bottom: 1px solid var(--border);
}
.brand { font-size: 20px; font-weight: 700; color: var(--accent); justify-self: start; }
.brand-logo { display: block; height: 36px; width: auto; } /* 顶栏 logo：原图 882×369 按高 36px 等比缩放，避免撑高顶栏 */
.nav { display: flex; gap: 10px; justify-self: center; } /* 适老：防 active scale(1.2) 放大后与相邻 Tab 临界贴合/重叠 */
.nav-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; font-size: 15px;
  color: var(--muted); transition: transform .15s, color .15s, background .15s;
}
.nav-tab .nav-icon { font-size: 16px; line-height: 1; } /* 防 emoji 行盒撑高导致平台差异 */
.nav-tab.active {
  background: var(--accent-soft); color: var(--accent-deep);
  font-weight: 700; transform: scale(1.2);
}
.search {
  justify-self: end; padding: 8px 14px; width: 260px;
  border: 1px solid var(--border); border-radius: 999px; font-size: 16px; outline: none;
} /* 适老：搜索框字号 16px——低于 16px 时 iOS Safari 聚焦输入框会自动缩放页面 */
.search:focus { border-color: var(--accent); }

.app { max-width: 1080px; margin: 0 auto; padding: 24px 28px calc(var(--bar-h) + 32px); }
.section-label { font-size: 16px; font-weight: 600; color: var(--muted); margin: 24px 0 12px; letter-spacing: 1px; } /* 适老：区块标题 16px 加粗（原 13px），"按爱好浏览"/"最近添加"共用 */

.recent-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; } /* 适老：垂直列表，手机 1 列 / 宽屏多列，整页上下滑动 */
.card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px; cursor: pointer; transition: box-shadow .15s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.card .thumb {
  flex: 0 0 100px; width: 100px; height: 100px;
  border-radius: 8px; background: var(--accent-soft); overflow: hidden;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .thumb .ph { font-size: 26px; font-weight: 700; color: var(--accent-deep); line-height: 1.2; text-align: center; } /* 适老：无封面大字占位 ≥24px */
.card .info { min-width: 0; flex: 1; }
.card .t { font-size: 15px; font-weight: 600; color: var(--text); white-space: normal; overflow-wrap: anywhere; } /* 适老：标题完整展示，优先词边界断行 */
.card .m { font-size: 13px; color: var(--muted); margin-top: 4px; }
.card .badge { background: var(--accent-soft); color: var(--accent-deep); font-size: 13px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; display: inline-block; margin-top: 6px; }
.card .fav { color: var(--gold); font-size: 24px; line-height: 1; cursor: pointer; padding: 10px; margin: -10px; display: inline-block; min-width: 44px; text-align: center; } /* 适老：爱心大字符，负 margin 扩触控区（min-width 44px 兜底窄字形 ♡）且不挤占布局 */

/* 播放中卡片选中效果（适老：accent 边框 + 淡紫底 + 缩略图 ▶ 遮罩，色弱亦可辨；徽章随卡片一起由 JS 增删） */
.card.playing { border-color: var(--accent); background: var(--accent-soft); }
.card.playing .t { color: var(--accent-deep); }
.card.playing .thumb::after {
  content: '▶'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff; background: rgba(0, 0, 0, .3);
}
.now-tag { display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 999px; background: var(--accent-deep); color: #fff; font-size: 13px; font-weight: 600; vertical-align: 3px; white-space: nowrap; line-height: 1.4; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.cat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; cursor: pointer; transition: box-shadow .15s; text-align: center;
}
.cat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.cat-card .icon { font-size: 40px; line-height: 1; margin-bottom: 8px; } /* 适老：剧种卡片随机图标（每次刷新随机分配） */
.cat-card .name { font-size: 17px; font-weight: 700; color: var(--text); }
.cat-card .count { font-size: 13px; color: var(--muted); margin-top: 4px; }

#play-all { /* 收藏页"播放全部"按钮：原胶囊样式，功能不变 */
  padding: 8px 18px; background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; font-size: 14px; cursor: pointer; color: var(--text);
}
#play-all:hover { border-color: var(--accent); color: var(--accent); }

.list-head { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.list-head select { padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border); }

#track-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; } /* 分类页/收藏页卡片列表：同"最近添加"布局，手机 1 列 / 宽屏多列 */

.pager { display: flex; justify-content: center; gap: 6px; margin-top: 18px; font-size: 14px; }
.pager button {
  min-width: 32px; padding: 6px 10px; border: 1px solid var(--border);
  background: var(--card); border-radius: 8px; cursor: pointer;
}
.pager button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.empty, .error-box { text-align: center; color: var(--muted); padding: 60px 0; font-size: 15px; }
.error-box { color: #b04a4a; }

.player-bar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--bar-h); z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: var(--card); border-top: 1px solid var(--border);
}
.pb-cover { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--accent-soft); }
.pb-info { min-width: 150px; max-width: 240px; }
.pb-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-meta { font-size: 12px; color: var(--muted); }
.pb-controls { display: flex; gap: 8px; }
.pb-controls button { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); cursor: pointer; font-size: 15px; }
.pb-controls #pb-play { background: var(--accent); color: #fff; border-color: var(--accent); }
.pb-controls #pb-loop.on { color: var(--gold); } /* 循环激活态（列表/单曲循环） */
.pb-progress { flex: 1; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.pb-progress input { flex: 1; }
.pb-extra { display: flex; align-items: center; gap: 10px; }
.pb-extra button { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.pb-extra button.on { color: var(--gold); }

/* 播放条两组布局：桌面恒完整横幅（.pb-full display:contents 平铺参与 flex，迷你行/细线/收起钮不显示）；手机常态迷你行、点 ▲ 展开**全屏播放页** */
.pb-mini { display: none; }
.pb-full { display: contents; }
.pb-mini-line { display: none; }
#pb-collapse { display: none; }
.pf-only { display: none; } /* 全屏播放页专属元素（收起头/封面播放态/歌词区/静音钮）：仅手机展开时显示 */
.pf-cover-wrap { display: contents; } /* 桌面横幅时封面直接参与 flex（与原直排一致）；手机展开时改 flex 居中 */

.to-top { /* 置顶悬浮按钮：默认右下角，播放条出现时上移到其上方；支持拖拽移动 */
  position: fixed; right: 16px; bottom: 16px; z-index: 25;
  width: 48px; height: 48px; border-radius: 50%; padding: 0;
  background: var(--card); border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(0,0,0,.15);
  font-size: 24px; line-height: 1; cursor: grab; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.player-bar:not(.hidden) ~ .to-top { bottom: calc(var(--bar-h) + 16px); }
.to-top.dragging { cursor: grabbing; box-shadow: 0 6px 16px rgba(0,0,0,.2); }

/* 图片大图灯箱（适老：48px 按钮、深色遮罩、18px 标题；z-index 高于播放条，浏览图片不打断播放） */
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .88);
  display: flex; align-items: center; justify-content: center;
}
.lightbox.hidden { display: none; }
.lb-stage { max-width: 92vw; max-height: 80vh; border-radius: 6px; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.lb-stage.hidden { visibility: hidden; } /* 换图间隙隐藏旧图而非移除，避免布局抖动 */
.lb-msg { position: absolute; color: #fff; font-size: 18px; padding: 0 24px; text-align: center; }
.lb-msg.hidden { display: none; }
.lb-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 14px 120px 20px; background: linear-gradient(transparent, rgba(0,0,0,.65));
}
.lb-title { color: #fff; font-size: 18px; overflow-wrap: anywhere; text-align: center; }
.lb-count { color: #ccc; font-size: 16px; white-space: nowrap; }
.lb-btn {
  position: absolute; width: 48px; height: 48px; border-radius: 50%; border: none; padding: 0;
  background: rgba(255,255,255,.14); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; line-height: 1;
}
.lb-btn:hover:not(:disabled) { background: rgba(255,255,255,.28); }
.lb-btn:disabled { opacity: .3; cursor: default; }
.lb-close { top: 16px; right: 16px; font-size: 20px; }
.lb-close:hover:not(:disabled) { background: rgba(255,80,80,.55); }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
body.lb-open { overflow: hidden; } /* 灯箱打开时锁定背景滚动 */

.video-stage {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bar-h) + 16px);
  z-index: 25; width: min(720px, 92vw); background: #000; border-radius: var(--radius); overflow: hidden;
}
.video-stage video { width: 100%; display: block; max-height: 60vh; }
.video-close {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px;
  border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; cursor: pointer;
}
.hidden { display: none !important; }

/* 窄视口（手机）：顶栏换行、播放条迷你/展开双态、视频浮层自适应 */
@media (max-width: 780px) {
  :root { --bar-h: 60px; } /* 播放条迷你态常态高：页面留白/视频浮层/置顶按钮定位基准；展开面板（~151px）由 body.pb-expanded 覆盖 */
  .topbar { grid-template-columns: auto 1fr; gap: 10px; padding: 10px 14px; }
  .brand { grid-column: 1; grid-row: 1; }
  .nav { grid-column: 2; grid-row: 1; justify-self: center; } /* 与品牌同行，居中于剩余空间 */
  .search { grid-column: 1 / -1; grid-row: 2; width: 100%; justify-self: stretch; } /* 搜索框位于 Tab 栏下方，全宽第二行 */
  .nav-tab { padding: 12px 16px; } /* 适老：导航 Tab 触控高度达标 44px */
  .app { padding: 16px 14px calc(var(--bar-h) + 24px); }

  /* 播放条：常态单行迷你条 60px（▶ 标题 ⏭ ♡ ▲ + 顶部 3px 细进度线），点 ▲ 展开**全屏播放页**，⬇ 收起 */
  .player-bar { flex-direction: column; align-items: stretch; gap: 0; padding: 0; }
  .pb-mini { display: flex; align-items: center; gap: 10px; height: 60px; padding: 8px 14px; }
  .pb-mini button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); cursor: pointer; font-size: 18px; line-height: 1; flex: 0 0 auto; }
  .pb-mini #pb-mini-play { background: var(--accent); color: #fff; border-color: var(--accent); font-size: 16px; }
  .pb-mini-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
  .pb-mini-line { display: block; position: absolute; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); }
  .pb-full { display: none; }
  .player-bar.expanded .pb-mini { display: none; }
  .player-bar.expanded .pb-mini-line { display: none; } /* 全屏页自带宽进度条，顶部细线让位 */
  /* 全屏播放页（▲ 展开）：fixed 覆盖全屏，纵向排布 头/圆封面/居中信息/进度条/歌词区/控制行/音量条 */
  .player-bar.expanded .pb-full {
    display: flex; flex-direction: column; align-items: stretch; gap: 0;
    position: fixed; inset: 0; z-index: 35; padding: 0;
    background: var(--card); overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .player-bar.expanded .pf-only { display: flex; } /* 展开时显示全屏专属元素 */
  .pf-head { align-items: center; justify-content: space-between; padding: 12px 16px 0; }
  #pb-collapse { display: inline-flex; align-items: center; justify-content: center; border: none; background: none; font-size: 16px; font-weight: 600; color: var(--text); padding: 8px; min-height: 44px; }
  .pf-mode { font-size: 13px; color: var(--muted); }
  .pf-cover-wrap { display: flex; justify-content: center; margin: 10px 0 2px; position: relative; }
  .pb-cover { width: min(62vw, 250px); height: min(62vw, 250px); border-radius: 50%; object-fit: cover; background: var(--accent-soft);
    box-shadow: 0 0 0 6px var(--accent-soft), 0 0 0 10px #c9c3f0, 0 10px 24px rgba(0,0,0,.16); }
  .pf-cover-play { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; justify-content: center; align-items: center;
    border-radius: 50%; background: rgba(0,0,0,.35); color: #fff; font-size: 26px; pointer-events: none; }
  .pb-info { text-align: center; padding: 8px 20px 2px; }
  .pb-title { font-size: 20px; font-weight: 600; white-space: normal; overflow-wrap: anywhere; }
  .pb-meta { font-size: 15px; color: var(--muted); margin-top: 2px; }
  .pb-progress { display: flex; align-items: center; gap: 10px; padding: 8px 20px; font-size: 13px; color: var(--muted); }
  .pb-progress input { flex: 1; height: 24px; } /* 统一 range 高度，消除 iOS Safari 差异 */
  .player-bar.expanded #pb-dur::before { content: "-"; } /* 总时长带 - 号（参考图样式） */
  .pf-lyrics { min-height: 40px; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; padding: 2px 24px; text-align: center; }
  .pb-controls { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 12px; }
  .pb-controls button { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); cursor: pointer; font-size: 20px; line-height: 1; }
  .pb-controls #pb-play { width: 64px; height: 64px; font-size: 24px; background: var(--accent); color: #fff; border-color: var(--accent); }
  .pb-controls #pb-loop { font-size: 20px; }
  .pb-extra { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 14px 20px 24px; }
  .pb-extra button { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); min-height: 44px; min-width: 44px; }
  .pb-extra #pb-volume { width: 150px; }

  .pager button { min-width: 40px; padding: 8px 12px; }
  .video-stage { width: 96vw; bottom: calc(var(--bar-h) + 8px); }
  .lb-bar { padding: 12px 70px 16px; } /* 手机：给左右翻页按钮让出空间 */

  /* 展开态：全屏播放页 fixed inset:0 覆盖，底部无需再让位；收起时 bar 回迷你条 60px，body class 由 setExpanded 联动 */
}
