@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg: #0b0f14;
  --panel: #101822;
  --panel-2: #111e2b;
  --graph-canvas-bg: radial-gradient(130% 120% at 50% 0%, rgba(54, 90, 138, 0.2), rgba(7, 12, 18, 0.94));
  --text: #e9f0f6;
  --muted: #9fb0c0;
  --border: #223244;
  --accent: #6aa6ff;
  --danger: #ff6a6a;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  --tab-h: 0px;
  --floating-tabs-top: 14px;
  --floating-bar-top: 14px;
  --graph-top-lane: 96px;
  --hier-canvas-top-gap: 12px;
  --topbar-right-reserve: 328px;
}

:root[data-theme="light"] {
  --bg: #edf3f9;
  --panel: #f7fbff;
  --panel-2: #eaf2fb;
  --graph-canvas-bg: radial-gradient(120% 120% at 50% 0%, rgba(113, 157, 206, 0.28), rgba(234, 242, 250, 0.96));
  --text: #1f3246;
  --muted: #5a6f84;
  --border: #c4d3e4;
  --accent: #2d6cc2;
  --danger: #bd3131;
  --shadow: 0 10px 28px rgba(27, 50, 76, 0.14);
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Space Grotesk", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: 0.1px;
}

#app {
  display: grid;
  grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
  height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  padding: 20px 20px 24px 20px;
  overflow: auto;
}

#sidebar-left {
  border-right: 1px solid var(--border);
}

.sidebar header {
  margin-bottom: 10px;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title-row__actions {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  flex: 0 0 auto;
}

.title-row--hier {
  width: 100%;
}

.title-row h1 {
  margin: 0;
}

.title-row + .small,
.title-row + .sub {
  margin-top: 6px;
}

.sidebar h1 {
  font-size: 24px;
  margin: 0 0 6px 0;
  letter-spacing: 0.2px;
}

.sidebar .sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.graph-hero-actions {
  margin-top: 12px;
}

.graph-hero-hier-btn {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(177, 222, 255, 0.86);
  background:
    radial-gradient(160% 220% at 4% 0%, rgba(238, 250, 255, 0.36), transparent 54%),
    linear-gradient(180deg, rgba(122, 188, 255, 0.8), rgba(78, 138, 222, 0.75));
  box-shadow: 0 0 0 1px rgba(236, 249, 255, 0.52), 0 0 20px rgba(114, 181, 255, 0.44);
  color: #f8fcff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-align: center;
}

.graph-hero-hier-btn:hover:not(:disabled) {
  border-color: rgba(230, 245, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(246, 252, 255, 0.62), 0 0 24px rgba(124, 191, 255, 0.54);
}

#hier-selected-only-hero.is-active,
#hier-selected-only-hero[aria-pressed="true"] {
  border-color: rgba(245, 226, 153, 0.96);
  background:
    radial-gradient(150% 200% at 6% 0%, rgba(255, 242, 180, 0.38), transparent 54%),
    linear-gradient(180deg, rgba(96, 155, 231, 0.82), rgba(62, 111, 186, 0.8));
  box-shadow: 0 0 0 1px rgba(255, 234, 171, 0.66), 0 0 22px rgba(130, 189, 255, 0.48);
}

#hier-selected-only-hero:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

.graph-relation-btn {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(170, 212, 255, 0.84);
  background:
    radial-gradient(140% 190% at 6% 0%, rgba(224, 243, 255, 0.3), transparent 56%),
    linear-gradient(180deg, rgba(92, 153, 226, 0.8), rgba(61, 115, 181, 0.76));
  box-shadow: 0 0 0 1px rgba(220, 242, 255, 0.48), 0 0 18px rgba(95, 162, 235, 0.34);
  color: #f8fcff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16px;
  text-align: center;
}

.graph-relation-btn:hover:not(:disabled) {
  border-color: rgba(224, 242, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(234, 248, 255, 0.6), 0 0 20px rgba(109, 175, 245, 0.42);
}

.graph-relation-btn--secondary {
  border-color: rgba(152, 189, 224, 0.6);
  background:
    radial-gradient(160% 190% at 6% 0%, rgba(180, 214, 248, 0.18), transparent 58%),
    linear-gradient(180deg, rgba(18, 31, 47, 0.88), rgba(11, 19, 30, 0.88));
  box-shadow: 0 0 0 1px rgba(178, 211, 244, 0.14), 0 10px 18px rgba(0, 0, 0, 0.22);
  color: #deedf9;
}

.graph-relation-btn--secondary.is-active,
.graph-relation-btn--secondary[aria-pressed="true"] {
  border-color: rgba(220, 236, 255, 0.94);
  background:
    radial-gradient(160% 190% at 6% 0%, rgba(216, 236, 255, 0.3), transparent 54%),
    linear-gradient(180deg, rgba(107, 163, 229, 0.78), rgba(61, 114, 178, 0.76));
  box-shadow: 0 0 0 1px rgba(220, 238, 255, 0.42), 0 0 18px rgba(104, 162, 231, 0.3);
  color: #f8fcff;
}

#relation-mode-left.is-active,
#relation-mode-left[aria-pressed="true"],
#relation-mode-filter.is-active,
#relation-mode-filter[aria-pressed="true"],
#topbar-relation-mode.is-active,
#topbar-relation-mode[aria-pressed="true"] {
  border-color: rgba(255, 234, 185, 0.96);
  background:
    radial-gradient(150% 210% at 6% 0%, rgba(255, 239, 195, 0.34), transparent 56%),
    linear-gradient(180deg, rgba(89, 146, 216, 0.84), rgba(55, 101, 163, 0.78));
  box-shadow: 0 0 0 1px rgba(255, 233, 179, 0.66), 0 0 20px rgba(136, 192, 255, 0.4);
  color: #fbfeff;
}

#relation-mode-left.relation-mode-with-missing,
#relation-mode-filter.relation-mode-with-missing,
#topbar-relation-mode.relation-mode-with-missing {
  border-color: rgba(255, 228, 171, 0.96);
  background:
    radial-gradient(150% 210% at 6% 0%, rgba(255, 196, 202, 0.36), transparent 56%),
    linear-gradient(180deg, rgba(201, 79, 100, 0.92), rgba(156, 50, 76, 0.86));
  box-shadow: 0 0 0 1px rgba(255, 199, 209, 0.78), 0 0 20px rgba(255, 92, 126, 0.44);
  color: #fff8fa;
}

#relation-mode-left.relation-mode-without-missing,
#relation-mode-filter.relation-mode-without-missing,
#topbar-relation-mode.relation-mode-without-missing {
  border-color: rgba(171, 255, 225, 0.96);
  background:
    radial-gradient(150% 210% at 6% 0%, rgba(191, 255, 227, 0.34), transparent 56%),
    linear-gradient(180deg, rgba(63, 160, 121, 0.9), rgba(40, 122, 90, 0.84));
  box-shadow: 0 0 0 1px rgba(190, 255, 229, 0.72), 0 0 20px rgba(73, 217, 156, 0.36);
  color: #f7fffb;
}

#relation-mode-left.relation-mode-named-only,
#relation-mode-filter.relation-mode-named-only,
#topbar-relation-mode.relation-mode-named-only {
  border-color: rgba(255, 211, 146, 0.96);
  background:
    radial-gradient(150% 210% at 6% 0%, rgba(255, 234, 190, 0.34), transparent 56%),
    linear-gradient(180deg, rgba(202, 140, 62, 0.92), rgba(158, 101, 34, 0.86));
  box-shadow: 0 0 0 1px rgba(255, 220, 161, 0.72), 0 0 20px rgba(244, 169, 71, 0.4);
  color: #fffaf1;
}

.graph-relation-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

.panel {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  background: rgba(0, 0, 0, 0.14);
}

.panel h2 {
  font-size: 12px;
  margin: 0 0 12px 0;
  color: #d7e3ee;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px 0;
}

.panel-head h2 {
  margin: 0;
}

.panel--graph .graph-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px 0;
}

.panel--graph .graph-panel-head h2 {
  margin: 0;
}

.panel--graph .graph-section-actions {
  margin-top: 12px;
  justify-content: flex-end;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.row + .row {
  margin-top: 8px;
}

.graph-layout-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}

.graph-layout-pair__item {
  min-width: 0;
}

.graph-layout-pair__item label {
  display: block;
  margin-bottom: 6px;
}

.filter-section {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.filter-section + .filter-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(120, 156, 196, 0.3);
}

.filter-section__title {
  margin: 0 0 10px 0;
  font-size: 11px;
  color: #c9dcf0;
  letter-spacing: 0.45px;
  text-transform: uppercase;
}

.filter-toggle-group {
  display: grid;
  gap: 8px;
}

.filter-toggle-group .row {
  margin-top: 0;
}

.filter-toggle {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  line-height: 1.25;
  font-size: 12px;
  border-color: rgba(95, 132, 174, 0.52);
  background: linear-gradient(180deg, rgba(21, 33, 47, 0.96), rgba(14, 24, 35, 0.92));
  color: #d8e7f6;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  transition: border-color 130ms ease, background 130ms ease, box-shadow 130ms ease, color 130ms ease, transform 120ms ease;
}

.filter-toggle:hover:not(:disabled) {
  border-color: rgba(138, 176, 219, 0.8);
  background: linear-gradient(180deg, rgba(28, 43, 61, 0.98), rgba(17, 30, 44, 0.95));
}

.filter-toggle:active:not(:disabled) {
  transform: translateY(0.5px);
}

.filter-toggle.is-active,
.filter-toggle[aria-pressed="true"] {
  border-color: rgba(168, 206, 250, 0.92);
  background: linear-gradient(180deg, rgba(83, 132, 197, 0.42), rgba(57, 98, 152, 0.36));
  color: #f2f9ff;
  box-shadow: 0 0 0 1px rgba(184, 217, 255, 0.45), 0 0 16px rgba(102, 162, 230, 0.26);
}

.filter-toggle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.filter-section--hier label {
  width: 100%;
  margin-top: 2px;
}

#hier-selected-level {
  width: 100%;
}

.hier-selected-label-menu {
  width: 100%;
  min-height: 84px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid rgba(132, 170, 212, 0.36);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(10, 17, 25, 0.92), rgba(8, 14, 21, 0.94));
  padding: 8px;
}

.hier-selected-label-menu__empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  padding: 4px;
}

.hier-selected-label-menu__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  color: #b5cae2;
}

.hier-selected-label-menu__title {
  color: #d8e9f9;
  font-weight: 600;
}

.hier-selected-label-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  border: 1px solid rgba(121, 160, 203, 0.22);
  border-radius: 10px;
  background: rgba(15, 26, 38, 0.72);
  padding: 7px 9px;
}

.hier-selected-label-item + .hier-selected-label-item {
  margin-top: 6px;
}

.hier-selected-label-item__text {
  font-size: 12px;
  line-height: 1.35;
  color: #e8f2fd;
}

.hier-selected-label-item__meta {
  font-size: 11px;
  color: #9bb4ce;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: nowrap;
}

#hier-selected-only {
  font-weight: 700;
  letter-spacing: 0.18px;
  border-color: rgba(158, 198, 244, 0.78);
  background:
    radial-gradient(120% 140% at 12% 8%, rgba(160, 212, 255, 0.22), transparent 58%),
    linear-gradient(180deg, rgba(31, 49, 70, 0.98), rgba(17, 30, 45, 0.95));
}

#hier-selected-only:hover:not(:disabled) {
  border-color: rgba(190, 222, 255, 0.95);
  background:
    radial-gradient(120% 140% at 12% 8%, rgba(170, 220, 255, 0.28), transparent 58%),
    linear-gradient(180deg, rgba(39, 60, 86, 0.98), rgba(21, 36, 53, 0.95));
}

#hier-selected-only.is-active,
#hier-selected-only[aria-pressed="true"] {
  font-weight: 800;
  border-color: rgba(222, 242, 255, 0.98);
  background:
    radial-gradient(140% 170% at 10% 8%, rgba(217, 240, 255, 0.36), transparent 56%),
    linear-gradient(180deg, rgba(106, 156, 220, 0.55), rgba(66, 115, 178, 0.47));
  color: #f7fcff;
  text-shadow: 0 0 8px rgba(213, 236, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(226, 244, 255, 0.72), 0 0 18px rgba(129, 184, 244, 0.35);
}

label {
  font-size: 12px;
  color: var(--muted);
}

select,
input[type="number"],
input[type="text"],
textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(12, 18, 26, 0.9);
  color: var(--text);
  outline: none;
}

button {
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(20, 30, 42, 0.95);
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: #38506a;
}

.btn-small {
  padding: 5px 8px;
  font-size: 11px;
  border-radius: 10px;
  line-height: 1.1;
}

button.danger {
  border-color: rgba(255, 106, 106, 0.35);
  color: #ffd1d1;
}

button.danger:hover {
  border-color: rgba(255, 106, 106, 0.7);
}

.hier-preset-box {
  margin-top: 8px;
}

#hier-import-text {
  box-sizing: border-box;
  width: 100%;
  min-height: 104px;
  resize: vertical;
  line-height: 1.42;
  font-size: 11.5px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.pill strong {
  color: #cfe3ff;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
}

