/* kdying 看电影 - 样式表 */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --surface-hover: #f2f5ff;
  --border: #e5e8ef;
  --border-strong: #d5dae5;
  --text: #1c2333;
  --text-2: #5b6478;
  --text-3: #8a93a6;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0ff;
  --primary-text: #ffffff;
  --accent: #0ea5a4;
  --shadow: 0 1px 2px rgba(20, 28, 50, .04), 0 6px 20px rgba(20, 28, 50, .05);
  --shadow-lg: 0 8px 30px rgba(20, 28, 50, .12);
  --radius: 12px;
  --topbar-h: 66px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}

a { color: var(--primary); text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 24px;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); flex: none; }
.brand:hover { color: var(--text); }
/* 品牌上下两行：中文站名在上、域名胶囊徽章在下，居中对齐共享中轴 */
.brand-text { display: flex; align-items: center; }
.brand-text strong {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 16px; font-weight: 700; letter-spacing: .3px; line-height: 1.2;
}
#site-title .t-zh {
  color: var(--text); font-size: 17px; font-weight: 800; letter-spacing: 2px;
  /* 抵消末字后的字距空隙，保证居中时视觉不偏 */
  margin-right: -2px;
  line-height: 1.15;
}
#site-title .t-en {
  color: #8a93a6;
  font-size: 10px; font-weight: 600;
  letter-spacing: 1.5px; line-height: 1;
  /* 无底色、无边框，纯文字小注脚 */
  padding: 0;
}

.top-actions { display: flex; gap: 8px; margin-left: auto; flex: none; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text-2);
  transition: all .15s;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }

/* 视图切换（软件库 / 在线观影） */
.tabs {
  display: flex; gap: 3px; flex: none;
  padding: 3px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.tab {
  padding: 6px 13px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--primary); }
.tab.active {
  background: var(--surface); color: var(--primary);  box-shadow: 0 1px 3px rgba(20, 28, 50, .1);
}

/* 顶栏「导航」按钮：显示/隐藏当前页面的书签栏（与标签并排，样式一致） */
.nav-toggle {
  flex: none;
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-toggle:hover { color: var(--primary); border-color: var(--primary); }
.nav-toggle[aria-expanded="false"] { color: var(--text-3); }
.nav-toggle[aria-expanded="false"] svg { opacity: .6; }
/* 顶栏「新窗口打开」纯图标按钮（导航右侧） */
.popout-btn { padding: 7px 9px; }
.popout-btn svg { display: block; }
/* 书签栏隐藏态（观影页 / 软件库通用） */
.watch-bookbar.is-hidden { display: none; }

/* 伪全屏时的悬浮控制组（导航切换 + 退出全屏），右上角浮于画面与书签栏之上 */
.fs-float {
  display: none;
  position: fixed;
  top: 10px; right: 10px;
  z-index: 110;
  gap: 8px;
}
body.fs-lock .fs-float { display: flex; }
.fs-fbtn {
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  background: #0b1220;
  color: #fff;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.fs-fbtn:hover { background: #16233d; border-color: rgba(255, 255, 255, .65); }
.fs-fbtn:active { transform: scale(.96); }
/* 悬浮「导航」按钮：深蓝底 + 亮边框，比「退出全屏」更醒目；
   收起状态反而更亮，提示点一下可以把导航拉回来 */
.fs-fbtn#fs-bookbar-toggle {
  background: #152747;
  border-color: rgba(255, 255, 255, .6);
  font-weight: 700;
}
.fs-fbtn#fs-bookbar-toggle[aria-expanded="false"] {
  background: #24406e;
  border-color: #fff;
}
/* 全屏时书签栏右侧留出悬浮按钮的位置（观影 / 网盘搜索） */
body.fs-lock .wb-scroll { padding-right: 108px; }

