/* ============== SMusic 增强样式 - 浅色友好风 ============== */

:root {
    /* v27+:浅色主题 color-scheme 声明 */
    color-scheme: light;

    --bg: #f7f7fa;
    --bg-elevated: #ffffff;
    --bg-hover: #f0f0f4;
    --bg-active: #ebebef;
    --border: #ececf0;
    --border-strong: #d8d8de;
    --text: #1c1c20;
    --text-soft: #3f3f46;
    --text-mute: #6b6b75;
    --accent: #6d28d9;
    --accent-soft: rgba(109, 40, 217, 0.08);
    --accent-line: rgba(109, 40, 217, 0.28);
    --radius: 10px;
    --radius-sm: 6px;
    /* v42:与 app.css --font 对齐,补 system-ui(Win11/现代 Android)与
       HarmonyOS Sans SC(华为设备)。防御:任何重新排序或单独引用此文件都安全 */
    --font: system-ui, -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "微软雅黑", sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* 隐藏原始雪碧图(由 SVG 替代) */
.grid-music-container .u-play-btn,
.grid-music-container .volume-control {
    background-image: none !important;
}

/* ============== 搜索匹配高亮 ============== */

.m-music-list-wrap li mark {
    /* v55+:硬编码 rgba(109, 40, 217, 0.18) → color-mix 跟随 6 主题 accent —
       与 app.css:73-75/213 等其他 9 处 color-mix 用法保持一致,
       主题切换时搜索高亮底色跟随 --accent 变(否则仅 Dark/Light 默认紫,
       Night/Amber/Ocean/Forest 主题下与主题色对不上)。 */
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
    padding: 0 1px;
    border-radius: 2px;
    font-weight: var(--fw-semibold);
}

/* ============== 列表搜索框 ============== */

.m-list-search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    transition: border-color var(--t-fast);
    flex-shrink: 0;
    /* v50+:空占位(enhance.js injectSearchBox 异步注入 input 前)保持
       与填充后一致的高度,避免列表 li 上下抖动。
       实测各视口填充后高度:
         ≥1024 / ≤480: 58px
         568-720: 61px(≤720 块 padding 14+14 + input line-height normal 21px)
       取最大值 61px,覆盖所有断点。 */
    min-height: 61px;
    box-sizing: border-box;
}

.m-list-search-wrap:focus-within {
    border-bottom-color: var(--accent);
}

.m-list-search-wrap svg {
    width: 14px;
    height: 14px;
    color: var(--text-mute);
    flex-shrink: 0;
}

.m-list-search {
    flex: 1;
    border: none;
    background: transparent;
    /* outline: none 不应孤立存在 — 必须配对 :focus-visible 提供键盘焦点反馈。
       搜索框是高频键盘交互入口(输入查询、Esc 清空、↑↓ 选匹配项),键盘用户
       Tab 到搜索框无任何视觉反馈此前是全站唯一 a11y 漏洞。 */
    outline: none;
    /* v42:font-size 15px → var(--fs-xl) token 化 */
    font-size: var(--fs-xl);
    color: var(--text);
    padding: 0;
    font-family: var(--font);
    font-weight: var(--fw-medium);
}

.m-list-search:focus-visible {
    /* 与 app.css 全站 focus-visible ring 一致:accent 2px outline + 2px offset */
    outline: 2px solid var(--accent, currentColor);
    outline-offset: 2px;
    border-radius: var(--r-xs, 4px);
}

.m-list-search::placeholder {
    color: var(--text-mute);
}

.m-list-search-up,
.m-list-search-down {
    border: none;
    background: transparent;
    color: var(--text-mute);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    /* v42:font-size 14px → var(--fs-lg) token 化;
       line-height 1 保留(SVG 按钮,字面无 token,符合 line-height:1 按钮通用约定) */
    font-size: var(--fs-lg);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    /* v18+ 触摸区扩展范式:透明 ::before 撑大到 44×44,移动端易点 */
    position: relative;
    transition: color var(--t-fast), background var(--t-fast);
}
.m-list-search-up::before,
.m-list-search-down::before {
    content: "";
    position: absolute;
    inset: -6px;
}
.m-list-search-up:hover:not(:disabled),
.m-list-search-down:hover:not(:disabled) {
    color: var(--accent);
    background: var(--accent-soft);
}
/* v55+:键盘焦点反馈 — Tab 焦点进入时与 :hover 视觉一致。 */
.m-list-search-up:focus-visible,
.m-list-search-down:focus-visible {
    color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}