#main {
  position: relative;
  display: block;
  height: 100vh;
  min-height: 520px;
  background: var(--bg);
  overflow: hidden;
  --graph-top-lane: 96px;
}

#threshold-bar {
  position: static;
  z-index: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  pointer-events: auto;
  margin-top: 14px;
}

.threshold-control {
  border: 1px solid rgba(118, 156, 198, 0.46);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(8, 15, 24, 0.9);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
}

.threshold-control__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.threshold-control label {
  display: block;
  margin: 0;
  min-width: 0;
  color: #d2e2f2;
}

.threshold-control .mono {
  display: block;
  margin: 0;
  color: #c8daed;
  font-size: 12px;
  white-space: nowrap;
  text-align: right;
}

#topbar-controls {
  position: absolute;
  top: var(--floating-bar-top);
  left: 12px;
  right: auto;
  width: min(1040px, max(0px, calc(100% - 24px - var(--topbar-right-reserve))));
  max-width: max(0px, calc(100% - 24px - var(--topbar-right-reserve)));
  box-sizing: border-box;
  transform: none;
  z-index: 28;
  pointer-events: none;
}

.topbar-controls__nav {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  gap: 8px;
  min-height: 50px;
  padding: 6px 10px;
  border-radius: 16px;
  border: 1px solid rgba(126, 166, 208, 0.46);
  background: rgba(8, 15, 24, 0.9);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
}

.topbar-controls.is-open .topbar-controls__nav {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: rgba(118, 156, 198, 0.08);
}

.topbar-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
  justify-content: flex-start;
}

.topbar-actions {
  display: flex;
  align-items: flex-start;
  align-content: flex-start;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 420px;
  min-width: min(100%, 320px);
  max-width: 100%;
  width: auto;
}

.topbar-actions > * {
  max-width: 100%;
}

#topbar-controls .topbar-tabs,
#topbar-controls .topbar-actions {
  display: contents;
}

.topbar-action-btn {
  border-radius: 999px;
  border: 1px solid rgba(152, 186, 220, 0.76);
  background: linear-gradient(180deg, rgba(49, 78, 110, 0.88), rgba(34, 58, 85, 0.9));
  color: #f0f7ff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16px;
  padding: 9px 15px;
  white-space: nowrap;
}

.topbar-action-btn:hover:not(:disabled) {
  border-color: rgba(183, 215, 247, 0.92);
  background: linear-gradient(180deg, rgba(66, 103, 141, 0.9), rgba(44, 76, 108, 0.92));
}

.topbar-action-btn[aria-pressed="true"] {
  border-color: rgba(228, 242, 255, 0.95);
  background: linear-gradient(180deg, rgba(113, 161, 219, 0.58), rgba(76, 121, 177, 0.52));
  color: #f7fcff;
  box-shadow: 0 0 0 1px rgba(206, 231, 255, 0.42), 0 0 14px rgba(111, 165, 227, 0.3);
}

.topbar-action-btn:disabled {
  opacity: 1;
  cursor: not-allowed;
  border-color: rgba(109, 124, 141, 0.58);
  background: linear-gradient(180deg, rgba(54, 61, 71, 0.9), rgba(40, 46, 55, 0.92));
  color: rgba(196, 206, 217, 0.82);
  box-shadow: none;
}

.topbar-compression-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.topbar-compact-select {
  min-width: 182px;
  max-width: 220px;
  height: 39px;
  padding: 0 38px 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(152, 186, 220, 0.76);
  background:
    linear-gradient(180deg, rgba(49, 78, 110, 0.88), rgba(34, 58, 85, 0.9)),
    rgba(34, 58, 85, 0.9);
  color: #f0f7ff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16px;
  box-shadow: none;
}

#topbar-controls .topbar-compact-select {
  min-width: 160px;
  max-width: 190px;
}

#topbar-controls .topbar-compression-wrap {
  gap: 8px;
}

.topbar-compact-select:disabled {
  border-color: rgba(109, 124, 141, 0.58);
  background:
    linear-gradient(180deg, rgba(54, 61, 71, 0.9), rgba(40, 46, 55, 0.92)),
    rgba(40, 46, 55, 0.92);
  color: rgba(196, 206, 217, 0.82);
  cursor: not-allowed;
}

.topbar-tab {
  border-radius: 999px;
  border: 1px solid rgba(90, 128, 169, 0.55);
  background: rgba(22, 35, 48, 0.92);
  color: #c8daed;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 9px 15px;
}

.topbar-controls.is-open .topbar-tab.active,
.topbar-controls.is-open .topbar-tab[aria-selected="true"] {
  border-color: rgba(184, 217, 255, 0.92);
  background: linear-gradient(180deg, rgba(81, 130, 191, 0.48), rgba(58, 98, 151, 0.4));
  color: #f4fbff;
  box-shadow: 0 0 0 1px rgba(213, 235, 255, 0.38), 0 0 12px rgba(108, 165, 231, 0.3);
}

@media (hover: hover) and (pointer: fine) {
  .topbar-tab:hover {
    border-color: rgba(147, 186, 229, 0.8);
    background: rgba(31, 49, 68, 0.95);
    color: #eaf4ff;
  }
}

.topbar-panel-stack {
  pointer-events: auto;
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  transform: none;
  width: min(760px, calc(100vw - 24px - var(--topbar-right-reserve)));
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0;
  overflow: visible;
}

.topbar-controls:not(.is-open) .topbar-panel-stack {
  display: none;
}

.topbar-panel {
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  border-top: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-color: rgba(118, 156, 198, 0.46);
  background: linear-gradient(180deg, rgba(14, 24, 35, 0.96), rgba(10, 18, 27, 0.93));
}

.topbar-panel:not(.active) {
  display: none;
}

.topbar-size-controls {
  display: grid;
  gap: 10px;
}

.topbar-size-control {
  border: 1px solid rgba(118, 156, 198, 0.34);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(10, 18, 27, 0.56);
}

.topbar-size-control__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.topbar-size-control label {
  display: block;
  margin: 0;
  color: #d2e2f2;
}

.topbar-size-control .mono {
  font-size: 12px;
  color: #c8daed;
  white-space: nowrap;
}

.topbar-display-toggle {
  margin-top: 12px;
  padding: 0 2px;
}

.topbar-display-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #d7e6f5;
  font-size: 13px;
  font-weight: 600;
}

.topbar-display-toggle input[type="checkbox"] {
  margin: 0;
}

#vis-shell {
  position: absolute;
  inset: 0;
  display: block;
}

.graph-pane {
  position: absolute;
  inset: 0;
  background: var(--graph-canvas-bg);
  overflow: hidden;
}

.detail-overlay-root {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: visible;
}

.detail-node-card {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 12px 13px;
  border: 1px solid rgba(167, 200, 233, 0.34);
  border-radius: 16px;
  background:
    radial-gradient(190% 240% at 10% 0%, rgba(255, 255, 255, 0.12), transparent 58%),
    rgba(18, 29, 42, 0.72);
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  pointer-events: auto;
  text-align: center;
  backdrop-filter: blur(6px);
}

.detail-node-card:hover,
.detail-node-card:focus-visible {
  border-color: rgba(225, 238, 255, 0.8);
  transform: translate(-50%, -50%) translateY(-1px);
  outline: none;
}

.detail-node-card.is-pinned {
  border-width: 1.6px;
}

.detail-node-card__main,
.detail-node-card__sub {
  display: block;
  pointer-events: none;
}

.detail-node-card__main {
  color: var(--detail-node-main-color, #edf5fc);
  font: 700 15px/1.24 "Space Grotesk", "Segoe UI", sans-serif;
  letter-spacing: 0.08px;
}

.detail-node-card__subwrap {
  display: block;
  margin-top: 1px;
}

.detail-node-card__sub {
  color: var(--detail-node-sub-color, #c5d8eb);
  font: 600 12px/1.22 "JetBrains Mono", ui-monospace, monospace;
}

.detail-node-card--compact {
  padding: 7px 9px;
}

.detail-node-card--compact .detail-node-card__main {
  font-size: 12px;
  line-height: 1.16;
}

.detail-node-card--compact .detail-node-card__sub {
  font-size: 10px;
}

.detail-edge-card,
.detail-edge-pill-group {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  min-width: 116px;
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid rgba(167, 200, 233, 0.42);
  border-radius: 16px;
  background:
    radial-gradient(170% 220% at 8% 0%, rgba(198, 224, 249, 0.14), transparent 56%),
    rgba(7, 13, 20, 0.9);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(160, 197, 233, 0.12);
  color: #edf5fc;
  font: 600 10px/1.16 "Space Grotesk", "Segoe UI", sans-serif;
  text-align: left;
  transform: translate(-50%, -50%);
  transition: box-shadow 120ms ease, border-color 120ms ease, transform 120ms ease;
  pointer-events: auto;
  backdrop-filter: blur(6px);
}

.detail-edge-pill-group {
  padding: 6px 8px;
  min-width: 0;
  border-radius: 999px;
  background:
    radial-gradient(180% 220% at 10% 0%, rgba(206, 229, 252, 0.16), transparent 58%),
    rgba(11, 18, 27, 0.82);
}

.detail-edge-card {
  min-width: 128px;
}

.detail-edge-card:hover,
.detail-edge-card:focus-visible,
.detail-edge-pill-group:hover,
.detail-edge-pill-group:focus-visible {
  border-color: rgba(222, 237, 255, 0.82);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(214, 233, 255, 0.26);
  transform: translate(-50%, -50%) translateY(-1px);
  outline: none;
}

.detail-edge-card__row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-chip {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  max-width: 100%;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
  font-size: 10px;
  line-height: 1.12;
  letter-spacing: 0.06px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.detail-chip--relation {
  border-color: rgba(141, 201, 244, 0.54);
  background: rgba(89, 156, 214, 0.24);
  color: #eef7ff;
}

.detail-chip--edge-label {
  border-color: rgba(145, 159, 179, 0.36);
  background: rgba(128, 142, 158, 0.16);
  color: #d9e4ef;
}

.detail-chip--auto-relate {
  border-color: rgba(255, 210, 88, 0.72);
  background: rgba(255, 210, 88, 0.2);
  color: #ffe28c;
  box-shadow: inset 0 0 0 1px rgba(255, 210, 88, 0.18), 0 0 14px rgba(255, 210, 88, 0.16);
}

.detail-chip--mechanism {
  border-color: rgba(145, 159, 179, 0.36);
  background: rgba(128, 142, 158, 0.16);
  color: #d9e4ef;
}

.detail-chip--summary,
.detail-chip--more {
  border-color: rgba(214, 193, 139, 0.34);
  background: rgba(196, 168, 83, 0.14);
  color: #f4e5b8;
}

.graph-pane__header {
  display: none;
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 15;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  pointer-events: none;
}

.graph-pane__title {
  flex: 1 1 260px;
  max-width: min(100%, 420px);
  border: 1px solid rgba(154, 192, 236, 0.34);
  border-radius: 14px;
  padding: 8px 12px;
  background: rgba(10, 18, 27, 0.82);
  color: #d8e7f7;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.28px;
  line-height: 1.35;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.graph-pane__fullscreen-btn {
  flex: 0 0 auto;
  pointer-events: auto;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border: 1px solid rgba(167, 206, 245, 0.4);
  border-radius: 10px;
  padding: 0;
  background:
    radial-gradient(160% 210% at 10% 0%, rgba(218, 236, 255, 0.22), transparent 56%),
    linear-gradient(180deg, rgba(18, 31, 46, 0.9), rgba(10, 19, 30, 0.92));
  color: #edf6ff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.graph-pane__fullscreen-btn svg {
  width: 18px;
  height: 18px;
}

.graph-pane__fullscreen-btn:hover:not(:disabled) {
  border-color: rgba(212, 232, 255, 0.72);
  background:
    radial-gradient(160% 210% at 10% 0%, rgba(226, 241, 255, 0.3), transparent 56%),
    linear-gradient(180deg, rgba(34, 52, 74, 0.94), rgba(14, 24, 36, 0.94));
}

.graph-pane__fullscreen-btn.is-active,
.graph-pane__fullscreen-btn[aria-pressed="true"] {
  border-color: rgba(255, 230, 164, 0.88);
  background:
    radial-gradient(180% 220% at 10% 0%, rgba(255, 243, 200, 0.28), transparent 58%),
    linear-gradient(180deg, rgba(106, 160, 224, 0.82), rgba(68, 117, 180, 0.82));
  color: #fffdfa;
  box-shadow: 0 0 0 1px rgba(255, 234, 182, 0.34), 0 10px 24px rgba(36, 72, 116, 0.28);
}

#vis,
#vis-transcoder {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

#vis canvas,
#vis-transcoder canvas,
#deck canvas {
  width: 100% !important;
  height: 100% !important;
}

.dual-inspector-family {
  display: inline-flex;
  gap: 8px;
  margin: 0 0 12px 0;
}

.dual-inspector-family__btn {
  border: 1px solid rgba(152, 191, 233, 0.34);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(13, 22, 34, 0.58);
  color: #cfe1f4;
  font-size: 12px;
  font-weight: 600;
}

.dual-inspector-family__btn.is-active {
  border-color: rgba(194, 224, 255, 0.72);
  background: linear-gradient(180deg, rgba(107, 163, 229, 0.82), rgba(65, 116, 180, 0.8));
  color: #f8fbff;
  box-shadow: 0 0 0 1px rgba(205, 230, 255, 0.22), 0 10px 18px rgba(43, 80, 132, 0.26);
}

#tooltip {
  position: absolute;
  z-index: 999;
  pointer-events: none;
  background: rgba(5, 10, 18, 0.93);
  border: 1px solid rgba(166, 204, 245, 0.42);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  max-width: 420px;
  white-space: pre-line;
  display: none;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(166, 204, 245, 0.08);
}

#tooltip.is-edge-tooltip {
  white-space: normal;
}

body.ui-mode-interactive-graph #graph-pane-transcoder {
  display: block !important;
}

