:root {
  color-scheme: dark;
  --night-map: #070605;
  --bg: #100d0b;
  --ocean-teal: #173d3d;
  --ocean-light: #2f7771;
  --brass: #c99a45;
  --brass-dark: #6f4a20;
  --enamel: rgba(12, 22, 22, 0.72);
  --parchment-button: #ead293;
  --glow-gold: #ffd66e;
  --scroll-paper: #d8bc82;
  --scroll-paper-light: #ecd8a5;
  --scroll-paper-dark: #8f673a;
  --scroll-ink: #f3e4bf;
  --scroll-blue: #4aa0a0;
  --panel: rgba(13, 23, 23, 0.68);
  --panel-strong: rgba(20, 25, 22, 0.88);
  --archive: rgba(79, 51, 25, 0.1);
  --paper: #f0dca7;
  --paper-deep: #9c713e;
  --mist: #6ea9a4;
  --line: rgba(201, 154, 69, 0.26);
  --text: #f6e8c5;
  --muted: #b7a184;
  --gold: #e4bd74;
  --amber: #f3cc7a;
  --aqua: #73d7d6;
  --violet: #c394ff;
  --danger: #ff6966;
  --font-heading: "Merriweather", Georgia, "Times New Roman", serif;
  --font-body: "Poppins", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--font-body);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 50% 40%, rgba(19, 82, 78, 0.36), transparent 34%),
    radial-gradient(circle at 18% 16%, rgba(93, 190, 179, 0.14), transparent 28%),
    radial-gradient(circle at 82% 76%, rgba(243, 204, 122, 0.08), transparent 32%),
    linear-gradient(180deg, #06100f 0%, #071817 44%, #020504 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(246, 232, 197, 0.78) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(115, 215, 214, 0.32) 0 1px, transparent 1.8px),
    radial-gradient(circle at 18% 30%, rgba(243, 204, 122, 0.08), transparent 8%),
    linear-gradient(rgba(234, 210, 147, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(234, 210, 147, 0.014) 1px, transparent 1px);
  background-position: 0 0, 32px 18px, 0 0, 0 0, 0 0;
  background-size: 170px 170px, 250px 250px, auto, 96px 96px, 96px 96px;
  opacity: 0.48;
}

.ambient-map-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, rgba(28, 120, 112, 0.22), transparent 46%),
    radial-gradient(circle at 50% 110%, rgba(0, 0, 0, 0.7), transparent 48%),
    linear-gradient(180deg, rgba(9, 24, 23, 0.16), rgba(0, 0, 0, 0.46));
}

.ambient-map-backdrop::before,
.ambient-map-backdrop::after {
  content: "";
  position: absolute;
  inset: 7% 9%;
  border: 1px solid rgba(255, 214, 110, 0.08);
  opacity: 0.7;
  transform: rotate(-3deg);
}

.ambient-map-backdrop::after {
  inset: 18% 14%;
  border-color: rgba(115, 215, 214, 0.08);
  transform: rotate(5deg);
}

.detail-body {
  overflow: auto;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  height: 100vh;
  padding: 0;
}

.atlas-plaque {
  justify-self: center;
  display: grid;
  min-width: min(520px, calc(100vw - 48px));
  gap: 2px;
  border: 1px solid rgba(201, 154, 69, 0.38);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(234, 210, 147, 0.14), transparent 58%),
    linear-gradient(180deg, rgba(13, 25, 25, 0.82), rgba(7, 12, 11, 0.72));
  box-shadow:
    inset 0 1px rgba(255, 244, 204, 0.16),
    0 18px 54px rgba(0, 0, 0, 0.34),
    0 0 44px rgba(75, 168, 156, 0.08);
  padding: 10px 28px 12px;
  text-align: center;
}

.floating-controls {
  position: fixed;
  top: 22px;
  left: 22px;
  z-index: 18;
  display: flex;
  gap: 8px;
}

.atlas-plaque span,
.atlas-plaque small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.atlas-plaque strong {
  color: var(--text);
  font-size: 30px;
  letter-spacing: 0.04em;
  text-shadow: 0 0 22px rgba(255, 214, 110, 0.28);
}

.atlas-plaque small {
  letter-spacing: 0.12em;
}

.atlas-plaque b {
  color: var(--glow-gold);
}

.scroll-shell {
  background:
    radial-gradient(circle at 50% 0%, rgba(93, 190, 179, 0.16), transparent 38%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.28), transparent 8%, transparent 92%, rgba(0, 0, 0, 0.28)),
    linear-gradient(180deg, rgba(74, 160, 160, 0.14), rgba(234, 210, 147, 0.035));
}

.app-shell > * {
  min-width: 0;
}

.control-panel,
.card-panel,
.map-stage {
  position: relative;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 30% 12%, rgba(255, 214, 110, 0.09), transparent 32%),
    linear-gradient(180deg, rgba(255, 214, 110, 0.06), rgba(74, 160, 160, 0.025)),
    var(--panel);
  box-shadow:
    inset 0 1px rgba(255, 214, 110, 0.16),
    inset 0 -20px 40px rgba(0, 0, 0, 0.16),
    0 18px 60px rgba(0, 0, 0, 0.42);
}

.map-first-shell .map-stage {
  grid-row: 1;
  width: 100vw;
  height: 100vh;
  justify-self: center;
}

.map-first-shell .atlas-plaque {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 18;
  transform: translateX(-50%);
}

