:root {
  color-scheme: light;
  --desktop: #123f3a;
  --desktop-dark: #082d2b;
  --chrome: #c7c9c2;
  --chrome-light: #ffffff;
  --chrome-mid: #8d918b;
  --chrome-dark: #252824;
  --paper: #f3f0df;
  --paper-2: #e7e2cd;
  --ink: #141511;
  --muted: #57594f;
  --navy: #072b56;
  --canvas: #06110f;
  --canvas-2: #0b1c18;
  --gold: #c49b45;
  --gold-light: #ead18e;
  --amber: #c87832;
  --emerald: #438769;
  --ivory: #eee4c8;
  --crimson: #a24d46;
  --violet: #7a708d;
  --blue: #527da0;
  --bevel-raised: inset 1px 1px 0 var(--chrome-light), inset -1px -1px 0 var(--chrome-dark), inset 2px 2px 0 #e5e7e1, inset -2px -2px 0 var(--chrome-mid);
  --bevel-sunken: inset 1px 1px 0 var(--chrome-dark), inset -1px -1px 0 var(--chrome-light), inset 2px 2px 0 var(--chrome-mid), inset -2px -2px 0 #e7e8e3;
  --focus: 0 0 0 2px #fff, 0 0 0 4px var(--navy);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 14px;
  overflow-x: hidden;
  background: var(--desktop);
  color: var(--ink);
  font-family: Tahoma, "MS Sans Serif", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  color: var(--ink);
}

a {
  color: #0a4175;
  font-weight: 700;
  text-underline-offset: 2px;
}

.desktop-pattern {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.045) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.045) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.08) 75%);
  background-position: 0 0, 0 3px, 3px -3px, -3px 0;
  background-size: 6px 6px;
}

.app-window {
  width: min(1540px, 100%);
  min-height: calc(100vh - 28px);
  margin: 0 auto;
  padding: 3px;
  background: var(--chrome);
  border: 1px solid var(--chrome-dark);
  box-shadow: var(--bevel-raised), 10px 14px 0 rgba(0, 0, 0, 0.24);
}

.app-chrome {
  background: var(--chrome);
}

.title-bar,
.modal-titlebar,
.window-title {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 4px 3px 7px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.title-bar-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.title-bar-brand img {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
}

.title-bar h1 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-bar-actions {
  display: flex;
  gap: 3px;
}

.title-bar-actions button,
.modal-titlebar button {
  display: grid;
  width: 22px;
  height: 21px;
  padding: 0;
  place-items: center;
  background: var(--chrome);
  border: 0;
  box-shadow: var(--bevel-raised);
  color: #111;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.title-bar-actions button:active,
.modal-titlebar button:active {
  box-shadow: var(--bevel-sunken);
  padding: 1px 0 0 1px;
}

.menu-bar {
  display: flex;
  min-height: 31px;
  align-items: center;
  gap: 2px;
  padding: 3px 4px;
  border-bottom: 1px solid var(--chrome-mid);
}

.menu-bar button {
  min-height: 24px;
  padding: 2px 9px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}

.menu-bar button:hover,
.menu-bar button:focus-visible {
  border-color: var(--chrome-light) var(--chrome-dark) var(--chrome-dark) var(--chrome-light);
  outline: none;
}

#installButton {
  margin-left: auto;
  background: var(--chrome);
  box-shadow: var(--bevel-raised);
}

.brand-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 440px);
  gap: 10px;
  align-items: stretch;
  padding: 7px;
  border-top: 1px solid var(--chrome-light);
}

.brand-block,
.method-card {
  min-width: 0;
  padding: 10px 12px;
  background: var(--paper);
  box-shadow: var(--bevel-sunken);
}

.eyebrow,
.method-kicker {
  margin: 0 0 4px;
  color: #744d0d;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.subtitle,
.method-card p {
  margin: 0;
  color: var(--muted);
}

.subtitle {
  max-width: 900px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 700;
}

.method-card {
  border-left: 5px solid var(--gold);
}

.method-card p {
  font-size: 12px;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 7px;
  border-top: 1px solid var(--chrome-light);
  border-bottom: 1px solid var(--chrome-mid);
  background: var(--chrome);
}

.search-wrap {
  position: relative;
  display: block;
}

.search-wrap svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  fill: #20231e;
}

.search-wrap input {
  width: 100%;
  height: 34px;
  padding: 4px 9px 4px 36px;
  border: 0;
  border-radius: 0;
  background: #fffef5;
  color: #111;
  box-shadow: var(--bevel-sunken);
  outline: none;
}

.search-wrap input:focus,
select:focus,
button:focus-visible,
.toggle input:focus-visible + .toggle-track {
  box-shadow: var(--focus);
  outline: none;
}

.toggle {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 35px;
  height: 18px;
  background: #fff;
  box-shadow: var(--bevel-sunken);
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  background: var(--chrome);
  box-shadow: var(--bevel-raised);
}

.toggle input:checked + .toggle-track {
  background: var(--emerald);
}

.toggle input:checked + .toggle-track::after {
  left: 20px;
}

.filter-bar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(7, minmax(105px, 1fr));
  gap: 5px;
  padding-top: 1px;
}

.filter-chip {
  min-width: 0;
}

.filter-chip label {
  display: block;
  margin: 0 0 2px 2px;
  color: #363832;
  font-size: 10px;
  font-weight: 700;
}

