/* ==========================================================================
   xiuche.xyz — 冷灰读数台
   Token 只在这里定义；组件规则只引用 var()。
   ========================================================================== */

:root {
  /* 调色板（按角色） */
  --bg: #101416;
  --surface: #171d20;
  --surface-2: #1e2529;
  --text: #e8ebe9;
  --text-muted: #9aa6a7;
  --accent: #4ad3c8;
  --accent-ink: #06201e;
  --accent-dim: #2b6f6b;
  --flag: #c32020;
  --flag-ink: #fff5f5;
  --border: #2a3337;
  --border-strong: #3b464a;
  --ring: #4ad3c8;
  --ok: #5fbf7f;
  --shadow-1: rgba(0, 0, 0, 0.35);
  --shadow-2: rgba(0, 0, 0, 0.5);

  /* 字号 */
  --fs-base: 16px;
  --fs-small: 13px;
  --fs-micro: 11px;
  --fs-figure: 32px;
  --fs-figure-sm: 20px;

  /* 间距 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* 圆角 / 动效 */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --dur: 140ms;
  --dur-slow: 220ms;

  /* 容器 */
  --container: 720px;
  --container-wide: 1140px;

  /* 字体族 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas,
    "DejaVu Sans Mono", "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding-bottom: 112px; /* 固定 CTA 的底部预留 */
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

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

/* --- 标题层级 ---------------------------------------------------------- */

h1 {
  font-size: 38px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}

h2 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin: var(--space-6) 0 var(--space-3);
}

h3 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  margin: var(--space-5) 0 var(--space-2);
}

p,
ul,
ol,
dl,
table {
  margin: 0 0 var(--space-4);
}

ul,
ol {
  padding-left: 1.35em;
}

li {
  margin-bottom: var(--space-1);
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
}

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

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

strong {
  font-weight: 700;
  color: var(--text);
}

/* --- 排版工具类 -------------------------------------------------------- */

.micro {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--space-2);
}

.figure {
  font-family: var(--font-mono);
  font-size: var(--fs-figure);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.05;
  color: var(--accent);
  display: block;
}

.figure--sm {
  font-size: var(--fs-figure-sm);
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: var(--fs-small);
}

.flag {
  color: var(--flag);
}

.flag-chip {
  display: inline-block;
  padding: 1px var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--flag);
  color: var(--flag-ink);
  font-size: var(--fs-micro);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  vertical-align: middle;
}

.chip {
  display: inline-block;
  padding: 1px var(--space-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--fs-micro);
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
}

.rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

/* --- 布局 -------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--space-4);
}

.wrap--wide {
  max-width: var(--container-wide);
}

.band {
  padding-block: var(--space-7);
  border-top: 1px solid var(--border);
}

.band--tight {
  padding-block: var(--space-6);
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose h2:first-child,
.prose h3:first-child {
  margin-top: 0;
}

.lede {
  font-size: var(--fs-base);
  line-height: 1.8;
  color: var(--text);
  max-width: 62ch;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}

/* --- 顶栏 -------------------------------------------------------------- */

.topline {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease);
}

.topline.is-stuck {
  border-bottom-color: var(--border-strong);
}

.topline__inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.topline__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--text);
  flex: 0 0 auto;
}

.topline__brand img {
  width: 132px;
  height: 30px;
}

.topline__brand:hover {
  color: var(--text);
  text-decoration: none;
}

.topline__tag {
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.topline__nav {
  margin-left: auto;
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
}

.topline__nav::-webkit-scrollbar {
  display: none;
}

.topline__nav a {
  color: var(--text-muted);
  font-size: var(--fs-small);
  padding: var(--space-2) var(--space-3);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: var(--radius-sm);
}

.topline__nav a:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--surface-2);
}

/* --- 读数格 ------------------------------------------------------------ */

.readout {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border-block: 1px solid var(--border);
}

.readout__cell {
  background: var(--bg);
  padding: var(--space-4) var(--space-3) var(--space-4) 0;
}

.readout__cell:not(:first-child) {
  padding-left: var(--space-3);
}

.readout__cell p {
  margin: var(--space-2) 0 0;
  font-size: var(--fs-small);
  color: var(--text-muted);
}

/* --- 首页 hero --------------------------------------------------------- */

.hero {
  padding-block: var(--space-7) var(--space-6);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-7);
  align-items: start;
}

.hero__brand p:last-child {
  margin-bottom: 0;
}

.hero__readout {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.hero__readout .readout__cell {
  background: var(--surface);
  padding: var(--space-4);
}

.verdict {
  border-block: 1px solid var(--border-strong);
  padding-block: var(--space-4);
  font-size: var(--fs-base);
  font-weight: 700;
}

/* --- 编号台账 ---------------------------------------------------------- */

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
}

.ledger caption {
  text-align: left;
  font-size: var(--fs-small);
  color: var(--text-muted);
  padding-bottom: var(--space-2);
}

.ledger th,
.ledger td {
  text-align: left;
  padding: var(--space-3) var(--space-3) var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.ledger thead th {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom-color: var(--border-strong);
  font-weight: 600;
}

.ledger td:first-child {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  width: 3.2em;
}

.ledger tbody tr:hover {
  background: var(--surface);
}

.ledger .col-sample {
  color: var(--text-muted);
}

/* --- 筛选与跳转 -------------------------------------------------------- */

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-4);
}