.map-first-shell .control-panel,
.map-first-shell .card-panel {
  position: fixed;
  top: 98px;
  bottom: 14px;
  z-index: 16;
  width: min(340px, calc(100vw - 28px));
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.map-first-shell .control-panel {
  left: 14px;
  transform: translateX(calc(-100% - 28px));
}

.map-first-shell .card-panel {
  width: min(390px, calc(100vw - 28px));
  right: 14px;
  transform: translateX(calc(100% + 28px));
}

.map-first-shell .control-panel.overlay-open,
.map-first-shell .card-panel.overlay-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.panel-glass {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 214, 110, 0.025)),
    rgba(7, 14, 14, 0.78);
  backdrop-filter: blur(16px);
}

.control-panel::before,
.card-panel::before,
.map-stage::before {
  content: "";
  position: absolute;
  inset: 9px;
  z-index: 0;
  border: 1px solid rgba(78, 45, 20, 0.12);
  border-radius: 6px;
  pointer-events: none;
}

.control-panel::after,
.card-panel::after,
.map-stage::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 0;
  width: 42px;
  height: 42px;
  border-right: 1px solid rgba(78, 45, 20, 0.28);
  border-bottom: 1px solid rgba(78, 45, 20, 0.28);
  border-radius: 0 0 6px 0;
  opacity: 0.65;
  pointer-events: none;
}

.corner-ornament {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.control-panel,
.card-panel {
  overflow: hidden;
  border-radius: 8px;
}

.control-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.control-panel > *,
.card-panel > *,
.map-stage > * {
  position: relative;
  z-index: 1;
}

.brand-block h1,
.map-header h2,
.legend-card h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand-block h1 {
  font-family: var(--font-heading);
  font-size: 42px;
  line-height: 1;
  color: var(--scroll-ink);
  text-shadow: 0 0 18px rgba(255, 214, 110, 0.2);
}

.brand-block p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.brand-block {
  border-bottom: 1px solid rgba(78, 45, 20, 0.18);
  padding-bottom: 18px;
}

.story-count {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.story-count span {
  border: 1px solid rgba(255, 214, 110, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 9px;
  font-size: 12px;
}

.story-count strong {
  display: block;
  color: var(--glow-gold);
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.search-box {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.search-box input {
  width: 100%;
  border: 1px solid rgba(255, 214, 110, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  outline: none;
  padding: 12px 13px;
}

.search-box input:focus {
  border-color: rgba(225, 184, 90, 0.65);
  box-shadow: 0 0 0 3px rgba(225, 184, 90, 0.1);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(78, 45, 20, 0.26), transparent);
}

.ghost-button,
.primary-button,
.chip,
.legend-row,
.theme-tags button {
  cursor: pointer;
  border: 1px solid rgba(201, 154, 69, 0.34);
  border-radius: 5px;
  background:
    linear-gradient(180deg, rgba(255, 244, 204, 0.06), rgba(201, 154, 69, 0.045)),
    var(--enamel);
  box-shadow:
    inset 0 1px rgba(255, 244, 204, 0.12),
    0 8px 24px rgba(0, 0, 0, 0.2);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.ghost-button {
  padding: 6px 9px;
  color: #f1d995;
  font-size: 12px;
  font-weight: 800;
}

.map-control,
.floating-controls .ghost-button {
  border-color: rgba(201, 154, 69, 0.52);
  background:
    linear-gradient(180deg, rgba(234, 210, 147, 0.12), rgba(91, 59, 25, 0.1)),
    rgba(12, 22, 22, 0.78);
  text-shadow: 0 1px rgba(0, 0, 0, 0.5);
}

.primary-button {
  min-width: 146px;
  padding: 12px 16px;
  border-color: rgba(111, 74, 32, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 246, 200, 0.9), rgba(234, 184, 104, 0.95)),
    var(--parchment-button);
  color: #1f1408;
  font-weight: 900;
  box-shadow:
    inset 0 1px rgba(255, 255, 230, 0.65),
    0 10px 30px rgba(201, 154, 69, 0.22);
}

.map-first-shell .primary-button {
  min-width: auto;
  padding: 9px 13px;
  border-color: rgba(226, 190, 103, 0.38);
  background:
    linear-gradient(180deg, rgba(244, 222, 166, 0.16), rgba(38, 94, 88, 0.08)),
    rgba(6, 14, 14, 0.62);
  color: #f4dfa1;
  box-shadow:
    inset 0 1px rgba(255, 244, 204, 0.1),
    0 12px 30px rgba(0, 0, 0, 0.2);
}

.parchment-button,
.primary-button {
  letter-spacing: 0.01em;
}

.chip {
  padding: 8px 11px;
  color: #d8c390;
  font-size: 11px;
  font-weight: 750;
  text-align: left;
  background:
    linear-gradient(180deg, rgba(234, 210, 147, 0.06), rgba(14, 26, 25, 0.08)),
    rgba(8, 15, 15, 0.58);
}

.chip.active,
.chip:hover,
.legend-row:hover,
.legend-row.active,
.theme-tags button:hover {
  border-color: rgba(234, 210, 147, 0.62);
  background:
    linear-gradient(180deg, rgba(234, 210, 147, 0.14), rgba(54, 105, 98, 0.08)),
    rgba(15, 28, 27, 0.76);
  color: var(--text);
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  max-height: 244px;
  overflow: auto;
  padding-right: 4px;
}

.legend-list {
  display: grid;
  gap: 8px;
  max-height: 100%;
  overflow: auto;
  padding-right: 4px;
}

.legend-group-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 7px 4px 4px;
  background: linear-gradient(180deg, rgba(9, 20, 20, 0.96), rgba(9, 20, 20, 0.78));
  color: #f0d793;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.legend-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 8px;
  text-align: left;
}

.legend-row strong,
.legend-row small {
  display: block;
}

.legend-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.legend-empty {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(226, 190, 103, 0.24);
  border-radius: 8px;
  padding: 14px;
  background: rgba(9, 20, 20, 0.58);
  color: var(--muted);
  line-height: 1.45;
}

.legend-empty strong {
  color: var(--text);
  font-size: 13px;
}

.legend-empty .ghost-button {
  width: fit-content;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 11px;
}

.row-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: rgba(115, 215, 214, 0.18);
  color: var(--aqua);
}

.map-stage {
  position: relative;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.map-header {
  position: absolute;
  top: 26px;
  left: 18px;
  right: 18px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  pointer-events: none;
}

.map-header .primary-button {
  pointer-events: auto;
}

.map-header::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 170px;
  height: 1px;
  background: linear-gradient(90deg, rgba(242, 207, 122, 0.55), transparent);
}

.map-header h2 {
  font-family: var(--font-heading);
  font-size: 26px;
}

.discovery-strip {
  position: absolute;
  top: 106px;
  left: 18px;
  right: 18px;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(255, 214, 110, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 214, 110, 0.16), rgba(115, 215, 214, 0.08)),
    rgba(0, 0, 0, 0.24);
  padding: 11px 13px;
}

.discovery-strip span,
.discovery-strip small {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.discovery-strip strong {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.discovery-strip small {
  color: var(--muted);
}

.quick-search {
  position: absolute;
  top: 82px;
  left: 30px;
  z-index: 6;
  display: grid;
  grid-template-columns: auto minmax(170px, 260px);
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(226, 190, 103, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(245, 226, 175, 0.08), rgba(76, 162, 150, 0.04)),
    rgba(5, 14, 14, 0.58);
  box-shadow:
    inset 0 1px rgba(255, 244, 204, 0.08),
    0 12px 34px rgba(0, 0, 0, 0.24);
  padding: 7px 11px;
  backdrop-filter: blur(10px);
}

.quick-search span {
  color: rgba(246, 232, 197, 0.62);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.quick-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.quick-search input::placeholder {
  color: rgba(246, 232, 197, 0.42);
}

.globe-stage {
  --cursor-x: 50%;
  --cursor-y: 50%;
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(201, 154, 69, 0.22);
  border-radius: 8px;
  background:
    radial-gradient(circle at var(--cursor-x) var(--cursor-y), rgba(234, 210, 147, 0.1), transparent 18%),
    radial-gradient(circle at 50% 34%, rgba(47, 119, 113, 0.28), transparent 42%),
    linear-gradient(180deg, #0b1818 0%, #102524 54%, #070c0b 100%);
}

.globe-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 214, 110, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 214, 110, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle, black, transparent 74%);
}

.map-grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 236, 170, 0.28) 1px, transparent 1.7px),
    linear-gradient(rgba(255, 214, 110, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 214, 110, 0.045) 1px, transparent 1px);
  background-size: 11.111% 12.5%;
  opacity: 0.3;
  mix-blend-mode: screen;
  mask-image: radial-gradient(circle at 50% 52%, black, transparent 68%);
}

.star-grid-overlay {
  filter: drop-shadow(0 0 5px rgba(255, 214, 110, 0.18));
}

#globe-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
}

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

