/* 正面对决资料站 · 三国暗色主题 */
:root {
  --bg: #16120e;
  --bg2: #1e1812;
  --bg3: #282017;
  --line: #3a3125;
  --line2: #4a3f2f;
  --gold: #c9a86a;
  --gold-dim: #8a744a;
  --accent: #c8452f;
  --accent-hi: #e05a3f;
  --text: #e8e0d0;
  --muted: #9a8f7d;
  --wind: #58a878;
  --forest: #2d7a4f;
  --fire: #c8452f;
  --mountain: #b98a3e;
  --yin: #8a6bb5;
  --thunder: #4a7fb5;
  --none: #8a8a8a;

  /* 墨色 / 卡图遮罩：与既有字面值完全一致，仅收口为令牌 */
  --ink: #f0e6d2;
  --ink-on-accent: #f5ead8;
  --scrim: rgba(20, 15, 10, 0.82);

  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;

  /* ---------- 工艺令牌：字号 7 档（近档收敛，单处视差 ≤1px）---------- */
  --fs-1: 11px;  /* 角标 / 辅助 / 说明 */
  --fs-2: 12px;  /* 小字 / 标签 / meta */
  --fs-3: 13px;  /* 紧凑正文 */
  --fs-4: 14px;  /* 正文 / 按钮 */
  --fs-5: 16px;  /* 区块标题 */
  --fs-6: 20px;  /* 面板大数 / 栏目主标 */
  --fs-7: 22px;  /* 页面标题 */

  /* ---------- 工艺令牌：圆角 3 档（50% 圆形 + 99px 胶囊另计）---------- */
  --r-s: 5px;    /* 小件：印章 / 芯片 / 缩略图 */
  --r-m: 10px;   /* 面板 / 输入 / 导航项 */
  --r-l: 14px;   /* 卡片 / 弹层 / 图片 */
  --r-pill: 99px; /* 胶囊（不计入 3 档）*/

  /* ---------- 字面量白名单（>3 档范畴，孤例保留）----------
     50%：圆形（6 处），不计入 3 档。
     font-size 24px：.doc-content h1（正文页主标，hero 级孤例）。 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(200, 69, 47, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 90% 110%, rgba(201, 168, 106, 0.05), transparent);
  background-attachment: fixed;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--accent-hi); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px;
  background: rgba(22, 18, 14, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }

.seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: var(--accent);
  color: #f5ead8;
  font-size: var(--fs-6); font-weight: 700;
  border-radius: var(--r-s);
  box-shadow: inset 0 0 0 2px rgba(245, 234, 216, 0.35), 0 2px 8px rgba(200, 69, 47, 0.4);
}

.brand-text { font-size: var(--fs-5); font-weight: 700; letter-spacing: 0.06em; color: var(--text); }
.brand-sub { font-size: var(--fs-1); color: var(--muted); letter-spacing: 0.2em; display: block; line-height: 1.2; }

.topnav { display: flex; gap: 4px; margin-left: auto; }

.topnav a {
  padding: 8px 16px; border-radius: var(--r-m);
  color: var(--muted); font-size: var(--fs-4); font-weight: 500;
  min-height: 44px; display: inline-flex; align-items: center;
  transition: color 0.15s, background 0.15s;
}
.topnav a:hover { color: var(--text); background: var(--bg3); }
.topnav a.active { color: #f0e6d2; background: var(--accent); }

/* ---------- 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 20px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px;
}

.layout-docs { grid-template-columns: 272px minmax(0, 1fr); }

@media (max-width: 860px) {
  .layout, .layout-docs { grid-template-columns: 1fr; padding: 12px; }
}

/* ---------- 筛选侧栏 ---------- */
.sidebar { position: sticky; top: 74px; align-self: start; max-height: calc(100dvh - 94px); overflow-y: auto; }

.fgroup { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; margin-bottom: 12px; }

.fgroup h3 {
  font-size: var(--fs-2); color: var(--gold); letter-spacing: 0.14em;
  margin-bottom: 8px; font-weight: 600;
}

.fopt {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 4px; border-radius: var(--r-s); cursor: pointer;
  font-size: var(--fs-4); color: var(--text);
  min-height: 32px;
}
.fopt:hover { background: var(--bg3); }
.fopt input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

.adot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.a-wind { background: var(--wind); } .a-forest { background: var(--forest); }
.a-fire { background: var(--fire); } .a-mountain { background: var(--mountain); }
.a-yin { background: var(--yin); } .a-thunder { background: var(--thunder); }
.a-none { background: var(--none); }

.fsel {
  width: 100%; padding: 7px 8px; border-radius: var(--r-s);
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--line2); font-size: var(--fs-4);
  font-family: var(--sans);
}

