/* ============================================================
   功能页通用组件样式 (小说/音乐/漫画/视频/壁纸)
   补充 style.css 未覆盖的 content-page 组件
   设计变量沿用 :root 令牌: --surface --ink --line --accent 等
   ============================================================ */

/* ---- 兼容别名: 模板/JS 中引用的变量 ---- */
:root {
  --text: var(--ink);
  --text-secondary: var(--ink-2);
  --text-light: var(--ink-3);
  --border: var(--line);
  --border-strong: var(--line-strong);
  --card-bg: var(--surface);
}

/* ---- 内容页框架 ---- */
.content-page { animation: fadeUp .35s ease both; min-height: 60vh; padding-bottom: env(safe-area-inset-bottom); }
.novel-content, .music-content, .comic-content, .video-content, .wallpaper-content { min-height: 40vh; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-header {
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.page-title { margin: 0; font-size: 1.5rem; font-family: var(--font-serif); display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
/* 覆盖 mobile.css 的 img{height:auto!important}，确保图标尺寸不被破坏 */
.tool-svg-icon.page { width: 28px !important; height: 28px !important; }
.tool-svg-icon.empty { width: 64px !important; height: 64px !important; }
.search-bar { display: flex; gap: 8px; flex: 1; min-width: 220px; max-width: 480px; margin-left: auto; }
.search-bar input,
input[type="text"].search-input,
#novelSearch,
#musicSearch {
  flex: 1; padding: 10px 14px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: var(--surface); color: var(--ink);
  font-size: 14px; outline: none; transition: border-color .2s, box-shadow .2s;
  min-width: 0;
}
.search-bar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-bar button, .refresh-btn, .download-btn, .btn-copy, .btn-confirm-download {
  padding: 10px 20px; border: none; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #fff !important; font-size: 14px; font-weight: 500;
  transition: background .2s, transform .1s; white-space: nowrap;
}
.search-bar button:hover, .refresh-btn:hover { background: var(--accent-ink); }
.search-bar button:active { transform: scale(.97); }

/* ---- 通用状态 ---- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 20px; min-height: 300px; color: var(--ink-3); text-align: center;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .7; }
.empty-icon.tool-svg-icon { width: 64px !important; height: 64px !important; opacity: .5; }
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 32px; color: var(--ink-2); font-size: 14px;
}
.loading::before {
  content: ""; width: 18px; height: 18px; margin-right: 10px;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 选项卡 ---- */
.source-tabs, .module-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.source-tab, .tab {
  padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--ink-2); font-size: 13px;
  cursor: pointer; transition: all .2s;
}
.source-tab.active, .tab.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* ---- 弹窗系统 ---- */
.modal {
  display: none; position: fixed; inset: 0; z-index: 99999;
  background: rgba(30, 24, 15, .55); backdrop-filter: blur(4px);
  align-items: flex-start; justify-content: center;
  padding: 12px;
  overflow-y: auto;
}
.modal.modal-center {
  align-items: flex-start;
  padding-top: 80px;
}
.modal.modal-center .modal-content { margin: 0; }

@media (max-width: 600px) {
  .modal.modal-center { padding-top: 12px; }
}
.modal-content {
  background: var(--surface); border-radius: var(--radius); width: 100%;
  max-width: 560px; max-height: calc(100vh - 24px);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: modalIn .25s ease both;
  position: relative;
  margin: auto 0;
}
.modal-content.modal-large { max-width: 760px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.modal-header h2 { margin: 0; font-size: 1.15rem; font-family: var(--font-serif); }
.modal-close {
  border: none; background: none; font-size: 18px; cursor: pointer;
  color: var(--ink-3); padding: 4px 8px; border-radius: 6px; line-height: 1;
  transition: all .2s;
}
.modal-close:hover { color: var(--accent); background: var(--accent-softer); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; min-height: 0; }

/* 大屏下恢复居中显示 */
@media (min-width: 700px) {
  .modal { align-items: center; padding: 20px; }
  .modal-content { max-height: min(86vh, calc(100vh - 40px)); margin: 0; }
}

/* ============================================================
   小说页
   ============================================================ */
/* 小说/音乐列表容器 */
.novel-list, .music-list { display: flex; flex-direction: column; gap: 12px; min-height: 200px; }
.novel-item {
  display: flex; gap: 14px; padding: 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); transition: all .2s;
}
.novel-item:hover {
  border-color: var(--accent); box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.novel-item img { width: 72px; height: 96px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.novel-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.novel-item-title { font-weight: 700; font-size: 15px; color: var(--ink); font-family: var(--font-serif); }
.novel-item-author { font-size: 13px; color: var(--ink-2); }
.novel-item-desc {
  font-size: 12px; color: var(--ink-3); overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* 详情信息区 */
.novel-info { display: flex; gap: 16px; margin-bottom: 16px; align-items: flex-start; }
.novel-info img { width: 96px; height: 128px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.novel-info h3 { margin: 0 0 6px; font-family: var(--font-serif); font-size: 1.1rem; }

/* 章节下载工具条 */
.chapter-download-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--surface-2); border-radius: var(--radius-sm);
}
.chapter-download-bar .download-btn { padding: 4px 12px; font-size: 13px; border-radius: 6px; }

/* 章节列表: 双列网格 */
.novel-chapters {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 4px; overflow-y: auto; padding-right: 4px;
  scrollbar-width: thin;
}
.chapter-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-radius: 6px; transition: background .15s;
}
.chapter-item:hover { background: var(--accent-softer); }
.chapter-checkbox { accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.chapter-title-text {
  flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
}
.chapter-title-text:hover { color: var(--accent); }

/* 阅读器 - 沉浸式阅读模式：隐藏 header/footer */
body.reading-mode .site-header,
body.reading-mode .site-footer {
    display: none !important;
}

/* 阅读器 */
.novel-reader {
    position: fixed; inset: 0; z-index: 100000; background: var(--surface);
    display: flex; flex-direction: column;
}
}
.reader-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  background: var(--surface); gap: 12px;
}
.reader-header button {
  border: 1px solid var(--line-strong); background: var(--surface);
  padding: 6px 14px; border-radius: 8px; cursor: pointer; color: var(--ink);
  transition: all .2s;
}
.reader-header button:hover { border-color: var(--accent); color: var(--accent); }
.reader-header span { font-weight: 600; font-family: var(--font-serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-settings {
  display: none; padding: 14px 18px; gap: 14px; align-items: center;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.reader-settings label { font-size: 13px; color: var(--ink-2); }
.reader-settings input[type=range] { accent-color: var(--accent); }
.bg-colors { display: flex; gap: 8px; }
.bg-colors button {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-strong); cursor: pointer;
}
.novel-reader-content, .reader-content {
  flex: 1; overflow-y: auto; padding: 24px max(20px, calc((100% - 720px) / 2));
  font-size: 18px; line-height: 1.9; color: var(--ink);
}
.reader-nav {
  display: flex; gap: 12px; padding: 12px 18px;
  border-top: 1px solid var(--line); background: var(--surface);
}
.reader-nav button {
  flex: 1; padding: 10px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink); cursor: pointer; font-size: 14px;
  transition: all .2s;
}
.reader-nav button:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   音乐页
   ============================================================ */
.music-list { display: flex; flex-direction: column; gap: 8px; }
.music-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); transition: all .2s;
}
.music-item:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.music-cover { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.music-info { flex: 1; min-width: 0; }
.music-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-artist { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-item-actions { display: flex; gap: 8px; align-items: center; }
.music-source-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink); flex-shrink: 0;
}
.music-source-badge.netease { background: #e8f0fe; color: #1a73e8; }
.music-source-badge.kuwo { background: #fef3e8; color: #e87d1a; }
.music-download-btn, .quality-select {
  font-size: 12px; padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
}
.quality-select { cursor: pointer; }
.music-download-btn { background: var(--accent); border-color: var(--accent); color: #fff; cursor: pointer; }

/* 引导横幅 */
.music-promote-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; margin-bottom: 18px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 14px; color: #fff; cursor: pointer;
  box-shadow: 0 4px 16px rgba(102, 126, 234, .35);
  transition: transform .2s, box-shadow .2s;
}
.music-promote-banner:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(102, 126, 234, .45); }
.promote-icon { font-size: 32px; flex-shrink: 0; }
.promote-text { flex: 1; min-width: 0; }
.promote-title { font-size: 16px; font-weight: 700; }
.promote-desc { font-size: 12px; opacity: .85; margin-top: 2px; }
.promote-btn {
  flex-shrink: 0; padding: 8px 18px;
  background: #fff; color: #667eea;
  border: none; border-radius: 20px;
  font-weight: 700; font-size: 13px; cursor: pointer;
  transition: transform .15s;
}
.promote-btn:hover { transform: scale(1.05); }

/* 引导弹窗 */
.promote-modal {
  padding: 28px 24px !important;
}
.promote-modal-icon {
  font-size: 56px;
  margin-bottom: 4px;
}
.promote-modal-btn {
  padding: 10px 28px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff; border: none; border-radius: 22px;
  font-weight: 700; font-size: 14px; cursor: pointer;
  transition: transform .15s;
}
.promote-modal-btn:hover { transform: scale(1.05); }
.promote-modal-btn-secondary {
  padding: 10px 20px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 22px;
  font-size: 14px; cursor: pointer;
  transition: all .15s;
}
.promote-modal-btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 600px) {
  .music-promote-banner { padding: 12px 14px; gap: 10px; }
  .promote-icon { font-size: 26px; }
  .promote-title { font-size: 14px; }
  .promote-desc { display: none; }
  .promote-btn { padding: 6px 14px; font-size: 12px; }
}