.globe-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, transparent 42%, rgba(0, 0, 0, 0.12) 66%, rgba(0, 0, 0, 0.54) 100%),
    linear-gradient(180deg, rgba(255, 214, 110, 0.04), transparent 22%);
}

.globe-label {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: grid;
  gap: 4px;
  border: 1px solid rgba(255, 214, 110, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(20, 17, 17, 0.88), rgba(8, 6, 5, 0.86));
  padding: 12px 14px;
  pointer-events: none;
}

.globe-label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.globe-label strong {
  color: var(--glow-gold);
  font-size: 16px;
}

.compass-rose {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(61, 38, 18, 0.32);
  border-radius: 50%;
  opacity: 0.42;
  pointer-events: none;
}

.compass-rose::before,
.compass-rose::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(61, 38, 18, 0.3);
  transform: rotate(45deg);
}

.compass-rose::after {
  inset: 30px;
  border-color: rgba(38, 109, 112, 0.28);
  border-radius: 50%;
  transform: none;
}

.globe-zoom-controls {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 4;
  display: grid;
  overflow: hidden;
  border-radius: 6px;
  box-shadow:
    inset 0 1px rgba(255, 244, 204, 0.12),
    0 12px 26px rgba(0, 0, 0, 0.28);
}

.globe-zoom-controls button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-bottom: 1px solid rgba(201, 154, 69, 0.36);
  background: transparent;
  color: #f3d98e;
  cursor: pointer;
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
}

.globe-zoom-controls button:last-child {
  border-bottom: 0;
}

.globe-zoom-controls button:hover,
.globe-zoom-controls button:focus-visible {
  background: rgba(234, 210, 147, 0.13);
  outline: none;
}

.markers-layer {
  position: absolute;
  inset: 0;
  display: none;
}

.map-marker {
  position: absolute;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(255, 230, 172, 0.58);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 239, 191, 0.95), rgba(225, 184, 90, 0.82) 36%, rgba(225, 93, 75, 0.24) 68%),
    rgba(0, 0, 0, 0.32);
  box-shadow:
    0 0 18px rgba(225, 184, 90, 0.58),
    0 0 42px rgba(225, 85, 75, 0.25);
  color: #110c08;
  font-size: 12px;
  transform: translate(-50%, -50%);
}

.map-marker::after {
  content: "";
  position: absolute;
  inset: -9px;
  border: 1px solid rgba(225, 184, 90, 0.18);
  border-radius: 50%;
}