.btn-reset {
  width: 100%; padding: 9px; border-radius: var(--r-m);
  background: transparent; color: var(--muted);
  border: 1px solid var(--line2); cursor: pointer;
  font-size: var(--fs-3); font-family: var(--sans);
  min-height: 40px;
  transition: color 0.15s, border-color 0.15s;
}
.btn-reset:hover { color: var(--accent-hi); border-color: var(--accent); }

@media (max-width: 860px) {
  .sidebar { position: static; max-height: none; }
  .sidebar-wrap { display: none; }
  .sidebar-wrap.open { display: block; }
  .btn-filters { display: inline-flex !important; }
}

.btn-filters {
  display: none; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: var(--r-m);
  background: var(--bg2); color: var(--gold);
  border: 1px solid var(--line2); cursor: pointer;
  font-size: var(--fs-4); font-family: var(--sans); min-height: 44px;
}

/* ---------- 搜索栏 ---------- */
.searchbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }

.searchbox { position: relative; flex: 1; min-width: 220px; }

.searchbox svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2;
}

#q {
  width: 100%; padding: 11px 14px 11px 38px;
  background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r-m);
  color: var(--text); font-size: var(--fs-4); font-family: var(--sans);
  min-height: 44px;
  transition: border-color 0.15s;
}
#q:focus { border-color: var(--gold); outline: none; }
#q::placeholder { color: var(--muted); }

#count { font-size: var(--fs-3); color: var(--muted); white-space: nowrap; }
#count b { color: var(--gold); font-weight: 600; }

/* ---------- 卡牌网格 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.15s;
}
.card:hover { transform: translateY(-3px); border-color: var(--gold-dim); }
.card:active { transform: scale(0.98); }

.card-imgbox { position: relative; aspect-ratio: 3 / 4; background: var(--bg3); overflow: hidden; }
.card-imgbox img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.card-imgbox img.fail { object-fit: none; }

.card-noimg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: var(--fs-2); letter-spacing: 0.2em;
  writing-mode: vertical-rl;
}

.card-cost {
  position: absolute; top: 6px; left: 6px;
  min-width: 24px; height: 24px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 15, 10, 0.82);
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  color: var(--gold); font-weight: 700; font-size: var(--fs-3);
}

.card-forbid {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); border-radius: var(--r-s);
  color: #fff; font-weight: 700; font-size: var(--fs-4);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.card-cmd {
  position: absolute; bottom: 6px; right: 6px;
  padding: 1px 7px; border-radius: var(--r-s);
  background: rgba(201, 168, 106, 0.92); color: #1a140d;
  font-size: var(--fs-1); font-weight: 700; letter-spacing: 0.1em;
}

.card-vers {
  position: absolute; bottom: 6px; left: 6px;
  padding: 1px 7px; border-radius: var(--r-s);
  background: rgba(20, 15, 10, 0.82);
  border: 1px solid var(--gold-dim);
  color: var(--gold); font-size: var(--fs-1); font-weight: 600;
}

.tag.vtag {
  color: var(--gold); border-color: var(--gold-dim); font-weight: 600;
}

/* ---------- 弹窗版本切换 ---------- */
.m-versions { margin-top: 14px; }
.m-versions h5 {
  font-size: var(--fs-2); color: var(--gold); letter-spacing: 0.14em;
  margin-bottom: 7px; font-weight: 600;
}

.vchip {
  font-size: var(--fs-2); padding: 4px 10px; border-radius: var(--r-s);
  background: var(--bg3); border: 1px solid var(--line2);
  color: var(--muted); cursor: pointer; font-family: var(--sans);
  transition: color 0.12s, background 0.12s;
}
.vchip:hover { color: var(--text); }
.vchip.active {
  background: rgba(200, 69, 47, 0.18);
  border-color: var(--accent);
  color: #f0e6d2; font-weight: 600;
}

.card-info { padding: 8px 9px 9px; border-top: 2px solid var(--attr-c, var(--line)); }

