:root {
  color-scheme: dark;
  --bg: #050b12;
  --bg-2: #081522;
  --panel: rgba(9, 22, 33, 0.82);
  --panel-solid: #0d1a27;
  --panel-2: rgba(17, 37, 51, 0.88);
  --text: #f6ead4;
  --muted: #9dafbf;
  --subtle: #6e8191;
  --line: rgba(139, 171, 190, 0.22);
  --line-strong: rgba(224, 184, 91, 0.42);
  --gold: #e4b95d;
  --teal: #48d4cd;
  --blue: #78aeea;
  --violet: #a688ff;
  --danger: #dc786f;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 1180px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 8%, rgba(72, 212, 205, 0.15), transparent 28%),
    radial-gradient(circle at 18% 20%, rgba(228, 185, 93, 0.13), transparent 26%),
    linear-gradient(180deg, #07111c 0%, #050b12 56%, #04070d 100%);
  color: var(--text);
}

button, input, select { font: inherit; }

button {
  border: 1px solid var(--line);
  background: rgba(12, 27, 39, 0.88);
  color: var(--text);
  border-radius: 8px;
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

button:hover, button:focus-visible {
  border-color: var(--gold);
  outline: none;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--teal); }

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  padding: 4px;
}

.app-nav {
  position: sticky;
  top: 4px;
  height: calc(100vh - 8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 8px 0 0 8px;
  background: linear-gradient(180deg, rgba(9, 28, 43, 0.94), rgba(4, 13, 22, 0.96));
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  overflow: hidden;
  background: rgba(3, 10, 17, 0.72);
}

.nav-mark {
  width: 54px;
  height: 72px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-weight: 900;
  background: rgba(228, 185, 93, 0.08);
  margin-bottom: 8px;
}

.nav-mark img {
  width: 38px;
  height: 58px;
  object-fit: contain;
  display: block;
}

.nav-button {
  width: 76px;
  min-height: 58px;
  padding: 8px 4px;
  display: grid;
  place-items: center;
  gap: 4px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  font-size: 12px;
}

.nav-button svg {
  width: 24px;
  height: 24px;
}

.nav-button.active {
  color: var(--gold);
  border-color: rgba(228, 185, 93, 0.28);
  background: rgba(72, 212, 205, 0.08);
}

.reference-drawer {
  margin-top: auto;
  width: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  text-transform: uppercase;
}

.reference-drawer strong {
  color: var(--gold);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 12px 22px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(4, 12, 20, 0.76), rgba(4, 12, 20, 0.96));
}

.hero-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.9;
  background-image:
    linear-gradient(90deg, rgba(4, 12, 20, 0.98) 0%, rgba(4, 12, 20, 0.78) 34%, rgba(4, 12, 20, 0.36) 68%, rgba(4, 12, 20, 0.82) 100%),
    linear-gradient(180deg, rgba(4, 12, 20, 0.08), rgba(4, 12, 20, 0.88)),
    radial-gradient(circle at 82% 24%, rgba(72, 212, 205, 0.28) 0 1px, transparent 2px),
    radial-gradient(circle at 68% 70%, rgba(228, 185, 93, 0.22) 0 1px, transparent 2px),
    radial-gradient(ellipse at 82% 44%, rgba(67, 108, 147, 0.28), transparent 42%);
  background-size: cover, cover, 54px 54px, 76px 76px, cover;
  background-position: center, center, 0 0, 18px 24px, center;
  background-repeat: no-repeat, no-repeat, repeat, repeat, no-repeat;
}

.topline,
.hero-center,
.overview-grid,
.category-tiles,
.lens-tiles,
.compendium {
  position: relative;
  z-index: 1;
}

.topline {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 44px;
}

.brand-lockup {
  display: grid;
  justify-items: center;
  min-width: 0;
  padding-left: 120px;
}

.brand-kicker {
  color: var(--gold);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 54px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
}

h1 small {
  display: block;
  margin-top: 8px;
  color: rgba(246, 234, 212, 0.82);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.36em;
}

#buildMeta,
.hero-copy,
.results-toolbar p,
.detail-empty p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: start;
}

.actions button {
  color: var(--muted);
  background: rgba(13, 27, 38, 0.72);
}

.hero-center {
  max-width: 820px;
  margin: 8px auto 10px;
  text-align: center;
}

.hero-copy {
  display: none;
  max-width: 720px;
  margin: 0 auto 14px;
}