body.ui-mode-interactive-graph .graph-pane__header {
  display: flex;
}

body.ui-mode-interactive-graph #vis-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: var(--graph-top-lane) 12px 12px 12px;
  box-sizing: border-box;
}

body.ui-mode-interactive-graph .graph-pane {
  position: relative;
  inset: auto;
  border: 1px solid rgba(117, 156, 197, 0.28);
  border-radius: 20px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

body.ui-mode-interactive-graph.ui-hide-relation-mode #relation-mode-left,
body.ui-mode-interactive-graph.ui-hide-relation-mode #relation-mode-filter,
body.ui-mode-interactive-graph.ui-hide-relation-mode #topbar-relation-mode {
  display: none !important;
}

body.ui-mode-interactive-graph #graph-pane-transcoder,
body.ui-mode-interactive-graph #vis-transcoder {
  display: block !important;
}

body.ui-mode-interactive-graph.ui-fullscreen-pane-cooccurrence #vis-shell,
body.ui-mode-interactive-graph.ui-fullscreen-pane-transcoder #vis-shell {
  grid-template-columns: minmax(0, 1fr);
}

body.ui-mode-interactive-graph.ui-fullscreen-pane-cooccurrence #graph-pane-transcoder,
body.ui-mode-interactive-graph.ui-fullscreen-pane-transcoder #graph-pane-cooc {
  display: none !important;
}

.edgeTipTitle {
  color: #cde1f6;
  font-size: 12px;
  letter-spacing: 0.1px;
}

.edgeTipLine {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 7px;
  font-size: 15px;
  line-height: 1.32;
  color: #e7f2ff;
}

.edgeTipLine--mechanism {
  align-items: center;
  gap: 9px;
}

.edgeTipNode {
  font-size: 15px;
  line-height: 1.32;
  font-weight: 600;
  color: #e7f2ff;
}

.edgeTipFlowCore {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}

.edgeTipArrowGlow {
  display: inline-flex;
  align-items: center;
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
  color: #c2cfdd;
  text-shadow: 0 0 10px rgba(109, 126, 144, 0.24);
}

.edgeTipMechanismGlow,
.inspectBadge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(185, 198, 214, 0.34);
  background: rgba(128, 142, 158, 0.16);
  box-shadow: inset 0 0 0 1px rgba(205, 216, 229, 0.08), 0 0 14px rgba(54, 66, 79, 0.18);
  color: #d9e4ef;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 800;
  text-shadow: none;
  word-break: break-word;
}

.edgeTipMechanismGlow--autoRelate,
.inspectBadge--autoRelate {
  border-color: rgba(255, 210, 88, 0.72);
  background: rgba(255, 210, 88, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 210, 88, 0.18), 0 0 14px rgba(255, 210, 88, 0.22);
  color: #ffd76a;
  text-shadow: 0 0 10px rgba(255, 215, 102, 0.42), 0 0 18px rgba(255, 181, 54, 0.18);
}

.edgeTipRelation {
  font-size: 15px;
  line-height: 1.32;
  font-weight: 800;
  color: #fff2cc;
}

.edgeTipMeta {
  margin-top: 4px;
  font-size: 12.5px;
  color: #d2e5f8;
}

.edgeTipList {
  max-height: 220px;
  overflow: auto;
  margin-top: 6px;
  padding-right: 6px;
}

.edgeTipListRow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 16, 24, 0.52);
  font-size: 12px;
  line-height: 1.45;
  color: #edf5ff;
}

.edgeTipListScore {
  flex: 0 0 auto;
  font-size: 11px;
  color: rgba(210, 229, 248, 0.84);
}

.edgeTipScore {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(210, 229, 248, 0.82);
}

.edgeTipSubtle {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(210, 229, 248, 0.72);
}

.edgeTipRelationText {
  font-size: 14px;
  line-height: 1.42;
}

.edgeTipMechanisms {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.48;
  font-weight: 650;
  color: #f7fbff;
}

.edgeTipFooter {
  margin-top: 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.edgeTipHint {
  font-size: 11px;
  line-height: 1.35;
  color: rgba(210, 229, 248, 0.76);
}

.edgeTipPager {
  margin-left: auto;
  font-size: 13px;
  line-height: 1;
  font-weight: 900;
  color: #f8fbff;
}

.edgeTipBadgeRow,
.inspectBadgeRow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.edgeTipMissing {
  margin-top: 7px;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 900;
  color: #ff2020;
  text-shadow: 0 0 10px rgba(255, 32, 32, 0.68);
}

.edgeTipKey {
  font-weight: 700;
  color: #bad9f9;
}

.edgeTipSep {
  margin: 0 4px;
  color: rgba(186, 217, 249, 0.85);
}

.graph-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
  background: rgba(7, 11, 16, 0.72);
  z-index: 12;
  pointer-events: none;
}

#tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.panel--text .text-controls {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.panel--text .text-controls__fields {
  display: grid;
  grid-template-columns: minmax(108px, 0.92fr) minmax(0, 1.08fr);
  gap: 10px;
  align-items: center;
}

.panel--text .text-controls__fields > * {
  min-width: 0;
}

.panel--text .text-controls__load-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.panel--text #unit-id {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.panel--text .text-controls__load-row button,
.panel--text #random-sentence {
  white-space: nowrap;
}

.compression-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid rgba(138, 178, 220, 0.34);
  background:
    radial-gradient(150% 180% at 10% 0%, rgba(126, 179, 244, 0.12), transparent 58%),
    rgba(11, 20, 30, 0.72);
  box-sizing: border-box;
  cursor: pointer;
  font-weight: 600;
  color: #e8f3ff;
}

.compression-toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #7fbbff;
}

.compression-toggle-label:hover {
  border-color: rgba(168, 206, 246, 0.56);
  background:
    radial-gradient(150% 180% at 10% 0%, rgba(133, 186, 249, 0.16), transparent 58%),
    rgba(14, 25, 37, 0.8);
}

.panel--text .text-meta {
  margin-top: 2px;
  margin-bottom: 8px;
}

.panel--text .breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px 0;
}

.panel--text .crumb,
.panel--text .crumbRange {
  font-size: 12px;
}

.panel--text .crumb {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(12, 18, 26, 0.8);
}

.panel--text .crumb.active {
  border-color: rgba(106, 166, 255, 0.6);
  color: #cfe3ff;
}

.panel--text .crumbRange {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  border: 1px dashed rgba(106, 166, 255, 0.25);
}

.panel--text .text {
  line-height: 1.55;
  white-space: pre-wrap;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(7, 12, 18, 0.6);
  min-height: 120px;
}

.panel--text .token-actions {
  margin-top: 10px;
  gap: 8px;
}

.token {
  font-size: 12px;
  padding: 6px 9px;
  border-radius: 11px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: rgba(0, 0, 0, 0.15);
}

.token.selected {
  border-color: rgba(106, 166, 255, 0.9);
  background: rgba(106, 166, 255, 0.18);
}

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

.list {
  max-height: 320px;
  overflow: auto;
  padding-right: 6px;
}

.selection-display-row {
  margin-top: 10px;
}

.selection-display-row select {
  width: 100%;
}

.featRow,
.edgeRow {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 16, 24, 0.6);
  margin-bottom: 8px;
  cursor: pointer;
}

.featRow:hover,
.edgeRow:hover {
  border-color: rgba(106, 166, 255, 0.5);
  background: rgba(13, 20, 30, 0.85);
}

.featRow:focus-visible,
.edgeRow:focus-visible {
  outline: 2px solid rgba(106, 166, 255, 0.92);
  outline-offset: 2px;
}

.featMain {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.featRow.is-pinned {
  border-color: rgba(255, 231, 154, 0.95);
  background:
    radial-gradient(160% 150% at 8% 0%, rgba(255, 240, 187, 0.2), transparent 56%),
    rgba(20, 24, 28, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 235, 170, 0.68), 0 0 20px rgba(255, 208, 96, 0.34);
}

.featId {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  color: #cfe3ff;
  font-size: 12px;
}

.featTitle {
  font-size: 12px;
  color: #e6edf3;
  white-space: pre-wrap;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  line-height: 1.4;
}

.featScore {
  font-size: 11px;
  color: var(--muted);
}

.featMeta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

#inspector {
  font-size: 13px;
  line-height: 1.48;
  color: #e5f0fb;
}

.inspectTitle {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.32;
  color: #f4f9ff;
  margin-bottom: 6px;
}

.inspectSub {
  margin-top: 4px;
  color: #c9daeb;
  font-size: 13px;
  line-height: 1.42;
}

.inspectDesc {
  margin-top: 8px;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.52;
  color: #ecf4ff;
}

.inspectList {
  max-height: 220px;
  overflow: auto;
  margin-top: 6px;
  padding-right: 6px;
}

.inspectRow {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 16, 24, 0.6);
  margin-bottom: 6px;
  font-size: 13px;
}

.inspectMechanisms {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.5;
  color: #f4f8ff;
}

.inspectRelCard {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(166, 206, 248, 0.48);
  background: linear-gradient(180deg, rgba(16, 28, 42, 0.94), rgba(9, 19, 31, 0.96));
}

.inspectRelTitle {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  color: #a9c7e7;
}

.inspectRelPhrase {
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.34;
  font-weight: 800;
  color: #fff2cf;
}

.inspectRelMeta {
  margin-top: 5px;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  align-items: baseline;
  font-size: 13px;
}

.inspectRelKey {
  color: #a9c7e7;
  font-weight: 700;
}

.inspectRelValue {
  color: #e8f4ff;
  font-weight: 600;
}

.inspectRelMetaAlert {
  margin-top: 7px;
}

.inspectRelKeyAlert,
.inspectRelValueAlert {
  color: #ff3b3b;
  font-weight: 900;
  text-shadow: 0 0 6px rgba(255, 59, 59, 0.45);
}

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

.clickable {
  cursor: pointer;
  color: #cfe3ff;
  text-decoration: underline;
  text-decoration-color: rgba(207, 227, 255, 0.35);
}

.clickable:hover {
  text-decoration-color: rgba(207, 227, 255, 0.9);
}

input[type="range"] {
  width: 100%;
}

.small {
  font-size: 12px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

body.view-hierarchy #app {
  display: none;
}

body.view-book #app {
  display: none;
}

#hierarchy-view {
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.hier-inspector {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  background: linear-gradient(180deg, #0e1721, #121f2d);
  border-right: 1px solid var(--border);
  padding: 12px;
  overflow: auto;
}

.hier-panel {
  margin: 0;
}

.hier-panel .row + .row {
  margin-top: 10px;
}

.hier-preset-panel {
  margin-top: auto;
}

#hier-center {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  background: var(--bg);
  --hier-canvas-top-gap: 12px;
}

#book-view {
  position: relative;
  display: block;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(140% 100% at 50% 0%, rgba(95, 143, 204, 0.16), transparent 58%),
    radial-gradient(140% 160% at 0% 0%, rgba(76, 120, 180, 0.18), transparent 44%),
    linear-gradient(180deg, rgba(8, 14, 22, 0.98), rgba(11, 17, 25, 0.99));
}

#book-rail {
  min-width: 0;
  padding: 18px 0 18px 18px;
  border-right: 1px solid rgba(108, 144, 186, 0.2);
  overflow: hidden;
}

#book-rail-card {
  height: 100%;
  overflow: auto;
  padding: 18px 16px 18px 16px;
  border-radius: 26px;
  border: 1px solid rgba(123, 162, 205, 0.28);
  background:
    radial-gradient(180% 220% at 8% 0%, rgba(101, 159, 229, 0.18), transparent 56%),
    linear-gradient(180deg, rgba(14, 23, 34, 0.94), rgba(11, 18, 27, 0.97));
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(198, 221, 244, 0.08) inset;
}

.book-rail-header {
  display: grid;
  gap: 8px;
}

.book-rail-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(156, 193, 231, 0.84);
}

.book-rail-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.05;
  color: #f1f8ff;
}

.book-rail-copy {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(196, 214, 233, 0.82);
}

.book-rail-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(121, 158, 200, 0.18);
}

.book-rail-label {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(158, 192, 226, 0.82);
}