.card-name {
  font-size: var(--fs-4); font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.7em;
}

.card-meta { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; align-items: center; }

.tag {
  font-size: var(--fs-1); padding: 1px 6px; border-radius: var(--r-s);
  background: var(--bg3); color: var(--muted); border: 1px solid var(--line);
  white-space: nowrap;
}
.tag.attr { color: #f0e6d2; border: none; }
.tag.attr.a-wind { background: var(--wind); } .tag.attr.a-forest { background: var(--forest); }
.tag.attr.a-fire { background: var(--fire); } .tag.attr.a-mountain { background: var(--mountain); }
.tag.attr.a-yin { background: var(--yin); } .tag.attr.a-thunder { background: var(--thunder); }
.tag.attr.a-none { background: var(--none); }

.card-stats { display: flex; gap: 8px; margin-top: 6px; font-size: var(--fs-2); color: var(--muted); }
.card-stats b { color: var(--text); font-weight: 600; }

.loadmore {
  display: block; margin: 18px auto; padding: 11px 34px;
  background: var(--bg2); color: var(--gold);
  border: 1px solid var(--line2); border-radius: var(--r-m);
  cursor: pointer; font-size: var(--fs-4); font-family: var(--sans); min-height: 44px;
  transition: border-color 0.15s, color 0.15s;
}
.loadmore:hover { border-color: var(--gold); color: #f0e6d2; }

/* ---------- 状态 ---------- */
.state {
  padding: 60px 20px; text-align: center; color: var(--muted); font-size: var(--fs-4);
}
.state h4 { color: var(--text); font-size: var(--fs-5); margin-bottom: 8px; }
.state .btn-reset { width: auto; padding: 9px 26px; margin-top: 14px; }

.skel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.skel {
  aspect-ratio: 3 / 4.6; border-radius: var(--r-m);
  background: linear-gradient(100deg, var(--bg2) 40%, var(--bg3) 50%, var(--bg2) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  * { transition: none !important; }
}

/* ---------- 卡牌详情弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 8, 5, 0.78);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.modal[hidden] { display: none; }

.modal-panel {
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: var(--r-l);
  max-width: 920px; width: 100%;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  display: grid; grid-template-columns: 340px minmax(0, 1fr);
  position: relative;
}

@media (max-width: 720px) {
  .modal-panel { grid-template-columns: 1fr; }
  .modal-img { max-height: 46dvh; }
}

.modal-img { background: var(--bg3); display: flex; gap: 10px; padding: 10px;
  align-items: stretch; justify-content: center; overflow: hidden; border-radius: var(--r-l) 0 0 var(--r-l); }
/* 双面卡：基本/觉醒两栏等宽，栏内整卡完整显示（object-fit:contain），不再裁切 */
.modal-img .mface { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.modal-img .mface img { width: 100%; flex: 1 1 auto; min-height: 0; object-fit: contain; display: block; }
.modal-img .mface .cap { flex: none; text-align: center; font-size: var(--fs-2); font-weight: 700; color: var(--gold); }
.modal-img .noimg { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); }
@media (max-width: 720px) { .modal-img { border-radius: var(--r-l) var(--r-l) 0 0; } }

.modal-body { padding: 22px 24px; }

.modal-close {
  position: absolute; top: 10px; right: 12px; z-index: 2;
  width: 36px; height: 36px; border-radius: var(--r-m);
  background: rgba(30, 24, 18, 0.9); color: var(--muted);
  border: 1px solid var(--line2); cursor: pointer;
  font-size: var(--fs-5); font-family: var(--sans);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--accent-hi); border-color: var(--accent); }

.m-name { font-size: var(--fs-7); font-weight: 700; letter-spacing: 0.02em; padding-right: 40px; }
.m-sub { color: var(--muted); font-size: var(--fs-2); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }

.m-forbid {
  margin-top: 12px; padding: 8px 12px; border-radius: var(--r-m);
  background: rgba(200, 69, 47, 0.15); border: 1px solid var(--accent);
  color: var(--accent-hi); font-size: var(--fs-3); font-weight: 600;
}

.m-stats { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.mstat {
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: var(--r-m); padding: 6px 12px; text-align: center; min-width: 58px;
}
.mstat i { display: block; font-style: normal; font-size: var(--fs-1); color: var(--muted); }
.mstat b { font-size: var(--fs-5); font-weight: 700; color: var(--gold); }

.m-sec { margin-top: 14px; }
.m-sec h5 {
  font-size: var(--fs-2); color: var(--gold); letter-spacing: 0.14em;
  margin-bottom: 6px; font-weight: 600;
}
.m-sec p { font-size: var(--fs-4); line-height: 1.75; white-space: pre-wrap; }
.m-flavor { color: var(--muted); font-style: italic; font-size: var(--fs-3) !important; }

/* ---------- 文档浏览器 ---------- */
.doc-nav { position: sticky; top: 74px; align-self: start; max-height: calc(100dvh - 94px); overflow-y: auto; }

.doc-item {
  display: block; width: 100%; text-align: left;
  padding: 10px 13px; border-radius: var(--r-m);
  background: transparent; border: 1px solid transparent;
  color: var(--text); font-size: var(--fs-4); font-family: var(--sans);
  cursor: pointer; min-height: 44px;
  transition: background 0.15s;
}
.doc-item:hover { background: var(--bg2); }
.doc-item.active { background: var(--bg2); border-color: var(--line2); color: var(--gold); font-weight: 600; }

.doc-toc { margin: 2px 0 8px 10px; padding-left: 12px; border-left: 1px solid var(--line); }
.doc-toc a {
  display: block; padding: 4px 6px; font-size: var(--fs-2); color: var(--muted);
  border-radius: var(--r-s); line-height: 1.45;
}
.doc-toc a:hover { color: var(--gold); background: var(--bg2); }
.doc-toc a.lv3 { padding-left: 18px; font-size: var(--fs-2); }

.doc-panel {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r-l); padding: 30px 36px;
  min-height: 60dvh;
}
@media (max-width: 860px) { .doc-panel { padding: 18px 16px; } .doc-nav { position: static; max-height: none; } }

/* ---------- Markdown 正文排版 ---------- */
.doc-content { max-width: 68ch; font-size: var(--fs-4); line-height: 1.85; }
.doc-content h1 { font-size: 24px; margin: 6px 0 18px; letter-spacing: 0.02em; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.doc-content h2 {
  font-size: var(--fs-6); margin: 34px 0 12px; color: #f0e6d2;
  padding-left: 11px; border-left: 3px solid var(--accent);
  scroll-margin-top: 80px;
}
.doc-content h3 { font-size: var(--fs-5); margin: 24px 0 10px; color: var(--gold); scroll-margin-top: 80px; }
.doc-content h4 { font-size: var(--fs-4); margin: 18px 0 8px; color: var(--text); }
.doc-content p { margin: 9px 0; }
.doc-content ul, .doc-content ol { margin: 9px 0 9px 22px; }
.doc-content li { margin: 4px 0; }
.doc-content strong { color: #f5ead8; }
.doc-content em { color: var(--muted); }
.doc-content blockquote {
  margin: 12px 0; padding: 9px 15px;
  border-left: 3px solid var(--gold-dim);
  background: var(--bg3); border-radius: 0 var(--r-m) var(--r-m) 0;
  color: var(--muted); font-size: var(--fs-4);
}
.doc-content code {
  background: var(--bg3); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: var(--r-s);
  font-size: var(--fs-2); font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--gold);
}
.doc-content pre {
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: var(--r-m); padding: 13px 15px; overflow-x: auto; margin: 12px 0;
}
.doc-content pre code { background: none; border: none; padding: 0; color: var(--text); }
.doc-content hr { border: none; border-top: 1px solid var(--line); margin: 22px 0; }
.doc-content table {
  width: 100%; border-collapse: collapse; margin: 13px 0;
  display: block; overflow-x: auto; font-size: var(--fs-3);
  scrollbar-width: thin;
}
.doc-content th {
  background: var(--bg3); color: var(--gold);
  font-weight: 600; text-align: left; white-space: nowrap;
}
.doc-content th, .doc-content td { border: 1px solid var(--line); padding: 7px 10px; }
.doc-content tr:nth-child(even) td { background: rgba(40, 32, 23, 0.4); }
.doc-content a { text-decoration: underline; text-underline-offset: 3px; }

.decklist { margin: 26px 0 8px; text-align: center; }
.decklist img {
  max-width: 100%; border-radius: var(--r-m); border: 1px solid var(--line2);
  background: #fff;
}
.decklist figcaption { color: var(--muted); font-size: var(--fs-2); margin-top: 8px; letter-spacing: 0.1em; }

/* ---------- 页内标签 ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 9px 20px; border-radius: var(--r-m);
  background: var(--bg2); border: 1px solid var(--line);
  color: var(--muted); font-size: var(--fs-4); font-family: var(--sans);
  cursor: pointer; min-height: 44px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: #f0e6d2; background: var(--accent); border-color: var(--accent); font-weight: 600; }

/* ---------- 赛事浏览器 ---------- */
.tour-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.tstat {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r-m); padding: 10px 18px; text-align: center; flex: 1; min-width: 110px;
}
.tstat i { display: block; font-style: normal; font-size: var(--fs-2); color: var(--muted); letter-spacing: 0.08em; }
.tstat b { font-size: var(--fs-7); color: var(--gold); font-weight: 700; }

.tour-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }

.tour-card {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r-m); padding: 14px 16px; cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  min-height: 44px;
}
.tour-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.tour-card.active { border-color: var(--accent); }

