:root {
  color-scheme: dark;
  --bg: #020403;
  --panel: #07110c;
  --panel-2: #0d1a13;
  --line: #2e4539;
  --line-soft: rgba(105, 145, 124, 0.32);
  --text: #edf8f1;
  --muted: #9fb2a7;
  --green: #18d865;
  --cyan: #7fd7ff;
  --pink: #ff73b8;
  --gold: #ffd84d;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  width: 100vw;
  height: 100vh;
  background:
    linear-gradient(90deg, rgba(20, 50, 36, 0.12), transparent 34%),
    #020403;
}

.side-panel {
  min-width: 0;
  height: 100%;
  overflow: auto;
  padding: 18px 18px 20px;
  border-right: 1px solid var(--line);
  background: rgba(5, 13, 9, 0.96);
}

.panel-header {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.alliance-mark {
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #08120c;
}

h1 {
  margin: 0 0 4px;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: 0;
}

p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.control-section {
  padding: 17px 0;
  border-bottom: 1px solid var(--line-soft);
}

.section-title {
  margin-bottom: 10px;
  color: #dcebe2;
  font-size: 14px;
  font-weight: 800;
}

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

.filter-option {
  display: grid;
  grid-template-columns: 22px 30px 1fr auto;
  gap: 9px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(12, 27, 18, 0.86);
  cursor: pointer;
}

.filter-option input,
.toggle-row input {
  accent-color: var(--green);
}

.mineral-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #0b130f;
}

.filter-name {
  min-width: 0;
  font-weight: 800;
  font-size: 14px;
}

.filter-count {
  color: var(--muted);
  font-size: 12px;
}

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

.segment-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: rgba(10, 25, 17, 0.9);
  cursor: pointer;
}

.segment-button[aria-pressed="true"] {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(24, 216, 101, 0.35);
  background: rgba(24, 216, 101, 0.12);
}

.toggle-row {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  font-weight: 700;
}

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

.stat-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(9, 22, 15, 0.84);
}

.stat-grid strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.stat-grid span {
  color: var(--muted);
  font-size: 12px;
}

.list-section {
  min-height: 190px;
}

.system-list {
  display: grid;
  gap: 7px;
}

.system-item {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(80, 120, 99, 0.66);
  border-radius: 7px;
  color: var(--text);
  text-align: left;
  background: rgba(8, 20, 14, 0.9);
  cursor: pointer;
}

.system-item:hover,
.system-item.is-selected {
  border-color: var(--cyan);
  background: rgba(23, 74, 73, 0.35);
}

.system-name {
  font-weight: 900;
}

.system-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #07110c;
  font-size: 12px;
  font-weight: 900;
}

.detail-card {
  border-bottom: 0;
}

.detail-body {
  display: grid;
  gap: 9px;
  color: var(--text);
  font-size: 13px;
}

.detail-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(9, 22, 15, 0.8);
}

.detail-row img {
  width: 26px;
  height: 26px;
}

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

.map-panel {
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.map-toolbar {
  position: absolute;
  z-index: 20;
  top: 18px;
  right: 18px;
  left: 18px;
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.map-toolbar > * {
  pointer-events: auto;
}

.toolbar-spacer {
  flex: 1;
}

.icon-button,
.tool-button {
  min-width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: rgba(6, 16, 10, 0.9);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.tool-button {
  padding: 0 13px;
  font-weight: 800;
}

.icon-button:hover,
.tool-button:hover {
  border-color: var(--green);
}

.map-status {
  max-width: 420px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(6, 16, 10, 0.9);
  box-shadow: var(--shadow);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
}

.map-viewport.is-dragging {
  cursor: grabbing;
}

.map-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.base-map-host,
.base-map-svg,
.overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.base-map-host,
.base-map-svg {
  user-select: none;
  pointer-events: none;
}

.base-map-svg {
  display: block;
  overflow: visible;
  shape-rendering: geometricPrecision;
  text-rendering: optimizeLegibility;
  image-rendering: auto;
}

.overlay {
  overflow: visible;
}

.ore-system {
  cursor: pointer;
  transition: opacity 160ms ease;
}

.ore-system.is-hidden {
  display: none;
}

.ore-system.is-dim {
  opacity: 0.28;
}

.ore-system .halo {
  fill: none;
  stroke: rgba(213, 255, 236, 0.72);
  stroke-width: 2.2;
  filter: drop-shadow(0 0 3px rgba(127, 215, 255, 0.45));
}

.ore-system.is-match .halo {
  stroke: var(--cyan);
  stroke-width: 3;
  filter: drop-shadow(0 0 5px rgba(127, 215, 255, 0.78));
}

.ore-system .selected-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0);
  stroke-width: 0;
  pointer-events: none;
}

.ore-system.is-selected .selected-ring {
  stroke: #ffffff;
  stroke-width: 3.4;
  filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.72));
}

.badge-shell {
  fill: rgba(3, 10, 7, 0.86);
  stroke: rgba(224, 255, 239, 0.42);
  stroke-width: 1.45;
}

.ore-badge {
  pointer-events: none;
}

.level-pill {
  fill: rgba(3, 8, 6, 0.94);
  stroke: rgba(255, 255, 255, 0.48);
  stroke-width: 0.8;
}

.level-text {
  fill: #ffffff;
  font: 900 10.5px "Microsoft YaHei", Arial, sans-serif;
  paint-order: stroke;
  stroke: #020403;
  stroke-width: 2.2px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 330px 1fr;
  }

  .side-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .map-toolbar {
    top: 10px;
    right: 10px;
    left: 10px;
  }
}