.global-search {
  height: 48px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  background: rgba(7, 18, 28, 0.82);
  border: 1px solid rgba(139, 171, 190, 0.38);
  border-radius: 8px;
  padding: 0 8px 0 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.global-search label {
  color: var(--gold);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
}

.global-search input {
  width: 100%;
  height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.global-search input::placeholder { color: #778896; }

.icon-button {
  width: 38px;
  padding: 0;
  font-weight: 900;
  text-transform: uppercase;
}

.category-tile,
.browse-rail,
.results-pane,
.detail-pane {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.category-tiles {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.category-tile {
  min-height: 72px;
  padding: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.category-tile::before,
.result-card::before,
.detail-section::before,
.profile-hero::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid transparent;
  border-image: linear-gradient(135deg, rgba(228, 185, 93, 0.42), transparent 28%, transparent 72%, rgba(72, 212, 205, 0.28)) 1;
  pointer-events: none;
  opacity: 0.55;
}

.category-tile svg {
  width: 27px;
  height: 27px;
  color: var(--gold);
  margin-bottom: 6px;
}

.category-tile span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 820;
  text-transform: uppercase;
}

.category-tile strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1;
}

.category-tile.active {
  border-color: var(--gold);
  background: linear-gradient(145deg, rgba(228, 185, 93, 0.16), rgba(72, 212, 205, 0.08));
}

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

.lens-tile {
  min-height: 60px;
  display: grid;
  gap: 4px;
  align-content: center;
  text-align: left;
  padding: 10px 12px;
  border-color: rgba(139, 171, 190, 0.2);
  background: rgba(6, 18, 29, 0.72);
}

.lens-tile span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 840;
}

.lens-tile small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.lens-tile.active {
  border-color: rgba(72, 212, 205, 0.55);
  background: linear-gradient(145deg, rgba(72, 212, 205, 0.14), rgba(228, 185, 93, 0.07));
}

.compendium {
  flex: 1;
  display: grid;
  grid-template-columns: 212px minmax(440px, 1fr) 440px;
  gap: 12px;
  padding: 12px 20px 18px;
  min-height: 0;
}

.compendium.source-archive-mode {
  grid-template-columns: 212px minmax(0, 1fr);
}

.compendium.search-mode {
  grid-template-columns: 212px minmax(0, 1fr);
}

.browse-rail,
.results-pane,
.detail-pane {
  border-radius: 8px;
  max-height: calc(100vh - 340px);
  min-height: 500px;
  overflow: auto;
}

.browse-rail {
  padding: 14px;
}

.rail-section h2,
.filter-header h2,
.results-toolbar h2,
.detail-section h3 {
  font-size: 14px;
  font-weight: 820;
  letter-spacing: 0;
}

.rail-link {
  width: 100%;
  margin-top: 8px;
  justify-content: flex-start;
  text-align: left;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.rail-link.active {
  color: var(--gold);
  border-color: rgba(228, 185, 93, 0.34);
  background: rgba(228, 185, 93, 0.08);
}

.lore-view-picker {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.lore-view-picker label {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.lore-view-picker p {
  margin-top: 9px;
  color: var(--subtle);
  font-size: 11px;
  line-height: 1.45;
}

.research-tools {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.research-tools summary {
  cursor: pointer;
  color: var(--teal);
  font-size: 13px;
  font-weight: 760;
}

.filter-header,
.results-toolbar,
.result-title,
.entity-card-head,
.profile-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.research-tools label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 12px;
}

select {
  width: 100%;
  height: 34px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
  color: var(--text);
}

.toggle-list {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.toggle-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.facet-cloud,
.active-filters,
.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.facet-cloud { margin-top: 14px; }

.facet-chip,
.active-chip,
.badge,
.type-pill,
.review-pill,
.lore-layer-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.entity-card-head > span,
.result-title > span,
.profile-hero .lore-layer-pill + .type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-hero .type-pill,
.profile-hero .lore-layer-pill {
  margin-right: 6px;
}

.facet-chip.active,
.active-chip,
.type-pill {
  color: var(--gold);
  border-color: rgba(228, 185, 93, 0.46);
  background: rgba(228, 185, 93, 0.08);
}

.lore-layer-pill.official-lore {
  color: var(--teal);
  border-color: rgba(72, 212, 205, 0.48);
  background: rgba(72, 212, 205, 0.08);
}

.lore-layer-pill.gameplay-lore {
  color: var(--blue);
  border-color: rgba(120, 174, 234, 0.48);
  background: rgba(120, 174, 234, 0.08);
}

.lore-layer-pill.player-lore {
  color: var(--violet);
  border-color: rgba(166, 136, 255, 0.48);
  background: rgba(166, 136, 255, 0.08);
}

.entity-source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-right: 6px;
  padding: 0 7px;
  border: 1px solid rgba(99, 220, 195, 0.48);
  border-radius: 999px;
  color: #9af0d8;
  background: rgba(39, 121, 107, 0.18);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.review-pill,
.badge.resolved {
  color: #bfe3a7;
  border-color: rgba(148, 214, 135, 0.42);
}

.badge.loading { color: var(--teal); border-color: rgba(72, 212, 205, 0.42); }
.badge.website { color: var(--blue); border-color: rgba(120, 174, 234, 0.42); }
.badge.conflict { color: var(--danger); border-color: rgba(220, 120, 111, 0.48); }
.badge.galactopedia {
  color: #8ee8ff;
  border-color: rgba(76, 209, 232, 0.54);
  background: rgba(76, 209, 232, 0.1);
}

.badge.terminal {
  color: #f4cc6b;
  border-color: rgba(244, 204, 107, 0.56);
  background: rgba(244, 204, 107, 0.11);
}

.results-toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 16px 18px;
  background: rgba(9, 22, 33, 0.96);
  border-bottom: 1px solid var(--line);
}

.section-label {
  color: var(--gold);
  font-size: 11px !important;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.results {
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.results > article,
.full-detail-card > .detail-section,
.full-detail-card > details.detail-section {
  content-visibility: auto;
  contain-intrinsic-block-size: 180px;
}

.pagination {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  background: rgba(6, 18, 28, 0.96);
  box-shadow: 0 -18px 32px rgba(4, 12, 20, 0.5);
  backdrop-filter: blur(8px);
}

.pagination.hidden {
  display: none;
}

.pagination-summary {
  color: var(--muted);
  font-size: 12px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.page-button,
.pagination-ellipsis {
  min-width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(12, 30, 44, 0.78);
  font-size: 12px;
  font-weight: 750;
}

.page-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.page-step {
  gap: 6px;
  padding: 0 10px;
}

.page-button {
  cursor: pointer;
}

.page-button:hover:not(:disabled),
.page-button.active {
  color: var(--gold);
  border-color: rgba(228, 185, 93, 0.5);
  background: rgba(228, 185, 93, 0.09);
}

.page-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.pagination-ellipsis {
  border-color: transparent;
  background: transparent;
}

.entity-results {
  grid-template-columns: 1fr;
}

.source-archive-results {
  gap: 14px;
}

.search-results {
  grid-template-columns: 1fr;
}

.result-card {
  position: relative;
  width: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr) 44px;
  gap: 14px;
  align-items: stretch;
  text-align: left;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 25, 37, 0.78);
}

.result-card:hover {
  background: rgba(15, 35, 49, 0.88);
}

.result-card.selected {
  border-color: var(--gold);
  box-shadow: inset 4px 0 0 var(--gold), 0 16px 38px rgba(0, 0, 0, 0.18);
}

.entity-card {
  cursor: pointer;
}

.entity-card-open {
  all: unset;
  color: inherit;
  cursor: pointer;
}

.entity-card-open:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.source-search-card {
  min-height: 118px;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 14px 16px;
  cursor: default;
}

.source-search-card header,
.source-search-card footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.source-search-card header strong {
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0;
}

.source-search-card p {
  max-width: 102ch;
  color: #d9e0e6;
  font-size: 14px;
  line-height: 1.55;
}

.source-search-card footer {
  color: var(--subtle);
  font-size: 12px;
}

.terminal-search-card {
  border-color: rgba(244, 204, 107, 0.28);
  background:
    linear-gradient(180deg, rgba(244, 204, 107, 0.08), transparent 52%),
    repeating-linear-gradient(0deg, rgba(244, 204, 107, 0.025), rgba(244, 204, 107, 0.025) 1px, transparent 1px, transparent 7px),
    rgba(11, 15, 18, 0.82);
}

.terminal-search-card p {
  color: #f7df9e;
  font-family: "Courier New", monospace;
}

.galactopedia-search-card {
  border-color: rgba(76, 209, 232, 0.28);
  background:
    radial-gradient(circle at 12% 0%, rgba(76, 209, 232, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(76, 209, 232, 0.07), transparent 42%),
    rgba(4, 18, 28, 0.72);
}

.signal-search-card {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  border-color: rgba(255, 113, 91, 0.36);
  background:
    linear-gradient(90deg, rgba(255, 113, 91, 0.12), transparent 42%),
    repeating-linear-gradient(135deg, rgba(255, 210, 111, 0.035), rgba(255, 210, 111, 0.035) 1px, transparent 1px, transparent 9px),
    rgba(18, 10, 14, 0.82);
}

.signal-search-card p {
  color: #ffd8c9;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 17px;
}

.source-archive-card {
  position: relative;
  text-align: left;
}

.source-archive-card::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid transparent;
  border-image: linear-gradient(135deg, rgba(228, 185, 93, 0.36), transparent 30%, transparent 72%, rgba(72, 212, 205, 0.22)) 1;
  pointer-events: none;
  opacity: 0.5;
}

.source-archive-card p {
  max-width: 108ch;
}

.corrupted-signal-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 94px;
  padding: 22px 26px;
  border-color: rgba(255, 113, 91, 0.36);
  background:
    linear-gradient(90deg, rgba(255, 113, 91, 0.12), transparent 42%),
    repeating-linear-gradient(135deg, rgba(255, 210, 111, 0.035), rgba(255, 210, 111, 0.035) 1px, transparent 1px, transparent 9px),
    rgba(18, 10, 14, 0.82);
  box-shadow:
    inset 0 0 34px rgba(255, 113, 91, 0.06),
    0 0 0 1px rgba(255, 210, 111, 0.04);
}

.corrupted-signal-entry::before {
  border-image: linear-gradient(135deg, rgba(255, 210, 111, 0.7), transparent 26%, transparent 68%, rgba(255, 113, 91, 0.58)) 1;
  opacity: 0.84;
}

.signal-warning {
  width: 34px;
  height: 34px;
  position: relative;
  z-index: 1;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 210, 111, 0.62);
  border-radius: 50%;
  color: #ffd26f;
  background: rgba(255, 113, 91, 0.12);
  font-weight: 900;
  box-shadow: 0 0 18px rgba(255, 113, 91, 0.12);
}

.corrupted-signal-entry p {
  margin: 0;
  color: #ffd8c9;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.45;
}

.source-archive-card footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.entity-card h3 {
  font-size: 18px;
  line-height: 1.15;
  font-weight: 820;
}

.entry-main {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 8px 0;
}

.entry-thumb,
.profile-art {
  background: linear-gradient(145deg, rgba(16, 38, 52, 0.96), rgba(6, 15, 24, 0.98));
  border: 1px solid rgba(139, 171, 190, 0.24);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.22);
}

.entry-thumb {
  height: 108px;
  border-radius: 8px;
}

.entry-thumb.has-media,
.profile-art.has-media {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
  background: #02070b;
}

.entity-art-fallback {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 14px;
  text-align: center;
}

.entity-art-fallback::before {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: -1;
  border: 1px solid rgba(228, 185, 93, 0.2);
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 42%),
    radial-gradient(circle at 75% 24%, var(--entity-placeholder-glow, rgba(72, 212, 205, 0.12)), transparent 42%);
}

.entity-fallback-name {
  max-width: 100%;
  color: var(--text);
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.12;
  overflow-wrap: anywhere;
  text-wrap: balance;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.7);
}

.profile-art .entity-fallback-name {
  font-size: clamp(24px, 4vw, 48px);
}

.entity-placeholder-people { --entity-placeholder-glow: rgba(120, 183, 255, 0.18); }
.entity-placeholder-locations { --entity-placeholder-glow: rgba(179, 139, 255, 0.18); }
.entity-placeholder-factions { --entity-placeholder-glow: rgba(237, 195, 91, 0.16); }
.entity-placeholder-species { --entity-placeholder-glow: rgba(85, 223, 199, 0.17); }
.entity-placeholder-concepts { --entity-placeholder-glow: rgba(157, 221, 114, 0.16); }

.entry-thumb.has-media.media-count-2,
.profile-art.has-media.media-count-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.entry-thumb.has-media img,
.profile-art.has-media img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  object-fit: cover;
}