.book-search-input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid rgba(134, 174, 216, 0.42);
  background:
    radial-gradient(160% 180% at 8% 0%, rgba(102, 160, 228, 0.16), transparent 56%),
    rgba(16, 27, 39, 0.88);
  color: #edf5fd;
  font-size: 14px;
  line-height: 1.3;
  box-shadow: inset 0 1px 0 rgba(216, 232, 247, 0.08);
}

.book-search-input::placeholder {
  color: rgba(155, 182, 209, 0.76);
}

.book-search-input:focus-visible {
  outline: 2px solid rgba(145, 196, 250, 0.66);
  outline-offset: 2px;
}

.book-search-meta {
  margin-top: 9px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(169, 195, 220, 0.82);
}

.book-search-results {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: min(44vh, 360px);
  overflow: auto;
  padding-right: 4px;
}

.book-search-result {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 10px 11px;
  border-radius: 16px;
  border: 1px solid rgba(123, 164, 207, 0.3);
  background:
    radial-gradient(160% 190% at 8% 0%, rgba(110, 166, 232, 0.16), transparent 56%),
    rgba(14, 24, 35, 0.78);
  color: #f0f6fc;
  text-align: left;
}

.book-search-result:hover {
  border-color: rgba(165, 205, 245, 0.58);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
}

.book-search-result.is-active {
  border-color: rgba(197, 226, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(205, 229, 251, 0.18), 0 10px 24px rgba(80, 126, 179, 0.18);
}

.book-search-result__meta {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(160, 192, 223, 0.82);
}

.book-search-result__text {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(235, 244, 252, 0.94);
}

.book-search-result mark {
  padding: 0 2px;
  border-radius: 5px;
  background: rgba(255, 214, 107, 0.28);
  color: inherit;
}

.book-outline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.book-outline {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.book-outline-empty {
  font-size: 12px;
  line-height: 1.5;
  color: rgba(169, 195, 220, 0.78);
}

.book-outline-item {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 14px;
  border: 1px solid rgba(120, 158, 198, 0.18);
  background: rgba(12, 21, 31, 0.34);
  color: #eaf3fb;
  text-align: left;
}

.book-outline-item[data-depth="1"] {
  padding-left: 22px;
}

.book-outline-item[data-depth="2"] {
  padding-left: 34px;
}

.book-outline-item[data-depth="3"] {
  padding-left: 46px;
}

.book-outline-item:hover {
  border-color: rgba(157, 196, 237, 0.5);
  background: rgba(18, 30, 43, 0.62);
}

.book-outline-item.is-active {
  border-color: rgba(202, 228, 253, 0.72);
  background:
    radial-gradient(180% 200% at 8% 0%, rgba(118, 178, 243, 0.24), transparent 56%),
    rgba(20, 33, 47, 0.84);
  box-shadow: 0 0 0 1px rgba(206, 228, 250, 0.16), 0 10px 20px rgba(79, 121, 170, 0.16);
}

.book-outline-item__kind {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(156, 190, 223, 0.78);
}

.book-outline-item__label {
  font-size: 12px;
  line-height: 1.45;
  color: inherit;
}

#book-center {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  min-width: 0;
  --book-scroll-top-gap: 16px;
}

#book-toolbar {
  position: relative;
  display: grid;
  padding: 20px 28px 14px 28px;
  padding-right: calc(28px + var(--topbar-right-reserve));
  border-bottom: 1px solid rgba(114, 150, 194, 0.22);
  background:
    linear-gradient(180deg, rgba(10, 17, 26, 0.94), rgba(10, 17, 26, 0.7)),
    rgba(10, 17, 26, 0.74);
  backdrop-filter: blur(8px);
  z-index: 2;
}

#book-toolbar-shell {
  display: grid;
  gap: 12px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 10px;
  box-sizing: border-box;
}

#book-toolbar .topbar-controls__nav {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

.book-toolbar-actions {
  align-items: end;
  justify-content: flex-start;
}

.book-toolbar-group {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.book-toolbar-label {
  margin-left: 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(192, 215, 238, 0.72);
}

.book-toolbar-group .topbar-compact-select {
  min-width: 190px;
  max-width: 320px;
}

.book-theme-toggle {
  margin-left: auto;
  align-self: end;
}

#book-search-panel {
  display: none;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid rgba(123, 164, 207, 0.3);
  background:
    radial-gradient(180% 190% at 8% 0%, rgba(110, 166, 232, 0.16), transparent 56%),
    rgba(14, 24, 35, 0.84);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
}

#book-search-panel.is-open {
  display: grid;
  gap: 10px;
}

#book-scroll {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--book-scroll-top-gap) + 4px) 28px 32px 28px;
}

#book-paper {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 3vw, 34px);
  border-radius: 28px;
  border: 1px solid rgba(129, 165, 210, 0.34);
  background:
    radial-gradient(180% 150% at 50% 0%, rgba(110, 164, 232, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(17, 25, 36, 0.96), rgba(12, 18, 27, 0.98));
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(197, 221, 245, 0.08) inset;
}

.book-hero {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.book-eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8fb6de;
}

.book-eyebrow:empty {
  display: none;
}

.book-heading {
  margin: 0;
  font-size: clamp(30px, 3.8vw, 46px);
  line-height: 1.01;
  letter-spacing: -0.03em;
  color: #f6fbff;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.book-subheading {
  max-width: 80ch;
  font-size: 14px;
  line-height: 1.58;
  color: rgba(208, 223, 238, 0.82);
}

.book-empty {
  padding: 20px 0 8px 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.book-body {
  display: grid;
  gap: 24px;
}

.book-subchapter {
  display: grid;
  gap: 14px;
  scroll-margin-top: 122px;
}

.book-subchapter.is-active-unit {
  padding-left: 14px;
  border-left: 3px solid rgba(171, 212, 253, 0.62);
}

.book-subchapter-heading {
  margin: 0;
  font-size: clamp(22px, 2.8vw, 30px);
  line-height: 1.06;
  color: #eff7ff;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.book-subchapter-deck {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(168, 194, 220, 0.86);
}

.book-section-heading {
  margin: 6px 0 0 0;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.12;
  color: #edf6ff;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  scroll-margin-top: 122px;
}

.book-section-heading--minor {
  font-size: clamp(17px, 2vw, 22px);
  color: #dbeaf9;
}

.book-paragraph {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 22px;
  border: 1px solid rgba(108, 144, 186, 0.22);
  background:
    linear-gradient(180deg, rgba(18, 27, 39, 0.78), rgba(14, 21, 31, 0.82)),
    rgba(14, 21, 31, 0.82);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.book-paragraph:hover {
  border-color: rgba(154, 197, 241, 0.42);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

.book-paragraph.has-active-sentence,
.book-paragraph.is-active-unit {
  border-color: rgba(184, 221, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(210, 234, 255, 0.18), 0 12px 30px rgba(68, 111, 162, 0.18);
}

.book-paragraph--compact {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.book-paragraph--compact:hover {
  transform: none;
  box-shadow: none;
}

.book-paragraph--list-item {
  margin: 0;
}

.book-paragraph--title {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.book-paragraph-meta {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(149, 178, 207, 0.82);
}

.book-paragraph-text {
  margin: 0;
  font-size: clamp(14px, 1.12vw, 16px);
  line-height: 1.58;
  color: rgba(239, 246, 253, 0.96);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.book-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 24px;
}

.book-list-item-text {
  font-size: clamp(14px, 1.22vw, 16px);
  line-height: 1.62;
  color: rgba(238, 245, 252, 0.95);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.book-textbox {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(153, 191, 232, 0.38);
  background:
    radial-gradient(180% 180% at 8% 0%, rgba(116, 175, 243, 0.18), transparent 56%),
    rgba(19, 30, 43, 0.84);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
  scroll-margin-top: 122px;
}

.book-textbox--learning-objectives {
  border-color: rgba(131, 213, 190, 0.42);
  background:
    radial-gradient(180% 180% at 8% 0%, rgba(104, 205, 173, 0.18), transparent 56%),
    rgba(16, 31, 31, 0.84);
}

.book-textbox--exercises {
  border-color: rgba(231, 193, 118, 0.42);
  background:
    radial-gradient(180% 180% at 8% 0%, rgba(235, 198, 118, 0.18), transparent 56%),
    rgba(37, 30, 20, 0.82);
}

.book-textbox--shaded {
  border-color: rgba(146, 177, 212, 0.42);
  background:
    radial-gradient(180% 180% at 8% 0%, rgba(169, 205, 242, 0.18), transparent 56%),
    rgba(22, 31, 42, 0.86);
}

.book-textbox-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  color: #f4fbff;
}

.book-textbox-title-text {
  font-size: clamp(18px, 1.9vw, 22px);
  line-height: 1.35;
  color: inherit;
  font-family: "Space Grotesk", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.book-textbox-body {
  display: grid;
  gap: 14px;
}

.book-figure {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(139, 177, 218, 0.3);
  background:
    radial-gradient(180% 180% at 50% 0%, rgba(113, 168, 235, 0.14), transparent 60%),
    linear-gradient(180deg, rgba(19, 30, 43, 0.82), rgba(14, 23, 34, 0.88)),
    rgba(14, 23, 34, 0.86);
  scroll-margin-top: 122px;
}

.book-figure-media {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: min(30vh, 240px);
  padding: clamp(10px, 1.6vw, 16px);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(9, 16, 24, 0.46), rgba(13, 21, 31, 0.28)),
    rgba(9, 16, 24, 0.3);
  box-shadow: inset 0 0 0 1px rgba(181, 211, 244, 0.08);
}

.book-figure-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(72vh, 620px);
  object-fit: contain;
  border-radius: 14px;
  border: none;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
}

.book-figure-caption {
  font-size: 13px;
  line-height: 1.48;
  color: rgba(198, 217, 236, 0.9);
}

.book-table-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid rgba(135, 173, 214, 0.34);
  background:
    linear-gradient(180deg, rgba(18, 28, 40, 0.84), rgba(12, 20, 30, 0.88)),
    rgba(12, 20, 30, 0.88);
  scroll-margin-top: 122px;
}

.book-table-caption {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
  color: rgba(223, 236, 248, 0.92);
}

.book-table-wrap {
  overflow: auto;
}

.book-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}

.book-table th,
.book-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(129, 164, 203, 0.24);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.45;
}

.book-table th {
  font-weight: 800;
  color: #eef7ff;
}

.book-table td {
  color: rgba(220, 233, 245, 0.9);
}

.book-note-block {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: rgba(210, 226, 242, 0.82);
}

.book-sentence {
  display: inline;
  border-radius: 12px;
  padding: 2px 4px;
  margin: 0 -2px;
  cursor: pointer;
  outline: none;
  transition: background-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
}

.book-sentence:hover,
.book-sentence:focus-visible {
  background: rgba(109, 171, 244, 0.18);
  box-shadow: 0 0 0 1px rgba(173, 214, 255, 0.24);
  color: #ffffff;
}

.book-sentence.is-active {
  background: rgba(155, 202, 255, 0.2);
  box-shadow: 0 0 0 1px rgba(213, 234, 255, 0.36), 0 0 18px rgba(114, 168, 233, 0.18);
  color: #ffffff;
}

.hier-left-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 2px 2px 10px 2px;
  border-bottom: 1px solid rgba(116, 170, 246, 0.26);
}

.hier-left-title {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: 0.2px;
  color: #f0f7ff;
  text-shadow: 0 2px 16px rgba(47, 111, 197, 0.35);
}

.hier-selected-label,
.hier-selected-feat,
.hier-search-item .snippet {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hier-show-descriptions-btn {
  justify-self: start;
  min-height: 46px;
  padding: 11px 20px;
  margin-bottom: 2px;
  border-radius: 14px;
  border: 1px solid rgba(168, 215, 255, 0.84);
  background:
    radial-gradient(150% 210% at 4% 0%, rgba(231, 247, 255, 0.36), transparent 54%),
    linear-gradient(180deg, rgba(112, 176, 255, 0.78), rgba(71, 130, 215, 0.72));
  box-shadow: 0 0 0 1px rgba(233, 247, 255, 0.54), 0 0 18px rgba(109, 177, 255, 0.42);
  color: #f8fcff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: none;
}

.hier-show-descriptions-btn:hover {
  border-color: rgba(221, 242, 255, 0.94);
  box-shadow: 0 0 0 1px rgba(243, 251, 255, 0.64), 0 0 22px rgba(119, 187, 255, 0.5);
}

#hier-show-descriptions.is-active {
  border-color: rgba(182, 232, 255, 0.95);
  background:
    radial-gradient(150% 210% at 4% 0%, rgba(218, 249, 255, 0.22), transparent 54%),
    linear-gradient(180deg, rgba(76, 142, 228, 0.74), rgba(52, 104, 180, 0.7));
  box-shadow: 0 0 0 1px rgba(211, 240, 255, 0.58), 0 0 20px rgba(85, 160, 241, 0.42);
}

#hier-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0;
  justify-self: start;
  width: fit-content;
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  min-height: 0;
  margin: var(--floating-bar-top) 12px 8px 12px;
  padding: 0;
  border: none;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  position: relative;
  z-index: 8;
}