.map-marker:hover,
.map-marker.selected {
  z-index: 4;
  transform: translate(-50%, -50%) scale(1.24);
}

.map-marker.selected {
  border-color: rgba(123, 219, 225, 0.95);
  box-shadow:
    0 0 22px rgba(123, 219, 225, 0.82),
    0 0 70px rgba(123, 219, 225, 0.34);
}

.map-marker.related-glow {
  border-color: rgba(255, 214, 110, 0.86);
  box-shadow:
    0 0 20px rgba(255, 214, 110, 0.62),
    0 0 54px rgba(115, 215, 214, 0.22);
}

.story-preview-card {
  position: absolute;
  left: 50%;
  bottom: 92px;
  z-index: 7;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: min(650px, calc(100% - 36px));
  border: 1px solid rgba(201, 154, 69, 0.36);
  border-radius: 8px;
  background:
    radial-gradient(circle at 16% 18%, rgba(234, 210, 147, 0.14), transparent 36%),
    linear-gradient(180deg, rgba(13, 24, 23, 0.9), rgba(7, 11, 10, 0.84));
  box-shadow:
    inset 0 1px rgba(255, 244, 204, 0.12),
    0 22px 70px rgba(0, 0, 0, 0.42),
    0 0 38px rgba(47, 119, 113, 0.1);
  padding: 12px;
  transform: translateX(-50%);
}

.preview-media {
  display: grid;
  height: 96px;
  place-items: center;
  border: 1px solid rgba(214, 177, 93, 0.42);
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 30%, rgba(255, 240, 189, 0.34), transparent 27%),
    radial-gradient(circle, rgba(220, 194, 126, 0.28), rgba(31, 119, 112, 0.22) 58%, rgba(12, 35, 33, 0.78)),
    rgba(14, 31, 29, 0.78);
  box-shadow:
    inset 0 0 16px rgba(0, 0, 0, 0.18),
    0 0 18px rgba(118, 203, 194, 0.1),
    0 0 24px rgba(214, 177, 93, 0.08);
}

.character-medallion,
.preview-media {
  aspect-ratio: 1;
}

.character-medallion {
  overflow: hidden;
}

.medallion-picture,
.medallion-svg,
.medallion-image {
  display: block;
  width: 100%;
  height: 100%;
}

.medallion-svg,
.medallion-image {
  filter:
    drop-shadow(0 0 9px rgba(118, 203, 194, 0.14))
    drop-shadow(0 4px 12px rgba(0, 0, 0, 0.28));
}

