/* ============================================================
   app.css — 万象生活 · 刷流引擎共享样式
   被 video/drama/live/music/mv/book 六个频道页共用。

   规矩 1：频道页的 <link href="app.css"> 必须是 <head> 里第一个元素，
           频道专属 <style> 必须排在其后，否则同特异性覆盖会失效。
   规矩 2：频道页不得重定义 :root 令牌，也不得重定义
           wave / pop / burst / blink / livePulse 这 5 个 keyframes 名
           —— @keyframes 没有作用域，重定义会全局覆盖本文件，
              导致别的频道页用错动画。
   规矩 3：跨频道"统一但参数不同"的几何一律走 CSS 变量（见 .app 块），
           由频道页的 cfg.vars 以 inline style 注入。inline 自定义属性
           优先于任何样式表规则，不存在特异性竞争。
   ============================================================ */

/* ===== T1 设计令牌 · news.html / app.css / article.html 三处必须一致（忽略行首缩进） ===== */
:root {
    --bg: #f4f5f9;          /* 全局背景 */
    --card: #ffffff;        /* 卡片底色 */
    --primary: #0052d9;     /* 资讯蓝 */
    --hot: #ff4d4f;         /* 热点 / 直播红 */
    --life: #00b578;        /* 生活绿 */
    --t1: #111;             /* 标题 */
    --t2: #888;             /* 次要描述 */
    --t3: #999;             /* 时间 */
    --t4: #bbb;             /* 播放量 / 图标默认 */
    --line: #f0f0f0;
    --gap: 8px;             /* 卡片间距 */
    --top-h: 52px;          /* 刷流页顶部栏高度 */
    --rail-w: 44px;         /* 刷流页右侧互动列宽度 */
    --sheet-r: 16px;        /* 底部弹层圆角 */
}
/* ===== /T1 ===== */

/* ================= 全局重置 ================= */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { background-color: var(--bg); color: #333; -webkit-tap-highlight-color: transparent; }
img { display: block; }
button { font-family: inherit; }

/* ================= 壳层：fixed + inset:0，不受 vh/dvh 影响 ================= */
.app {
    height: 100dvh;                 /* 旧浏览器忽略，回落 height:100% */
    height: 100%;
    position: fixed; inset: 0; overflow: hidden;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --top-row: calc(var(--safe-t) + 11px);   /* 导航行 / 角标行的统一基线 */
    --rail-b: 116px;                /* 右侧互动列距底 */
    --main-b: 150px;                /* 音乐/听书主视觉区距底 */
    --ctrl-b: 28px;                 /* 控制行距底 */
}

/* ================= 唯一纵向滚动容器 ================= */
.feed-scroll {
    position: absolute; inset: 0;
    overflow-y: auto; overflow-x: hidden;
    scroll-snap-type: y mandatory;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-width: none; -ms-overflow-style: none;
}
.feed-scroll::-webkit-scrollbar { display: none; }

/* 一屏一条。约束条款：任何新增层都不得改变 .feed-item 的高度 */
.feed-item {
    position: relative; height: 100%; overflow: hidden;
    background: #ddd;                       /* 与 news.html 的 .media-wrap 一致 */
    scroll-snap-align: start;
    scroll-snap-stop: always;
    isolation: isolate;
    touch-action: manipulation;             /* 防 iOS 双击缩放 */
}

/* ================= 顶部导航行（滚动容器的兄弟浮层） ================= */
.nav-bar {
    position: absolute; top: 0; left: 0; right: 0; z-index: 40;
    height: calc(var(--safe-t) + 56px);
    background: linear-gradient(180deg, rgba(0,0,0,0.5), rgba(0,0,0,0));
    pointer-events: none;                   /* 空白处点击穿透为播放/暂停 */
}
/* pointer-events 必须显式声明：父级是 none，否则返回键点不动 */
.nav-back {
    position: absolute; top: var(--top-row); left: 10px;
    pointer-events: auto;
    background: none; border: 0; padding: 2px; color: #fff; cursor: pointer;
    display: flex; align-items: center;
}
.nav-back svg {
    width: 24px; height: 24px; fill: none; stroke: currentColor;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}
.nav-back:active { color: var(--primary); }

/* ================= 舞台与渐变遮罩 ================= */
.stage { position: absolute; inset: 0; }
.stage-bg { width: 100%; height: 100%; object-fit: cover; transition: filter 0.18s ease; }
.feed-item:active .stage-bg { filter: brightness(0.94); }
.stage-bg.img-fail { background: linear-gradient(135deg, #dfe3ea, #c4ccd8); }   /* 浅色兜底，不出现黑块 */
.scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.85) 100%); }
.scrim.deep { background: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.6) 45%, rgba(0,0,0,0.88) 100%); }

