:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #101010;
  --panel-2: #171717;
  --line: #303030;
  --line-soft: rgba(245, 245, 245, 0.14);
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --green: #f4f4f5;
  --yellow: #d4d4d8;
  --red: #ef746f;
  --blue: #c7c7c7;
  --violet: #e4e4e7;
  --canvas: #080808;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #000;
  color: var(--text);
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.boot-loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1000;
  background: #050505;
  color: var(--text);
  transition: opacity 220ms ease, visibility 220ms ease;
}

.boot-loader.done {
  opacity: 0;
  visibility: hidden;
}

.boot-loader-panel {
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 42px));
  padding: 22px;
  border: 1px solid rgba(245, 245, 245, 0.18);
  border-radius: 8px;
  background: #111;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
}

.boot-loader-panel strong {
  font-size: 18px;
}

.boot-loader-panel span {
  color: var(--muted);
  font-size: 13px;
}

.boot-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.boot-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #f5f5f5, #9ca3af);
  transition: width 180ms ease;
}

.app-shell {
  display: grid;
  grid-template-columns: 410px minmax(0, 1fr);
  grid-template-rows: 62px minmax(0, 1fr) 38px;
  grid-template-areas:
    "top top"
    "side map"
    "bottom bottom";
  height: 100vh;
  min-height: 560px;
  background: var(--bg);
}

.top-bar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 0 16px;
  border-bottom: 1px solid rgba(245, 245, 245, 0.12);
  background: rgba(5, 5, 5, 0.94);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.28);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 244px;
  font-size: 20px;
}

.brand-cube {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.22) 42%, rgba(0, 0, 0, 0.74));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.22) inset, 0 12px 24px rgba(0,0,0,0.35);
}

.top-meta {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.top-meta strong {
  color: var(--text);
}

.top-nav {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  margin-left: auto;
}

.map-pane {
  grid-area: map;
  position: relative;
  min-width: 0;
  background:
    linear-gradient(rgba(245, 245, 245, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245, 245, 245, 0.035) 1px, transparent 1px),
    var(--canvas);
  background-size: 44px 44px;
  isolation: isolate;
}

#map {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#map.dragging {
  cursor: grabbing;
}

.map-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.dimension-tabs,
.tool-buttons {
  display: flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(218, 235, 220, 0.16);
  background: rgba(10, 15, 12, 0.78);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
  border-radius: 8px;
  pointer-events: auto;
}

.mode-tab,
.tab,
.icon-button {
  border: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
  min-height: 34px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.mode-tab,
.tab {
  padding: 0 12px;
}

.mode-tab.active,
.tab.active {
  color: #050505;
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}

.icon-button {
  width: 34px;
  font-size: 18px;
}

.icon-button:hover,
.mode-tab:hover,
.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.mode-tab.active:hover,
.tab.active:hover {
  color: #050505;
  background: var(--green);
}

.muted-map {
  filter: saturate(0.68) brightness(0.58);
}

.three-panel,
.intel-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #070707;
}

.three-canvas {
  position: absolute;
  inset: 0;
}

.three-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.three-canvas canvas.dragging {
  cursor: grabbing;
}

.three-status {
  position: absolute;
  left: 18px;
  bottom: 18px;
  max-width: min(520px, calc(100% - 36px));
  padding: 10px 12px;
  border: 1px solid rgba(218, 235, 220, 0.16);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(9, 14, 11, 0.86);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.34);
}

.three-badge {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 8;
  padding: 8px 16px;
  border: 1px solid rgba(245, 245, 245, 0.42);
  border-radius: 8px;
  color: var(--green);
  background: rgba(10, 25, 17, 0.82);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
  font-weight: 800;
}

.three-left-dock,
.three-position-card,
.three-inspector,
.three-controlbar {
  position: absolute;
  z-index: 8;
  border: 1px solid rgba(218, 235, 220, 0.17);
  border-radius: 8px;
  background: rgba(10, 16, 13, 0.82);
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
}

.three-left-dock {
  left: 18px;
  top: 106px;
  display: grid;
  gap: 4px;
  min-width: 174px;
  padding: 8px;
}

.three-dock-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 5px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.three-dock-stat strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.three-dock-stat span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.three-inspector {
  top: 18px;
  right: 18px;
  width: min(330px, calc(100% - 36px));
  overflow: hidden;
}

.three-inspector header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(218, 235, 220, 0.14);
}

.three-inspector header span {
  color: var(--text);
  font-weight: 800;
}

.three-inspector header strong {
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--green);
  background: rgba(245, 245, 245, 0.14);
  font-size: 12px;
}

