/* ============================================================
   CoinNav Design System
   Tokens → Base → Layout → Components → Utilities
   ============================================================ */

/* ========== Design Tokens ========== */
:root {
  /* Accent（青绿色：专业工具感，替代交易所橙） */
  --accent: #37b7a0;
  --accent-soft: rgba(55, 183, 160, .10);
  --accent-line: rgba(55, 183, 160, .30);
  --accent-ink: #06201c;

  /* Semantic */
  --success: #37b7a0;
  --danger: #f2726f;
  --link: #58a6ff;

  /* Radius */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 12px;
  --r-full: 999px;

  /* Spacing（4/8 基础体系） */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s8: 48px; --s10: 64px;

  /* Layout */
  --sidebar-w: 240px;
  --content-max: 1440px;

  /* Type */
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #0b1017;
  --bg-subtle: #0f1620;
  --card: #151d28;
  --card-hover: #1a2330;
  --elevated: #1a2330;
  --text: #edf2f7;
  --text-2: #93a1b4;
  --text-3: #65758b;
  --line: #26313f;
  --line-strong: #33455a;
  --chip: rgba(255, 255, 255, .045);
  --chip-hover: rgba(255, 255, 255, .08);
  --bg-hero: none;
}
html[data-theme="light"] {
  --bg: #f7f9fb;
  --bg-subtle: #eef2f6;
  --card: #ffffff;
  --card-hover: #f8fafc;
  --elevated: #ffffff;
  --text: #16202b;
  --text-2: #55657a;
  --text-3: #8394a8;
  --line: #dbe3ec;
  --line-strong: #b9c6d4;
  --chip: rgba(0, 0, 0, .035);
  --chip-hover: rgba(0, 0, 0, .06);
  --bg-hero: none;
}

/* ========== Reset & Base ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
section.cat, .detail-main, .d-card { scroll-margin-top: 62px; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}

a { color: inherit; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--s4); }

/* ========== Icon Wrapper（线性 SVG 图标统一尺寸与基线） ========== */
.i {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; vertical-align: -0.15em;
}
.i svg { width: 1.05em; height: 1.05em; display: block; }
.cat-ico .i svg, .dom-ico .i svg, .side-card h3 .i svg { width: 1.15em; height: 1.15em; }
.s-dom .i { margin-right: 2px; }
.s-dom .i svg { width: 12px; height: 12px; }
.s-item .i svg { width: 14px; height: 14px; }
.s-item .i { margin-right: 7px; opacity: .85; }

/* ========== Sidebar Navigation ========== */
.snav {
  position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w);
  background: var(--bg-subtle); border-right: 1px solid var(--line);
  z-index: 100; display: flex; flex-direction: column;
  padding: var(--s4) var(--s3); overflow-y: auto;
}
.s-logo {
  display: flex; align-items: center; gap: var(--s2);
  text-decoration: none; color: var(--text);
  padding: var(--s1) var(--s2) var(--s5);
}
.s-logo .logo-badge {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.s-logo b { font-size: 15px; font-weight: 600; }
.s-nav { flex: 1; display: flex; flex-direction: column; gap: 1px; }
/* 领域分组（details 折叠） */
.s-group { margin-top: var(--s2); }
.s-group:first-of-type { margin-top: var(--s2); }
.s-dom {
  display: flex; align-items: center; gap: var(--s1);
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3);
  padding: 6px var(--s2); cursor: pointer; border-radius: var(--r-sm);
  list-style: none; user-select: none;
  transition: color .15s, background .15s;
}
.s-dom::-webkit-details-marker { display: none; }
.s-dom:hover { color: var(--text); background: var(--chip); }
.sd-t { flex: 1; }
.sd-c {
  font-size: 9px; color: var(--text-3); transition: transform .18s;
}
.s-group[open] .sd-c { transform: rotate(90deg); }
.s-group[open] .s-dom { color: var(--text-2); }
.s-sub { display: flex; flex-direction: column; gap: 1px; padding-top: 1px; }
.s-item.sub { padding-left: var(--s5); font-size: 13px; }
.s-item {
  display: flex; align-items: center; gap: var(--s2);
  padding: 7px var(--s3); border-radius: var(--r-md);
  color: var(--text-2); text-decoration: none;
  font-size: 13.5px; transition: background .15s, color .15s;
}
.s-item:hover { color: var(--text); background: var(--chip-hover); }
.s-item.on {
  color: var(--text); background: var(--chip);
  font-weight: 500;
  box-shadow: inset 2px 0 0 var(--accent);
}
.s-foot { padding-top: var(--s4); font-size: 11px; color: var(--text-3); border-top: 1px solid var(--line); }

