/* ============================================================
   JK吧 style.css — 现代化样式（浅/深双主题 · 移动端 H5 优先）
   ============================================================ */

/* ===== 主题变量 ===== */
:root {
    --primary: #ec4899;
    --primary-dark: #db2777;
    --primary-light: #fdf2f8;
    --secondary: #a855f7;
    --bg-gradient: linear-gradient(135deg, #fff5f8 0%, #f8f0ff 100%);
    --bg-solid: #fff5f8;
    --white: #ffffff;
    --text-main: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --shadow-soft: 0 10px 40px rgba(236, 72, 153, 0.12);
    --shadow-hover: 0 8px 25px rgba(236, 72, 153, 0.25);
    --card-bg: rgba(255, 255, 255, 0.95);
    --border-radius: 16px;
    --border-soft: 1px solid rgba(236, 72, 153, 0.1);
    --overlay-bg: rgba(255, 255, 255, 0.85);
    --transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --header-h: 60px;
}

/* 深色主题 */
[data-theme="dark"] {
    --primary: #f472b6;
    --primary-dark: #ec4899;
    --primary-light: #2a1740;
    --secondary: #f0abfc;
    --bg-gradient: linear-gradient(135deg, #1a1030 0%, #241244 100%);
    --bg-solid: #160d2b;
    --white: #21143d;
    --text-main: #f3e9fb;
    --text-secondary: #c4b2d8;
    --text-muted: #8b7aa3;
    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.45);
    --shadow-hover: 0 8px 25px rgba(244, 114, 182, 0.35);
    --card-bg: rgba(45, 28, 75, 0.92);
    --border-soft: 1px solid rgba(244, 114, 182, 0.18);
    --overlay-bg: rgba(30, 18, 55, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transition: background 0.4s ease, color 0.4s ease;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--primary-light); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%); border-radius: 10px; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.page-in { animation: fadeInUp 0.6s ease-out forwards; }

.container { display: flex; flex-direction: column; min-height: 100vh; }

/* ===== 头部 ===== */
header {
    background: var(--overlay-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
    padding: 10px 16px;
    position: sticky;
    top: 0;
    z-index: 999;
    border-bottom: var(--border-soft);
}
.header-wrap {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.header-left { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex-shrink: 0; }
.site-logo { display: flex; align-items: center; gap: 6px; text-decoration: none; }
.logo-emoji { font-size: 20px; }
#site-title {
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 0.5px;
    line-height: 1.2;
}
.header-url { font-size: 12px; color: var(--text-secondary); text-decoration: none; transition: var(--transition); }
.header-url:hover { color: var(--primary); }

.header-center { flex: 1; display: flex; justify-content: center; margin: 0 5px; min-width: 0; }
.header-category {
    font-size: 12px;
    color: var(--primary-dark);
    background: var(--primary-light);
    padding: 6px 12px;
    border-radius: var(--border-radius);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-weight: 500;
    border: var(--border-soft);
    transition: var(--transition);
}
.header-category.loading { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* 后端健康自检状态点（低调，悬停可见详情） */
.backend-status {
    font-size: 12px;
    margin-left: 8px;
    padding: 4px 9px;
    border-radius: 999px;
    white-space: nowrap;
    font-weight: 500;
    cursor: default;
    opacity: 0.85;
    border: 1px solid transparent;
    transition: var(--transition);
}
.backend-status.ok   { color: #15803d; background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.3); }
.backend-status.bad  { color: #b91c1c; background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); }
.backend-status.checking { color: var(--text-secondary); background: var(--primary-light); border-color: var(--border-soft); }

.header-right { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }

.icon-btn {
    background: var(--card-bg);
    border: var(--border-soft);
    border-radius: 12px;
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px; cursor: pointer; transition: var(--transition);
    color: var(--text-main);
}
.icon-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--primary); }

/* ===== 按钮 ===== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff; border: none; border-radius: var(--border-radius);
    padding: 12px 20px; font-weight: 600; font-size: 16px;
    transition: var(--transition); width: 100%; line-height: 1.3; cursor: pointer;
    position: relative; overflow: hidden; box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
    margin-bottom: 20px;
}
.btn-primary::before {
    content: ""; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
}
.btn-primary:hover:not(:disabled)::before { left: 100%; }
.btn-primary:hover:not(:disabled) { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.btn-primary:active:not(:disabled) { transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.refresh-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff; border: none; border-radius: var(--border-radius);
    padding: 8px 16px; display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition); font-size: 14px; font-weight: 600;
    white-space: nowrap;
}
.refresh-btn:hover { background: var(--primary-dark); }

.btn-loading { display: inline-flex; align-items: center; gap: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-spinner {
    width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite;
}
.btn-spinner {
    display: inline-block; width: 13px; height: 13px; margin-right: 6px;
    border: 2px solid rgba(255,255,255,0.45); border-top-color: #fff; border-radius: 50%;
    animation: btn-spin 0.7s linear infinite; vertical-align: -2px;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ===== 主区域 ===== */
main { flex-grow: 1; padding: 20px 16px; animation: fadeInUp 0.6s ease-out 0.2s both; }
.main-wrap { max-width: 480px; margin: 0 auto; }

/* 导语 */
.intro { text-align: center; margin-bottom: 16px; }
.intro-title {
    font-size: 19px; font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    line-height: 1.35;
}
.intro-desc { font-size: 13px; color: var(--text-secondary); margin-top: 6px; line-height: 1.6; }

.section-title {
    font-size: 15px; font-weight: 700; color: var(--primary-dark);
    margin: 22px 0 12px; text-align: left; position: relative; padding-left: 10px;
}
.section-title::before {
    content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 4px;
    border-radius: 4px; background: linear-gradient(180deg, var(--primary), var(--secondary));
}

/* ===== 播放器 ===== */
.player-section { margin-bottom: 8px; }
.video-container {
    aspect-ratio: 9/16;
    border-radius: var(--border-radius);
    overflow: hidden; position: relative; margin: 0 auto;
    background: #000;
    box-shadow: 0 0 0 2px rgba(236, 72, 153, 0.1), 0 15px 50px rgba(236, 72, 153, 0.22);
    transition: var(--transition);
    margin-bottom: 16px; max-width: 420px;
    touch-action: pan-y;
}
.video-container:hover { transform: translateY(-4px); box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15), 0 20px 60px rgba(236, 72, 153, 0.28); }
.video-container::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    z-index: 0; opacity: 1; transition: opacity 0.3s ease;
}
/* 视频就绪或加载中一结束就隐藏黑遮罩，避免遮住视频造成"黑屏/加载不出来"的错觉 */
.video-container.video-ready::before,
.video-container.played::before { opacity: 0; pointer-events: none; }
#video-player { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 2; background: #000; }

video::-webkit-media-controls { display: none !important; }
video::-webkit-media-controls-panel { display: none !important; }
video::-webkit-media-controls-start-playback-button { display: none !important; }
video::-webkit-media-controls-overlay-play-button { display: none !important; }
video::-webkit-media-controls-fullscreen-button { display: none !important; }
video::-webkit-media-controls-mute-button { display: none !important; }
video::-webkit-media-controls-volume-slider { display: none !important; }
video::-webkit-media-controls-timeline { display: none !important; }
video::-webkit-media-controls-current-time-display { display: none !important; }
video::-webkit-media-controls-time-remaining-display { display: none !important; }
video::-webkit-media-controls-toggle-closed-captions-button { display: none !important; }

.load-tips { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 8px; line-height: 1.4; }

/* 右上角按钮组：用 flex 自动排列，取代原先逐个写 right 值（文字按钮变宽后不会互相重叠） */
.top-controls {
    position: absolute; top: 12px; right: 12px; z-index: 16;
    display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
}
.overlay-btn {
    position: static; display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; font-size: 15px; flex: 0 0 auto;
    background: rgba(0,0,0,0.45); border: none; color: #fff;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    transition: transform 0.2s ease, background 0.2s ease;
}
/* 文字类按钮（播放/暂停、倍速）宽度自适应，避免文字溢出 36px 方框造成排版错位 */
.overlay-btn-text {
    width: auto; min-width: 44px; padding: 0 10px;
    font-size: 13px; font-weight: 600; letter-spacing: 0.5px; border-radius: 10px;
    white-space: nowrap;
}
#muteBtn.muted { background: rgba(220, 38, 38, 0.85); }
.overlay-btn.active { background: var(--primary); }
.overlay-btn:hover { transform: scale(1.08); }
.overlay-btn:active { transform: scale(0.94); }

.controls-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 30px 15px 12px; color: white; z-index: 5;
    opacity: 0; transition: opacity 0.3s ease;
}
.video-container:hover .controls-overlay, .video-container.show-controls .controls-overlay { opacity: 1; }
.video-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.video-title { font-size: 14px; font-weight: bold; }
.video-duration { font-size: 12px; opacity: 0.85; }
/* 进度条：去掉 overflow:hidden（改为给 .progress 自身加圆角），
   再用 ::after 上下各撑开 8px 透明热区，手机上更容易点中 3px 的细条 */
