/* TokenKing — 视觉系统
   墨黑底 · 一点金 · 衬线标题 · 等宽数据 */

@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("/portal/fonts/instrument-serif.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url("/portal/fonts/instrument-serif-italic.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("/portal/fonts/jetbrains-mono.woff2") format("woff2"); }

:root {
  --ink: #0b0c0f;
  --ink-2: #111318;
  --ink-3: #171a20;
  --ink-4: #1f232b;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #ece8df;
  --text-2: #b4b1a8;
  --text-3: #7d7f88;
  --gold: #e2bd63;
  --gold-2: #f3d78a;
  --gold-dim: rgba(226, 189, 99, 0.14);
  --ok: #7ed3a1;
  --bad: #ef7f7f;
  --serif: "Instrument Serif", "Songti SC", "Noto Serif SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: clamp(20px, 5vw, 64px);
  --max: 1160px;
  --radius: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--ink); color: var(--text);
  font: 15px/1.6 var(--sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column;
}
code, pre, kbd { font-family: var(--mono); font-feature-settings: "liga" 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
::selection { background: var(--gold); color: var(--ink); }

/* ---------- 背景 ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 45% at 70% -10%, rgba(226, 189, 99, 0.13), transparent 70%),
    radial-gradient(40% 30% at 10% 10%, rgba(120, 140, 200, 0.08), transparent 70%),
    var(--ink);
}
.backdrop::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.055) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent 70%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent 70%);
}

/* ---------- 页眉 ---------- */
.masthead {
  max-width: var(--max); width: 100%; margin: 0 auto;
  padding: 22px var(--gutter) 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
  font-family: var(--serif); font-size: 26px; letter-spacing: -0.01em; line-height: 1;
}
.wordmark em { font-style: italic; color: var(--gold); }
.wordmark-crown { width: 26px; height: 26px; fill: var(--gold); }
.masthead-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.nav-key { font-size: 12.5px; color: var(--text-2); }
.nav-meta { font-size: 12px; color: var(--text-3); }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); letter-spacing: 0.02em; margin-right: 6px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); position: relative; }
.status[data-state="online"] .status-dot { background: var(--ok); box-shadow: 0 0 0 0 rgba(126, 211, 161, 0.5); animation: pulse 2.4s var(--ease) infinite; }
.status[data-state="online"] .status-text { color: var(--text-2); }
.status[data-state="offline"] .status-dot { background: var(--bad); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(126, 211, 161, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(126, 211, 161, 0); } 100% { box-shadow: 0 0 0 0 rgba(126, 211, 161, 0); } }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: 12.5px; color: var(--text-2); background: rgba(255,255,255,0.02);
  transition: border-color .2s, color .2s, background .2s;
}
.chip:hover { border-color: var(--gold); color: var(--text); }
.chip code { font-size: 12px; }
.chip-ghost { border-color: transparent; color: var(--text-3); }
.chip-ghost:hover { border-color: var(--line-strong); }

/* ---------- 主体 ---------- */
main { flex: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* 入口 */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr); grid-template-areas: "copy form" "facts form";
  gap: 0 clamp(32px, 6vw, 96px); align-items: start;
  padding: clamp(64px, 11vh, 132px) 0 clamp(56px, 8vh, 96px);
  animation: rise .7s var(--ease) both;
}
.eyebrow { margin: 0 0 22px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
h1 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: clamp(40px, 4.8vw, 64px); line-height: 1.08; letter-spacing: -0.015em;
}
h1 em { font-style: italic; color: var(--gold-2); }
.lede { margin: 26px 0 0; max-width: 34em; font-size: 16.5px; color: var(--text-2); }
.hero-copy { grid-area: copy; }
.hero-facts { grid-area: facts; list-style: none; margin: 40px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, auto)); justify-content: start; gap: 24px 36px; }
.hero-facts li { display: flex; flex-direction: column; gap: 4px; }
.hero-facts b, .hero-facts a.fact-link { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1; color: var(--text); font-variant-numeric: lining-nums; text-decoration: none; }
.hero-facts a.fact-link { color: var(--gold-2); border-bottom: 1px dashed rgba(226,189,99,0.5); width: fit-content; }
.hero-facts a.fact-link:hover { color: var(--text); border-bottom-style: solid; }
.hero-facts span { font-size: 12.5px; color: var(--text-3); letter-spacing: 0.01em; max-width: 17em; }