.main-col { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.main-col > .wrap, .main-col > footer { width: 100%; }
.main-col > footer { margin-top: auto; }

html[dir="rtl"] .snav { left: auto; right: 0; border-right: 0; border-left: 1px solid var(--line); }
html[dir="rtl"] .main-col { margin-left: 0; margin-right: var(--sidebar-w); }

/* ========== Mobile Topbar ========== */
.mtop {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s2) var(--s4);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.mtop .burger {
  display: none; background: none; border: 0; color: var(--text);
  font-size: 18px; cursor: pointer; padding: var(--s1) var(--s2);
  border-radius: var(--r-sm);
}
.mtop .burger:hover { background: var(--chip); }
.mt-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
.mt-sp { flex: 1; }

.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 99; }

/* ========== Price Ticker ========== */
.ticker-wrap { border-bottom: 1px solid var(--line); background: var(--card); }
.ticker {
  display: flex; gap: var(--s6); overflow-x: auto; white-space: nowrap;
  padding: var(--s2) var(--s4); scrollbar-width: none;
}
.ticker::-webkit-scrollbar { display: none; }
.tk { font-size: 12.5px; color: var(--text-2); flex: none; }
.tk b { color: var(--text); font-weight: 600; margin-right: var(--s1); }
.tk i { font-style: normal; color: var(--text); margin-right: var(--s1); }
.tk .up { color: var(--success); }
.tk .down { color: var(--danger); }

/* ========== Hero / Search ========== */
.hero { padding: var(--s8) 0 var(--s6); background: var(--bg-hero); }
.hero-title {
  text-align: center; font-size: 24px; font-weight: 600;
  letter-spacing: -.02em; color: var(--text);
}
.hero-sub { text-align: center; margin-top: var(--s2); color: var(--text-2); font-size: 13.5px; }
.hero-sub b { color: var(--accent); font-weight: 600; }

/* 搜索面板：默认只露搜索框，聚焦后展开建议 + 引擎（渐进披露） */
.search-wrap { position: relative; max-width: 560px; margin: var(--s4) auto 0; }
.search-box {
  position: relative; display: flex; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 0 var(--s4); height: 44px;
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap.open .search-box,
.search-wrap:focus-within .search-box {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(247, 147, 26, .12);
}
.search-ico { color: var(--text-3); flex: none; }
#search {
  flex: 1; height: 100%; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 14px; padding: 0 var(--s2);
}
#search::placeholder { color: var(--text-3); }
.search-clear {
  border: 0; background: var(--chip); color: var(--text-3);
  width: 20px; height: 20px; border-radius: var(--r-full); cursor: pointer;
  font-size: 10px; flex: none;
}
.search-clear:hover { color: var(--text); }

