.science-empty {
  display:grid;
  gap:5px;
  padding:10px;
  border:1px dashed var(--border);
  border-radius:var(--radius);
  color:var(--muted);
  font-size:10px;
  line-height:1.4;
}

.science-empty strong {
  color:var(--gold);
  font-size:11px;
}

.science-group {
  border-top:1px solid color-mix(in srgb,var(--border) 27.84%,transparent);
}

.science-group:first-child {
  border-top:0;
}

.science-group-header {
  display:grid;
  grid-template-columns:22px minmax(0, 1fr);
  align-items:center;
}

.science-group-expand {
  width:22px;
  height:28px;
  padding:0;
  border:0;
  background:transparent;
  color:var(--muted);
  cursor:pointer;
}

.science-group-expand span {
  display:inline-block;
  font-size:18px;
  transform:rotate(0deg);
  transition:transform .15s ease;
}

.science-group-expand[aria-expanded="true"] span {
  transform:rotate(90deg);
}

.science-group-check {
  font-weight:700;
}

.science-group-children {
  padding:0 0 6px 22px;
}

.science-group-children.hidden {
  display:none;
}

.science-layer-row {
  color:var(--text);
}

.science-domain-geology { background:var(--accent); }
.science-domain-elevation { background:var(--accent); }
.science-domain-magnetics { background:var(--accent); }
.science-domain-gravity { background:var(--accent); }

.map-legends {
  position:absolute;
  z-index:3;
  right:14px;
  bottom:26px;
  width:min(320px, calc(100% - 28px));
  display:grid;
  gap:8px;
  pointer-events:none;
}

.map-legends .map-legend {
  position:static;
  width:100%;
  max-width:none;
  padding:9px 11px;
  pointer-events:auto;
}

.map-legends .map-legend.hidden {
  display:none;
}

.map-legends .map-legend-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}

.map-legend-toggle {
  flex:0 0 auto;
  width:24px;
  height:24px;
  padding:0;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:var(--surface);
  color:var(--muted);
  line-height:1;
  cursor:pointer;
}

.map-legend-toggle:hover {
  color:var(--text);
  border-color:var(--border);
}

.map-legends .map-legend.collapsed .map-legend-items,
.map-legends .map-legend.collapsed .scientific-legend-items {
  display:none;
}

.map-legends .map-legend-items {
  display:grid;
  gap:5px;
  margin-top:7px;
}

.map-legends .map-legend-item {
  display:flex;
}

.scientific-map-legend .scientific-legend-items {
  display:grid;
  gap:10px;
  max-height:50vh;
  overflow:auto;
  margin-top:8px;
  padding-right:3px;
}

.scientific-map-legend .science-legend-layer {
  display:grid;
  gap:6px;
  border-top:1px solid color-mix(in srgb,var(--border) 34.90%,transparent);
  padding-top:9px;
}

.scientific-map-legend .science-legend-layer:first-child {
  border-top:0;
  padding-top:0;
}

.scientific-map-legend .science-legend-layer > strong {
  color:var(--text);
  text-transform:none;
  letter-spacing:0;
  font-size:11px;
}

.scientific-map-legend .science-legend-layer > small,
.scientific-map-legend .science-legend-note,
.scientific-map-legend .science-legend-error {
  display:block;
  color:var(--muted);
  font-size:9px;
  line-height:1.4;
}

.scientific-map-legend .science-legend-error {
  color:var(--af-error);
}

.scientific-map-legend .science-legend-image {
  display:block;
  width:100%;
  max-height:180px;
  object-fit:contain;
  object-position:left center;
  border-radius:var(--radius);
  background:var(--bg);
}

.scientific-map-legend .science-legend-gradient {
  display:block;
  width:100%;
  height:12px;
  border:1px solid color-mix(in srgb,var(--border) 33.33%,transparent);
  border-radius:var(--radius);
}

.scientific-map-legend .science-gradient-labels {
  display:flex;
  justify-content:space-between;
  color:var(--muted);
  font-size:9px;
}

.scientific-map-legend .science-legend-symbols {
  display:grid;
  gap:4px;
  max-height:180px;
  overflow:auto;
}

.scientific-map-legend .science-legend-symbols > div {
  display:grid;
  grid-template-columns:14px minmax(0, 1fr);
  align-items:center;
  gap:7px;
  font-size:9px;
  color:var(--text);
}

.scientific-map-legend .science-legend-symbols i {
  width:12px;
  height:12px;
  border:1px solid;
  border-radius:var(--radius);
}

@media (max-width:1050px) {
  .map-legends { width:min(280px, calc(100% - 28px)); }
}