.caveat {
  grid-area: caveat; grid-column: 1 / -1; margin-top: clamp(20px, 4vh, 44px);
  padding: 22px 26px; border: 1px solid var(--line); border-left: 2px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0; background: var(--ink-2);
  font-size: 13.5px; color: var(--text-2); line-height: 1.8;
}
.caveat-title { margin: 0 0 10px; font-family: var(--serif); font-size: 20px; color: var(--text); letter-spacing: 0.01em; }
.caveat p { margin: 0; }
.caveat p + p { margin-top: 8px; }
.caveat a { color: var(--gold-2); text-decoration: none; border-bottom: 1px dashed rgba(226,189,99,0.45); }
.caveat a:hover { border-bottom-style: solid; }

.keyform {
  grid-area: form; position: relative; margin-top: 18px; align-self: start;
  padding: 26px 26px 22px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.06);
}
.keyform::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(226,189,99,0.35), transparent 40%, transparent 60%, rgba(226,189,99,0.12));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; padding: 1px;
}
.keyform-label { display: block; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px; }
.keyform-field { position: relative; display: flex; }
.keyform-field input {
  flex: 1; width: 100%; height: 50px; padding: 0 48px 0 16px;
  background: var(--ink); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 10px;
  font: 500 14.5px/1 var(--mono); letter-spacing: 0.02em;
  transition: border-color .2s, box-shadow .2s;
}
.keyform-field input::placeholder { color: var(--text-3); }
.keyform-field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-dim); }
.keyform[data-invalid] .keyform-field input { border-color: var(--bad); animation: shake .35s var(--ease); }
.iconbtn { position: absolute; right: 6px; top: 6px; width: 38px; height: 38px; border-radius: 8px; color: var(--text-3); display: grid; place-items: center; }
.iconbtn:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.iconbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn .ico-eye-off { display: none; }
.iconbtn[aria-pressed="true"] .ico-eye { display: none; }
.iconbtn[aria-pressed="true"] .ico-eye-off { display: block; }