.progress-bar {
    width: 100%; height: 3px; background: rgba(255,255,255,0.3);
    border-radius: 3px; position: relative; cursor: pointer;
    transition: height 0.15s ease;
}
.progress-bar.interactive::after {
    content: ""; position: absolute; left: 0; right: 0; top: -8px; bottom: -8px;
}
.progress-bar:hover { height: 5px; }
.progress { height: 100%; background: #fff; width: 0%; border-radius: 3px; transition: width 0.1s linear; }

.autoplay-toggle {
    position: absolute; bottom: 10px; right: 12px; z-index: 6;
    background: rgba(0,0,0,0.45); color: #fff; font-size: 12px;
    padding: 4px 10px; border-radius: 20px; backdrop-filter: blur(4px);
}
.autoplay-toggle label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.autoplay-toggle input { accent-color: var(--primary); }

/* 加载/结束/错误 覆盖层 */
.loading-indicator, .error-overlay, .end-screen {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    z-index: 15; opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.loading-indicator { background: rgba(0, 0, 0, 0.5); }
.loading-indicator.active { opacity: 1; pointer-events: all; }
.spinner { width: 40px; height: 40px; border: 4px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 1s linear infinite; }

.error-overlay { background: rgba(0, 0, 0, 0.82); flex-direction: column; gap: 16px; z-index: 18; pointer-events: none; }
.error-overlay.active { opacity: 1; pointer-events: all; }
.error-msg { color: #fff; font-size: 14px; text-align: center; padding: 0 20px; line-height: 1.5; }
.error-btns { display: flex; gap: 12px; }
.error-retry, .error-next { padding: 9px 20px; border-radius: 22px; border: none; font-size: 14px; cursor: pointer; transition: var(--transition); }
.error-retry { background: var(--primary); color: #fff; }
.error-next { background: #fff; color: var(--text-main); }
.error-retry:hover, .error-next:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3); }

.end-screen { background: rgba(0, 0, 0, 0.8); flex-direction: column; z-index: 20; }
.end-screen.active { opacity: 1; pointer-events: all; }
.end-screen-buttons { display: flex; gap: 10px; margin-top: 15px; }
.end-screen-btn { padding: 8px 16px; border-radius: 20px; border: none; font-size: 14px; cursor: pointer; transition: var(--transition); }
.replay-btn { background: var(--primary); color: white; }
.next-btn { background: #fff; color: var(--text-main); }
.end-screen-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3); }

.mute-badge {
    position: absolute; top: 12px; left: 12px; display: none; align-items: center; gap: 4px;
    background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 12px; font-weight: 500;
    padding: 6px 12px; border-radius: 20px; z-index: 16; cursor: pointer;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    transition: var(--transition); animation: pulse 2s ease-in-out infinite;
}
.mute-badge:hover { background: var(--primary); animation: none; }

/* ===== 分类网格 ===== */
.category-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px; margin: 8px 0;
}
.category-card {
    background: var(--card-bg); border-radius: var(--border-radius);
    padding: 14px 8px; text-align: center; cursor: pointer; transition: var(--transition);
    border: var(--border-soft); text-decoration: none; color: var(--text-main);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.category-card:hover, .category-card.active {
    transform: translateY(-3px);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white; box-shadow: var(--shadow-hover); border-color: transparent;
}
.category-icon { font-size: 22px; }
.category-name { font-size: 13px; font-weight: 600; }

/* ===== FAQ ===== */
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item {
    background: var(--card-bg); border-radius: var(--border-radius);
    border: var(--border-soft); padding: 12px 14px; transition: var(--transition);
}
.faq-item summary { font-size: 14px; font-weight: 600; cursor: pointer; list-style: none; position: relative; padding-right: 20px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "＋"; position: absolute; right: 0; top: 0; color: var(--primary); font-weight: 700; }
.faq-item[open] summary::after { content: "－"; }
.faq-item p { font-size: 13px; color: var(--text-secondary); margin-top: 8px; line-height: 1.6; }

/* ===== 页脚 ===== */
footer {
    background: var(--overlay-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    padding: 24px 16px; margin-top: 30px; border-top: var(--border-soft);
    animation: fadeInUp 0.6s ease-out 0.4s both;
}
.footer-wrap { max-width: 1100px; margin: 0 auto; text-align: center; }
.backend-status-bar {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin-bottom: 18px; flex-wrap: wrap;
}
.backend-status-note { font-size: 12px; color: var(--text-muted); }
.disclaimer-box { margin-bottom: 20px; padding: 16px; background: var(--card-bg); border-radius: var(--border-radius); border: var(--border-soft); }
#disclaimer-text { font-size: 12px; color: var(--text-muted); line-height: 1.6; text-align: left; }
.friendship-links { margin-bottom: 16px; }
#friendship-title { font-size: 14px; font-weight: 600; color: var(--primary); margin-bottom: 10px; }
.links-wrap { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 16px; }
.link-item { font-size: 12px; color: var(--text-secondary); text-decoration: none; padding: 4px 8px; border-radius: var(--border-radius); transition: var(--transition); }
.link-item:hover { color: #fff; background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%); transform: translateY(-2px); }
.copyright { color: var(--text-secondary); font-size: 12px; }
.copyright a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* ===== 悬浮刷新按钮 ===== */
.floating-refresh-btn {
    position: fixed; right: 22px; bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    z-index: 100; width: 56px; height: 56px; padding: 0; border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28); font-size: 24px; line-height: 1;
}
.floating-refresh-btn:hover { background: var(--primary-dark); transform: scale(1.06); }
.floating-refresh-btn.is-loading { animation: fab-spin 0.9s linear infinite; }
@keyframes fab-spin { to { transform: rotate(360deg); } }

/* 右下角悬浮：我的收藏（位于刷新按钮上方 64px 处） */
.floating-fav-btn {
    position: fixed; right: 22px; bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    z-index: 100; width: 56px; height: 56px; padding: 0; border: none; border-radius: 50%;
    background: var(--card-bg); color: var(--text-main); cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22); font-size: 22px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s ease, background .15s ease;
}
.floating-fav-btn:hover { background: var(--primary); transform: scale(1.06); }
.floating-fav-btn:active { transform: scale(0.94); }

/* 加载态锁 */
.disabled-temporarily { opacity: 0.55 !important; cursor: wait !important; pointer-events: none !important; }
.category-card.disabled-temporarily { position: relative; }
.category-card.disabled-temporarily::after {
    content: ""; position: absolute; top: 6px; right: 8px; width: 12px; height: 12px;
    border: 2px solid rgba(236, 72, 153, 0.35); border-top-color: var(--primary);
    border-radius: 50%; animation: btn-spin 0.7s linear infinite; pointer-events: none;
}
.refresh-btn.is-loading { cursor: wait !important; opacity: 0.92; }

/* ===== Toast ===== */
.toast {
    position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(10px);
    background: rgba(0, 0, 0, 0.85); color: #fff; font-size: 13px; padding: 10px 18px;
    border-radius: 12px; z-index: 10000; opacity: 0; pointer-events: none; max-width: 80%;
    text-align: center; transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 抽屉（收藏/历史）===== */
.drawer { position: fixed; inset: 0; z-index: 2000; display: none; }
.drawer.open { display: block; }
.drawer-mask { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.drawer-panel {
    position: absolute; top: 0; right: 0; height: 100%; width: min(86vw, 360px);
    background: var(--white); box-shadow: -8px 0 30px rgba(0,0,0,0.2);
    display: flex; flex-direction: column; animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: var(--border-soft); font-weight: 700; font-size: 16px; color: var(--primary-dark); }
.drawer-tabs { display: flex; gap: 8px; padding: 12px 16px 0; }
.drawer-tab { flex: 1; padding: 8px; border: var(--border-soft); background: var(--card-bg); border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--text-secondary); }
.drawer-tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-color: transparent; }
.drawer-list { list-style: none; flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.drawer-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--card-bg); border: var(--border-soft); }
.drawer-item .di-icon { font-size: 18px; }
.drawer-item .di-body { flex: 1; min-width: 0; }
.drawer-item .di-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-item .di-sub { font-size: 11px; color: var(--text-muted); }
.drawer-item .di-act { font-size: 12px; color: var(--primary); cursor: pointer; white-space: nowrap; padding: 4px 6px; border-radius: 6px; }
.drawer-item .di-act:hover { background: var(--primary-light); }
.drawer-item .di-del { color: var(--text-muted); font-size: 11px; }
.drawer-item .di-act + .di-act { margin-left: 2px; }
.drawer-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 30px 16px; display: none; }
.drawer-empty.show { display: block; }

