:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-muted: #f3f4f6;
  --ink: #09090b;
  --ink-muted: #475569;
  --ink-faint: #64748b;
  --line: #e4e4e7;
  --accent: #0ea5e9;
  --accent-strong: #0369a1;
  --accent-soft: #e0f2fe;
  --danger: #b91c1c;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.07);
  --header-height: 72px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-height) + 16px); }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, white); outline-offset: 3px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
}
.nav {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: inline-flex; align-items: baseline; gap: 9px; text-decoration: none; min-height: 44px; }
.brand-mark { font-size: 20px; font-weight: 800; letter-spacing: -0.04em; }
.brand-note { color: var(--ink-faint); font-size: 13px; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a, .nav-links button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-muted);
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease;
}
.nav-links a:hover, .nav-links a[aria-current="page"], .nav-links button:hover { background: var(--surface-muted); color: var(--ink); }

.page { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 80px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); align-items: end; gap: 48px; padding: 36px 0 52px; }
.eyebrow { margin: 0 0 14px; color: var(--accent-strong); font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 740px; margin-bottom: 18px; font-size: clamp(2.4rem, 7vw, 5.6rem); line-height: .98; letter-spacing: -.07em; }
h2 { margin-bottom: 10px; font-size: clamp(1.55rem, 3vw, 2.35rem); line-height: 1.1; letter-spacing: -.04em; }
h3 { margin-bottom: 8px; font-size: 1.1rem; line-height: 1.25; }
.lede { max-width: 680px; color: var(--ink-muted); font-size: clamp(1.05rem, 2vw, 1.25rem); }
.hero-aside { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.hero-aside strong { display: block; margin-bottom: 6px; font-size: 1.25rem; }
.hero-aside p { margin-bottom: 0; color: var(--ink-muted); }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 16px 0 20px; }
.section-note { margin: 0; color: var(--ink-faint); }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.toolbar input { max-width: 280px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 0 rgba(15,23,42,.02); }
.world-card { display: flex; flex-direction: column; min-height: 230px; transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease; }
.world-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow); transform: translateY(-2px); }
.world-card p { color: var(--ink-muted); }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 18px; color: var(--ink-faint); font-size: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.tag { display: inline-flex; align-items: center; min-height: 30px; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 13px; }
.meta-line { color: var(--ink-faint); font-size: 14px; }
.empty { padding: 38px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-muted); text-align: center; }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border: 1px solid transparent; border-radius: 10px; font-weight: 700; text-decoration: none; transition: background 180ms ease, border-color 180ms ease, color 180ms ease, opacity 180ms ease; }
.button-primary { background: var(--ink); color: white; }
.button-primary:hover { background: var(--accent-strong); }
.button-accent { background: var(--accent); color: #09090b; }
.button-accent:hover { background: #38bdf8; }
.button-secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.button-secondary:hover { border-color: var(--ink-muted); background: var(--surface-muted); }
.button-danger { border-color: #fecaca; background: #fff1f2; color: var(--danger); }
.button:disabled { cursor: not-allowed; opacity: .52; }

.form-shell { width: min(560px, 100%); margin: 20px auto; }
.form-card { padding: clamp(22px, 5vw, 36px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.form-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 24px; border-radius: 12px; background: var(--surface-muted); }
.form-tabs button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-muted); font-weight: 700; }
.form-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(15,23,42,.08); }
.field { margin-bottom: 17px; }
.field label { display: block; margin-bottom: 7px; font-weight: 700; }
.field input, .field textarea, .field select, .toolbar input {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: var(--surface); color: var(--ink); transition: border-color 180ms ease, box-shadow 180ms ease;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus, .toolbar input:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 4px var(--accent-soft); outline: 0; }
.field-hint { margin: 6px 0 0; color: var(--ink-faint); font-size: 13px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; }
.error-summary { margin-bottom: 18px; padding: 12px 14px; border: 1px solid #fecaca; border-radius: 10px; background: #fff1f2; color: var(--danger); }
.error-summary:empty { display: none; }
.status { min-height: 24px; margin: 12px 0 0; color: var(--ink-muted); }

.detail-header { display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.detail-header .lede { margin-bottom: 0; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(250px, .8fr); gap: 16px; }
.list { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.list li { padding: 14px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 0; }
.list strong { display: block; margin-bottom: 3px; }
.list span { color: var(--ink-muted); }
.definition { display: grid; grid-template-columns: minmax(110px, .35fr) minmax(0, 1fr); gap: 9px 16px; margin: 0; }
.definition dt { color: var(--ink-faint); }
.definition dd { margin: 0; overflow-wrap: anywhere; }
.callout { padding: 16px; border-left: 4px solid var(--accent); background: var(--accent-soft); }
.callout p { margin-bottom: 0; }
.report-card { margin-top: 18px; }
.report-form { display: grid; grid-template-columns: minmax(150px, .35fr) minmax(0, 1fr) auto auto; align-items: center; gap: 10px; margin-top: 16px; }
.report-form select, .report-form textarea { min-height: 44px; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 10px; background: var(--surface); color: var(--ink); }
.report-form textarea { min-width: 0; resize: vertical; }
.warning-card { border-color: #7dd3fc; background: linear-gradient(135deg, #fff, #f0f9ff); }
.connector-empty { max-width: 760px; margin: 20px auto; }
.connector-empty h1 { max-width: 680px; font-size: clamp(2.25rem, 6vw, 4.8rem); }
.connector-error { max-width: 760px; margin: 20px auto; border-color: #fecaca; background: #fff7f7; }
.publish-confirm { display: grid; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.publish-confirm > label { display: flex; align-items: flex-start; gap: 10px; color: var(--ink); font-weight: 700; line-height: 1.5; }
.publish-confirm input { flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent-strong); }
.publish-preview-graph { margin-top: 18px; }
.publish-preview-data { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.preview-data-block { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-muted); }
.preview-data-block h3 { margin: 0 0 10px; font-size: 1rem; }
.preview-data-block .list { max-height: 300px; overflow: auto; padding-right: 8px; }
.preview-data-block .list li { padding: 10px 0; }
.preview-data-block .list span { display: block; overflow-wrap: anywhere; }
.workspace-switcher { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.workspace-switcher .section-note { margin: 5px 0 0; }
.workspace-picker-label { color: var(--ink-faint); font-size: 14px; font-weight: 700; }
.workspace-switcher select { min-height: 44px; min-width: 220px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }

/* ============================================================
   网页图谱（角色关系 3D + 剧情网络 3D）
   渲染核心与本地图谱屏是同一份源文件（/graph/*.js）。这里只提供宿主外观：
   1) 把本页设计系统的 token 映射成渲染核心沿用的 token 名（.graph-block 作用域）；
   2) 3D 画布容器 / 标签层 / 图例 / 搜索下拉 / 详情栏 / 提示层的样式。
   全部选择器不带 id，同一页面可安全挂多个图谱实例（发布预览 + 主图谱）。
   ============================================================ */
.world-graph-section { margin-top: 16px; }
.graph-section-head { margin-top: 0; }
.graph-block {
  --bg-canvas: #f5f5f7;
  --bg-surface: var(--surface);
  --bg-inset: var(--surface-muted);
  --bg-hover: color-mix(in srgb, var(--accent) 9%, var(--surface));
  --border: var(--line);
  --border-strong: #d4d4d8;
  --text: var(--ink);
  --text-muted: var(--ink-muted);
  --text-faint: var(--ink-faint);
  --ok-fg: #15803d;
  --warn-fg: #b45309;
  --graph-hairline: color-mix(in srgb, var(--border-strong) 68%, transparent);
  --graph-panel: color-mix(in srgb, var(--surface) 92%, transparent);
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---- 工具条（视图切换 / 世界线 / 相机预设 / 模式 / 搜索 / 动作） ---- */
.graph-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 16px 0 8px; }
.graph-toolbar-group { display: inline-flex; align-items: center; gap: 6px; }
.graph-button { min-height: 40px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-muted); font-weight: 700; font-size: 14px; transition: background 180ms ease, border-color 180ms ease, color 180ms ease; }
.graph-button:hover:not(:disabled) { border-color: var(--accent-strong); background: var(--accent-soft); color: var(--accent-strong); }
.graph-button:disabled { cursor: not-allowed; opacity: .52; }
.graph-subtab.active, .graph-subtab[aria-selected="true"] { border-color: var(--accent-strong); background: var(--accent-soft); color: var(--accent-strong); }
.graph-export-button { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.graph-worldline-wrap { display: inline-flex; align-items: center; gap: 7px; }
.graph-worldline-wrap[hidden], .graph-mode-switch[hidden], .graph-degraded[hidden], .graph-notice[hidden], .graph-empty[hidden] { display: none; }
.graph-worldline-label { color: var(--ink-faint); font-size: 14px; white-space: nowrap; }
.graph-worldline-select { min-height: 40px; min-width: 150px; max-width: 15rem; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.graph-mode-switch { display: inline-flex; align-items: center; gap: 6px; }
.graph-mode-switch .graph-button[aria-pressed="true"] { border-color: var(--accent-strong); background: var(--accent-soft); color: var(--accent-strong); }
.graph-search-wrap { position: relative; flex: 1 1 14rem; min-width: 10rem; display: block; }
.graph-search-wrap input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: var(--surface); color: var(--ink); }
.graph-search-wrap input:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 4px var(--accent-soft); outline: 0; }
.graph-search-drop { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 6; max-height: 16rem; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: 0 14px 34px rgba(15, 23, 42, .18); }
.graph-search-item { display: flex; align-items: center; gap: 8px; width: calc(100% - 8px); margin: 4px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.graph-search-item:hover, .graph-search-item.active { background: var(--surface-muted); }
.graph-search-empty { padding: 8px 12px; color: var(--ink-faint); font-size: 14px; }
.graph-status { margin: 6px 0 0; min-height: 22px; color: var(--ink-muted); font-size: 14px; }

/* ---- 画布 + 详情栏 ---- */
.graph-frame { display: grid; grid-template-columns: minmax(0, 1fr) clamp(16rem, 26%, 22rem); gap: 12px; align-items: stretch; }
/* 详情收起：把整列宽度还给画布（配合宿主在 frame 上切 data-detail-collapsed） */
.graph-frame[data-detail-collapsed="true"] { grid-template-columns: minmax(0, 1fr) 3rem; }
/* 图例 / 详情 / 聚焦徽标都悬浮在这一列内部，故宿主必须是定位容器 */
.graph-canvas-host { position: relative; min-width: 0; height: clamp(320px, 46vh, 560px); overflow: hidden; isolation: isolate; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-canvas); }
.graph-canvas-host canvas:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, white); outline-offset: -3px; }
.graph-canvas-host canvas { display: block; position: relative; z-index: 2; }
.graph-canvas-host::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 42%), linear-gradient(to bottom, rgba(255, 255, 255, .35), transparent 26%, rgba(15, 23, 42, .04)); }
.graph-labels { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.graph-view-layer { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; padding: 16px; color: var(--ink-faint); font-size: 14px; text-align: center; pointer-events: none; }
/* 一行短提示：排在画布下方（悬浮会盖住左下图例与过滤勾选框） */
.graph-canvas-help { margin: 8px 0 0; color: var(--ink-faint); font-size: 13px; line-height: 1.5; }
.graph-degraded { position: absolute; z-index: 5; left: 12px; top: 12px; max-width: min(32rem, calc(100% - 24px)); padding: 12px 14px; border: 1px solid var(--border-strong); border-left: 4px solid var(--warn-fg); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: 0 12px 30px rgba(15, 23, 42, .14); }
.graph-degraded p { margin: 0; font-size: 14px; line-height: 1.5; }
.graph-notice { position: absolute; z-index: 4; left: 12px; right: 12px; top: 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink-muted); font-size: 13px; line-height: 1.5; pointer-events: none; }
/* WebGL 不可用时降级提示占住顶部，把 0 条关系提示压到它下面，两层不重叠 */
.graph-canvas-host.is-degraded .graph-notice { top: 96px; }
.graph-empty { position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: min(32rem, calc(100% - 32px)); margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-muted); text-align: center; box-shadow: 0 14px 38px rgba(15, 23, 42, .12); }
.graph-detail { min-width: 0; max-height: clamp(320px, 46vh, 560px); display: flex; flex-direction: column; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-muted); overflow-y: auto; scrollbar-width: thin; }
.graph-detail-head { position: sticky; top: -12px; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 10px; padding: 4px 0 8px; background: linear-gradient(var(--surface-muted), var(--surface-muted) 76%, transparent); color: var(--ink-faint); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.graph-detail-toggle { min-height: 32px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-muted); font-size: 12px; }
.graph-detail-toggle:hover { border-color: var(--accent-strong); color: var(--accent-strong); }
.graph-detail.is-collapsed { flex-basis: auto; padding: 8px; overflow: hidden; }
.graph-detail.is-collapsed .graph-detail-label, .graph-detail.is-collapsed .graph-detail-body { display: none; }

