:root {
  --ink: #1c1914;
  --muted: #5c564c;
  --paper: #f6f1e8;
  --card: #fffcf7;
  --line: #ddd4c4;
  --accent: #9b2c1a;
  --accent-dark: #7a1f12;
  --tag-person: #1f4d3a;
  --tag-company: #1e3a5f;
  --tag-notice: #6b4f1d;
  --shadow: 0 10px 30px rgba(28, 25, 20, 0.08);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); }
body { display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 22px 8vw 0;
}
.brand { font-family: "Source Serif 4", Georgia, serif; font-size: 1.35rem; color: var(--ink); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }
.lang { font-size: 0.78rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.header-nav { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.nav-link {
  font-size: 0.78rem; color: var(--muted); letter-spacing: 0.04em;
  text-transform: uppercase; text-decoration: none;
}
.nav-link:hover { color: var(--accent); text-decoration: underline; }
.nav-link.is-active { color: var(--ink); }
.search-row .btn-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
}
.search-row .btn-secondary:hover {
  color: var(--ink);
  border-color: #c9bba6;
  background: #f3eee4;
}

.hero {
  padding: 8vh 8vw 4vh;
  max-width: 920px;
}
.hero h1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  line-height: 1.3;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}
.hero p.lead { margin: 0 0 28px; color: var(--muted); font-size: 1.05rem; max-width: 36em; }

.search-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.search-row { display: flex; gap: 8px; }
.search-row input[type="search"] {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 1.05rem;
  background: #fff;
  color: var(--ink);
}
.search-row input:focus { outline: 2px solid rgba(155, 44, 26, 0.35); border-color: var(--accent); }
.search-row button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 0 22px;
  font-weight: 600;
  cursor: pointer;
}
.search-row button:hover { background: var(--accent-dark); }