.three-inspector-body {
  display: grid;
  gap: 8px;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.three-inspector-body strong {
  color: var(--green);
  font-size: 18px;
}

.three-inspector-body span {
  display: block;
}

.three-mini-map {
  border-top: 1px solid rgba(218, 235, 220, 0.14);
  padding: 14px;
}

.three-mini-title {
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 800;
}

.three-mini-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 1px;
  min-height: 196px;
  border: 1px solid rgba(218, 235, 220, 0.16);
  background: rgba(6, 10, 8, 0.62);
}

.three-mini-grid span {
  min-width: 0;
  aspect-ratio: 1;
}

.three-position-card {
  left: 18px;
  bottom: 30px;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 4px 14px;
  width: 320px;
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
}

.compass {
  grid-row: span 4;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(218, 235, 220, 0.24);
  border-radius: 50%;
  color: var(--text);
  font-weight: 800;
}

.three-controlbar {
  left: 50%;
  bottom: 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  width: min(900px, calc(100% - 620px));
  min-width: 520px;
  padding: 11px 14px;
  transform: translateX(-50%);
}

.three-controlbar strong {
  white-space: nowrap;
}

.three-controlbar label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.building-range-control.inactive,
#buildingRangeValue.inactive,
.building-sample-switch.inactive {
  opacity: 0.52;
}

.three-view-switch,
.building-sample-switch,
.three-vertical-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(218, 235, 220, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
}

.three-controlbar .three-view-toggle,
.three-controlbar .building-sample-toggle,
.three-vertical-switch button {
  padding: 5px 9px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
}

.three-controlbar .three-view-toggle.active,
.three-controlbar .building-sample-toggle.active {
  color: #050505;
  background: var(--green);
}

.three-controlbar input {
  width: 150px;
  accent-color: var(--green);
}