.m-list-search-up:disabled,
.m-list-search-down:disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

/* v41+:搜索 ↑↓ 按钮换 SVG 图标(替换原"↑↓"文本),与顶栏 SVG 风格统一 */
.m-list-search-up svg,
.m-list-search-down svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.m-list-search-clear {
    border: none;
    background: transparent;
    color: var(--text-mute);
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    /* v42:font-size 16px → var(--fs-2xl) token 化;
       line-height 1 保留(SVG 按钮,字面无 token) */
    font-size: var(--fs-2xl);
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    transition: color var(--t-fast), background var(--t-fast);
    padding: 0;
    /* v18+ 触摸区扩展:与 ↑↓ 同步,撑大到 38×38 */
    position: relative;
}
.m-list-search-clear::before {
    content: "";
    position: absolute;
    inset: -8px;
}

.m-list-search-clear.visible {
    display: inline-flex;
}

.m-list-search-clear:hover {
    color: var(--accent);
    background: var(--accent-soft);
}
/* v55+:键盘焦点反馈。 */
.m-list-search-clear:focus-visible {
    color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}

/* v41+:清除 × 按钮换 SVG 图标(替换原"×"文本),与 ↑↓ 风格统一 */
.m-list-search-clear svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.m-list-search-stats {
    /* v42:font-size 14px → var(--fs-lg) token 化 */
    font-size: var(--fs-lg);
    color: var(--text-soft);
    padding: 6px 16px;
    font-family: var(--font);
    font-variant-numeric: tabular-nums;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: var(--fw-medium);
}

/* 底部播放器当前曲目序号 — 由 smusic.enhance.js 的 stripPlayerTitlePrefix 注入。
   把 list 文件生成的 "[N] 标题" 剥成 序号 span + 纯标题,水平排列。
   视觉上与列表 .li-index 对齐(同色、同字号基线),但稍小以避免抢占标题注意力。 */
.u-music-title strong .player-track-index {
    /* v42:font-size 12px → var(--fs-base) token 化 */
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
    color: var(--text-mute);
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    margin-right: 10px;
    padding: 1px 5px;
    background: var(--bg-hover);
    border-radius: 3px;
    flex-shrink: 0;
    align-self: center;
    /* v42:letter-spacing 0.02em → var(--tracking-tag) token 化 */
    letter-spacing: var(--tracking-tag);
    /* v24: 用 opacity 0.85 让 pill 视觉降权,不抢标题;
       hover 标题时整体提升到 1 让序号更明显 */
    opacity: 0.85;
    transition: opacity var(--t-fast) var(--ease);
}

.u-music-title:hover strong .player-track-index {
    opacity: 1;
}

/* 搜索无结果空状态 — 卡片式(与 .fav-empty 风格统一,带搜索图标 + 标题 + 清除按钮) */
.m-list-empty {
    padding: 56px 24px 40px;
    text-align: center;
    color: var(--text-soft);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.m-list-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    color: var(--text-mute);
    flex-shrink: 0;
    /* v56+:2.4s 轻微脉冲(scale 1↔1.06 + opacity 0.92↔1),
       让搜索无结果空状态"在等你换词"的呼吸感。
       幅度 < 10% 不夺戏;prefers-reduced-motion 在下方禁用。 */
    animation: emptyPulse 2.4s var(--ease-in-out) infinite;
}

@keyframes emptyPulse {
    0%, 100% { transform: scale(1); opacity: 0.92; }
    50%      { transform: scale(1.06); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .m-list-empty-icon { animation: none; }
}

.m-list-empty-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    opacity: 0.7;
}