.sugg {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 70;
  background: var(--elevated); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.sugg[hidden] { display: none; }
.sugg-item {
  display: flex; align-items: baseline; gap: var(--s2);
  padding: 8px var(--s3); text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.sugg-item:last-child { border-bottom: 0; }
.sugg-item.on, .sugg-item:hover { background: var(--chip-hover); }
.si-n { font-size: 13.5px; font-weight: 500; flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-d { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.engines { display: flex; gap: var(--s1); justify-content: center; margin-top: 8px; }
.search-wrap:not(.open):not(:focus-within) .engines { display: none; }
.eng {
  border: 1px solid transparent; background: transparent;
  color: var(--text-3); border-radius: var(--r-full);
  padding: 4px 14px; font-size: 12.5px; cursor: pointer;
  transition: color .15s, background .15s;
}
.eng:hover { color: var(--text); background: var(--chip); }
.eng.on { color: var(--accent); background: var(--accent-soft); font-weight: 500; }

.hot { text-align: center; margin-top: var(--s3); font-size: 12.5px; color: var(--text-3); }
.hot-tag {
  border: 1px solid transparent; background: var(--chip); color: var(--text-2);
  border-radius: var(--r-full); padding: 4px 12px; margin-left: 6px;
  font-size: 12px; cursor: pointer; transition: all .15s;
}
.hot-tag:hover { color: var(--text); background: var(--chip-hover); }

/* ========== Category Chips ========== */
.chips-bar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.chips {
  display: flex; gap: var(--s1); overflow-x: auto;
  padding: var(--s2) var(--s4); scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: var(--s1);
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  border-radius: var(--r-full); padding: 5px 12px; font-size: 13px;
  text-decoration: none; cursor: pointer; transition: all .15s;
}
.chip:hover { color: var(--text); background: var(--chip-hover); }
.chip.active {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent-line); font-weight: 500;
}

/* ========== Explore：六大领域入口 ========== */
.explore { padding: var(--s2) 0 0; }
.explore .wrap {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s2);
}
.dom-card {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s3);
  text-decoration: none; color: var(--text);
  transition: background .15s, border-color .15s;
}
.dom-card:hover { background: var(--card-hover); border-color: var(--text-3); }
.dom-card.fav-card { cursor: pointer; font: inherit; text-align: start; }
.dom-ico { font-size: 17px; line-height: 1.2; }
.dom-card b { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.dom-cats {
  font-size: 11px; color: var(--text-3); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dom-n {
  margin-top: auto; font-size: 11px; color: var(--accent);
  background: var(--accent-soft); border-radius: var(--r-full); padding: 1px 8px;
}

/* ========== Category Sections ========== */
section.cat {
  padding-top: var(--s6);
  content-visibility: auto;
  contain-intrinsic-size: auto 600px;
}
.cat-head { display: flex; align-items: baseline; gap: var(--s2); margin-bottom: var(--s3); }
.cat-ico { font-size: 16px; }
.cat-head h2 { font-size: 16px; font-weight: 600; }
.cat-desc { color: var(--text-3); font-size: 12.5px; }
.cat-count {
  color: var(--text-3); font-size: 11.5px;
  background: var(--chip); border-radius: var(--r-full); padding: 1px 8px;
}
.view-all {
  margin-left: auto; font-size: 12.5px; font-weight: 500;
  color: var(--accent); text-decoration: none; white-space: nowrap;
}
.view-all:hover { text-decoration: underline; }

/* 首页每类默认只展示前 6 张；搜索/收藏模式展开全部（卡片仍全量预渲染，SEO 不受损） */
.grid .card.extra { display: none; }
body.searching .grid .card.extra,
body.fav-only .grid .card.is-fav { display: grid; }

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

/* ========== Cards ========== */
.card {
  position: relative; display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s2) var(--s3);
  align-items: start;
  min-width: 0;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s3);
  text-decoration: none; color: var(--text);
  transition: background .15s, border-color .15s;
}
.card:hover { background: var(--card-hover); border-color: var(--text-3); }
.card .card-meta { grid-column: 2; }
.card .c-foot { grid-column: 1 / -1; }

.avatar {
  flex: none; width: 38px; height: 38px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; color: #fff;
  background: hsl(var(--h, 200), 28%, 38%);
  border: 1px solid rgba(255, 255, 255, .08);
}
html[data-theme="light"] .avatar { border-color: rgba(0, 0, 0, .06); }

.card-meta { min-width: 0; flex: 1; }
.card-name {
  font-size: 13.5px; font-weight: 600; display: flex;
  align-items: center; flex-wrap: wrap; gap: 0 6px; padding-right: 20px;
}
.card-name .nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-name .dom {
  flex: 0 1 auto; min-width: 0; max-width: 100%;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: -.01em;
  color: var(--text-3); font-weight: 400;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-desc {
  margin-top: 3px; font-size: 12.5px; color: var(--text-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.c-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
}
.c-foot .det { color: var(--text-2); cursor: pointer; }
.card:hover .c-foot .det { color: var(--text); }
.c-foot .go {
  color: var(--accent); font-weight: 500; cursor: pointer;
  padding: 2px 6px; margin-right: -6px; border-radius: var(--r-sm);
}
.c-foot .go:hover { background: var(--accent-soft); }
.c-foot .go:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.fav {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; border-radius: var(--r-sm);
  border: 0; background: transparent; color: var(--text-3);
  font-size: 14px; cursor: pointer; opacity: 0;
  transition: opacity .15s, color .15s; line-height: 1;
}
.card:hover .fav, .fav.on { opacity: 1; }
.fav:hover { color: var(--accent); background: var(--chip); }
.fav.on { color: var(--accent); }

/* ========== Search Result / Empty ========== */
.result-bar {
  margin-top: var(--s5); padding: var(--s2) var(--s4);
  background: var(--chip); border-radius: var(--r-md);
  font-size: 13px; color: var(--text-2);
}
.result-bar b { color: var(--accent); font-weight: 600; }
.empty { text-align: center; padding: 80px 0 60px; color: var(--text-3); }
.empty-tip { font-size: 13px; margin-top: var(--s2); }
.empty-sugg { margin-top: var(--s3); display: flex; gap: var(--s1); flex-wrap: wrap; justify-content: center; }

/* ⌘K 快捷键提示 */
.kbd {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 2px 6px; flex: none; white-space: nowrap;
  background: var(--chip);
}
.kbd[hidden] { display: none; }

/* ========== Footer ========== */
.footer {
  margin-top: var(--s10); border-top: 1px solid var(--line);
  padding: var(--s6) 0 var(--s8); text-align: center;
}
.footer-links a {
  color: var(--text-2); text-decoration: none; margin: 0 6px;
  display: inline-block; font-size: 13px;
}
.footer-links a:hover { color: var(--accent); }
.disclaimer {
  margin: var(--s4) auto 0; max-width: 720px;
  font-size: 12px; color: var(--text-3); line-height: 1.8;
}
.copyright { margin-top: var(--s3); font-size: 12px; color: var(--text-3); }

/* ========== Back to Top ========== */
.back-top {
  position: fixed; right: var(--s5); bottom: var(--s5); z-index: 60;
  width: 40px; height: 40px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--card); color: var(--text-2);
  font-size: 16px; cursor: pointer; opacity: 0; pointer-events: none;
  transition: opacity .2s, background .15s;
}
.back-top.show { opacity: 1; pointer-events: auto; }
.back-top:hover { background: var(--chip-hover); color: var(--text); }

/* ========== Favorite Mode ========== */
body.fav-only section.cat { display: none; }
body.fav-only section.cat.has-fav { display: block; }
body.fav-only .card { display: none; }
body.fav-only .card.is-fav { display: grid; }

/* ========== Detail Page ========== */
.detail-main { padding-top: var(--s5); }
.crumbs { font-size: 12.5px; color: var(--text-3); margin-bottom: var(--s4); }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

.detail-cols {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--s5); align-items: start;
}
.detail-side { position: sticky; top: var(--s4); }

.d-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s6);
}
.d-head { display: flex; gap: var(--s4); align-items: center; }
.d-head .avatar { width: 52px; height: 52px; font-size: 22px; border-radius: var(--r-lg); flex: none; }
.d-title { font-size: 20px; font-weight: 600; line-height: 1.3; }
.d-pos { margin-top: 3px; font-size: 14px; color: var(--text-2); }
.d-dom { margin-top: 2px; font-size: 12.5px; color: var(--text-3); }

