/* =========================================================
   Pulsedeck · 样式表
   0. 变量与基础     1. 顶栏      2. 通用卡片元素
   3. 六种布局       4. 抽屉/弹窗  5. 响应式断点
   ========================================================= */

/* ------------------------- 0. 变量与基础 ------------------------- */

:root {
  --bg: #f4f6f9;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, #e8eefc 0%, transparent 60%);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e3e8ef;
  --border-soft: #edf1f6;
  --text: #10151f;
  --text-2: #3b455a;
  --muted: #6b7688;
  --faint: #97a1b2;
  --accent: #2563eb;
  --accent-2: #7c3aed;
  --accent-soft: #e8efff;
  --warn: #b45309;
  --warn-soft: #fef6e7;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, .07);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, .16);
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --topbar-h: 116px;
  --maxw: 1680px;
  --gap: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Georgia", "Songti SC", "Noto Serif SC", "Times New Roman", serif;
}

[data-theme="dark"] {
  --bg: #0a0d13;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, #16213a 0%, transparent 60%);
  --surface: #131822;
  --surface-2: #171d29;
  --surface-3: #1e2532;
  --border: #262e3d;
  --border-soft: #1f2733;
  --text: #e8ebf2;
  --text-2: #c2c9d6;
  --muted: #8e98a9;
  --faint: #6b7486;
  --accent: #6ea3ff;
  --accent-2: #a78bfa;
  --accent-soft: #1b2740;
  --warn: #fbbf24;
  --warn-soft: #2a2313;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 56px rgba(0, 0, 0, .55);
}

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

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

::selection { background: var(--accent); color: #fff; }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ------------------------- 1. 顶栏 ------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-sm);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; letter-spacing: -.3px; }
.brand-text em { font-style: normal; font-size: 11px; color: var(--muted); }

.search {
  flex: 1;
  max-width: 560px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute; left: 12px;
  width: 17px; height: 17px; color: var(--faint);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 9px 34px 9px 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  outline: none;
  font-size: 13.5px;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.search-clear {
  position: absolute; right: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  color: var(--muted); font-size: 12px;
  display: grid; place-items: center;
}
.search-clear:hover { background: var(--surface-3); }

.actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--text-2);
  transition: background .15s, color .15s, transform .15s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.i-moon { display: none; }
[data-theme="dark"] .i-sun { display: none; }
[data-theme="dark"] .i-moon { display: block; }

.select-wrap { position: relative; }
.select-wrap select {
  appearance: none;
  padding: 7px 26px 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
}
.select-wrap::after {
  content: "";
  position: absolute; right: 10px; top: 50%;
  width: 6px; height: 6px;
  border-right: 1.6px solid var(--faint);
  border-bottom: 1.6px solid var(--faint);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* 分类 + 布局条 */
.subbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px 10px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.cats {
  display: flex; gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  padding-bottom: 2px;
}
.cats::-webkit-scrollbar { display: none; }

.cat {
  flex-shrink: 0;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all .15s;
}
.cat:hover { background: var(--surface-3); color: var(--text); }
.cat.on {
  background: var(--text);
  color: var(--surface);
  font-weight: 600;
}
.cat .n { opacity: .55; font-size: 11.5px; margin-left: 4px; }

.layouts {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-3);
  border-radius: 11px;
  flex-shrink: 0;
}
.lay-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--muted);
  transition: all .15s;
  white-space: nowrap;
}
.lay-btn svg { width: 15px; height: 15px; }
.lay-btn:hover { color: var(--text); }
.lay-btn.on {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* 提示条 */
.notice {
  max-width: var(--maxw);
  margin: 14px auto 0;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12.5px;
  line-height: 1.6;
  border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
  width: calc(100% - 44px);
}

/* ------------------------- 2. 舞台与通用元素 ------------------------- */

.stage {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 22px 60px;
  min-height: 60vh;
}
/* 刷新完成时的短暂闪动反馈 */
.stage-flash { animation: flash-in 0.6s ease-out; }
@keyframes flash-in {
  0%   { opacity: .35; transform: translateY(4px); }
  100% { opacity: 1;   transform: translateY(0); }
}

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--muted);
  white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.src-dot {
  width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent);
}