#hier-toolbar .topbar-controls__nav {
  min-height: 50px;
}

#hier-toolbar .topbar-actions {
  flex-wrap: wrap;
}

.hier-status {
  margin: 0 16px 8px 16px;
  min-height: 16px;
}

#hier-canvas-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  margin: var(--hier-canvas-top-gap) 12px 12px 12px;
  border: 1px solid rgba(118, 156, 201, 0.48);
  border-radius: 20px;
  background:
    radial-gradient(180% 150% at 50% 0%, rgba(76, 117, 176, 0.16), transparent 56%),
    rgba(8, 13, 20, 0.5);
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
}

#hier-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
  cursor: grab;
}

#hier-canvas:active {
  cursor: grabbing;
}

.hier-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
  background: rgba(7, 11, 16, 0.72);
}

.hier-tooltip {
  position: absolute;
  z-index: 18;
  pointer-events: none;
  max-width: min(520px, 56vw);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(160, 193, 233, 0.42);
  background: rgba(7, 13, 20, 0.95);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  color: #deebf9;
  font-size: 12px;
  white-space: pre-wrap;
}

#hier-edges path {
  fill: none;
  transition: stroke 120ms ease, stroke-width 120ms ease, filter 140ms ease;
}

#hier-nodes .h-node {
  cursor: pointer;
}

#hier-nodes .node-hit-area {
  fill: rgba(0, 0, 0, 0);
  stroke: none;
  pointer-events: all;
}

#hier-nodes .node-dot {
  transition: fill 120ms ease, stroke 120ms ease, stroke-width 120ms ease, filter 140ms ease, r 120ms ease;
}

#hier-nodes .node-box {
  transition: fill 120ms ease, stroke 120ms ease, stroke-width 120ms ease, filter 140ms ease;
}

#hier-nodes .h-node:hover .node-dot,
#hier-nodes .h-node.hovered .node-dot {
  filter: brightness(1.14);
}

#hier-nodes .h-node.selected .node-dot {
  filter: drop-shadow(0 0 8px rgba(168, 203, 255, 0.42));
}

#hier-nodes .h-node.partial .node-dot {
  stroke-dasharray: 2 1.2;
}

#hier-nodes .h-node.highlighted .node-dot {
  filter: drop-shadow(0 0 7px rgba(255, 148, 84, 0.55));
}

#hier-nodes .h-node text {
  fill: #dfe9f5;
  font-size: 12px;
  dominant-baseline: middle;
  pointer-events: none;
}

#hier-nodes .h-node text.node-meta {
  fill: #9cb0c4;
  font-size: 11px;
}

#hier-nodes .h-node .node-box-label {
  dominant-baseline: middle;
  pointer-events: none;
}

#hier-nodes .h-node .node-box-main {
  font-size: 12px;
  font-weight: 600;
  dominant-baseline: text-before-edge;
}

#hier-nodes .h-node .node-box-sub {
  font-size: 10.5px;
  dominant-baseline: text-before-edge;
}

#hier-nodes .toggle-hit {
  cursor: pointer;
}

#hier-nodes .toggle-hit rect {
  fill: rgba(12, 23, 36, 0.9);
  stroke: rgba(64, 97, 130, 0.8);
  rx: 3px;
  ry: 3px;
}

#hier-nodes .toggle-hit text {
  font-size: 11px;
  fill: #cde0f7;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

#hier-nodes .selected-dot {
  filter: drop-shadow(0 0 4px rgba(152, 196, 255, 0.55));
}

.hier-selected-features-panel {
  display: flex;
  flex-direction: column;
  min-height: 24vh;
}

.hier-selected-features-list {
  margin-top: 8px;
  max-height: 30vh;
  overflow: auto;
  padding-right: 6px;
}

.hier-node-selector-panel {
  display: flex;
  flex-direction: column;
  min-height: 20vh;
}

.hier-node-selector-list {
  margin-top: 8px;
  max-height: 24vh;
  overflow: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hier-occurrence-node {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  text-align: left;
  border-radius: 11px;
  border: 1px solid rgba(140, 176, 216, 0.34);
  background: linear-gradient(180deg, rgba(12, 21, 31, 0.88), rgba(8, 16, 24, 0.9));
  padding: 8px 10px;
}

.hier-occurrence-node:hover {
  border-color: rgba(182, 214, 248, 0.72);
  background: linear-gradient(180deg, rgba(20, 34, 49, 0.94), rgba(13, 25, 37, 0.95));
}

.hier-occurrence-node.active {
  border-color: rgba(226, 243, 255, 0.88);
  box-shadow: 0 0 0 1px rgba(188, 224, 255, 0.46), 0 0 14px rgba(120, 183, 245, 0.24);
}

.hier-occurrence-node__desc {
  font-size: 12px;
  line-height: 1.35;
  color: #deebfa;
}

.hier-occurrence-node__meta {
  font-size: 11px;
  color: #9dc0e2;
  white-space: nowrap;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.hier-level-block {
  border: 1px solid rgba(130, 169, 212, 0.24);
  border-radius: 12px;
  padding: 9px;
  margin-bottom: 9px;
  background: rgba(9, 16, 24, 0.66);
}

.hier-level-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 8px;
}

.hier-level-title {
  font-size: 12px;
  font-weight: 600;
  color: #e8f2ff;
}

.hier-level-meta {
  font-size: 11px;
  color: #9eb4cb;
}

.hier-selected-label {
  font-size: 12px;
  line-height: 1.45;
  color: #dce9f8;
  padding: 4px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.hier-selected-label.active {
  color: #f4fbff;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(123, 182, 255, 0.45);
}

.hier-selected-feat {
  font-size: 11px;
  line-height: 1.35;
  color: #d6e4f3;
  padding: 4px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.hier-selected-feat .fid {
  color: #9ec4f0;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  margin-right: 6px;
}

.hier-search-results {
  margin-top: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 6px;
}

.hier-search-group-title {
  margin: 12px 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a9c3de;
}

.hier-search-group-title:first-child {
  margin-top: 2px;
}

.hier-search-item {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  background: rgba(12, 20, 30, 0.75);
}

.hier-search-item .meta {
  font-size: 11px;
  color: #9fb2c7;
}

.hier-search-item .snippet {
  margin-top: 5px;
  font-size: 12px;
  color: #dfe8f1;
}

.hier-search-item mark {
  background: rgba(255, 210, 92, 0.3);
  color: #ffe7b6;
}

.hier-search-actions {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}

#bottom-tabs {
  position: fixed;
  top: var(--floating-tabs-top);
  right: 14px;
  left: auto;
  transform: none;
  bottom: auto;
  height: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  border: 1px solid rgba(168, 206, 246, 0.58);
  background:
    radial-gradient(200% 220% at 8% 0%, rgba(109, 169, 240, 0.34), transparent 56%),
    rgba(8, 15, 24, 0.92);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.44), 0 0 0 1px rgba(203, 229, 255, 0.16) inset;
  z-index: 46;
}

.bottom-tab {
  flex: none;
  min-width: 126px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #9db2c8;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.32px;
  padding: 10px 18px;
}

.bottom-tab:hover {
  background: rgba(40, 61, 85, 0.5);
  color: #e2edf9;
}

.bottom-tab.active {
  background: rgba(96, 151, 224, 0.36);
  border-color: rgba(174, 214, 255, 0.74);
  color: #f1f7ff;
  box-shadow: 0 0 0 1px rgba(255, 234, 167, 0.62) inset, 0 0 14px rgba(121, 181, 246, 0.4);
}

.theme-toggle-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid rgba(157, 198, 241, 0.64);
  background:
    radial-gradient(170% 200% at 6% 0%, rgba(116, 175, 244, 0.28), transparent 56%),
    rgba(11, 22, 34, 0.94);
  color: #d9ebff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(205, 228, 254, 0.18) inset;
}

.header-theme-toggle {
  flex: 0 0 auto;
  align-self: flex-start;
}

.title-row__actions .theme-toggle-btn svg {
  width: 18px;
  height: 18px;
}

.theme-toggle-btn:hover {
  border-color: rgba(197, 226, 255, 0.86);
  background:
    radial-gradient(170% 200% at 6% 0%, rgba(139, 193, 255, 0.34), transparent 56%),
    rgba(14, 27, 41, 0.95);
}

.theme-toggle-btn[aria-pressed="true"] {
  border-color: rgba(227, 203, 141, 0.82);
  color: #fff6e2;
  background:
    radial-gradient(170% 200% at 6% 0%, rgba(255, 230, 172, 0.34), transparent 56%),
    rgba(29, 34, 38, 0.94);
}

:root[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #f7fbff, #eaf2fb);
}

:root[data-theme="light"] .panel {
  border-color: #c4d4e5;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 24px rgba(34, 62, 93, 0.12);
}

:root[data-theme="light"] .panel h2 {
  color: #3b5773;
}

:root[data-theme="light"] .graph-hero-hier-btn {
  border-color: rgba(117, 156, 198, 0.86);
  background:
    radial-gradient(160% 220% at 4% 0%, rgba(167, 209, 248, 0.3), transparent 54%),
    linear-gradient(180deg, rgba(219, 238, 255, 0.9), rgba(186, 216, 245, 0.82));
  box-shadow: 0 0 0 1px rgba(189, 218, 247, 0.52), 0 0 18px rgba(115, 164, 215, 0.22);
  color: #163a5a;
}

:root[data-theme="light"] .graph-hero-hier-btn:hover:not(:disabled) {
  border-color: rgba(92, 133, 176, 0.92);
  box-shadow: 0 0 0 1px rgba(164, 201, 237, 0.58), 0 0 20px rgba(102, 151, 203, 0.24);
}

:root[data-theme="light"] #hier-selected-only-hero.is-active,
:root[data-theme="light"] #hier-selected-only-hero[aria-pressed="true"] {
  border-color: rgba(101, 143, 188, 0.94);
  background:
    radial-gradient(150% 200% at 6% 0%, rgba(203, 227, 251, 0.4), transparent 54%),
    linear-gradient(180deg, rgba(171, 205, 238, 0.86), rgba(133, 173, 214, 0.84));
  box-shadow: 0 0 0 1px rgba(155, 193, 231, 0.62), 0 0 18px rgba(96, 145, 196, 0.24);
  color: #123552;
}

:root[data-theme="light"] .graph-relation-btn {
  border-color: rgba(120, 159, 199, 0.84);
  background:
    radial-gradient(140% 190% at 6% 0%, rgba(181, 218, 252, 0.26), transparent 56%),
    linear-gradient(180deg, rgba(231, 245, 255, 0.9), rgba(198, 223, 246, 0.84));
  box-shadow: 0 0 0 1px rgba(183, 214, 245, 0.48), 0 0 16px rgba(110, 161, 214, 0.2);
  color: #1b3d5d;
}

:root[data-theme="light"] .graph-relation-btn:hover:not(:disabled) {
  border-color: rgba(88, 129, 171, 0.92);
  box-shadow: 0 0 0 1px rgba(162, 200, 236, 0.56), 0 0 18px rgba(99, 149, 201, 0.24);
}

:root[data-theme="light"] .graph-relation-btn--secondary {
  border-color: rgba(132, 168, 201, 0.78);
  background:
    radial-gradient(140% 190% at 6% 0%, rgba(194, 223, 252, 0.22), transparent 56%),
    linear-gradient(180deg, rgba(246, 251, 255, 0.96), rgba(227, 239, 249, 0.94));
  box-shadow: 0 0 0 1px rgba(189, 217, 243, 0.48), 0 0 16px rgba(112, 160, 209, 0.18);
  color: #274565;
}

:root[data-theme="light"] .graph-relation-btn--secondary.is-active,
:root[data-theme="light"] .graph-relation-btn--secondary[aria-pressed="true"] {
  border-color: rgba(89, 131, 177, 0.92);
  background: linear-gradient(180deg, rgba(161, 198, 236, 0.58), rgba(127, 169, 216, 0.52));
  color: #11334f;
  box-shadow: 0 0 0 1px rgba(108, 152, 202, 0.38), 0 0 12px rgba(102, 146, 198, 0.22);
}

:root[data-theme="light"] .filter-section__title {
  color: #4f6f90;
}

:root[data-theme="light"] label {
  color: #4e677f;
}

:root[data-theme="light"] select,
:root[data-theme="light"] input[type="number"],
:root[data-theme="light"] input[type="text"],
:root[data-theme="light"] textarea {
  background: rgba(255, 255, 255, 0.96);
  color: #1f3246;
  border-color: #bccde0;
}

:root[data-theme="light"] button {
  background: linear-gradient(180deg, rgba(247, 252, 255, 0.98), rgba(235, 244, 253, 0.98));
  color: #1f3349;
  border-color: #bacde1;
}

:root[data-theme="light"] button:hover {
  border-color: #7f9fc0;
}