.tour-name { font-size: var(--fs-4); font-weight: 600; }
.tour-meta { font-size: var(--fs-2); color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.tour-champ { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line); font-size: var(--fs-2); color: var(--muted); }
.tour-champ b { color: var(--gold); font-weight: 600; }

.deck-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: var(--fs-3); }
.deck-table th {
  text-align: left; padding: 8px 10px; color: var(--gold);
  border-bottom: 1px solid var(--line2); font-weight: 600; font-size: var(--fs-2);
  letter-spacing: 0.08em; white-space: nowrap;
}
.deck-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.deck-table tr.deck-row { cursor: pointer; }
.deck-table tr.deck-row:hover td { background: var(--bg3); }

.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; border-radius: var(--r-s);
  background: var(--bg3); border: 1px solid var(--line2);
  font-weight: 700; font-size: var(--fs-3); color: var(--text);
}
.rank-badge.r1 { background: var(--accent); border-color: var(--accent); color: #fff; }
.rank-badge.r2, .rank-badge.r3 { border-color: var(--gold-dim); color: var(--gold); }

.wararts { display: inline-flex; gap: 4px; }
.wa {
  font-size: var(--fs-1); padding: 1px 6px; border-radius: var(--r-s);
  color: #f0e6d2; font-weight: 600;
}
.wa.a-wind { background: var(--wind); } .wa.a-forest { background: var(--forest); }
.wa.a-fire { background: var(--fire); } .wa.a-mountain { background: var(--mountain); }
.wa.a-yin { background: var(--yin); } .wa.a-thunder { background: var(--thunder); }

.deck-detail td { background: var(--bg); padding: 14px 16px !important; }
.dd-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.dd-cols h6 { font-size: var(--fs-2); color: var(--gold); letter-spacing: 0.12em; margin-bottom: 7px; font-weight: 600; }
.dd-list { display: flex; flex-wrap: wrap; gap: 5px; }
.dd-chip {
  font-size: var(--fs-2); padding: 3px 9px; border-radius: var(--r-s);
  background: var(--bg2); border: 1px solid var(--line);
}
.dd-chip b { color: var(--gold); font-weight: 700; margin-left: 3px; }

.btn-copy {
  padding: 4px 10px; border-radius: var(--r-s);
  background: var(--bg3); border: 1px solid var(--line2);
  color: var(--muted); font-size: var(--fs-2); cursor: pointer;
  font-family: var(--sans); white-space: nowrap;
}
.btn-copy:hover { color: var(--gold); border-color: var(--gold-dim); }
.btn-copy.done { color: var(--wind); border-color: var(--wind); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--gold-dim);
  color: var(--gold); padding: 10px 22px; border-radius: var(--r-m);
  font-size: var(--fs-4); z-index: 200;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.toast.show { opacity: 1; }

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 40px; padding: 22px 20px 30px;
  border-top: 1px solid var(--line);
  text-align: center; color: var(--muted); font-size: var(--fs-2); line-height: 2;
}
.footer b { color: var(--gold-dim); font-weight: 500; }
.footer .disclaimer { margin-top: 6px; color: var(--text); font-size: var(--fs-3); }
.footer .icp { margin-top: 2px; }
.footer .icp a { color: var(--text); }