.star-btn {
  color: var(--faint);
  width: 26px; height: 26px;
  border-radius: 7px;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: all .15s;
}
.star-btn svg { width: 15px; height: 15px; }
.star-btn:hover { background: var(--surface-3); color: var(--warn); }
.star-btn.on { color: #f59e0b; }
.star-btn.on svg { fill: currentColor; }

/* 单条「翻译」按钮 + 顶栏双语开关高亮 */
.tr-btn {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  flex-shrink: 0;
  transition: all .15s;
}
.tr-btn:hover { background: var(--surface-3); color: var(--accent); border-color: var(--accent); }
.tr-btn.on { color: #fff; background: var(--accent); border-color: var(--accent); }
#trBtn.on { color: var(--accent); }

.is-read .ttl { color: var(--muted) !important; }
.is-read .thumb { opacity: .55; }

/* 键盘 J/K 选中态 */
.cursor {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r);
}

.meta {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px;
  color: var(--faint);
  flex-wrap: wrap;
}
.meta .src { color: var(--accent); font-weight: 600; }
.meta .sep { opacity: .4; }

.thumb {
  background: var(--surface-3);
  object-fit: cover;
  display: block;
  transition: opacity .3s, transform .4s;
}

/* 骨架屏 */
.skeleton {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--gap);
}
.sk {
  height: 268px;
  border-radius: var(--r);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-3) 50%, var(--surface) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
}
@keyframes shimmer { to { background-position: -220% 0; } }
.sk-msg {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13.5px;
  padding: 4px 2px 8px;
}

/* 启动兜底 + 致命错误 */
.boot-fallback {
  text-align: center;
  padding: 110px 20px;
  color: var(--muted);
}
.boot-fallback p { margin: 14px 0 4px; font-size: 15px; }
.boot-fallback small { color: var(--faint); font-size: 12px; }
.boot-fallback code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; color: var(--accent); }

.fatal { text-align: center; padding: 100px 20px; color: var(--muted); }
.fatal .big { font-size: 42px; margin-bottom: 12px; }
.fatal .fmsg { color: var(--fg); margin: 0 auto 18px; max-width: 520px; font-size: 14px; line-height: 1.6; word-break: break-word; }

.spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 2.5px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.boot-fallback .spinner { width: 34px; height: 34px; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  text-align: center;
  padding: 90px 20px;
  color: var(--muted);
}
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .5; }

/* ------------------------- 3.1 布局：卡片流 ------------------------- */