.medallion-image {
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

.preview-copy {
  min-width: 0;
}

.preview-copy span,
.preview-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.preview-copy h3 {
  margin: 4px 0;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 27px;
  line-height: 1.06;
}

.preview-copy p {
  margin: 0 0 8px;
  color: #fff1c9;
  font-size: 14px;
  line-height: 1.35;
}

.preview-actions {
  display: grid;
  gap: 8px;
  min-width: 82px;
}

.preview-link {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.theme-rail {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  display: flex;
  gap: 9px;
  min-height: 44px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.theme-rail .chip {
  flex: 0 0 auto;
  white-space: nowrap;
}

.clarity-hud .map-header {
  top: 22px;
  left: 24px;
  right: 24px;
  justify-content: flex-end;
  min-height: 48px;
}

.clarity-hud .map-header div {
  display: none;
}

.clarity-hud .map-header::before {
  display: none;
}

.clarity-hud .discovery-strip {
  top: 104px;
  border-color: rgba(255, 214, 110, 0.13);
  background:
    linear-gradient(90deg, rgba(255, 214, 110, 0.1), rgba(115, 215, 214, 0.045)),
    rgba(0, 0, 0, 0.2);
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.22);
}

.clarity-hud .globe-label {
  display: none;
}

.clarity-hud .theme-rail {
  bottom: 20px;
}

.map-first-shell:not(.filters-open) .discovery-strip {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
}

.map-first-shell:not(.filters-open) .theme-rail {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

.map-first-shell.filters-open .theme-rail,
.map-first-shell.filters-open .discovery-strip {
  opacity: 1;
  transform: translateY(0);
}

.discovery-strip,
.theme-rail {
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.map-first-shell .atlas-plaque {
  min-width: min(470px, calc(100vw - 48px));
  border-color: rgba(226, 190, 103, 0.28);
  background:
    linear-gradient(90deg, rgba(11, 22, 22, 0.1), rgba(13, 28, 27, 0.86) 18% 82%, rgba(11, 22, 22, 0.1)),
    linear-gradient(180deg, rgba(245, 226, 175, 0.1), rgba(8, 14, 13, 0.48));
  box-shadow:
    inset 0 1px rgba(255, 244, 204, 0.12),
    0 12px 38px rgba(0, 0, 0, 0.26);
  padding: 8px 26px 10px;
}

.map-first-shell:not(.filters-open):not(.details-open) .atlas-plaque {
  top: 16px;
  min-width: min(380px, calc(100vw - 48px));
  padding: 7px 22px 8px;
  opacity: 0.92;
}

.map-first-shell:not(.filters-open):not(.details-open) .atlas-plaque strong {
  font-size: 24px;
}

.map-first-shell:not(.filters-open):not(.details-open) .atlas-plaque small {
  display: none;
}

.map-first-shell .atlas-plaque::before,
.map-first-shell .atlas-plaque::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 74px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(226, 190, 103, 0.54), transparent);
}

.map-first-shell .atlas-plaque::before {
  left: -60px;
}

.map-first-shell .atlas-plaque::after {
  right: -60px;
}

.map-first-shell .atlas-plaque strong {
  font-size: 28px;
  line-height: 1.05;
}

.tool-ribbon {
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(226, 190, 103, 0.22);
  border-radius: 8px;
  background: rgba(5, 14, 14, 0.42);
  box-shadow:
    inset 0 1px rgba(255, 244, 204, 0.06),
    0 14px 36px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
}

.tool-ribbon .ghost-button {
  min-width: 54px;
  border-color: rgba(226, 190, 103, 0.34);
  background:
    linear-gradient(180deg, rgba(244, 222, 166, 0.08), rgba(23, 61, 61, 0.18)),
    rgba(8, 16, 15, 0.62);
  box-shadow: none;
}

.mobile-random {
  display: none;
}

.map-stage {
  background:
    radial-gradient(circle at 50% 44%, rgba(76, 162, 150, 0.18), transparent 38%),
    linear-gradient(180deg, rgba(255, 244, 204, 0.035), rgba(9, 20, 19, 0.02)),
    rgba(8, 17, 16, 0.62);
}

.map-first-shell .map-stage {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.map-first-shell .map-stage::before,
.map-first-shell .map-stage::after {
  display: none;
}

.globe-stage {
  border-color: rgba(226, 190, 103, 0.16);
  background:
    radial-gradient(circle at 50% 42%, rgba(54, 130, 122, 0.2), transparent 38%),
    radial-gradient(circle at 50% 58%, rgba(244, 207, 122, 0.065), transparent 34%),
    linear-gradient(180deg, #0d2422 0%, #0a1716 62%, #060909 100%);
}

.map-first-shell .globe-stage {
  position: fixed;
  inset: 0;
  height: 100vh;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 44%, rgba(34, 117, 110, 0.24), transparent 36%),
    radial-gradient(circle at 50% 54%, rgba(245, 226, 175, 0.05), transparent 30%),
    linear-gradient(180deg, rgba(8, 24, 23, 0.48), rgba(0, 0, 0, 0.42));
}

.map-first-shell .globe-stage::before {
  opacity: 0.14;
  background-image:
    radial-gradient(circle, rgba(246, 232, 197, 0.46) 0 1px, transparent 1.8px),
    radial-gradient(circle, rgba(115, 215, 214, 0.22) 0 1px, transparent 1.8px);
  background-position: 0 0, 70px 30px;
  background-size: 180px 180px, 280px 280px;
  mask-image: none;
}

.globe-vignette {
  background:
    radial-gradient(circle at 50% 50%, transparent 50%, rgba(0, 0, 0, 0.12) 72%, rgba(0, 0, 0, 0.44) 100%),
    linear-gradient(180deg, rgba(255, 244, 204, 0.035), transparent 25%);
}

.discovery-strip {
  left: 30px;
  right: 30px;
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(16, 39, 37, 0.84), rgba(13, 28, 27, 0.38)),
    rgba(0, 0, 0, 0.1);
  box-shadow:
    inset 0 1px rgba(255, 244, 204, 0.08),
    0 14px 36px rgba(0, 0, 0, 0.18);
}

.story-preview-card {
  left: var(--preview-x, 44px);
  top: var(--preview-y, 132px);
  bottom: auto;
  width: min(360px, calc(100vw - 36px));
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  border-color: rgba(226, 190, 103, 0.4);
  background:
    radial-gradient(circle at 18% 18%, rgba(226, 190, 103, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(13, 31, 29, 0.9), rgba(5, 9, 8, 0.78));
  box-shadow:
    inset 0 1px rgba(255, 244, 204, 0.14),
    0 20px 54px rgba(0, 0, 0, 0.36);
  padding: 12px;
  transform: none;
}

.map-first-shell:not(.filters-open):not(.details-open) .story-preview-card {
  left: var(--preview-x, 44px);
  top: var(--preview-y, 132px);
  bottom: auto;
  width: min(360px, calc(100vw - 36px));
  grid-template-columns: 74px minmax(0, 1fr);
  background:
    radial-gradient(circle at 18% 18%, rgba(226, 190, 103, 0.12), transparent 34%),
    rgba(4, 10, 10, 0.68);
  backdrop-filter: blur(8px);
}

.map-first-shell:not(.filters-open):not(.details-open) .preview-media {
  height: 74px;
}

.map-first-shell:not(.filters-open):not(.details-open) .preview-copy p {
  display: block;
}

.map-first-shell:not(.filters-open):not(.details-open) .preview-copy h3 {
  margin: 2px 0 4px;
}

.story-preview-card.marker-hidden {
  opacity: 0.82;
}

.story-preview-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(226, 190, 103, 0.12);
  border-radius: 5px;
  pointer-events: none;
}

.preview-media {
  height: 74px;
}

.preview-copy p {
  max-width: 48rem;
  color: rgba(246, 232, 197, 0.82);
  font-size: 13px;
  line-height: 1.45;
}

.preview-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preview-actions .ghost-button {
  min-height: 34px;
  text-align: center;
}

.theme-rail {
  min-height: 40px;
  padding: 4px 4px 7px;
  border: 1px solid rgba(226, 190, 103, 0.14);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(5, 13, 13, 0.22), rgba(5, 13, 13, 0.42));
  backdrop-filter: blur(6px);
}

.theme-rail .chip {
  padding: 7px 12px;
  border-color: rgba(226, 190, 103, 0.26);
  background:
    linear-gradient(180deg, rgba(245, 226, 175, 0.055), rgba(38, 94, 88, 0.08)),
    rgba(4, 11, 11, 0.42);
  color: rgba(246, 232, 197, 0.78);
  box-shadow: none;
}

.theme-rail .chip.active {
  border-color: rgba(246, 215, 121, 0.66);
  color: #fff1c9;
  background:
    linear-gradient(180deg, rgba(246, 215, 121, 0.16), rgba(76, 162, 150, 0.12)),
    rgba(10, 25, 24, 0.72);
}

.globe-zoom-controls {
  border: 1px solid rgba(226, 190, 103, 0.2);
  background: rgba(5, 13, 13, 0.48);
  backdrop-filter: blur(8px);
}

.map-first-shell .globe-zoom-controls {
  top: 132px;
  left: 30px;
}

.primary-button {
  border-radius: 6px;
}

.card-panel {
  padding: 18px;
  overflow-y: auto;
  border-left-color: rgba(226, 190, 103, 0.22);
  box-shadow:
    inset 1px 0 rgba(255, 244, 204, 0.08),
    -24px 0 80px rgba(0, 0, 0, 0.28);
}

.map-first-shell .card-panel {
  width: min(720px, calc(100vw - 72px));
  max-width: none;
}

.legend-card {
  position: relative;
  min-height: 100%;
  border: 1px solid rgba(255, 214, 110, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 40% 0%, rgba(255, 214, 110, 0.11), transparent 38%),
    linear-gradient(180deg, rgba(115, 215, 214, 0.035), rgba(255, 214, 110, 0.04)),
    var(--panel-strong);
  padding: 22px;
  font-size: 17px;
}

.drawer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(226, 190, 103, 0.3);
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(245, 226, 175, 0.1), rgba(38, 94, 88, 0.08)),
    rgba(5, 14, 14, 0.58);
  color: rgba(246, 232, 197, 0.82);
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.drawer-close:hover,
.drawer-close:focus-visible {
  border-color: rgba(246, 215, 121, 0.62);
  color: #fff1c9;
  outline: none;
}