.m-list-empty-title {
    /* v42:font-size 16px → var(--fs-2xl) token 化 */
    font-size: var(--fs-2xl);
    font-weight: var(--fw-semibold);
    color: var(--text);
    margin-top: 2px;
}

.m-list-empty-desc {
    /* v42:font-size 13px → var(--fs-md) token 化;
       line-height 1.6 → var(--lh-relaxed) token 化,与 favorites.css 对齐 */
    font-size: var(--fs-md);
    color: var(--text-soft);
    line-height: var(--lh-relaxed);
    max-width: 320px;
}

.m-list-empty-desc strong {
    color: var(--accent);
    background: var(--accent-soft);
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: var(--fw-semibold);
}

.m-list-empty-clear {
    margin-top: 4px;
    padding: 6px 16px;
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-soft);
    border-radius: var(--radius-sm);
    cursor: pointer;
    /* v42:font-size 13px → var(--fs-md) token 化 */
    font-size: var(--fs-md);
    font-weight: var(--fw-medium);
    font-family: inherit;
    /* P1 性能修复:精确过渡列表 */
    transition:
        color var(--t-fast) var(--ease),
        border-color var(--t-fast) var(--ease),
        background var(--t-fast) var(--ease),
        transform var(--t-fast) var(--ease);
    -webkit-tap-highlight-color: transparent;
}

.m-list-empty-clear:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}
/* v55+:键盘焦点反馈 — 与 :hover 视觉对齐(项目内 .app-keyhint-btn 既有范式)。 */
.m-list-empty-clear:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}

.m-list-empty-clear:active {
    transform: scale(0.96);
}

/* ============== 进度条 hover tooltip ============== */

.m-progress-tip {
    position: absolute;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    padding: 3px 6px;
    background: var(--bg-active);
    color: var(--text);
    font-size: var(--fs-sm);
    font-family: var(--mono);
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    pointer-events: none;
    opacity: 0;
    /* v55+:补 var(--ease) — 与项目其他 transition 一致 */
    transition: opacity var(--t-fast) var(--ease);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    /* v55+:z-index 10 → 2 — tooltip 是 .u-process 的子元素,在其定位祖先内
       自然提升,无需大数值(z=10 比 --z-sticky=100 小,但仍是无意义的"魔法数字")。
       走 token:在 app.css 没有 --z-tooltip,留 fallback 2。 */
    z-index: var(--z-thumb);
}

.u-process:hover .m-progress-tip {
    opacity: 1;
}

/* ============== 键盘 cheat sheet (原生 <dialog>) ============== */

.m-cheatsheet {
    /* 浏览器默认 dialog 居中 */
    border: none;
    padding: 0;
    background: transparent;
    color: inherit;
    max-width: 90vw;
    max-height: 85vh;
}

.m-cheatsheet::backdrop {
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

@keyframes cheatSheetIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.m-cheatsheet[open] {
    animation: cheatSheetIn var(--t-base) var(--ease);
}

.m-cheatsheet-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0;
    max-width: 420px;
    width: 100%;
    /* v40 P0 修复:568×320 横屏 85vh = 272px,内容 ~480px 被截断 208px。
       把 max-height 移到 card 并加 overflow-y:auto,grid 9 行可通过滚动浏览。
       原 line 340 overflow:hidden 是为外圆角剪裁,现改 overflow-y:auto,
       卡片外层 .m-cheatsheet 已有 max-height:85vh + dialog 圆角剪裁,不会
       出现"内容溢出卡片圆角"的视觉问题。 */
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 32px);
    overflow-y: auto;
    box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.25);
}