.lay-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: var(--gap);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .18s cubic-bezier(.2,.8,.3,1), box-shadow .18s, border-color .18s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
}
/* 没有真实图片的卡片：左侧色条 + 纯文字，更紧凑 */
.card:not(:has(.thumb)) {
  border-left: 3.5px solid var(--accent);
}
.card:not(:has(.thumb)) .card-body {
  padding: 16px 18px 14px;
}
.card .thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.card:hover .thumb { transform: scale(1.03); }
.card-body { padding: 14px 16px 13px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .ttl {
  font-size: 15.5px;
  font-weight: 650;
  line-height: 1.42;
  letter-spacing: -.2px;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}
.card .ttl:hover { color: var(--accent); }
.card .sum {
  font-size: 12.8px;
  line-height: 1.62;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
}
.card .sum .tag-zh { vertical-align: 1px; }
.card-foot {
  margin-top: auto;
  padding-top: 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.compact .card .sum { -webkit-line-clamp: 2; }
.compact .card-body { padding: 11px 13px 10px; gap: 6px; }
.compact .lay-cards { gap: 12px; }

/* ------------------------- 3.2 布局：紧凑列表 ------------------------- */

.lay-list {
  max-width: 880px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.row {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  transition: background .14s;
  align-items: flex-start;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--surface-2); }
.row-idx {
  width: 22px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  padding-top: 3px;
  text-align: right;
}
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.row .ttl {
  font-size: 14.8px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0;
  cursor: pointer;
}
.row .ttl:hover { color: var(--accent); }
.row .sum {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row .thumb {
  width: 104px; height: 68px;
  border-radius: 9px;
  flex-shrink: 0;
}
.compact .row { padding: 9px 14px; }
.compact .row .sum { display: none; }
.compact .row .thumb { width: 62px; height: 40px; }

/* ------------------------- 3.3 布局：杂志头条 ------------------------- */

.lay-mag { display: flex; flex-direction: column; gap: 26px; }

.mag-top {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: var(--gap);
}
.mag-hero {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  min-height: 420px;
  background: var(--surface-3);
  display: flex;
  align-items: flex-end;
  border: 1px solid var(--border);
}
/* 杂志头条没有真实图片时：用渐变色背景代替占位图 */
.mag-hero:not(:has(.thumb)) {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 40%, #7c3aed 100%);
}
.mag-hero .thumb {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.mag-hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(6,10,20,.05) 30%, rgba(6,10,20,.82) 100%);
}
.mag-hero-body {
  position: relative;
  z-index: 1;
  padding: 26px 28px;
  color: #fff;
  width: 100%;
}
.mag-hero .ttl {
  font-family: var(--font-serif);
  font-size: clamp(23px, 2.4vw, 34px);
  line-height: 1.28;
  margin: 8px 0 10px;
  font-weight: 700;
  cursor: pointer;
  text-shadow: 0 2px 14px rgba(0,0,0,.35);
}
.mag-hero .sum {
  font-size: 13.5px;
  line-height: 1.65;
  color: rgba(255,255,255,.86);
  max-width: 62ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mag-hero .meta { color: rgba(255,255,255,.78); margin-top: 12px; }
.mag-hero .meta .src { color: #fff; }
.mag-hero .badge { background: rgba(255,255,255,.18); color: #fff; backdrop-filter: blur(6px); }

.mag-side { display: grid; grid-template-rows: repeat(3, 1fr); gap: 12px; }
.mag-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 15px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: border-color .16s, transform .16s;
}
.mag-item:hover { border-color: color-mix(in srgb, var(--accent) 34%, var(--border)); transform: translateX(2px); }
.mag-item .thumb { width: 84px; height: 62px; border-radius: 8px; flex-shrink: 0; object-fit: cover; }
.mag-item .ttl {
  font-size: 14px; font-weight: 620; line-height: 1.45; margin: 0 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  cursor: pointer;
}
.mag-item .ttl:hover { color: var(--accent); }

.mag-rest-head {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--faint);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.mag-rest-head::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.mag-rest {
  columns: 3;
  column-gap: 30px;
}
.mag-brief {
  break-inside: avoid;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border);
}
.mag-brief .ttl {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.5;
  margin: 0 0 5px;
  font-weight: 600;
  cursor: pointer;
}
.mag-brief .ttl:hover { color: var(--accent); }

/* ------------------------- 3.4 布局：多栏看板 ------------------------- */

.lay-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 14px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x proximity;
}
.board-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--topbar-h) - 90px);
  scroll-snap-align: start;
}
.board-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  position: sticky; top: 0;
  background: var(--surface);
  border-radius: var(--r) var(--r) 0 0;
  z-index: 1;
}
.board-head h3 { margin: 0; font-size: 13.5px; font-weight: 650; }
.board-head .n {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface-3);
  padding: 1px 7px;
  border-radius: 999px;
}
.board-list { overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.mini {
  padding: 9px 10px;
  border-radius: 9px;
  transition: background .14s;
  display: flex; flex-direction: column; gap: 5px;
}
.mini:hover { background: var(--surface-2); }
.mini .ttl {
  font-size: 13.4px; line-height: 1.46; margin: 0; font-weight: 550;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  cursor: pointer;
}
.mini .ttl:hover { color: var(--accent); }

/* ------------------------- 3.5 布局：时间轴 ------------------------- */

.lay-time { max-width: 940px; margin: 0 auto; }
.time-group { margin-bottom: 28px; }
.time-label {
  position: sticky;
  top: calc(var(--topbar-h) + 6px);
  z-index: 5;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.time-list {
  position: relative;
  padding-left: 26px;
  border-left: 2px solid var(--border);
  margin-left: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.tl {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 16px;
  display: flex; gap: 14px; align-items: flex-start;
  transition: border-color .16s, transform .16s;
}
.tl:hover { border-color: color-mix(in srgb, var(--accent) 34%, var(--border)); transform: translateX(3px); }
.tl::before {
  content: "";
  position: absolute;
  left: -33px; top: 20px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
}
.tl-time {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  width: 40px;
  padding-top: 2px;
}
.tl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tl .ttl { font-size: 14.6px; font-weight: 620; line-height: 1.45; margin: 0; cursor: pointer; }
.tl .ttl:hover { color: var(--accent); }
.tl .sum {
  font-size: 12.5px; color: var(--muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tl .thumb { width: 92px; height: 62px; border-radius: 8px; flex-shrink: 0; }

/* ------------------------- 3.6 布局：双栏阅读器 ------------------------- */

.lay-reader {
  display: grid;
  grid-template-columns: 366px 1fr;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 74px);
  min-height: 520px;
}
.reader-index {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.idx {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .14s, border-color .14s;
  display: flex; flex-direction: column; gap: 5px;
}
.idx:hover { background: var(--surface-2); }
.idx.on {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.idx .ttl {
  font-size: 13.8px; font-weight: 600; line-height: 1.45; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.reader-pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow-y: auto;
  padding: 0;
}
.reader-inner { padding: 34px 46px 60px; max-width: 760px; margin: 0 auto; }
.reader-inner .kicker {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; color: var(--muted); margin-bottom: 14px;
}
.reader-inner h1 {
  font-family: var(--font-serif);
  font-size: clamp(24px, 2.6vw, 33px);
  line-height: 1.32;
  margin: 0 0 16px;
  letter-spacing: -.4px;
}
.reader-hero {
  width: 100%;
  border-radius: var(--r);
  margin-bottom: 20px;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--surface-3);
}
.reader-inner .body {
  font-size: 15.4px;
  line-height: 1.86;
  color: var(--text-2);
  white-space: pre-wrap;
}
.reader-actions { margin-top: 26px; display: flex; gap: 10px; flex-wrap: wrap; }
.reader-empty {
  height: 100%;
  display: grid; place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 40px;
}

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 17px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  transition: all .15s;
}
.btn:hover { background: var(--surface-3); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { filter: brightness(1.08); }

/* ------------------------- 4. 抽屉 / 弹窗 / Toast ------------------------- */

.scrim {
  position: fixed; inset: 0;
  background: rgba(8, 12, 20, .48);
  backdrop-filter: blur(3px);
  z-index: 60;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }

.panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 392px; max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 70;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideIn .24s cubic-bezier(.2,.8,.3,1);
}
@keyframes slideIn { from { transform: translateX(100%); } }

.panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-head h2 { margin: 0; font-size: 15.5px; }
.panel-body { overflow-y: auto; padding: 18px; flex: 1; }
.panel-sec { margin-bottom: 26px; }
.panel-sec h3 {
  margin: 0 0 11px;
  font-size: 11.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--faint);
}
.sec-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.sec-head h3 { margin: 0; }
.sec-actions { margin-left: auto; display: flex; gap: 5px; }
.mini-btn {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--muted);
}
.mini-btn:hover { color: var(--text); }

.switch {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--text-2);
}
.switch input {
  appearance: none;
  width: 36px; height: 21px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  position: relative;
  transition: background .18s;
  flex-shrink: 0;
  cursor: pointer;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .18s cubic-bezier(.3,.9,.4,1);
}
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(15px); }