.legend-card::before {
  content: "Archive folio";
  display: block;
  margin: -2px 0 14px;
  color: rgba(246, 232, 197, 0.64);
  font-family: var(--font-heading);
  font-size: 13px;
  font-style: italic;
}

.legend-card h2::after {
  content: "";
  display: block;
  width: 84px;
  height: 1px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, rgba(234, 216, 170, 0.46), transparent);
}

.folio-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(234, 216, 170, 0.32), transparent);
}

.file-hero {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  align-items: center;
  justify-items: stretch;
  gap: 22px;
  margin: 4px 0 18px;
  padding: 18px;
  border: 1px solid rgba(226, 190, 103, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 16% 24%, rgba(244, 207, 122, 0.14), transparent 34%),
    linear-gradient(135deg, rgba(115, 215, 214, 0.08), rgba(255, 214, 110, 0.04));
}

.file-hero .sigil {
  margin: 0;
}

.file-hero-copy {
  min-width: 0;
  text-align: left;
}

.file-hero .card-topline {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px 14px;
  text-align: left;
}

.file-hero .legend-card h2,
.file-hero h2,
.file-hero .region {
  text-align: left;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-topline span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sigil {
  display: grid;
  width: 136px;
  height: 136px;
  margin: 26px auto 22px;
  place-items: center;
  border: 1px solid rgba(214, 177, 93, 0.32);
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 30%, rgba(255, 240, 189, 0.24), transparent 32%),
    radial-gradient(circle, rgba(214, 177, 93, 0.18), rgba(38, 117, 111, 0.2)),
    rgba(255, 255, 255, 0.03);
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.18),
    0 0 30px rgba(118, 203, 194, 0.08),
    0 16px 42px rgba(0, 0, 0, 0.22);
}

.legend-card h2 {
  font-family: var(--font-heading);
  font-size: clamp(42px, 4.2vw, 60px);
  line-height: 1.04;
  text-align: left;
}

.region {
  margin: 10px 0 18px;
  color: var(--muted);
  text-align: left;
}

.summary {
  margin: 0;
  color: #fff1c9;
  font-size: 22px;
  line-height: 1.45;
}

.danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0;
  border-top: 1px solid rgba(255, 214, 110, 0.14);
  border-bottom: 1px solid rgba(255, 214, 110, 0.14);
  padding: 14px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.danger-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 6px;
  border: 1px solid rgba(78, 45, 20, 0.2);
  border-radius: 50%;
}

.danger-dot.filled {
  border-color: rgba(242, 104, 104, 0.8);
  background: var(--danger);
  box-shadow: 0 0 14px rgba(242, 104, 104, 0.5);
}

.theme-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.theme-tags button {
  padding: 7px 9px;
  color: var(--aqua);
  font-size: 12px;
}

.story,
.source-note,
.related {
  color: var(--muted);
  line-height: 1.72;
}

.story {
  font-size: 19px;
}

.source-note {
  border-left: 2px solid rgba(225, 184, 90, 0.55);
  margin: 18px 0;
  padding-left: 12px;
  font-size: 13px;
}

.audit-strip,
.archive-badge-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: -4px 0 18px;
}