:root[data-theme="light"] .filter-toggle {
  border-color: rgba(138, 167, 197, 0.74);
  background: linear-gradient(180deg, rgba(246, 251, 255, 0.96), rgba(236, 245, 253, 0.96));
  color: #27415b;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

:root[data-theme="light"] .filter-toggle:hover:not(:disabled) {
  border-color: rgba(100, 137, 175, 0.88);
  background: linear-gradient(180deg, rgba(241, 249, 255, 0.99), rgba(230, 241, 251, 0.99));
}

:root[data-theme="light"] .filter-toggle.is-active,
:root[data-theme="light"] .filter-toggle[aria-pressed="true"] {
  border-color: rgba(94, 141, 194, 0.96);
  background: linear-gradient(180deg, rgba(148, 189, 235, 0.36), rgba(116, 165, 222, 0.32));
  color: #173451;
  box-shadow: 0 0 0 1px rgba(124, 172, 226, 0.4), 0 0 14px rgba(107, 159, 220, 0.22);
}

:root[data-theme="light"] #hier-selected-only {
  border-color: rgba(118, 156, 197, 0.86);
  background:
    radial-gradient(120% 140% at 12% 8%, rgba(154, 206, 255, 0.2), transparent 58%),
    linear-gradient(180deg, rgba(236, 246, 255, 0.98), rgba(221, 236, 251, 0.95));
  color: #214263;
}

:root[data-theme="light"] #hier-selected-only.is-active,
:root[data-theme="light"] #hier-selected-only[aria-pressed="true"] {
  border-color: rgba(82, 129, 183, 0.96);
  background:
    radial-gradient(140% 170% at 10% 8%, rgba(196, 225, 255, 0.5), transparent 56%),
    linear-gradient(180deg, rgba(156, 195, 236, 0.58), rgba(118, 162, 212, 0.48));
  color: #13304b;
  text-shadow: none;
}

:root[data-theme="light"] .hier-selected-label-menu {
  border-color: rgba(153, 184, 217, 0.62);
  background: linear-gradient(180deg, rgba(250, 253, 255, 0.98), rgba(239, 247, 254, 0.97));
}

:root[data-theme="light"] .hier-selected-label-item {
  border-color: rgba(159, 187, 216, 0.46);
  background: rgba(243, 249, 255, 0.9);
}

:root[data-theme="light"] .hier-selected-label-item__text {
  color: #254261;
}

:root[data-theme="light"] .hier-selected-label-item__meta {
  color: #5c7590;
}

:root[data-theme="light"] #threshold-bar .threshold-control {
  border-color: rgba(145, 173, 204, 0.74);
  background: rgba(247, 252, 255, 0.97);
  box-shadow: 0 10px 24px rgba(44, 74, 106, 0.16);
}

:root[data-theme="light"] .threshold-control .mono {
  color: #385774;
}

:root[data-theme="light"] .graph-pane__title {
  border-color: rgba(141, 174, 209, 0.78);
  background: rgba(248, 252, 255, 0.92);
  color: #25425f;
  box-shadow: 0 10px 24px rgba(35, 63, 94, 0.14);
}

:root[data-theme="light"] .graph-pane__fullscreen-btn {
  border-color: rgba(139, 173, 208, 0.76);
  background:
    radial-gradient(160% 210% at 10% 0%, rgba(235, 245, 255, 0.64), transparent 56%),
    linear-gradient(180deg, rgba(246, 251, 255, 0.98), rgba(230, 241, 251, 0.98));
  color: #24415e;
  box-shadow: 0 10px 24px rgba(35, 63, 94, 0.14);
}

:root[data-theme="light"] .graph-pane__fullscreen-btn:hover:not(:disabled) {
  border-color: rgba(105, 146, 191, 0.84);
  background:
    radial-gradient(160% 210% at 10% 0%, rgba(228, 240, 255, 0.78), transparent 56%),
    linear-gradient(180deg, rgba(242, 249, 255, 0.99), rgba(223, 236, 248, 0.99));
}

:root[data-theme="light"] .graph-pane__fullscreen-btn.is-active,
:root[data-theme="light"] .graph-pane__fullscreen-btn[aria-pressed="true"] {
  border-color: rgba(101, 144, 191, 0.88);
  background:
    radial-gradient(170% 210% at 10% 0%, rgba(255, 243, 203, 0.74), transparent 58%),
    linear-gradient(180deg, rgba(173, 204, 238, 0.82), rgba(137, 175, 221, 0.8));
  color: #173350;
}

:root[data-theme="light"] .detail-node-card {
  background:
    radial-gradient(190% 240% at 10% 0%, rgba(188, 221, 252, 0.2), transparent 58%),
    rgba(248, 252, 255, 0.92);
  box-shadow: 0 12px 26px rgba(53, 83, 116, 0.14);
}

:root[data-theme="light"] .detail-edge-card,
:root[data-theme="light"] .detail-edge-pill-group {
  border-color: rgba(144, 174, 207, 0.64);
  background:
    radial-gradient(170% 220% at 8% 0%, rgba(190, 221, 251, 0.2), transparent 56%),
    rgba(249, 252, 255, 0.96);
  box-shadow: 0 12px 26px rgba(53, 83, 116, 0.16), 0 0 0 1px rgba(194, 217, 241, 0.2);
  color: #20384f;
}

:root[data-theme="light"] .detail-edge-card:hover,
:root[data-theme="light"] .detail-edge-card:focus-visible,
:root[data-theme="light"] .detail-edge-pill-group:hover,
:root[data-theme="light"] .detail-edge-pill-group:focus-visible,
:root[data-theme="light"] .detail-node-card:hover,
:root[data-theme="light"] .detail-node-card:focus-visible {
  border-color: rgba(98, 136, 176, 0.82);
  box-shadow: 0 14px 28px rgba(47, 78, 111, 0.2), 0 0 0 1px rgba(170, 201, 234, 0.28);
}

:root[data-theme="light"] .detail-chip--relation {
  border-color: rgba(137, 180, 222, 0.6);
  background: rgba(179, 212, 242, 0.44);
  color: #1e4465;
}

:root[data-theme="light"] .detail-chip--edge-label {
  border-color: rgba(177, 190, 206, 0.72);
  background: rgba(221, 228, 236, 0.92);
  color: #34485c;
}

:root[data-theme="light"] .detail-chip--auto-relate {
  color: #693400;
  border-color: rgba(181, 119, 0, 0.48);
  background: rgba(255, 205, 84, 0.72);
  box-shadow: inset 0 0 0 1px rgba(181, 119, 0, 0.14), 0 2px 8px rgba(181, 119, 0, 0.1);
}

:root[data-theme="light"] .detail-chip--mechanism {
  border-color: rgba(177, 190, 206, 0.72);
  background: rgba(221, 228, 236, 0.92);
  color: #34485c;
}

:root[data-theme="light"] .detail-chip--summary,
:root[data-theme="light"] .detail-chip--more {
  border-color: rgba(201, 180, 123, 0.56);
  background: rgba(255, 233, 176, 0.7);
  color: #6d4a14;
}

:root[data-theme="light"] .compression-toggle-label {
  border-color: rgba(152, 183, 216, 0.48);
  background:
    radial-gradient(150% 180% at 10% 0%, rgba(120, 171, 234, 0.16), transparent 58%),
    rgba(240, 247, 254, 0.92);
  color: #26435f;
}

:root[data-theme="light"] #topbar-controls .topbar-controls__nav {
  border-color: rgba(139, 170, 203, 0.76);
  background: rgba(247, 252, 255, 0.95);
  box-shadow: 0 10px 24px rgba(35, 63, 94, 0.16);
}

:root[data-theme="light"] .topbar-controls.is-open .topbar-controls__nav {
  border-bottom-color: rgba(112, 146, 182, 0.24);
}

:root[data-theme="light"] .topbar-tab {
  border-color: rgba(134, 163, 194, 0.72);
  background: rgba(235, 245, 253, 0.94);
  color: #355370;
}

:root[data-theme="light"] .topbar-controls.is-open .topbar-tab.active,
:root[data-theme="light"] .topbar-controls.is-open .topbar-tab[aria-selected="true"] {
  border-color: rgba(88, 128, 173, 0.9);
  background: linear-gradient(180deg, rgba(156, 194, 233, 0.55), rgba(132, 176, 222, 0.48));
  color: #153550;
  box-shadow: 0 0 0 1px rgba(115, 161, 211, 0.4), 0 0 10px rgba(105, 151, 202, 0.2);
}

@media (hover: hover) and (pointer: fine) {
  :root[data-theme="light"] .topbar-tab:hover {
    border-color: rgba(94, 130, 168, 0.84);
    background: rgba(224, 239, 252, 0.98);
    color: #1f3b57;
  }
}

:root[data-theme="light"] .topbar-action-btn {
  border-color: rgba(123, 157, 191, 0.76);
  background: linear-gradient(180deg, rgba(241, 249, 255, 0.98), rgba(226, 238, 249, 0.98));
  color: #1f3d5a;
}

:root[data-theme="light"] .topbar-action-btn:hover:not(:disabled) {
  border-color: rgba(89, 127, 167, 0.9);
  background: linear-gradient(180deg, rgba(232, 244, 255, 0.99), rgba(216, 233, 248, 0.99));
}

:root[data-theme="light"] .topbar-action-btn[aria-pressed="true"] {
  border-color: rgba(89, 131, 177, 0.92);
  background: linear-gradient(180deg, rgba(161, 198, 236, 0.58), rgba(127, 169, 216, 0.52));
  color: #11334f;
  box-shadow: 0 0 0 1px rgba(108, 152, 202, 0.38), 0 0 12px rgba(102, 146, 198, 0.22);
}

:root[data-theme="light"] .topbar-action-btn:disabled {
  border-color: rgba(177, 191, 206, 0.84);
  background: linear-gradient(180deg, rgba(233, 237, 241, 0.98), rgba(219, 225, 231, 0.98));
  color: rgba(101, 118, 136, 0.92);
  box-shadow: none;
}

:root[data-theme="light"] .topbar-compact-select {
  border-color: rgba(123, 157, 191, 0.76);
  background:
    linear-gradient(180deg, rgba(241, 249, 255, 0.98), rgba(226, 238, 249, 0.98)),
    rgba(226, 238, 249, 0.98);
  color: #1f3d5a;
}

:root[data-theme="light"] .topbar-compact-select:disabled {
  border-color: rgba(177, 191, 206, 0.84);
  background:
    linear-gradient(180deg, rgba(233, 237, 241, 0.98), rgba(219, 225, 231, 0.98)),
    rgba(219, 225, 231, 0.98);
  color: rgba(101, 118, 136, 0.92);
}

:root[data-theme="light"] .topbar-panel {
  border-color: rgba(131, 164, 197, 0.66);
  background: linear-gradient(180deg, rgba(245, 251, 255, 0.97), rgba(233, 243, 252, 0.95));
}

:root[data-theme="light"] .topbar-size-control {
  border-color: rgba(144, 174, 204, 0.62);
  background: linear-gradient(180deg, rgba(249, 253, 255, 0.98), rgba(238, 247, 254, 0.96));
}

:root[data-theme="light"] .topbar-size-control label {
  color: #375270;
}

:root[data-theme="light"] .topbar-size-control .mono {
  color: #446581;
}

:root[data-theme="light"] .topbar-display-toggle label {
  color: #2e4a67;
}

:root[data-theme="light"] #vis {
  background: var(--graph-canvas-bg);
}

:root[data-theme="light"] .graph-loading {
  color: #42607d;
  background: rgba(241, 248, 255, 0.86);
}

:root[data-theme="light"] #tooltip {
  background: rgba(248, 250, 252, 0.98);
  border-color: rgba(116, 145, 176, 0.72);
  color: #203245;
  box-shadow: 0 12px 22px rgba(33, 59, 89, 0.16), 0 0 0 1px rgba(116, 145, 176, 0.18);
}

:root[data-theme="light"] .edgeTipTitle,
:root[data-theme="light"] .edgeTipNode {
  color: #21364a;
}

:root[data-theme="light"] .edgeTipLine {
  color: #29435b;
}

:root[data-theme="light"] .edgeTipArrowGlow {
  color: #5a6f84;
  text-shadow: none;
}

:root[data-theme="light"] .edgeTipMechanismGlow,
:root[data-theme="light"] .inspectBadge {
  color: #34485c;
  border-color: rgba(90, 111, 132, 0.24);
  background: rgba(221, 228, 236, 0.92);
  box-shadow: inset 0 0 0 1px rgba(90, 111, 132, 0.08), 0 2px 8px rgba(64, 82, 101, 0.08);
  text-shadow: none;
}

:root[data-theme="light"] .edgeTipMechanismGlow--autoRelate,
:root[data-theme="light"] .inspectBadge--autoRelate {
  color: #693400;
  border-color: rgba(181, 119, 0, 0.48);
  background: rgba(255, 205, 84, 0.72);
  box-shadow: inset 0 0 0 1px rgba(181, 119, 0, 0.14), 0 2px 8px rgba(181, 119, 0, 0.1);
  text-shadow: none;
}

:root[data-theme="light"] .edgeTipRelation {
  color: #7d5200;
}

:root[data-theme="light"] .edgeTipMeta {
  color: #39526c;
}