.text-input {
  width: 100%;
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
  outline: none;
}
.text-input:focus { border-color: var(--accent); }
.hint { font-size: 11.5px; color: var(--faint); margin: 7px 0 0; line-height: 1.5; }

.src-list { display: flex; flex-direction: column; gap: 1px; }
.src-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px;
  border-radius: 9px;
  font-size: 13px;
  cursor: pointer;
  transition: background .14s;
}
.src-item:hover { background: var(--surface-2); }
.src-item input {
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 5px;
  border: 1.6px solid var(--border);
  background: var(--surface);
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}
.src-item input:checked { background: var(--accent); border-color: var(--accent); }
.src-item input:checked::after {
  content: "";
  position: absolute; left: 4.6px; top: 1.6px;
  width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(43deg);
}
.src-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-stat { font-size: 11px; color: var(--faint); }
.src-stat.bad { color: #ef4444; }

.keys { list-style: none; padding: 0; margin: 0; font-size: 12.5px; color: var(--muted); line-height: 2.1; }
kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--text-2);
}
.panel-foot { font-size: 11.5px; color: var(--faint); line-height: 1.7; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0;
  z-index: 80;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(8, 12, 20, .5);
  backdrop-filter: blur(4px);
  animation: fade .18s ease;
}
.modal-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: min(760px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: pop .22s cubic-bezier(.2,.9,.3,1);
}
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.modal-hero { width: 100%; aspect-ratio: 16/8; object-fit: cover; background: var(--surface-3); }
.modal-body { padding: 26px 30px 30px; }
.modal-body h2 {
  font-family: var(--font-serif);
  font-size: clamp(20px, 2.3vw, 27px);
  line-height: 1.35;
  margin: 12px 0 14px;
}
.modal-body .body { font-size: 14.8px; line-height: 1.85; color: var(--text-2); }
.modal-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.modal-actions { margin-top: 24px; display: flex; gap: 10px; flex-wrap: wrap; }

.toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--surface);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 90;
  box-shadow: var(--shadow-md);
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { transform: translate(-50%, 12px); opacity: 0; } }

/* 底栏 */
.foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 22px 40px;
  font-size: 12px;
  color: var(--faint);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border-top: 1px solid var(--border);
}
.foot a { color: var(--accent); }
.foot .dot { opacity: .5; }

/* 移动端底部布局条 */
.mobile-bar { display: none; }

/* ------------------------- 5. 响应式 ------------------------- */

/* 超宽屏：卡片流更密、看板更多列 */
@media (min-width: 1800px) {
  .lay-cards { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
}

/* 中等桌面 */
@media (max-width: 1280px) {
  .mag-rest { columns: 2; }
  .lay-reader { grid-template-columns: 320px 1fr; }
  .reader-inner { padding: 28px 32px 50px; }
}

/* 平板横屏 / 小笔记本 */
@media (max-width: 1080px) {
  :root { --topbar-h: 112px; }
  .mag-top { grid-template-columns: 1fr; }
  .mag-hero { min-height: 320px; }
  .mag-side { grid-template-rows: none; grid-template-columns: repeat(3, 1fr); }
  .mag-item { flex-direction: column; }
  .mag-item .thumb { width: 100%; height: 108px; }
  .lay-reader {
    grid-template-columns: 1fr;
    height: auto;
  }
  .reader-index { max-height: 300px; }
  .reader-pane { min-height: 460px; }
}

/* 平板竖屏 */
@media (max-width: 900px) {
  .topbar-inner { padding: 10px 16px; flex-wrap: wrap; }
  .subbar { padding: 0 16px 9px; flex-direction: column; align-items: stretch; gap: 9px; }
  .layouts { overflow-x: auto; scrollbar-width: none; }
  .layouts::-webkit-scrollbar { display: none; }
  .stage { padding: 16px 16px 40px; }
  .notice { width: calc(100% - 32px); }
  .foot { padding: 20px 16px 34px; }
  .lay-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .mag-side { grid-template-columns: repeat(2, 1fr); }
  .lay-board { grid-auto-columns: minmax(260px, 78vw); }
  .board-col { max-height: 70vh; }
}

/* 手机 */
@media (max-width: 720px) {
  :root { --gap: 12px; --topbar-h: 104px; }

  .topbar-inner { gap: 10px; padding: 9px 13px; }
  .brand-text em { display: none; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .actions { margin-left: auto; }
  .select-wrap select { padding: 6px 22px 6px 9px; font-size: 12px; max-width: 96px; }
  .subbar { padding: 0 13px 8px; }
  .layouts { display: none; }         /* 手机改用底部条 */
  .cats { gap: 5px; }
  .cat { padding: 5px 11px; font-size: 12.5px; }

  .stage { padding: 13px 13px 88px; }
  .foot { padding: 16px 13px 92px; font-size: 11.5px; }
  .notice { width: calc(100% - 26px); margin-top: 11px; font-size: 12px; }

  /* 卡片流 → 单列 */
  .lay-cards { grid-template-columns: 1fr; }
  .card .thumb { aspect-ratio: 2 / 1; }

  /* 列表 → 图右侧小图 */
  .lay-list { border-radius: var(--r); }
  .row { padding: 12px 13px; gap: 11px; }
  .row-idx { display: none; }
  .row .thumb { width: 82px; height: 58px; }
  .row .sum { -webkit-line-clamp: 2; font-size: 12px; }

  /* 杂志 → 头条 + 单列 */
  .mag-hero { min-height: 260px; }
  .mag-hero-body { padding: 18px 18px 20px; }
  .mag-side { grid-template-columns: 1fr; }
  .mag-item { flex-direction: row; }
  .mag-item .thumb { width: 78px; height: 58px; }
  .mag-rest { columns: 1; }

  /* 看板 → 横向滑动，一屏一列 */
  .lay-board { grid-auto-columns: 86vw; gap: 11px; scroll-snap-type: x mandatory; }
  .board-col { max-height: 74vh; }

  /* 时间轴 */
  .time-list { padding-left: 18px; margin-left: 8px; }
  .tl { padding: 11px 13px; gap: 11px; }
  .tl::before { left: -25px; top: 17px; width: 9px; height: 9px; }
  .tl-time { width: 34px; font-size: 11px; }
  .tl .thumb { width: 74px; height: 52px; }
  .time-label { top: calc(var(--topbar-h) + 4px); font-size: 11.5px; }

  /* 阅读器 → 索引在上、详情弹出 */
  .lay-reader { grid-template-columns: 1fr; height: auto; gap: 12px; }
  .reader-index { max-height: none; }
  .reader-pane { display: none; }
  .reader-pane.mobile-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 75;
    border-radius: 0;
    border: none;
  }
  .reader-inner { padding: 20px 18px 80px; }

  /* 弹窗改成底部抽屉 */
  .modal { padding: 0; align-items: flex-end; }
  .modal-card {
    max-height: 90vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    animation: sheetUp .26s cubic-bezier(.2,.9,.3,1);
  }
  @keyframes sheetUp { from { transform: translateY(100%); } }
  .modal-body { padding: 20px 18px 34px; }

  .panel { width: 100%; max-width: none; border-left: none; }

  /* 底部布局条 */
  .mobile-bar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    overflow-x: auto;
    scrollbar-width: none;
  }
  .mobile-bar::-webkit-scrollbar { display: none; }
  .mb-btn {
    flex: 1 0 auto;
    min-width: 62px;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 4px;
    border-radius: 10px;
    font-size: 10.5px;
    color: var(--muted);
    transition: color .14s, background .14s;
  }
  .mb-btn svg { width: 19px; height: 19px; }
  .mb-btn.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
}