.audit-label,
.audit-pill,
.archive-badge {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.audit-label {
  color: rgba(239, 221, 167, 0.72);
}

.audit-pill,
.archive-badge {
  border: 1px solid rgba(115, 215, 214, 0.24);
  border-radius: 999px;
  padding: 5px 7px;
  background: rgba(115, 215, 214, 0.08);
  color: #b8f3ee;
}

.archive-badge-strip {
  margin-top: 12px;
  margin-bottom: 10px;
}

.archive-badge.source {
  border-color: rgba(226, 190, 103, 0.28);
  background: rgba(226, 190, 103, 0.1);
  color: #f2dfa7;
}

.archive-badge.scope {
  border-color: rgba(198, 223, 255, 0.24);
  background: rgba(198, 223, 255, 0.08);
  color: #d3e6ff;
}

.archive-badge.depth {
  border-color: rgba(126, 229, 158, 0.28);
  background: rgba(126, 229, 158, 0.08);
  color: #c9f7d4;
}

.audit-pill.status-source-checked {
  border-color: rgba(126, 229, 158, 0.34);
  background: rgba(126, 229, 158, 0.1);
  color: #c5f4ce;
}

.audit-pill.sensitive,
.audit-pill.priority {
  border-color: rgba(226, 190, 103, 0.36);
  background: rgba(226, 190, 103, 0.1);
  color: #f0d793;
}

.source-reference-plate {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 14px;
  margin: 16px 0 20px;
  border: 1px solid rgba(115, 215, 214, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(115, 215, 214, 0.1), rgba(226, 190, 103, 0.055)),
    rgba(6, 28, 25, 0.74);
  padding: 12px;
}

.source-plate-media {
  display: grid;
  aspect-ratio: 16 / 11;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(239, 221, 167, 0.2);
  border-radius: 6px;
  background: rgba(239, 221, 167, 0.055);
}

.source-plate-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.source-plate-placeholder {
  max-width: 72px;
  color: rgba(239, 221, 167, 0.62);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
}

.source-reference-plate figcaption {
  display: grid;
  align-content: center;
  gap: 5px;
}

.source-reference-plate span,
.source-reference-plate em {
  color: rgba(239, 221, 167, 0.68);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.source-reference-plate strong {
  color: var(--cream);
  font-family: var(--display);
  font-size: 17px;
  line-height: 1.05;
}

.source-reference-plate small {
  color: rgba(239, 221, 167, 0.78);
  font-size: 13px;
  line-height: 1.5;
}

.source-reference-plate em {
  margin-top: 3px;
  color: rgba(239, 221, 167, 0.54);
  letter-spacing: 0.08em;
}

.related span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.related p {
  margin: 6px 0 0;
}

.detail-illustration-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 18px;
}

.detail-illustration-tile {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(216, 180, 95, 0.28);
  border-radius: 8px;
  background:
    radial-gradient(circle at 22% 15%, rgba(255, 224, 146, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(115, 215, 214, 0.08), rgba(255, 214, 110, 0.045)),
    rgba(255, 255, 255, 0.035);
}

.detail-illustration-tile::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 241, 198, 0.08);
  content: "";
  pointer-events: none;
}

.detail-illustration-tile picture,
.detail-illustration-tile img {
  display: block;
  width: 100%;
}

.detail-illustration-tile img {
  aspect-ratio: 16 / 11;
  height: auto;
  object-fit: contain;
}

.detail-illustration-tile.plate {
  padding: 8px;
}

.detail-illustration-tile.plate img {
  filter: saturate(0.94) contrast(1.03);
  object-position: center;
}

.detail-illustration-placeholder {
  display: grid;
  aspect-ratio: 16 / 11;
  place-items: center;
  padding: 18px;
  color: rgba(239, 221, 167, 0.68);
  font-family: var(--display);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
}

.detail-illustration-tile figcaption {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  border-top: 1px solid rgba(216, 180, 95, 0.22);
  padding: 10px 2px 2px;
}

.detail-illustration-tile figcaption span {
  color: var(--gold);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-illustration-tile figcaption strong {
  color: var(--cream);
  font-family: var(--display);
  font-size: 18px;
  line-height: 1;
}

.detail-link {
  display: block;
  margin-top: 22px;
  border: 1px solid rgba(216, 180, 95, 0.42);
  border-radius: 6px;
  padding: 12px;
  color: var(--amber);
  text-align: center;
  text-decoration: none;
}

.muted-link {
  color: var(--muted);
  cursor: default;
}

.detail-page {
  width: min(760px, calc(100vw - 28px));
  margin: 28px auto;
  overflow-wrap: anywhere;
}

.detail-page .detail-link {
  margin-bottom: 14px;
}

.detail-page h1 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 54px;
  line-height: 1.02;
  text-align: center;
}

.detail-summary {
  font-size: 18px;
  line-height: 1.45;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.55fr);
  gap: 26px;
}

.detail-page p {
  line-height: 1.55;
}

.detail-page section,
.detail-page aside {
  min-width: 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag-row span {
  border: 1px solid rgba(216, 180, 95, 0.32);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-nav,
.detail-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 26px;
}

.detail-related {
  margin-top: 28px;
}

.detail-nav a,
.detail-link-grid a {
  min-width: 0;
  border: 1px solid rgba(216, 180, 95, 0.34);
  border-radius: 8px;
  padding: 12px;
  background: rgba(7, 18, 17, 0.48);
  color: var(--text);
  text-decoration: none;
}

.detail-nav a:hover,
.detail-link-grid a:hover {
  border-color: rgba(243, 204, 122, 0.7);
  background: rgba(28, 81, 79, 0.46);
}

.detail-nav span,
.detail-link-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-nav strong,
.detail-link-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--amber);
  overflow-wrap: anywhere;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(225, 184, 90, 0.25);
}

@media (max-width: 1160px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .map-first-shell {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
  }

  .map-first-shell .map-stage {
    height: 100vh;
    width: 100vw;
  }

  .map-first-shell .control-panel,
  .map-first-shell .card-panel {
    position: fixed;
    top: 96px;
    bottom: 12px;
  }

  .control-panel {
    grid-template-rows: auto auto auto;
  }

  .legend-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 260px;
  }

  .globe-stage {
    min-height: 620px;
  }
}