/* ============ jovan 协作版新增组件 ============ */

.page { max-width: 1200px; margin: 0 auto; padding: 20px; }
@media (max-width: 860px) { .page { padding: 12px; } }

.nav-tip { font-size: var(--fs-2); color: var(--muted); line-height: 1.7; margin-top: 8px; }

.rdot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.card-serial { font-size: var(--fs-1); color: var(--muted); margin-top: 5px; letter-spacing: 0.04em; }

/* ---------- 首页轮播 ---------- */
.banner {
  position: relative; overflow: hidden;
  border-radius: var(--r-l); border: 1px solid var(--line);
  margin-bottom: 18px; background: var(--bg2);
  aspect-ratio: 21 / 7;
}
@media (max-width: 700px) { .banner { aspect-ratio: 16 / 9; } }
.banner-track { display: flex; transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); height: 100%; }
.banner-slide { position: relative; flex: 0 0 100%; height: 100%; }
.banner-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-slide.imgfail::after {
  content: "轮播图加载失败（官方 CDN 外链）";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: var(--fs-3);
}
.banner-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 22px 16px 10px;
  background: linear-gradient(transparent, rgba(10, 8, 5, 0.82));
  color: #f0e6d2; font-size: var(--fs-4); font-weight: 600;
}
.banner-dots {
  position: absolute; right: 12px; bottom: 12px;
  display: flex; gap: 6px; z-index: 2;
}
.banner-dot {
  width: 9px; height: 9px; border-radius: 50%; padding: 0;
  background: rgba(232, 224, 208, 0.35); border: none; cursor: pointer;
}
.banner-dot.active { background: var(--gold); }