.d-tags { margin-top: var(--s4); display: flex; gap: var(--s1); flex-wrap: wrap; }
.d-tag {
  font-size: 12px; color: var(--text-2); background: var(--chip);
  border: 1px solid var(--line); padding: 3px 10px; border-radius: var(--r-full);
}

.url-row {
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  margin-top: var(--s4); padding: var(--s2) var(--s3);
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg);
}
.url-row .d-dom { font-size: 13px; color: var(--text); }
.copy-btn {
  border: 1px solid var(--line); background: var(--card);
  color: var(--text-2); border-radius: var(--r-sm);
  padding: 4px 10px; font-size: 12px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.copy-btn:hover { color: var(--text); border-color: var(--text-3); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }
.updated { margin-left: auto; font-size: 11.5px; color: var(--text-3); }

.d-note {
  margin-top: var(--s2); padding: var(--s2) var(--s3);
  font-size: 12px; line-height: 1.7; color: var(--text-3);
  background: var(--chip); border-radius: var(--r-md);
  border-left: 2px solid var(--line-strong);
}

.d-sec { margin-top: var(--s6); }
.d-sec h3 {
  font-size: 14px; font-weight: 600; margin-bottom: var(--s3);
  color: var(--text); display: flex; align-items: center; gap: var(--s2);
}
.d-sec h3::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px;
  background: var(--accent);
}
.d-sec p { font-size: 13.5px; line-height: 1.9; color: var(--text-2); }
.d-p2 { margin-top: var(--s3); font-size: 13.5px; line-height: 1.9; color: var(--text-2); }