.m-cheatsheet-title {
    /* v42:font-size 17px → var(--fs-3xl) token 化 */
    font-size: var(--fs-3xl);
    font-weight: var(--fw-bold);
    color: var(--text);
    font-family: var(--font);
    /* v42:letter-spacing 0 删 — 无意义的归零(token 默认 0,显式声明是冗余) */
    text-transform: none;
    margin: 0;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.m-cheatsheet-grid {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 0;
}

.m-cheatsheet-key {
    font-family: var(--mono);
    /* v42:font-size 14px → var(--fs-lg) token 化 */
    font-size: var(--fs-lg);
    padding: 10px 22px;
    color: var(--text-soft);
    border-top: 1px solid var(--border);
    font-weight: var(--fw-semibold);
}

.m-cheatsheet-desc {
    /* v42:font-size 15px → var(--fs-xl) token 化 */
    font-size: var(--fs-xl);
    padding: 10px 22px;
    color: var(--text);
    border-top: 1px solid var(--border);
    font-family: var(--font);
    font-weight: var(--fw-medium);
}

.m-cheatsheet-hint {
    padding: 12px 22px;
    border-top: 1px solid var(--border);
    font-family: var(--font);
    /* v42:font-size 13px → var(--fs-md) token 化 */
    font-size: var(--fs-md);
    color: var(--text-mute);
    text-align: center;
    margin: 0;
    font-weight: var(--fw-medium);
}

/* ============== 关于弹窗 (原生 <dialog>) ==============
   结构与 .m-cheatsheet 对齐(标题/内容/底部提示),max-width 放宽到 440px
   容纳"音乐版权""友情提示"两段较长正文 + 个人信息三行 dl。 */

.m-about {
    border: none;
    padding: 0;
    background: transparent;
    color: inherit;
    max-width: 90vw;
    max-height: 85vh;
}

.m-about::backdrop {
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

@keyframes aboutIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.m-about[open] {
    animation: aboutIn var(--t-base) var(--ease);
}

/* v53 降级:旧浏览器无 showModal,用 [open]+.visible 模拟显示 */
.m-about.visible:not([open]) { display: none; }

.m-about-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0;
    max-width: 440px;
    width: 100%;
    /* 与 cheatsheet 一致:max-height 移到 card + overflow-y:auto,
       568×320 横屏 85vh = 272px 容纳全部 section 滚动可达。 */
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 32px);
    overflow-y: auto;
    box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.25);
}

.m-about-title {
    font-size: var(--fs-3xl);
    font-weight: var(--fw-bold);
    color: var(--text);
    font-family: var(--font);
    text-transform: none;
    margin: 0;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.m-about-body {
    padding: 0;
}

.m-about-section {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
}

.m-about-section:first-child {
    border-top: none;
}

/* 个人信息 section 单独加大 padding,视觉上与上方两段正文分组 */
.m-about-section--info {
    padding-bottom: 16px;
}

.m-about-heading {
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--text-soft);
    margin: 0 0 8px 0;
    font-family: var(--font);
    text-transform: none;
    /* 字母间距拓宽,与正文区分小标题层级 */
    letter-spacing: 0.5px;
}

.m-about-text {
    font-size: var(--fs-lg);
    line-height: var(--lh-relaxed);
    color: var(--text);
    font-family: var(--font);
    margin: 0;
    font-weight: var(--fw-medium);
}

.m-about-list {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 0;
    margin: 0;
}

.m-about-list dt {
    padding: 5px 0;
    color: var(--text-soft);
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    font-family: var(--font);
}

.m-about-list dd {
    padding: 5px 0;
    margin: 0;
    color: var(--text);
    font-size: var(--fs-lg);
    font-weight: var(--fw-medium);
    font-family: var(--font);
    /* v53 r2:word-break:break-all → overflow-wrap:break-word。
       完整 URL "https://www.guanjihuan.com/about" 在 360px 视口 dd 宽 ~222px
       边界时,break-all 会在 "guanjihuan.c|om" 中间断字(丑);break-word 优先在
       "/" 等软换行点断开,得到 "https://www.guanjihuan.com" + "/about" 自然分段,
       同时邮箱 "guanjihuan@163.com" 在 320 极窄时也在 "@" 处断开而非拆字。
       旧 iOS Safari(< 9) 不支持 overflow-wrap,降级到默认 normal 会溢出 — 360 屏
       dd 宽 222 实际不溢出(URL 渲染宽 ~216),旧浏览器即使溢出也会被 dl grid
       限死 1fr 而非溢出 card。 */
    overflow-wrap: break-word;
}