.filter-chip select {
  width: 100%;
  height: 28px;
  padding: 2px 24px 2px 6px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #fffef6;
  box-shadow: var(--bevel-sunken);
  text-overflow: ellipsis;
}

.view-nav {
  display: flex;
  min-width: 0;
  gap: 2px;
  padding: 6px 7px 0;
  overflow-x: auto;
  border-top: 1px solid var(--chrome-light);
  background: var(--chrome);
  scrollbar-width: thin;
}

.view-button,
.text-button,
.icon-button {
  border: 0;
  border-radius: 0;
  background: var(--chrome);
  box-shadow: var(--bevel-raised);
  cursor: pointer;
}

.view-button {
  min-width: max-content;
  min-height: 31px;
  padding: 4px 12px;
  font-size: 12px;
}

.view-button.active {
  position: relative;
  z-index: 1;
  background: var(--paper);
  box-shadow: inset 1px 1px 0 var(--chrome-dark), inset -1px 0 0 var(--chrome-light), inset 2px 2px 0 var(--chrome-mid);
  font-weight: 700;
}

.view-button:active,
.text-button:active,
.icon-button:active {
  box-shadow: var(--bevel-sunken);
  transform: translate(1px, 1px);
}

#app {
  min-height: 600px;
  padding: 8px;
  background: var(--paper-2);
  box-shadow: var(--bevel-sunken);
  outline: none;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 8px;
  padding: 12px 14px;
  border: 1px solid #9d9989;
  background: var(--paper);
  box-shadow: var(--bevel-raised);
}

.view-head h2,
.codex-intro h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  line-height: 1.08;
  font-weight: 700;
}

.view-head p,
.codex-intro p:not(.eyebrow) {
  max-width: 830px;
  margin: 5px 0 0;
  color: var(--muted);
}

.count-pill,
.status-chip {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid #8b8676;
  background: #fffef5;
  box-shadow: var(--bevel-sunken);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.home-codex {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 0.8fr);
  gap: 8px;
}

.codex-network-panel,
.index-panel,
.atlas-panel,
.timeline-panel,
.motif-panel,
.method-panel,
.source-panel,
.glossary-panel,
.compare-panel,
.window-panel {
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--chrome-dark);
  background: var(--chrome);
  box-shadow: var(--bevel-raised);
}

.window-title {
  margin: 0 0 4px;
  background: #356457;
}

.window-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.window-title span {
  color: #d9e7df;
  font-size: 10px;
  white-space: nowrap;
}

.codex-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 24px;
  align-items: end;
  padding: 12px 14px;
  background: var(--paper);
  box-shadow: var(--bevel-sunken);
}

.codex-intro .eyebrow {
  grid-column: 1 / -1;
  margin-bottom: -2px;
}

.codex-intro p:not(.eyebrow) {
  max-width: 470px;
  font-size: 12px;
}

.network-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px 1px;
}