.tools label {
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.tools input[type="text"],
.tools input[type="number"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  padding: var(--space-2) var(--space-3);
  min-height: 44px;
  min-width: 12em;
}

.tools input:hover {
  border-color: var(--border-strong);
}

.btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-small);
  padding: var(--space-2) var(--space-4);
  min-height: 44px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.btn:hover {
  border-color: var(--border-strong);
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint {
  font-size: var(--fs-small);
  color: var(--text-muted);
  min-height: 1.6em;
  margin: var(--space-2) 0 0;
}

.hint[data-state="miss"] {
  color: var(--flag);
}

.hint[data-state="hit"] {
  color: var(--accent);
}

.row--hidden {
  display: none;
}

/* --- 标签行 ------------------------------------------------------------ */

.tagrow {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
}

.tagrow li {
  margin: 0;
}

/* --- 对照块 ------------------------------------------------------------ */

.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.pair > dl {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--surface);
  margin: 0;
}

.pair dt {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pair dd {
  margin: var(--space-2) 0 0;
}

.pair dd > :last-child {
  margin-bottom: 0;
}

/* --- 编号行（省级页用） ------------------------------------------------ */

.numlist {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4);
  border-top: 1px solid var(--border);
}

.numlist li {
  display: grid;
  grid-template-columns: 4.5em minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  margin: 0;
}

.numlist b {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent);
}

/* --- 卡片（少量使用） -------------------------------------------------- */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.card h3 {
  margin-top: 0;
}

.card p:last-child {
  margin-bottom: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

/* --- FAQ --------------------------------------------------------------- */

.faq {
  border-top: 1px solid var(--border);
}

.faq details {
  border-bottom: 1px solid var(--border);
}

.faq summary {
  cursor: pointer;
  padding: var(--space-4) 0;
  min-height: 44px;
  font-weight: 700;
  list-style: none;
  display: flex;
  gap: var(--space-3);
  align-items: baseline;
}

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

.faq summary::before {
  content: "\25B8";
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.faq details[open] > summary::before {
  content: "\25BE";
  color: var(--accent);
}

.faq details[open] > summary {
  color: var(--accent);
}

.faq .faq__body {
  padding: 0 0 var(--space-5) var(--space-5);
}

.faq .faq__body p:last-child {
  margin-bottom: 0;
}

/* --- 内链组 ------------------------------------------------------------ */

.jump {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.jump h3 {
  margin-top: 0;
}

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

.jump li {
  margin-bottom: var(--space-2);
}

/* --- 页脚 -------------------------------------------------------------- */

.foot {
  border-top: 1px solid var(--border-strong);
  background: var(--surface);
  padding-block: var(--space-7) var(--space-6);
  font-size: var(--fs-small);
}

.foot__cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.foot__cols h3 {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--space-3);
}

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

.foot__cols li {
  margin-bottom: var(--space-2);
}

.foot__cols a {
  color: var(--text-muted);
}

.foot__cols a:hover {
  color: var(--accent);
  text-decoration: none;
}

.foot__base {
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: space-between;
  color: var(--text-muted);
}

.foot__trust {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
}

.foot__brand {
  margin: var(--space-4) 0 0;
}

.foot__base a {
  color: var(--text);
  font-weight: 700;
}

.foot__brand a {
  color: var(--text);
  font-weight: 700;
}

/* --- 固定 CTA ---------------------------------------------------------- */

.site-cta {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(480px, calc(100vw - 28px));
  min-height: 60px;
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px var(--shadow-2);
  text-align: center;
  text-decoration: none;
  animation: cta-breathe 3.2s var(--ease) infinite;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.site-cta:hover,
.site-cta:focus-visible {
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 12px 30px var(--shadow-2);
}

.site-cta:active {
  transform: translateX(-50%) translateY(0);
}

@keyframes cta-breathe {
  0%,
  100% {
    box-shadow: 0 8px 24px var(--shadow-2);
  }
  50% {
    box-shadow: 0 10px 30px var(--shadow-2), 0 0 0 6px rgba(74, 211, 200, 0.12);
  }
}

/* --- 平板 -------------------------------------------------------------- */

@media (max-width: 1199px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
  }

  .cards,
  .jump {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .foot__cols {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 899px) {
  .readout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .readout__cell {
    padding-left: var(--space-3);
  }

  .ledger .col-sample {
    display: none;
  }

  .pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .cards,
  .jump {
    grid-template-columns: minmax(0, 1fr);
  }

  .foot__cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* --- 移动端 ------------------------------------------------------------ */

@media (max-width: 640px) {
  :root {
    --fs-figure: 26px;
  }

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 21px;
  }

  h3 {
    font-size: 17px;
  }

  body {
    padding-bottom: 124px;
  }

  .topline__inner {
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
  }

  .topline__brand img {
    width: 110px;
    height: 25px;
  }

  .topline__tag {
    display: none;
  }

  .topline__nav {
    margin-left: 0;
    width: 100%;
  }

  .band {
    padding-block: var(--space-6);
  }

  .readout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .numlist li {
    grid-template-columns: 3.4em minmax(0, 1fr);
  }

  .site-cta {
    left: 14px;
    right: 14px;
    width: auto;
    transform: none;
    font-size: 16px;
    min-height: 56px;
    margin-bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
  }

  .site-cta:hover,
  .site-cta:focus-visible {
    transform: translateY(-2px);
  }

  .site-cta:active {
    transform: translateY(0);
  }

  .foot__cols {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- 降级 -------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
