/* ============================================================
   四喜娱乐 · /assets/site.css
   共享外壳：reset / 设计令牌 / 中文排版 / 头部 / 页脚 / 基础组件
   ============================================================ */

/* ---------- 1. reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, h5, p, ul, ol, li, figure, blockquote, dl, dd { margin: 0; }
ul, ol { list-style: none; padding: 0; }
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
table { width: 100%; border-collapse: collapse; }
::selection { background: var(--gold); color: var(--ink); }

/* ---------- 2. 设计令牌 ---------- */
:root {
  --ink: #1A1A2E;
  --ink-deep: #0E0E1A;
  --paper: #F7F5F2;
  --white: #FFFFFF;
  --red: #D7263D;
  --gold: #F4A259;
  --gold-text: #B26A1F;
  --mint: #2EC4B6;
  --mist: #C9C6D1;
  --graphite: #4A4A5E;
  --gold-soft: #FBE3C8;
  --red-soft: #F6D6DA;

  --bg: var(--paper);
  --surface: var(--white);
  --text: var(--ink);
  --muted: var(--graphite);
  --line: var(--mist);
  --bar-bg: var(--paper);
  --bar-line: var(--mist);
  --on-dark: var(--paper);
  --on-dark-muted: rgba(247, 245, 242, 0.68);
  --hair: rgba(255, 255, 255, 0.10);

  --font-display: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --rail-w: 240px;
  --bar-h: 64px;
  --content-max: 1240px;
  --gap: 24px;
}

:root[data-theme="night"] {
  --bg: var(--ink-deep);
  --surface: var(--ink);
  --text: var(--paper);
  --muted: var(--mist);
  --line: rgba(201, 198, 209, 0.28);
  --bar-bg: var(--ink-deep);
  --bar-line: rgba(201, 198, 209, 0.28);
}

/* ---------- 3. 基础排版与容器 ---------- */
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  padding-left: var(--rail-w);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(34px, 4.6vw, 60px); font-weight: 900; }
h2 { font-size: clamp(26px, 3vw, 34px); }
h3 { font-size: 22px; }
p { max-width: 68ch; }

:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.brand-rail :focus-visible,
.site-footer :focus-visible { outline-color: var(--gold); }

#main-content { display: block; padding-top: var(--bar-h); }
[id] { scroll-margin-top: calc(var(--bar-h) + 24px); }

.container { width: min(var(--content-max), 100% - 48px); margin-inline: auto; }

.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--red);
  color: var(--white);
  font-weight: 700;
  letter-spacing: 0.04em;
  transform: translateY(-220%);
  transition: transform 0.18s ease-out;
}
.skip-link:focus { transform: translateY(0); }

/* ---------- 4. 头部 ---------- */
.site-header { position: relative; z-index: 60; }

.brand-rail {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--rail-w);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 26px 20px 24px;
  background-color: var(--ink);
  background-image: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 8px);
  color: var(--on-dark);
  border-right: 1px solid var(--hair);
  overflow-y: auto;
}

.rail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand__marks {
  display: grid;
  grid-template-columns: repeat(2, 10px);
  grid-template-rows: repeat(2, 10px);
  gap: 3px;
  flex: none;
  transition: transform 0.18s ease-out;
}
.brand:hover .brand__marks { transform: rotate(90deg); }
.brand__mark { display: block; width: 100%; height: 100%; }
.brand__mark--red { background: var(--red); }
.brand__mark--gold { background: var(--gold); }
.brand__mark--mint { background: var(--mint); }
.brand__mark--paper { background: var(--paper); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-family: var(--font-display); font-weight: 900; font-size: 19px; letter-spacing: 0.02em; }
.brand__sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; opacity: 0.62; }
.brand--footer { margin-bottom: 18px; }

.rail-tagline { font-size: 13px; line-height: 1.6; color: var(--on-dark-muted); letter-spacing: 0.02em; }