.player-story-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.player-contribution-list {
  display: grid;
  gap: 18px;
}

.player-contribution {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(166, 136, 255, 0.28);
  border-radius: 10px;
  background: rgba(8, 15, 24, 0.72);
}

.player-contribution-header {
  padding: 16px clamp(16px, 3vw, 28px);
  border-bottom: 1px solid rgba(166, 136, 255, 0.18);
  background: rgba(166, 136, 255, 0.06);
}

.player-contribution-header h4 {
  margin: 0;
  color: var(--text);
  font-family: "Georgia", "Times New Roman", serif;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.2;
}

.player-contribution-blocks {
  display: grid;
  gap: 18px;
  padding: clamp(16px, 3vw, 28px);
}

.player-contribution-prose {
  width: min(100%, 76ch);
  margin-inline: auto;
  color: var(--text);
}

.player-contribution-prose p {
  margin: 0;
  line-height: 1.7;
}

.player-contribution-prose p + p {
  margin-top: 14px;
}

.player-contribution-media {
  width: min(100%, 780px);
  margin: 0 auto;
}

.player-contribution-media .player-gallery-button {
  min-height: 0;
  padding: 8px;
}

.player-contribution-media img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
}

.player-lore-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
}

.player-lore-gallery figure {
  min-width: 0;
  margin: 0;
}

.player-gallery-button {
  width: 100%;
  min-height: 150px;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(166, 136, 255, 0.3);
  border-radius: 8px;
  background: rgba(10, 16, 25, 0.88);
}

.player-gallery-button:hover,
.player-gallery-button:focus-visible {
  border-color: rgba(166, 136, 255, 0.72);
  box-shadow: 0 0 0 2px rgba(166, 136, 255, 0.16);
}

.player-lore-gallery img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: clamp(240px, 48vh, 560px);
  object-fit: contain;
}

.player-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 12px;
}

.player-video-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(166, 136, 255, 0.3);
  border-radius: 8px;
  background: rgba(10, 16, 25, 0.88);
}

.player-video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #02060a;
}

.player-video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.player-video-copy {
  padding: 12px;
  display: grid;
  gap: 6px;
}

.player-video-copy h4 {
  color: var(--text);
  font-size: 14px;
}

.player-video-copy p {
  color: var(--muted);
  font-size: 12px;
}

.player-video-copy a {
  width: fit-content;
  color: #c9b8ff;
}

.profile-art.has-media img { min-height: 238px; }
.profile-art::after { z-index: 1; }

.alias-line,
.entity-summary,
.entity-note,
.result-text,
.detail-section p,
.detail-section li,
.story-context p {
  color: #d9e0e6;
  font-size: 14px;
  line-height: 1.52;
}

.entity-summary { color: #c8d5dc; }

.detail-section.signal-line p {
  margin: 0;
  color: var(--text);
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.5;
}

.entity-summary,
.entity-note {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entity-summary { -webkit-line-clamp: 3; }

.entity-note {
  -webkit-line-clamp: 2;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.readable-bullets,
.profile-facts,
.claim-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
}

.readable-bullets li,
.profile-facts li,
.claim-list li {
  color: #d2dde4;
  font-size: 13px;
  line-height: 1.45;
}

.profile-facts span,
.claim-list span,
.story-source,
.result-meta {
  color: var(--subtle);
  font-size: 12px;
}

.citation {
  display: inline-flex;
  align-items: center;
  max-width: min(100%, 320px);
  color: var(--subtle);
  border: 1px solid rgba(172, 188, 199, 0.22);
  background: rgba(180, 194, 205, 0.08);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 7px;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.5;
  vertical-align: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-empty,
.detail-card {
  padding: 18px;
}

.detail-empty { color: var(--muted); }
.hidden { display: none; }

.detail-card {
  display: grid;
  gap: 14px;
}

.profile-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  align-items: end;
  min-height: 238px;
  padding: 0;
  border: 1px solid rgba(228, 185, 93, 0.26);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(8, 18, 29, 0.94);
}

.profile-art {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  opacity: 0.82;
}

.profile-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 11, 18, 0.08), rgba(4, 11, 18, 0.72) 58%, rgba(4, 11, 18, 0.96));
}

.profile-hero > div:not(.profile-art) {
  position: relative;
  z-index: 1;
}

.profile-hero > div:not(.profile-art) {
  padding: 96px 18px 18px;
}

.profile-hero h2 {
  margin-top: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 600;
  line-height: 1.05;
}

.profile-hero p {
  max-width: 620px;
  margin-top: 10px;
  color: #d6e2e8;
  font-size: 14px;
  line-height: 1.55;
}

.detail-section {
  position: relative;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 20, 31, 0.72);
  display: grid;
  gap: 10px;
}

.dossier-action,
.dossier-close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin-top: 14px;
  color: var(--gold);
  border-color: rgba(228, 185, 93, 0.38);
  background: rgba(228, 185, 93, 0.09);
}

.dossier-close.secondary {
  color: #d7e4ea;
  border-color: rgba(172, 188, 199, 0.28);
  background: rgba(172, 188, 199, 0.08);
}

.dossier-action svg,
.dossier-close svg {
  width: 18px;
  height: 18px;
}

.full-profile {
  position: fixed;
  inset: 0;
  z-index: 80;
  padding: 22px;
  overflow: auto;
  background:
    radial-gradient(circle at 74% 12%, rgba(72, 212, 205, 0.16), transparent 30%),
    linear-gradient(180deg, rgba(3, 8, 14, 0.96), rgba(4, 12, 20, 0.98));
}