.d-feats { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s2); }
.d-feats li {
  font-size: 13px; color: var(--text); background: var(--chip);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px 12px;
}

.d-info { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.d-info .row { display: flex; border-bottom: 1px solid var(--line); font-size: 13px; }
.d-info .row:last-child { border-bottom: 0; }
.d-info .row span {
  width: 100px; flex: none; padding: 9px var(--s4);
  color: var(--text-2); background: var(--bg-subtle);
}
.d-info .row b { padding: 9px var(--s4); font-weight: 400; }
.d-info .row a { color: var(--link); text-decoration: none; }
.d-info .row a:hover { text-decoration: underline; }

.d-btns { margin-top: var(--s5); }
.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 9px 24px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; text-decoration: none;
  border: 1px solid var(--line); transition: all .15s;
}
.btn-primary {
  background: var(--accent); color: #fff; border-color: transparent;
}
.btn-primary:hover { background: #e08415; }
.btn-primary:active { background: #d07810; }
.btn-ghost { color: var(--text-2); background: var(--chip); }
.btn-ghost:hover { color: var(--text); background: var(--chip-hover); }

.d-safe-line { margin-top: var(--s4); font-size: 12px; color: var(--text-3); line-height: 1.8; }

/* ========== Related Sites ========== */
.d-rel { margin-top: var(--s8); }
.d-rel h2 { font-size: 16px; font-weight: 600; margin-bottom: var(--s3); }
.rel-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--s2);
}
.rel-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--s3);
  text-decoration: none; color: var(--text);
  transition: background .15s, border-color .15s;
}
.rel-card:hover { background: var(--card-hover); border-color: var(--text-3); }
.rel-card .rc-head { display: flex; align-items: center; gap: var(--s2); }
.rel-card .rc-head .avatar { width: 30px; height: 30px; font-size: 13px; border-radius: var(--r-sm); flex: none; }
.rel-card .rc-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-card .rc-desc { font-size: 12px; color: var(--text-2); line-height: 1.55; }
.rel-card .rc-more { margin-top: auto; padding-top: 6px; font-size: 12px; color: var(--accent); font-weight: 500; }

/* ========== Star Button (Detail) ========== */
.d-head { position: relative; }
.star-btn {
  margin-left: auto; flex: none;
  width: 40px; height: 40px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--bg);
  color: var(--text-3); font-size: 18px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.star-btn:hover { color: var(--accent); border-color: var(--accent-line); }
.star-btn.on { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }

/* ========== FAQ ========== */
.faq-list { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: 0; }
.faq-item summary {
  cursor: pointer; list-style: none;
  padding: var(--s3) var(--s4); font-size: 13.5px; font-weight: 500; color: var(--text);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "+ "; color: var(--accent); font-weight: 700; }
.faq-item[open] summary::before { content: "\2212 "; }
.faq-item[open] summary { background: var(--bg-subtle); }
.faq-a { padding: var(--s2) var(--s4) var(--s3); font-size: 13px; line-height: 1.9; color: var(--text-2); }

/* ========== Detail Sidebar ========== */
.detail-side { position: sticky; top: var(--s4); }
.side-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s4); margin-bottom: var(--s4);
}
.side-card h3 {
  font-size: 13.5px; font-weight: 600; margin-bottom: var(--s3);
  display: flex; align-items: center; gap: var(--s2); color: var(--text);
}
.side-card h3::before {
  content: ""; width: 3px; height: 12px; border-radius: 2px;
  background: var(--accent);
}
.side-p { font-size: 12.5px; line-height: 1.9; color: var(--text-2); }