.nav-toggle { display: none; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid rgba(255, 255, 255, 0.28); font-size: 13px; font-weight: 700; letter-spacing: 0.06em; }
.nav-toggle__bars { display: flex; flex-direction: column; gap: 3px; width: 16px; }
.nav-toggle__bars span { display: block; height: 2px; background: currentColor; transition: transform 0.18s ease-out, opacity 0.18s ease-out; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

.rail-nav { flex: 1 1 auto; min-height: 0; }
.rail-nav__list { display: flex; flex-direction: column; gap: 2px; }
.rail-nav__item { display: block; }
.rail-nav__link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  border-left: 2px solid transparent;
  color: var(--on-dark-muted);
  background-image: linear-gradient(90deg, rgba(215, 38, 61, 0.55), rgba(215, 38, 61, 0.06));
  background-repeat: no-repeat;
  background-position: left center;
  background-size: 0% 100%;
  transition: background-size 0.18s ease-out, color 0.18s ease-out, border-color 0.18s ease-out, background-color 0.18s ease-out;
}
.rail-nav__link:hover { color: var(--paper); background-color: rgba(255, 255, 255, 0.06); }
.rail-nav__link[aria-current="page"] {
  color: var(--white);
  font-weight: 700;
  border-left-color: var(--red);
  background-size: 100% 100%;
}
.rail-nav__num { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; color: var(--gold); min-width: 22px; }
.rail-nav__label { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }
.rail-nav__note { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: rgba(247, 245, 242, 0.44); padding-left: 12px; margin-top: 12px; }

.rail-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--hair); display: flex; flex-direction: column; gap: 10px; }
.rail-foot .rail-nav__note { margin-top: 0; padding-left: 0; }
.rail-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--on-dark-muted); }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(46, 196, 182, 0.22);
  flex: none;
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(46, 196, 182, 0.22); }
  50% { box-shadow: 0 0 0 6px rgba(46, 196, 182, 0.08); }
}

.top-bar {
  position: fixed;
  top: 0; left: var(--rail-w); right: 0;
  height: var(--bar-h);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--bar-line);
}

.tag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0;
}
.tag-row::-webkit-scrollbar { display: none; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  flex: none;
  transition: transform 0.18s ease-out, border-color 0.18s ease-out, background-color 0.18s ease-out, color 0.18s ease-out;
}
.tag::before { content: ""; width: 8px; height: 8px; background: var(--mist); flex: none; }
.tag--red::before { background: var(--red); }
.tag--gold::before { background: var(--gold); }
.tag--mint::before { background: var(--mint); }
.tag--ink::before { background: var(--ink); }
.tag:hover { background: var(--gold); border-color: var(--gold); color: var(--ink); transform: translateY(-2px); }
.tag:hover::before { background: var(--ink); }
.tag[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.tag[aria-current="page"]::before { background: var(--red); }

.quick-find {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: var(--ink);
  border: 1px solid var(--ink);
  color: var(--paper);
  white-space: nowrap;
  flex: none;
  transition: background-color 0.18s ease-out, border-color 0.18s ease-out;
}
.quick-find__hint { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; color: var(--gold); }
.quick-find__keys { font-size: 13px; color: rgba(247, 245, 242, 0.78); }
.quick-find:hover { background: var(--red); border-color: var(--red); }
.quick-find:hover .quick-find__hint { color: var(--white); }

.top-bar__utils { display: flex; align-items: center; gap: 10px; flex: none; }
.util-link {
  font-size: 14px;
  font-weight: 700;
  padding: 7px 4px;
  border-bottom: 2px solid transparent;
  transition: color 0.18s ease-out, border-color 0.18s ease-out;
}
.util-link:hover { color: var(--red); border-bottom-color: var(--red); }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: border-color 0.18s ease-out, color 0.18s ease-out;
}
.theme-toggle:hover { border-color: var(--ink); color: var(--text); }
.theme-toggle__icon {
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(90deg, var(--ink) 50%, transparent 50%);
  border: 1px solid var(--ink);
}
.theme-toggle[aria-pressed="true"] .theme-toggle__icon {
  background: linear-gradient(90deg, transparent 50%, var(--gold) 50%);
  border-color: var(--gold);
}