/* 底部播放器 */
.music-player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1500;
  display: flex; align-items: center; gap: 14px; padding: 12px 20px;
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px -12px rgba(50, 40, 25, .3);
}
.player-cover { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; }
.player-info { flex: 1; min-width: 0; }
.player-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-artist { font-size: 12px; color: var(--ink-3); }
.player-controls { display: flex; align-items: center; gap: 10px; }
.player-controls button {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--surface); cursor: pointer; font-size: 15px; color: var(--ink);
  transition: all .2s;
}
.player-controls button:hover { border-color: var(--accent); color: var(--accent); }
.player-progress { width: 160px; accent-color: var(--accent); }
.player-time { font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); }
.player-quality { font-size: 11px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }

/* 下载弹窗 */
.download-modal-song { font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.download-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ============================================================
   漫画页
   ============================================================ */
.comic-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px;
}
.comic-item { cursor: pointer; transition: transform .2s; }
.comic-item:hover { transform: translateY(-3px); }
.comic-item img, .comic-item .empty-icon {
  width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.comic-item-title {
  margin-top: 8px; font-size: 13px; font-weight: 600; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.comic-info { display: flex; gap: 16px; margin-bottom: 16px; }
.comic-info img { width: 110px; height: 146px; object-fit: cover; border-radius: 8px; }
.comic-chapters {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 4px; overflow-y: auto;
}
.comic-reader { position: fixed; inset: 0; z-index: 2100; background: #111; overflow-y: auto; }
.comic-reader .comic-content { max-width: 900px; margin: 0 auto; }
.comic-reader .comic-content img { display: block; width: 100%; }

/* ============================================================
   视频页
   ============================================================ */
.video-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px;
}
.video-item { cursor: pointer; transition: transform .2s; }
.video-item:hover { transform: translateY(-3px); }
.video-item img, .video-item .empty-icon {
  width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); font-size: 32px;
}
.video-item-title {
  margin-top: 8px; font-size: 13px; font-weight: 600; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.video-info { display: flex; gap: 16px; margin-bottom: 16px; }
.video-info img { width: 120px; height: 160px; object-fit: cover; border-radius: 8px; }
.video-episodes {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px; overflow-y: auto;
}
.episode-item {
  padding: 8px; text-align: center; font-size: 13px; border-radius: 8px;
  border: 1px solid var(--line-strong); cursor: pointer; color: var(--ink-2);
  transition: all .2s; background: var(--surface);
}
.episode-item:hover, .episode-item.active { border-color: var(--accent); color: var(--accent); background: var(--accent-softer); }

/* 播放器浮层 */
.video-player-overlay {
  position: fixed; inset: 0; z-index: 2200; background: rgba(15, 12, 8, .92);
  display: flex; flex-direction: column;
}
.video-player-wrapper { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; }
.video-player-wrapper video { max-width: 100%; max-height: 100%; }
.video-player-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; color: #f5f1e8;
}
.video-player-header button {
  border: none; background: none; color: #f5f1e8; font-size: 20px; cursor: pointer;
}
.video-player-footer { padding: 12px 20px; color: var(--ink-3); font-size: 13px; }

/* HEVC/H.265 视频不兼容提示 */
.hevc-warning {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 15, 8, .9);
  border: 1px solid rgba(255, 180, 80, .4);
  border-radius: 12px;
  padding: 20px 24px;
  max-width: 85%;
  width: 380px;
  color: #f5f1e8;
  font-size: 14px;
  line-height: 1.6;
  z-index: 10;
  text-align: center;
  backdrop-filter: blur(8px);
}
.hevc-warning.show { display: block; }
.hevc-warning-icon { font-size: 32px; margin-bottom: 8px; }
.hevc-warning-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: #ffc87a; }
.hevc-warning-desc { color: #c9c0ad; margin-bottom: 12px; font-size: 13px; }
.hevc-warning-tips { text-align: left; font-size: 12px; color: #a8a08d; margin-bottom: 14px; padding-left: 0; list-style: none; }
.hevc-warning-tips li { padding: 3px 0; }
.hevc-warning-tips li::before { content: "• "; color: #ffc87a; }

/* 软解播放主按钮 */
.hevc-wasm-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #ffc87a 0%, #ff9d4a 100%);
  border-radius: 10px;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s;
  text-align: left;
}
.hevc-wasm-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255, 157, 74, .4);
}
.hevc-wasm-btn:active { transform: translateY(0); }
.hevc-wasm-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(61, 42, 16);
  color: #ffc87a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.hevc-wasm-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hevc-wasm-title { font-size: 15px; font-weight: 600; color: #3d2a10; }