.pick-box { display: flex; flex-direction: column; gap: var(--s1); }
.pick-card {
  display: flex; gap: var(--s2); align-items: center;
  padding: 6px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--text);
  transition: background .15s;
}
.pick-card:hover { background: var(--chip-hover); }
.pick-card .avatar { width: 28px; height: 28px; font-size: 12px; border-radius: var(--r-sm); flex: none; }
.pk-m { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pk-m b { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-m i { font-style: normal; font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-2); text-decoration: none;
  border: 1px solid var(--line); background: var(--chip);
  border-radius: var(--r-full); padding: 3px 10px;
  transition: color .15s, border-color .15s;
}
.tchip i { font-style: normal; font-size: 10.5px; opacity: .6; }
.tchip:hover { color: var(--text); border-color: var(--text-3); }

/* ========== Topic Page ========== */
.topic-title { font-size: 20px; margin-bottom: var(--s4); }
.topic-intro p { font-size: 13.5px; line-height: 1.95; color: var(--text-2); margin-bottom: var(--s2); }
.topic-intro { margin-top: var(--s4); }

/* ========== Language Switch ========== */
.lang-switch { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.lang-switch a {
  font-size: 12px; color: var(--text-2); text-decoration: none;
  border: 1px solid var(--line); background: var(--chip);
  border-radius: var(--r-full); padding: 3px 10px; white-space: nowrap;
  transition: all .15s;
}
.lang-switch a:hover { color: var(--text); background: var(--chip-hover); }
.lang-switch a.on {
  color: #fff; background: var(--accent); border-color: transparent;
  font-weight: 500;
}

.lang-switch a:focus-visible, .eng:focus-visible, .hot-tag:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* ========== 404 / Not Found ========== */
.d-none { text-align: center; padding: 80px 0; color: var(--text-3); }

/* ========== Category Page ========== */

/* ========== Topbar (Detail / Non-Shell Pages) ========== */
.topbar-wrap {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  padding: var(--s2) 0;
}
.topbar-wrap .wrap { display: flex; align-items: center; justify-content: space-between; }
.logo { display: inline-flex; align-items: center; gap: var(--s2); text-decoration: none; color: var(--text); }
.logo .logo-badge { width: 26px; height: 26px; font-size: 14px; border-radius: var(--r-sm); }
.logo-text { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.logo-text i { font-style: normal; font-size: 11px; font-weight: 400; color: var(--text-3); margin-left: 6px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.theme-btn {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--chip);
  cursor: pointer; font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.theme-btn:hover { background: var(--chip-hover); border-color: var(--text-3); }

/* ========== Responsive ========== */
@media (max-width: 1023px) {
  .snav, html[dir="rtl"] .snav { transform: translateX(-100%); transition: transform .2s; }
  html[dir="rtl"] .snav { transform: translateX(100%); }
  body.show-nav .snav, html[dir="rtl"] body.show-nav .snav { transform: none; }
  .main-col, html[dir="rtl"] .main-col { margin-left: 0 !important; margin-right: 0 !important; }
  .burger { display: inline-flex !important; }
  .scrim {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 99;
  }
  body.show-nav .scrim { display: block; }
  .detail-cols { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .explore .wrap { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 640px) {
  .lang-switch a { padding: 3px 8px; font-size: 11px; }
  .hero-title { font-size: 20px; }
  .hero { padding: var(--s5) 0 var(--s5); }
  .logo-text i { display: none; }
  .explore .wrap { grid-template-columns: repeat(2, 1fr); }
  .dom-cats { display: none; }
  .dom-card b { font-size: 13px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--s2); }
  .card { padding: var(--s3); }
  .avatar { width: 32px; height: 32px; font-size: 14px; }
  .card-name .dom { display: none; }
  .card-name { padding-right: var(--s3); }
  .card-name .nm {
    font-size: 13px; white-space: normal; overflow-wrap: anywhere; word-break: break-word;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .cat-head { flex-wrap: wrap; gap: 4px 6px; }
  .cat-head .cat-desc { display: none; }
  .search-box { height: 42px; }
  .d-card { padding: var(--s4); }
  .d-title { font-size: 18px; }
  .d-head { gap: var(--s3); }
  .d-head .avatar { width: 44px; height: 44px; font-size: 20px; }
  .d-info .row span { width: 84px; padding: var(--s2) var(--s3); }
  .d-info .row b { padding: var(--s2) var(--s3); }
  .rel-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ========== Touch / RTL refinements ========== */
@media (hover: none) {
  .fav { opacity: 1; }
}
html[dir="rtl"] .fav { right: auto; left: 8px; }
html[dir="rtl"] .card-name { padding-right: 0; padding-left: var(--s3); }
html[dir="rtl"] .s-item.on { box-shadow: inset -2px 0 0 var(--accent); }
html[dir="rtl"] .back-top { right: auto; left: var(--s5); }

/* 减少动态偏好：关闭抽屉与平滑滚动动画 */
@media (prefers-reduced-motion: reduce) {
  .snav, html[dir="rtl"] .snav { transition: none; }
  html { scroll-behavior: auto; }
}
