﻿/* ============ base.css 鈥?鍙橀噺 / 閲嶇疆 / 椤舵爮 / 閫氱敤 ============ */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --text: #181818;
  --text-2: #6b7280;
  --border: #e5e7eb;
  --accent: #e60012;      /* NICONICO 椋庢牸鐐圭紑绾?*/
  --accent-hover: #c5000f;
  --header-bg: #0b0b0b;
  --header-text: #fff;
  --player-bg: #000;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.18);
  --header-h: 56px;
  --poster-w: 150px;
  --thumb-w: 268px;      /* 横版卡片宽度（继续观看/最近观看） */

  /* 骨架屏 / 图片占位 / 悬浮面 —— 深色主题要改的就是这些语义变量 */
  --placeholder: #e7e9ee;      /* 海报未加载时的底色 */
  --placeholder-2: #d9dde3;    /* 横版卡片的占位底色 */
  --skeleton: #e9ecf1;
  --skeleton-hi: #f4f6f9;
  --hover: #f7f8fa;            /* 列表项 hover */
  --chip: #f1f3f6;             /* 小胶囊底色 */
  --chip-text: #6b7280;
}

/* ================= 深色主题 =================
 * 由 <html data-theme="dark"> 触发（js/theme.js 控制，index.html 里有防闪烁的内联脚本）。
 * 头部、播放器本来就是深色的，所以只改内容区相关变量。
 */
html[data-theme="dark"] {
  --bg: #0e1014;
  --surface: #171a21;
  --surface-2: #1c2028;
  --text: #e9ecf1;
  --text-2: #98a1b0;
  --border: #2a2f3a;

  --placeholder: #232833;
  --placeholder-2: #2b313d;
  --skeleton: #20242d;
  --skeleton-hi: #272c36;
  --hover: #1f242e;
  --chip: #242a35;
  --chip-text: #a8b1bf;

  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.6);

  color-scheme: dark;
  background: var(--bg);
}

html[data-theme="dark"] .poster-card .thumb { background: var(--placeholder); }
html[data-theme="dark"] .poster-card.landscape .thumb { background: var(--placeholder-2); }
html[data-theme="dark"] .sked-ava { background: var(--placeholder); }
html[data-theme="dark"] .ep-card:hover { background: var(--hover); }
html[data-theme="dark"] .modal .field input,
html[data-theme="dark"] .modal .quick .q-user:hover { background: var(--surface-2); }
html[data-theme="dark"] .ep-pos { background: var(--chip); color: var(--chip-text); }
html[data-theme="dark"] .poster-card .meta .sub,
html[data-theme="dark"] .sked-hint,
html[data-theme="dark"] .empty,
html[data-theme="dark"] .sked-none { color: var(--text-2); }
/* 深色下红色胶囊稍微提亮一点，保证对比度 */
html[data-theme="dark"] { --accent: #ff2d3f; --accent-hover: #e11d2e; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; } /* 闃叉绉诲姩绔暣椤靛乏鍙虫嫋鍔?*/
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-x: none;
}
a { color: inherit; text-decoration: none; }
img { display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c4c8cf; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #aab0b8; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 椤舵爮 ---------- */
#header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--header-bg);
  color: var(--header-text);
  display: flex; align-items: center; gap: 20px;
  padding: 0 18px;
  box-shadow: 0 1px 0 rgba(255,255,255,.06);
}
#header .logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 17px; letter-spacing: .5px;
  cursor: pointer; white-space: nowrap;
}
#header .logo .nico-badge {
  background: #fff; color: #000; font-weight: 800;
  border-radius: 4px; padding: 2px 6px; font-size: 13px; letter-spacing: 0;
}
#header .nav { display: flex; align-items: center; gap: 2px; }
#header .nav a {
  padding: 7px 13px; border-radius: 6px; color: #d7d7d7; font-size: 14px;
  transition: background .15s, color .15s;
}
#header .nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
#header .nav a.active { background: rgba(255,255,255,.14); color: #fff; }
#header .search-box {
  display: flex; align-items: center; flex: 1; max-width: 440px; min-width: 150px;
  background: rgba(255,255,255,.1); border-radius: 6px; overflow: hidden;
  transition: background .15s;
}
#header .search-box:focus-within { background: rgba(255,255,255,.16); }
#header .search-box input {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: #fff; padding: 8px 12px; font-size: 14px;
}
#header .search-box input::placeholder { color: #9aa0a8; }
#header .search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }
#header .search-box button {
  background: transparent; border: none; color: #c9cdd4; padding: 0 12px;
  font-size: 15px; cursor: pointer; height: 100%;
}
#header .search-box button:hover { color: #fff; }
#header .spacer { flex: 1; }
#header .user-area { display: flex; align-items: center; gap: 10px; }
#header .user-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.1); border-radius: 999px; padding: 5px 6px 5px 12px;
  font-size: 13px; color: #fff; cursor: pointer;
}
#header .avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: #3a3f47; display: grid; place-items: center;
  font-weight: 700; font-size: 12px; color: #fff;
}
#header .login-btn {
  background: var(--accent); color: #fff; border-radius: 6px;
  padding: 8px 16px; font-size: 14px; font-weight: 600;
  transition: background .15s;
}
#header .login-btn:hover { background: var(--accent-hover); }