.full-profile-shell {
  max-width: 1360px;
  min-height: calc(100vh - 44px);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 15, 24, 0.88);
  box-shadow: var(--shadow);
}

.full-profile-topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 17, 27, 0.96);
  backdrop-filter: blur(18px);
}

.dossier-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.dossier-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--subtle);
  font-size: 12px;
}

.dossier-breadcrumbs button {
  max-width: 180px;
  min-height: 26px;
  padding: 3px 8px;
  color: #cbd8df;
  border: 1px solid rgba(172, 188, 199, 0.18);
  background: rgba(172, 188, 199, 0.06);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dossier-breadcrumbs button[aria-current="page"] {
  color: var(--gold);
  border-color: rgba(228, 185, 93, 0.34);
  background: rgba(228, 185, 93, 0.08);
}

.crumb-separator {
  color: rgba(214, 226, 232, 0.42);
}

.full-profile-topbar h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 600;
}

.full-detail-card {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.58fr);
  align-items: start;
  padding: 18px;
}

.full-detail-card .profile-hero,
.full-detail-card .sources-fold,
.full-detail-card > .detail-section,
.full-detail-card > details.detail-section {
  grid-column: 1 / -1;
}

.expanded-profile-hero {
  min-height: 420px;
}

.expanded-profile-hero h2 {
  font-size: 54px;
}

.player-lore-profile-hero {
  grid-template-columns: minmax(220px, 38%) minmax(0, 1fr);
  align-items: stretch;
  min-height: 0;
}

.player-lore-profile-hero.is-portrait-art,
.player-lore-profile-hero.is-square-art {
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
}

.player-lore-profile-hero .profile-art {
  position: relative;
  inset: auto;
  min-height: 260px;
  max-height: 360px;
  opacity: 1;
  background: rgba(3, 9, 15, 0.96);
}

.player-lore-profile-hero .profile-art::after {
  display: none;
}

.player-lore-profile-hero .profile-art.has-media img {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 360px;
  object-fit: contain;
}

.player-lore-profile-hero > div:not(.profile-art) {
  padding: 24px;
  align-self: center;
}

.player-lore-profile-hero.expanded-profile-hero {
  min-height: 0;
}

.player-lore-profile-hero.expanded-profile-hero h2 {
  font-size: clamp(36px, 4vw, 46px);
}

.hero-media-action {
  width: fit-content;
  min-height: 34px;
  margin-top: 12px;
  padding: 0 12px;
  color: #c9b8ff;
  border-color: rgba(166, 136, 255, 0.38);
  background: rgba(166, 136, 255, 0.08);
}

.player-media-dialog {
  width: min(1180px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(166, 136, 255, 0.5);
  border-radius: 10px;
  color: var(--text);
  background: rgba(4, 11, 18, 0.98);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.7);
}

.player-media-dialog::backdrop {
  background: rgba(0, 3, 8, 0.82);
  backdrop-filter: blur(5px);
}

.player-media-dialog-shell {
  position: relative;
  max-height: calc(100vh - 34px);
  padding: 46px 16px 16px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
}

.player-media-dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  min-height: 32px;
  color: var(--gold);
  border-color: rgba(228, 185, 93, 0.38);
  background: rgba(6, 17, 27, 0.9);
}

.player-media-dialog img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 130px);
  margin: auto;
  object-fit: contain;
}

.player-media-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

body.dossier-open {
  overflow: hidden;
}

.detail-section.compact {
  padding: 13px 15px;
}

.dossier-primary-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: start;
}

.detail-card:not(.full-detail-card) .dossier-primary-grid {
  grid-template-columns: 1fr;
}

.detail-section.reviewed {
  border-color: rgba(148, 214, 135, 0.38);
  background: rgba(30, 61, 45, 0.28);
}

.reader-note {
  border-color: rgba(228, 185, 93, 0.34);
  background:
    linear-gradient(135deg, rgba(228, 185, 93, 0.12), transparent 46%),
    rgba(13, 25, 35, 0.8);
}

.reader-note p {
  font-size: 15px;
  line-height: 1.65;
}

.context-block {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(228, 185, 93, 0.18);
  display: grid;
  gap: 8px;
}

