/* ============================================================
   桌游规则书 — 全局样式
   纯静态站点，无外部依赖，可直接部署到任意服务器
   ============================================================ */

:root {
  --topbar-h: 56px;
  --sidebar-w: 280px;
  --content-w: 860px;

  /* 主题色：默认（首页） */
  --accent: #8a6d3b;
  --accent-strong: #6b532e;
  --accent-soft: rgba(138, 109, 59, 0.12);
  --accent-border: rgba(138, 109, 59, 0.35);

  --bg: #faf9f7;
  --paper: #ffffff;
  --ink: #2b2a27;
  --ink-soft: #6f6b63;
  --line: #e8e4dd;

  --radius: 10px;
  --shadow: 0 1px 3px rgba(43, 42, 39, 0.08), 0 4px 14px rgba(43, 42, 39, 0.06);
  --shadow-lift: 0 4px 10px rgba(43, 42, 39, 0.12), 0 10px 28px rgba(43, 42, 39, 0.10);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

/* 各游戏主题色 */
body[data-theme="wonders"] { --accent: #b45309; --accent-strong: #92400e; --accent-soft: rgba(180, 83, 9, 0.10); --accent-border: rgba(180, 83, 9, 0.35); }
body[data-theme="wingspan"] { --accent: #2f7d4f; --accent-strong: #226240; --accent-soft: rgba(47, 125, 79, 0.10); --accent-border: rgba(47, 125, 79, 0.35); }
body[data-theme="vale"] { --accent: #7c5cbf; --accent-strong: #6244a3; --accent-soft: rgba(124, 92, 191, 0.10); --accent-border: rgba(124, 92, 191, 0.35); }
body[data-theme="grove"] { --accent: #55921c; --accent-strong: #3f7212; --accent-soft: rgba(85, 146, 28, 0.10); --accent-border: rgba(85, 146, 28, 0.35); }
body[data-theme="brass"] { --accent: #8a6a15; --accent-strong: #6b5210; --accent-soft: rgba(138, 106, 21, 0.10); --accent-border: rgba(138, 106, 21, 0.35); }
body[data-theme="puerto"] { --accent: #17698e; --accent-strong: #105270; --accent-soft: rgba(23, 105, 142, 0.10); --accent-border: rgba(23, 105, 142, 0.35); }
body[data-theme="agricola"] { --accent: #a84632; --accent-strong: #8a3828; --accent-soft: rgba(168, 70, 50, 0.10); --accent-border: rgba(168, 70, 50, 0.35); }
body[data-theme="barcelona"] { --accent: #a13a5e; --accent-strong: #82294b; --accent-soft: rgba(161, 58, 94, 0.10); --accent-border: rgba(161, 58, 94, 0.35); }
body[data-theme="dune"] { --accent: #bf7a16; --accent-strong: #995e0e; --accent-soft: rgba(191, 122, 22, 0.10); --accent-border: rgba(191, 122, 22, 0.35); }
body[data-theme="uprising"] { --accent: #a63a22; --accent-strong: #822a18; --accent-soft: rgba(166, 58, 34, 0.10); --accent-border: rgba(166, 58, 34, 0.35); }
body[data-theme="ascension"] { --accent: #7c3aad; --accent-strong: #63288c; --accent-soft: rgba(124, 58, 173, 0.10); --accent-border: rgba(124, 58, 173, 0.35); }
body[data-theme="trajan"] { --accent: #8c3037; --accent-strong: #6f2430; --accent-soft: rgba(140, 48, 55, 0.10); --accent-border: rgba(140, 48, 55, 0.35); }
body[data-theme="tulip"] { --accent: #a92f3d; --accent-strong: #87222e; --accent-soft: rgba(169, 47, 61, 0.10); --accent-border: rgba(169, 47, 61, 0.35); }
body[data-theme="galileo"] { --accent: #35558a; --accent-strong: #2a4470; --accent-soft: rgba(53, 85, 138, 0.10); --accent-border: rgba(53, 85, 138, 0.35); }
body[data-theme="orloj"] { --accent: #2f6e5e; --accent-strong: #24584c; --accent-soft: rgba(47, 110, 94, 0.10); --accent-border: rgba(47, 110, 94, 0.35); }
body[data-theme="fcm"] { --accent: #0f7f8b; --accent-strong: #0c6671; --accent-soft: rgba(15, 127, 139, 0.10); --accent-border: rgba(15, 127, 139, 0.35); }
body[data-theme="clank"] { --accent: #6a5a8e; --accent-strong: #554773; --accent-soft: rgba(106, 90, 142, 0.10); --accent-border: rgba(106, 90, 142, 0.35); }
body[data-theme="clankuw"] { --accent: #4a5a94; --accent-strong: #3a4780; --accent-soft: rgba(74, 90, 148, 0.10); --accent-border: rgba(74, 90, 148, 0.35); }
body[data-theme="clankap"] { --accent: #bf5f2a; --accent-strong: #9c4a20; --accent-soft: rgba(191, 95, 42, 0.10); --accent-border: rgba(191, 95, 42, 0.35); }
body[data-theme="arkmarine"] { --accent: #2a6f97; --accent-strong: #1f567a; --accent-soft: rgba(42, 111, 151, 0.10); --accent-border: rgba(42, 111, 151, 0.35); }
body[data-theme="speakeasy"] { --accent: #257a72; --accent-strong: #1c605a; --accent-soft: rgba(37, 122, 114, 0.10); --accent-border: rgba(37, 122, 114, 0.35); }
body[data-theme="powergrid"] { --accent: #b09510; --accent-strong: #8d770c; --accent-soft: rgba(176, 149, 16, 0.10); --accent-border: rgba(176, 149, 16, 0.35); }
body[data-theme="seti"] { --accent: #0e7490; --accent-strong: #0b5c73; --accent-soft: rgba(14, 116, 144, 0.10); --accent-border: rgba(14, 116, 144, 0.35); }
body[data-theme="setisa"] { --accent: #c2410c; --accent-strong: #9a3412; --accent-soft: rgba(194, 65, 12, 0.10); --accent-border: rgba(194, 65, 12, 0.35); }
body[data-theme="endeavor"] { --accent: #0d6273; --accent-strong: #0a4d5b; --accent-soft: rgba(13, 98, 115, 0.10); --accent-border: rgba(13, 98, 115, 0.35); }
body[data-theme="edora"] { --accent: #2e6b46; --accent-strong: #235236; --accent-soft: rgba(46, 107, 70, 0.10); --accent-border: rgba(46, 107, 70, 0.35); }
body[data-theme="austria"] { --accent: #7a3b2e; --accent-strong: #61301f; --accent-soft: rgba(122, 59, 46, 0.10); --accent-border: rgba(122, 59, 46, 0.35); }
body[data-theme="arle"] { --accent: #3d7ab0; --accent-strong: #2f5f8c; --accent-soft: rgba(61, 122, 176, 0.10); --accent-border: rgba(61, 122, 176, 0.35); }
body[data-theme="message"] { --accent: #6b3040; --accent-strong: #552533; --accent-soft: rgba(107, 48, 64, 0.10); --accent-border: rgba(107, 48, 64, 0.35); }
body[data-theme="gwt"] { --accent: #2a6149; --accent-strong: #214e3a; --accent-soft: rgba(42, 97, 73, 0.10); --accent-border: rgba(42, 97, 73, 0.35); }
body[data-theme="arnakel"] { --accent: #8c6d2f; --accent-strong: #6f5724; --accent-soft: rgba(140, 109, 47, 0.10); --accent-border: rgba(140, 109, 47, 0.35); }
body[data-theme="bga"] { --accent: #c35500; --accent-strong: #9a4300; --accent-soft: rgba(195, 85, 0, 0.09); --accent-border: rgba(195, 85, 0, 0.35); }
body[data-theme="white-castle"] { --accent: #1e3a8a; --accent-strong: #172e6b; --accent-soft: rgba(30, 58, 138, 0.10); --accent-border: rgba(30, 58, 138, 0.35); }

/* ---------- BGA wiki 内容适配 ---------- */
.content .mw-parser-output { font-size: 0.98rem; }
.content .mw-parser-output img,
.content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
/* 信息框类表格在窄屏不浮动 */
.content .infobox,
.content table.infobox {
  float: none !important;
  margin: 1.2em auto !important;
  width: auto;
  max-width: 100%;
}
.content .wikitable { width: auto; max-width: 100%; }
.content .navbox { display: none; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ---------- 阅读进度条 ---------- */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  z-index: 100;
  transition: width 0.1s linear;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.topbar .brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  white-space: nowrap;
}
.topbar .brand:hover { text-decoration: none; color: var(--accent-strong); }

.topbar-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  color: var(--ink-soft);
  text-align: center;
}

.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  flex: none;
}
.menu-btn:hover { background: var(--accent-soft); }

/* ---------- 整体布局：侧边栏 + 正文 ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  max-width: 1280px;
  margin: 0 auto;
}

/* 遮罩层仅手机抽屉用；桌面隐藏，避免占据网格位把正文挤到第二行 */
.backdrop { display: none; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 20px 14px 32px;
  border-right: 1px solid var(--line);
  background: var(--bg);
  overscroll-behavior: contain;
}

.sidebar nav + nav { margin-top: 26px; padding-top: 18px; border-top: 1px dashed var(--line); }

.toc-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0 0 8px 10px;
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc a {
  display: block;
  padding: 5px 10px;
  border-left: 3px solid transparent;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.5;
  border-radius: 0 6px 6px 0;
}
.toc a:hover {
  color: var(--ink);
  background: var(--accent-soft);
  text-decoration: none;
}
.toc a.active {
  color: var(--accent-strong);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.toc .toc-h3 { margin: 0; }
.toc .toc-h3 a { padding-left: 26px; font-size: 0.85rem; }

/* ---------- 正文 ---------- */
.content {
  padding: 28px 32px 80px;
  min-width: 0;
}

.content article {
  max-width: var(--content-w);
  margin: 0 auto;
}

.page-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 3px solid var(--accent-border);
}

.page-header .game-title {
  margin: 0 0 6px;
  font-size: 1.9rem;
  line-height: 1.3;
  color: var(--ink);
}

.page-header .game-sub {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 1rem;
}

.meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 12px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* 标题层级 */
.content h2 {
  position: relative;
  margin: 2.6em 0 0.9em;
  padding-left: 14px;
  font-size: 1.42rem;
  line-height: 1.4;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.content h2::before {
  content: "";
  position: absolute;
  left: 0; top: 0.18em;
  width: 5px; height: 1.1em;
  border-radius: 3px;
  background: var(--accent);
}

.content h3 {
  margin: 1.9em 0 0.7em;
  font-size: 1.15rem;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.content h4 {
  margin: 1.5em 0 0.5em;
  font-size: 1.02rem;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.content p { margin: 0.8em 0; }

.content ul, .content ol { padding-left: 1.6em; }
.content li { margin: 0.35em 0; }

.content strong { color: var(--ink); }

/* 引用 / 来源 */
.content blockquote {
  margin: 1.2em 0;
  padding: 10px 16px;
  border-left: 4px solid var(--accent-border);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  color: var(--ink-soft);
}
.content blockquote p { margin: 0.3em 0; }

/* 提示框 */
.callout {
  margin: 1.2em 0;
  padding: 12px 16px;
  border: 1px solid var(--accent-border);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--accent-soft);
}
.callout .callout-title { font-weight: 700; margin-bottom: 2px; }
.callout p { margin: 0.3em 0; }

/* 表格 */
.table-wrap { overflow-x: auto; margin: 1.2em 0; }

.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--paper);
}

.content th, .content td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

.content th {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  white-space: nowrap;
}

.content tbody tr:nth-child(even) { background: rgba(0, 0, 0, 0.015); }

/* 行内代码 / 键位 */
.content code {
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(43, 42, 39, 0.07);
  font-size: 0.9em;
}

/* 正文图片（示意图 / 组件照） */
.content figure { margin: 1.4em 0; text-align: center; }
.content figure img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.content figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* 规则书扫描图附录 */
.scan-appendix { margin-top: 3em; }

.scan-appendix summary {
  cursor: pointer;
  padding: 12px 16px;
  border: 1px dashed var(--accent-border);
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-weight: 600;
  color: var(--accent-strong);
  user-select: none;
}
.scan-appendix summary:hover { background: var(--accent-border); }

.scan-appendix[open] summary { margin-bottom: 16px; }

.scan-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.scan-list figure { margin: 0; }
.scan-list img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* 来源落款 */
.source-note {
  margin-top: 3em;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- 返回顶部 ---------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 26px;
  width: 42px; height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--accent-strong);
  font-size: 1.1rem;
  box-shadow: var(--shadow-lift);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 70;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--accent-soft); }

/* ---------- 首页：搜索 + 全量游戏目录 ---------- */
.search-section { margin: 0 0 30px; }

.search-box > input[type="search"] {
  width: 100%;
  padding: 13px 18px;
  font-size: 1.02rem;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box > input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-meta {
  margin: 10px 4px 12px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.show-en-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin: 10px 2px 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.show-en-toggle input { accent-color: var(--accent); }

.bga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 8px;
}

.bga-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 13px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.35;
  transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
.bga-item:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  transform: translateY(-1px);
  text-decoration: none;
}
.bga-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.bga-zh {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bga-en {
  font-size: 0.72rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bga-players {
  flex: none;
  font-size: 0.75rem;
  color: var(--ink-soft);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 1px 8px;
}
.bga-rating {
  font-size: 0.72rem;
  color: #8a6d1a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* BGG 评分 chip（游戏页头部，金色调不随主题变化） */
.meta-chip.bgg-chip {
  border-color: #ead9a0;
  background: #fff8e1;
  color: #8a6d1a;
}
.meta-chip.bgg-chip:hover {
  border-color: #d8bd6a;
  background: #fdf2cf;
}

.search-empty { color: var(--ink-soft); padding: 18px 4px; grid-column: 1 / -1; }

.search-more {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
}

.section-title {
  margin: 40px 0 18px;
  font-size: 1.35rem;
}


/* ---------- 首页 ---------- */
.home {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.hero {
  padding: 64px 0 46px;
  text-align: center;
}

.hero .hero-icon { font-size: 3rem; line-height: 1; }

.hero h1 {
  margin: 14px 0 8px;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  letter-spacing: 0.04em;
}

.hero .hero-sub {
  margin: 0 auto;
  max-width: 560px;
  color: var(--ink-soft);
}

.hero .hero-tags {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.home-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------- 首页 FAQ ---------- */
.faq-section {
  margin-top: 48px;
}

.faq-list {
  display: grid;
  gap: 12px;
  max-width: var(--content-w);
  margin: 0 auto;
  text-align: left;
}

.faq-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.faq-item summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 400;
  flex: none;
  line-height: 1;
}

.faq-item[open] summary::after { content: "–"; }

.faq-item .faq-a {
  padding: 0 18px 14px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.75;
}

/* ---------- 移动端（≤ 900px）：侧边栏变抽屉 ---------- */
@media (max-width: 900px) {
  :root { --topbar-h: 52px; }

  .menu-btn { display: inline-flex; }

  .topbar-title { display: none; }

  .layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0;
    top: var(--topbar-h);
    z-index: 80;
    width: min(84vw, 340px);
    height: calc(100vh - var(--topbar-h));
    background: var(--paper);
    box-shadow: var(--shadow-lift);
    transform: translateX(-102%);
    transition: transform 0.25s ease;
  }

  body.sidebar-open .sidebar { transform: none; }

  .backdrop {
    display: block;
    position: fixed;
    inset: 0;
    top: var(--topbar-h);
    background: rgba(30, 28, 25, 0.45);
    z-index: 75;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
  }

  body.sidebar-open .backdrop { opacity: 1; visibility: visible; }

  .content {
    padding: 20px 18px 64px;
  }

  .page-header .game-title { font-size: 1.55rem; }

  .content h2 { font-size: 1.28rem; }
  .content h3 { font-size: 1.08rem; }

  .content table { font-size: 0.85rem; }
  .content th, .content td { padding: 6px 9px; }

  .to-top { right: 14px; bottom: 18px; }
}

/* ---------- 打印 ---------- */
@media print {
  .topbar, .sidebar, .backdrop, .to-top, .progress-bar, .menu-btn { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
}

/* ---------- 图片点击放大（lightbox，支持缩放平移） ---------- */
.content img { cursor: zoom-in; }
.lightbox {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.88);
  cursor: zoom-out;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  cursor: zoom-in;
  touch-action: none;
  -webkit-user-drag: none;
  will-change: transform;
}
.lightbox img.zoomed { cursor: grab; }
.lightbox-bar {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: default;
}
.lightbox-bar .lightbox-zoom {
  min-width: 42px;
  text-align: center;
  color: #cbd5e1;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.lightbox-bar button {
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-bar button:hover { background: rgba(255, 255, 255, 0.24); }
.lightbox-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- 正文内联小图标（裁剪自原书扫描图） ---------- */
.content img.ic, .content img.ic-md, .content img.ic-badge { cursor: default; }
img.ic { height: 1.15em; width: auto; vertical-align: -0.22em; margin: 0 1px; }
img.ic-md { height: 2em; width: auto; vertical-align: middle; margin: 2px 6px 2px 0; }
img.ic-badge { height: 1.3em; width: auto; vertical-align: -0.3em; margin-right: 3px; }

/* ---------- ICP 备案页脚（main.js 全站注入，index.html 静态内置） ---------- */
.icp-footer {
  margin-top: 48px;
  padding: 20px 0 32px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
}
.icp-footer a { color: var(--ink-soft); }
.icp-footer a:hover { text-decoration: underline; }

/* ---------- 用户与收藏（account.js 注入） ---------- */
.topbar-auth {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.topbar-auth + .topbar-title { text-align: right; }
.auth-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 4px 12px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.85rem;
  text-decoration: none;
}
.auth-link:hover { background: var(--accent-border); text-decoration: none; }
.auth-logout {
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 2px;
}
.auth-logout:hover { color: var(--ink); }

.collect-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
}
.collect-label { font-size: 0.88rem; color: var(--accent-strong); font-weight: 600; }
.collect-btn {
  padding: 5px 14px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.collect-btn:hover:not(:disabled) { border-color: var(--accent-strong); color: var(--accent-strong); }
.collect-btn.active {
  background: var(--accent);
  border-color: var(--accent-strong);
  color: #fff;
}
.collect-btn:disabled { opacity: 0.55; cursor: wait; }

/* ---------- 我的收藏页（account.html）与公开分享页（shared.html）：独立靛蓝主题 ---------- */
body[data-page="account"],
body[data-page="shared"] {
  --accent: #5457c8;
  --accent-strong: #4043ad;
  --accent-soft: rgba(84, 87, 200, 0.10);
  --accent-border: rgba(84, 87, 200, 0.32);
}

.account-auth { display: flex; justify-content: center; padding: 56px 18px; }
.auth-card {
  width: min(400px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 30px 30px 24px;
}
.auth-hero { text-align: center; font-size: 2rem; margin-bottom: 10px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 22px; background: var(--bg); border-radius: 999px; padding: 4px; }
.auth-tab {
  flex: 1;
  padding: 7px 0;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--ink-soft);
  font-size: 0.95rem;
  cursor: pointer;
}
.auth-tab.active { background: var(--paper); color: var(--accent-strong); font-weight: 600; box-shadow: var(--shadow); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { font-size: 0.9rem; color: var(--ink-soft); display: flex; flex-direction: column; gap: 6px; }
.auth-form input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-size: 1rem;
}
.auth-form input:focus { outline: 2px solid var(--accent-border); border-color: var(--accent); }
.form-error { margin: 0; color: #b42318; font-size: 0.88rem; }
.auth-submit {
  margin-top: 4px;
  padding: 11px 0;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.auth-submit:hover:not(:disabled) { background: var(--accent-strong); }
.auth-submit:disabled { opacity: 0.6; cursor: wait; }
.auth-hint { margin: 0; font-size: 0.85rem; color: var(--ink-soft); text-align: center; }
.auth-hint a { color: var(--accent-strong); }

/* 页头：标题居左，用户信息卡片居右 */
.account-lists { max-width: 860px; margin: 0 auto; padding: 36px 18px 64px; }
.account-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
}
.account-title { font-size: 1.5rem; margin: 0; color: var(--ink); }
.account-tip { margin: 6px 0 0; font-size: 0.88rem; color: var(--ink-soft); }
.account-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px 7px 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex: none;
}
.account-username {
  font-weight: 600;
  color: var(--ink);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-logout { padding: 6px 12px; }

/* 三张统计卡片 */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 22px 0 32px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px solid var(--st, var(--accent));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); text-decoration: none; }
.stat-num { font-size: 1.55rem; font-weight: 700; color: var(--ink); line-height: 1.2; }
.stat-label { font-size: 0.85rem; color: var(--ink-soft); }
.st-owned { --st: #2f7d4f; }
.st-wishlist { --st: #b45309; }
.st-play { --st: #5457c8; }

/* 三张清单分区 */
.list-block { margin-bottom: 30px; }
.list-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.12rem;
  color: var(--ink);
  margin: 0 0 12px;
  padding-left: 10px;
  border-left: 3px solid var(--st, var(--accent));
}
.count-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--st, var(--accent));
  color: #fff;
  font-size: 0.76rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink-soft);
  text-align: center;
}
.le-ico { font-size: 1.7rem; opacity: 0.75; }
.list-empty p { margin: 0; font-size: 0.9rem; }
.le-link { color: var(--accent-strong); font-size: 0.88rem; text-decoration: none; }
.le-link:hover { text-decoration: underline; }

.list-rows { display: flex; flex-direction: column; gap: 10px; }
.list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.list-row:hover { border-color: var(--accent-border); box-shadow: var(--shadow-lift); }
.list-info { flex: 1; min-width: 220px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.list-name { color: var(--ink); font-weight: 600; text-decoration: none; }
.list-name:hover { color: var(--accent-strong); text-decoration: underline; }
.list-en { color: var(--ink-soft); font-size: 0.85rem; }
.bgg-chip-mini {
  padding: 1px 9px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  white-space: nowrap;
}
.list-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.mini-btn {
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.mini-btn:hover:not(.active) { border-color: var(--accent); color: var(--accent-strong); }
.mini-btn.active { background: var(--accent); border-color: var(--accent-strong); color: #fff; cursor: default; }
.mini-btn.remove:hover { border-color: #b42318; color: #b42318; }

@media (max-width: 900px) {
  .topbar-auth { gap: 8px; }
  .auth-link { max-width: 130px; }
  .collect-bar { padding: 9px 11px; }
  .collect-btn { flex: 1 1 auto; text-align: center; padding: 7px 10px; }
  .account-head { align-items: flex-start; }
  .account-user { padding: 5px 6px; }
  .stat-cards { gap: 8px; }
  .stat-card { padding: 11px 14px; }
  .stat-num { font-size: 1.3rem; }
  .list-actions { margin-left: 0; width: 100%; }
  .list-actions .mini-btn { flex: 1 1 auto; text-align: center; }
}
@media print {
  .topbar-auth, .collect-bar { display: none !important; }
}

/* hidden 属性优先于任何 display 规则（否则 .auth-form 的 flex 会把 hidden 表单顶出来） */
[hidden] { display: none !important; }

/* ---------- 密码强度（注册表单） ---------- */
.pw-meter { display: flex; align-items: center; gap: 10px; }
.pw-track { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.pw-fill { height: 100%; width: 0; border-radius: 999px; background: #b42318; transition: width 0.2s ease, background 0.2s ease; }
.pw-fill.mid { background: #b45309; }
.pw-fill.strong { background: #2f7d4f; }
.pw-text { font-size: 0.78rem; color: var(--ink-soft); white-space: nowrap; min-width: 3.5em; text-align: right; }
.pw-rules {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  padding: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.pw-rules li::before { content: "○ "; color: var(--ink-soft); }
.pw-rules li.ok { color: #2f7d4f; }
.pw-rules li.ok::before { content: "✓ "; }
.pw-rules li.bad::before { content: "✗ "; color: #b42318; }

/* ---------- 分享面板（account.html） ---------- */
.share-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 20px 0 6px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.share-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 240px; }
.share-ico { font-size: 1.35rem; }
.share-info strong { font-size: 0.95rem; color: var(--ink); display: block; }
.share-info p { margin: 2px 0 0; font-size: 0.8rem; color: var(--ink-soft); }
.share-off { display: flex; }
.share-on { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; align-items: center; }
.share-link {
  flex: 1;
  min-width: 220px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.share-link:focus { outline: 2px solid var(--accent-border); }
.share-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-btn.share-primary { background: var(--accent); border-color: var(--accent-strong); color: #fff; font-weight: 600; }
.mini-btn.share-primary:hover:not(:disabled) { background: var(--accent-strong); color: #fff; }

/* ---------- 公开分享页（shared.html，与账号页同主题） ---------- */
.shared-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 64px 18px;
  color: var(--ink-soft);
  text-align: center;
}
.shared-error p { margin: 0; font-size: 0.95rem; }

@media (max-width: 900px) {
  .share-info { min-width: 100%; }
  .share-on { flex-direction: column; align-items: stretch; }
  .share-btns .mini-btn { flex: 1 1 auto; text-align: center; }
}

/* ---------- 首页卡片快捷收藏（登录态，account.js 注入） ---------- */
.bga-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bga-card .bga-item { flex: 1; }
.card-collect { display: flex; gap: 5px; }
.card-btn {
  flex: 1;
  padding: 4px 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.12s, border-color 0.12s;
}
.card-btn:hover:not(:disabled) { opacity: 1; border-color: var(--accent); }
.card-btn:disabled { opacity: 0.5; cursor: wait; }
.card-btn.active { color: #fff; opacity: 1; font-weight: 600; }
.card-btn.st-owned.active { background: #2f7d4f; border-color: #2f7d4f; }
.card-btn.st-wishlist.active { background: #b45309; border-color: #b45309; }
.card-btn.st-play.active { background: #5457c8; border-color: #5457c8; }

@media print {
  .card-collect { display: none !important; }
}

/* ---------- 「在线玩」横幅(规则页 → /play/) ---------- */
.play-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 26px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #6e2639, #7c2f3e 55%, #8f3a49);
  color: #fff;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(110, 38, 57, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.play-banner:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(110, 38, 57, 0.32); color: #fff; text-decoration: none; }
.play-banner-icon { font-size: 1.7rem; }
.play-banner-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.play-banner-body strong { font-size: 1.02rem; letter-spacing: 0.02em; }
.play-banner-body em { font-style: normal; font-size: 0.84rem; opacity: 0.85; }
.play-banner-go {
  margin-left: auto;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.92rem;
  background: rgba(255, 255, 255, 0.16);
  padding: 6px 12px;
  border-radius: 999px;
}
@media (max-width: 640px) {
  .play-banner { gap: 10px; padding: 12px 14px; }
  .play-banner-go { display: none; }
}