/* 鐢ㄦ埛鎮仠鍗＄墖 */
#header .user-area { position: relative; }
.user-card {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 200;
  width: 264px; background: #1a1e24; border: 1px solid #2b3038; border-radius: 10px;
  padding: 14px; box-shadow: var(--shadow-lg); color: #e8eaee;
}
.user-card .uc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-card .uc-head .avatar { width: 38px; height: 38px; font-size: 16px; }
.user-card .uc-name { font-weight: 700; font-size: 14px; color: #fff; }
.user-card .uc-role { font-size: 12px; color: #9aa0a8; margin-top: 2px; }
.user-card .uc-quota { margin-bottom: 12px; }
.user-card .uc-row { display: flex; justify-content: space-between; font-size: 12px; color: #9aa0a8; margin-bottom: 6px; }
.user-card .uc-num { color: #e8eaee; font-variant-numeric: tabular-nums; }
.user-card .uc-bar { height: 6px; background: #2b3038; border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.user-card .uc-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.user-card .uc-sub { font-size: 11px; color: #6b7280; }
.user-card .uc-logout { width: 100%; margin-top: 2px; }

/* ---------- 閫氱敤 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 14px; color: var(--text); transition: all .15s;
}
.btn:hover { border-color: #cfd3d9; background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; }

.hidden { display: none !important; }
.muted { color: var(--text-2); }
.spinner {
  width: 34px; height: 34px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; margin: 60px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading, .empty, .error {
  text-align: center; padding: 60px 20px; color: var(--text-2); font-size: 14px;
}
.empty { color: #9aa0a8; }
.error { color: var(--accent); }

/* 椤甸潰瀹瑰櫒 */
.page { padding: 18px 22px 60px; max-width: 1500px; margin: 0 auto; }
.page-title { font-size: 20px; font-weight: 700; margin: 6px 0 16px; }
.page-title .sub { font-size: 13px; font-weight: 400; color: var(--text-2); margin-left: 10px; }

/* 椤舵爮澶村儚棰滆壊姹?*/
.avatar[data-c="0"] { background: #e60012; }
.avatar[data-c="1"] { background: #1a73e8; }
.avatar[data-c="2"] { background: #188038; }
.avatar[data-c="3"] { background: #f29900; }
.avatar[data-c="4"] { background: #8e24aa; }
.avatar[data-c="5"] { background: #00838f; }

/* ---------- 瑙傜湅鏁板皬寰芥爣锛堟挱鏀鹃〉鏍囬鏃?/ 璇︽儏椤典俊鎭锛?---------- */
.views-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; color: #ffd24a;
  background: rgba(255,255,255,.12); padding: 2px 9px; border-radius: 999px;
  font-variant-numeric: tabular-nums; white-space: nowrap; text-shadow: none;
}
.ep-card .ep-meta .views-badge,
.views-badge.ep-views {
  position: static; background: none; color: #9aa0a8;
  font-size: 12px; padding: 0; margin-left: 10px; font-weight: 500;
}

/* ---------- 鏂扮増鏈彁绀烘潯 ---------- */
.update-bar {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 9999; display: flex; align-items: center; gap: 14px;
  padding: 10px 14px 10px 18px; border-radius: 999px;
  background: #1c1c1e; color: #fff; font-size: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  animation: update-bar-in .3s ease-out;
}
.update-bar span { white-space: nowrap; }
.update-bar button {
  padding: 6px 15px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: var(--accent); color: #fff; transition: background .15s;
}
.update-bar button:hover { background: var(--accent-hover); }
@keyframes update-bar-in {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 绉诲姩绔?---------- */
@media (max-width: 640px) {
  #header { gap: 8px; padding: 0 10px; }
  #header .logo .logo-name { display: none; }   /* 手机上只留徽标 + 线路标识 */
  #header .nav a { padding: 7px 9px; font-size: 13px; }
  #header .search-box { max-width: none; min-width: 0; }
  #header .search-box input { padding: 8px 9px; font-size: 13px; }
  #header .login-btn { padding: 7px 12px; font-size: 13px; }
  .update-bar { bottom: 14px; font-size: 13px; }
}

/* ---------- 鐧诲綍鐘舵€佸け鏁堟í骞咃紙鐧诲綍浜嗕絾娌℃湁 AccessToken 鈫?杩涘害涓嶄細璁板綍锛?---------- */
.auth-warning {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9999;
  padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
  background: #7c2d12; color: #ffe4c7; border-top: 1px solid #ea580c;
  font-size: 13px; text-align: center; cursor: pointer; line-height: 1.5;
}
.auth-warning b { color: #fff; }
.auth-warning:hover { background: #9a3412; }

/* ---------- 「需要刷新」提示条（连接失效 / 卡住 / 字幕加载不出来） ---------- */
.notice-bar { background: #7c2d12; border: 1px solid #ea580c; max-width: calc(100vw - 24px); }
.notice-bar .notice-text { white-space: normal; line-height: 1.45; }
.notice-bar .notice-refresh { background: #ea580c; }
.notice-bar .notice-refresh:hover { background: #f97316; }
.notice-bar .notice-close {
  background: transparent; color: #ffd9b8; font-size: 15px; line-height: 1;
  padding: 4px 8px; border-radius: 999px;
}
.notice-bar .notice-close:hover { background: rgba(255,255,255,.14); }
@media (max-width: 640px) {
  .notice-bar { left: 12px; right: 12px; transform: none; border-radius: 14px; gap: 10px; padding: 10px 12px; }
  .notice-bar .notice-text { font-size: 12.5px; }
}

/* ---------- 顶栏线路标识（站点标题下方） ---------- */
.logo { align-items: center; }
.logo .logo-text { display: flex; flex-direction: column; justify-content: center; line-height: 1.15; min-width: 0; }
.logo .logo-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.line-badge { display: block; }
.lb-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 0; padding: 1px 0; margin: 0;
  color: #9aa4b2; font-size: 11px; line-height: 1.4; cursor: pointer;
  white-space: nowrap; max-width: 100%;
}
.lb-btn:hover { color: #e8ecf2; }
.lb-btn:hover .lb-caret { opacity: 1; }
.lb-text { overflow: hidden; text-overflow: ellipsis; }
.lb-text b { color: #cbd5e1; font-weight: 600; }
.lb-btn:hover .lb-text b { color: #fff; }
.lb-caret { opacity: .5; font-size: 9px; transition: opacity .15s; }

/* 圆点：闪烁 = 正在检测/正常心跳，红 = 不可用 */
.lb-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: #6b7280; box-shadow: 0 0 0 0 rgba(107,114,128,.6);
}
.lb-dot.ok { background: #22c55e; animation: lb-pulse 1.8s ease-out infinite; }
.lb-dot.bad { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,.8); }
.lb-dot.warn { background: #f59e0b; animation: lb-pulse-warn 1.8s ease-out infinite; }
@keyframes lb-pulse-warn {
  0%   { box-shadow: 0 0 0 0 rgba(245,158,11,.65); }
  70%  { box-shadow: 0 0 0 6px rgba(245,158,11,0); }
  100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); }
}
.lb-row.warn .lb-ms { color: #f59e0b; }
@media (prefers-reduced-motion: reduce) { .lb-dot.warn { animation: none; } }
.lb-dot.checking { background: #9ca3af; animation: lb-blink .9s ease-in-out infinite; }
@keyframes lb-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.65); }
  70%  { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
@keyframes lb-blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
  .lb-dot.ok, .lb-dot.checking, .lb-dot.warn { animation: none; }
}

/* ---------- 线路选择菜单 ---------- */
.lb-menu {
  position: fixed; z-index: 10000; min-width: 250px; max-width: min(320px, calc(100vw - 24px));
  background: #1c1c1e; color: #e8ecf2; border: 1px solid #33363d;
  border-radius: 12px; padding: 6px; box-shadow: 0 14px 40px rgba(0,0,0,.45);
  font-size: 13px; animation: lb-menu-in .14s ease-out;
}
@keyframes lb-menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.lb-title { padding: 7px 10px 6px; color: #8b93a1; font-size: 11px; letter-spacing: .04em; }
.lb-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer; transition: background .12s;
}
.lb-row:hover { background: #2a2d34; }
.lb-row.active { background: #23406b; }
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-weight: 600; }
.lb-desc { color: #8b93a1; font-size: 11px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row.active .lb-desc { color: #b9c6da; }
.lb-ms { color: #8b93a1; font-size: 11px; font-variant-numeric: tabular-nums; flex: none; }
.lb-foot { padding: 7px 10px 5px; color: #6f7783; font-size: 11px; border-top: 1px solid #2a2d34; margin-top: 4px; }

.lb-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(8px); z-index: 10001;
  background: #1c1c1e; color: #fff; font-size: 13px;
  padding: 9px 16px; border-radius: 999px; box-shadow: 0 8px 30px rgba(0,0,0,.4);
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
  max-width: calc(100vw - 32px); text-align: center;
}
.lb-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 手机上顶栏窄，线路标识只留圆点 + 短名 */
@media (max-width: 640px) {
  .lb-text { display: none; }
  .lb-caret { display: none; }
  .lb-btn { gap: 0; }
  .lb-menu { min-width: 210px; }
}

/* ---------- 用户详情卡片里的偏好设置 ---------- */
.user-card .uc-prefs {
  margin: 10px 0 4px; padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.12);
}
.user-card .uc-pref-title { font-size: 11px; letter-spacing: .05em; color: #7b8494; margin-bottom: 8px; }
.user-card .uc-pref {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 5px 0; font-size: 13px;
}
.user-card .uc-pref-label { color: #c9cdd4; flex: none; }

.user-card .uc-seg { display: flex; gap: 3px; background: rgba(255,255,255,.07); padding: 3px; border-radius: 8px; }
.user-card .uc-seg button {
  padding: 3px 9px; border-radius: 6px; font-size: 12px; line-height: 1.5;
  background: transparent; color: #b6bdc8; cursor: pointer; transition: background .15s, color .15s;
  white-space: nowrap;
}
.user-card .uc-seg button:hover { color: #fff; }
.user-card .uc-seg button.active { background: var(--accent); color: #fff; font-weight: 600; }

/* 开关 */
.user-card .uc-switch {
  position: relative; width: 40px; height: 22px; border-radius: 999px; flex: none;
  background: rgba(255,255,255,.18); cursor: pointer; padding: 0;
  transition: background .18s;
}
.user-card .uc-switch .uc-switch-knob {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .18s;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.user-card .uc-switch.on { background: #22c55e; }
.user-card .uc-switch.on .uc-switch-knob { transform: translateX(18px); }
@media (max-width: 640px) {
  .user-card .uc-seg button { padding: 4px 7px; font-size: 11.5px; }
  .user-card .uc-pref { font-size: 12.5px; }
}

/* ================= 移动端：去掉点击蓝框 / 灰底 =================
   安卓 Chrome 点击可点元素会闪一个蓝色高亮框，iOS 会闪灰色半透明块。
   这是浏览器默认的 tap highlight，跟我们的设计无关，全局关掉。
   注意：这【不影响】键盘导航的 :focus-visible 焦点圈（无障碍保留）。 */
html {
  -webkit-tap-highlight-color: transparent;
}
button, a, [role="button"], [tabindex], label, summary,
.carousel, .slide, .dots, .arrow, .poster, .card, .chip, .lb-btn, .uc-seg > button {
  -webkit-tap-highlight-color: transparent;
}
/* 去掉 iOS 上长按图片弹出的"存储图像"菜单 */
img, canvas, video {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}