.scroll-progress {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.12s linear;
}

.to-top {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--paper);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.18s ease-out, transform 0.18s ease-out, background-color 0.18s ease-out, visibility 0.18s;
}
.to-top[data-visible="true"] { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--red); }
.to-top__mark {
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 8px solid var(--gold);
  flex: none;
}

/* ---------- 5. 页脚 ---------- */
.site-footer {
  margin-top: 96px;
  background: var(--ink);
  color: var(--on-dark);
}
.site-footer::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--red) 0 25%, var(--gold) 25% 50%, var(--mint) 50% 75%, var(--paper) 75% 100%);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.3fr;
  gap: 40px 24px;
  width: min(var(--content-max), 100% - 48px);
  margin: 0 auto;
  padding: 64px 0 48px;
}
.footer-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin-bottom: 16px;
}
.footer-claim { font-size: 14px; line-height: 1.75; color: var(--on-dark-muted); max-width: 34ch; }
.footer-legal { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; color: rgba(247, 245, 242, 0.5); margin-top: 18px; }
.footer-links li + li { margin-top: 10px; }
.footer-links a {
  font-size: 15px;
  color: rgba(247, 245, 242, 0.82);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.18s ease-out, border-color 0.18s ease-out;
}
.footer-links a:hover { color: var(--white); border-bottom-color: var(--red); }
.footer-contact { display: flex; flex-direction: column; }
.footer-contact__item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--hair);
}
.footer-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--gold);
  min-width: 34px;
}
.footer-value { flex: 1 1 auto; min-width: 0; font-size: 13px; color: rgba(247, 245, 242, 0.88); word-break: break-all; }
.copy-btn {
  margin-left: auto;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: background-color 0.18s ease-out, border-color 0.18s ease-out, color 0.18s ease-out;
}
.copy-btn:hover { border-color: var(--mint); background: var(--mint); color: var(--ink); }
.copy-btn[data-state] { border-color: var(--mint); background: var(--mint); color: var(--ink); }
.footer-note { font-size: 12px; line-height: 1.8; color: rgba(247, 245, 242, 0.52); margin-top: 14px; max-width: 40ch; }
.footer-note a { color: var(--gold); border-bottom: 1px solid rgba(244, 162, 89, 0.5); }
.footer-note a:hover { color: var(--paper); }
.footer-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(var(--content-max), 100% - 48px);
  margin: 0 auto;
  padding: 20px 0 34px;
  border-top: 1px solid var(--hair);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: rgba(247, 245, 242, 0.6);
}
.footer-copy { max-width: none; }
.footer-base__links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-base__links a:hover { color: var(--gold); }

/* ---------- 6. 基础组件 ---------- */
.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.rule { height: 1px; background: var(--line); border: 0; margin: 32px 0; }
.stack > * + * { margin-top: 16px; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot--red { background: var(--red); }
.dot--gold { background: var(--gold); }
.dot--mint { background: var(--mint); }

.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  transition: transform 0.18s ease-out, background-color 0.18s ease-out, border-color 0.18s ease-out, color 0.18s ease-out;
}
.btn:hover { transform: translateY(-2px); }
.btn--red { background: var(--red); border-color: var(--red); color: var(--white); }
.btn--red:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn--ghost { background: transparent; border-color: var(--ink); color: var(--text); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); }
.btn--mint { background: var(--mint); border-color: var(--mint); color: var(--ink); }
.btn--mint:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn__icon { width: 16px; height: 16px; flex: none; }

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform 0.18s ease-out, border-color 0.18s ease-out;
}
.card:hover { transform: translateY(-2px); border-color: var(--ink); }
.card--red { background: var(--red-soft); border-color: var(--red); }
.card--gold { background: var(--gold-soft); border-color: var(--gold); }
.card--ink { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.card--red .card__title, .card--red .card__body, .card--gold .card__title, .card--gold .card__body { color: var(--ink); }
.card--ink .card__title { color: var(--paper); }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card__title { font-family: var(--font-display); font-size: 20px; font-weight: 800; }
.card__body { font-size: 15px; line-height: 1.75; color: var(--muted); }
.card--ink .card__body { color: var(--on-dark-muted); }
.card__meta { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--muted); }
.card--ink .card__meta { color: var(--gold); }