.text-button {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.text-button.primary {
  background: #d7d9d2;
  color: #002b54;
}

.network-shell {
  position: relative;
  min-height: 610px;
  overflow: hidden;
  border: 1px solid #000;
  background:
    linear-gradient(rgba(67, 135, 105, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(196, 155, 69, 0.08) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px;
  box-shadow: var(--bevel-sunken);
}

.home-network {
  min-height: 520px;
}

.network-shell::after {
  content: "MYCELIAL RELATIONSHIP VIEW  /  DRAG NODES  /  SELECT TO FILTER";
  position: absolute;
  right: 8px;
  bottom: 6px;
  padding: 2px 4px;
  background: rgba(6, 17, 15, 0.82);
  color: #9faf9e;
  font-family: "Courier New", monospace;
  font-size: 9px;
  pointer-events: none;
}

.mycelial-svg,
.atlas-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.network-edge {
  stroke: rgba(225, 211, 158, 0.2);
  cursor: pointer;
  transition: stroke 100ms linear;
}

.network-edge:hover,
.network-edge:focus-visible {
  stroke: rgba(234, 209, 142, 0.9);
  outline: none;
}

.network-node {
  cursor: grab;
  outline: none;
}

.network-node:active {
  cursor: grabbing;
}

.network-node circle {
  stroke: #f4ebcf;
  stroke-width: 1;
  filter: url("#nodeGlow");
  transition: r 100ms linear, stroke-width 100ms linear;
}

.network-node text {
  max-width: 90px;
  fill: #e9e3ce;
  font-family: Tahoma, sans-serif;
  font-size: 10px;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.92);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.network-node:hover circle,
.network-node:focus-visible circle,
.network-node.active circle {
  stroke: #fff;
  stroke-width: 3px;
}

.network-node:hover text,
.network-node:focus-visible text,
.network-node.active text {
  fill: #fff;
  font-weight: 700;
}

.codex-side {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.inspector-body,
.active-node-panel,
.motif-detail {
  min-height: 0;
  padding: 12px;
  overflow: auto;
  background: var(--paper);
  box-shadow: var(--bevel-sunken);
}

.index-panel h3,
.panel-title,
.motif-detail h3 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
}

.index-panel p,
.motif-detail p {
  color: var(--muted);
}

.confidence-list,
.source-list,
.glossary-list {
  display: grid;
  gap: 5px;
}

.confidence-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  min-height: 27px;
  padding: 4px 5px;
  border: 1px solid #b9b39f;
  background: #fffdf2;
}

.confidence-row b {
  min-width: 0;
  font-size: 11px;
}

.dot {
  width: 9px;
  height: 9px;
  border: 1px solid rgba(0, 0, 0, 0.45);
}

.side-heading {
  margin-top: 16px !important;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.quick-actions .text-button {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-timeline {
  grid-column: 1 / -1;
}

.timeline-preview {
  display: grid;
  grid-auto-columns: minmax(190px, 240px);
  grid-auto-flow: column;
  gap: 6px;
  padding: 8px;
  overflow-x: auto;
  background: var(--paper);
  box-shadow: var(--bevel-sunken);
  scroll-snap-type: x proximity;
}

.timeline-preview-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 7px;
  min-height: 70px;
  padding: 5px;
  border: 1px solid #9b9788;
  background: #fffdf1;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--bevel-raised);
  cursor: pointer;
  scroll-snap-align: start;
}

.timeline-preview-item .mini-image,
.timeline-preview-item .mini-fallback {
  width: 58px;
  height: 58px;
  border: 1px solid #4b4c47;
}

.timeline-preview-item .mini-image {
  margin: 0;
}

.timeline-preview-item .mini-image img {
  object-fit: cover;
}

.timeline-preview-item .mini-image figcaption,
.timeline-thumb figcaption {
  display: none;
}

.timeline-preview-item .mini-fallback {
  display: block;
  background: repeating-linear-gradient(45deg, #16372f 0 5px, #20483d 5px 10px);
}

.timeline-preview-item strong,
.timeline-preview-item span {
  display: block;
}

.timeline-preview-item strong {
  font-size: 11px;
  line-height: 1.25;
}

.timeline-preview-item span {
  margin-bottom: 3px;
  color: #76510c;
  font-family: "Courier New", monospace;
  font-size: 10px;
  font-weight: 700;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.entry-card {
  display: flex;
  min-width: 0;
  min-height: 510px;
  flex-direction: column;
  padding: 5px;
  border: 1px solid var(--chrome-dark);
  background: var(--chrome);
  box-shadow: var(--bevel-raised);
}

.entry-card::before {
  content: "CODEX RECORD  /  READ-ONLY";
  display: block;
  min-height: 22px;
  margin: -1px -1px 4px;
  padding: 3px 6px;
  overflow: hidden;
  background: #356457;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-frame {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid #252824;
  background: #0b1714;
  box-shadow: var(--bevel-sunken);
}

.image-frame.thumb {
  aspect-ratio: 16 / 9;
}

.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  filter: saturate(0.72) contrast(1.06) sepia(0.08);
}

.entry-plate {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 49%, rgba(234, 209, 142, 0.14) 50%, transparent 51%),
    linear-gradient(transparent 49%, rgba(234, 209, 142, 0.12) 50%, transparent 51%),
    #10221c;
  background-size: 42px 42px;
  color: var(--gold-light);
}

.entry-plate::before,
.entry-plate::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(234, 209, 142, 0.32);
  transform: rotate(45deg);
}

.entry-plate::before {
  width: 42%;
  aspect-ratio: 1;
}

.entry-plate::after {
  width: 25%;
  aspect-ratio: 1;
}

.plate-initial {
  position: relative;
  z-index: 1;
  font-family: Georgia, serif;
  font-size: 40px;
  font-weight: 700;
}

.image-frame.image-broken img {
  display: none;
}

.image-frame.image-broken .entry-plate {
  display: grid;
}

.image-frame figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 18px 7px 5px;
  overflow: hidden;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
  color: #f2ead2;
  font-size: 9px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-topline,
.article-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin: 6px 2px 0;
}

.badge,
.confidence,
.category,
.motif-chip {
  display: inline-block;
  max-width: 100%;
  padding: 2px 5px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.46);
  border-radius: 0;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.confidence {
  color: #fff;
  text-shadow: 0 1px #000;
}

.category,
.motif-chip {
  background: #eee9d6;
  color: #34352f;
}

.entry-card h3 {
  margin: 9px 3px 3px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.12;
}

.entry-meta,
.entry-term,
.entry-summary {
  margin: 4px 3px;
}

.entry-meta {
  color: #4f554c;
  font-family: "Courier New", monospace;
  font-size: 10px;
  font-weight: 700;
}

.entry-term {
  color: #76510c;
  font-family: Georgia, serif;
  font-style: italic;
}

.entry-summary {
  color: #31332d;
  font-size: 12px;
}

.motif-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 7px 3px;
}

.card-actions {
  display: flex;
  gap: 5px;
  margin: auto 3px 3px;
  padding-top: 8px;
}

.atlas-layout,
.motif-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(270px, 0.7fr);
  gap: 8px;
}