.three-controlbar button {
  border: 1px solid rgba(218, 235, 220, 0.18);
  border-radius: 6px;
  padding: 7px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.three-controlbar .three-view-toggle.active,
.three-controlbar .building-sample-toggle.active {
  color: #050505;
  background: var(--green);
}

.selection-actions {
  margin-bottom: 10px;
}

.primary-action {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(245, 245, 245, 0.62);
  border-radius: 7px;
  color: #050505;
  background: linear-gradient(180deg, #f5f5f5, #a3a3a3);
  cursor: pointer;
  font-weight: 900;
}

.primary-action:disabled {
  border-color: rgba(218, 235, 220, 0.12);
  color: rgba(238, 245, 237, 0.38);
  background: rgba(255, 255, 255, 0.04);
  cursor: not-allowed;
}

.control-check {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(245, 245, 245, 0.56);
  border-radius: 4px;
  background: rgba(245, 245, 245, 0.2);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.control-check::after {
  content: "✓";
}

.map-legend {
  position: absolute;
  top: 86px;
  right: 16px;
  z-index: 8;
  display: grid;
  gap: 10px;
  min-width: 176px;
  padding: 14px;
  border: 1px solid rgba(218, 235, 220, 0.16);
  border-radius: 8px;
  background: rgba(8, 13, 10, 0.78);
  color: var(--text);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(16px);
  font-size: 13px;
}

.map-zoom-rail {
  position: absolute;
  right: 22px;
  bottom: 66px;
  z-index: 8;
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(218, 235, 220, 0.16);
  border-radius: 8px;
  background: rgba(8, 13, 10, 0.78);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(16px);
}

.rail-button {
  width: 48px;
  height: 48px;
  border: 0;
  border-bottom: 1px solid rgba(218, 235, 220, 0.12);
  background: transparent;
  color: var(--text);
  font-size: 23px;
  cursor: pointer;
}

.rail-button:last-child {
  border-bottom: 0;
}

.rail-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.map-scale {
  position: absolute;
  left: 24px;
  bottom: 22px;
  z-index: 8;
  padding-top: 7px;
  width: 118px;
  border-top: 2px solid rgba(238, 245, 237, 0.86);
  color: var(--text);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  font-size: 13px;
}

.map-notice {
  position: absolute;
  left: 24px;
  top: 86px;
  z-index: 8;
  max-width: min(460px, calc(100% - 48px));
  border: 1px solid rgba(240, 199, 106, 0.32);
  border-radius: 8px;
  padding: 10px 12px;
  color: #ffe4a8;
  background: rgba(32, 24, 8, 0.82);
  font-size: 13px;
  line-height: 1.45;
}

.legend-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.legend-toggle.active {
  color: var(--text);
}

.legend-toggle:hover,
.legend-toggle:focus-visible {
  color: var(--text);
}

.legend-toggle:not(.active) .legend-dot,
.legend-toggle:not(.active) .legend-line {
  opacity: 0.32;
}

.legend-check {
  display: inline-grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border: 1px solid rgba(238, 245, 237, 0.38);
  border-radius: 3px;
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.legend-check.on {
  border-color: var(--green);
  background: rgba(245, 245, 245, 0.18);
  box-shadow: 0 0 0 1px rgba(245, 245, 245, 0.24) inset;
}

.legend-check.on::after {
  content: "✓";
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.structure {
  background: var(--yellow);
}

.legend-dot.player {
  background: var(--blue);
}

.legend-dot.marker {
  background: var(--green);
}

.legend-line {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.legend-line.chunk {
  border: 2px solid var(--blue);
}

.legend-line.explored {
  border: 2px solid var(--green);
}

.legend-line.border {
  border: 2px solid #d9961f;
}

.intel-overlay {
  overflow: auto;
  padding: 86px 20px 20px;
  background: rgba(8, 13, 10, 0.96);
}

.intel-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
  max-width: 1120px;
}

.catalog-grid {
  max-width: 1240px;
}

.intel-grid article {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px;
  background: rgba(16, 16, 16, 0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

#timeline {
  display: block;
  width: 100%;
  height: 180px;
  margin-top: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.mini-stats {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

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

.metric-card {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.metric-card span,
.metric-card em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
}

.metric-card strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.readiness-list,
.request-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.request-list .item {
  width: 100%;
}

.panel-link-button {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(218, 235, 220, 0.16);
  border-radius: 7px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-weight: 800;
}

.panel-link-button:hover {
  border-color: rgba(245, 245, 245, 0.42);
  background: rgba(245, 245, 245, 0.10);
}

.readiness,
.request,
.detail-box {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  background: #111712;
}

.readiness {
  display: grid;
  gap: 3px;
}

.readiness strong {
  font-size: 13px;
}

.readiness span,
.request {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.request strong {
  color: var(--text);
}

.readiness.ok {
  border-color: rgba(245, 245, 245, 0.42);
}

.readiness.wait {
  border-color: rgba(240, 199, 106, 0.34);
}

.detail-box {
  color: var(--muted);
  font-size: 12px;
  overflow: auto;
  max-height: 260px;
}

.detail-box dl {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
}

.detail-box dt {
  color: var(--text);
  font-weight: 700;
}

.detail-box dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.loading-line,
.error-inline,
.terrain-note,
.terrain-title {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.error-inline {
  color: #ffd4d1;
}

.terrain-title {
  color: var(--text);
  font-weight: 700;
}

.terrain-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 0;
  width: min(100%, 240px);
  margin-top: 8px;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: #0d120e;
  overflow: hidden;
  image-rendering: pixelated;
}

.terrain-cell {
  aspect-ratio: 1;
  border-radius: 0;
  min-width: 0;
}

.hover-card {
  position: absolute;
  max-width: 280px;
  padding: 10px 12px;
  border: 1px solid rgba(218, 235, 220, 0.16);
  border-radius: 8px;
  background: rgba(16, 22, 18, 0.92);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.32);
  pointer-events: none;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  z-index: 5;
}

.hidden {
  display: none !important;
}

.side-panel {
  grid-area: side;
  border-right: 1px solid rgba(245, 245, 245, 0.12);
  background: #0d0d0d;
  overflow: auto;
  padding: 12px;
  box-shadow: 18px 0 52px rgba(0, 0, 0, 0.28);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
  padding: 12px 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(6, 10, 8, 0.36);
}

.reset-button {
  border: 1px solid rgba(218, 235, 220, 0.16);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.reset-button:hover {
  color: var(--text);
  border-color: rgba(245, 245, 245, 0.42);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 18px;
  line-height: 1.12;
}

h2 {
  font-size: 15px;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #07100a;
  background: var(--muted);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}

.status-pill.online {
  background: var(--green);
}

.status-pill.offline {
  background: var(--red);
}

.status-pill.unknown {
  background: var(--yellow);
}

.error-box {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(239, 116, 111, 0.35);
  border-radius: 8px;
  background: rgba(239, 116, 111, 0.1);
  color: #ffd4d1;
  font-size: 13px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.selection-summary {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(245, 245, 245, 0.34);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(26, 44, 31, 0.92), rgba(14, 20, 16, 0.92));
}

.selection-summary.empty {
  border-color: rgba(196, 220, 202, 0.14);
  background: rgba(23, 32, 25, 0.72);
}

.selection-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.selection-summary-head span {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 5px;
  color: #050505;
  background: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.selection-summary.empty .selection-summary-head span {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
}

.selection-summary-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.selection-summary-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.selection-summary-stats,
.chunk-detail-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.selection-summary-stats:empty {
  display: none;
}

.selection-summary-stats div,
.chunk-detail-summary div {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(196, 220, 202, 0.1);
  border-radius: 6px;
  background: rgba(5, 9, 7, 0.32);
}

.selection-summary-stats span,
.chunk-detail-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.selection-summary-stats strong,
.chunk-detail-summary strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.selection-summary .primary-action {
  width: 100%;
  margin-top: 10px;
}

.bottom-bar {
  grid-area: bottom;
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
  padding: 0 18px;
  border-top: 1px solid rgba(196, 220, 202, 0.12);
  background: rgba(8, 13, 10, 0.92);
  color: var(--muted);
  font-size: 13px;
  z-index: 20;
}

.bottom-bar strong {
  color: var(--text);
}

.connection-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(180deg, #fafafa, #8a8a8a);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.22);
  margin-left: auto;
}

.info-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(245, 245, 245, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.info-grid span,
.item-meta,
.coord {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.info-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.panel-section {
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}

.panel-dimensions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 14px;
}

.panel-dimension {
  min-height: 34px;
  border: 1px solid rgba(218, 235, 220, 0.14);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(6, 10, 8, 0.28);
  cursor: pointer;
}

.panel-dimension.active {
  color: #050505;
  border-color: rgba(245, 245, 245, 0.68);
  background: linear-gradient(180deg, #f5f5f5, #a3a3a3);
  font-weight: 800;
}

.structure-filter {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.filter-title button {
  border: 0;
  color: var(--green);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

.structure-toggle {
  display: flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(218, 235, 220, 0.12);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(12, 18, 14, 0.76);
  cursor: pointer;
}

.structure-toggle span {
  width: 24px;
  color: var(--green);
}

.structure-toggle.active {
  color: var(--text);
  border-color: rgba(245, 245, 245, 0.32);
  box-shadow: 0 0 0 1px rgba(245, 245, 245, 0.12) inset;
}

.structure-toggle::after {
  content: "";
  display: inline-grid;
  place-items: center;
  width: 13px;
  height: 13px;
  margin-left: auto;
  border: 1px solid rgba(218, 235, 220, 0.28);
  border-radius: 3px;
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.structure-toggle.active::after {
  content: "✓";
  border-color: var(--green);
  background: rgba(245, 245, 245, 0.22);
}

.search-controls {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.search-controls label {
  display: grid;
  gap: 7px;
}

.search-controls select,
.coord-inputs input {
  min-width: 0;
  height: 34px;
  border: 1px solid rgba(218, 235, 220, 0.14);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--text);
  background: #101010;
}

.coord-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr 94px;
  gap: 6px;
}

.coord-inputs button {
  border: 1px solid rgba(245, 245, 245, 0.48);
  border-radius: 6px;
  color: #050505;
  background: linear-gradient(180deg, #f5f5f5, #a3a3a3);
  cursor: pointer;
  font-weight: 800;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

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

.search {
  width: 100%;
  height: 38px;
  margin-bottom: 10px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #101010;
  color: var(--text);
  outline: none;
}

.search:focus {
  border-color: rgba(245, 245, 245, 0.62);
}

.list {
  display: grid;
  gap: 6px;
}

.list.empty {
  padding: 12px;
  border: 1px dashed rgba(218, 235, 220, 0.18);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.item {
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(16, 16, 16, 0.9);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.item:hover {
  border-color: rgba(245, 245, 245, 0.45);
  background: rgba(30, 30, 30, 0.95);
  transform: translateY(-1px);
}

.mode-three .app-shell {
  grid-template-columns: 0 minmax(0, 1fr);
}

.mode-three .side-panel {
  display: none;
}

.mode-three .map-pane {
  grid-area: map;
}

.mode-catalog .app-shell {
  grid-template-columns: 0 minmax(0, 1fr);
}

.mode-catalog .side-panel {
  display: none;
}

.mode-intel .map-legend,
.mode-catalog .map-legend {
  display: none;
}

.mode-catalog .map-pane {
  grid-area: map;
}

.mode-three .panel-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

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

.mode-three .panel-section:nth-of-type(2) {
  border-top-color: rgba(245, 245, 245, 0.32);
}

.mode-three .three-panel {
  background: #070707;
}

.mode-three .map-toolbar,
.mode-three .map-legend,
.mode-three .map-zoom-rail,
.mode-three .map-scale {
  display: none;
}

.mode-catalog .map-toolbar,
.mode-catalog .map-legend,
.mode-catalog .map-zoom-rail,
.mode-catalog .map-scale {
  display: none;
}

.item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 700;
}

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

.tag {
  padding: 3px 6px;
  border-radius: 5px;
  color: #07100a;
  background: var(--yellow);
  font-size: 11px;
  font-weight: 700;
}

.top-bar,
.brand-cube,
.dimension-tabs,
.tool-buttons,
.three-status,
.three-badge,
.three-left-dock,
.three-position-card,
.three-inspector,
.three-controlbar,
.map-legend,
.map-zoom-rail,
.intel-grid article,
.hover-card,
.side-panel,
.connection-dot {
  box-shadow: none;
}

.dimension-tabs,
.tool-buttons,
.three-left-dock,
.three-position-card,
.three-inspector,
.three-controlbar,
.map-legend,
.map-zoom-rail {
  backdrop-filter: none;
}

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

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 56vh auto auto;
    grid-template-areas:
      "top"
      "map"
      "side"
      "bottom";
    height: auto;
    min-height: 100vh;
  }

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

  .top-bar,
  .bottom-bar {
    flex-wrap: wrap;
    height: auto;
    padding: 10px;
    gap: 10px;
  }

  .top-nav {
    justify-content: flex-start;
    width: 100%;
  }

  .map-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-legend {
    display: none;
  }

  .map-zoom-rail {
    right: 12px;
    bottom: 16px;
  }

  .intel-grid {
    grid-template-columns: 1fr;
  }

  .mode-three .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "map"
      "bottom";
  }

  .three-inspector {
    top: 64px;
    right: 10px;
    width: min(280px, calc(100% - 20px));
  }

  .three-left-dock {
    left: 10px;
  }

  .three-position-card {
    display: none;
  }

  .three-controlbar {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    min-width: 0;
    transform: none;
    gap: 10px;
  }

  .three-controlbar input {
    width: 88px;
  }
}

body.is-mobile {
  overflow: hidden;
}

body.is-mobile .app-shell {
  grid-template-columns: 1fr;
  grid-template-rows: 48px minmax(0, 1fr);
  grid-template-areas:
    "top"
    "map";
  height: 100svh;
  min-height: 0;
}

body.is-mobile .top-bar {
  height: 48px;
  min-height: 48px;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 6px 8px;
  overflow: hidden;
}

body.is-mobile .brand {
  min-width: auto;
  gap: 6px;
}

body.is-mobile .brand strong,
body.is-mobile .top-meta,
body.is-mobile .status-pill,
body.is-mobile .bottom-bar,
body.is-mobile .side-panel {
  display: none;
}

body.is-mobile .brand-cube {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

body.is-mobile .top-nav {
  width: auto;
  min-width: 0;
  margin-left: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

body.is-mobile .top-nav::-webkit-scrollbar {
  display: none;
}

body.is-mobile .mode-tab {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

body.is-mobile .map-pane {
  grid-area: map;
  min-height: 0;
}

body.is-mobile .map-toolbar {
  top: 8px;
  left: 8px;
  right: 8px;
  align-items: flex-start;
  flex-direction: row;
}

body.is-mobile .dimension-tabs {
  max-width: calc(100vw - 74px);
  overflow-x: auto;
  padding: 4px;
}

body.is-mobile .tab {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 8px;
  font-size: 11px;
}

body.is-mobile .map-notice {
  top: 52px;
  left: 8px;
  right: 8px;
  max-width: none;
  padding: 8px 10px;
  font-size: 12px;
}

body.is-mobile .map-legend {
  display: none;
}

body.is-mobile .three-controlbar {
  align-items: center;
  gap: 6px;
  padding: 7px;
}

body.is-mobile .three-controlbar strong,
body.is-mobile .control-check {
  display: none;
}

body.is-mobile .three-view-switch,
body.is-mobile .building-sample-switch,
body.is-mobile .three-vertical-switch {
  order: -1;
}

body.is-mobile .three-controlbar .three-view-toggle,
body.is-mobile .three-controlbar .building-sample-toggle,
body.is-mobile .three-controlbar button {
  padding: 6px 8px;
  font-size: 11px;
}

body.is-mobile .three-controlbar label {
  gap: 6px;
  font-size: 11px;
}

body.is-mobile .hover-card {
  display: none;
}

body.is-mobile .intel-overlay {
  padding: 58px 8px 8px;
}

body.is-mobile .three-badge,
body.is-mobile .three-left-dock,
body.is-mobile .three-position-card,
body.is-mobile .three-inspector {
  display: none;
}
