/* ==========================================================================
   小屋 · 全站设计系统
   浅绿（默认）/ 浅黄（可切换）两套护眼配色；零外部字体、零框架。
   页面结构：header → main → footer；组件按「导航 / 首页 / 列表页 / 内容页」排列。
   ========================================================================== */

/* ---------- 1. 配色与变量 ---------- */
:root {
  color-scheme: light;

  /* 浅绿：纸感米绿，不刺眼 */
  --bg: #f2f7ef;
  --bg-deep: #e7f0e2;
  --surface: #fbfdf9;
  --surface-2: #ffffff;
  --surface-3: #f5faf2;
  --ink: #1e2d25;
  --ink-soft: #33463b;
  --muted: #65776b;
  --faint: #8b9a8f;
  --line: #dbe7d6;
  --line-strong: #c3d5bc;
  --acc: #2f7d5a;
  --acc-2: #2f9e63;
  --acc-soft: #e1f0e2;
  --acc-softer: #eef7ec;
  --gold: #a9822f;
  --danger: #b4483c;
  --shadow: 0 1px 2px rgba(30, 45, 37, .04), 0 14px 34px rgba(47, 90, 62, .07);
  --shadow-lift: 0 2px 4px rgba(30, 45, 37, .05), 0 22px 46px rgba(47, 90, 62, .11);
  --ring: rgba(47, 125, 90, .25);
  --glow: rgba(129, 190, 140, .18);
  --glow-2: rgba(233, 205, 126, .14);

  --font-sans: "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC", "Noto Sans CJK SC",
    "Microsoft YaHei", "WenQuanYi Zen Hei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --wrap: 1120px;
  --gutter: 22px;
  --header-h: 64px;

  /* 供 auth.js 复用（旧页面没有这些变量时 auth.js 走 fallback） */
  --site-acc: var(--acc);
  --site-line: var(--line);
  --site-muted: var(--muted);
  --site-surface: var(--surface-2);
  --site-soft: var(--acc-soft);
  --site-ink: var(--ink);
}

/* 浅黄：旧书页 / 日光纸 */
:root[data-palette="cream"] {
  --bg: #faf6e9;
  --bg-deep: #f3ecd7;
  --surface: #fffdf5;
  --surface-2: #fffef9;
  --surface-3: #fbf6e6;
  --ink: #332d1f;
  --ink-soft: #4a422f;
  --muted: #7c7159;
  --faint: #9a8f75;
  --line: #e8dfc6;
  --line-strong: #d8caa8;
  --acc: #8a6a22;
  --acc-2: #a5812f;
  --acc-soft: #f3ead2;
  --acc-softer: #faf4e4;
  --gold: #9a7626;
  --danger: #b4483c;
  --shadow: 0 1px 2px rgba(51, 45, 31, .04), 0 14px 34px rgba(103, 83, 40, .08);
  --shadow-lift: 0 2px 4px rgba(51, 45, 31, .05), 0 22px 46px rgba(103, 83, 40, .12);
  --ring: rgba(138, 106, 34, .25);
  --glow: rgba(231, 201, 128, .20);
  --glow-2: rgba(160, 190, 140, .14);
}

/* ---------- 2. 基础 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  background:
    radial-gradient(1100px 560px at 88% -8%, var(--glow), transparent 62%),
    radial-gradient(820px 520px at -12% 6%, var(--glow-2), transparent 58%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -.022em; font-weight: 800; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
::selection { background: var(--acc-soft); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
  border-radius: 5px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: fixed; top: 10px; left: 12px; z-index: 200;
  transform: translateY(-160%);
  background: var(--ink); color: var(--bg);
  padding: 9px 14px; border-radius: 9px; font-size: 13px;
  transition: transform .18s ease;
}
.skip:focus { transform: translateY(0); }

.hidden { display: none !important; }
.mt-24 { margin-top: 24px; }

h1, h2, h3 { text-wrap: balance; }
.grid-note, .lib-note, .news-item p, .panel > p { text-wrap: pretty; }

/* 等宽小标签 */
.eyebrow {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-mono);
  font-size: 11px; line-height: 1.4;
  letter-spacing: .15em; text-transform: uppercase;
  color: var(--muted);
}
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--acc); box-shadow: 0 0 0 4px var(--acc-soft);
  flex: none;
}