/* ===== 响应式（H5 / 桌面）===== */
@media (min-width: 640px) {
    header { padding: 12px 24px; }
    main { padding: 30px 24px; }
    footer { padding: 32px 24px; }
    #site-title { font-size: 20px; }
    .intro-title { font-size: 22px; }
    .link-item { font-size: 13px; }
    .category-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

@media (max-width: 639px) {
    main { padding: 15px 12px; }
    header { padding: 8px 12px; }
    footer { padding: 20px 12px; }
    #site-title { font-size: 16px; }
    .logo-emoji { font-size: 18px; }
    .floating-refresh-btn { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: 50px; height: 50px; font-size: 22px; }
    .floating-fav-btn { right: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); width: 50px; height: 50px; font-size: 20px; }
    .header-center { margin: 0 4px; }
    .header-category { font-size: 12px; padding: 5px 10px; }
    .top-controls { top: 10px; right: 10px; gap: 6px; }
    /* 移动端点击热区 ≥38px（配合下方 touch-action，兼顾易点性与不遮挡画面） */
    .overlay-btn { width: 38px; height: 38px; font-size: 14px; }
    .overlay-btn-text { min-width: 40px; padding: 0 8px; font-size: 12px; }
    .autoplay-toggle { font-size: 12px; padding: 4px 8px; }
    /* 悬浮按钮会盖住页脚内容，给页脚留出安全高度 */
    footer { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ============================================================
   H5 移动端兼容 / SEO 可读性补充
   依据：百度移动搜索白皮书（字号≥12px、可点区域足够大、无横向滚动、
        自适应站点需声明 applicable-device=pc,mobile）
        iOS / Android / 微信 / QQ 浏览器 X5 内核实测兼容项
   ============================================================ */

/* 禁止移动端浏览器自动放大文字（旋转屏幕/横屏时布局不炸） */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { max-width: 100%; }

/* 消除移动端 300ms 点击延迟，避免双击缩放误触 */
button, a, [role="button"], summary, input[type="checkbox"], label { touch-action: manipulation; }

/* 现代移动浏览器地址栏伸缩时高度不跳动 */
@supports (min-height: 100dvh) {
    body, .container { min-height: 100dvh; }
}

/* 刘海屏 / 灵动岛：sticky 头部不被系统状态栏遮挡（分别覆盖桌面/移动断点，保持原间距） */
@media (min-width: 640px) {
    header { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
}
@media (max-width: 639px) {
    header { padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
}

/* 无障碍：跳转到主内容 */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 3000; }
.skip-link:focus {
    left: 8px; top: 8px; background: var(--primary); color: #fff;
    padding: 8px 14px; border-radius: 10px; text-decoration: none;
}

.noscript-tip {
    text-align: center; padding: 14px 16px; margin-bottom: 12px;
    color: var(--text-secondary); font-size: 13px; line-height: 1.6;
    background: var(--card-bg); border: var(--border-soft); border-radius: var(--border-radius);
}

/* ===== 面包屑（可见内链，与 BreadcrumbList 结构化数据一致；位于播放器下方）===== */
.breadcrumb {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    font-size: 12px; color: var(--text-secondary); margin: 14px 0 12px;
}
.breadcrumb a { color: var(--primary-dark); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .bc-sep { color: var(--text-muted); }
.breadcrumb .bc-current { color: var(--text-secondary); }

.intro { margin: 0 0 14px; }
.category-desc { font-size: 12px; color: var(--text-secondary); margin-top: 10px; line-height: 1.7; }

/* ===== 自动播放被拦截时的引导（iOS 低电量模式 / 部分安卓策略）===== */
.tap-play-hint {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    z-index: 19; display: none; flex-direction: column; align-items: center; gap: 4px;
    color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
    background: rgba(0, 0, 0, 0.45); padding: 14px 24px; border-radius: 999px;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.tap-play-hint.show { display: flex; animation: pulse 2s ease-in-out infinite; }
.tap-play-icon { font-size: 20px; line-height: 1; }

/* ===== 触屏设备：控制条常驻（无 hover，手指点了才闪现不直观）===== */
@media (hover: none) and (pointer: coarse) {
    .controls-overlay { opacity: 0.95; }
    .video-container:hover { transform: none; }
    .progress-bar { height: 4px; }
    .progress-bar.interactive::after { top: -12px; bottom: -12px; }
}

/* ===== 横屏：播放器改为横向比例，避免被顶出视口 ===== */
@media (orientation: landscape) and (max-height: 560px) {
    .main-wrap { max-width: 760px; }
    .video-container { max-width: 100%; aspect-ratio: 16 / 9; }
    .category-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
    header { position: static; }
    .floating-refresh-btn, .floating-fav-btn { width: 46px; height: 46px; }
}

/* ===== 极窄屏（≤360px）===== */
@media (max-width: 360px) {
    .category-grid { grid-template-columns: repeat(3, 1fr); }
    .top-controls { gap: 5px; }
    .header-url { display: none; }
}