@media (max-width: 680px) {
  .detail-page {
    width: min(100% - 28px, 760px);
    margin: 28px 14px;
  }

  .detail-page h1 {
    font-size: 46px;
    text-align: left;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .detail-nav,
  .detail-link-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    padding: 0;
    overflow-x: hidden;
  }

  .map-first-shell {
    --mobile-edge-gap: 12px;
    --mobile-theme-rail-height: 50px;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
  }

  .map-first-shell .atlas-plaque {
    top: 10px;
    left: 10px;
    width: 158px;
    min-width: 0;
    padding: 7px 10px 8px;
    text-align: left;
    transform: none;
  }

  .map-first-shell:not(.filters-open):not(.details-open) .atlas-plaque {
    top: 10px;
    width: 158px;
    min-width: 0;
    padding: 7px 10px 8px;
  }

  .map-first-shell .atlas-plaque strong {
    display: block;
    overflow: hidden;
    font-size: 18px;
    letter-spacing: 0;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .map-first-shell .atlas-plaque span,
  .map-first-shell .atlas-plaque small {
    display: none;
  }

  .map-first-shell .atlas-plaque::before,
  .map-first-shell .atlas-plaque::after {
    display: none;
  }

  .map-first-shell .floating-controls {
    top: 10px;
    left: 176px;
    right: 10px;
    justify-content: flex-start;
    width: auto;
    overflow: hidden;
  }

  .compact-map-tools {
    gap: 3px;
    padding: 3px;
  }

  .compact-map-tools .ghost-button {
    min-width: 42px;
    min-height: 34px;
    padding: 6px 7px;
    font-size: 11px;
  }

  .compact-map-tools .mobile-random {
    display: none;
  }

  @media (max-width: 360px) {
    .map-first-shell .floating-controls {
      left: 168px;
    }
  }

  .control-panel,
  .card-panel,
  .map-stage {
    width: 100vw;
    max-width: 100vw;
  }

  .control-panel {
    padding: 16px;
    order: 3;
  }

  .map-stage {
    order: 1;
    padding: 0;
  }

  .map-first-shell .map-stage {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
  }

  .map-first-shell .control-panel,
  .map-first-shell .card-panel {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    width: auto;
    max-width: none;
    max-height: 72vh;
    transform: translateY(calc(100% + 18px));
  }

  .map-first-shell .control-panel.overlay-open,
  .map-first-shell .card-panel.overlay-open {
    transform: translateY(0);
  }

  .card-panel {
    order: 2;
  }

  .brand-block h1,
  .legend-card h2 {
    font-size: 34px;
  }

  .file-hero {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  .file-hero .sigil {
    width: 92px;
    height: 92px;
  }

  .detail-illustration-panel {
    grid-template-columns: 1fr;
  }

  .card-topline {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    font-size: 11px;
    letter-spacing: 0.08em;
  }

  .brand-block p {
    font-size: 16px;
    max-width: 310px;
  }

  .search-box input,
  .chip,
  .legend-row {
    max-width: 100%;
  }

  .map-header {
    display: none;
  }

  .map-first-shell .map-header div {
    display: none;
  }

  .map-first-shell .map-header .primary-button {
    display: none;
  }

  .map-first-shell .map-header .primary-button::after {
    content: "?";
    color: #f4dfa6;
    font-size: 18px;
    line-height: 1;
  }

  .quick-search {
    top: 62px;
    left: 12px;
    right: 12px;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .map-header h2 {
    font-size: 26px;
  }

  .discovery-strip {
    display: none;
  }

  .globe-stage {
    height: 100%;
    min-height: 0;
  }

  .map-first-shell .globe-zoom-controls {
    top: 112px;
    left: 12px;
  }

  .story-preview-card {
    left: 12px;
    right: 12px;
    bottom: 86px;
    grid-template-columns: 58px minmax(0, 1fr);
    width: auto;
    transform: none;
  }

  .map-first-shell:not(.filters-open):not(.details-open) .story-preview-card {
    left: 12px;
    right: 12px;
    bottom: 22px;
    width: auto;
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .map-first-shell:not(.filters-open):not(.details-open) .preview-media {
    height: 54px;
  }

  .map-first-shell:not(.filters-open):not(.details-open) .preview-actions {
    display: none;
  }

  .preview-media {
    height: 58px;
    font-size: 26px;
  }

  .preview-copy h3 {
    font-size: 20px;
  }

  .preview-copy p {
    display: none;
  }

  .preview-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .preview-actions .ghost-button {
    width: 100%;
    min-width: 0;
  }

  .theme-rail {
    left: var(--mobile-edge-gap);
    right: var(--mobile-edge-gap);
    bottom: var(--mobile-edge-gap);
    min-height: var(--mobile-theme-rail-height);
  }

  .clarity-hud .map-header {
    display: none;
  }

  .clarity-hud .discovery-strip {
    display: none;
  }

  .clarity-hud .story-preview-card {
    bottom: 86px;
  }

  .map-first-shell:not(.filters-open):not(.details-open).clarity-hud .story-preview-card,
  .map-first-shell:not(.filters-open):not(.details-open) .story-preview-card {
    bottom: calc(var(--mobile-edge-gap) + var(--mobile-theme-rail-height) + 14px);
  }

  .globe-label {
    left: 12px;
    bottom: 12px;
    padding: 10px 12px;
  }

  .compass-rose {
    display: none;
  }

  .legend-list {
    grid-template-columns: 1fr;
  }

}