/* 模糊背景：用低分辨率源，模糊成本降一个数量级 */
.bg-blur { filter: blur(28px) brightness(0.62); transform: scale(1.45); }

/* ================= 底部渐变文案区（跨频道统一） ================= */
.text-overlay {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 12px calc(var(--rail-w) + 32px) calc(18px + var(--safe-b)) 14px;
    display: flex; flex-direction: column; justify-content: flex-end;
    color: #fff; pointer-events: none;      /* 不拦截点击 → 穿透为播放/暂停 */
}
.text-overlay h3 {
    font-size: 15px; font-weight: 600; line-height: 1.35; margin-bottom: 6px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.text-overlay .hash,
.text-overlay .sub-line { font-size: 13px; color: rgba(255,255,255,0.9); margin-bottom: 6px; text-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.text-overlay .sound { font-size: 11px; color: rgba(255,255,255,0.75); margin-bottom: 6px; text-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.text-overlay .meta { display: flex; gap: 12px; align-items: center; font-size: 12px; color: rgba(255,255,255,0.85); text-shadow: 0 1px 3px rgba(0,0,0,0.4); }

/* ================= 右侧竖排互动列（跨频道统一） ================= */
.rail {
    position: absolute; right: 8px; z-index: 30;
    bottom: calc(var(--rail-b) + var(--safe-b));
    display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.rail-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: rgba(255,255,255,0.85); font-size: 11px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5); user-select: none; cursor: pointer;
}
.rail-item .icon::before { font-size: 22px; }      /* 放大字形；与下面 .icon-* 的 12/13px 必须同在 app.css */
.rail-item.active { color: var(--primary); }
.rail-item.active .icon { text-shadow: none; }

/* ================= 进度条（transform，不触发布局） ================= */
.prog { position: absolute; left: 0; right: 0; bottom: var(--safe-b); height: 2px; background: rgba(255,255,255,0.22); z-index: 35; }
.prog i { display: block; height: 100%; width: 100%; background: #fff; transform-origin: left center; transform: scaleX(0); }

/* ================= 播放键：纯白三角，无背景圈 ================= */
.play-key {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 56px; color: #fff; z-index: 25; opacity: 0.95;
    pointer-events: none; line-height: 1;
    text-shadow: 0 2px 10px rgba(0,0,0,0.45);
    transition: opacity 0.2s ease;
}
.feed-item.playing .play-key { opacity: 0; }
.play-key.preview { opacity: 0.6 !important; }

/* ================= 角标 / 胶囊 ================= */
.badge-tl, .badge-tr { position: absolute; top: var(--top-row); z-index: 28; }
.badge-tl { left: 52px; }        /* 让开返回键 */
.badge-tr { right: 12px; }

.follow-chip {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 4px 11px; border: 1px solid rgba(255,255,255,0.75); border-radius: 14px;
    font-size: 12px; font-weight: 600; color: #fff; background: rgba(0,0,0,0.18);
    cursor: pointer; user-select: none; transition: 0.2s;
}
.follow-chip.on { border-color: rgba(255,255,255,0.4); color: rgba(255,255,255,0.6); background: none; }

.pill-outline {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 12px; border: 1px solid rgba(255,255,255,0.6); border-radius: 14px;
    font-size: 12px; color: #fff; background: rgba(0,0,0,0.18);
    cursor: pointer; user-select: none; white-space: nowrap;
}
.pill-outline:active { background: rgba(255,255,255,0.2); }

/* ================= 音乐 / 听书 的主视觉区 ================= */
.music-main {
    position: absolute; left: 0; right: 0;
    top: var(--top-row); bottom: calc(var(--main-b) + var(--safe-b));
    display: flex; flex-direction: column; align-items: center;
    padding: 0 24px; z-index: 20; pointer-events: none;
}
.disc-wrap { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; position: relative; }
/* 宽度驱动尺寸：max-width 定量、aspect-ratio 定高，max-height 仅在短屏兜底（不用 vh） */
.disc {
    width: 76%; max-width: 240px; max-height: 100%; aspect-ratio: 1 / 1;
    border-radius: 14px; overflow: hidden; background: #ddd;
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}
.disc img { width: 100%; height: 100%; object-fit: cover; }
.song-title { font-size: 19px; font-weight: 700; color: #fff; margin-top: 14px; text-shadow: 0 1px 4px rgba(0,0,0,0.5); text-align: center; }
.song-sub { font-size: 12px; color: rgba(255,255,255,0.78); margin-top: 5px; text-shadow: 0 1px 3px rgba(0,0,0,0.5); text-align: center; }

/* 歌词窗口：高度 = 行高 × 可见行数，用 transform 平移而非滚动 */
.lyric-window {
    --lyric-h: 26px;                /* 行高；引擎读 p.offsetHeight 定位，这里只控制窗口尺寸 */
    width: 100%; height: calc(var(--lyric-h) * 3); margin-top: 10px; overflow: hidden;
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 24%, #000 76%, transparent);
            mask-image: linear-gradient(180deg, transparent, #000 24%, #000 76%, transparent);
}
.lyric-list { transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1); }
.lyric-list p {
    height: var(--lyric-h); line-height: var(--lyric-h); font-size: 14px; text-align: center;
    color: rgba(255,255,255,0.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: color 0.3s ease, font-size 0.3s ease;
}
.lyric-list p.on { font-size: 16px; font-weight: 600; color: #fff; }

/* 声波（复用 @keyframes wave，仅局部放大） */
.wave-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; }
.hero-wave { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.hero-wave i { width: 3px; border-radius: 2px; background: #fff; transform-origin: bottom; animation: wave 0.9s ease-in-out infinite; }
.hero-wave i:nth-child(1) { height: 10px; animation-delay: 0s; }
.hero-wave i:nth-child(2) { height: 22px; animation-delay: 0.15s; }
.hero-wave i:nth-child(3) { height: 13px; animation-delay: 0.3s; }
.hero-wave i:nth-child(4) { height: 18px; animation-delay: 0.45s; }
.feed-item:not(.playing) .hero-wave i { animation-play-state: paused; }
.mode-line { font-size: 10px; color: rgba(255,255,255,0.6); }

/* ================= 控制行 ================= */
.ctrl-row {
    position: absolute; left: 0; right: 0; bottom: calc(var(--ctrl-b) + var(--safe-b));
    display: flex; align-items: center; justify-content: center; gap: 20px;
    z-index: 30;
}
.ctrl { background: none; border: 0; padding: 4px; color: rgba(255,255,255,0.9); cursor: pointer; display: flex; align-items: center; }
.ctrl svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.45)); }
.ctrl-main svg { width: 38px; height: 38px; }
.ctrl:active { color: #fff; }
.ctrl-main .ic-pause { display: none; }
.feed-item.playing .ctrl-main .ic-play { display: none; }
.feed-item.playing .ctrl-main .ic-pause { display: block; }
.speed-pill {
    font-size: 11px; color: #fff; border: 1px solid rgba(255,255,255,0.6);
    border-radius: 10px; padding: 2px 7px; background: rgba(0,0,0,0.18);
    cursor: pointer; user-select: none; min-width: 38px; text-align: center;
}

/* ================= 可拖拽进度行（深色版；仅引擎勾选 cfg.seek 的频道渲染） ================= */
.prog-row {
    position: absolute; left: 0; right: 0; z-index: 32;
    bottom: calc(var(--prog-b, 104px) + var(--safe-b));
    display: flex; align-items: center; gap: 10px; padding: 0 20px;
}
.prog-row .tm { font-size: 10px; color: rgba(255,255,255,0.75); min-width: 30px; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.prog-row .tm.r { text-align: right; }
.prog-row input[type=range] {
    -webkit-appearance: none; appearance: none;
    flex: 1 1 auto; height: 20px; background: transparent;
    touch-action: none;             /* 拖拽时不滚动页面 */
    cursor: pointer;
}
.prog-row input[type=range]::-webkit-slider-runnable-track { height: 2px; background: rgba(255,255,255,0.3); border-radius: 2px; }
.prog-row input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%;
    background: #fff; margin-top: -4.5px; box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.prog-row input[type=range]::-moz-range-track { height: 2px; background: rgba(255,255,255,0.3); border-radius: 2px; }
.prog-row input[type=range]::-moz-range-thumb { width: 11px; height: 11px; border: 0; border-radius: 50%; background: #fff; }

/* ================= 弹层（app 级单例，滚动容器的兄弟） ================= */
.mask {
    position: absolute; inset: 0; z-index: 50; background: rgba(0,0,0,0.5);
    opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.mask.open { opacity: 1; pointer-events: auto; }
.sheet {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 51;
    background: var(--card); color: var(--t1);
    border-radius: var(--sheet-r) var(--sheet-r) 0 0;
    padding: 16px 16px calc(16px + var(--safe-b));
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
    max-height: 52%; overflow-y: auto; overscroll-behavior: contain;
}
.sheet.open { transform: none; }
.sheet-head { font-size: 16px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.sheet-sub { font-size: 12px; font-weight: 400; color: var(--t3); }
.ep-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.ep-grid button { padding: 9px 0; font-size: 13px; color: var(--t1); background: var(--bg); border: 0; border-radius: 6px; cursor: pointer; }
.ep-grid button.on { color: #fff; background: var(--primary); font-weight: 600; }
.ch-list { display: flex; flex-direction: column; }
.ch-item {
    display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
    padding: 11px 8px; font-size: 14px; color: var(--t1);
    background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.ch-item:last-child { border-bottom: none; }
.ch-item.on { color: var(--primary); font-weight: 600; }
.ch-item .ch-n { font-size: 11px; color: var(--t4); min-width: 20px; font-style: italic; }
.ch-item.on .ch-n { color: var(--primary); }
.ch-item .ch-sub { margin-left: auto; font-size: 11px; color: var(--t4); }

/* ================= 双击点赞爆心 ================= */
.burst {
    position: absolute; z-index: 60; transform: translate(-50%, -50%);
    font-size: 64px; color: #fff; line-height: 1; pointer-events: none;
    text-shadow: 0 2px 14px rgba(0,0,0,0.5);
    animation: burst 0.7s ease-out forwards;
}
@keyframes burst {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
    30%  { opacity: 1; transform: translate(-50%, -50%) scale(1.25); }
    100% { opacity: 0; transform: translate(-50%, -90%) scale(1); }
}

/* ===== T2 线框图标 · news.html / app.css / article.html 三处必须一致（忽略行首缩进） ===== */
.meta-icon { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--t4); cursor: pointer; transition: color 0.2s ease; user-select: none; }
.meta-icon .icon { font-size: 12px; display: inline-block; line-height: 1; font-weight: 400; }
.icon-comment::before { content: '☐'; font-size: 12px; }
.icon-like::before { content: '♡'; font-size: 13px; }
.icon-collect::before { content: '☆'; font-size: 13px; }
.icon-play::before { content: '▶'; font-size: 10px; }
.icon-view::before { content: '◉'; font-size: 12px; }
.meta-icon.active { color: var(--primary); }
.meta-icon.pop { animation: pop 0.28s ease; }
/* ===== /T2 ===== */

/* ===== T3 关键帧 · news.html / app.css / article.html 三处必须一致（忽略行首缩进） ===== */
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
/* ===== /T3 ===== */

/* ===== 刷流引擎专属关键帧（只有频道页用；全局命名空间，不得在频道页重名重定义） ===== */
@keyframes wave { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }

/* ================= 无障碍：遵循系统减弱动效偏好 ================= */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   以下为 Laravel 化之后新增（原型的 design/prototype/app.css 里没有）
   ============================================================ */

/* 频道空态。注意它渲染在 #scroll 之外 —— 引擎用 scrollEl.children[S.i]
   按下标寻址，任何混进 #scroll 的非 .feed-item 节点都会让滑动落到错误的条目上。 */
.empty-state {
    position: absolute; inset: 0; z-index: 5;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 0 32px; text-align: center;
    color: var(--t3); pointer-events: none;
}
.empty-state p { font-size: 14px; line-height: 1.6; }
.empty-state .hint { font-size: 12px; color: var(--t4); }

/* 顶部条的标题（歌单刷流页用；六个频道页照原型只有返回键，不渲染它）。
   与返回键同一行居中，不挡返回键也不压到角标。 */
.nav-title {
    position: absolute; left: 56px; right: 56px; top: 0; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 14px; font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.45);
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    pointer-events: none;   /* 只是标题，别把返回键那一片的手势吃掉 */
}

/* 「点一下开声音」——只有浏览器拒了带声音的自动播放时才亮（引擎加 .on）。
   位置在顶部条下方居中，不压返回键也不挡角标。 */
.sound-hint {
    position: absolute; top: calc(var(--top-row, 44px) + 4px); left: 50%; transform: translateX(-50%);
    z-index: 40; display: none;
    font-size: 12px; color: #fff; background: rgba(0,0,0,0.55);
    border-radius: 12px; padding: 4px 12px; pointer-events: none;
}
.sound-hint.on { display: block; }