.context-block h4 {
  margin: 0;
  color: var(--gold);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.analysis-note {
  color: #e6c982;
  border-top: 1px solid rgba(228, 185, 93, 0.22);
  padding-top: 10px;
}

.lore-link {
  color: #8eece6;
  border-bottom: 1px solid rgba(142, 236, 230, 0.42);
  cursor: pointer;
  text-decoration: none;
  text-underline-offset: 3px;
}

.lore-link:hover,
.lore-link:focus-visible {
  color: #f5d58b;
  border-bottom-color: rgba(245, 213, 139, 0.72);
  outline: none;
}

.why-section {
  border-color: rgba(72, 212, 205, 0.3);
}

.org-section {
  border-color: rgba(122, 166, 255, 0.28);
  background:
    linear-gradient(135deg, rgba(122, 166, 255, 0.11), transparent 44%),
    rgba(9, 21, 34, 0.78);
}

.connection-section {
  grid-column: 1 / -1;
  border-color: rgba(72, 212, 205, 0.24);
}

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

.connection-card {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(133, 166, 192, 0.2);
  border-radius: 8px;
  background: rgba(4, 14, 24, 0.54);
}

.connection-card strong {
  color: #f2d28b;
  font-size: 14px;
}

.relationship-link {
  width: fit-content;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(72, 212, 205, 0.38);
  border-radius: 0;
  color: #a9eeea;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.relationship-link:hover,
.relationship-link:focus-visible {
  color: #f5d58b;
  border-bottom-color: rgba(245, 213, 139, 0.72);
  outline: none;
}

.terminal-section {
  grid-column: 1 / -1;
  border-color: rgba(244, 204, 107, 0.3);
  background:
    linear-gradient(180deg, rgba(244, 204, 107, 0.08), transparent 44%),
    repeating-linear-gradient(0deg, rgba(244, 204, 107, 0.035), rgba(244, 204, 107, 0.035) 1px, transparent 1px, transparent 7px),
    rgba(11, 15, 18, 0.86);
  box-shadow: inset 0 0 34px rgba(244, 204, 107, 0.05);
}

.terminal-entry-list {
  display: grid;
  gap: 12px;
}

.terminal-entry {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(244, 204, 107, 0.25);
  border-radius: 8px;
  background: rgba(13, 16, 18, 0.72);
  box-shadow: inset 0 0 20px rgba(244, 204, 107, 0.05);
}

.terminal-entry header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.terminal-entry header strong {
  color: #f4cc6b;
  font-family: "Courier New", monospace;
  font-size: 12px;
  text-transform: uppercase;
}

.terminal-entry p {
  max-width: 78ch;
  color: #f7df9e;
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.65;
}

.galactopedia-section {
  grid-column: 1 / -1;
  border-color: rgba(76, 209, 232, 0.28);
  background:
    radial-gradient(circle at 18% 0%, rgba(76, 209, 232, 0.14), transparent 34%),
    linear-gradient(135deg, rgba(76, 209, 232, 0.08), transparent 42%),
    rgba(6, 21, 31, 0.8);
  box-shadow: inset 0 0 36px rgba(76, 209, 232, 0.05);
}

.galactopedia-entry-list {
  display: grid;
  gap: 12px;
}

.galactopedia-entry {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(76, 209, 232, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(76, 209, 232, 0.07), transparent 52%),
    rgba(4, 18, 28, 0.62);
}

.galactopedia-entry header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.galactopedia-entry header strong {
  color: #8ee8ff;
  font-size: 12px;
  text-transform: uppercase;
}

.galactopedia-entry p {
  max-width: 78ch;
}

.source-archive-results .terminal-entry p,
.source-archive-results .galactopedia-entry p {
  max-width: 108ch;
}

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

.org-grid div,
.org-list article,
.thread-list article {
  padding: 12px;
  border: 1px solid rgba(133, 166, 192, 0.2);
  border-radius: 8px;
  background: rgba(4, 14, 24, 0.54);
}

.org-grid dt,
.org-list em {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.org-grid dd {
  margin-top: 5px;
  color: var(--text);
  line-height: 1.55;
}

.org-list,
.thread-list {
  display: grid;
  gap: 10px;
}

.org-list article,
.thread-list article {
  display: grid;
  gap: 5px;
}

.org-list strong,
.thread-list strong {
  color: #f2d28b;
  font-size: 14px;
}

.org-list span,
.thread-list p {
  margin: 0;
  color: var(--text);
}

.evidence-drawer {
  padding: 0;
  gap: 0;
}

.evidence-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 15px;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.evidence-drawer summary::-webkit-details-marker {
  display: none;
}

.evidence-drawer summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(228, 185, 93, 0.28);
  border-radius: 50%;
  color: var(--gold);
}

.evidence-drawer[open] summary::after {
  content: "-";
}

.evidence-drawer summary span {
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
}

.evidence-drawer summary small {
  margin-left: auto;
  color: var(--subtle);
  font-size: 12px;
  text-align: right;
}

.evidence-group {
  display: grid;
  gap: 10px;
  padding: 0 15px 15px;
}

.evidence-group + .evidence-group {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 0;
}

.profile-grid div {
  min-width: 0;
}

.profile-grid dt {
  color: var(--subtle);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
}

.profile-grid dd {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.story-contexts {
  display: grid;
  gap: 10px;
}

.story-context {
  border-left: 3px solid rgba(72, 212, 205, 0.52);
  padding-left: 11px;
}

.context-window {
  margin-top: 7px;
  color: var(--subtle);
  font-size: 12px;
  line-height: 1.45;
}

.timeline-list {
  display: grid;
  gap: 8px;
}

.timeline-list article {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 10px;
  align-items: start;
}

.timeline-list article > span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.sources-fold p {
  color: var(--subtle);
  overflow-wrap: anywhere;
}

.reference-source-list p {
  color: var(--subtle);
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1220px) {
  body { min-width: 820px; }
  .overview-grid { grid-template-columns: repeat(3, 1fr); }
  .category-tiles { grid-template-columns: repeat(4, 1fr); }
  .lens-tiles { grid-template-columns: repeat(3, 1fr); }
  .compendium { grid-template-columns: 220px minmax(420px, 1fr); }
  .compendium.source-archive-mode { grid-template-columns: 220px minmax(0, 1fr); }
  .compendium.search-mode { grid-template-columns: 220px minmax(0, 1fr); }
  .detail-pane {
    grid-column: 1 / -1;
    max-height: none;
    min-height: 420px;
  }
}

@media (max-width: 760px) {
  body { min-width: 0; }
  .app-shell {
    grid-template-columns: 72px minmax(0, 1fr);
    padding: 2px;
  }
  .app-nav {
    top: 2px;
    height: calc(100vh - 4px);
    gap: 8px;
    padding: 10px 4px;
  }
  .nav-mark {
    width: 46px;
    height: 62px;
  }
  .nav-mark img {
    width: 32px;
    height: 50px;
  }
  .nav-button {
    width: 60px;
    min-height: 54px;
    font-size: 11px;
  }
  .hero { padding: 12px; }
  .topline {
    display: block;
    min-height: 0;
  }
  .brand-lockup {
    justify-items: center;
    padding-left: 0;
    text-align: center;
  }
  .actions { display: none; }
  h1 { font-size: 24px; }
  .overview-grid { grid-template-columns: repeat(2, 1fr); }
  #sourceCanvas { grid-column: 1 / -1; }
  .category-tiles { grid-template-columns: 1fr 1fr; }
  .lens-tiles { grid-template-columns: 1fr; }
  .compendium {
    grid-template-columns: 1fr;
    padding: 10px;
  }
  .compendium.source-archive-mode { grid-template-columns: 1fr; }
  .compendium.search-mode { grid-template-columns: 1fr; }
  .browse-rail,
  .results-pane,
  .detail-pane {
    max-height: none;
    min-height: 0;
  }
  .pagination {
    align-items: flex-start;
    flex-direction: column;
  }
  .pagination-controls {
    justify-content: flex-start;
  }
  .profile-grid,
  .org-grid,
  .connection-grid,
  .dossier-primary-grid { grid-template-columns: 1fr; }
  .full-profile { padding: 10px; }
  .full-profile-shell { min-height: calc(100vh - 20px); }
  .full-profile-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }
  .dossier-topbar-actions {
    justify-content: flex-start;
    width: 100%;
  }
  .dossier-close span { white-space: nowrap; }
  .full-detail-card {
    grid-template-columns: minmax(0, 1fr);
    padding: 10px;
  }
  .expanded-profile-hero h2 { font-size: 42px; }
  .profile-hero { flex-direction: column; }
  .player-lore-profile-hero,
  .player-lore-profile-hero.is-portrait-art,
  .player-lore-profile-hero.is-square-art { grid-template-columns: 1fr; }
  .player-lore-profile-hero .profile-art { min-height: 0; max-height: 300px; }
  .player-lore-profile-hero .profile-art.has-media img { height: auto; max-height: 300px; }
  .player-lore-profile-hero > div:not(.profile-art) { padding: 18px; }
}

@media (max-width: 480px) {
  .global-search {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding-left: 12px;
  }
  .global-search label { display: none; }
}

/* Constellation Map */

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

.mobile-only { display: none; }

body.constellation-open {
  overflow: hidden;
}

.constellation-map {
  position: fixed;
  inset: 4px 4px 4px 96px;
  z-index: 70;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(112, 174, 201, 0.32);
  border-radius: 0 8px 8px 0;
  background: #030a11;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.34);
}

.constellation-map.hidden { display: none; }

.constellation-topbar {
  position: relative;
  z-index: 12;
  display: grid;
  grid-template-columns: 310px minmax(260px, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(112, 174, 201, 0.25);
  background: rgba(5, 16, 25, 0.97);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.constellation-heading {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
}

.constellation-heading > div {
  min-width: 0;
  overflow: hidden;
}

.constellation-emblem {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(75, 213, 204, 0.42);
  border-radius: 50%;
  color: var(--teal);
  background: rgba(28, 106, 112, 0.13);
  box-shadow: inset 0 0 18px rgba(72, 212, 205, 0.12), 0 0 20px rgba(72, 212, 205, 0.08);
}

.constellation-emblem svg { width: 25px; height: 25px; }

.constellation-heading p,
.map-panel-heading p,
.map-preview-hero p {
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.constellation-heading h2 {
  margin-top: 2px;
  overflow: hidden;
  color: #f6ead4;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 600;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.constellation-trail {
  position: relative;
  z-index: 11;
  min-width: 0;
  min-height: 38px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-bottom: 1px solid rgba(104, 157, 180, 0.2);
  background: rgba(4, 14, 22, 0.96);
}

.constellation-trail-back {
  width: 30px;
  min-height: 29px;
  padding: 0;
  display: grid;
  place-items: center;
  border-color: rgba(114, 164, 184, 0.25);
  color: #9cb2bc;
  background: rgba(16, 36, 47, 0.55);
}

.constellation-trail-back:disabled {
  cursor: default;
  opacity: 0.35;
}

.constellation-trail-back svg { width: 16px; height: 16px; }

.constellation-trail-items {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  white-space: nowrap;
}

.constellation-trail-items button {
  min-width: 0;
  min-height: 28px;
  padding: 0 7px;
  overflow: hidden;
  border-color: transparent;
  color: #8198a4;
  background: transparent;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.constellation-trail-items button:hover,
.constellation-trail-items button:focus-visible {
  border-color: rgba(72, 212, 205, 0.25);
  color: #dce9e7;
  background: rgba(72, 212, 205, 0.055);
}

.constellation-trail-items button[aria-current="page"] {
  color: var(--gold);
  font-weight: 700;
}

.trail-separator,
.trail-ellipsis {
  flex: 0 0 auto;
  color: #49616d;
  font-size: 10px;
}

.constellation-search {
  position: relative;
  min-width: 0;
  height: 46px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 13px;
  border: 1px solid rgba(109, 161, 187, 0.34);
  border-radius: 7px;
  background: rgba(8, 23, 34, 0.88);
  box-shadow: inset 0 0 22px rgba(24, 79, 100, 0.13);
}

.constellation-search:focus-within {
  border-color: rgba(72, 212, 205, 0.68);
  box-shadow: inset 0 0 22px rgba(24, 79, 100, 0.13), 0 0 0 2px rgba(72, 212, 205, 0.08);
}

.constellation-search > svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.constellation-search input {
  min-width: 0;
  height: 42px;
  border: 0;
  outline: 0;
  color: #edf4f3;
  background: transparent;
  font-size: 13px;
}

.constellation-search input::placeholder { color: #8298a6; }

.map-search-clear {
  width: 30px;
  min-height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.map-search-clear svg { width: 16px; height: 16px; }

.constellation-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: min(460px, 62vh);
  overflow: auto;
  padding: 5px;
  border: 1px solid rgba(99, 166, 190, 0.36);
  border-radius: 7px;
  background: rgba(4, 15, 24, 0.98);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
}

.constellation-search-results button {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 0;
  border-bottom: 1px solid rgba(124, 161, 180, 0.13);
  border-radius: 4px;
  text-align: left;
  background: transparent;
}

.constellation-search-results button:last-child { border-bottom: 0; }

.constellation-search-results button:hover,
.constellation-search-results button:focus-visible {
  background: rgba(72, 212, 205, 0.08);
}

.constellation-search-results button > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.constellation-search-results button strong {
  overflow: hidden;
  color: #edf2ee;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.constellation-search-results button small {
  color: var(--muted);
  font-size: 10px;
}

.map-search-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.constellation-controls {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.map-control-group {
  height: 38px;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(52px, auto);
  align-items: stretch;
  padding: 3px;
  border: 1px solid rgba(117, 156, 176, 0.25);
  border-radius: 7px;
  background: rgba(4, 13, 21, 0.8);
}

.map-control-group button {
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  white-space: nowrap;
}

.map-control-group button.active {
  color: #eff9f5;
  background: rgba(54, 166, 165, 0.2);
  box-shadow: inset 0 0 0 1px rgba(72, 212, 205, 0.28);
}

.map-control-group button:disabled {
  cursor: default;
  opacity: 0.38;
}

.map-select-control {
  height: 38px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid rgba(117, 156, 176, 0.25);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(4, 13, 21, 0.8);
}

.map-select-control svg { width: 17px; height: 17px; }

.map-select-control select {
  max-width: 142px;
  border: 0;
  outline: 0;
  color: #d8e2e4;
  background: transparent;
  font-size: 11px;
}

.map-icon-button {
  flex: 0 0 auto;
  width: 38px;
  min-height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(4, 13, 21, 0.8);
}

.map-icon-button.mobile-only { display: none; }

.map-icon-button svg { width: 18px; height: 18px; }

.constellation-close {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-color: rgba(228, 185, 93, 0.34);
  color: var(--gold);
  background: rgba(228, 185, 93, 0.07);
  font-size: 11px;
  font-weight: 700;
}

.constellation-close svg { width: 17px; height: 17px; }

.constellation-workspace {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  overflow: hidden;
}

.constellation-map.has-selection .constellation-workspace {
  grid-template-columns: 228px minmax(0, 1fr) 312px;
}

.constellation-filters,
.constellation-preview {
  position: relative;
  z-index: 8;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: rgba(5, 16, 25, 0.97);
}

.constellation-filters {
  padding: 16px 14px;
  border-right: 1px solid rgba(111, 161, 183, 0.22);
}

.constellation-preview {
  display: none;
  border-left: 1px solid rgba(111, 161, 183, 0.25);
}

.constellation-map.has-selection .constellation-preview { display: block; }

.map-panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 17px;
}

.map-panel-heading h3 {
  margin-top: 2px;
  color: #e9eee8;
  font-size: 17px;
  font-weight: 690;
}

.map-type-filters {
  min-width: 0;
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0 0 16px;
  border: 0;
  border-bottom: 1px solid rgba(112, 152, 174, 0.16);
}

.map-type-filters legend,
.map-filter-field > label {
  display: block;
  margin-bottom: 8px;
  color: #8398a6;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.map-type-filters label {
  position: relative;
  min-width: 0;
  min-height: 42px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 4px 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #c9d4d7;
  cursor: pointer;
  font-size: 12px;
}

.map-type-filters label:hover {
  border-color: rgba(112, 164, 185, 0.2);
  background: rgba(31, 70, 88, 0.13);
}

.map-type-filters label:has(input:focus-visible) {
  border-color: var(--gold);
}

.map-type-filters label:has(input:not(:checked)) {
  color: #667b89;
  opacity: 0.72;
}

.map-type-filters label.empty { display: none; }

.map-type-filters input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.map-type-filters label strong {
  color: #768b98;
  font-size: 10px;
  font-weight: 700;
}

.map-type-icon {
  --map-type-color: #9ddd72;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--map-type-color) 46%, transparent);
  border-radius: 50%;
  color: var(--map-type-color);
  background: color-mix(in srgb, var(--map-type-color) 10%, transparent);
}

.map-type-icon svg { width: 16px; height: 16px; }
.map-type-icon.person { --map-type-color: #78b7ff; }
.map-type-icon.race { --map-type-color: #55dfc7; }
.map-type-icon.organization { --map-type-color: #edc35b; }
.map-type-icon.planet { --map-type-color: #b38bff; }
.map-type-icon.civilization { --map-type-color: #ff8d74; }
.map-type-icon.concept { --map-type-color: #9ddd72; }

.map-filter-field { margin-top: 16px; }

.map-filter-field select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid rgba(109, 153, 174, 0.28);
  border-radius: 6px;
  outline: 0;
  color: #d9e2e3;
  background: #071722;
  font-size: 12px;
}

.map-filter-field select:focus-visible { border-color: var(--gold); }

.map-switch {
  position: relative;
  min-height: 42px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  color: #c8d3d6;
  cursor: pointer;
  font-size: 12px;
}

.map-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.map-switch > span {
  position: relative;
  width: 34px;
  height: 19px;
  border: 1px solid rgba(118, 157, 176, 0.38);
  border-radius: 12px;
  background: rgba(29, 48, 60, 0.72);
}

.map-switch > span::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #8295a1;
  transition: transform 150ms ease, background 150ms ease;
}

.map-switch input:checked + span {
  border-color: rgba(72, 212, 205, 0.5);
  background: rgba(38, 145, 143, 0.24);
}

.map-switch input:checked + span::after {
  transform: translateX(15px);
  background: var(--teal);
}

.map-switch input:focus-visible + span { outline: 1px solid var(--gold); outline-offset: 2px; }

.map-switch strong { font-weight: 580; }

.map-reading-key {
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid rgba(112, 152, 174, 0.16);
}

.map-reading-key h4 {
  margin: 0 0 6px;
  color: #d9e4e3;
  font-size: 11px;
}

.map-reading-key p {
  color: #7e939f;
  font-size: 11px;
  line-height: 1.55;
}

.map-reset {
  width: 100%;
  min-height: 38px;
  margin-top: 14px;
  border-color: rgba(228, 185, 93, 0.22);
  color: #c7aa68;
  background: rgba(228, 185, 93, 0.04);
  font-size: 11px;
}

.constellation-viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #020810;
}

#constellationCanvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#constellationCanvas:active { cursor: grabbing; }
#constellationCanvas.node-hovered { cursor: pointer; }
#constellationCanvas:focus-visible { outline: 1px solid rgba(72, 212, 205, 0.62); outline-offset: -2px; }

.constellation-grid {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(83, 137, 159, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(83, 137, 159, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(83, 137, 159, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(83, 137, 159, 0.035) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}

.constellation-vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
  box-shadow: inset 0 0 90px 24px rgba(0, 0, 0, 0.72);
}

.constellation-vignette::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -2px;
  height: 1px;
  background: rgba(83, 226, 211, 0.34);
  box-shadow: 0 0 12px rgba(83, 226, 211, 0.28);
  animation: constellation-scan 10s linear infinite;
}

@keyframes constellation-scan {
  from { transform: translateY(0); }
  to { transform: translateY(82vh); }
}

.constellation-readout {
  position: absolute;
  z-index: 6;
  top: 12px;
  left: 12px;
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid rgba(90, 167, 188, 0.25);
  border-radius: 5px;
  color: #9eb3bd;
  background: rgba(4, 15, 24, 0.8);
  backdrop-filter: blur(9px);
  font-size: 10px;
}

.constellation-readout strong { color: #c8d8da; font-weight: 650; }

.readout-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px rgba(72, 212, 205, 0.75);
  animation: readout-pulse 2.2s ease-in-out infinite;
}

@keyframes readout-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.84); }
  50% { opacity: 1; transform: scale(1); }
}

.constellation-instructions {
  position: absolute;
  z-index: 6;
  right: 12px;
  bottom: 11px;
  max-width: 390px;
  padding: 7px 10px;
  border-left: 2px solid rgba(228, 185, 93, 0.55);
  color: #8197a3;
  background: rgba(3, 12, 20, 0.76);
  font-size: 10px;
  line-height: 1.4;
}

.constellation-tooltip {
  position: absolute;
  z-index: 18;
  top: 0;
  left: 0;
  width: min(220px, calc(100% - 20px));
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid rgba(111, 186, 199, 0.38);
  border-radius: 5px;
  pointer-events: none;
  color: #edf4ed;
  background: rgba(3, 15, 24, 0.95);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
}

.constellation-tooltip strong { font-size: 12px; }
.constellation-tooltip span { color: #8da3ae; font-size: 10px; }

.map-preview-empty {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  padding: 28px;
  color: #7f939f;
  text-align: center;
}

.map-preview-empty > span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(72, 212, 205, 0.28);
  border-radius: 50%;
  color: var(--teal);
}

.map-preview-empty h3 { color: #dce5e3; font-size: 16px; }
.map-preview-empty p { max-width: 220px; font-size: 12px; line-height: 1.5; }

.map-preview-hero {
  --preview-color: #9ddd72;
  position: relative;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 17px 44px 17px 15px;
  border-bottom: 1px solid color-mix(in srgb, var(--preview-color) 26%, transparent);
  background: color-mix(in srgb, var(--preview-color) 6%, #06121c);
}

.map-preview-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  min-height: 30px;
  padding: 0;
  display: none;
  place-items: center;
  border-color: rgba(119, 160, 178, 0.22);
  color: #8ca1aa;
  background: rgba(4, 14, 22, 0.72);
}

.map-preview-close svg { width: 15px; height: 15px; }

.map-preview-hero.person { --preview-color: #78b7ff; }
.map-preview-hero.race { --preview-color: #55dfc7; }
.map-preview-hero.organization { --preview-color: #edc35b; }
.map-preview-hero.planet { --preview-color: #b38bff; }
.map-preview-hero.civilization { --preview-color: #ff8d74; }
.map-preview-hero.concept { --preview-color: #9ddd72; }

.map-preview-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--preview-color) 55%, transparent);
  border-radius: 50%;
  color: var(--preview-color);
  background: color-mix(in srgb, var(--preview-color) 11%, transparent);
  box-shadow: 0 0 24px color-mix(in srgb, var(--preview-color) 11%, transparent);
}

.map-preview-icon svg { width: 25px; height: 25px; }

.map-preview-hero h3 {
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: #f2eadc;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.05;
}

.map-preview-layers {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.map-preview-layers .lore-layer-pill {
  min-height: 20px;
  padding-inline: 7px;
  font-size: 9px;
}

.map-preview-copy {
  padding: 14px 15px 12px;
  border-bottom: 1px solid rgba(113, 154, 174, 0.16);
}

.map-preview-copy p {
  color: #b2c1c5;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.55;
}

.map-preview-statline {
  display: block;
  border-bottom: 1px solid rgba(113, 154, 174, 0.16);
}

.map-preview-statline span {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  color: #788e9a;
  font-size: 9px;
  text-transform: uppercase;
}

.map-preview-statline strong { color: var(--gold); font-size: 13px; }

.map-preview-relations {
  padding: 13px 11px 75px;
}

.map-preview-relations h4 {
  margin: 0 4px 8px;
  color: #8399a5;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.map-preview-relations > div { display: grid; gap: 3px; }

.map-preview-relations button {
  min-width: 0;
  min-height: 48px;
  display: grid;
  grid-template-columns: 13px minmax(0, 1fr) 7px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-color: transparent;
  border-bottom-color: rgba(112, 151, 171, 0.12);
  border-radius: 4px;
  text-align: left;
  background: transparent;
}

.map-preview-relations button:hover,
.map-preview-relations button:focus-visible {
  border-color: rgba(72, 212, 205, 0.26);
  background: rgba(72, 212, 205, 0.055);
}

.map-preview-relations button > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.map-preview-relations button small {
  overflow: hidden;
  color: #718895;
  font-size: 9px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.map-preview-relations button strong {
  overflow: hidden;
  color: #cbd8d9;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relation-direction {
  width: 11px;
  height: 1px;
  background: #507483;
}

.relation-direction::after {
  content: '';
  display: block;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 7px;
  border-top: 1px solid #6d9aaa;
  border-right: 1px solid #6d9aaa;
  transform: rotate(45deg);
}

.map-preview-relations button i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--relation-color);
  box-shadow: 0 0 7px color-mix(in srgb, var(--relation-color) 70%, transparent);
}

.map-preview-relations > div > p {
  padding: 10px 4px;
  color: #708691;
  font-size: 11px;
  line-height: 1.45;
}

.map-open-dossier {
  position: absolute;
  z-index: 3;
  left: 12px;
  right: 12px;
  bottom: 12px;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-color: rgba(228, 185, 93, 0.45);
  color: #f1cc73;
  background: rgba(30, 29, 23, 0.95);
  box-shadow: 0 -12px 28px rgba(5, 16, 25, 0.96);
  font-size: 12px;
  font-weight: 700;
}

.map-open-dossier svg { width: 18px; height: 18px; }

.constellation-sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 72;
  background: rgba(0, 5, 9, 0.62);
  backdrop-filter: blur(2px);
}

.map-filter-fab {
  position: absolute;
  z-index: 9;
  left: 12px;
  bottom: 12px;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  color: var(--teal);
  border-color: rgba(72, 212, 205, 0.36);
  background: rgba(5, 20, 30, 0.93);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.36);
  font-size: 11px;
}

.map-filter-fab svg { width: 18px; height: 18px; }

.mobile-sheet-handle { display: none; }

@media (max-width: 1380px) {
  .constellation-topbar {
    grid-template-columns: minmax(220px, 0.72fr) minmax(340px, 1.28fr);
    grid-template-areas:
      "heading search"
      "controls controls";
    gap: 10px;
    min-height: 118px;
    padding: 9px 12px;
  }
  .constellation-heading { grid-area: heading; }
  .constellation-search { grid-area: search; }
  .constellation-controls { grid-area: controls; justify-content: space-between; }
  .constellation-heading h2 { font-size: 22px; }
  .map-select-control select { max-width: 106px; }
  .constellation-workspace { grid-template-columns: 210px minmax(0, 1fr); }
  .constellation-map.has-selection .constellation-workspace { grid-template-columns: 210px minmax(0, 1fr) 286px; }
  .constellation-preview { font-size: 12px; }
}

@media (max-width: 1120px) {
  .mobile-only { display: flex; }
  .constellation-topbar {
    grid-template-columns: minmax(190px, 0.7fr) minmax(280px, 1.3fr);
  }
  .constellation-heading h2 { font-size: 21px; }
  .constellation-emblem { width: 40px; height: 40px; }
  .constellation-controls > .map-select-control { display: none; }
  .constellation-workspace,
  .constellation-map.has-selection .constellation-workspace { grid-template-columns: minmax(0, 1fr) 284px; }
  .constellation-map:not(.has-selection) .constellation-workspace { grid-template-columns: minmax(0, 1fr); }
  .constellation-filters {
    position: fixed;
    z-index: 74;
    left: 96px;
    right: 4px;
    bottom: 4px;
    max-height: min(760px, 84vh);
    padding: 10px 18px 18px;
    border: 1px solid rgba(101, 168, 190, 0.36);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.58);
    transform: translateY(calc(100% + 12px));
    transition: transform 220ms ease;
  }
  .constellation-map.filters-open .constellation-filters { transform: translateY(0); }
  .constellation-map.filters-open .constellation-sheet-scrim { display: block; }
  .mobile-sheet-handle {
    width: 46px;
    height: 4px;
    display: block;
    margin: 0 auto 9px;
    border-radius: 2px;
    background: rgba(146, 177, 190, 0.34);
  }
  .map-type-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 8px;
  }
  .map-type-filters legend { grid-column: 1 / -1; }
  .map-filter-field { max-width: 440px; }
  .mobile-map-tools {
    max-width: 440px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
  }
  .mobile-cluster-control.mobile-only { display: block; }
  #constellationFiltersClose.mobile-only { display: grid; }
  .mobile-map-tools button {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
  }
  .mobile-map-tools svg { width: 17px; height: 17px; }
  .map-filter-fab { display: flex; }
  .constellation-instructions { display: none; }
}

@media (max-width: 900px) {
  .constellation-topbar {
    grid-template-columns: auto minmax(220px, 1fr);
    grid-template-areas:
      "heading search"
      "controls controls";
    min-height: 118px;
    padding: 9px 11px;
  }
  .constellation-heading { grid-area: heading; }
  .constellation-search { grid-area: search; }
  .constellation-controls { grid-area: controls; justify-content: space-between; }
  .constellation-workspace,
  .constellation-map.has-selection .constellation-workspace { grid-template-columns: minmax(0, 1fr); }
  .constellation-preview {
    position: absolute;
    z-index: 10;
    top: 10px;
    right: 10px;
    bottom: 10px;
    width: 278px;
    border: 1px solid rgba(102, 163, 184, 0.3);
    border-radius: 7px;
    background: rgba(5, 16, 25, 0.94);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.46);
    backdrop-filter: blur(12px);
  }
  .map-preview-close { display: grid; }
  .map-filter-fab { bottom: 12px; }
  .constellation-trail-items { overflow-x: auto; scrollbar-width: none; }
  .constellation-trail-items::-webkit-scrollbar { display: none; }
}

@media (max-width: 760px) {
  .constellation-map {
    inset: 0;
    border-radius: 0;
  }
  .constellation-trail { padding-inline: 7px; }
  .constellation-trail-items button { max-width: 145px; }
  .constellation-topbar {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "search"
      "controls";
    min-height: 160px;
    gap: 7px;
    padding: 7px 8px;
  }
  .constellation-heading { min-height: 34px; }
  .constellation-heading p { display: none; }
  .constellation-heading h2 { font-size: 19px; }
  .constellation-emblem { width: 34px; height: 34px; }
  .constellation-emblem svg { width: 19px; height: 19px; }
  .constellation-search { height: 40px; }
  .constellation-search input { height: 37px; font-size: 12px; }
  .constellation-controls { min-width: 0; gap: 5px; }
  .map-control-group { height: 35px; }
  .map-control-group button { min-height: 27px; padding: 0 7px; font-size: 10px; }
  .constellation-controls > .map-icon-button,
  .constellation-controls > .map-select-control { display: none; }
  .constellation-close { min-height: 35px; margin-left: auto; padding: 0 9px; }
  .constellation-filters { left: 0; right: 0; bottom: 0; }
  .map-type-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .constellation-readout { top: 8px; left: 8px; max-width: calc(100% - 16px); }
  .map-filter-fab { left: 8px; bottom: 8px; }
  .constellation-preview {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 56px;
    width: auto;
    max-height: min(310px, 42vh);
  }
  .map-preview-hero {
    grid-template-columns: 38px minmax(0, 1fr);
    min-height: 62px;
    padding: 9px 42px 9px 11px;
  }
  .map-preview-icon { width: 38px; height: 38px; }
  .map-preview-icon svg { width: 20px; height: 20px; }
  .map-preview-hero h3 { font-size: 18px; }
  .map-preview-copy { padding: 9px 11px; }
  .map-preview-copy p { font-size: 12px; line-height: 1.42; }
  .map-preview-statline { display: none; }
  .map-preview-relations { padding: 8px 8px 62px; }
  .map-preview-relations h4 { margin-bottom: 4px; }
  .map-preview-relations button { min-height: 40px; }
  .map-open-dossier { min-height: 40px; bottom: 8px; left: 8px; right: 8px; }
  .constellation-tooltip { display: none; }
}

@media (max-width: 480px) {
  .constellation-close span { display: none; }
  .constellation-close { width: 36px; padding: 0; justify-content: center; }
  .map-control-group { grid-auto-columns: minmax(45px, auto); }
  .map-type-filters label { padding-right: 5px; font-size: 11px; }
  .map-type-filters label strong { display: none; }
  .constellation-preview { max-height: min(290px, 39vh); }
  .map-preview-copy p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .constellation-vignette::before,
  .readout-pulse {
    animation: none;
  }
  .constellation-filters,
  .map-switch > span::after {
    transition: none;
  }
}

@media (max-width: 760px) {
  .player-lore-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .player-contribution-media img { max-height: 360px; }
}

@media (max-width: 480px) {
  .player-lore-gallery { grid-template-columns: 1fr; }
}