/* ---------- 首页区块 ---------- */
.home-sec { margin-bottom: 26px; }
.sec-title {
  font-size: var(--fs-5); color: #f0e6d2; margin-bottom: 12px;
  padding-left: 11px; border-left: 3px solid var(--accent);
  letter-spacing: 0.04em;
}
a.tstat { display: block; text-decoration: none; }
a.tstat:hover { border-color: var(--gold-dim); }
a.tstat i { color: var(--muted); }

.nav-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.nav-card {
  display: block; padding: 16px 18px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-l);
  transition: border-color 0.15s, transform 0.15s;
}
.nav-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.nav-card b { display: block; font-size: var(--fs-5); color: var(--gold); margin-bottom: 5px; }
.nav-card span { font-size: var(--fs-2); color: var(--muted); line-height: 1.6; display: block; }
.nav-card span b { display: inline; font-size: var(--fs-2); color: var(--accent-hi); margin: 0; }

.qa-row { display: flex; gap: 10px; flex-wrap: wrap; }
.qa-col { display: grid; gap: 6px; }
.qa-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-radius: var(--r-m);
  background: var(--bg2); border: 1px solid var(--line);
  font-size: var(--fs-4); color: var(--text); flex: 1; min-width: 220px;
}
.qa-col .qa-link { flex: none; padding: 8px 12px; font-size: var(--fs-2); }
.qa-link:hover { border-color: var(--gold-dim); color: var(--gold); }
.qa-link small { color: var(--muted); white-space: nowrap; }

/* ---------- 资讯网格 ---------- */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.news-card {
  display: block; background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r-l); overflow: hidden; color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.news-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); color: var(--text); }
.news-img { aspect-ratio: 16 / 9; background: var(--bg3); overflow: hidden; position: relative; }
.news-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-img.imgfail::after {
  content: "封面加载失败"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: var(--fs-2);
}
.news-body { padding: 12px 14px; }
.news-body h3 {
  font-size: var(--fs-4); line-height: 1.5; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-meta { font-size: var(--fs-2); color: var(--muted); margin-top: 6px; }

/* ---------- 活动日程 ---------- */
.ev-list { display: grid; gap: 10px; }
.ev-card {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r-m); overflow: hidden;
}
.ev-card[open] { border-color: var(--gold-dim); }
.ev-card summary {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 13px 16px; cursor: pointer; list-style: none;
}
.ev-card summary::-webkit-details-marker { display: none; }
.ev-card summary:hover { background: var(--bg3); }
.ev-date {
  flex: none; width: 58px; text-align: center;
  background: var(--bg3); border: 1px solid var(--line2); border-radius: var(--r-m);
  padding: 6px 4px;
}
.ev-date b { display: block; font-size: var(--fs-5); color: var(--gold); font-weight: 700; }
.ev-date i { font-style: normal; font-size: var(--fs-1); color: var(--muted); }
.ev-main { min-width: 0; flex: 1; }
.ev-title-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ev-title-line h3 { font-size: var(--fs-4); font-weight: 600; }
.ev-meta { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: var(--fs-2); color: var(--muted); margin-top: 5px; }
.ev-cat { font-size: var(--fs-2); color: var(--gold-dim); margin-top: 5px; }
.ev-desc { padding: 4px 16px 14px 88px; }
.ev-desc p {
  font-size: var(--fs-3); color: var(--muted); line-height: 1.8;
  white-space: pre-wrap;
  border-top: 1px dashed var(--line); padding-top: 10px;
}
@media (max-width: 600px) { .ev-desc { padding-left: 16px; } }