.primary {
  margin-top: 12px; width: 100%; height: 50px; border-radius: 10px;
  background: var(--gold); color: #1a1508; font-weight: 600; font-size: 15px; letter-spacing: 0.04em;
  position: relative; overflow: hidden;
  transition: transform .15s var(--ease), background .2s, filter .2s;
}
.primary:hover { background: var(--gold-2); }
.primary:active { transform: translateY(1px); }
.primary[disabled] { cursor: progress; filter: saturate(0.6); }
.btn-busy { position: absolute; inset: 0; display: none; place-items: center; }
.btn-busy::after { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(26,21,8,0.25); border-top-color: #1a1508; animation: spin .8s linear infinite; }
.primary[disabled] .btn-label { visibility: hidden; }
.primary[disabled] .btn-busy { display: grid; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.keyform-error { margin: 12px 0 0; font-size: 13px; color: var(--bad); }
.keyform-hint { margin: 14px 0 0; font-size: 12.5px; color: var(--text-3); }

/* 工作台 */
.workspace { padding: 28px 0 64px; animation: rise .6s var(--ease) both; }

.block {
  display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px clamp(24px, 4vw, 64px);
  padding: 44px 0; border-top: 1px solid var(--line);
}
.workspace > .block:first-child { border-top: 0; padding-top: 16px; }
.block-head { position: relative; }
.block-index { display: block; font-family: var(--serif); font-size: 15px; letter-spacing: 0.1em; color: var(--gold); margin-bottom: 12px; }
.block-head h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.1; letter-spacing: -0.01em; }
.block-note { margin: 14px 0 0; font-size: 13.5px; color: var(--text-3); line-height: 1.6; }
.block-note span { color: var(--text); font-family: var(--serif); font-size: 17px; }
.block-body { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.empty { margin: 0; padding: 28px 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--text-3); font-size: 14px; text-align: center; }
.notice { margin: 0; padding: 12px 16px; border-radius: 10px; background: var(--gold-dim); color: var(--gold-2); font-size: 13.5px; }

/* 01 模型 */
.models { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.model {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 14px;
  padding: 14px 16px; border-radius: 12px; cursor: pointer;
  background: var(--ink-2); border: 1px solid var(--line);
  transition: border-color .2s, background .2s, transform .2s var(--ease);
}
.model:hover { border-color: var(--line-strong); background: var(--ink-3); }
.model[aria-checked="true"] { border-color: rgba(226,189,99,0.55); background: linear-gradient(180deg, rgba(226,189,99,0.08), rgba(226,189,99,0.02)); }
.model-mark { grid-row: 1 / 3; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--text-3); position: relative; transition: border-color .2s; }
.model-mark::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--gold); transform: scale(0); transition: transform .2s var(--ease); }
.model[aria-checked="true"] .model-mark { border-color: var(--gold); }
.model[aria-checked="true"] .model-mark::after { transform: scale(1); }
.model-vendor { grid-column: 2; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.model-id { grid-column: 2; font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.model-selected { grid-column: 3; grid-row: 1 / 3; font-size: 11.5px; color: var(--gold); opacity: 0; transition: opacity .2s; }
.model[aria-checked="true"] .model-selected { opacity: 1; }

/* 02 接入 */
.endpoints { border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink-2); overflow: hidden; }
.endpoint-base { display: flex; align-items: center; gap: 18px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.endpoint-label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.endpoint-url { display: inline-flex; align-items: center; gap: 14px; text-align: left; border-radius: 8px; padding: 4px 8px; margin: -4px -8px; transition: background .2s; }
.endpoint-url:hover { background: rgba(255,255,255,0.04); }
.endpoint-url code { font-size: clamp(15px, 2vw, 19px); font-weight: 500; color: var(--gold-2); letter-spacing: -0.01em; }
.endpoint-url .dim { color: var(--text-2); font-weight: 400; }
.copy-hint { font-size: 11.5px; color: var(--text-3); opacity: 0; transition: opacity .2s; }
.endpoint-url:hover .copy-hint { opacity: 1; }
.endpoint-list { list-style: none; margin: 0; padding: 6px 0; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; }
.endpoint-list li { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; gap: 16px; align-items: baseline; padding: 10px 20px; font-size: 13px; }
.endpoint-list li + li { border-top: 1px solid var(--line); }
.endpoint-list code { color: var(--text); font-size: 13px; white-space: nowrap; }
.endpoint-list span { color: var(--text-2); }
.endpoint-list em { font-style: normal; font-family: var(--mono); font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

.snippets { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--ink-2); }
.snippet-tabs { display: flex; align-items: center; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.snippet-tabs::-webkit-scrollbar { display: none; }
.snippet-tabs [role="tab"] { height: 32px; padding: 0 13px; border-radius: 8px; font-size: 13px; color: var(--text-3); white-space: nowrap; transition: color .2s, background .2s; }
.snippet-tabs [role="tab"]:hover { color: var(--text); }
.snippet-tabs [role="tab"][aria-selected="true"] { color: var(--text); background: var(--ink-4); }
.snippet-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; padding: 0 6px; cursor: pointer; user-select: none; }
.snippet-toggle input { appearance: none; width: 30px; height: 17px; border-radius: 999px; background: var(--ink-4); border: 1px solid var(--line-strong); position: relative; margin: 0; cursor: pointer; transition: background .2s, border-color .2s; }
.snippet-toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--text-3); transition: transform .2s var(--ease), background .2s; }
.snippet-toggle input:checked { background: var(--gold-dim); border-color: var(--gold); }
.snippet-toggle input:checked::after { transform: translateX(13px); background: var(--gold); }
.snippet-toggle:has(input:checked) span { color: var(--gold-2); }
.snippet-frame { position: relative; }
.snippet-meta { display: flex; align-items: center; gap: 12px; padding: 10px 16px 0; font-size: 12px; color: var(--text-3); }
.snippet-file { font-family: var(--mono); }
.snippet-model { font-family: var(--mono); color: var(--gold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snippet-meta .chip { margin-left: auto; height: 26px; padding: 0 10px; font-size: 12px; }
.snippet { margin: 0; padding: 14px 18px 20px; overflow-x: auto; font-size: 13px; line-height: 1.7; color: var(--text-2); tab-size: 2; }
.snippet code { display: block; min-width: max-content; }
.snippet .k { color: var(--gold-2); }        /* key / 高亮值 */
.snippet .s { color: #c8d7a5; }              /* 字符串 */
.snippet .c { color: var(--text-3); }        /* 注释 */
.snippet .m { color: #a9c6e8; }              /* 模型 */

.ccswitch {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 32px; align-items: center;
  padding: 22px 24px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(226,189,99,0.10), rgba(226,189,99,0.03) 60%, transparent); border: 1px solid rgba(226,189,99,0.28);
}
.ccswitch h3 { margin: 0 0 8px; font-family: var(--serif); font-weight: 400; font-size: 24px; letter-spacing: -0.01em; }
.ccswitch p { margin: 0; font-size: 13.5px; color: var(--text-2); max-width: 40em; }
.ccswitch p code { font-size: 12.5px; color: var(--gold-2); }
.ccswitch p b { color: var(--text); font-weight: 600; }
.ccswitch-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.import {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left;
  min-width: 190px; padding: 12px 16px; border-radius: 12px;
  background: var(--ink); border: 1px solid var(--line-strong);
  transition: border-color .2s, transform .2s var(--ease), box-shadow .2s;
}
.import:hover { border-color: var(--gold); transform: translateY(-1px); box-shadow: 0 12px 30px -16px rgba(226,189,99,0.5); }
.import:active { transform: translateY(0); }
.import-app { font-weight: 600; font-size: 14.5px; }
.import-app::before { content: "↗ "; color: var(--gold); }
.import-desc { font-size: 11.5px; color: var(--text-3); }
.ccswitch-note { grid-column: 1 / -1; font-size: 12.5px !important; color: var(--text-3) !important; }

/* 03 调用记录：账本占满整行 */
#block-usage { grid-template-columns: 1fr; gap: 28px; }
#block-usage .block-head { display: flex; align-items: baseline; gap: 18px 28px; flex-wrap: wrap; }
#block-usage .block-index { margin: 0; }
#block-usage .block-note { margin: 0; flex-basis: 100%; }
@media (min-width: 961px) { #block-usage .block-note { flex-basis: auto; margin-left: auto; text-align: right; } }

.stats { margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stats div { background: var(--ink-2); padding: 16px 20px; }
.stats dt { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.stats dd { margin: 6px 0 0; font-family: var(--serif); font-size: 32px; line-height: 1; color: var(--text); font-variant-numeric: lining-nums tabular-nums; }
.stats dd small { font-family: var(--sans); font-size: 12px; color: var(--text-3); margin-left: 4px; }
.stats dd.good { color: var(--ok); }
.stats dd.warn { color: var(--bad); }

.ledger-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; background: var(--ink-2); }
.ledger { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.ledger th { position: sticky; top: 0; z-index: 1; background: var(--ink-3); text-align: left; font-weight: 500; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); padding: 11px 14px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.ledger td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.ledger tbody tr:last-child td { border-bottom: 0; }
.ledger tbody tr { transition: background .15s; }
.ledger tbody tr:hover { background: rgba(255,255,255,0.025); }
.ledger tbody tr.is-failed td { color: var(--text-2); }
.ledger .num { text-align: right; font-family: var(--mono); font-size: 12.5px; }
.ledger .t-time time { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.ledger .t-time time .d { color: var(--text-3); margin-right: 6px; }
.ledger .t-time.is-new time::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); margin-right: 8px; vertical-align: middle; }
.ledger .t-model code { font-size: 12.5px; color: var(--text); }
.ledger .t-model .vendor { color: var(--text-3); }
.ledger .t-proto span { font-size: 12px; color: var(--text-2); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ok); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.bad { color: var(--bad); }
.ledger .t-in b, .ledger .t-out b { font-weight: 500; display: block; }
.ledger .t-in small, .ledger .t-out small { display: block; font-size: 10.5px; color: var(--text-3); line-height: 1.3; }
.ledger .t-in small:empty, .ledger .t-out small:empty { display: none; }
.ledger .t-total { color: var(--text); font-weight: 500; }

/* 页脚 */
.colophon {
  max-width: var(--max); width: 100%; margin: 0 auto; padding: 28px var(--gutter) 36px;
  display: flex; flex-wrap: wrap; gap: 10px 28px; justify-content: space-between;
  border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-3);
}
.colophon-year { font-family: var(--serif); letter-spacing: 0.08em; }

/* 提示 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 999px; font-size: 13px;
  background: var(--text); color: var(--ink); box-shadow: 0 20px 40px -20px rgba(0,0,0,0.8);
  transition: opacity .25s, transform .3s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; grid-template-areas: "copy" "form" "facts" "caveat"; padding-top: clamp(40px, 8vh, 72px); }
  .keyform { max-width: 520px; margin-top: 32px; }
  .hero-facts { margin-top: 36px; }
  .block { grid-template-columns: 1fr; gap: 20px; padding: 36px 0; }
  .block-head h2 { font-size: 30px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .ccswitch { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .masthead .chip-copy { display: none; }
  h1 { font-size: clamp(36px, 10vw, 48px); }
  .hero-facts { grid-template-columns: 1fr 1fr; gap: 20px 24px; }
  .keyform { padding: 20px 18px 18px; }
  .endpoint-list { grid-template-columns: 1fr; }
  .endpoint-list li { gap: 2px; }
  .endpoint-list em { justify-self: start; }
  .import { min-width: 0; flex: 1; }
  .nav-meta { display: none; }

  /* 账本改为卡片 */
  .ledger thead { display: none; }
  .ledger, .ledger tbody { display: block; }
  .ledger tr {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 12px; align-items: end;
    grid-template-areas: "time time status" "model model model" "proto proto lat" "in out total";
    padding: 14px 16px; border-bottom: 1px solid var(--line);
  }
  .ledger tbody tr:last-child { border-bottom: 0; }
  .ledger td { display: block; padding: 0; border: 0; white-space: normal; text-align: left; }
  .ledger .t-time { grid-area: time; }
  .ledger .t-status { grid-area: status; justify-self: end; }
  .ledger .t-model { grid-area: model; font-size: 14px; margin: 2px 0 4px; }
  .ledger .t-model code { font-size: 14px; }
  .ledger .t-proto { grid-area: proto; }
  .ledger .t-latency { grid-area: lat; justify-self: end; color: var(--text-2); }
  .ledger .t-in { grid-area: in; } .ledger .t-out { grid-area: out; } .ledger .t-total { grid-area: total; }
  .ledger .t-in, .ledger .t-out, .ledger .t-total { align-self: start; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--line); }
  .ledger .t-in::before, .ledger .t-out::before, .ledger .t-total::before { display: block; font-family: var(--sans); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); margin-bottom: 2px; }
  .ledger .t-in::before { content: "输入"; } .ledger .t-out::before { content: "输出"; } .ledger .t-total::before { content: "合计"; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