.m-about-list a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--t-fast) var(--ease);
}

.m-about-list a:hover,
.m-about-list a:focus-visible {
    color: var(--accent);
    text-decoration: underline;
}

.m-about-hint {
    padding: 12px 22px;
    border-top: 1px solid var(--border);
    font-family: var(--font);
    font-size: var(--fs-md);
    color: var(--text-mute);
    text-align: center;
    margin: 0;
    font-weight: var(--fw-medium);
}

/* ============== 返回首页按钮 ============== */

.back-home {
    position: fixed;
    top: 16px;
    left: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    color: var(--text);
    text-decoration: none;
    font-family: var(--font);
    /* v42:font-size 15px → var(--fs-xl) token 化 */
    font-size: var(--fs-xl);
    font-weight: var(--fw-semibold);
    /* v42:letter-spacing 0 删 — 显式归零是冗余 */
    text-transform: none;
    padding: 8px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    /* P1 性能修复:精确过渡列表。v55+:补 var(--ease) — 与项目其他 transition 一致 */
    transition:
        color var(--t-fast) var(--ease),
        border-color var(--t-fast) var(--ease),
        background var(--t-fast) var(--ease),
        transform var(--t-fast) var(--ease),
        box-shadow var(--t-fast) var(--ease);
    /* v55+:z-index 100 → var(--z-sticky, 100) — 与 app.css --z-* token 系统对齐 */
    z-index: var(--z-sticky, 100);
    user-select: none;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.back-home::before {
    content: "←";
    /* v42:font-size 15px → var(--fs-xl) token 化 */
    font-size: var(--fs-xl);
    /* line-height: 1 保留(SVG/单字符箭头,字面无 token) */
    line-height: 1;
}

.back-home:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}
/* v55+:键盘焦点反馈。 */
.back-home:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ============== 加载状态 ============== */

.m-list-loading {
    padding: 28px;
    text-align: center;
    color: var(--text-soft);
    font-family: var(--font);
    /* v42:font-size 15px → var(--fs-xl) token 化 */
    font-size: var(--fs-xl);
    font-weight: var(--fw-medium);
}

.m-list-loading::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 8px;
    border: 1px solid var(--text-mute);
    border-top-color: var(--accent);
    border-radius: 50%;
    vertical-align: middle;
    animation: spin 0.8s linear infinite;
}

/* v58+:spin 关键帧已统一在 smusic.css 定义(全局)。浏览器允许跨文件
   keyframes 复用,删掉 enhance.css 本地副本消除冗余。 */

.m-music-list-wrap li.current {
    scroll-margin-top: 8px;
}

/* ============== 响应式 ============== */

@media (max-width: 720px) {
    /* 搜索框:加大内边距,便于触摸 */
    .m-list-search-wrap {
        padding: 14px 14px;
        gap: 8px;
    }
    .m-list-search {
        /* v42:font-size 15px → var(--fs-xl) token 化;
           防 iOS 自动缩放为 16px 等价,但保持视觉 */
        font-size: var(--fs-xl);
    }
    .m-list-search-clear {
        width: 26px;
        height: 26px;
    }
    .m-list-search-stats {
        padding: 6px 14px;
    }

    /* 空状态:紧凑 */
    .m-list-empty {
        padding: 40px 20px 32px;
        /* v42:font-size 13px → var(--fs-md) token 化 */
        font-size: var(--fs-md);
    }

    /* Cheat sheet:占满底部,避开安全区 */
    .m-cheatsheet-card {
        max-width: 100vw;
        border-radius: 16px 16px 0 0;
        width: 100%;
    }
    .m-cheatsheet[open] {
        margin: auto auto 0;
        max-width: 100vw;
        width: 100vw;
        max-height: 85vh;
    }
    .m-cheatsheet[open]::backdrop {
        align-items: flex-end;
    }
    .m-cheatsheet-title {
        padding: 16px 18px;
        /* v42:font-size 15px → var(--fs-xl) token 化 */
        font-size: var(--fs-xl);
    }
    .m-cheatsheet-grid {
        grid-template-columns: 90px 1fr;
    }
    .m-cheatsheet-key {
        padding: 10px 18px;
        /* v42:font-size 12px → var(--fs-base) token 化 */
        font-size: var(--fs-base);
    }
    .m-cheatsheet-desc {
        padding: 10px 18px;
        /* v42:font-size 13px → var(--fs-md) token 化 */
        font-size: var(--fs-md);
    }
}