/* ---- 详情内容 / 图例 / 标签 / tooltip（渲染核心生成的 DOM） ---- */
.graph-block .empty { padding: 16px; border: 1px dashed var(--line); border-radius: 10px; color: var(--ink-muted); text-align: center; font-size: 14px; }
.gdetail-name { font-size: 17px; font-weight: 700; color: var(--ink); }
.gdetail-name .gdetail-badge { margin-left: 8px; font-size: 12px; font-weight: 400; }
.gdetail-line { margin-top: 6px; color: var(--ink-muted); font-size: 13px; line-height: 1.65; }
.gdetail-sec { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.gdetail-subhead { margin: 0 0 8px; color: var(--ink-faint); font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.gdetail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.gdetail-table td { padding: 7px 4px; vertical-align: top; border-bottom: 1px solid var(--line); }
.gdetail-table td:first-child { white-space: nowrap; padding-right: 8px; }
.gdetail-link { color: var(--accent-strong); cursor: pointer; }
.gdetail-link:hover { text-decoration: underline; }
.gdetail-self { color: var(--warn-fg); }
.gdetail-badge { color: var(--accent-strong); }
.gdetail-badge.warn { color: var(--warn-fg); }
.gdetail-chips { margin-top: 4px; }
.gdetail-chip { display: inline-block; margin: 3px 6px 3px 0; padding: 3px 10px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 999px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); color: var(--ink-muted); font-size: 12px; }
.gdetail-chip:hover { border-color: var(--accent-strong); color: var(--accent-strong); }
.glegend { position: absolute; left: 12px; bottom: 12px; z-index: 3; max-width: 16rem; padding: 9px 11px; border: 1px solid var(--graph-hairline); border-radius: 12px; background: color-mix(in srgb, var(--surface) 90%, transparent); color: var(--ink-muted); font-size: 12px; user-select: none; box-shadow: 0 10px 28px rgba(15, 23, 42, .13); backdrop-filter: blur(12px); }
.glegend-row { display: flex; align-items: center; gap: 8px; margin: 0 -4px; padding: 4px; border-radius: 6px; cursor: pointer; }
.glegend-row:hover { background: var(--surface-muted); color: var(--ink); }
.glegend-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; }
.glegend-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.glegend-count { color: var(--ink-faint); font-family: var(--font-mono); font-size: 11px; }
.glegend-row.off { opacity: .45; }
.glegend-row.off .glegend-name { text-decoration: line-through; }
.glegend-empty, .glegend-note { padding: 3px 0; color: var(--ink-faint); font-size: 12px; line-height: 1.4; }
.glegend-sep { margin: 7px 0; border-top: 1px solid var(--line); }
.glegend-filters { display: flex; flex-wrap: wrap; gap: 11px; }
.glegend-filters label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.glegend-filters input { margin: 0; accent-color: var(--accent-strong); }
.glegend-line-sample { flex: 0 0 auto; width: 25px; height: 0; border-top: 2px solid var(--accent-strong); }
.glegend-line-sample.dashed { border-top-style: dashed; border-top-color: var(--ink-faint); }
.timeline-edge-row { width: 100%; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
.timeline-edge-row[aria-pressed="false"] { opacity: .45; }
.timeline-edge-row[aria-pressed="false"] .glegend-name { text-decoration: line-through; }
.graph-node-label { padding: 1px 8px; border: 1px solid color-mix(in srgb, var(--border-strong) 66%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--ink-muted); font-family: var(--font-ui); font-size: 11px; line-height: 1.55; white-space: nowrap; box-shadow: 0 3px 11px rgba(15, 23, 42, .12); backdrop-filter: blur(8px); }
.graph-node-label.major { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--ink); font-weight: 700; }
.graph-floor-label, .graph-plotline-label, .graph-gate-label, .graph-event-label, .graph-event-title { border-radius: 6px; font-family: var(--font-ui); white-space: nowrap; box-shadow: 0 3px 10px rgba(15, 23, 42, .1); }
.graph-floor-label, .graph-plotline-label { padding: 1px 8px; border: 1px solid color-mix(in srgb, var(--plotline-color, var(--accent)) 50%, var(--line)); border-radius: 999px; background: color-mix(in srgb, var(--surface) 90%, transparent); color: var(--ink); font-size: 11px; font-weight: 700; }
.graph-gate-label { padding: 1px 7px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 999px; background: color-mix(in srgb, var(--surface) 90%, transparent); color: var(--accent-strong); font-size: 10px; font-weight: 700; }
.graph-event-label, .graph-event-title { max-width: 15rem; overflow: hidden; padding: 1px 7px; border: 1px solid color-mix(in srgb, var(--border-strong) 60%, transparent); background: color-mix(in srgb, var(--surface) 86%, transparent); color: var(--ink-muted); font-size: 10px; text-overflow: ellipsis; }
.graph-event-label.stale, .graph-event-title.stale, .graph-event-stale-mark { border-color: color-mix(in srgb, var(--warn-fg) 45%, var(--line)); color: var(--warn-fg); }
.graph-event-stale-mark { padding: 1px 5px; border: 1px solid currentColor; border-radius: 5px; background: color-mix(in srgb, var(--surface) 86%, transparent); font-family: var(--font-mono); font-size: 9px; }
.graph-tooltip { position: absolute; z-index: 5; max-width: 16rem; padding: 8px 10px; border: 1px solid var(--graph-hairline); border-radius: 10px; background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--ink); font-size: 12px; line-height: 1.5; pointer-events: none; box-shadow: 0 12px 28px rgba(15, 23, 42, .2); backdrop-filter: blur(12px); }
.graph-tooltip .tt-name { font-weight: 700; }
.graph-tooltip .tt-badge { margin-left: 7px; color: var(--accent-strong); font-size: 11px; }
.graph-tooltip .tt-badge.warn { color: var(--warn-fg); }
.graph-tooltip .tt-muted { color: var(--ink-muted); font-size: 11px; }
.graph-rel-focus-badge, .graph-tl-focus-badge { position: absolute; z-index: 3; top: 12px; left: 12px; max-width: calc(100% - 24px); overflow: hidden; padding: 5px 11px; border: 1px solid color-mix(in srgb, var(--accent) 48%, var(--line)); border-radius: 999px; background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; pointer-events: none; box-shadow: 0 7px 22px rgba(15, 23, 42, .14); backdrop-filter: blur(10px); }
.graph-rel-focus-badge b, .graph-tl-focus-badge b { color: var(--accent-strong); font-weight: 700; }