.section { padding: 72px 0; }
.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.section__title { font-size: clamp(24px, 2.6vw, 32px); }

.chapter { position: relative; }
.chapter__num {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--red);
  margin-bottom: 6px;
}
.chapter__title { font-size: clamp(22px, 2.4vw, 28px); }
.chapter__meta { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--muted); }

.page-head { padding: 56px 0 24px; }
.page-title { font-size: clamp(32px, 5vw, 56px); }
.page-lead { margin-top: 16px; font-size: 18px; line-height: 1.75; color: var(--muted); }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.2em; color: var(--red); }

.frame {
  position: relative;
  padding: clamp(24px, 4vw, 56px);
  background: var(--surface);
  border: 1px solid var(--ink);
}
.frame::before,
.frame::after {
  content: "";
  position: absolute;
  width: 24px; height: 24px;
  border: 2px solid var(--red);
}
.frame::before { top: -6px; left: -6px; border-right: 0; border-bottom: 0; }
.frame::after { bottom: -6px; right: -6px; border-left: 0; border-top: 0; }

.panel { padding: 20px; background: var(--ink); border: 1px solid var(--ink); color: var(--paper); }
.panel__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--hair);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.panel__row:last-child { border-bottom: 0; }
.panel__key { color: rgba(247, 245, 242, 0.6); letter-spacing: 0.06em; }
.panel__val { color: var(--paper); text-align: right; }
.panel__val--ok { color: var(--mint); }
.panel__val--hot { color: var(--gold); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.badge--red { background: var(--red-soft); border-color: var(--red); color: var(--ink); }
.badge--gold { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-text); }
.badge--mint { background: rgba(46, 196, 182, 0.16); border-color: var(--mint); color: var(--ink); }