/* 超小屏 */
@media (max-width: 380px) {
  .brand-text strong { font-size: 15px; }
  .select-wrap { display: none; }
}

/* 尊重「减少动态效果」 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 打印 */
@media print {
  .topbar, .mobile-bar, .foot, .panel, .scrim, .modal { display: none !important; }
  .stage { padding: 0; }
  .card, .row, .tl { break-inside: avoid; border-color: #ddd; }
}

/* ------------------------- 中文译文（自动双语） ------------------------- */
.zh { display: block; }
.zh::before {
  content: "译";
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  font-size: .68em;
  font-weight: 700;
  letter-spacing: .5px;
  color: #fff;
  background: var(--accent);
  border-radius: 5px;
  vertical-align: middle;
  line-height: 1.6;
}
.ttl-zh {
  display: block;
  margin-top: 6px;
  font-size: .8em;
  font-weight: 600;
  line-height: 1.5;
  color: var(--accent);
}
.sum-zh {
  display: block;
  margin-top: 6px;
  font-size: .94em;
  line-height: 1.65;
  color: var(--text-2);
}
.body-zh {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 14.8px;
  line-height: 1.9;
  color: var(--text-2);
}

/* 卡片摘要里的小标签：译 / 原文 / 汇 / 汇总 */
.tag-zh {
  display: inline-block;
  margin-left: 2px;
  padding: 0 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  vertical-align: 1px;
  line-height: 1.7;
}
.tag-zh.en {
  color: var(--muted);
  background: var(--surface-3);
  border-color: var(--border);
}

/* 阅读器顶部的「汇总」块 */
.body-digest {
  margin: 4px 0 18px;
  padding: 14px 16px;
  border-radius: var(--r);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  font-size: 15px;
  line-height: 1.85;
  color: var(--text);
}
.body-digest .tag-zh {
  margin-right: 8px;
  font-size: 11px;
  vertical-align: 2px;
}
/* 标题里译文比正文小，避免喧宾夺主 */