.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 12px; font-size: 0.85rem; color: var(--muted);
}
.filters label { display: flex; align-items: center; gap: 6px; }
.filters label[hidden],
.method-filter[hidden] { display: none !important; }
.filters select {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff;
}
.schema-pills { display: flex; gap: 6px; }
.schema-pills button {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 12px; cursor: pointer; color: var(--muted); font-size: 0.85rem;
}
.schema-pills button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.meta-line { margin: 18px 8vw 0; color: var(--muted); font-size: 0.82rem; }
.results { padding: 18px 8vw 8vh; display: grid; gap: 6px; max-width: 920px; }
.result {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; display: block; color: inherit; box-shadow: 0 1px 0 rgba(28,25,20,0.04);
}
.result:hover { border-color: #c9bba6; text-decoration: none; }
.result-title {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 0 0 2px;
}
.result-title .tag { margin-right: 0; }
.result h2 { margin: 0; font-size: 1.12rem; font-family: "Source Serif 4", Georgia, serif; font-weight: 600; }
.result .addr { color: var(--muted); font-size: 0.88rem; }
.result .aka { color: var(--muted); font-size: 0.88rem; font-style: italic; margin-top: 2px; }
.result .disambig { color: var(--ink); font-size: 0.84rem; margin-top: 2px; opacity: 0.82; }
.result .ids { margin-top: 4px; font-size: 0.75rem; color: var(--muted); letter-spacing: 0.02em; }
.empty { padding: 32px 8vw; color: var(--muted); }

.tag {
  display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 999px; margin-right: 6px;
}
.tag.Person { background: #e4f0ea; color: var(--tag-person); }
.tag.Company { background: #e4ebf4; color: var(--tag-company); }
.tag.Notice { background: #f3ead4; color: var(--tag-notice); }
.rel-rich .tag.Person,
.rel-rich .tag.Company,
.notice-pane-rel .tag.Person,
.notice-pane-rel .tag.Company {
  background: #e6e2da;
  color: var(--muted);
}

.suggest {
  position: relative;
}
.suggest-list {
  position: absolute; left: 14px; right: 110px; top: 58px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); z-index: 20; display: none; overflow: hidden;
}
.suggest-list a {
  display: block; padding: 10px 14px; color: var(--ink); border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.suggest-list a:last-child { border-bottom: 0; }
.suggest-list a:hover { background: #f3eee4; text-decoration: none; }
.suggest-disambig {
  display: block; margin-top: 3px; font-size: 0.78rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.suggest-addr {
  display: block; margin-top: 2px; font-size: 0.78rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.entity-wrap { padding: 4vh 8vw 10vh; max-width: 880px; }
.entity-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 0 4vh;
}
.entity-layout .entity-wrap {
  max-width: none;
  padding: 4vh 6vw 2vh;
}
.entity-layout .entity-main { min-width: 0; }

@media (min-width: 1100px) {
  .entity-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
    gap: 0 28px;
    padding: 0 3vw 4vh;
  }
  .entity-layout .entity-wrap { padding: 4vh 0 2vh; }
  .notice-pane {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    align-self: start;
  }
}

.notice-pane {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 0 6vw 24px;
  overflow: auto;
  box-shadow: var(--shadow);
}
.notice-pane:not(.is-open),
.notice-pane[hidden] {
  display: none !important;
}
@media (min-width: 1100px) {
  .notice-pane { margin: 4vh 0 0; }
}
@media (max-width: 1099px) {
  .notice-pane.is-open {
    position: fixed;
    left: 12px; right: 12px; bottom: 12px;
    max-height: min(62vh, 520px);
    z-index: 40;
    margin: 0;
    display: block !important;
  }
}
@media (min-width: 1100px) {
  .notice-pane.is-open {
    display: block !important;
  }
}
.notice-pane.is-open { outline: 1px solid rgba(155, 44, 26, 0.18); }
.notice-pane-inner { padding: 16px 18px 22px; }
.notice-pane-empty {
  color: var(--muted); font-size: 0.92rem; line-height: 1.45;
  padding: 28px 8px; text-align: center;
}
.notice-pane-head {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start;
  margin-bottom: 8px;
}
.notice-pane-title {
  flex: 1 1 160px; font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600; font-size: 1.05rem; line-height: 1.3;
}
.notice-pane-close { margin-left: auto; min-width: 2rem; padding-left: 10px; padding-right: 10px; }
.notice-pane-meta { margin: 0 0 8px; font-size: 0.82rem; color: var(--muted); }
.notice-pane-body { max-height: none; }
.notice-pane-shortened-hint {
  margin: 0 0 8px;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}
.notice-pane-shortened-hint a { font-weight: 600; }
.notice-pane-body.is-shortened {
  border-color: #e8dfd0;
  background: #fffdf9;
}
.notice-pane-rels { margin-top: 18px; }
.notice-pane-rels h3 {
  margin: 0 0 8px; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
  line-height: 1.35; font-weight: 600;
}
.notice-pane-rel-list {
  display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem;
}
.notice-pane-rel {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline;
}
.pager-row { margin: 12px 0 0; }
.pager-row .graph-btn { font-size: 0.85rem; }
.mgmt-filter { display: flex; gap: 8px; margin: 0 0 14px; max-width: 28rem; }
.mgmt-filter input[type="search"] {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
}
.mgmt-loading .mgmt-filter input { opacity: 0.55; }
.mgmt-loading #mgmt-hint { font-style: italic; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.notice-list > .notice-card {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  margin: 0 -12px;
  border-radius: 10px;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
.notice-list > .notice-card.is-selected {
  background: #faf4ef;
  border-top-color: transparent;
  padding: 14px 16px;
  margin: 6px -16px;
  box-shadow: 0 6px 18px rgba(28, 25, 20, 0.06);
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  position: relative;
  z-index: 1;
}
.notice-card.is-selected .notice-id {
  color: var(--accent);
  font-weight: 700;
}
.notice-card.is-selected .notice-date {
  color: var(--accent-dark);
}
.notice-card.is-selected .notice-title {
  color: var(--ink);
  font-weight: 600;
}
.notice-card.is-keyboard-focus:not(.is-selected) {
  background: #f8f3eb;
  box-shadow: inset 3px 0 0 #c9bba6;
}

.entity-wrap h1 {
  font-family: "Source Serif 4", Georgia, serif; font-size: clamp(1.8rem, 3vw, 2.6rem);
  margin: 8px 0 6px; letter-spacing: -0.02em;
}
.entity-wrap .addr { margin: 0 0 8px; color: var(--muted); font-size: 1.02rem; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 22px 0; font-size: 0.95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.related { margin-top: 28px; }
.related h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.related h3.rel-group {
  margin: 14px 0 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}
.related h3.rel-group .count {
  font-weight: 600; font-size: 0.78rem; color: var(--muted); margin-left: 6px;
}
.related h2 .count {
  display: inline-block; margin-left: 8px; font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0; text-transform: none; color: var(--ink);
  background: #efe8db; border-radius: 999px; padding: 2px 8px;
}
.related ul { list-style: none; padding: 0; margin: 0; }
.related li { border-top: 1px solid var(--line); padding: 10px 0; }
.notice-list { display: grid; gap: 0; }
.related .notice-list li { border-top: 0; padding: 0; } /* avoid double padding from .related li */
.notice-link {
  display: grid;
  grid-template-columns: 11.5rem 6rem minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 4px;
  align-items: start;
  color: inherit;
}
.notice-link:hover { text-decoration: none; }
.notice-link:hover .notice-title { text-decoration: underline; color: var(--accent); }
.notice-link:focus { outline: none; }
.notice-link:focus-visible {
  outline: 2px solid rgba(155, 44, 26, 0.45);
  outline-offset: 2px;
  border-radius: 4px;
}
.notice-id {
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color: var(--tag-notice);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notice-date {
  font-size: 0.78rem; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sort-hint { margin: -4px 0 10px; font-size: 0.78rem; color: var(--muted); }
.notice-title {
  font-size: 0.92rem; line-height: 1.4; color: var(--ink);
  min-width: 0;
}
@media (max-width: 720px) {
  .notice-link {
    grid-template-columns: minmax(0, 1fr) 5.8rem;
    column-gap: 8px;
  }
  .notice-title { grid-column: 1 / -1; }
}
.notice-preview {
  margin: 8px 0 0 0; padding: 10px 12px; background: #fff;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.88rem; color: var(--muted); line-height: 1.45;
  white-space: pre-wrap;
}
.empty-inline { color: var(--muted); font-size: 0.9rem; }
.notice-text {
  white-space: pre-wrap; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; font-size: 0.92rem; line-height: 1.5;
}
.rel-rich li { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; overflow: visible; }
.rel-rich .rel-main,
.notice-pane-rel .rel-main {
  flex: 1 1 12rem;
  min-width: 0;
}
.rel-rich .addr,
.notice-pane-rel .addr {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}
.role-pill {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 2px 8px; border-radius: 999px; background: #efe8db; color: var(--ink);
}
.role-pill.appointed { background: #e4f0ea; color: var(--tag-person); }
.role-pill.departed { background: #f3e4e0; color: var(--accent-dark); }
.role-pill.mentioned { background: #e4ebf4; color: var(--tag-company); }
.role-snippet {
  flex: 1 1 100%; margin: 4px 0 0; padding: 8px 10px; background: #fff;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.82rem; color: var(--muted); line-height: 1.4;
}
.role-snippet mark.name-hit {
  color: var(--ink);
  font-weight: 600;
}
.meta-quiet { font-size: 0.75rem; color: var(--muted); }
.notice-filter-btn {
  margin: 0; padding: 0; border: 0; background: none;
  font: inherit; font-size: 0.75rem; color: var(--accent);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.notice-filter-btn:hover { color: var(--accent-dark); }
.notice-filter-btn.is-active {
  color: var(--accent-dark); font-weight: 600;
  text-decoration-thickness: 2px;
}
.notice-filter-status {
  margin: -2px 0 10px;
  font-size: 0.82rem;
  color: var(--ink);
}
.notice-filter-status .text-btn { margin-left: 8px; }
.notice-refs {
  display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center;
  font-size: 0.78rem;
  overflow: visible;
}
.notice-date-badge {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3ead4;
  color: var(--tag-notice);
  border: 1px solid #e5d7b8;
  text-decoration: none;
  line-height: 1.35;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.notice-date-badge.has-role {
  position: relative;
}
.notice-date-badge.notice-role-appointed.has-role {
  background: #e4f0ea;
  border-color: #c5ddd0;
  color: var(--tag-person);
}
.notice-date-badge.notice-role-departed.has-role {
  background: #f3e4e0;
  border-color: #e5c8c0;
  color: var(--accent-dark);
}
.notice-date-badge.notice-role-mentioned.has-role {
  background: #e4f0ea;
  border-color: #c5ddd0;
  color: var(--tag-person);
}
.notice-date-badge[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 8rem;
  max-width: 18rem;
  padding: 6px 10px;
  background: var(--ink);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  border-radius: 8px;
  white-space: normal;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 30;
  box-shadow: 0 8px 20px rgba(28, 25, 20, 0.18);
  transition: opacity 0.12s ease, visibility 0.12s ease, transform 0.12s ease;
}
.notice-date-badge[data-tip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--ink);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.12s ease, visibility 0.12s ease;
}
.notice-date-badge[data-tip]:hover::after,
.notice-date-badge[data-tip]:hover::before,
.notice-date-badge[data-tip]:focus-visible::after,
.notice-date-badge[data-tip]:focus-visible::before {
  opacity: 1;
  visibility: visible;
}
.notice-date-badge[data-tip]:hover::after,
.notice-date-badge[data-tip]:focus-visible::after {
  transform: translateX(-50%) translateY(-2px);
}
.notice-date-badge:hover {
  background: #ebe0c4;
  border-color: #d4c29a;
  color: var(--accent-dark);
  text-decoration: none;
}
.notice-date-badge.notice-role-appointed.has-role:hover {
  background: #d5e8dd;
  border-color: #a8cbb8;
  color: var(--tag-person);
}
.notice-date-badge.notice-role-departed.has-role:hover {
  background: #ead4ce;
  border-color: #d4ada4;
  color: var(--accent-dark);
}
.notice-date-badge.notice-role-mentioned.has-role:hover {
  background: #d5e8dd;
  border-color: #a8cbb8;
  color: var(--tag-person);
}
.notice-date-badge:focus { outline: none; }
.notice-date-badge:focus-visible {
  outline: 2px solid rgba(155, 44, 26, 0.45);
  outline-offset: 2px;
}
.notice-date-badge.is-active {
  background: #f3e4e0;
  border-color: rgba(155, 44, 26, 0.35);
  color: var(--accent-dark);
  box-shadow: 0 0 0 1px rgba(155, 44, 26, 0.2);
}
.notice-date-badge.notice-KK01,
.notice-date-badge.notice-KK02,
.notice-date-badge.notice-KK03,
.notice-date-badge.notice-KK04,
.notice-date-badge.notice-KK05,
.notice-date-badge.notice-KK06 {
  background: #f3e4e0;
  border-color: #e5c8c0;
  color: var(--accent-dark);
}
mark.name-hit {
  background: #f6e2a8;
  color: var(--ink);
  padding: 0 2px;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.notice-pane-body mark.name-hit {
  font-weight: 600;
}
kbd {
  font-family: "IBM Plex Sans", monospace;
  font-size: 0.72em;
  font-weight: 600;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}
.text-btn {
  margin-left: 10px; border: 0; background: none; color: var(--accent);
  font: inherit; font-size: 0.78rem; cursor: pointer; text-decoration: underline;
  padding: 0;
}
.text-btn:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.graph-toolbar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin: 4px 0 10px;
}
.graph-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 5px 10px; font-size: 0.78rem; font-weight: 600;
  cursor: pointer; line-height: 1.2;
}
.graph-btn:hover:not(:disabled) { border-color: #c9bba6; background: #f3eee4; }
.graph-btn:disabled { opacity: 0.45; cursor: default; }
.graph-zoom-label {
  min-width: 3.2rem; text-align: center; font-size: 0.78rem;
  font-variant-numeric: tabular-nums; color: var(--muted);
}
.graph-toolbar-sep {
  width: 1px; height: 1.1rem; background: var(--line); margin: 0 2px;
}
.graph-wrap {
  --graph-scale: 1;
  margin-top: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; overflow: auto; max-height: min(80vh, 900px);
}
#rel-graph {
  width: calc(100% * var(--graph-scale));
  max-width: none;
  height: auto;
  display: block;
  min-width: 320px;
}
.g-bg { fill: var(--card); }
.g-edge { stroke: #c9bba6; stroke-width: 1.2; }
.g-edge.hop2 { stroke: #ddd4c4; stroke-dasharray: 4 3; }
.g-edge-hit { stroke: transparent; stroke-width: 14; fill: none; cursor: default; }
.g-edge-label { opacity: 0; pointer-events: none; transition: opacity 0.12s ease; }
.g-edge-label rect { fill: var(--card); stroke: #c9bba6; stroke-width: 1; }
.g-edge-label text {
  font-size: 9px; fill: var(--ink);
  font-family: "IBM Plex Sans", sans-serif;
}
.g-edge-group.is-hot .g-edge { stroke: var(--accent); stroke-width: 2.2; }
.g-edge-group.is-hot .g-edge-label { opacity: 1; }
.g-edge-group.is-dim .g-edge { opacity: 0.25; }
.g-node circle { stroke: #fff; stroke-width: 2; }
.g-node.Person circle { fill: #1f4d3a; }
.g-node.Company circle { fill: #1e3a5f; }
.g-node.hop0 circle { fill: var(--accent); }
.g-node.hop2 circle { opacity: 0.7; }
.g-node.is-hot circle { stroke: var(--accent); stroke-width: 3; }
.g-node text {
  font-size: 10px; fill: var(--ink); pointer-events: none;
  font-family: "IBM Plex Sans", sans-serif;
}
.graph-layout-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: var(--muted);
}
.graph-select {
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px;
  background: #fff; color: var(--ink); font-size: 0.78rem; font-weight: 600;
}
a.graph-btn {
  display: inline-flex; align-items: center; text-decoration: none;
  color: var(--ink);
}
a.graph-btn:hover { text-decoration: none; border-color: #c9bba6; background: #f3eee4; }
.g-node { cursor: grab; touch-action: none; }
.g-node.is-dragging { cursor: grabbing; }
.g-node.is-dragging circle { stroke: var(--accent); stroke-width: 3; }

.graph-expand-backdrop {
  position: fixed; inset: 0; background: rgba(28, 25, 20, 0.45);
  z-index: 50;
}
.graph-wrap.is-expanded {
  position: fixed;
  z-index: 60;
  left: 3vw; right: 3vw; top: 10vh; bottom: 3vh;
  max-height: none;
  margin: 0;
  width: auto;
  --graph-scale: 1;
}
.graph-wrap.is-expanded #rel-graph {
  width: 100%;
  height: 100%;
}
.graph-section-expanded .graph-toolbar {
  position: fixed;
  z-index: 61;
  left: 3vw; right: 3vw; top: 3vh;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}
body.graph-is-expanded { overflow: hidden; }

.graph-page-main {
  padding: 2vh 3vw 4vh;
  display: flex; flex-direction: column; gap: 12px;
  min-height: calc(100vh - 100px);
}
.graph-page-head h1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  margin: 6px 0 4px;
}
.graph-wrap-page {
  flex: 1;
  min-height: 70vh;
  max-height: none;
}
.graph-wrap-page #rel-graph {
  width: 100%;
  height: 100%;
  min-height: 70vh;
}
.last-updated { font-size: 0.78rem; color: var(--muted); letter-spacing: 0.01em; }
.site-footer { margin-top: auto; padding: 24px 8vw; font-size: 0.75rem; color: var(--muted); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

.manual { max-width: 820px; margin: 0 auto; padding: 2vh 8vw 10vh; }
.manual h1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0 0 8px; letter-spacing: -0.02em;
}
.manual .lead { color: var(--muted); margin: 0 0 20px; font-size: 1.02rem; line-height: 1.5; }
.manual-toc { margin: 0 0 28px; }
.manual-toc a { margin-right: 14px; font-size: 0.88rem; }
.manual h2 { font-size: 1.05rem; margin: 28px 0 10px; letter-spacing: 0.02em; }
.manual p, .manual li { font-size: 0.95rem; line-height: 1.55; }
.manual ul { padding-left: 1.2rem; }
.manual pre {
  margin: 10px 0 16px; padding: 12px 14px; background: #f3eee4; border-radius: 8px;
  overflow-x: auto; font-size: 0.82rem; line-height: 1.45;
}
.manual kbd {
  font-size: 0.8em; padding: 1px 5px; border: 1px solid var(--line);
  border-radius: 4px; background: #fff;
}