.map-wrap {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  background:
    linear-gradient(rgba(196, 155, 69, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(196, 155, 69, 0.08) 1px, transparent 1px),
    var(--canvas);
  background-size: 40px 40px;
  box-shadow: var(--bevel-sunken);
}

.marker-layer-html {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-marker {
  position: absolute;
  top: var(--y);
  left: var(--x);
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  transform: translate(-50%, -50%);
  place-items: center;
  border: 2px solid #fff3ce;
  border-radius: 50%;
  background: var(--marker);
  color: #fff;
  box-shadow: 0 0 0 2px #000, 0 0 15px var(--marker);
  font-size: 10px;
  font-weight: 700;
  pointer-events: auto;
  cursor: pointer;
}

.map-marker:hover,
.map-marker:focus-visible {
  z-index: 2;
  transform: translate(-50%, -50%) scale(1.2);
}

.land {
  fill: #23463c;
  stroke: #71927e;
  stroke-width: 1;
}

.graticule {
  stroke: rgba(232, 209, 145, 0.11);
  stroke-width: 1;
}

.side-list {
  display: grid;
  gap: 4px;
  max-height: 555px;
  overflow: auto;
}

.side-list.compact {
  max-height: 390px;
}

.side-item {
  display: block;
  width: 100%;
  padding: 7px;
  border: 1px solid #9b9787;
  background: #fffdf2;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--bevel-raised);
  cursor: pointer;
}

.side-item:hover,
.side-item:focus-visible {
  background: #fff7cf;
}

.side-item strong,
.side-item span {
  display: block;
}

.side-item strong {
  font-family: Georgia, serif;
  font-size: 13px;
}

.side-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.timeline-panel {
  padding: 5px;
}

.timeline-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px;
  background: var(--chrome);
}

.timeline-controls p {
  margin: 0;
  color: #3d403a;
  font-size: 11px;
}

.timeline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  background: #101b18;
  box-shadow: var(--bevel-sunken);
  scrollbar-color: var(--chrome-mid) #e4e5df;
}

.timeline {
  position: relative;
  display: grid;
  min-width: 1240px;
  min-height: 570px;
  grid-template-columns: repeat(var(--timeline-columns, 6), minmax(200px, 1fr));
  gap: 0;
  padding: 70px 28px 24px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 46px;
  right: 28px;
  left: 28px;
  height: 2px;
  background: var(--gold-light);
  box-shadow: 0 0 12px rgba(234, 209, 142, 0.45);
}

.timeline-era-column {
  position: relative;
  min-width: 0;
  padding: 18px 6px 0;
  border-left: 1px dashed rgba(234, 209, 142, 0.3);
}

.timeline-era-column::before {
  content: "";
  position: absolute;
  top: -29px;
  left: -5px;
  width: 8px;
  height: 8px;
  border: 1px solid #fff2c8;
  background: var(--amber);
}

.timeline-era {
  position: absolute;
  top: -58px;
  left: 5px;
  color: #ead18e;
  font-family: "Courier New", monospace;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.timeline-item {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 7px;
  min-height: 100px;
  margin-bottom: 6px;
  padding: 5px;
  border: 1px solid #262923;
  background: var(--paper);
  box-shadow: var(--bevel-raised);
  cursor: pointer;
}

.timeline-item:hover,
.timeline-item:focus-visible {
  background: #fff8d7;
}

.timeline-thumb {
  position: relative;
  width: 62px;
  height: 72px;
  overflow: hidden;
  border: 1px solid #4a4a42;
  background: #183027;
}

.inspector-image {
  aspect-ratio: 16 / 9;
  margin: 8px 0;
}

.timeline-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.timeline-year {
  color: #80530c;
  font-family: "Courier New", monospace;
  font-size: 10px;
  font-weight: 700;
}

.timeline-item h3 {
  margin: 2px 0 3px;
  font-family: Georgia, serif;
  font-size: 14px;
  line-height: 1.15;
}

.timeline-item p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.motif-panel {
  min-height: 670px;
}

.node-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
}

.node-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 10px;
}

.node-legend i {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.45);
}

.compare-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 7px;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.compare-card {
  min-width: 0;
  padding: 6px;
  border: 1px solid #8f8b7e;
  background: var(--paper);
  box-shadow: var(--bevel-sunken);
}

.compare-card select {
  width: 100%;
  height: 31px;
  margin-bottom: 6px;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: var(--bevel-sunken);
}

.compare-card h3 {
  min-height: 46px;
  margin: 8px 2px;
  font-family: Georgia, serif;
  font-size: 18px;
}

.compare-image {
  aspect-ratio: 16 / 9;
}

.compare-field {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 7px;
  padding: 7px 3px;
  border-top: 1px dotted #aaa590;
}

.compare-field b {
  font-family: "Courier New", monospace;
  font-size: 10px;
  text-transform: uppercase;
}

.compare-field span {
  font-size: 11px;
}

.active-filter-note {
  margin-bottom: 8px;
  padding: 6px 8px;
  border: 1px solid #8f8b7e;
  background: #fff5bf;
  box-shadow: var(--bevel-raised);
}

.method-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(270px, 0.6fr);
  gap: 8px;
}

.method-panel,
.source-panel,
.glossary-panel,
.compare-panel {
  padding: 10px;
}

.method-panel > p,
.source-panel > p,
.glossary-panel > p {
  color: var(--muted);
}

.principle-list {
  display: grid;
  gap: 5px;
  padding: 0;
  list-style: none;
}

.principle-list li {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid #aaa590;
  background: var(--paper);
  box-shadow: var(--bevel-sunken);
}

.principle-list strong {
  font-family: Georgia, serif;
}

.source-card,
.glossary-card {
  padding: 9px;
  border: 1px solid #aaa590;
  background: var(--paper);
  box-shadow: var(--bevel-sunken);
}

.source-card h3,
.glossary-card h3 {
  margin: 0 0 4px;
  font-family: Georgia, serif;
  font-size: 16px;
}

.source-card p,
.glossary-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.source-card ul {
  margin: 7px 0 0;
  padding-left: 20px;
}