/* ---- 可访问列表（完整角色/事件，不截断） ---- */
.graph-accessible { margin-top: 14px; }
.graph-accessible summary { min-height: 44px; padding: 10px 0; color: var(--ink); cursor: pointer; font-weight: 700; }
.graph-accessible-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.graph-accessible-block h3 { margin: 0 0 8px; font-size: 15px; }
.graph-accessible-list { max-height: 360px; overflow: auto; padding-right: 8px; }
.policy { width: min(820px, 100%); margin: 0 auto; }
.policy p { max-width: 680px; color: var(--ink-muted); font-size: 1.08rem; }
.drop-zone { padding: 18px; border: 1px dashed #cbd5e1; border-radius: 12px; background: var(--surface-muted); }
.token-box { margin-top: 14px; padding: 14px; border-radius: 10px; background: #18181b; color: white; overflow-wrap: anywhere; }
.token-box code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.copy-block { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.copy-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.copy-value { margin: 10px 0 0; padding: 14px; overflow-x: auto; border-radius: 10px; background: #18181b; color: #f8fafc; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.reader { width: min(800px, 100%); margin: 0 auto; }
.reader-content { max-width: 680px; margin: 0 auto; color: #1f2937; font: 18px/2 ui-serif, Georgia, Cambria, "Times New Roman", serif; white-space: pre-wrap; overflow-wrap: anywhere; }
.reader-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }
.chapter-list { display: grid; gap: 10px; margin: 0; padding-left: 28px; }
.chapter-list li { padding-left: 6px; }
.chapter-list a { color: var(--ink); text-decoration: none; }
.chapter-list a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 4px; }
.footer { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 0 0 34px; color: var(--ink-faint); font-size: 14px; }
.noscript { width: min(680px, calc(100% - 32px)); margin: 80px auto; }

@media (max-width: 800px) {
  .hero, .split { grid-template-columns: 1fr; gap: 24px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-header { flex-direction: column; }
  /* 图谱：详情栏移到画布下方（竖排），收起态恢复单列时不再预留空列 */
  .graph-frame { grid-template-columns: minmax(0, 1fr); }
  .graph-frame[data-detail-collapsed="true"] { grid-template-columns: minmax(0, 1fr); }
  .graph-detail { max-height: none; }
  .graph-detail.is-collapsed { padding: 8px 12px; }
  .graph-detail.is-collapsed .graph-detail-body { display: none; }
  .graph-detail.is-collapsed .graph-detail-label { display: inline; }
}
@media (max-width: 560px) {
  :root { --header-height: 64px; }
  .nav, .page, .footer { width: min(100% - 24px, 1180px); }
  .brand-note { display: none; }
  .nav-links a, .nav-links button { padding: 8px; font-size: 14px; }
  .page { padding-top: 28px; }
  .hero { padding-top: 16px; padding-bottom: 34px; }
  h1 { font-size: clamp(2.45rem, 15vw, 4.2rem); }
  .grid { grid-template-columns: 1fr; }
  .section-head, .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar input { max-width: none; }
  .graph-worldline-select { width: 100%; }
  .graph-canvas-host { height: clamp(280px, 52vh, 420px); }
  .graph-accessible-body { grid-template-columns: 1fr; }
  .graph-toolbar-group { flex: 1 1 auto; }
  .graph-search-wrap { flex: 1 1 100%; }
  .glegend { max-width: calc(100% - 24px); }
  .workspace-switcher { align-items: stretch; flex-direction: column; }
  .workspace-switcher select { width: 100%; }
  .publish-preview-data { grid-template-columns: 1fr; }
  .definition { grid-template-columns: 1fr; gap: 3px; }
  .definition dd { margin-bottom: 8px; }
  .reader-content { font-size: 17px; line-height: 1.85; }
  .reader-nav { flex-direction: column; }
  .report-form { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