@media (max-width: 480px) {
    .m-list-search-wrap {
        padding: 12px 12px;
    }
    .m-list-search {
        /* v42:font-size 14px → var(--fs-lg) token 化 */
        font-size: var(--fs-lg);
    }
    .m-list-search-stats {
        padding: 5px 12px;
        /* v42:font-size 12px → var(--fs-base) token 化 */
        font-size: var(--fs-base);
    }
}

/* ============== 列表当前曲目"波形"指示 ==============
   替换 .li-index 在 li.current 上的视觉:3 根竖条活动显示,
   暂停/非播放时停在中间高度。

   v55+:容器宽度与 .li-index 等宽(阶梯同步 smusic.css):
   - 默认 52px (桌面) → 与 .li-index flex:0 0 52px 等宽,内容右对齐对应数字右对齐
   - ≤720 屏 44px → 与 .li-index flex:0 0 44px 等宽
   - ≤480 屏 32px → 与 grid-template-columns col 1 (32px) 等宽
   让 strong 在 li.current 与 li 普通态下起始位置一致(0 错位),
   修复"播放时标题左偏 20-28px"视觉不对齐问题。

   虚拟列表(.is-virtual-list)走绝对定位分支:见下方。
   与 smusic.css 里 li.is-playing::before 的外侧圆点互不冲突(::before margin-left:-16px
   在 li 左外,li-playing-bars 在 li 内 0px 之后,绝对定位不影响 flex 流)。 */
.li-playing-bars {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    width: 52px;
    height: 18px;
    flex-shrink: 0;
}
.li-playing-bars > span {
    width: 2.5px;
    height: 100%;
    background: var(--accent);
    border-radius: 1.5px;
    transform-origin: center;
    animation: liBar 0.9s var(--ease-in-out) infinite;
}
.li-playing-bars > span:nth-child(1) { animation-delay: 0s; }
.li-playing-bars > span:nth-child(2) { animation-delay: 0.18s; }
.li-playing-bars > span:nth-child(3) { animation-delay: 0.36s; }

/* ≤720 屏:.li-index 52 → 44px,li-playing-bars 同步收窄保持 strong 起始位置不变。
   与 smusic.css:826 .m-music-list-wrap li .li-index { flex: 0 0 44px } 对齐。
   v56+:删原 ≤480 注释 — smusic.css:884 设 grid-template-columns:32px minmax(0,1fr)
   但 li 实际是 flex(display:flex)+gap:12px,grid-template-columns 失效,
   .li-index 实际宽度仍是 ≤720 块的 44px。所以 ≤480 不再阶梯,共用 ≤720 的 44px。 */
@media (max-width: 720px) {
    .li-playing-bars {
        width: 44px;
    }
}

/* 虚拟分类(收藏 / 最近播放)li.current:
   v57+:删除绝对定位 — .li-no-num 改为 52px visibility:hidden 占位后,
   .li-playing-bars 走 flex 自然流继承上方 52px(≤720→44px)宽度,
   strong 起始 X = 24+52+18 = 94px = 普通列表(24+52+18),达成对齐。
   原 absolute left:24px width:24px 是 v55 为"强贴左"做的特殊处理,
   但导致 strong 起始 X 比普通列表左偏 70px(用户反馈"缩进存在问题")。

   视觉:虚拟分类当前播放项与普通列表当前播放项起始位置完全一致;
   .li-no-num visibility:hidden + .li-playing-bars flex 自然流 = 替换 .li-index。
   .li.is-playing::before 外圆点仍显示(-16px),与波形条双指示。 */