.hevc-wasm-sub { font-size: 12px; color: rgba(61, 42, 16, .7); }

.hevc-warning-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.hevc-warning-actions button {
  padding: 8px 16px;
  border: 1px solid rgba(255, 200, 122, .4);
  border-radius: 8px;
  background: transparent;
  color: #ffc87a;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s;
}
.hevc-warning-actions button:hover { background: rgba(255, 200, 122, .15); }

/* ---- WASM 软解播放器 (movi-player) ---- */
#wasmPlayerContainer {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; left: 0;
    background: #000;
}
#wasmPlayer {
    width: 100%;
    height: 100%;
    display: block;
}
/* WASM播放器加载中 — 视频区域中央转圈 */
.video-player-wrapper.wasm-loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(255, 255, 255, .2);
    border-top-color: #ffc87a;
    border-radius: 50%;
    animation: spin .8s linear infinite;
    z-index: 5;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   壁纸页
   ============================================================ */
.wallpaper-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
}
.wallpaper-item { position: relative; cursor: pointer; border-radius: 10px; overflow: hidden; }
.wallpaper-item img { width: 100%; aspect-ratio: 9/16; object-fit: cover; display: block; transition: transform .3s; }
.wallpaper-item:hover img { transform: scale(1.05); }
.wallpaper-info {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 10px 8px;
  background: linear-gradient(transparent, rgba(20, 15, 8, .75));
  color: #fff; font-size: 12px;
}
