@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;800&family=Spectral:wght@400;500;600;700&display=swap');
:root {
  --bg: #17120e;
  --bg-2: #0f0c09;
  --panel: #241c16;
  --panel-2: #2f261e;
  --line: #5b4938;
  --line-2: #7f674f;
  --text: #f4ead8;
  --muted: #bea98d;
  --accent: #c4633c;
  --accent-2: #d9b36a;
  --accent-soft: #4d2f23;
  --shadow-1: 0 14px 36px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f5ecdc;
  --bg-2: #efe2cd;
  --panel: #fffaf2;
  --panel-2: #f8efdf;
  --line: #cfb18b;
  --line-2: #bc9772;
  --text: #2f2014;
  --muted: #765e48;
  --accent: #a8532f;
  --accent-2: #c98f43;
  --accent-soft: #ead3b7;
  --shadow-1: 0 16px 36px rgba(102, 70, 31, 0.14);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: "Spectral", "Georgia", serif;
  background:
    radial-gradient(1400px 680px at -8% -22%, #3a2a1f 0%, transparent 58%),
    radial-gradient(1000px 560px at 110% -12%, #312012 0%, transparent 54%),
    radial-gradient(900px 460px at 50% 120%, #1f1913 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(30deg, rgba(255, 255, 255, 0.016) 0 1px, transparent 1px 8px),
    linear-gradient(125deg, rgba(255, 255, 255, 0.03), transparent 35%);
}
html[data-theme="light"] body {
  background:
    radial-gradient(1400px 680px at -8% -22%, rgba(203, 149, 103, 0.22) 0%, transparent 58%),
    radial-gradient(1000px 560px at 110% -12%, rgba(231, 201, 162, 0.38) 0%, transparent 54%),
    radial-gradient(900px 460px at 50% 120%, rgba(214, 190, 158, 0.34) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}
html[data-theme="light"] body::before {
  background:
    repeating-linear-gradient(30deg, rgba(92, 58, 25, 0.02) 0 1px, transparent 1px 8px),
    linear-gradient(125deg, rgba(145, 106, 54, 0.04), transparent 35%);
}
a { color: #f19a67; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #ffd7a7; }
html[data-theme="light"] a { color: #9f4f29; }
html[data-theme="light"] a:hover { color: #6f3619; }
.muted { color: var(--muted); }
h1, h2, h3, h4 { font-family: "Cinzel", "Times New Roman", serif; letter-spacing: 0.03em; }
.panel {
  background:
    radial-gradient(160% 120% at 50% -40%, rgba(217, 179, 106, 0.11), transparent 60%),
    linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-1);
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 294px 1fr; overflow-x: clip; }
.left-nav {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  border-right: 1px solid #5b4938;
  background:
    radial-gradient(120% 120% at 10% -10%, rgba(196, 99, 60, 0.18), transparent 46%),
    linear-gradient(180deg, #17120f 0%, #211912 100%);
  padding: 1rem 0.76rem;
}
.brand { color: #f7e9cf; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 800; font-size: 0.88rem; margin-bottom: 0.32rem; }
.campaign { margin: 0 0 0.8rem; color: #d2be9f; font-size: 0.82rem; }
.left-theme-toggle { margin-bottom: 0.72rem; }
.left-menu { display: grid; gap: 0.34rem; margin-top: 0.6rem; }
.left-admin-access {
  margin-top: 0.75rem;
  padding: 0.52rem;
  display: grid;
  gap: 0.36rem;
  background: linear-gradient(180deg, rgba(50, 37, 28, 0.98), rgba(35, 25, 19, 0.98));
}
.left-admin-access button {
  border: 1px solid #8c6e51;
  background: #3a2b1f;
  color: var(--text);
  border-radius: 8px;
  padding: 0.38rem 0.55rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.left-admin-access button:hover { background: #503827; }
html[data-theme="light"] .left-nav {
  border-right-color: #d4b897;
  background:
    radial-gradient(120% 120% at 10% -10%, rgba(196, 99, 60, 0.12), transparent 46%),
    linear-gradient(180deg, #f7ebda 0%, #efdfc8 100%);
}
html[data-theme="light"] .brand { color: #4d2f1c; }
html[data-theme="light"] .campaign { color: #755d49; }
html[data-theme="light"] .left-admin-access {
  background: linear-gradient(180deg, rgba(255, 248, 238, 0.98), rgba(244, 231, 210, 0.98));
}
html[data-theme="light"] .left-admin-access button {
  border-color: #be9875;
  background: #f4e6d1;
  color: var(--text);
}
html[data-theme="light"] .left-admin-access button:hover { background: #edd8bc; }
.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  color: #f2e6d1;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.5rem 0.62rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}
.nav-item small { color: #c7b091; font-size: 0.77rem; }
.nav-item:hover { color: #fff7e6; border-color: #9a7756; background: #3b2a1d; text-decoration: none; transform: translateX(2px); }
.nav-item.active { border-color: #c58d65; background: #523423; color: #fff7e6; }
.nav-hub-link {
  border-color: #8e6f50;
  background: linear-gradient(180deg, rgba(217, 179, 106, 0.16), rgba(196, 99, 60, 0.12));
}
html[data-theme="light"] .nav-item {
  color: #4a311f;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 250, 242, 0.72));
}
html[data-theme="light"] .nav-item small { color: #856951; }
html[data-theme="light"] .nav-item:hover {
  color: #362113;
  border-color: #b38860;
  background: #f4e2c8;
}
html[data-theme="light"] .nav-item.active {
  border-color: #b66d4b;
  background: #edd2b4;
  color: #2d1d12;
}

.index-doc { width: min(1540px, 100%); margin: 0 auto; padding: 1.1rem 1.1rem 2rem; }
.index-hero {
  padding: 0.95rem 1rem;
  margin-bottom: 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-start;
  border: 1px solid #7b6149;
  border-radius: 12px;
  background:
    radial-gradient(950px 250px at 18% -80%, rgba(196, 99, 60, 0.28), transparent 70%),
    radial-gradient(300px 180px at 92% 0%, rgba(217, 179, 106, 0.2), transparent 72%),
    linear-gradient(180deg, #3a2c20, #241b14);
  box-shadow: var(--shadow-1);
}
.kicker { margin: 0; color: #d2bd9d; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.74rem; }
.index-hero h1 { margin: 0.22rem 0 0; font-size: 2.2rem; line-height: 1.05; }
.hero-sub { margin: 0.4rem 0 0; color: var(--muted); max-width: 760px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 0.45rem; justify-content: flex-end; }
.hero-badge { border: 1px solid #84684f; border-radius: 999px; height: 30px; display: inline-flex; align-items: center; padding: 0 0.62rem; background: rgba(41, 29, 20, 0.65); font-size: 0.83rem; color: #f1e4d0; }
html[data-theme="light"] .index-hero {
  border-color: #cfab82;
  background:
    radial-gradient(950px 250px at 18% -80%, rgba(196, 99, 60, 0.16), transparent 70%),
    radial-gradient(300px 180px at 92% 0%, rgba(217, 179, 106, 0.14), transparent 72%),
    linear-gradient(180deg, #fff8ee, #f2e4cf);
}
html[data-theme="light"] .kicker { color: #8b6f56; }
html[data-theme="light"] .hero-badge {
  border-color: #c79f77;
  background: rgba(255, 248, 238, 0.9);
  color: #4c311d;
}

.quick-jump { display: flex; flex-wrap: wrap; gap: 0.42rem; padding: 0.56rem; margin-bottom: 0.85rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(30, 23, 17, 0.7); }
.chip-link { display: inline-flex; align-items: center; height: 32px; padding: 0 0.7rem; border-radius: 999px; border: 1px solid #7b624a; color: #f4ead8; text-decoration: none; background: linear-gradient(180deg, #4b3525, #332419); font-size: 0.84rem; transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
.chip-link:hover { border-color: #d9b36a; color: #fff7e8; background: linear-gradient(180deg, #61452e, #44311f); text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
html[data-theme="light"] .quick-jump { background: rgba(255, 248, 239, 0.82); }
html[data-theme="light"] .chip-link {
  border-color: #c8a178;
  color: #442c1a;
  background: linear-gradient(180deg, #fdf4e8, #f2dfc5);
}
html[data-theme="light"] .chip-link:hover {
  color: #2f1c10;
  background: linear-gradient(180deg, #f7e9d7, #ebd1b0);
}

.index-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.95rem; align-items: start; }
.index-main { min-width: 0; }
.index-rail { position: sticky; top: 1rem; display: grid; gap: 0.8rem; }
.rail-card { padding: 0.6rem; }
.rail-card h2 { margin: 0 0 0.45rem; font-size: 0.94rem; text-transform: uppercase; letter-spacing: 0.08em; color: #d6dcee; }
.rail-row, .recent-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.38rem 0.44rem;
  border-radius: 8px;
  border: 1px solid transparent;
  color: #e1e5f1;
  text-decoration: none;
}
.rail-row strong { color: #b8c1d5; font-size: 0.84rem; }
.recent-row { flex-direction: column; align-items: flex-start; gap: 0.08rem; }
.recent-row small { color: var(--muted); }
.rail-row:hover, .recent-row:hover { border-color: var(--line-2); background: #2a303d; color: #fff; text-decoration: none; }
html[data-theme="light"] .rail-card h2 { color: #7a6049; }
html[data-theme="light"] .rail-row,
html[data-theme="light"] .recent-row { color: #4d341f; }
html[data-theme="light"] .rail-row strong { color: #6b4c32; }
html[data-theme="light"] .rail-row:hover,
html[data-theme="light"] .recent-row:hover { background: #efe2ce; color: #2b1c12; }

.stats-strip { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 0.55rem; margin-bottom: 0.85rem; }
.stat { padding: 0.6rem 0.68rem; display: grid; gap: 0.2rem; border: 1px solid #6d563f; background: linear-gradient(180deg, #3a2b1f, #2a1f17); }
.stat small { color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; font-size: 0.72rem; }
.stat strong { font-size: 1.35rem; line-height: 1; color: #ffe0a8; }
html[data-theme="light"] .stat {
  border-color: #cfab82;
  background: linear-gradient(180deg, #fff8ee, #f2e4cf);
}
html[data-theme="light"] .stat strong { color: #8f5125; }

.control-bar { position: sticky; top: 0.65rem; z-index: 5; backdrop-filter: blur(8px); padding: 0.8rem; margin-bottom: 0.9rem; background: linear-gradient(180deg, rgba(56, 40, 27, 0.94), rgba(40, 29, 21, 0.94)); }
#global-search { width: 100%; border: 1px solid #8a6d52; background: #1f1712; color: var(--text); border-radius: 9px; padding: 0.6rem 0.66rem; }
.control-grid { margin-top: 0.6rem; display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 0.5rem; }
.control-grid label { display: grid; gap: 0.2rem; color: var(--muted); font-size: 0.8rem; }
.control-grid select, .control-grid input { border: 1px solid #8a6d52; background: #1f1712; color: var(--text); border-radius: 8px; padding: 0.43rem 0.48rem; }
.section-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.5rem; margin-bottom: 0.62rem; }
.section-filters label { display: grid; gap: 0.2rem; color: var(--muted); font-size: 0.8rem; }
.section-filters select { border: 1px solid #8a6d52; background: #1f1712; color: var(--text); border-radius: 8px; padding: 0.43rem 0.48rem; }
.index-tools { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.6rem; }
.index-tools button { border: 1px solid #8a6d52; border-radius: 8px; background: #3d2c1f; color: var(--text); padding: 0.38rem 0.64rem; cursor: pointer; transition: transform 0.15s ease, background-color 0.15s ease; }
.index-tools button:hover { background: #5a3d28; transform: translateY(-1px); }
#visible-counter { color: var(--muted); margin-left: auto; }
html[data-theme="light"] .control-bar { background: linear-gradient(180deg, rgba(255, 249, 241, 0.95), rgba(244, 232, 212, 0.95)); }
html[data-theme="light"] #global-search,
html[data-theme="light"] .control-grid select,
html[data-theme="light"] .control-grid input,
html[data-theme="light"] .section-filters select {
  border-color: #c09a73;
  background: #fffaf2;
  color: var(--text);
}
html[data-theme="light"] .index-tools button,
html[data-theme="light"] .zone-nav button,
html[data-theme="light"] .map-admin-tools button,
html[data-theme="light"] .map-admin-import,
html[data-theme="light"] .topbar .top-actions a {
  border-color: #c09a73;
  background: #f6e6d0;
  color: var(--text);
}
html[data-theme="light"] .index-tools button:hover,
html[data-theme="light"] .zone-nav button:hover,
html[data-theme="light"] .map-admin-tools button:hover,
html[data-theme="light"] .map-admin-import:hover,
html[data-theme="light"] .topbar .top-actions a:hover { background: #edd7b9; }

.search-results { margin-bottom: 0.9rem; padding: 0.7rem; }
.search-results h2 { margin: 0 0 0.45rem; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; }
.search-results ul { margin: 0; padding-left: 1rem; }
.search-results li { margin-bottom: 0.35rem; }
.search-results mark { background: #e0b95a; color: #111; }

.fold { margin-bottom: 0.82rem; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); overflow: hidden; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28); animation: revealIn 0.35s ease both; }
.fold summary { cursor: pointer; padding: 0.69rem 0.82rem; font-size: 1.1rem; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 0.5rem; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before { content: "▸"; color: #c7cbe0; font-size: 0.92rem; transform: translateY(-1px); transition: transform 0.16s ease; }
.fold[open] summary::before { transform: rotate(90deg) translateX(1px); }
.fold-section { margin-bottom: 0.95rem; }
.section-title { margin: 0; font-size: 1.55rem; line-height: 1.15; border-left: 4px solid var(--accent); padding: 0.54rem 0.76rem; background: linear-gradient(90deg, rgba(196, 99, 60, 0.28), rgba(217, 179, 106, 0.16) 35%, transparent 58%); }
.section-body { padding: 0.45rem 0.72rem 0.85rem; }
.inner-fold { margin-top: 0.45rem; }
.inner-fold > summary { font-size: 1rem; background: #243042; border-top: 1px solid #36445a; border-bottom: 1px solid #36445a; }
html[data-theme="light"] .inner-fold > summary {
  background: #f2e5d0;
  border-top-color: #d0b28d;
  border-bottom-color: #d0b28d;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin: 0.6rem 0; font-size: 0.98rem; }
thead th { position: sticky; top: 0; z-index: 1; text-align: left; background: rgba(22, 24, 30, 0.97); font-weight: 700; }
th, td { border: 1px solid var(--line); padding: 0.58rem 0.6rem; vertical-align: top; }
tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.025); }
tbody td:hover { background: rgba(196, 99, 60, 0.18); }
[data-row="1"].row-hidden, tr.row-hidden { display: none !important; }
html[data-theme="light"] thead th { background: rgba(249, 239, 224, 0.98); }
html[data-theme="light"] tbody tr:nth-child(even) td { background: rgba(128, 88, 44, 0.04); }
html[data-theme="light"] tbody td:hover { background: rgba(196, 99, 60, 0.11); }
.note-table-wrap {
  margin: 0.8rem 0 1rem;
  border: 1px solid rgba(127, 103, 79, 0.7);
  border-radius: 12px;
  background: rgba(23, 18, 14, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.note-markdown-table {
  min-width: min(100%, 760px);
  margin: 0;
  table-layout: fixed;
}
.note-markdown-table thead th {
  white-space: nowrap;
  text-align: center;
}
.note-markdown-table th,
.note-markdown-table td {
  padding: 0.8rem 0.75rem;
  vertical-align: middle;
  text-align: center;
}
.note-markdown-table td:first-child,
.note-markdown-table th:first-child {
  width: clamp(96px, 22%, 170px);
}
.note-markdown-table td:first-child {
  text-align: center;
  padding-inline: 0.5rem;
}
.note-markdown-table td:first-child > a,
.note-markdown-table td:first-child > span,
.note-markdown-table td:first-child > img {
  display: inline-flex;
  justify-content: center;
}
.note-markdown-table td:first-child .inline-image {
  width: auto !important;
  max-width: min(100%, 140px) !important;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}
.note-markdown-table td:nth-child(2) a {
  overflow-wrap: anywhere;
}
.note-markdown-table td:nth-child(2),
.note-markdown-table th:nth-child(2) {
  width: auto;
  text-align: center;
}
.note-markdown-table td:last-child,
.note-markdown-table th:last-child {
  width: clamp(86px, 16%, 120px);
  white-space: nowrap;
}
html[data-theme="light"] .note-table-wrap {
  background: rgba(255, 249, 241, 0.72);
  border-color: rgba(192, 154, 115, 0.76);
}
.thumb { width: 110px; max-width: 100%; height: auto; max-height: 170px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.thumb-pj { width: 88px; height: 88px; border-radius: 999px; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.7rem; }
.catalog-grid-pj { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.entity-card { background: linear-gradient(180deg, #2d2219, #221912); border: 1px solid #6d563f; border-radius: 12px; padding: 0.58rem; display: grid; gap: 0.5rem; align-content: start; transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease; }
.entity-card:hover { transform: translateY(-2px); border-color: #d6aa6b; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32); }
.entity-media { min-height: 130px; display: grid; place-items: center; border-radius: 9px; background: #1b140f; overflow: hidden; border: 1px solid #5d4a37; }
.entity-media .thumb {
  width: 100%;
  height: 210px;
  max-height: 210px;
  object-fit: contain;
  background: #1b140f;
}
.entity-card-pj .entity-media { min-height: 150px; }
.entity-card-pj .entity-media .thumb-pj {
  width: 100%;
  height: 140px;
  max-height: 140px;
  object-fit: contain;
  border-radius: 10px;
  background: #1b140f;
}
.entity-media-fallback { color: var(--muted); font-size: 0.82rem; }
.entity-title { margin: 0; font-size: 1rem; line-height: 1.28; }
.entity-title a { color: var(--text); text-decoration: none; }
.entity-title a:hover { text-decoration: underline; color: #fff4e1; }
.entity-details { display: grid; gap: 0.22rem; }
.entity-line { display: grid; gap: 0.04rem; }
.entity-line span { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.entity-line strong { font-size: 0.87rem; font-weight: 600; color: #e9edf9; word-break: break-word; }
html[data-theme="light"] .entity-card {
  background: linear-gradient(180deg, #fff9f1, #f3e5d0);
  border-color: #cfab82;
}
html[data-theme="light"] .entity-media,
html[data-theme="light"] .entity-media .thumb,
html[data-theme="light"] .entity-card-pj .entity-media .thumb-pj {
  background: #f7ecdc;
  border-color: #d0b28d;
}
html[data-theme="light"] .entity-title a { color: #2d1d12; }
html[data-theme="light"] .entity-title a:hover { color: #7a3b1f; }
html[data-theme="light"] .entity-line strong { color: #3c2818; }
.timeline { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.timeline li { margin-bottom: 0.35rem; }
.timeline li span { color: var(--muted); margin-right: 0.5rem; }
.relation-graph-shell { display: grid; grid-template-columns: 318px minmax(0, 1fr) 318px; gap: 0.8rem; align-items: stretch; }
.relation-graph-detail-panel,
.relation-graph-sidebar { padding: 0.75rem; border: 1px solid #4f5055; background: linear-gradient(180deg, rgba(40, 40, 42, 0.98), rgba(28, 28, 30, 0.98)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 20px 38px rgba(0,0,0,0.26); }
.relation-graph-detail-panel { display: grid; align-content: start; }
.relation-graph-sidebar { display: grid; grid-template-rows: auto auto auto auto; gap: 0.7rem; align-content: start; }
.relation-inspector-head { display: grid; gap: 0.12rem; margin-bottom: 0.7rem; padding: 0.2rem 0.1rem 0.55rem; border-bottom: 1px solid rgba(145, 168, 210, 0.18); }
.relation-inspector-kicker { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.68rem; color: #8fbfff; }
.relation-inspector-head strong { font-size: 1.08rem; color: #f5f7fb; }
.relation-inspector-head small { color: #aab4c8; font-size: 0.82rem; }
.relation-graph-toolbar { display: grid; gap: 0.55rem; }
.relation-graph-toolbar label,
.relation-graph-toggle { display: grid; gap: 0.24rem; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.relation-graph-toolbar input,
.relation-graph-toolbar select { width: 100%; border: 1px solid #4e4f55; border-radius: 10px; background: rgba(31, 31, 35, 0.96); color: #edf3ff; padding: 0.62rem 0.74rem; font: inherit; }
.relation-graph-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.relation-graph-actions button,
.relation-legend-chip { border: 1px solid #4f5055; border-radius: 999px; background: linear-gradient(180deg, #2f3034, #25262a); color: #ededee; padding: 0.48rem 0.74rem; font: inherit; cursor: pointer; transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease; }
.relation-graph-actions button:hover,
.relation-legend-chip:hover,
.relation-legend-chip.active { border-color: #8fbfff; background: linear-gradient(180deg, #3a3c45, #2d2f38); transform: translateY(-1px); }
.relation-graph-toggle { display: inline-flex; align-items: center; gap: 0.42rem; }
.relation-graph-toggle input { accent-color: #9cc7ff; }
.relation-graph-legend { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.relation-graph-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
.relation-graph-stats div { border: 1px solid #4d4e53; border-radius: 14px; padding: 0.72rem; background: rgba(27, 29, 34, 0.94); }
.relation-graph-stats strong { display: block; font-size: 1.28rem; color: #f4f5f7; }
.relation-graph-stats span { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
.relation-graph-controls { border: 1px solid #4d4e53; border-radius: 16px; overflow: hidden; background: rgba(29, 31, 35, 0.96); }
.relation-graph-controls summary { cursor: pointer; list-style: none; padding: 0.78rem 0.82rem; font-weight: 700; color: #f0f2f5; border-bottom: 1px solid transparent; }
.relation-graph-controls[open] summary { border-bottom-color: #4a4b50; }
.relation-graph-controls summary::-webkit-details-marker { display: none; }
.relation-force-list { display: grid; gap: 0.78rem; padding: 0.82rem; }
.relation-force-control { display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 0.55rem; align-items: center; }
.relation-force-control span { font-size: 0.83rem; color: #d8dce3; }
.relation-force-control strong { font-size: 0.78rem; color: #aeb6c7; font-weight: 600; }
.relation-force-control input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: #a9cbff; }
.relation-graph-detail { min-height: 220px; border: 1px solid #5b4b3d; border-radius: 16px; background:
  radial-gradient(circle at top, rgba(111, 155, 255, 0.12), transparent 42%),
  linear-gradient(180deg, rgba(29, 32, 39, 0.98), rgba(22, 24, 30, 0.98));
  padding: 0.9rem;
}
.relation-graph-detail .muted { display: block; padding: 0.2rem 0.05rem; line-height: 1.55; }
.relation-graph-detail h3 { margin: 0; font-size: 1.06rem; color: #f6f7f8; }
.relation-graph-detail p { margin: 0.35rem 0 0; }
.relation-graph-detail .meta { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.75rem; }
.relation-graph-detail .meta span { border: 1px solid #4f5f77; border-radius: 999px; padding: 0.28rem 0.58rem; background: rgba(103, 161, 255, 0.12); color: #dfe9ff; font-size: 0.76rem; }
.relation-graph-neighbors { display: grid; gap: 0.35rem; margin-top: 0.8rem; }
.relation-graph-neighbors a { display: flex; justify-content: space-between; gap: 0.5rem; text-decoration: none; border: 1px solid #415267; border-radius: 10px; padding: 0.5rem 0.62rem; color: #eaf1ff; background: rgba(27, 37, 52, 0.76); }
.relation-graph-neighbors a:hover { border-color: #d8b46d; background: rgba(44, 58, 81, 0.92); }
.relation-graph-neighbors small { color: #afbdd6; }
.relation-graph-stage { min-width: 0; }
.relation-graph-canvas-wrap { position: relative; overflow: hidden; border: 1px solid #5f4e3f; border-radius: 18px; background:
  radial-gradient(circle at top, rgba(255, 255, 255, 0.02), transparent 32%),
  linear-gradient(180deg, #1e1e1f, #1a1a1b 58%, #171718); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.025), 0 18px 40px rgba(0,0,0,0.22); }
#relation-graph { display: block; width: 100%; height: auto; cursor: grab; background:
  radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.03), transparent 20%),
  linear-gradient(180deg, rgba(255,255,255,0.012), rgba(255,255,255,0.006)); }
.relation-graph-hint { position: absolute; right: 14px; bottom: 12px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 999px; padding: 0.36rem 0.7rem; background: rgba(26, 27, 30, 0.82); color: #bfc4cf; font-size: 0.76rem; backdrop-filter: blur(5px); pointer-events: none; }
html[data-theme="light"] .relation-graph-detail-panel,
html[data-theme="light"] .relation-graph-sidebar { border-color: #c7ab89; background: linear-gradient(180deg, rgba(255, 250, 242, 0.98), rgba(245, 232, 211, 0.98)); }
html[data-theme="light"] .relation-graph-detail-panel,
html[data-theme="light"] .relation-graph-sidebar,
html[data-theme="light"] .relation-graph-canvas-wrap { box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 16px 28px rgba(135, 101, 62, 0.12); }
html[data-theme="light"] .relation-inspector-head { border-bottom-color: rgba(136, 110, 81, 0.18); }
html[data-theme="light"] .relation-inspector-kicker { color: #7d5f44; }
html[data-theme="light"] .relation-inspector-head strong { color: #352214; }
html[data-theme="light"] .relation-inspector-head small { color: #7f6954; }
html[data-theme="light"] .relation-graph-toolbar label,
html[data-theme="light"] .relation-graph-toggle,
html[data-theme="light"] .relation-graph-stats span { color: #755c48; }
html[data-theme="light"] .relation-graph-toolbar input,
html[data-theme="light"] .relation-graph-toolbar select { border-color: #caa57b; background: rgba(255, 249, 240, 0.96); color: #382517; }
html[data-theme="light"] .relation-graph-actions button,
html[data-theme="light"] .relation-legend-chip { border-color: #c49c70; background: linear-gradient(180deg, #fff6ea, #eedfca); color: #382617; }
html[data-theme="light"] .relation-graph-stats div,
html[data-theme="light"] .relation-graph-detail { border-color: #cfb08b; background:
  radial-gradient(circle at top, rgba(111, 155, 255, 0.08), transparent 42%),
  linear-gradient(180deg, rgba(255, 251, 245, 0.98), rgba(241, 231, 214, 0.98)); }
html[data-theme="light"] .relation-graph-stats strong,
html[data-theme="light"] .relation-graph-detail h3 { color: #352214; }
html[data-theme="light"] .relation-graph-controls { border-color: #d2b693; background: rgba(255, 248, 238, 0.98); }
html[data-theme="light"] .relation-graph-controls summary { color: #352214; }
html[data-theme="light"] .relation-graph-controls[open] summary { border-bottom-color: #dac4a6; }
html[data-theme="light"] .relation-force-control span { color: #5d4a3a; }
html[data-theme="light"] .relation-force-control strong { color: #7c634d; }
html[data-theme="light"] .relation-graph-detail .meta span { border-color: #bfd0ef; background: rgba(103, 161, 255, 0.1); color: #28405f; }
html[data-theme="light"] .relation-graph-neighbors a { border-color: #c5b08f; background: rgba(255, 251, 244, 0.95); color: #362315; }
html[data-theme="light"] .relation-graph-neighbors small { color: #7a624b; }
html[data-theme="light"] .relation-graph-canvas-wrap { border-color: #c8ab88; background:
  radial-gradient(circle at top, rgba(111, 155, 255, 0.11), transparent 38%),
  radial-gradient(circle at bottom, rgba(214, 143, 88, 0.1), transparent 34%),
  linear-gradient(180deg, #f8efe1, #f3e7d5 55%, #efe1ca); }
html[data-theme="light"] #relation-graph { background:
  radial-gradient(circle at 20% 15%, rgba(118, 157, 255, 0.08), transparent 24%),
  radial-gradient(circle at 80% 78%, rgba(255, 158, 102, 0.06), transparent 22%),
  linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.06)); }
html[data-theme="light"] .relation-graph-hint { border-color: rgba(168, 134, 96, 0.24); background: rgba(255, 249, 241, 0.82); color: #6b5440; }
@media (max-width: 980px) {
  .relation-graph-shell { grid-template-columns: 1fr; }
  .relation-graph-detail-panel { order: 1; }
  .relation-graph-stage { order: 2; }
  .relation-graph-sidebar { order: 3; }
}
@media (max-width: 700px) {
  .relation-graph-shell { gap: 0.6rem; }
  .relation-graph-detail-panel,
  .relation-graph-sidebar { padding: 0.58rem; border-radius: 16px; }
  .relation-graph-toolbar input,
  .relation-graph-toolbar select { min-height: 42px; font-size: 0.95rem; }
  .relation-graph-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.42rem; }
  .relation-graph-actions button { min-height: 40px; }
  .relation-graph-toggle { grid-column: 1 / -1; min-height: 40px; align-items: center; }
  .relation-graph-stats { grid-template-columns: 1fr 1fr; }
  .relation-graph-canvas-wrap { border-radius: 16px; }
  #relation-graph { min-height: 420px; }
  .relation-graph-hint { left: 12px; right: 12px; bottom: 10px; text-align: center; border-radius: 12px; }
}
@media (max-width: 560px) {
  .relation-graph-detail { min-height: 0; }
  .relation-graph-neighbors a { padding: 0.56rem 0.58rem; }
  .relation-graph-actions { grid-template-columns: 1fr; }
  .relation-graph-stats { grid-template-columns: 1fr; }
  .relation-force-control span { font-size: 0.8rem; }
  .relation-graph-hint { display: none; }
  #relation-graph { min-height: 360px; }
}
.faerun-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 0.75rem; align-items: start; }
.zone-nav { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.45rem; }
.zone-nav button { border: 1px solid #8a6d52; border-radius: 8px; background: #3d2c1f; color: var(--text); padding: 0.32rem 0.58rem; cursor: pointer; }
.zone-nav button:hover { background: #5a3d28; }
.zone-nav span { color: #dfe4f3; font-weight: 700; letter-spacing: 0.02em; }
.faerun-session-list { padding: 0.58rem; max-height: 560px; overflow: auto; border: 1px solid #6d563f; background: linear-gradient(180deg, #2e231a, #221a13); }
.faerun-session-list h3 { margin: 0 0 0.45rem; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.07em; color: #d6dcee; }
.session-group { border: 1px solid #6d563f; border-radius: 9px; background: #2c2119; margin-bottom: 0.45rem; overflow: hidden; }
.session-group summary { cursor: pointer; list-style: none; padding: 0.45rem 0.5rem; font-size: 0.84rem; font-weight: 700; border-bottom: 1px solid transparent; }
.session-group[open] summary { border-bottom-color: var(--line); }
.session-group summary::-webkit-details-marker { display: none; }
.session-links { display: grid; gap: 0.24rem; padding: 0.4rem; }
.map-session-link { border: 1px solid #71583f; background: #34271c; color: #f2e6d1; border-radius: 7px; padding: 0.38rem 0.47rem; text-align: left; font-size: 0.82rem; cursor: pointer; }
.map-session-link:hover { background: #4a3423; border-color: #d9b36a; }
.map-session-link.active { background: #4a2b35; border-color: #b1596d; color: #fff; }
.map-session-link[draggable="true"] { cursor: grab; }
.map-session-link[draggable="true"]:active { cursor: grabbing; }
.faerun-map { position: relative; height: 560px; overflow: hidden; border: 1px solid #6f5841; border-radius: 12px; background: #18110d; cursor: grab; touch-action: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02); }
.map-stack-picker {
  position: absolute;
  min-width: 220px;
  max-width: min(320px, calc(100% - 16px));
  max-height: min(52vh, 300px);
  overflow: auto;
  border: 1px solid #755c42;
  border-radius: 10px;
  background: rgba(20, 28, 40, 0.96);
  backdrop-filter: blur(2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.46);
  z-index: 12;
  padding: 0.35rem;
}
.map-stack-picker[hidden] { display: none !important; }
.map-stack-title {
  font-size: 0.74rem;
  color: #c7d4ea;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0.1rem 0.15rem 0.3rem;
}
.map-stack-item {
  width: 100%;
  border: 1px solid #71583f;
  background: #2f2319;
  color: #ebeff8;
  border-radius: 8px;
  padding: 0.42rem 0.48rem;
  text-align: left;
  font-size: 0.82rem;
  cursor: pointer;
  margin-bottom: 0.28rem;
}
.map-stack-item:last-child { margin-bottom: 0; }
.map-stack-item:hover { background: #493423; border-color: #d9b36a; }
.map-stack-item.active { background: #4a2b35; border-color: #b1596d; color: #fff; }
html[data-theme="light"] .faerun-session-list {
  border-color: #cfab82;
  background: linear-gradient(180deg, #fff8ee, #f1e3cf);
}
html[data-theme="light"] .faerun-session-list h3,
html[data-theme="light"] .zone-nav span { color: #4f331e; }
html[data-theme="light"] .session-group {
  border-color: #cfab82;
  background: #f7ecdc;
}
html[data-theme="light"] .map-session-link {
  border-color: #be9875;
  background: #fffaf2;
  color: #402919;
}
html[data-theme="light"] .map-session-link:hover { background: #efd9bd; }
html[data-theme="light"] .faerun-map {
  border-color: #cfab82;
  background: #f6ebdb;
}
html[data-theme="light"] .map-stack-picker {
  border-color: #c09a73;
  background: rgba(255, 249, 242, 0.97);
}
html[data-theme="light"] .map-stack-title { color: #6f553f; }
html[data-theme="light"] .map-stack-item {
  border-color: #be9875;
  background: #f8eddd;
  color: #422a1a;
}
html[data-theme="light"] .map-stack-item:hover { background: #edd7b9; }
.faerun-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  user-select: none;
  --image-scale: 1;
  --label-scale: 1;
}
.faerun-image { display: block; max-width: none; width: 1400px; height: auto; }
.faerun-chrono-layer {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 1;
}
.faerun-chrono-edge {
  stroke: #bb0c0c;
  stroke-width: 2.4;
  stroke-linecap: round;
  opacity: 0.82;
  filter: drop-shadow(0 0 4px rgba(22, 24, 32, 0.62));
}
.faerun-chrono-step {
  fill: #fff8eb;
  font-size: calc(11px * var(--label-scale, 1));
  font-weight: 700;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(26, 20, 14, 0.75);
  stroke-width: 2px;
}
.faerun-pin {
  position: absolute;
  transform: translate(calc(-50% + var(--stack-tx, 0px)), calc(-50% + var(--stack-ty, 0px))) scale(var(--pin-scale, 1));
  transition: transform 0.16s ease, box-shadow 0.14s ease, background-color 0.14s ease, border-color 0.14s ease;
  width: calc(14px * var(--image-scale, 1));
  height: calc(14px * var(--image-scale, 1));
  border-radius: 999px;
  background: #f36d6d;
  border: calc(2px * var(--image-scale, 1)) solid #ffd0d0;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 18px rgba(221, 90, 79, 0.28);
  text-decoration: none;
}
.faerun-pin:hover { background: #ff8a8a; }
.faerun-pin.place-pin { background: #6dc3ff; border-color: #cceeff; --pin-scale: var(--place-pin-scale, 1); }
.faerun-pin.session-pin { background: #f36d6d; border-color: #ffd0d0; --pin-scale: var(--session-pin-scale, 1); z-index: 4; }
.faerun-pin.session-pin.stack-splayed { z-index: 8; }
.faerun-pin.session-pin.active { background: #ffd166; border-color: #ffe6a5; box-shadow: 0 0 0 3px rgba(255, 200, 80, 0.26); }
.faerun-zone-hub {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 1px solid #9c6f4b;
  background: linear-gradient(180deg, rgba(156, 91, 66, 0.94), rgba(129, 60, 49, 0.94));
  color: #fff;
  border-radius: 999px;
  min-height: 28px;
  padding: 0.2rem 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-size: calc(0.76rem * var(--label-scale, 1));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
  z-index: 3;
}
.faerun-zone-hub small { color: #ffe2b9; font-weight: 700; }
.faerun-zone-hub:hover { background: linear-gradient(180deg, rgba(181, 108, 78, 0.98), rgba(145, 69, 56, 0.98)); }
.faerun-pin span {
  position: absolute;
  top: calc(-30px * var(--image-scale, 1));
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(14, 18, 25, 0.95);
  border: 1px solid #44516a;
  color: #f0f2f7;
  font-size: calc(0.75rem * var(--label-scale, 1));
  border-radius: 6px;
  padding: 0.18rem 0.36rem;
  opacity: 0;
  pointer-events: none;
}
.faerun-pin:hover span { opacity: 1; }
.map-admin { margin-top: 0.7rem; padding: 0.6rem; display: grid; gap: 0.55rem; }
body:not(.map-admin-on) #map-admin { display: none !important; }
body.map-admin-on #map-admin { display: grid !important; }
.map-admin-access-state { color: var(--muted); }
.map-admin-access-state.ok { color: #86efac; }
.map-admin-tools { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.map-admin-tools button, .map-admin-import {
  border: 1px solid #8a6d52;
  border-radius: 8px;
  background: #3d2c1f;
  color: var(--text);
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  text-decoration: none;
}
.map-admin-import input { display: none; }
.map-admin-tools button:hover, .map-admin-import:hover { background: #5a3d28; }
.map-admin-status { color: #d6d8e0; }
.map-admin-status.ok { color: #86efac; }
.map-admin-status.warn { color: #fbbf24; }
.map-admin-status.err { color: #fca5a5; }

.note-page { background: var(--bg); }
.note-shell { max-width: 1140px; margin: 0 auto; padding: 0.9rem; }
.topbar { display: flex; justify-content: space-between; padding: 0.74rem 0.92rem; margin-bottom: 0.8rem; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(180deg, #3b2b1f, #2c2017); box-shadow: var(--shadow-1); }
.top-actions { display: flex; align-items: center; gap: 0.85rem; }
.topbar-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 0.7rem;
  border: 1px solid #8a6d52;
  border-radius: 8px;
  background: #33251a;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.topbar-action-button:hover { background: #493322; }
.theme-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.theme-toggle-input {
  position: absolute;
  opacity: 0;
  inline-size: 1px;
  block-size: 1px;
  pointer-events: none;
}
.theme-switch-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  min-width: 92px;
  height: 34px;
  padding: 0 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(176, 133, 90, 0.42);
  background:
    radial-gradient(circle at 50% 0%, rgba(244, 214, 170, 0.1), transparent 58%),
    linear-gradient(180deg, #2f2219, #1b1410);
  color: #f7ecdc;
  box-shadow:
    inset 0 1px 0 rgba(255, 241, 224, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.24),
    0 6px 16px rgba(16, 10, 6, 0.22);
}
.theme-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 36px;
  height: 26px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.78), transparent 42%),
    linear-gradient(180deg, #fbf2e5, #d8b88e);
  border: 1px solid rgba(255, 245, 232, 0.42);
  box-shadow:
    0 7px 14px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: transform 0.26s ease, background 0.26s ease, box-shadow 0.26s ease;
}
.theme-switch-icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  transition: color 0.22s ease, transform 0.22s ease, opacity 0.22s ease, text-shadow 0.22s ease;
}
.theme-switch-icon-moon {
  color: rgba(255, 246, 234, 0.96);
  text-shadow: 0 0 12px rgba(239, 220, 193, 0.22);
}
.theme-switch-icon-sun {
  color: rgba(213, 166, 104, 0.48);
}
.theme-toggle-input:checked + .theme-switch-track .theme-switch-thumb {
  transform: translateX(50px);
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.7), transparent 40%),
    linear-gradient(180deg, #ffd79a, #d88e45);
  box-shadow:
    0 7px 14px rgba(64, 28, 4, 0.28),
    0 0 18px rgba(232, 164, 88, 0.18),
    inset 0 1px 0 rgba(255, 249, 236, 0.7);
}
.theme-toggle-input:checked + .theme-switch-track .theme-switch-icon-moon {
  color: rgba(255, 240, 220, 0.4);
  transform: scale(0.9);
  opacity: 0.75;
  text-shadow: none;
}
.theme-toggle-input:checked + .theme-switch-track .theme-switch-icon-sun {
  color: #fff7d3;
  transform: scale(1.02);
  opacity: 1;
  text-shadow: 0 0 14px rgba(255, 205, 104, 0.45);
}
.theme-toggle-input:not(:checked) + .theme-switch-track .theme-switch-icon-moon {
  color: #fff6ea;
  transform: scale(1.02);
  opacity: 1;
  text-shadow: 0 0 14px rgba(255, 237, 206, 0.26);
}
.theme-toggle-input:not(:checked) + .theme-switch-track .theme-switch-icon-sun {
  color: rgba(213, 166, 104, 0.44);
  transform: scale(0.9);
  opacity: 0.7;
  text-shadow: none;
}
.theme-toggle-input:focus-visible + .theme-switch-track {
  outline: 2px solid #d9b36a;
  outline-offset: 2px;
}
html[data-theme="light"] .theme-switch-track {
  border-color: rgba(191, 155, 111, 0.62);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 225, 180, 0.38), transparent 56%),
    linear-gradient(180deg, #fff6e8, #ead7b9);
  color: #4a311d;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    inset 0 -1px 0 rgba(165, 122, 73, 0.1),
    0 6px 14px rgba(92, 57, 28, 0.12);
}
html[data-theme="light"] .theme-switch-thumb {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.82), transparent 42%),
    linear-gradient(180deg, #fffefe, #edd7b8);
  border-color: rgba(255, 248, 235, 0.9);
  box-shadow:
    0 6px 12px rgba(126, 88, 46, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}
html[data-theme="light"] .theme-switch-icon-moon {
  color: rgba(122, 88, 54, 0.52);
  text-shadow: none;
}
html[data-theme="light"] .theme-switch-icon-sun {
  color: #b96d2f;
}
html[data-theme="light"] .theme-toggle-input:not(:checked) + .theme-switch-track .theme-switch-icon-moon {
  color: #745237;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.32);
}
html[data-theme="light"] .theme-toggle-input:not(:checked) + .theme-switch-track .theme-switch-icon-sun {
  color: rgba(185, 109, 47, 0.4);
}
html[data-theme="light"] .theme-toggle-input:checked + .theme-switch-track .theme-switch-thumb {
  box-shadow:
    0 7px 14px rgba(180, 112, 45, 0.16),
    0 0 16px rgba(236, 173, 92, 0.18),
    inset 0 1px 0 rgba(255, 249, 236, 0.8);
}
html[data-theme="light"] .theme-toggle-input:checked + .theme-switch-track .theme-switch-icon-sun {
  color: #8a4e20;
  text-shadow: 0 0 14px rgba(255, 211, 140, 0.44);
}
html[data-theme="light"] .theme-toggle-input:checked + .theme-switch-track .theme-switch-icon-moon {
  color: rgba(116, 82, 55, 0.34);
}
.topbar .top-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 0.7rem;
  border: 1px solid #8a6d52;
  border-radius: 8px;
  background: #33251a;
  color: var(--text);
  text-decoration: none;
}
.topbar .top-actions a:hover { background: #493322; }
.note-print-button { white-space: nowrap; }
.note { padding: 1rem; }
.note-hero { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 1rem; align-items: start; margin-bottom: 0.8rem; }
.note-hero > div { min-width: 0; }
.note-hero h1 {
  margin: 0;
  overflow-wrap: anywhere;
}
.note-portrait {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  object-fit: contain;
  border: 1px solid #6f5841;
  background: #121723;
  padding: 0.2rem;
}
.note-portrait.fallback { display: grid; place-items: center; background: #1a1d26; color: var(--muted); }
.note-summary { color: #d9dbe3; margin: 0.3rem 0 0; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.5rem; margin-bottom: 0.9rem; }
.meta div { border: 1px solid #6d563f; border-radius: 9px; padding: 0.45rem 0.52rem; background: #2a1f17; }
.meta span { display: block; color: var(--muted); font-size: 0.74rem; }
.meta strong { display: block; margin-top: 0.14rem; }
.note-content p { line-height: 1.55; color: #d9dbe3; }
.note-content h1, .note-content h2, .note-content h3 { color: #f0f2f7; }
.note-content pre { overflow-x: auto; border-radius: 8px; background: #1f1712; border: 1px solid #5a4635; padding: 0.6rem; }
.note-content code { background: #241a14; padding: 0.07rem 0.24rem; border-radius: 4px; }
.note-content img.inline-image { width: 100%; max-width: 620px; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.journal-parchment {
  margin: 0.86rem 0;
  padding: 0.86rem 0.82rem 0.74rem;
  border: 1px solid #2e2318;
  border-top: 6px solid #e69a28;
  border-bottom: 6px solid #e69a28;
  border-radius: 2px;
  background-color: #fdf1dc;
  background-image: url("fond/fond-mm-effet.png"), url("fond/fond-ph.jpg");
  background-repeat: no-repeat, repeat;
  background-position: top left, top left;
  background-size: 100% auto, auto;
  color: #2a1f14;
  font-family: Georgia, "Times New Roman", serif;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.45);
}
.journal-heading {
  margin: 0 0 0.5rem;
  color: #6D0000;
  font-weight: 700;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  line-height: 1.05;
}
.journal-parchment p,
.journal-parchment li {
  color: #2a1f14;
  line-height: 1.56;
  font-size: 0.97rem;
}
.journal-parchment a { color: #B80000; text-decoration: none; border-bottom: 1px dashed transparent; }
.journal-parchment a:hover { color: #D80000; border-bottom-color: #D80000; }
.journal-parchment ul { list-style: square outside; margin: 0.34rem 0 0.18rem; padding-left: 1.2rem; }
body:not(.map-admin-on) .journal-secret { display: none; }
.journal-secret p:nth-last-child(2),
.journal-secret p:last-child {
  text-align: right;
}
.journal-secret p:last-child img.inline-image {
  width: 92px;
  max-width: 92px;
  height: auto;
  display: inline-block;
  border: 0;
  box-shadow: none;
  mix-blend-mode: multiply;
  opacity: 0.9;
  filter: contrast(1.08);
}
.linked { margin-top: 0.95rem; display: grid; gap: 0.8rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.linked h3 { margin: 0 0 0.35rem; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.06em; }
.linked ul { margin: 0; padding-left: 1rem; }
html[data-theme="light"] .topbar { background: linear-gradient(180deg, #fff8ee, #f2e3ce); }
html[data-theme="light"] .topbar-action-button {
  border-color: #be9875;
  background: #f4e6d1;
  color: var(--text);
}
html[data-theme="light"] .topbar-action-button:hover { background: #edd8bc; }
html[data-theme="light"] .note-summary,
html[data-theme="light"] .note-content p,
html[data-theme="light"] .note-content h1,
html[data-theme="light"] .note-content h2,
html[data-theme="light"] .note-content h3 { color: #3b2818; }
html[data-theme="light"] .note-portrait {
  border-color: #cfab82;
  background: #f7ecdc;
}
html[data-theme="light"] .note-portrait.fallback { background: #efe2ce; }
html[data-theme="light"] .meta div {
  border-color: #cfab82;
  background: #fbf3e7;
}
html[data-theme="light"] .note-content pre {
  background: #fbf3e8;
  border-color: #d0b28d;
}
html[data-theme="light"] .note-content code { background: #f2dfc4; }

@media print {
  @page { margin: 12mm 8mm 10mm; }
  html, body {
    background: #f7ecd2 !important;
    color: #111111 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body {
    margin: 0;
    min-height: auto;
  }
  body::before,
  .topbar,
  .theme-switch,
  .linked,
  .note-print-button {
    display: none !important;
  }
  .note-page,
  .note-shell,
  .note,
  .panel {
    box-shadow: none !important;
    border: 0 !important;
  }
  .note-page {
    background: transparent !important;
  }
  .note-shell {
    width: auto;
    max-width: none;
    min-height: auto;
    padding: 1.5mm 4mm 4.5mm;
    margin: 0;
    background-color: #f7ecd2 !important;
    background-image: url("fond/fond-mm-effet.png"), url("fond/fond-ph.jpg") !important;
    background-repeat: no-repeat, repeat !important;
    background-position: top left, top left !important;
    background-size: 100% auto, auto !important;
  }
  .note {
    padding: 0;
    background: transparent !important;
  }
  .panel {
    background: transparent !important;
  }
  .note-hero {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 0.4rem;
    padding-bottom: 0.24rem;
    border-bottom: 1px solid rgba(117, 82, 39, 0.34);
    break-inside: avoid;
  }
  .note-hero h1 {
    margin: 0;
    font-size: 1.18rem;
    line-height: 1.04;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #362315 !important;
  }
  .note-portrait {
    width: 78px;
    height: 78px;
    border: 1px solid #c8b28e;
    background: rgba(247, 236, 210, 0.88);
    padding: 0.12rem;
    border-radius: 10px;
  }
  .meta {
    grid-template-columns: repeat(auto-fit, minmax(56mm, 1fr));
    gap: 0.24rem;
    margin-bottom: 0.42rem;
  }
  .meta div {
    background: rgba(251, 242, 221, 0.92) !important;
    border: 1px solid #ccb089;
    border-radius: 6px;
    padding: 0.24rem 0.34rem 0.22rem;
    break-inside: avoid;
  }
  .meta span {
    font-size: 0.56rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #7a5b3d !important;
  }
  .meta strong {
    margin-top: 0.07rem;
    font-size: 0.76rem;
    line-height: 1.18;
    color: #2d1c10 !important;
  }
  .note-content {
    font-size: 0.79rem;
    line-height: 1.34;
  }
  .note-content > *:first-child {
    margin-top: 0 !important;
  }
  .note-content p,
  .note-content ul,
  .note-content ol {
    margin: 0.22rem 0;
    orphans: 3;
    widows: 3;
    text-wrap: pretty;
  }
  .note-content ul,
  .note-content ol {
    padding-left: 1.15rem;
  }
  .note-content li {
    margin: 0.08rem 0;
    break-inside: avoid;
  }
  .note-content h1,
  .note-content h2,
  .note-content h3 {
    margin: 0.42rem 0 0.14rem;
    line-height: 1.12;
    break-after: avoid;
  }
  .note-content h2:not(:first-child),
  .note-content h3:not(:first-child) {
    padding-top: 0.08rem;
  }
  .note-content h1 + p,
  .note-content h1 + ul,
  .note-content h1 + ol,
  .note-content h2 + p,
  .note-content h2 + ul,
  .note-content h2 + ol,
  .note-content h3 + p,
  .note-content h3 + ul,
  .note-content h3 + ol {
    break-before: avoid;
  }
  .meta span,
  .note-summary,
  .note-content p,
  .note-content h1,
  .note-content h2,
  .note-content h3,
  .note-content li,
  .note-content strong,
  .note-content code,
  .note-content pre {
    color: #111111 !important;
  }
  .note-content a,
  .meta a {
    color: #111111 !important;
    text-decoration: underline;
  }
  .note-content pre,
  .note-content code {
    background: #f5f5f5 !important;
    border-color: #dddddd !important;
  }
  .note-content blockquote {
    margin: 0.35rem 0;
    padding: 0.28rem 0.5rem;
    border-left: 3px solid #b48753;
    background: rgba(250, 241, 220, 0.72);
    color: #3c291a !important;
    font-style: italic;
  }
  .note-content blockquote > *:first-child {
    margin-top: 0 !important;
  }
  .note-content blockquote > *:last-child {
    margin-bottom: 0 !important;
  }
  .note-content table {
    width: 100%;
    font-size: 0.72rem;
    border-collapse: collapse;
  }
  .note-table-wrap {
    border-color: #cfb18b !important;
    background: rgba(250, 241, 220, 0.68) !important;
    box-shadow: none !important;
  }
  .note-markdown-table {
    min-width: 0;
    table-layout: auto;
  }
  .note-content th,
  .note-content td {
    padding: 0.18rem 0.28rem;
    border-color: #cfb18b !important;
  }
  .note-content th {
    background: rgba(234, 219, 194, 0.82) !important;
    color: #412d1d !important;
  }
  .note-content hr {
    margin: 0.45rem 0 0.35rem;
    border: 0;
    border-top: 1px solid rgba(126, 93, 43, 0.35);
    break-after: avoid;
  }
  .note-content pre,
  .note-content blockquote,
  .note-content table,
  .note-content ul,
  .note-content ol,
  .journal-parchment {
    break-inside: avoid;
  }
  .note-content p:has(> img.inline-image) {
    break-inside: avoid;
    margin: 0.45rem 0;
  }
  .note-content img.inline-image {
    max-width: 72mm;
    max-height: 56mm;
    width: auto;
    height: auto;
    display: block;
    margin: 0.35rem auto;
    padding: 0.14rem;
    border-color: #ccb089;
    background: rgba(250, 241, 220, 0.84);
    box-shadow: none;
    break-inside: avoid;
  }
  .note-page-sparse .note-shell {
    display: flex;
  }
  .note-page-sparse .note {
    min-height: auto;
    display: flex;
    flex-direction: column;
  }
  .note-page-sparse .note-hero {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 0.72rem;
    margin-bottom: 0.5rem;
  }
  .note-page-sparse .note-hero h1 {
    font-size: 1.28rem;
  }
  .note-page-sparse .note-portrait {
    width: 92px;
    height: 92px;
  }
  .note-page-sparse .meta {
    margin-bottom: 0.55rem;
  }
  .note-page-sparse .note-content-sparse {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 0.84rem;
    line-height: 1.42;
  }
  .note-page-sparse .note-content-sparse p,
  .note-page-sparse .note-content-sparse ul,
  .note-page-sparse .note-content-sparse ol {
    margin: 0.28rem 0;
  }
  .note-page-sparse .note-content-with-illustration img.inline-image {
    max-width: 90mm;
    max-height: 118mm;
  }
  .note-page-sparse .note-content-ending-illustration > p:last-child {
    margin-top: 0.6rem;
    padding-top: 0.2rem;
  }
  .journal-parchment {
    margin: 0.35rem 0;
    padding: 0.42rem 0.48rem 0.36rem;
    border: 1px solid #7e5d2b !important;
    border-top: 4px solid #d59638 !important;
    border-bottom: 4px solid #d59638 !important;
    background-color: #f7ecd2 !important;
    color: #2a1f14 !important;
    box-shadow: none;
    break-inside: avoid;
    background-image:
      linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 28%),
      linear-gradient(180deg, #f9efd8, #f2e2bf) !important;
  }
  .journal-heading {
    color: #6d0000 !important;
    letter-spacing: 0.06em;
    margin: 0 0 0.16rem;
    font-size: 0.76rem;
  }
  .journal-parchment p,
  .journal-parchment li,
  .journal-parchment strong {
    color: #2a1f14 !important;
    font-size: 0.72rem;
    line-height: 1.22;
  }
  .journal-parchment ul { margin: 0.12rem 0; padding-left: 1rem; }
  .journal-parchment a {
    color: #8f1010 !important;
    text-decoration: none;
    border-bottom: 1px solid rgba(143, 16, 16, 0.45);
  }
  .journal-secret p:nth-last-child(2),
  .journal-secret p:last-child {
    text-align: right;
  }
  .journal-secret p:last-child img.inline-image {
    width: 19mm;
    max-width: 19mm;
    max-height: none;
    border: 0 !important;
    box-shadow: none !important;
    opacity: 0.92;
    filter: contrast(1.05) sepia(0.12);
  }
}

@keyframes revealIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1220px) {
  .index-layout { grid-template-columns: 1fr; }
  .index-rail { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .stats-strip { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .control-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .section-title { font-size: 1.35rem; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .left-nav {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0.62rem 0.55rem 0.5rem;
  }
  .brand { font-size: 0.78rem; letter-spacing: 0.04em; }
  .campaign { margin-bottom: 0.45rem; font-size: 0.74rem; }
  .left-menu {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.34rem;
    padding-bottom: 0;
  }
  .left-admin-access { margin-top: 0.55rem; }
  .nav-item {
    min-width: 0;
    padding: 0.42rem 0.5rem;
  }
  .nav-item small { font-size: 0.72rem; }
  .index-doc { padding: 0.78rem 0.62rem 1.35rem; }
  .index-hero { padding: 0.75rem; }
  .index-hero h1 { font-size: 1.65rem; }
  .hero-sub { font-size: 0.9rem; }
  .quick-jump { padding: 0.45rem; gap: 0.35rem; }
  .chip-link { height: 30px; padding: 0 0.6rem; font-size: 0.8rem; }
  .control-bar { position: static; }
  #global-search { min-height: 42px; font-size: 0.95rem; }
  .control-grid { grid-template-columns: 1fr; gap: 0.42rem; }
  .control-grid select, .control-grid input { min-height: 40px; font-size: 0.92rem; }
  .section-filters { grid-template-columns: 1fr; gap: 0.42rem; }
  .section-filters select { min-height: 40px; font-size: 0.92rem; }
  .index-tools { flex-wrap: wrap; }
  .index-tools button { min-height: 40px; flex: 1 1 140px; }
  #visible-counter { width: 100%; margin-left: 0; }
  .fold summary { padding: 0.6rem 0.58rem; }
  .section-title { font-size: 1.12rem; line-height: 1.2; padding: 0.48rem 0.56rem; }
  .section-body { padding: 0.4rem 0.52rem 0.66rem; }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.52rem; }
  .entity-card { padding: 0.5rem; }
  .entity-media .thumb { height: 170px; max-height: 170px; }
  .index-hero { flex-direction: column; }
  .hero-badges { justify-content: flex-start; }
  .index-rail { grid-template-columns: 1fr; }
  .note-hero { grid-template-columns: 1fr; }
  .linked { grid-template-columns: 1fr; }
  .faerun-layout { grid-template-columns: 1fr; }
  .faerun-layout > aside { order: 2; }
  .faerun-layout > div { order: 1; }
  .faerun-session-list { max-height: 280px; }
  .zone-nav { flex-wrap: wrap; }
  .zone-nav button { min-height: 38px; }
  .faerun-map { height: 420px; }
  .map-admin-tools button, .map-admin-import { min-height: 38px; }
  .note-table-wrap {
    margin-inline: -0.18rem;
    border-radius: 10px;
  }
  .note-markdown-table {
    min-width: 540px;
    table-layout: auto;
  }
  .note-markdown-table th,
  .note-markdown-table td {
    padding: 0.52rem 0.5rem;
    vertical-align: top;
  }
  .note-markdown-table td:first-child,
  .note-markdown-table th:first-child {
    width: 92px;
  }
  .note-markdown-table td:first-child .inline-image {
    max-width: 72px !important;
  }
  .note-markdown-table td:last-child,
  .note-markdown-table th:last-child {
    width: 82px;
  }
}
@media (max-width: 700px) {
  .stats-strip { grid-template-columns: 1fr; }
  .left-menu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entity-media .thumb { height: 210px; max-height: 210px; }
  .entity-card-pj .entity-media .thumb-pj { height: 180px; max-height: 180px; }
  .faerun-map { height: 58vh; min-height: 340px; }
  .faerun-pin span { display: none; }
  .note-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .note-markdown-table,
  .note-markdown-table tbody,
  .note-markdown-table tr,
  .note-markdown-table td {
    display: block;
    width: 100%;
  }
  .note-markdown-table {
    min-width: 0;
    border-collapse: separate;
    margin: 0.45rem 0 0.9rem;
  }
  .note-markdown-table thead {
    display: none;
  }
  .note-markdown-table tr {
    margin-bottom: 0.72rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(47, 36, 27, 0.98), rgba(34, 25, 18, 0.96));
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
  }
  html[data-theme="light"] .note-markdown-table tr {
    background: linear-gradient(180deg, rgba(255, 249, 241, 0.98), rgba(242, 228, 207, 0.98));
    border-color: #cfab82;
    box-shadow: 0 8px 18px rgba(109, 80, 46, 0.12);
  }
  .note-markdown-table td {
    position: relative;
    padding: 0.7rem 0.72rem 0.72rem;
    border-left: 0;
    border-right: 0;
    border-bottom: 1px solid rgba(127, 103, 79, 0.38);
    text-align: center;
  }
  .note-markdown-table td:last-child {
    border-bottom: 0;
  }
  .note-markdown-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.34rem;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .note-markdown-table td:first-child,
  .note-markdown-table td:last-child {
    width: 100%;
  }
  .note-markdown-table td:first-child .inline-image {
    max-width: min(100%, 112px) !important;
  }
}
@media (max-width: 560px) {
  .brand { font-size: 0.74rem; }
  .campaign { font-size: 0.71rem; }
  .left-menu { grid-template-columns: 1fr 1fr; }
  .nav-item { min-width: 0; }
  .nav-item span { font-size: 0.86rem; }
  .index-doc { padding: 0.64rem 0.46rem 1.1rem; }
  .index-hero { padding: 0.64rem; }
  .index-hero h1 { font-size: 1.42rem; }
  .hero-sub { font-size: 0.84rem; margin-top: 0.3rem; }
  .quick-jump { border-radius: 10px; }
  .chip-link { height: 29px; padding: 0 0.54rem; font-size: 0.77rem; }
  .control-bar { padding: 0.58rem; }
  .index-tools button { font-size: 0.84rem; }
  .section-title { font-size: 1.02rem; }
  .entity-media .thumb { height: 190px; max-height: 190px; }
  table { font-size: 0.88rem; }
  th, td { padding: 0.46rem 0.44rem; }
  .topbar { padding: 0.58rem 0.62rem; }
  .note-shell { padding: 0.62rem; }
  .meta { grid-template-columns: 1fr; }
  .faerun-session-list { max-height: 220px; }
  .faerun-map { height: 56vh; min-height: 320px; }
  .left-admin-access button { width: 100%; }
  .map-admin-tools { display: grid; grid-template-columns: 1fr; gap: 0.36rem; }
  .map-admin-tools button, .map-admin-import { width: 100%; text-align: center; justify-content: center; }
}
@media (max-width: 420px) {
  .left-nav { padding: 0.55rem 0.44rem; }
  .nav-item { min-width: 102px; }
  .index-doc { padding: 0.55rem 0.34rem 1rem; }
  .control-bar { padding: 0.52rem; }
  #global-search { min-height: 40px; font-size: 0.9rem; }
  .control-grid select, .control-grid input { min-height: 38px; font-size: 0.88rem; }
  .section-filters select { min-height: 38px; font-size: 0.88rem; }
  .fold summary { padding: 0.52rem 0.5rem; }
  .section-body { padding: 0.34rem 0.42rem 0.6rem; }
  .entity-media .thumb { height: 170px; max-height: 170px; }
  .faerun-map { min-height: 300px; }
  .map-admin-tools { grid-template-columns: 1fr; }
}