/* ---------- 3. 顶栏 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand nav tools";
  align-items: center;
  gap: 18px;
  min-height: var(--header-h);
}

.brand {
  grid-area: brand;
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; letter-spacing: -.03em; font-size: 17px;
  min-width: 0;
}
.brand-mark {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--ink); color: var(--bg);
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-word { white-space: nowrap; }
.brand-sub {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .12em; color: var(--muted); text-transform: uppercase;
  margin-left: 1px;
}

.site-nav {
  grid-area: nav;
  display: flex; align-items: center; justify-content: center;
  gap: 2px;
  min-width: 0;
}
.site-nav a {
  flex: none;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13.5px; font-weight: 650; color: var(--muted);
  transition: color .16s ease, background .16s ease;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); background: var(--acc-softer); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--acc-soft); }

.header-tools {
  grid-area: tools;
  display: flex; align-items: center; justify-content: flex-end; gap: 9px;
  min-width: 0;
}

.palette-toggle {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px; flex: none;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface);
  transition: border-color .16s ease;
}
.palette-toggle:hover { border-color: var(--line-strong); }
.palette-toggle .sw {
  width: 19px; height: 19px; border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .06);
  transition: box-shadow .18s ease, transform .18s ease;
}
.sw-green { background: #dcefe0; }
.sw-cream { background: #f6e9c8; }
:root[data-palette="green"] .sw-green { box-shadow: 0 0 0 2px var(--acc); }
:root[data-palette="cream"] .sw-cream { box-shadow: 0 0 0 2px var(--acc); }

/* auth.js 注入的胶囊：嵌入顶栏 + 跟随主题 */
.site-header .dauth-chip { position: static; z-index: auto; gap: 6px; }
.site-header .dauth-chip .b,
.site-header .dauth-chip .ghost {
  padding: 6px 12px; font-size: 12.5px; border-radius: 9px;
}
.site-header .dauth-chip .b {
  background: var(--site-acc, var(--acc)); color: #fff;
}
.site-header .dauth-chip .b:hover { filter: brightness(1.06); }
.site-header .dauth-chip .ghost {
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line);
}
.site-header .dauth-chip .nm {
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  padding: 5px 10px; font-size: 12.5px; border-radius: 999px;
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 4. 首页 · hero ---------- */
.hero {
  padding-top: clamp(22px, 4.5vw, 48px);
  padding-bottom: clamp(26px, 5vw, 54px);
}
.hero-figure { margin: 0; }
.hero-figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 9px;
  min-height: 46px; padding: 0 19px;
  border: 1px solid transparent; border-radius: 12px;
  font-size: 13.5px; font-weight: 700; line-height: 1;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--acc); color: #fff; box-shadow: var(--shadow); }
.btn-ghost {
  background: var(--surface); color: var(--ink);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--acc-softer); border-color: var(--acc); }
.btn svg { width: 15px; height: 15px; }
.btn-sm { min-height: 36px; padding: 0 13px; font-size: 12.5px; border-radius: 9px; }

/* ---------- 5. 分区与标题 ---------- */
.section {
  padding-top: clamp(34px, 5.6vw, 62px);
  padding-bottom: clamp(34px, 5.6vw, 62px);
  border-top: 1px solid var(--line);
}
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(24px, 3.3vw, 34px);
  text-wrap: balance;
}
.section-note {
  max-width: 42ch;
  font-size: 13px; line-height: 1.75; color: var(--muted);
  text-align: right;
}