/* ---------- 卡组广场 ---------- */
.deck-table-wrap { overflow-x: auto; margin-top: 12px; }
.code-cell { white-space: nowrap; }
.code-cell code {
  background: var(--bg3); border: 1px solid var(--line);
  padding: 2px 7px; border-radius: var(--r-s); font-size: var(--fs-2); color: var(--gold);
  margin-right: 8px;
}
.cmd-thumb {
  width: 34px; height: 46px; object-fit: cover; border-radius: var(--r-s);
  border: 1px solid var(--line2); display: block; background: var(--bg3);
}
.group-body { padding: 0 14px 12px; }
.tour-card .tour-name { word-break: break-all; }

/* ---------- 修复：手机端顶栏（品牌缩小、导航横向滚动不竖排） ---------- */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 4px 12px; padding: 8px 12px; }
  .brand .brand-text { font-size: var(--fs-4); }
  .brand .brand-sub { display: none; }
  .seal { width: 30px; height: 30px; font-size: var(--fs-5); }
  .topnav {
    margin-left: 0; width: 100%;
    overflow-x: auto; flex-wrap: nowrap;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { flex: none; white-space: nowrap; padding: 8px 12px; font-size: var(--fs-4); min-height: 40px; }
  .sidebar { position: static; top: auto; max-height: none; }
}

/* ---------- 修复：规则页栅格子项可收缩（防横向超出） ---------- */
.layout > *, .layout-docs > * { min-width: 0; }
.doc-content { overflow-wrap: break-word; }
.doc-content table { max-width: 100%; }

/* ---------- 修复：资讯标题固定两行高度（防与元信息挤压） ---------- */
.news-body h3 { min-height: 2.9em; }

/* ---------- 修复：轮播圆点加大触点 ---------- */
.banner-dot { width: 12px; height: 12px; }

/* ---------- 修复：卡组表格移动端横向滚动（不再竖排挤压） ---------- */
.deck-table { min-width: 640px; }

/* ---------- 修复：轮播圆点 20px 触点（视觉 10px） ---------- */
.banner-dot {
  width: 20px; height: 20px; background: transparent;
  position: relative; border-radius: 50%;
}
.banner-dot::after {
  content: ""; position: absolute; inset: 5px; border-radius: 50%;
  background: rgba(232, 224, 208, 0.4);
}
.banner-dot.active::after, .banner-dot[aria-current="true"]::after { background: var(--gold); }

/* ---------- 微调：PDF 链接字号 ---------- */
.qa-link small { font-size: var(--fs-2); }

/* 轮播圆点点击脉冲（每次点击必有可感知反馈） */
.banner-dot.pulse::after { animation: dotpulse 0.45s ease; }
@keyframes dotpulse { 50% { transform: scale(1.6); background: var(--accent-hi); } }

/* ---------- 修复v2：卡组表格移动端一律不换行，横向滚动查看 ---------- */
@media (max-width: 700px) {
  .deck-table { min-width: 0; font-size: var(--fs-2); }
  .deck-table th, .deck-table td { white-space: nowrap; }
  .deck-table td { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
  .deck-table td.code-cell { max-width: none; }
}

/* 觉醒统帅角标（左下，与右下类型角标对称） */
.card-awaken {
  position: absolute; bottom: 6px; left: 6px;
  padding: 1px 7px; border-radius: var(--r-s);
  background: rgba(138, 107, 181, 0.92); color: #f0e6d2;
  font-size: var(--fs-1); font-weight: 700; letter-spacing: 0.1em;
}