.source-card li + li {
  margin-top: 4px;
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.empty-state {
  min-height: 240px;
  padding: 40px;
  border: 1px solid #8e8b80;
  background: var(--paper);
  box-shadow: var(--bevel-sunken);
  color: var(--muted);
  text-align: center;
}

.status-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 4px;
  padding: 5px 4px 2px;
  background: var(--chrome);
  font-size: 10px;
}

.status-bar > span {
  min-width: 0;
  min-height: 23px;
  padding: 4px 7px;
  overflow: hidden;
  box-shadow: var(--bevel-sunken);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-light {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border: 1px solid #1f3129;
  background: #36a66d;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  padding: 18px;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 10, 8, 0.8);
}

.modal-panel {
  position: relative;
  width: min(1000px, 100%);
  max-height: calc(100vh - 36px);
  padding: 3px;
  overflow: hidden;
  border: 1px solid #111;
  background: var(--chrome);
  box-shadow: var(--bevel-raised), 12px 14px 0 rgba(0, 0, 0, 0.35);
}

.modal-titlebar {
  margin-bottom: 3px;
}

.modal-content {
  max-height: calc(100vh - 78px);
  padding: 18px;
  overflow: auto;
  background: var(--paper);
  box-shadow: var(--bevel-sunken);
}

.modal-title {
  margin: 8px 0 12px;
  font-family: Georgia, serif;
  font-size: 34px;
  line-height: 1.05;
}

.article-image {
  aspect-ratio: 16 / 7;
  max-height: 440px;
}

.article-claim {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #918c7c;
  border-left: 5px solid var(--gold);
  background: #fffbe9;
  font-family: Georgia, serif;
  font-size: 17px;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.article-field {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid #aaa590;
  background: #fffdf2;
  box-shadow: var(--bevel-sunken);
}

.article-field b,
.article-section h3 {
  color: #684708;
  font-family: "Courier New", monospace;
  font-size: 10px;
  text-transform: uppercase;
}

.article-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #aaa590;
}

.article-section h3,
.article-section p {
  margin: 0;
}

.article-section p {
  margin-top: 5px;
}

.creator-theory {
  border-left: 4px solid #b98d2f;
  background: linear-gradient(90deg, rgba(185, 141, 47, 0.13), rgba(185, 141, 47, 0.025));
}

.creator-theory ol {
  margin: 9px 0 8px 22px;
  padding: 0;
}

.creator-theory li {
  margin: 0 0 7px;
  padding-left: 3px;
  line-height: 1.45;
}

.creator-theory .theory-boundary {
  padding: 8px;
  border: 1px solid rgba(162, 77, 70, 0.42);
  background: rgba(162, 77, 70, 0.08);
}

.image-credit a {
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Dimensional visualization pass */
.network-shell {
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 44%, rgba(67, 135, 105, 0.2), transparent 42%),
    linear-gradient(rgba(104, 164, 136, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(196, 155, 69, 0.07) 1px, transparent 1px),
    #030c0a;
  background-size: auto, 32px 32px, 32px 32px, auto;
}

.mycelial-svg-depth {
  touch-action: none;
  user-select: none;
}

.network-depth-field { cursor: grab; }
.is-rotating .network-depth-field { cursor: grabbing; }

.depth-rings {
  pointer-events: none;
  transform-origin: center;
}

.depth-rings ellipse {
  fill: none;
  stroke: rgba(218, 196, 125, 0.11);
  stroke-width: 1;
  stroke-dasharray: 3 9;
}

.depth-rings ellipse:nth-child(2) {
  stroke: rgba(99, 177, 139, 0.12);
  stroke-dasharray: 2 12;
}

.network-dust { pointer-events: none; }

.network-dust circle {
  fill: #d8c98c;
  opacity: 0.22;
  animation: spore-pulse 5.5s ease-in-out var(--delay) infinite alternate;
}

@keyframes spore-pulse {
  from { opacity: 0.08; }
  to { opacity: 0.48; }
}

.network-edge-depth {
  stroke: #cbbf86;
  stroke-linecap: round;
  filter: url("#edgeGlow");
  vector-effect: non-scaling-stroke;
}

.network-node {
  transform-box: fill-box;
  transform-origin: center;
}

.network-node .node-halo {
  stroke: none;
  opacity: 0.12;
  filter: url("#nodeGlow");
}

.network-node .node-core {
  stroke: rgba(255, 247, 216, 0.9);
  stroke-width: 1.2;
  filter: url("#nodeGlow");
}

.network-node .node-shine {
  fill: #fff;
  stroke: none;
  opacity: 0.72;
  filter: none;
  pointer-events: none;
}

.network-node.minor-node text { opacity: 0.26; }

.network-node:not(.minor-node) text {
  opacity: 0.86;
  font-weight: 700;
}

.network-node:hover text,
.network-node:focus-visible text,
.network-node.active text { opacity: 1; }

.network-node:hover .node-halo,
.network-node:focus-visible .node-halo,
.network-node.active .node-halo { opacity: 0.35; }

.network-depth-key {
  position: absolute;
  left: 10px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #aeb9ac;
  font: 9px "Courier New", monospace;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.network-depth-key i {
  display: block;
  width: 54px;
  height: 4px;
  border: 1px solid rgba(222, 210, 164, 0.45);
  background: linear-gradient(90deg, #f5dc8c, #315f51 62%, #0b1b18);
}

.atlas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 35px;
  padding: 3px 2px 5px;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 5px 12px;
  color: #3c433e;
  font-size: 10px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border: 1px solid #2b332e;
  border-radius: 50%;
}

.legend-dot.strong { background: #438769; }
.legend-dot.contested { background: #a24d46; }

.map-wrap {
  min-height: 500px;
  aspect-ratio: 1000 / 540;
  isolation: isolate;
  border: 1px solid #000;
  background: #04120f;
}

.atlas-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.marker-layer-html { z-index: 2; }

.map-marker {
  display: flex;
  width: auto;
  min-width: 112px;
  height: 34px;
  padding: 3px 8px 3px 4px;
  transform: translate(-50%, -50%);
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  border: 1px solid rgba(255, 243, 206, 0.86);
  border-radius: 17px;
  background: rgba(4, 17, 14, 0.88);
  color: #f7efd5;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.92), 0 4px 12px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(2px);
  font-size: 10px;
  text-align: left;
  white-space: nowrap;
}

.map-marker-count {
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: var(--marker);
  box-shadow: 0 0 12px var(--marker);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.map-marker-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-marker:hover,
.map-marker:focus-visible,
.map-marker.active {
  z-index: 4;
  transform: translate(-50%, -50%) scale(1.08);
  border-color: #fff;
  background: rgba(20, 55, 45, 0.96);
  color: #fff;
  outline: none;
}

.map-marker.active {
  box-shadow: 0 0 0 2px #d4ba70, 0 5px 18px rgba(0, 0, 0, 0.56);
}

.map-compass {
  position: absolute;
  z-index: 1;
  top: 14px;
  left: 16px;
  display: grid;
  color: rgba(240, 225, 177, 0.7);
  font: 700 10px Georgia, serif;
  place-items: center;
}

.map-compass i {
  width: 1px;
  height: 24px;
  margin-top: 2px;
  background: linear-gradient(#e0c87e, transparent);
}

.map-scale {
  position: absolute;
  z-index: 1;
  right: 14px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(231, 222, 190, 0.58);
  font: 9px "Courier New", monospace;
  letter-spacing: 0.03em;
  pointer-events: none;
}

.map-scale i {
  width: 52px;
  height: 5px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  border-left: 1px solid currentColor;
}

.atlas-layout > .index-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 4px;
}

.atlas-layout > .index-panel h3 {
  margin: 0;
  padding: 10px 9px 8px;
  background: var(--paper);
  box-shadow: var(--bevel-sunken);
  font-size: 17px;
}

.atlas-layout .side-list {
  flex: 1;
  max-height: 525px;
  padding: 4px;
  background: var(--paper);
  box-shadow: var(--bevel-sunken);
}

@media (prefers-reduced-motion: reduce) {
  .network-dust circle { animation: none; }
}

@media (max-width: 1120px) {
  .filter-bar {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }

  .entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-codex,
  .motif-layout,
  .atlas-layout {
    grid-template-columns: minmax(0, 1.65fr) minmax(250px, 0.7fr);
  }
}

@media (max-width: 820px) {
  body {
    padding: 5px;
    font-size: 13px;
  }

  .app-window {
    min-height: calc(100vh - 10px);
    box-shadow: var(--bevel-raised), 4px 5px 0 rgba(0, 0, 0, 0.25);
  }

  .brand-strip,
  .home-codex,
  .motif-layout,
  .atlas-layout,
  .method-grid,
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .method-card {
    display: none;
  }

  .control-panel {
    position: relative;
    grid-template-columns: 1fr;
  }

  .toggle {
    justify-content: flex-start;
  }

  .filter-bar {
    grid-column: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-timeline {
    grid-column: 1;
  }

  .codex-intro {
    grid-template-columns: 1fr;
  }

  .network-shell,
  .home-network {
    min-height: 470px;
  }

  .codex-side,
  .motif-detail {
    max-height: none;
  }

  .entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-bar {
    grid-template-columns: 1fr auto;
  }

  .status-bar > span:last-child {
    display: none;
  }

  .modal-title {
    font-size: 26px;
  }
}

@media (max-width: 560px) {
  .title-bar h1 {
    font-size: 11px;
  }

  .title-bar-actions button {
    width: 21px;
  }

  .menu-bar button {
    padding-inline: 6px;
    font-size: 11px;
  }

  .brand-block {
    padding: 7px 9px;
  }

  .subtitle {
    font-size: 14px;
    line-height: 1.25;
  }

  .entry-grid,
  .article-grid {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-chip:nth-child(n + 5) {
    display: none;
  }

  #app {
    min-height: 520px;
    padding: 5px;
  }

  .view-head {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px;
  }

  .view-head h2,
  .codex-intro h2 {
    font-size: 23px;
  }

  .network-shell,
  .home-network {
    min-height: 420px;
  }

  .network-toolbar .text-button {
    flex: 1 1 42%;
  }

  .entry-card {
    min-height: 0;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .map-wrap {
    min-height: 390px;
  }

  .timeline {
    min-width: 1080px;
  }

  .timeline-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .timeline-controls .text-button {
    width: 100%;
  }

  .modal {
    padding: 4px;
  }

  .modal-panel {
    max-height: calc(100vh - 8px);
  }

  .modal-content {
    max-height: calc(100vh - 49px);
    padding: 10px;
  }

  .modal-title {
    font-size: 23px;
  }

  .article-image {
    aspect-ratio: 4 / 3;
  }

  .status-bar {
    grid-template-columns: 1fr;
  }

  .status-bar > span:nth-child(2) {
    display: none;
  }
}

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

@media (max-width: 820px) {
  .atlas-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-legend { justify-content: flex-start; }

  .atlas-layout .side-list { max-height: 420px; }
}

@media (max-width: 560px) {
  .map-wrap {
    min-height: 350px;
    aspect-ratio: 1.35;
  }

  .map-marker {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 4px;
    border-radius: 50%;
  }

  .map-marker-count {
    flex-basis: 24px;
  }

  .map-marker-label { display: none; }

  .map-scale span { display: none; }

  .map-compass {
    top: 9px;
    left: 10px;
  }

  .network-depth-key { display: none; }

  .network-node.minor-node text { opacity: 0.12; }
}

/* 2D powder-physics mycelium */
.powder-shell {
  isolation: isolate;
  touch-action: none;
  background:
    radial-gradient(circle at 50% 45%, rgba(57, 119, 91, 0.2), transparent 50%),
    linear-gradient(rgba(96, 150, 123, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(196, 155, 69, 0.05) 1px, transparent 1px),
    #020a08;
  background-size: auto, 32px 32px, 32px 32px, auto;
}

.powder-shell::after {
  content: "2D POWDER FIELD  /  DRAG COLONIES  /  CLICK TO FILTER";
}

.powder-canvas,
.powder-node-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.powder-canvas {
  z-index: 0;
  display: block;
}

.powder-node-layer {
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.powder-node {
  position: absolute;
  display: grid;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  transform: translate(-50%, -50%);
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: #eee5c9;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

.powder-node:active { cursor: grabbing; }

.powder-node-dot {
  display: block;
  width: var(--node-size);
  height: var(--node-size);
  border: 1px solid rgba(255, 247, 218, 0.9);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,.8) 0 8%, transparent 10%),
    var(--node-color);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--node-color) 18%, transparent),
    0 0 14px color-mix(in srgb, var(--node-color) 78%, transparent);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.powder-node-label {
  position: absolute;
  top: calc(50% + var(--node-size) / 2 + 4px);
  left: 50%;
  width: max-content;
  max-width: 126px;
  padding: 1px 3px;
  transform: translateX(-50%);
  overflow: hidden;
  border-radius: 2px;
  background: rgba(1, 8, 6, 0.66);
  color: #e8e1ca;
  font: 10px Tahoma, sans-serif;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
  pointer-events: none;
}

.powder-node.minor-node .powder-node-label { opacity: 0.2; }

.powder-node:hover,
.powder-node:focus-visible,
.powder-node.active {
  z-index: 5;
  outline: none;
}

.powder-node:hover .powder-node-dot,
.powder-node:focus-visible .powder-node-dot,
.powder-node.active .powder-node-dot {
  transform: scale(1.32);
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--node-color) 26%, transparent),
    0 0 22px var(--node-color);
}

.powder-node:hover .powder-node-label,
.powder-node:focus-visible .powder-node-label,
.powder-node.active .powder-node-label {
  opacity: 1;
  background: rgba(1, 8, 6, 0.94);
  color: #fff;
  font-weight: 700;
}

.powder-status {
  position: absolute;
  z-index: 3;
  left: 10px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border: 1px solid rgba(164, 191, 167, 0.2);
  background: rgba(2, 12, 9, 0.76);
  color: #aebcad;
  font: 9px "Courier New", monospace;
  letter-spacing: 0.07em;
  pointer-events: none;
}

.powder-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d9c479;
  box-shadow: 0 0 8px #d9c479;
  animation: spore-pulse 1.5s ease-in-out infinite alternate;
}

/* Offline Natural Earth atlas plate */
.map-wrap {
  min-height: 440px;
  aspect-ratio: 2 / 1;
  background: #071614;
}

.atlas-map-image {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  filter: brightness(0.56) saturate(0.68) contrast(1.18) sepia(0.08);
}

.map-wrap::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(rgba(7, 30, 25, 0.06), rgba(1, 10, 8, 0.24)),
    radial-gradient(circle at 50% 45%, transparent 42%, rgba(0, 7, 5, 0.36));
  pointer-events: none;
}

.marker-layer-html { z-index: 3; }
.map-compass,
.map-scale { z-index: 4; }

@media (prefers-reduced-motion: reduce) {
  .powder-status i { animation: none; }
}

@media (max-width: 560px) {
  .powder-node {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
  }

  .powder-node-label {
    max-width: 86px;
    font-size: 8px;
  }

  .powder-node.minor-node .powder-node-label { display: none; }

  .powder-status { display: none; }

  .map-wrap {
    min-height: 260px;
    aspect-ratio: 1.5;
  }
}

/* Spatial powder mycelium: a perspective canvas with accessible HTML colonies */
.network-toolbar-spatial {
  align-items: end;
  padding-block: 7px;
}

.network-select-control {
  display: grid;
  min-width: 142px;
  gap: 2px;
  color: #64706a;
  font: 700 9px "Courier New", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.network-select-control select {
  min-height: 30px;
  padding: 3px 25px 3px 7px;
  border: 1px solid #7d827b;
  border-radius: 0;
  background: #e7e8df;
  box-shadow: inset 1px 1px #fff, inset -1px -1px #a4a69f;
  color: #12392f;
  font: 700 11px Tahoma, sans-serif;
}

.spatial-powder-shell {
  min-height: 710px;
  isolation: isolate;
  touch-action: none;
  user-select: none;
  background:
    radial-gradient(ellipse at 50% 44%, rgba(43, 119, 88, 0.27), transparent 48%),
    radial-gradient(ellipse at 72% 32%, rgba(185, 145, 61, 0.09), transparent 32%),
    linear-gradient(rgba(112, 160, 137, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(112, 160, 137, 0.045) 1px, transparent 1px),
    #020907;
  background-size: auto, auto, 36px 36px, 36px 36px, auto;
}

.spatial-powder-shell::after {
  content: "3D POWDER FIELD  /  ORBIT  /  ZOOM  /  DRAG COLONIES";
  z-index: 4;
  right: 9px;
  bottom: 7px;
  border: 1px solid rgba(182, 190, 169, 0.13);
  background: rgba(1, 9, 7, 0.78);
  color: #8fa198;
}

.spatial-powder-canvas,
.spatial-node-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.spatial-powder-canvas {
  z-index: 0;
  display: block;
  cursor: grab;
  touch-action: none;
}

.spatial-powder-shell.is-orbiting .spatial-powder-canvas { cursor: grabbing; }

.spatial-node-layer {
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
  perspective: 900px;
}

.spatial-node {
  --depth-scale: 1;
  position: absolute;
  display: grid;
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  transform: translate(-50%, -50%) scale(var(--depth-scale));
  transform-origin: center;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: #eee5c9;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  transition: filter 120ms ease, opacity 120ms ease;
}

.spatial-node:active { cursor: grabbing; }

.spatial-node-core {
  position: relative;
  z-index: 2;
  display: block;
  width: var(--node-size);
  height: var(--node-size);
  border: 1px solid rgba(255, 250, 226, 0.92);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.92) 0 6%, transparent 9%),
    radial-gradient(circle at 50% 52%, color-mix(in srgb, var(--node-color) 88%, white) 0 16%, var(--node-color) 55%, color-mix(in srgb, var(--node-color) 56%, #00110b) 100%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--node-color) 17%, transparent),
    0 0 13px color-mix(in srgb, var(--node-color) 78%, transparent),
    inset -2px -3px 5px rgba(0, 0, 0, 0.46);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.spatial-node-orbit {
  position: absolute;
  z-index: 1;
  width: calc(var(--node-size) + 13px);
  height: calc(var(--node-size) + 5px);
  border: 1px solid color-mix(in srgb, var(--node-color) 40%, transparent);
  border-radius: 50%;
  transform: rotate(-18deg);
  opacity: 0.58;
}

.spatial-node-orbit::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -2px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff0b1;
  box-shadow: 0 0 6px var(--node-color);
}

.spatial-node-label {
  position: absolute;
  z-index: 3;
  top: calc(50% + var(--node-size) / 2 + 5px);
  left: 50%;
  width: max-content;
  max-width: 148px;
  padding: 2px 4px;
  transform: translateX(-50%);
  overflow: hidden;
  border: 1px solid rgba(185, 198, 178, 0.13);
  background: rgba(1, 10, 7, 0.76);
  color: #dddac7;
  font: 10px Tahoma, sans-serif;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
  pointer-events: none;
}

.spatial-node .spatial-node-label { opacity: 0.06; }
.spatial-node.node-culture .spatial-node-label { opacity: 0.92; }
.spatial-node.node-evidence .spatial-node-label,
.spatial-node.node-confidence .spatial-node-label { opacity: 0.72; }
.spatial-node.node-tradition .spatial-node-label { opacity: 0.48; }
.spatial-node.node-region .spatial-node-label { opacity: 0.34; }
.spatial-node.node-entry .spatial-node-orbit { border-style: dotted; }

.spatial-node:hover,
.spatial-node:focus-visible,
.spatial-node.active {
  z-index: 4000 !important;
  outline: none;
  filter: brightness(1.2);
}

.spatial-node:hover .spatial-node-core,
.spatial-node:focus-visible .spatial-node-core,
.spatial-node.active .spatial-node-core {
  transform: scale(1.35);
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--node-color) 28%, transparent),
    0 0 24px var(--node-color),
    inset -2px -3px 5px rgba(0, 0, 0, 0.38);
}

.spatial-node:hover .spatial-node-label,
.spatial-node:focus-visible .spatial-node-label,
.spatial-node.active .spatial-node-label {
  opacity: 1;
  border-color: color-mix(in srgb, var(--node-color) 58%, #b7baa9);
  background: rgba(1, 10, 7, 0.96);
  color: #fffdf0;
  font-weight: 700;
}

.spatial-hud {
  position: absolute;
  z-index: 3;
  top: 9px;
  left: 9px;
  display: grid;
  max-width: calc(100% - 18px);
  gap: 2px;
  padding: 5px 7px;
  border: 1px solid rgba(182, 196, 177, 0.2);
  background: rgba(1, 10, 7, 0.78);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  color: #9daca2;
  font: 9px "Courier New", monospace;
  letter-spacing: 0.035em;
  pointer-events: none;
}

.spatial-hud b {
  color: #e3cf86;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .network-toolbar-spatial { align-items: stretch; }

  .network-select-control {
    flex: 1 1 44%;
    min-width: 0;
  }

  .network-toolbar-spatial .text-button { flex: 1 1 31%; }

  .spatial-powder-shell,
  .home-network.spatial-powder-shell { min-height: 520px; }

  .spatial-node {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .spatial-node-label {
    max-width: 96px;
    font-size: 8px;
  }

  .spatial-node.minor-node .spatial-node-label { display: none; }
  .spatial-hud span:last-child { display: none; }
}