:root[data-theme="light"] .edgeTipListRow {
  border-color: rgba(150, 178, 208, 0.56);
  background: rgba(245, 251, 255, 0.95);
  color: #17314d;
}

:root[data-theme="light"] .edgeTipListScore {
  color: rgba(57, 82, 108, 0.92);
}

:root[data-theme="light"] .edgeTipScore {
  color: rgba(57, 82, 108, 0.92);
}

:root[data-theme="light"] .edgeTipSubtle {
  color: rgba(57, 82, 108, 0.84);
}

:root[data-theme="light"] .edgeTipMechanisms,
:root[data-theme="light"] .inspectMechanisms {
  color: #1f354c;
}

:root[data-theme="light"] .edgeTipHint {
  color: rgba(57, 82, 108, 0.86);
}

:root[data-theme="light"] .edgeTipPager {
  color: #1f354c;
}

:root[data-theme="light"] .featRow,
:root[data-theme="light"] .edgeRow,
:root[data-theme="light"] .inspectRow {
  border-color: rgba(150, 178, 208, 0.56);
  background: rgba(245, 251, 255, 0.95);
}

:root[data-theme="light"] .featRow:hover,
:root[data-theme="light"] .edgeRow:hover {
  border-color: rgba(93, 131, 170, 0.82);
  background: rgba(236, 246, 255, 0.98);
}

:root[data-theme="light"] .featTitle {
  color: #20384f;
}

:root[data-theme="light"] #inspector {
  color: #1f3449;
}

:root[data-theme="light"] .inspectTitle {
  color: #15354f;
}

:root[data-theme="light"] .inspectSub {
  color: #3f5c79;
}

:root[data-theme="light"] .inspectDesc {
  color: #1f3850;
}

:root[data-theme="light"] .inspectRelCard {
  border-color: rgba(130, 167, 206, 0.64);
  background: linear-gradient(180deg, rgba(244, 250, 255, 0.98), rgba(232, 243, 252, 0.96));
}

:root[data-theme="light"] .inspectRelTitle,
:root[data-theme="light"] .inspectRelKey {
  color: #3f5f7f;
}

:root[data-theme="light"] .inspectRelPhrase {
  color: #855300;
}

:root[data-theme="light"] .inspectRelValue {
  color: #1b3854;
}

:root[data-theme="light"] .clickable {
  color: #2f5f95;
  text-decoration-color: rgba(47, 95, 149, 0.4);
}

:root[data-theme="light"] .clickable:hover {
  text-decoration-color: rgba(47, 95, 149, 0.9);
}

:root[data-theme="light"] .token {
  background: rgba(247, 252, 255, 0.98);
  border-color: rgba(153, 183, 214, 0.66);
  color: #24415f;
}

:root[data-theme="light"] .token.selected {
  border-color: rgba(84, 130, 182, 0.92);
  background: rgba(125, 170, 222, 0.25);
}

:root[data-theme="light"] .panel--text .text-meta {
  color: #4f6b86;
}

:root[data-theme="light"] .panel--text .crumb {
  border-color: rgba(152, 182, 212, 0.72);
  background: rgba(244, 250, 255, 0.95);
  color: #24415d;
}

:root[data-theme="light"] .panel--text .crumb.active {
  border-color: rgba(84, 126, 175, 0.88);
  background: rgba(187, 214, 241, 0.34);
  color: #16344f;
}

:root[data-theme="light"] .panel--text .crumbRange {
  border-color: rgba(115, 153, 191, 0.42);
  background: rgba(244, 250, 255, 0.86);
  color: #5b7590;
}

:root[data-theme="light"] .panel--text .text {
  border-color: rgba(151, 181, 211, 0.74);
  background: rgba(247, 252, 255, 0.96);
  color: #1f344b;
}

:root[data-theme="light"] #book-view {
  background:
    radial-gradient(140% 100% at 50% 0%, rgba(143, 189, 233, 0.26), transparent 60%),
    linear-gradient(180deg, rgba(240, 247, 253, 0.98), rgba(232, 241, 249, 0.98));
}

:root[data-theme="light"] #book-rail {
  border-right-color: rgba(145, 177, 208, 0.34);
}

:root[data-theme="light"] #book-rail-card {
  border-color: rgba(150, 184, 215, 0.62);
  background:
    radial-gradient(180% 220% at 8% 0%, rgba(164, 205, 243, 0.28), transparent 56%),
    linear-gradient(180deg, rgba(248, 252, 255, 0.98), rgba(241, 248, 255, 0.98));
  box-shadow: 0 16px 34px rgba(52, 82, 114, 0.12), 0 0 0 1px rgba(205, 224, 243, 0.52) inset;
}

:root[data-theme="light"] #book-toolbar {
  border-bottom-color: rgba(134, 167, 201, 0.34);
  background:
    linear-gradient(180deg, rgba(245, 250, 255, 0.96), rgba(242, 248, 255, 0.78)),
    rgba(245, 250, 255, 0.82);
}

:root[data-theme="light"] #book-toolbar .topbar-controls__nav {
  border-color: rgba(152, 184, 215, 0.62);
  background:
    radial-gradient(180% 220% at 6% 0%, rgba(162, 203, 242, 0.34), transparent 56%),
    rgba(245, 250, 255, 0.94);
  box-shadow: 0 12px 28px rgba(62, 96, 132, 0.14), 0 0 0 1px rgba(205, 225, 245, 0.5) inset;
}

:root[data-theme="light"] #book-search-panel {
  border-color: rgba(148, 181, 212, 0.56);
  background:
    radial-gradient(180% 190% at 8% 0%, rgba(171, 207, 240, 0.28), transparent 56%),
    rgba(245, 250, 255, 0.95);
  box-shadow: 0 16px 34px rgba(62, 96, 132, 0.14), 0 0 0 1px rgba(205, 225, 245, 0.38) inset;
}

:root[data-theme="light"] .book-toolbar-label {
  color: rgba(71, 101, 131, 0.76);
}

:root[data-theme="light"] .book-rail-eyebrow {
  color: rgba(85, 116, 146, 0.82);
}

:root[data-theme="light"] .book-rail-title {
  color: #173651;
}

:root[data-theme="light"] .book-rail-copy,
:root[data-theme="light"] .book-search-meta,
:root[data-theme="light"] .book-outline-empty {
  color: rgba(77, 104, 132, 0.82);
}

:root[data-theme="light"] .book-rail-section {
  border-top-color: rgba(153, 184, 215, 0.4);
}

:root[data-theme="light"] .book-rail-label {
  color: rgba(83, 111, 140, 0.84);
}

:root[data-theme="light"] .book-search-input {
  border-color: rgba(145, 177, 209, 0.6);
  background:
    radial-gradient(160% 180% at 8% 0%, rgba(166, 205, 241, 0.3), transparent 56%),
    rgba(247, 251, 255, 0.97);
  color: #183651;
}

:root[data-theme="light"] .book-search-input::placeholder {
  color: rgba(104, 130, 157, 0.78);
}

:root[data-theme="light"] .book-search-result {
  border-color: rgba(148, 181, 212, 0.5);
  background:
    radial-gradient(160% 190% at 8% 0%, rgba(171, 207, 240, 0.28), transparent 56%),
    rgba(245, 250, 255, 0.92);
  color: #18344d;
}

:root[data-theme="light"] .book-search-result:hover {
  border-color: rgba(112, 149, 186, 0.72);
  box-shadow: 0 10px 20px rgba(78, 112, 147, 0.12);
}

:root[data-theme="light"] .book-search-result__meta,
:root[data-theme="light"] .book-outline-item__kind {
  color: rgba(88, 117, 145, 0.82);
}

:root[data-theme="light"] .book-search-result__text {
  color: rgba(31, 57, 82, 0.94);
}

:root[data-theme="light"] .book-outline-item {
  border-color: rgba(150, 183, 214, 0.36);
  background: rgba(243, 248, 254, 0.84);
  color: #1d3a55;
}

:root[data-theme="light"] .book-outline-item:hover {
  border-color: rgba(117, 154, 191, 0.62);
  background: rgba(236, 244, 252, 0.96);
}

:root[data-theme="light"] .book-outline-item.is-active {
  border-color: rgba(92, 134, 177, 0.8);
  background:
    radial-gradient(180% 200% at 8% 0%, rgba(170, 208, 241, 0.36), transparent 56%),
    rgba(234, 243, 252, 0.98);
  box-shadow: 0 0 0 1px rgba(118, 160, 201, 0.18), 0 10px 18px rgba(78, 113, 148, 0.12);
}

:root[data-theme="light"] #book-paper {
  border-color: rgba(149, 183, 216, 0.62);
  background:
    radial-gradient(180% 150% at 50% 0%, rgba(171, 206, 240, 0.22), transparent 60%),
    linear-gradient(180deg, rgba(252, 254, 255, 0.98), rgba(245, 250, 255, 0.98));
  box-shadow: 0 18px 38px rgba(40, 68, 98, 0.12), 0 0 0 1px rgba(204, 224, 244, 0.6) inset;
}

:root[data-theme="light"] .book-eyebrow {
  color: #5d7ea0;
}

:root[data-theme="light"] .book-heading {
  color: #19344d;
}

:root[data-theme="light"] .book-subheading {
  color: rgba(55, 80, 107, 0.82);
}

:root[data-theme="light"] .book-subchapter-heading {
  color: #21435f;
}

:root[data-theme="light"] .book-subchapter-deck {
  color: rgba(82, 110, 140, 0.88);
}

:root[data-theme="light"] .book-subchapter.is-active-unit {
  border-left-color: rgba(92, 134, 177, 0.72);
}

:root[data-theme="light"] .book-section-heading {
  color: #23425f;
}

:root[data-theme="light"] .book-section-heading--minor {
  color: #355675;
}

:root[data-theme="light"] .book-paragraph {
  border-color: rgba(152, 183, 213, 0.52);
  background:
    linear-gradient(180deg, rgba(250, 253, 255, 0.98), rgba(244, 249, 254, 0.98)),
    rgba(247, 252, 255, 0.98);
}

:root[data-theme="light"] .book-paragraph:hover {
  border-color: rgba(108, 149, 191, 0.68);
  box-shadow: 0 10px 20px rgba(73, 108, 145, 0.12);
}

:root[data-theme="light"] .book-paragraph.has-active-sentence,
:root[data-theme="light"] .book-paragraph.is-active-unit {
  border-color: rgba(92, 134, 177, 0.82);
  box-shadow: 0 0 0 1px rgba(112, 156, 201, 0.22), 0 10px 24px rgba(81, 117, 157, 0.14);
}

:root[data-theme="light"] .book-paragraph-meta {
  color: rgba(87, 117, 148, 0.84);
}

:root[data-theme="light"] .book-paragraph-text {
  color: #233c54;
}

:root[data-theme="light"] .book-list-item-text {
  color: #244059;
}

:root[data-theme="light"] .book-textbox {
  border-color: rgba(149, 184, 216, 0.6);
  background:
    radial-gradient(180% 180% at 8% 0%, rgba(166, 205, 241, 0.26), transparent 56%),
    rgba(243, 249, 254, 0.98);
  box-shadow: 0 14px 26px rgba(71, 102, 136, 0.1);
}

:root[data-theme="light"] .book-textbox--learning-objectives {
  border-color: rgba(110, 182, 163, 0.58);
  background:
    radial-gradient(180% 180% at 8% 0%, rgba(168, 231, 214, 0.28), transparent 56%),
    rgba(241, 252, 250, 0.98);
}

:root[data-theme="light"] .book-textbox--exercises {
  border-color: rgba(214, 182, 121, 0.62);
  background:
    radial-gradient(180% 180% at 8% 0%, rgba(242, 222, 165, 0.32), transparent 56%),
    rgba(255, 250, 241, 0.98);
}

:root[data-theme="light"] .book-textbox--shaded {
  border-color: rgba(149, 184, 216, 0.6);
  background:
    radial-gradient(180% 180% at 8% 0%, rgba(177, 213, 243, 0.28), transparent 56%),
    rgba(243, 249, 255, 0.98);
}

:root[data-theme="light"] .book-textbox-title {
  color: #1f3b56;
}

:root[data-theme="light"] .book-figure {
  border-color: rgba(149, 184, 216, 0.52);
  background:
    radial-gradient(180% 180% at 50% 0%, rgba(179, 214, 243, 0.24), transparent 60%),
    linear-gradient(180deg, rgba(243, 249, 255, 0.98), rgba(238, 246, 253, 0.98)),
    rgba(238, 246, 253, 0.98);
}

:root[data-theme="light"] .book-figure-media {
  background:
    linear-gradient(180deg, rgba(224, 236, 247, 0.6), rgba(239, 246, 253, 0.78)),
    rgba(239, 246, 253, 0.82);
  box-shadow: inset 0 0 0 1px rgba(166, 195, 223, 0.36);
}

:root[data-theme="light"] .book-figure-image {
  box-shadow: 0 10px 24px rgba(74, 108, 143, 0.14);
}

:root[data-theme="light"] .book-figure-caption,
:root[data-theme="light"] .book-note-block,
:root[data-theme="light"] .book-table td {
  color: rgba(57, 84, 111, 0.9);
}