/* 虚拟分类 ≤720:.li-no-num 阶梯改 44px,li-playing-bars 同步走 base ≤720 块的 44px。
   虚拟分类 ≤480:listWrap li 仍 flex,继承 44px;
   small(艺人)v74 起仅在 ≤360 display:none,361-480 恢复显示并优先收缩。
   全部继承 .li-playing-bars base + ≤720 media query,无需虚拟分类专属覆盖。 */

@keyframes liBar {
    0%, 100% { transform: scaleY(0.35); }
    50%      { transform: scaleY(1); }
}

/* 暂停时所有柱子停在中间高度。
   P0 性能修复:li-playing-bars 只在 .is-playing li 里插入(见 smusic.enhance.js renderPlayingBars),
   所以 :not(.is-playing) 选择器匹配 0 个元素,却要遍历 1546 个 li 去重算样式。删除。 */
.m-music-list-wrap li.is-paused .li-playing-bars > span {
    animation-play-state: paused;
    transform: scaleY(0.45);
}

/* 用户偏好减少动画 */
@media (prefers-reduced-motion: reduce) {
    .li-playing-bars > span {
        animation: none;
        transform: scaleY(0.6);
    }
}

/* iOS 安全区:cheatsheet 底部留 home indicator 空间 */
@supports (padding: max(0px)) {
    .m-cheatsheet[open] {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

/* standalone 播放页(.back-home)在移动端:避开触摸区,放右上而非左上,
   避免遮挡列表项,同时留 safe-top。
   注意:var(--safe-top) 在 standalone 页面可能未定义(只有 index.html 设置),
   必须用 fallback,否则 calc() 失效后浏览器会让 fixed 元素跑到奇怪位置。 */
@media (max-width: 720px) {
    .back-home {
        top: calc(12px + var(--safe-top, 0px));
        left: auto;
        right: 12px;
        width: 36px;
        height: 36px;
        padding: 0;
        /* v42:font-size 18px → var(--fs-4xl) token 化 */
        font-size: var(--fs-4xl);
        border-radius: 50%;
    }
    .back-home::before {
        /* 隐藏箭头,只显示 ⌂ 字符 */
        content: "";
        margin: 0;
    }
    /* 让 ⌂ 居中显示 */
    .back-home {
        /* v42:font-size 16px → var(--fs-2xl) token 化 */
        font-size: var(--fs-2xl);
    }
}

@media (max-width: 480px) {
    .back-home {
        width: 32px;
        height: 32px;
        /* v42:font-size 14px → var(--fs-lg) token 化 */
        font-size: var(--fs-lg);
        top: calc(10px + var(--safe-top, 0px));
        right: 10px;
    }
}

/* v71+: *:active 按压瞬时反馈规则统一在 app.css 定义(含 no-preference 门控),
   本文件此前的重复块已移除 — 5 份相同规则纯冗余,且注释里的级联说明有误。 */

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* v27+:触摸设备触摸命中区扩展。
   smusic.enhance.css 之前没有 hover:none 块,导致以下三个按钮触摸命中率极低:
   - .m-list-search-clear (22×22,目标 ≥44)
   - .m-list-empty-clear (~30px 高,目标 ≥44)
   - .back-home (32-36px,目标 ≥44;standalone `?standalone=1` 页面专用)
   它们都是 standalone SMusic 的样式,app.css hover:none 块覆盖不到。 */
@media (hover: none) {
    /* 列表搜索 × 清除按钮:22 → 42px */
    .m-list-search-clear {
        position: relative;
    }
    .m-list-search-clear::before {
        content: "";
        position: absolute;
        inset: -10px;
        border-radius: 8px;
    }

    /* 空状态"清除搜索"按钮:~30 → 44px */
    .m-list-empty-clear {
        position: relative;
    }
    .m-list-empty-clear::before {
        content: "";
        position: absolute;
        inset: -7px;
        border-radius: 8px;
    }

    /* standalone 模式返回首页按钮(32-36 → ≥48px),standalone 页面专为手机设计 */
    .back-home {
        position: relative;
    }
    .back-home::before {
        content: "";
        position: absolute;
        inset: -8px;
        border-radius: 50%;
    }
}