/* ---------- 布局 ---------- */
.layout { margin-top: 22px; }
.content { min-width: 0; }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin: 22px 0 14px; flex-wrap: wrap;
}
.result-count { color: var(--text-2); font-size: 13px; }
.result-count b { color: var(--primary); font-size: 15px; }
.toolbar-controls { display: flex; align-items: center; gap: 10px; }
.sel { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.sel > span { flex: none; }
.sel select {
  height: 32px; padding: 0 26px 0 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); outline: none; font-size: 12.5px;
}
.sel select:focus { border-color: var(--primary); }
.view-switch {
  display: flex; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); overflow: hidden;
}
.view-switch button {
  width: 34px; height: 32px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--text-3);
}
.view-switch button + button { border-left: 1px solid var(--border); }
.view-switch button:hover { color: var(--primary); }
.view-switch button.active { background: var(--primary-soft); color: var(--primary); }

/* ---------- 表格视图 ---------- */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
thead th {
  background: var(--surface-2); color: var(--text-2);
  text-align: left; font-size: 12px; font-weight: 600;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-hover); }
td.col-name { font-weight: 600; color: var(--text); min-width: 170px; }
td.col-desc { color: var(--text-2); min-width: 280px; line-height: 1.6; }
td.col-meta { color: var(--text-3); white-space: nowrap; font-size: 12px; }
td.col-action { white-space: nowrap; text-align: right; }
.badge-cat {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  border-radius: 5px; background: var(--primary-soft); color: var(--primary);
  font-size: 10.5px; font-weight: 500; vertical-align: 1px; cursor: pointer;
  border: 0;
}
.badge-cat:hover { background: var(--primary); color: #fff; }

.dl-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border: 0; border-radius: 7px;
  background: var(--primary); color: var(--primary-text);
  font-size: 12px; font-weight: 500; white-space: nowrap;
  transition: background .15s, transform .15s;
}
.dl-btn:hover { background: var(--primary-hover); color: #fff; transform: translateY(-1px); }
.dl-btn + .dl-btn { margin-left: 6px; }
.dl-btn svg { flex: none; }
.dl-btn.ghost {
  background: var(--primary-soft); color: var(--primary);
}
.dl-btn.ghost:hover { background: var(--primary); color: #fff; }

/* ---------- 卡片视图 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
/* 关键：允许卡片在窄栏里收缩，防止 nowrap 内容把栅格撑破、挤出屏幕 */
.card-grid > * { min-width: 0; }
.soft-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 17px 18px 15px;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.soft-card:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}
/* 图文卡片：封面大图 + 标题 + 描述 + 整行「前往下载」 */
.soft-card.has-cover { padding: 0 0 14px; overflow: hidden; }
.soft-card .card-cover { margin: 0; }
.soft-card .card-cover img {
  display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover;
}
.soft-card.has-cover .card-body { padding: 4px 16px 0; }
.soft-card.has-cover h3 { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.soft-card.has-cover .card-desc {
  margin: 7px 0 12px; font-size: 13px; line-height: 1.65;
  color: var(--text-2); -webkit-line-clamp: 3;
}
/* 整行浅紫「前往下载」按钮 */
.dl-btn.dl-go {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 10px 12px;
  background: var(--primary-soft); color: var(--primary);
  border: 0; border-radius: 10px;
  font-size: 14px; font-weight: 600; letter-spacing: 1px;
  transition: background .15s, transform .15s;
}
.dl-btn.dl-go:hover {
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
  transform: translateY(-1px);
}
/* 表格视图：名称列缩略图 */
.row-thumb {
  width: 64px; height: 42px; object-fit: cover;
  border-radius: 7px; margin-right: 9px;
  vertical-align: middle; display: inline-block;
  border: 1px solid var(--border); background: var(--surface-2);
}
.soft-card .card-top { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.soft-card .card-top > div { min-width: 0; }
.soft-card .avatar {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  background: var(--primary-soft); color: var(--primary);
}
.soft-card h3 { margin: 0; font-size: 15px; line-height: 1.4; word-break: break-word; }
.soft-card .card-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.soft-card .card-desc {
  margin: 12px 0 14px; font-size: 12.5px; color: var(--text-2);
  line-height: 1.7; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.soft-card .card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tag {
  padding: 2px 8px; border-radius: 6px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-3); font-size: 11px;
}

/* 关键词高亮 */
mark { background: color-mix(in srgb, var(--accent) 25%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* 空状态 */
.empty {
  text-align: center; padding: 70px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-2);
}
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 16px; }
.empty p { margin: 0 0 18px; font-size: 13px; }
.btn-reset {
  padding: 7px 18px; border-radius: 8px; border: 1px solid var(--primary);
  background: var(--primary-soft); color: var(--primary); font-size: 13px;
}
.btn-reset:hover { background: var(--primary); color: #fff; }

/* ---------- 分页 ---------- */
.pagination { display: flex; justify-content: center; gap: 6px; margin: 24px 0 40px; flex-wrap: wrap; }
.pagination button {
  min-width: 34px; height: 34px; padding: 0 9px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text-2); font-size: 12.5px;
}
.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination .ellipsis { padding: 0 4px; color: var(--text-3); align-self: center; }

/* ---------- 页脚 / 回顶 ---------- */
.footer {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 24px 0 30px; margin-top: 20px;
}
.footer p { margin: 0; font-size: 12px; color: var(--text-2); }
.footer-meta { margin-top: 6px !important; font-size: 11.5px !important; color: var(--text-3) !important; }
.footer .dot { margin: 0 7px; }
.back-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  width: 40px; height: 40px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); box-shadow: var(--shadow-lg);
  display: grid; place-items: center;
}
.back-top:hover { color: var(--primary); border-color: var(--primary); }

/* ---------- 在线观影 ---------- */
/* 顶栏下方的两级导航书签栏：一级青紫渐变条 + 二级白底胶囊 */
.watch-bookbar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 40;
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, #7c6cf0 22%, var(--border));
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(79, 70, 229, .10);
  overflow: hidden;
}
.wb-scroll {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px;
  overflow-x: auto; overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
  user-select: none;
}
.wb-scroll.dragging { cursor: grabbing; }
.wb-scroll::-webkit-scrollbar { display: none; }
/* 一级：青→紫渐变，白色文字；底部不留白，让选中块坐到二级栏上 */
.watch-bookbar > .wb-scroll:not(.wb-sub) {
  background: linear-gradient(100deg, #22d3ee 0%, #4f9cf9 38%, #7b6ef6 72%, #a855f7 100%);
  padding-bottom: 0;
}
.wb-item {
  flex: none;
  border: 0; background: transparent; color: var(--text-2);
  font-size: 12.5px; padding: 5px 10px; border-radius: 7px;
  cursor: pointer; white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background .14s, color .14s, box-shadow .14s;
}
.wb-item:hover { background: var(--surface-hover); color: var(--text); }
.wb-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
/* 一级分组标签：渐变条上白字 + 线性图标，选中白色高亮 */
.wb-tab {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 8px;
  color: rgba(255, 255, 255, .93);
}
.wb-tab svg { width: 15px; height: 15px; flex: none; opacity: .95; }
.wb-tab:hover { background: rgba(255, 255, 255, .18); color: #fff; }
/* 选中块：底部平角、无下圆角，像标签页一样坐到下方二级栏上，融为一体 */
.wb-tab.active {
  background: #fff; color: #2563eb; font-weight: 700;
  padding-top: 8px; padding-bottom: 9px;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -2px 10px rgba(37, 99, 235, .18);
  position: relative; z-index: 2;
}
.wb-tab.active svg { opacity: 1; }
/* 二级站点行：白底，无分隔线，与一级选中块连成整体 */
.wb-sub {
  position: relative;
  border-top: 0;
  background: #fff;
  border-radius: 0 0 12px 12px;
}
/* 联动高亮带：宽度由 JS 按一级选中项宽度设置，随切换平滑滑动 */
.wb-sub::before {
  content: "";
  position: absolute; left: 0; bottom: 0; top: 0;
  width: var(--fusion-w, 0px);
  background: linear-gradient(90deg, #eaf2ff 0%, #eaf2ff 72%, rgba(234, 242, 255, 0) 100%);
  border-radius: 0 12px 12px 0;
  pointer-events: none;
  transition: width .28s cubic-bezier(.4, 0, .2, 1);
}
.wb-sub > .wb-item { position: relative; z-index: 1; }
.wb-site { font-size: 12px; padding: 4px 11px; border-radius: 999px; }
.wb-site:hover { background: #f2f5ff; color: var(--text); }
.wb-site.active { background: #dbe8ff; color: #2563eb; font-weight: 600; }
.watch-empty {
  margin: 0; padding: 10px 8px;
  font-size: 12px; line-height: 1.7; color: rgba(255, 255, 255, .92);
}
.watch-empty code {
  padding: 1px 5px; border-radius: 4px;
  background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .35); font-size: 11px;
}

.watch-stage { display: flex; flex-direction: column; gap: 12px; }

.watch-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
}
.watch-title { display: flex; flex-direction: column; min-width: 0; }
.watch-title strong { font-size: 15px; color: var(--text); line-height: 1.4; }
.watch-title span {
  font-size: 12px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.watch-actions { display: flex; gap: 8px; flex: none; }
.wa-btn {
  padding: 7px 13px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-2); font-size: 12.5px; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.wa-btn:hover { border-color: var(--primary); color: var(--primary); }
.wa-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.wa-btn.primary:hover { background: var(--primary-hover); color: #fff; }

.watch-frame-wrap {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: #0e1320;
  border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; box-shadow: var(--shadow);
}
#watch-frame, #search-frame {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; background: #0e1320; display: block;
}
/* 伪全屏兜底：iPhone Safari 等不支持元素全屏 API 的浏览器，
   按钮点击后用 fixed 覆盖整个屏幕（盖过顶栏），再点「退出全屏」恢复 */
#watch-stage.pseudo-fs,
#search-stage.pseudo-fs {
  position: fixed;
  inset: 0;
  z-index: 90;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  aspect-ratio: auto;
  max-height: none;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
body.fs-lock { overflow: hidden; }
/* 伪全屏时书签栏浮在全屏画面之上，随时可换台 */
body.fs-lock .watch-bookbar { z-index: 100; }
.watch-cover {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 20px; text-align: center; color: #9aa6bd;
  background: radial-gradient(circle at 50% 40%, #1b2436, #0e1320 70%);
}
.watch-cover .wc-icon {
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .09);
  color: #dfe7f5; font-size: 20px; padding-left: 4px;
}
.watch-cover p { margin: 0; font-size: 13px; }
.watch-loading {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 16px; text-align: center;
  background: rgba(14, 19, 32, .78); color: #dbe3f1; font-size: 13px;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.watch-loading.loading-retry {
  cursor: pointer;
  color: #fff;
}
.watch-loading.loading-retry:hover { background: rgba(14, 19, 32, .88); }
/* 超时提示卡片：一行文案 + 两个按钮 */
.loading-tip {
  width: min(360px, 100%);
  padding: 20px 18px 18px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px;
  background: rgba(18, 26, 44, .92);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .4);
}
.loading-tip-text {
  margin: 0 0 16px;
  color: #eaf0ff; font-size: 13.5px; line-height: 1.6;
}
.loading-tip-actions {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 10px;
}
.watch-loading .loading-btn {
  min-width: 112px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13px; font-weight: 600; line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, border-color .15s, transform .1s;
}
.watch-loading .loading-btn:active { transform: scale(.97); }
.watch-loading .loading-reload {
  border: 1px solid #6f9bff;
  background: #3b6fe0;
  color: #fff;
}
.watch-loading .loading-reload:hover { background: #4c80f0; }
.watch-loading .loading-open {
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .08);
  color: #dce6ff;
}
.watch-loading .loading-open:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.loading-tip-hint {
  margin: 14px 0 0;
  color: #8b97b2; font-size: 11.5px; line-height: 1.5;
}

.watch-hint { margin: 0; font-size: 12px; line-height: 1.65; color: var(--text-3); }

/* ---------- 下载网盘弹窗 ---------- */
.dl-count {
  display: inline-block; min-width: 15px; height: 15px; margin-left: 5px;
  padding: 0 4px; border-radius: 8px;
  background: rgba(255, 255, 255, .24);
  font-size: 10px; line-height: 15px; text-align: center; vertical-align: 1px;
}

body.modal-open { overflow: hidden; }

.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal[hidden] { display: none; }
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(20, 28, 50, .4);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.modal-card {
  position: relative; z-index: 1;
  width: min(460px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--surface); border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: 0 24px 70px rgba(20, 28, 50, .3);
  animation: modal-in .18s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-3);
  font-size: 20px; line-height: 1;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-card h3 { margin: 0; font-size: 16.5px; line-height: 1.35; color: var(--text); }
/* 弹窗头部：软件名 + 「免登录下载」按钮同行 */
.modal-head {
  display: flex; align-items: center; gap: 12px;
  margin-right: 30px;
}
.modal-head h3 { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-head .drive-open {
  flex: none; padding: 7px 13px; white-space: nowrap;
  /* 与网盘卡的紫色按钮形成对比：青色主按钮 */
  background: var(--accent);
}
.modal-head .drive-open:hover { background: #0b8f8e; color: #fff; }
.modal-meta { margin: 4px 0 12px; font-size: 12px; color: var(--text-3); }
.modal-label { margin: 0 0 8px; font-size: 12px; color: var(--text-3); }
/* 一行两个网盘卡片 */
.drive-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.drive-row {
  display: flex; flex-direction: column; gap: 7px;
  padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 10px;
  min-width: 0;
}
.drive-info { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; min-width: 0; }
.drive-name { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
/* 网盘官方图标（本地 favicon） */
.drive-ico-img {
  flex: none; width: 17px; height: 17px;
  border-radius: 4px; display: block; object-fit: contain;
}
.drive-code {
  border: 0; background: transparent; padding: 0;
  font-size: 11px; color: var(--text-3); white-space: nowrap;
}
.drive-code b { font-weight: 600; color: var(--text-2); }
.drive-code:hover b { color: var(--primary); }
.drive-actions { margin-left: 0; display: flex; gap: 6px; }
.drive-actions > * { flex: 1; text-align: center; justify-content: center; }
.drive-open {
  padding: 6px 8px; border-radius: 7px;
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  display: inline-flex; align-items: center;
}
.drive-open:hover { background: var(--primary-hover); color: #fff; }
.drive-copy {
  padding: 6px 8px; border-radius: 7px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); font-size: 12px; white-space: nowrap;
}
.drive-copy:hover { border-color: var(--primary); color: var(--primary); }
.drive-copy.copied {
  border-color: var(--primary); color: var(--primary); background: var(--primary-soft);
}

/* ---------- 免登录下载：答题解锁 ---------- */
.dl-quiz { padding: 2px 0; }
.dl-quiz-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 12px;
  font-size: 12px; color: var(--text-3);
}
.dl-quiz-change {
  border: 0; background: transparent; padding: 2px 4px;
  font-size: 12px; color: var(--primary);
}
.dl-quiz-change:hover { color: var(--primary-hover); }
.dl-quiz-q {
  margin: 0 0 14px; font-size: 15px; font-weight: 600;
  text-align: center; color: var(--text); line-height: 1.6;
}
.dl-quiz-kw {
  margin: -4px 0 12px; padding: 10px 12px;
  border: 1px dashed var(--border-strong); border-radius: 9px;
  background: var(--surface-2);
}
.dl-quiz-kw-text {
  font-size: 12.5px; line-height: 1.6; color: var(--text-2);
  word-break: break-all; white-space: pre-wrap;
  margin-bottom: 8px;
}
.dl-quiz-kw .drive-copy { width: 100%; padding: 7px; font-size: 13px; }
.dl-quiz-form { display: flex; gap: 8px; }
.dl-quiz-input {
  flex: 1; min-width: 0; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); color: var(--text);
  font-size: 14px; outline: none;
  transition: border-color .13s, background .13s;
}
.dl-quiz-input:focus { border-color: var(--primary); background: var(--surface); }
.dl-quiz-input::placeholder { color: var(--text-3); }
.dl-quiz-input.wrong {
  background: #fee2e2; border-color: #fca5a5; color: #b91c1c;
  animation: shake .3s;
}
.dl-quiz-form .drive-open { padding: 9px 18px; }
.dl-quiz-err {
  margin: 10px 0 0; font-size: 12.5px; color: #b91c1c; text-align: center;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.dl-quiz-ok { text-align: center; padding: 8px 0 2px; }
.dl-quiz-done { margin: 0 0 12px; font-size: 13.5px; font-weight: 600; color: var(--accent); }
.dl-quiz-actions { display: flex; gap: 8px; }
.dl-quiz-actions > * { flex: 1; text-align: center; justify-content: center; padding: 9px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  z-index: 120; padding: 9px 18px; border-radius: 999px;
  background: rgba(28, 35, 51, .94); color: #fff; font-size: 13px;
  box-shadow: 0 8px 24px rgba(20, 28, 50, .25);
  animation: toast-in .18s ease-out;
}
.toast[hidden] { display: none; }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 响应式 ---------- */
/* 桌面/平板始终一行 3 个卡片；手机(≤720px)降为 2 个 */

/* 手机：顶栏两行 + 全宽搜索 + 表格横滑 */
@media (max-width: 720px) {
  .container, .topbar-inner { padding-left: 14px; padding-right: 14px; }

  /* 手机端顶栏保持吸顶；顶栏单行高度写进变量，供书签栏定位使用。
     搜索框删除后顶栏只剩一行，若沿用旧的两行高度(108px)，
     sticky 会把书签栏推低约 50px，出现空白。 */
  :root { --topbar-h: 64px; }
  .topbar-inner {
    gap: 10px; height: auto; min-height: 0;
    padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap;
  }
  .brand { gap: 9px; }
  #site-title .t-zh { font-size: 16px; letter-spacing: 1.5px; margin-right: -1.5px; }
  #site-title .t-en { font-size: 9.5px; letter-spacing: 1px; padding: 0; }
  .top-actions { margin-left: auto; gap: 6px; }
  .icon-btn { width: 36px; height: 36px; }

  .toolbar { align-items: flex-start; gap: 10px; margin: 14px 0 12px; }
  .result-count { font-size: 13.5px; }
  .toolbar-controls { width: 100%; flex-wrap: wrap; gap: 8px; }
  .sel select { height: 36px; font-size: 13.5px; }
  .view-switch button { width: 42px; height: 38px; }

  /* 手机卡片视图：一行 3 张（与桌面一致），图文卡紧凑适配 */
  .card-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .soft-card { padding: 10px 9px 9px; }
  .soft-card .avatar { width: 30px; height: 30px; font-size: 13px; border-radius: 7px; }
  .soft-card h3 { font-size: 13px; }
  .soft-card .card-meta { font-size: 10.5px; }
  .soft-card .card-desc { font-size: 11.5px; margin: 6px 0 8px; -webkit-line-clamp: 2; }
  .soft-card .card-foot { gap: 5px; }
  .soft-card .tag { font-size: 10px; padding: 2px 5px; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .card-grid .dl-btn { font-size: 11.5px; padding: 6px 9px; }
  /* 手机图文卡 */
  .soft-card.has-cover { padding: 0 0 9px; }
  .soft-card.has-cover .card-body { padding: 3px 9px 0; }
  .soft-card.has-cover h3 { font-size: 12.5px; }
  .soft-card.has-cover .card-desc { font-size: 10.5px; margin: 4px 0 8px; -webkit-line-clamp: 2; line-height: 1.5; }
  .dl-btn.dl-go { padding: 8px 6px; font-size: 12px; border-radius: 8px; gap: 5px; letter-spacing: .5px; }

  /* 表格：横向滚动 + 触控友好 */
  .table-scroll { -webkit-overflow-scrolling: touch; }
  table { min-width: 620px; }
  thead th { padding: 10px 12px; font-size: 12px; }
  tbody td { padding: 11px 12px; font-size: 13px; }
  td.col-name { min-width: 130px; }
  td.col-desc { min-width: 210px; }
  .dl-btn { padding: 8px 13px; font-size: 13px; }

  .pagination { gap: 5px; margin: 18px 0 32px; }
  .pagination button { min-width: 36px; height: 36px; }

  .back-top { right: 14px; bottom: 16px; }

  /* 观影页：工具条换行 */
  .watch-bar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
  .watch-actions { justify-content: flex-start; }
  .wa-btn { flex: 1; text-align: center; padding: 9px 10px; font-size: 13px; }
  /* 播放器铺满页面：不再固定 16:9，高度撑满首屏剩余空间（网址栏已删，预留更少） */
  .watch-frame-wrap {
    aspect-ratio: auto;
    height: calc(100vh - 196px);
    height: calc(100dvh - 196px);
    min-height: 360px;
  }
  .watch-title strong { font-size: 14.5px; }
  .watch-hint { font-size: 12px; }

  /* 书签栏手机端：紧凑一档，横向滑动 */
  .watch-bookbar { margin-top: 10px; border-radius: 9px; }
  .wb-scroll { gap: 2px; padding: 4px 6px; }
  .wb-tab { font-size: 12px; padding: 6px 10px; }
  .wb-site { font-size: 11.5px; padding: 5px 8px; }

  /* 弹窗改为底部弹层，按钮撑满一行便于点按 */
  /* 弹窗：手机端也居中显示（不再贴底），宽度留边距、内部可滚动 */
  .modal { padding: 16px; align-items: center; }
  .modal-card {
    width: min(460px, 100%);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    padding: 16px 14px;
    border-radius: 14px;
  }
  .modal-card h3 { font-size: 15px; }
  .modal-meta { margin-bottom: 10px; }
  .modal-head .drive-open { padding: 6px 10px; font-size: 12px; }
  .drive-list { gap: 6px; }
  .drive-row { padding: 8px 10px; gap: 6px; }
  .drive-name { font-size: 12.5px; }
  .drive-actions > * { padding: 8px 6px; }
  .toast { bottom: 20px; max-width: calc(100% - 32px); }
}

/* 小屏手机 */
@media (max-width: 480px) {
  .container, .topbar-inner { padding-left: 10px; padding-right: 10px; }
  .tabs { padding: 2px; gap: 2px; }
  .tab { padding: 4px 8px; font-size: 11.5px; }
  /* 小屏顶栏空间紧张：导航按钮只留图标 */
  .nav-toggle { padding: 6px 8px; gap: 0; }
  .nav-toggle span { display: none; }
  .watch-cover .wc-icon { width: 46px; height: 46px; font-size: 17px; }
  .watch-cover p { font-size: 12px; }
  /* 小屏书签栏再紧凑一档 */
  .wb-tab { font-size: 11.5px; padding: 5px 9px; }
  .wb-site { font-size: 11px; padding: 4px 7px; }
  /* 全屏悬浮按钮小屏紧凑 */
  .fs-fbtn { font-size: 12px; padding: 7px 11px; }
  body.fs-lock .wb-scroll { padding-right: 96px; }
  .card-grid { gap: 8px; }
  .soft-card { padding: 11px 10px 10px; }
  .soft-card .card-foot { flex-wrap: wrap; }
  .sel { flex: 1 1 110px; }
  .sel select { flex: 1 1 auto; min-width: 0; }
  .footer { padding: 18px 0 24px; }
}

/* ---------------- 影视盒子（TVBox 接口 / 直播源） ---------------- */
.box-section {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.box-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  min-width: 0;
}
.box-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.box-sub { font-size: 12px; font-weight: 400; color: var(--text-3); }
.box-list { display: grid; gap: 4px; min-width: 0; }
.box-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 9px;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.box-item:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.box-name {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 4.5em;
}
.box-url {
  flex: 1 1 0;
  min-width: 0;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2, var(--text));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: all;
}
.box-copy { flex: 0 0 auto; padding: 3px 11px; font-size: 12px; }
.box-usage {
  margin: 0 0 10px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 8px;
  font-size: 13px;
  color: var(--text-2, var(--text));
}
.box-usage summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
  user-select: none;
}
.box-usage ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.box-usage li { line-height: 1.6; }
.box-extra { margin: 8px 0 0; line-height: 1.6; color: var(--text-3); }
@media (max-width: 720px) {
  .box-card { padding: 12px; }
  .box-item { flex-wrap: wrap; gap: 4px 6px; padding: 4px 8px; }
  .box-url { flex: 1 1 100%; order: 3; white-space: normal; word-break: break-all; font-size: 11px; line-height: 1.35; }
  .box-name { min-width: 0; }
  .box-copy { margin-left: auto; }
}