.media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--ink);
  border: 1px solid var(--line);
}
.media--square { aspect-ratio: 1 / 1; }
.media--wide { aspect-ratio: 21 / 9; }
.media--tall { aspect-ratio: 4 / 5; }
.media--red { background: linear-gradient(135deg, var(--red), var(--gold)); }
.media--gold { background: linear-gradient(135deg, var(--gold), var(--red-soft)); }
.media--mint { background: linear-gradient(135deg, var(--mint), var(--ink)); }
.media--ink { background: linear-gradient(135deg, var(--ink), var(--ink-deep)); }
.media img, .media video, .media svg { width: 100%; height: 100%; object-fit: cover; }
.media__caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(14, 14, 26, 0), rgba(14, 14, 26, 0.88));
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.media__label {
  position: absolute;
  top: 12px; left: 12px;
  padding: 4px 10px;
  background: var(--red);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.breadcrumb { padding-top: 20px; }
.breadcrumb__list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.breadcrumb__item { display: inline-flex; align-items: center; }
.breadcrumb__item + .breadcrumb__item::before { content: "/"; margin-right: 8px; color: var(--mist); }
.breadcrumb__link { color: var(--muted); transition: color 0.18s ease-out; }
.breadcrumb__link:hover { color: var(--red); }

.toc { position: sticky; top: calc(var(--bar-h) + 24px); }
.toc__title { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; color: var(--muted); margin-bottom: 12px; }
.toc__list { border-left: 1px solid var(--line); }
.toc__link {
  display: block;
  margin-left: -1px;
  padding: 7px 12px;
  border-left: 2px solid transparent;
  font-size: 14px;
  color: var(--muted);
  transition: color 0.18s ease-out, border-color 0.18s ease-out, background-color 0.18s ease-out;
}
.toc__link:hover { color: var(--text); }
.toc__link.is-active {
  color: var(--red);
  font-weight: 700;
  border-left-color: var(--red);
  background-image: linear-gradient(90deg, rgba(215, 38, 61, 0.12), rgba(215, 38, 61, 0));
}

/* 夜间主题下的浅色卡片 */
:root[data-theme="night"] .card--red { background: rgba(215, 38, 61, 0.18); border-color: var(--red); color: var(--paper); }
:root[data-theme="night"] .card--gold { background: rgba(244, 162, 89, 0.16); border-color: var(--gold); color: var(--paper); }
:root[data-theme="night"] .card--red .card__title,
:root[data-theme="night"] .card--red .card__body,
:root[data-theme="night"] .card--gold .card__title,
:root[data-theme="night"] .card--gold .card__body { color: var(--paper); }
:root[data-theme="night"] .card--red .card__body,
:root[data-theme="night"] .card--gold .card__body { color: rgba(247, 245, 242, 0.78); }

/* ---------- 7. 响应式 ---------- */
@media (max-width: 1180px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1100px) and (min-width: 961px) {
  :root { --rail-w: 200px; }
  .brand-rail { padding: 22px 16px; }
  .rail-nav__label { font-size: 14px; }
}

@media (max-width: 1024px) {
  .col-3, .col-4 { grid-column: span 6; }
  .col-8 { grid-column: span 12; }
}

@media (max-width: 960px) {
  body { padding-left: 0; }
  #main-content { padding-top: 104px; }
  [id] { scroll-margin-top: 124px; }

  .brand-rail {
    top: 0; left: 0; right: 0; bottom: auto;
    width: auto;
    height: 56px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--hair);
    background-image: none;
  }
  .rail-head { flex: 1 1 auto; align-items: center; }
  .brand__sub, .rail-tagline, .rail-foot { display: none; }
  .nav-toggle { display: inline-flex; }

  .rail-nav {
    position: fixed;
    top: 56px; left: 0; right: 0;
    flex: 0 0 auto;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    padding: 12px 16px 22px;
    background: var(--ink);
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease-out, transform 0.18s ease-out, visibility 0.18s;
  }
  .rail-nav[data-open="true"] { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }
  .rail-nav__link { padding: 12px; }
  .rail-nav__note { display: none; }

  .top-bar { top: 56px; left: 0; right: 0; height: 48px; padding: 0 12px; gap: 10px; }
  .tag { font-size: 14px; padding: 6px 12px; }
  .quick-find { padding: 6px 12px; }
  .quick-find__keys { display: none; }
  .util-link { display: none; }
  .theme-toggle__text { display: none; }
  .theme-toggle { padding: 8px; }

  .to-top { right: 14px; bottom: 14px; padding: 10px 12px; }
  .toc { position: static; }
}

@media (max-width: 640px) {
  .container { width: calc(100% - 32px); }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; width: calc(100% - 32px); padding: 44px 0 32px; }
  .footer-base { width: calc(100% - 32px); flex-direction: column; align-items: flex-start; }
  .col-3, .col-4, .col-6 { grid-column: span 12; }
  .section { padding: 52px 0; }
  .section__head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-head { padding: 36px 0 18px; }
  .card { padding: 20px; }
  .site-footer { margin-top: 64px; }
  .to-top { right: 12px; bottom: 12px; font-size: 12px; }
}

/* ---------- 8. 动效与可访问性 ---------- */
.is-js [data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}
.is-js [data-reveal].is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .is-js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .brand:hover .brand__marks { transform: none; }
  .card:hover, .btn:hover, .tag:hover { transform: none; }
  .status-dot { animation: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