:root[data-theme="light"] .book-table-card {
  border-color: rgba(149, 184, 216, 0.56);
  background:
    linear-gradient(180deg, rgba(243, 249, 255, 0.98), rgba(238, 246, 253, 0.98)),
    rgba(238, 246, 253, 0.98);
}

:root[data-theme="light"] .book-table-caption,
:root[data-theme="light"] .book-table th {
  color: #1f3d59;
}

:root[data-theme="light"] .book-table th,
:root[data-theme="light"] .book-table td {
  border-bottom-color: rgba(151, 183, 214, 0.38);
}

:root[data-theme="light"] .book-sentence:hover,
:root[data-theme="light"] .book-sentence:focus-visible {
  background: rgba(133, 182, 231, 0.24);
  box-shadow: 0 0 0 1px rgba(117, 164, 211, 0.22);
  color: #18354d;
}

:root[data-theme="light"] .book-sentence.is-active {
  background: rgba(101, 160, 222, 0.22);
  box-shadow: 0 0 0 1px rgba(93, 144, 193, 0.28), 0 0 16px rgba(117, 162, 209, 0.18);
  color: #102c44;
}

:root[data-theme="light"] .hier-inspector {
  background: linear-gradient(180deg, #f6fbff, #eaf3fb);
}

:root[data-theme="light"] #hier-center {
  background: var(--graph-canvas-bg);
}

:root[data-theme="light"] .hier-left-header {
  border-bottom-color: rgba(111, 154, 201, 0.36);
}

:root[data-theme="light"] .hier-left-title {
  color: #1e3d5a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

:root[data-theme="light"] .hier-show-descriptions-btn {
  border-color: rgba(121, 157, 193, 0.82);
  background:
    radial-gradient(150% 210% at 4% 0%, rgba(188, 220, 251, 0.36), transparent 54%),
    linear-gradient(180deg, rgba(242, 249, 255, 0.96), rgba(224, 238, 251, 0.95));
  box-shadow: 0 0 0 1px rgba(179, 208, 239, 0.56), 0 0 14px rgba(99, 146, 198, 0.2);
  color: #1d3d5c;
}

:root[data-theme="light"] .hier-show-descriptions-btn:hover {
  border-color: rgba(92, 133, 174, 0.9);
  box-shadow: 0 0 0 1px rgba(161, 197, 232, 0.62), 0 0 16px rgba(97, 143, 191, 0.24);
}

:root[data-theme="light"] #hier-show-descriptions.is-active {
  border-color: rgba(83, 126, 170, 0.92);
  background:
    radial-gradient(150% 210% at 4% 0%, rgba(176, 212, 246, 0.42), transparent 54%),
    linear-gradient(180deg, rgba(196, 222, 247, 0.82), rgba(168, 201, 235, 0.78));
  box-shadow: 0 0 0 1px rgba(128, 170, 214, 0.5), 0 0 14px rgba(88, 131, 178, 0.24);
  color: #143451;
}

:root[data-theme="light"] #hier-toolbar {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

:root[data-theme="light"] #hier-toolbar .topbar-controls__nav {
  border-color: rgba(139, 170, 203, 0.76);
  background: rgba(247, 252, 255, 0.95);
  box-shadow: 0 10px 24px rgba(35, 63, 94, 0.16);
}

:root[data-theme="light"] #hier-center {
  background: var(--bg);
}

:root[data-theme="light"] #hier-canvas {
  background: transparent;
}

:root[data-theme="light"] #hier-canvas-wrap {
  border-color: rgba(138, 173, 209, 0.58);
  background:
    radial-gradient(180% 150% at 50% 0%, rgba(154, 194, 232, 0.18), transparent 58%),
    rgba(248, 252, 255, 0.84);
  box-shadow: 0 10px 24px rgba(37, 63, 91, 0.12);
}

:root[data-theme="light"] .hier-empty {
  color: #45617d;
  background: rgba(241, 248, 255, 0.88);
}

:root[data-theme="light"] .hier-tooltip {
  border-color: rgba(140, 174, 211, 0.62);
  background: rgba(250, 253, 255, 0.97);
  color: #203a56;
  box-shadow: 0 10px 20px rgba(36, 62, 90, 0.2);
}

:root[data-theme="light"] #hier-nodes .h-node text {
  fill: #234360;
}

:root[data-theme="light"] #hier-nodes .h-node text.node-meta {
  fill: #5a7692;
}

:root[data-theme="light"] #hier-nodes .toggle-hit rect {
  fill: rgba(240, 248, 255, 0.95);
  stroke: rgba(127, 163, 198, 0.86);
}

:root[data-theme="light"] #hier-nodes .toggle-hit text {
  fill: #2c4e70;
}

:root[data-theme="light"] .hier-occurrence-node {
  border-color: rgba(154, 184, 214, 0.58);
  background: linear-gradient(180deg, rgba(247, 252, 255, 0.98), rgba(236, 246, 254, 0.98));
}

:root[data-theme="light"] .hier-occurrence-node:hover {
  border-color: rgba(97, 136, 176, 0.84);
  background: linear-gradient(180deg, rgba(240, 249, 255, 0.99), rgba(229, 242, 252, 0.99));
}

:root[data-theme="light"] .hier-occurrence-node.active {
  border-color: rgba(83, 127, 173, 0.84);
  box-shadow: 0 0 0 1px rgba(118, 163, 208, 0.4), 0 0 12px rgba(98, 147, 200, 0.2);
}

:root[data-theme="light"] .hier-occurrence-node__desc {
  color: #23415e;
}

:root[data-theme="light"] .hier-occurrence-node__meta {
  color: #5b7590;
}

:root[data-theme="light"] .hier-level-block {
  border-color: rgba(148, 179, 210, 0.56);
  background: rgba(245, 251, 255, 0.95);
}

:root[data-theme="light"] .hier-level-title {
  color: #1f3f5d;
}

:root[data-theme="light"] .hier-level-meta {
  color: #5a7692;
}

:root[data-theme="light"] .hier-selected-label {
  color: #2b4b68;
  border-top-color: rgba(114, 149, 185, 0.24);
}

:root[data-theme="light"] .hier-selected-label.active {
  color: #163753;
  text-shadow: none;
}

:root[data-theme="light"] .hier-selected-feat {
  color: #2a4661;
  border-top-color: rgba(114, 149, 185, 0.24);
}

:root[data-theme="light"] .hier-selected-feat .fid {
  color: #3e6793;
}

:root[data-theme="light"] .hier-search-item {
  border-color: rgba(152, 182, 212, 0.54);
  background: rgba(246, 251, 255, 0.96);
}

:root[data-theme="light"] .hier-search-group-title {
  color: #54779b;
}

:root[data-theme="light"] .hier-search-item .meta {
  color: #5a7591;
}

:root[data-theme="light"] .hier-search-item .snippet {
  color: #23415e;
}

:root[data-theme="light"] #bottom-tabs {
  border-color: rgba(142, 176, 211, 0.74);
  background:
    radial-gradient(200% 220% at 8% 0%, rgba(138, 182, 232, 0.28), transparent 56%),
    rgba(247, 252, 255, 0.95);
  box-shadow: 0 8px 20px rgba(37, 63, 91, 0.16), 0 0 0 1px rgba(177, 206, 237, 0.24) inset;
}

:root[data-theme="light"] .bottom-tab {
  color: #4b6682;
}

:root[data-theme="light"] .bottom-tab:hover {
  background: rgba(181, 207, 234, 0.34);
  color: #1e3a56;
}

:root[data-theme="light"] .bottom-tab.active {
  background: rgba(123, 168, 220, 0.4);
  border-color: rgba(86, 129, 177, 0.72);
  color: #13324c;
  box-shadow: 0 0 0 1px rgba(111, 156, 207, 0.42) inset, 0 0 12px rgba(96, 146, 202, 0.24);
}

:root[data-theme="light"] .theme-toggle-btn {
  border-color: rgba(138, 172, 207, 0.78);
  background:
    radial-gradient(170% 200% at 6% 0%, rgba(172, 206, 240, 0.34), transparent 56%),
    rgba(247, 252, 255, 0.96);
  color: #2f5477;
  box-shadow: 0 8px 18px rgba(34, 59, 86, 0.17), 0 0 0 1px rgba(170, 200, 231, 0.3) inset;
}

:root[data-theme="light"] .theme-toggle-btn:hover {
  border-color: rgba(96, 133, 171, 0.88);
  background:
    radial-gradient(170% 200% at 6% 0%, rgba(156, 195, 234, 0.4), transparent 56%),
    rgba(239, 248, 255, 0.98);
}

:root[data-theme="light"] .theme-toggle-btn[aria-pressed="true"] {
  border-color: rgba(86, 126, 170, 0.9);
  background:
    radial-gradient(170% 200% at 6% 0%, rgba(154, 196, 238, 0.46), transparent 56%),
    rgba(222, 237, 251, 0.97);
  color: #133452;
}

@media (max-width: 1200px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(60vh, 1fr);
    height: auto;
  }

  #sidebar-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  #main {
    height: 70vh;
    min-height: 360px;
  }

  #topbar-controls {
    left: 8px;
    right: auto;
    width: calc(100% - 16px);
    max-width: calc(100% - 16px);
  }

  body.ui-mode-interactive-graph #vis-shell {
    padding: var(--graph-top-lane) 8px 8px 8px;
    gap: 8px;
  }

  #book-view {
    grid-template-columns: minmax(228px, 280px) minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  :root {
    --topbar-right-reserve: 0px;
  }

  #hierarchy-view {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(300px, 44vh) minmax(52vh, 1fr);
    overflow: auto;
  }

  .hier-inspector {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 44vh;
  }

  #hier-center {
    min-height: 52vh;
  }

  #book-view {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: auto;
  }

  #book-rail {
    padding: 14px 14px 0 14px;
    border-right: none;
  }

  #book-rail-card {
    height: auto;
    max-height: none;
  }

  #book-center {
    min-height: 62vh;
  }

  #book-scroll {
    padding-left: 14px;
    padding-right: 14px;
  }

  #book-toolbar-shell {
    width: 100%;
  }

  #book-search-panel {
    width: 100%;
  }

  #book-paper {
    width: min(100%, 980px);
  }

  #hier-toolbar {
    width: calc(100% - 16px);
    max-width: none;
    margin: var(--floating-bar-top) 8px 8px 8px;
  }
}

@media (max-width: 720px) {
  #topbar-controls {
    left: 8px;
    right: 8px;
    width: calc(100% - 16px);
    max-width: none;
  }

  .sidebar {
    padding: 16px;
  }

  .graph-layout-pair {
    grid-template-columns: 1fr;
  }

  #topbar-controls .topbar-controls__nav {
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
    min-height: 0;
  }

  #topbar-controls .topbar-tabs,
  #topbar-controls .topbar-actions {
    display: flex;
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }

  #topbar-controls .topbar-tab,
  #topbar-controls .topbar-action-btn,
  #topbar-controls .topbar-compression-wrap,
  #topbar-controls .topbar-compact-select {
    flex: 0 1 auto;
  }

  .topbar-panel-stack {
    width: 100%;
  }

  .panel--text .text-controls__fields {
    grid-template-columns: 1fr;
  }

  body.ui-mode-interactive-graph #vis-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(240px, 1fr) minmax(240px, 1fr);
  }

  #main {
    height: 60vh;
  }

  #threshold-bar {
    grid-template-columns: 1fr;
  }

  .hier-left-header {
    padding: 0 0 10px 0;
  }

  .hier-left-title {
    font-size: clamp(19px, 5.2vw, 28px);
  }

  .hier-show-descriptions-btn {
    width: 100%;
    justify-self: stretch;
  }

  #book-rail {
    padding-top: 12px;
  }

  #book-rail-card {
    padding: 16px 14px 16px 14px;
    border-radius: 20px;
  }

  .book-rail-title {
    font-size: 21px;
  }

  #book-toolbar {
    padding: 62px 14px 10px 14px;
    padding-right: 14px;
  }

  #book-toolbar .topbar-controls__nav,
  #book-search-panel {
    width: 100%;
  }

  .book-toolbar-actions {
    width: 100%;
    gap: 8px;
  }

  .book-toolbar-group {
    width: 100%;
  }

  .book-theme-toggle {
    margin-left: 0;
  }

  .book-toolbar-group .topbar-compact-select {
    width: 100%;
    max-width: none;
  }

  #book-paper {
    padding: 22px 18px 24px 18px;
    border-radius: 24px;
  }

  .book-search-result {
    padding: 9px 10px;
  }

  .book-outline-item {
    padding: 8px 9px;
  }

  .book-paragraph {
    padding: 14px 14px;
    border-radius: 18px;
  }

  #bottom-tabs {
    top: var(--floating-tabs-top);
    right: 8px;
    left: auto;
    transform: none;
    padding: 4px;
  }

  .theme-toggle-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    border-radius: 8px;
    font-size: 14px;
  }

  .bottom-tab {
    min-width: 96px;
    padding: 8px 13px;
    font-size: 13px;
  }
}