/* ---------- 6. 五个角落（bento） ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.tile {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 208px;
  padding: 21px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.tile:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.tile > * { position: relative; z-index: 1; }

.tile-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--faint);
}
.tile-top .tile-icon {
  width: 22px; height: 22px; color: var(--acc); opacity: .8;
}
.tile h3 {
  margin: 13px 0 7px;
  font-size: 25px;
  letter-spacing: -.035em;
}
.tile p {
  font-size: 13px; line-height: 1.75; color: var(--muted);
  max-width: 34em;
  text-wrap: pretty;
}
.tile-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  font-size: 12px; color: var(--muted);
}
.tile-foot .go {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 650; color: var(--ink);
}
.tile:hover .go { color: var(--acc); }
.tile-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 16px;
}
.tile-chips span {
  font-size: 10.5px; line-height: 1;
  padding: 6px 9px; border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
}
.tile-games .tile-chips span { background: color-mix(in srgb, var(--surface-2) 72%, transparent); }
/* ---------- 7. 游戏卡片 ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.game-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lift);
}
.cover {
  position: relative;
  display: grid; place-items: center;
  aspect-ratio: 16 / 9.6;
  background:
    radial-gradient(circle at 1px 1px, rgba(30, 45, 37, .10) 1px, transparent 0) 0 0 / 13px 13px,
    var(--tone-bg, var(--acc-soft));
  overflow: hidden;
  isolation: isolate;
}
.cover::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(255, 255, 255, .22));
  pointer-events: none;
}
.cover-face {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: relative; z-index: 1;
  transition: transform .28s cubic-bezier(.2, .7, .2, 1);
}
.game-card:hover .cover-face { transform: translateY(-5px) scale(1.05); }
.cover-glyph {
  font-size: 54px; line-height: 1; font-weight: 800;
  letter-spacing: -.05em;
  color: var(--tone-ink, var(--ink));
  opacity: .9;
}
.cover-code {
  font-family: var(--font-mono); font-size: 8.5px;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--tone-ink, var(--ink)); opacity: .55;
}
.cover-cat {
  position: absolute; top: 11px; left: 11px; z-index: 1;
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 78%, transparent);
  border: 1px solid rgba(30, 45, 37, .08);
  color: var(--ink-soft);
  backdrop-filter: blur(4px);
}
.cover-go {
  position: absolute; right: 11px; bottom: 11px; z-index: 1;
  width: 27px; height: 27px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink);
  font-size: 12px;
  opacity: 0; transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease;
}
.game-card:hover .cover-go { opacity: 1; transform: translateY(0); }
.game-body { padding: 15px 16px 17px; display: flex; flex-direction: column; flex: 1; }
.game-body h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.game-body p {
  margin: 6px 0 0;
  font-size: 12.5px; line-height: 1.7; color: var(--muted);
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-size: 10.5px; line-height: 1;
  padding: 5px 8px; border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
}

/* 卡片彩色底（低饱和，护眼） */
[data-tone="jade"]  { --tone-bg: #dcefe0; --tone-ink: #2f6349; }
[data-tone="sky"]   { --tone-bg: #dcebf1; --tone-ink: #2e5a6b; }
[data-tone="sand"]  { --tone-bg: #f3e9cf; --tone-ink: #74561f; }
[data-tone="rose"]  { --tone-bg: #f2e0dd; --tone-ink: #743d38; }
[data-tone="moss"]  { --tone-bg: #e5edd3; --tone-ink: #4c5f2a; }
[data-tone="plum"]  { --tone-bg: #e9e1ef; --tone-ink: #563a63; }
[data-tone="clay"]  { --tone-bg: #efe3d5; --tone-ink: #66462d; }
[data-tone="stone"] { --tone-bg: #e5e9e3; --tone-ink: #3d4a41; }

/* ---------- 8. 文库 / 资讯 双栏 ---------- */
.split {
  display: grid;
  grid-template-columns: 1.12fr .88fr;
  gap: 18px;
  align-items: start;
}
.panel {
  height: 100%;
  padding: 22px 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px;
}
.panel-head h2 { margin: 0; font-size: 21px; letter-spacing: -.03em; }
.panel-head a { font-size: 12px; color: var(--muted); white-space: nowrap; }
.panel-head a:hover { color: var(--acc); }
.panel > p { margin-top: 7px; font-size: 12.5px; color: var(--muted); }
/* 正文内链：明显的强调色 + 下划线，避免看起来像普通文字 */
.lede a, .grid-note a, .lib-note a, .panel > p a, .empty p a {
  color: var(--acc);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--acc) 42%, transparent);
}
.panel code, .page code {
  font-family: var(--font-mono); font-size: .88em;
  padding: 1px 5px; border-radius: 5px;
  background: var(--surface-3); border: 1px solid var(--line);
}
.lede a:hover, .grid-note a:hover, .lib-note a:hover, .panel > p a:hover,
.empty p a:hover {
  text-decoration-color: var(--acc);
}

.tips { list-style: none; margin-top: 10px; }
.tips li {
  display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 9px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 12.5px; line-height: 1.75; color: var(--muted);
}
.tips li:first-child { border-top: 0; padding-top: 2px; }
.tips .n {
  font-family: var(--font-mono); font-size: 10px; color: var(--acc);
  padding-top: 3px;
}

.lib-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 17px;
}
.lib-stat {
  display: block;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  transition: border-color .16s ease, background .16s ease;
}
.lib-stat:hover { border-color: var(--acc); background: var(--acc-softer); }
.lib-stat strong {
  display: block;
  font-family: var(--font-mono); font-size: 28px; font-weight: 600;
  line-height: 1; letter-spacing: -.03em;
}
.lib-stat span { display: block; margin-top: 7px; font-size: 11.5px; color: var(--muted); }
.panel-foot {
  margin-top: 16px; padding-top: 13px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--faint);
}

.news-mini { list-style: none; margin: 12px 0 0; }
.news-mini li {
  display: grid; grid-template-columns: 48px 1fr; gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.news-mini li:first-child { border-top: 0; padding-top: 2px; }
.news-mini time {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--faint);
  padding-top: 2px;
}
.news-mini a { font-size: 13px; line-height: 1.55; }
.news-mini a:hover { color: var(--acc); }
.news-mini .src { display: block; font-size: 10.5px; color: var(--faint); margin-top: 2px; }

/* ---------- 10. 页脚（只保留一句版权说明） ---------- */
.site-footer {
  flex: none;
  margin-top: clamp(30px, 5vw, 54px);
  padding: 22px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.footer-note { max-width: 50em; line-height: 1.75; text-wrap: pretty; }

/* ---------- 12. 内页通用 ---------- */
.page { padding-top: clamp(34px, 6vw, 64px); padding-bottom: 10px; }
.page-head { max-width: 820px; }
.page-head h1 {
  margin: 12px 0 0;
  font-size: clamp(36px, 6.4vw, 62px);
  letter-spacing: -.05em;
}
.page-head .lede {
  margin-top: 16px;
  max-width: 44em;
  font-size: 14.5px; line-height: 1.85; color: var(--muted);
  text-wrap: pretty;
}

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 7px;
  margin: 28px 0 22px;
  align-items: center;
}
.chip-btn {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 36px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font-size: 12.5px; font-weight: 600;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.chip-btn span { font-family: var(--font-mono); font-size: 10px; opacity: .72; }
.chip-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.chip-btn.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.grid-note {
  margin-top: 22px;
  font-size: 12px; color: var(--faint);
}

/* ---------- 13. 文库页 ---------- */
.lib-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin: 28px 0 18px;
}
.tabs {
  display: inline-flex; gap: 3px;
  padding: 3px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface);
}
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px; border-radius: 9px;
  font-size: 13px; font-weight: 650; color: var(--muted);
  transition: background .16s ease, color .16s ease;
}
.tab span {
  font-family: var(--font-mono); font-size: 10px; opacity: .7;
}
.tab:hover { color: var(--ink); }
.tab.is-on { background: var(--acc-soft); color: var(--ink); }

.search {
  display: flex; align-items: center; gap: 8px;
  min-width: min(300px, 100%);
  height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface);
}
.search svg { width: 15px; height: 15px; color: var(--faint); flex: none; }
.search input {
  width: 100%; border: 0; outline: 0; background: transparent;
  font-size: 13px;
}
.search input::placeholder { color: var(--faint); }

.lib-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.lib-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px; align-items: start;
  padding: 21px 2px;
  border-bottom: 1px solid var(--line);
}
.lib-item h3 { margin: 0 0 6px; font-size: 16.5px; line-height: 1.5; }
.lib-item h3 a:hover { color: var(--acc); }
.lib-meta { font-size: 12px; color: var(--muted); }
.lib-note { margin-top: 7px; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.lib-actions { display: flex; align-items: center; gap: 7px; padding-top: 2px; }
.lib-actions .btn { min-height: 34px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.lib-actions .btn-ghost { border-color: var(--line); background: var(--surface-2); }

.empty {
  padding: 46px 26px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  background:
    radial-gradient(420px 200px at 50% 0%, var(--acc-softer), transparent 75%),
    var(--surface);
}
.empty svg { width: 34px; height: 34px; margin: 0 auto 13px; color: var(--acc); opacity: .8; }
.empty h3 { margin: 0 0 7px; font-size: 16px; letter-spacing: -.02em; }
.empty p {
  max-width: 40em; margin: 0 auto;
  font-size: 12.5px; line-height: 1.85; color: var(--muted);
  text-wrap: pretty;
}
.empty .btn { margin-top: 17px; }

/* ---------- 14. 资讯页 ---------- */
.news-list { list-style: none; border-top: 1px solid var(--line); }
.news-item {
  display: grid; grid-template-columns: 62px minmax(0, 1fr);
  gap: 16px;
  padding: 21px 2px;
  border-bottom: 1px solid var(--line);
}
.news-item time {
  font-family: var(--font-mono); font-size: 11px; color: var(--faint);
  padding-top: 4px; letter-spacing: .02em;
}
.news-item h3 { margin: 5px 0 5px; font-size: 16px; line-height: 1.55; }
.news-item h3 a:hover { color: var(--acc); }
.news-item p { font-size: 12.5px; line-height: 1.75; color: var(--muted); }
.news-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 999px;
  background: var(--acc-soft); color: var(--acc);
}
.badge.ext { background: var(--surface-3); color: var(--muted); border: 1px solid var(--line); }
.news-src { font-size: 10.5px; color: var(--faint); }
/* 资讯操作 */
.news-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 9px; }
.news-star {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: 11px; line-height: 1.3; cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.news-star:hover { border-color: var(--acc); color: var(--acc); }
.news-star.on { background: var(--acc-soft); border-color: var(--acc); color: var(--acc); }
.news-star:disabled { opacity: .55; cursor: default; }
.badge.feat { background: var(--acc-soft); color: var(--acc); }
.badge.manual { background: #fdf6e3; color: #8a6a22; border: 1px solid #f0e2bd; }

/* 资讯查询工具条 + 分页 */
.news-toolbar {
  display: flex; gap: 8px; align-items: center;
  margin: 0 0 18px;
}
.news-toolbar input[type="search"] {
  min-height: 36px; padding: 0 13px; width: min(300px, 60vw);
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px;
}
.news-toolbar input[type="search"]:focus { outline: 2px solid var(--acc-soft); border-color: var(--acc); }
.news-pager {
  display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap;
  margin: 26px 0 6px;
}
.news-pager-info { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.news-pager .btn[disabled] { opacity: .45; cursor: default; }
.news-pages { display: inline-flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.news-page-btn {
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--muted);
  font-family: var(--font-mono); font-size: 12px; cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.news-page-btn:hover { border-color: var(--acc); color: var(--acc); }
.news-page-btn.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.news-page-dots { color: var(--faint); font-family: var(--font-mono); font-size: 12px; }
.news-page-jump {
  min-height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 12.5px;
}
.back-top {
  position: fixed; right: 18px; bottom: 84px; z-index: 200;
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-size: 17px; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .10);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s, border-color .16s ease, color .16s ease;
}
.back-top.show { opacity: 1; visibility: visible; transform: none; }
.back-top:hover { border-color: var(--acc); color: var(--acc); }

.site-toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 230;
  transform: translateX(-50%) translateY(8px);
  max-width: 80vw; padding: 9px 16px; border-radius: 999px;
  background: rgba(30, 45, 37, .94); color: #fff;
  font-size: 12.5px; text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.site-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 论文对照阅读 */
.paper-page { padding-top: clamp(26px, 4vw, 44px); padding-bottom: 20px; }
.paper-back {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 18px; font-size: 12.5px; color: var(--muted);
}
.paper-back:hover { color: var(--acc); }
.paper-head { max-width: 980px; }
.paper-head h1 {
  margin: 0;
  font-size: clamp(26px, 4.2vw, 42px);
  line-height: 1.28; letter-spacing: -.035em;
}
.paper-meta { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.paper-head .tags { margin-top: 10px; }
.paper-source { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.paper-toolbar {
  position: sticky; top: calc(var(--header-h) + 1px); z-index: 30;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  margin-top: 22px; padding: 10px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}
.seg {
  display: inline-flex; padding: 3px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface);
}
.seg button {
  border: 0; border-radius: 7px; padding: 6px 12px;
  background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 650;
}
.seg button.on { background: var(--acc-soft); color: var(--ink); }
.paper-note { font-size: 11px; color: var(--faint); text-align: right; }
.paper-body { border-top: 1px solid var(--line); }
.paper-pair {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 56px);
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}
.paper-col { min-width: 0; }
.paper-col .label {
  display: block; margin-bottom: 6px;
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--faint);
}
.paper-col p {
  margin: 0; font-size: 14.5px; line-height: 1.95;
  color: var(--ink); white-space: pre-wrap;
}
.paper-col.trans { padding-left: clamp(20px, 3vw, 38px); border-left: 1px solid var(--line); }
.paper-col.trans p { color: var(--ink-soft); }
.paper-body.view-original .paper-pair,
.paper-body.view-translation .paper-pair { grid-template-columns: 1fr; }
.paper-body.view-original .paper-trans,
.paper-body.view-translation .paper-orig { display: none; }
.paper-body.view-translation .paper-col.trans { border-left: 0; padding-left: 0; }
.paper-loading { padding: 40px 0; font-size: 13px; color: var(--muted); }

/* 电子书书架 */
.book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.book-grid .empty { grid-column: 1 / -1; }
.book-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.book-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.book-cover {
  position: relative; display: grid; place-items: center;
  aspect-ratio: 4 / 3;
  background:
    radial-gradient(circle at 1px 1px, rgba(30, 45, 37, .10) 1px, transparent 0) 0 0 / 13px 13px,
    var(--tone-bg, var(--acc-soft));
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-glyph {
  font-size: 48px; line-height: 1; font-weight: 800;
  color: var(--tone-ink, var(--ink)); opacity: .9;
}
.book-badge {
  position: absolute; top: 10px; left: 10px;
  padding: 3px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 82%, transparent);
  font-family: var(--font-mono); font-size: 9px; color: var(--ink-soft);
}
.book-body { display: flex; flex-direction: column; flex: 1; padding: 14px 15px 16px; }
.book-body h3 { margin: 0; font-size: 15px; line-height: 1.45; }
.book-meta { margin-top: 5px; font-size: 11.5px; color: var(--muted); }
.book-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.book-actions .btn { min-height: 30px; padding: 0 10px; font-size: 11.5px; border-radius: 7px; }

/* ---------- 15. 下载页 ---------- */
.gate {
  margin-top: 26px;
  padding: 54px 26px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  background:
    radial-gradient(480px 220px at 50% 0%, var(--acc-softer), transparent 78%),
    var(--surface);
}
.gate .lock {
  width: 52px; height: 52px; margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--acc-soft); color: var(--acc);
}
.gate .lock svg { width: 23px; height: 23px; }
.gate h2 { margin: 0 0 8px; font-size: 19px; }
.gate p {
  max-width: 50ch; margin: 0 auto;
  font-size: 12.5px; line-height: 1.85; color: var(--muted);
}
.gate .btn { margin-top: 20px; }
.gate .gate-note { margin-top: 14px; font-size: 10.5px; color: var(--faint); }

.dl-list { display: flex; flex-direction: column; margin-top: 24px; }
.dl-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px; align-items: center;
  padding: 20px 2px;
  border-bottom: 1px solid var(--line);
}
.dl-item h3 { margin: 0 0 4px; font-size: 16px; }
.dl-item p { font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.dl-meta {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  margin-top: 8px;
  font-family: var(--font-mono); font-size: 10px; color: var(--faint);
}
.dl-actions { display: flex; gap: 8px; }

/* ---------- 16. 查看器（/lab/view.html） ---------- */
.viewer-page { min-height: 100vh; display: flex; flex-direction: column; }
.viewer-bar {
  flex: none;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.viewer-bar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; min-height: 56px;
}
.viewer-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.viewer-title .back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 650; color: var(--muted);
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); flex: none;
}
.viewer-title .back:hover { color: var(--ink); border-color: var(--line-strong); }
.viewer-title h1 {
  font-size: 14px; margin: 0; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.viewer-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.viewer-note {
  flex: none;
  padding: 7px 0;
  background: var(--acc-softer);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted); text-align: center;
}
.viewer-frame {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  background: var(--surface-2);
}
.viewer-frame iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* ---------- 17. 动效 ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero-figure { animation: rise .65s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- 18. 响应式 ---------- */
@media (max-width: 980px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-grid, .lab-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .section-note { max-width: 34ch; }
}

@media (max-width: 720px) {
  :root { --gutter: 18px; --header-h: 56px; }
  .header-inner {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand tools" "nav nav";
    gap: 6px 12px;
    padding-top: 9px;
    padding-bottom: 7px;
  }
  .brand { font-size: 16px; }
  .brand-mark { width: 27px; height: 27px; border-radius: 8px; }
  .site-nav {
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 0 1px;
    -webkit-overflow-scrolling: touch;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { padding: 6px 11px; font-size: 13px; }
  .palette-toggle { padding: 3px; }
  .palette-toggle .sw { width: 17px; height: 17px; }
  .site-header .dauth-chip .ghost { padding: 5px 9px; font-size: 12px; }

  .hero { padding-top: 20px; }

  .section-head { display: block; }
  .section-note { margin-top: 9px; text-align: left; max-width: none; }
  .bento { grid-template-columns: 1fr; gap: 11px; }
  .tile { grid-column: span 1; min-height: 0; }
  .tile h3 { font-size: 22px; }

  .game-grid, .lab-grid { gap: 12px; }
  .game-body { padding: 12px 13px 14px; }
  .game-body h3 { font-size: 14.5px; }
  .game-body p { font-size: 11.5px; }
  .cover-glyph { font-size: 40px; }
  .cover-code { font-size: 7.5px; }
  .cover-cat { font-size: 8.5px; padding: 3px 6px; top: 8px; left: 8px; }
  .cover-go { display: none; }
  .tag { font-size: 9.5px; padding: 4px 7px; }

  .download-band { flex-direction: column; align-items: flex-start; }
  .download-band .btn { width: 100%; }

  .page-head h1 { font-size: clamp(34px, 10vw, 46px); }
  .lib-toolbar { align-items: stretch; }
  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; }
  .search { min-width: 0; width: 100%; }
  .lib-item, .dl-item { grid-template-columns: 1fr; gap: 12px; }
  .lib-actions, .dl-actions { padding-top: 0; }
  .lib-actions .btn { flex: 1; }
  .news-item { grid-template-columns: 50px minmax(0, 1fr); gap: 12px; }
  .viewer-note { font-size: 10.5px; padding: 6px 10px; }
  .viewer-title h1 { font-size: 12.5px; }
  .viewer-bar .wrap { min-height: 50px; }
}

@media (max-width: 420px) {
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-grid { grid-template-columns: 1fr; }
  .site-header .dauth-chip .nm { max-width: 78px; }
  .site-header .dauth-chip .ghost { padding: 5px 7px; font-size: 11.5px; }
  .header-tools { gap: 6px; }
  .brand-sub { display: none; }
}

@media (max-width: 380px) {
  .brand-word { display: none; }
  .site-header .dauth-chip .nm { max-width: 64px; }
}

@media (max-width: 980px) {
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper-toolbar { position: static; }
}
@media (max-width: 760px) {
  .paper-pair { grid-template-columns: 1fr; gap: 18px; }
  .paper-col.trans { border-left: 0; padding-left: 0; }
  .paper-note { text-align: left; }
}
@media (max-width: 560px) {
  .book-grid { grid-template-columns: 1fr; }
}
