:root {
  --bg: #090b0e;
  --panel: #101318;
  --panel-2: #151920;
  --line: #282e38;
  --line-soft: #1c222a;
  --text: #eeeae1;
  --muted: #9aa2ae;
  --dim: #69717d;
  --accent: #e6b76e;
  --topbar-h: 78px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: radial-gradient(circle at 35% 20%, #15191f 0, var(--bg) 44%); }
button, input, select { font: inherit; }

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 18px 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 11, 14, .95);
}

.brand { min-width: 275px; }
.eyebrow { display: block; margin-bottom: 2px; color: var(--accent); font-size: 9px; letter-spacing: .22em; }
h1 { margin: 0; font-size: 24px; font-weight: 420; letter-spacing: -.02em; }
h1 strong { color: var(--accent); font-weight: 720; }

.toolbar { display: flex; align-items: flex-end; justify-content: flex-end; gap: 10px; min-width: 0; }
.field { display: grid; gap: 4px; color: var(--muted); font-size: 9px; letter-spacing: .11em; text-transform: uppercase; }
.field input, .field select {
  height: 34px;
  min-width: 190px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
  color: var(--text);
  background: var(--panel-2);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}
.field--search input { min-width: 128px; width: 128px; text-transform: uppercase; }
.field input:focus, .field select:focus { border-color: #b98e54; box-shadow: 0 0 0 2px rgba(230,183,110,.11); }

.button-group { display: flex; gap: 4px; }
button {
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
}
button:hover, button:focus-visible { border-color: #6b7480; background: #1c222a; outline: none; }
.button-group button { width: 34px; font-size: 18px; }
.button-group .wide { width: auto; font-size: 11px; }

.workspace { height: calc(100vh - var(--topbar-h)); display: grid; grid-template-columns: minmax(0, 1fr) 420px; }
.map-stage { position: relative; min-width: 0; overflow: hidden; background: #0b0e12; }
#atlas { display: block; width: 100%; height: 100%; cursor: grab; outline: none; }
#atlas.is-dragging { cursor: grabbing; }

.map-meta {
  position: absolute;
  top: 13px;
  left: 15px;
  display: flex;
  gap: 8px;
  pointer-events: none;
}
.map-meta span, .gesture-hint {
  padding: 5px 8px;
  border: 1px solid rgba(72,80,91,.55);
  border-radius: 3px;
  color: #b3bac3;
  background: rgba(9,11,14,.78);
  backdrop-filter: blur(5px);
  font-size: 9px;
  letter-spacing: .06em;
}
.gesture-hint { position: absolute; right: 15px; bottom: 13px; pointer-events: none; }

.axis {
  position: absolute;
  display: flex;
  gap: 6px;
  align-items: center;
  color: #6f7884;
  font-size: 9px;
  pointer-events: none;
}
.axis b { color: #b0b8c1; letter-spacing: .08em; }
.axis--x { left: 50%; bottom: 14px; transform: translateX(-50%); }
.axis--y { left: 13px; top: 50%; width: 310px; transform: translate(-47%, -50%) rotate(-90deg); justify-content: center; }

.hover-card {
  position: absolute;
  z-index: 10;
  width: 350px;
  min-height: 132px;
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 13px;
  padding: 9px;
  border: 1px solid #515b67;
  border-radius: 7px;
  background: rgba(15,18,23,.96);
  box-shadow: 0 18px 54px rgba(0,0,0,.46);
  pointer-events: none;
}
.hover-card[hidden] { display: none; }
.hover-card img { width: 116px; height: 116px; object-fit: cover; border-radius: 4px; background: #080a0d; }
.hover-copy { min-width: 0; padding: 2px 4px 1px 0; }
.hover-id { display: flex; align-items: center; gap: 7px; color: var(--accent); font: 700 11px/1.2 ui-monospace, Consolas, monospace; }
.hover-id i { width: 7px; height: 7px; border-radius: 50%; }
.hover-copy strong { display: block; margin: 7px 0 5px; font-size: 13px; }
.hover-copy p { margin: 0 0 7px; color: #d0d4da; font-size: 10px; line-height: 1.4; }
.hover-copy small { display: block; color: var(--muted); font-size: 9px; line-height: 1.35; }

.sidebar { min-width: 0; overflow-y: auto; border-left: 1px solid var(--line); background: rgba(16,19,24,.98); }
.sidebar-section { padding: 15px 16px; border-bottom: 1px solid var(--line); }
.sidebar-section--intro { background: linear-gradient(145deg, rgba(230,183,110,.06), transparent 55%); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 9px; color: #d9dde2; font-size: 10px; letter-spacing: .11em; text-transform: uppercase; }
.section-heading b { color: var(--accent); font-size: 9px; }
.section-heading button { height: auto; padding: 0; border: 0; color: #9fa7b1; background: none; font-size: 9px; text-transform: lowercase; }
.sidebar p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.52; }
details { margin-top: 10px; color: #aeb5be; font-size: 10px; }
summary { cursor: pointer; color: #d5d9de; }
details p { margin-top: 8px; }

.legend { display: grid; gap: 4px; }
.legend-item {
  width: 100%; height: 33px; padding: 0 8px;
  display: grid; grid-template-columns: 9px 25px 1fr auto; gap: 7px; align-items: center;
  border-color: transparent; background: transparent; text-align: left; font-size: 10px;
}
.legend-item:hover { border-color: var(--line); }
.legend-item.is-active { border-color: #59616d; background: #1b2027; }
.legend-item.is-muted { opacity: .35; }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; }
.legend-number { color: #747d89; font: 10px ui-monospace, Consolas, monospace; }
.legend-name { overflow: hidden; color: #d9dce0; text-overflow: ellipsis; white-space: nowrap; }
.legend-count { color: #7f8894; font: 9px ui-monospace, Consolas, monospace; }

.detail-panel { min-height: 215px; }
.detail-placeholder { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; }
.detail-placeholder span { color: var(--accent); font-size: 18px; }
.detail-card-head { display: block; margin-bottom: 11px; }
.detail-card-head img {
  display: block;
  width: 100%;
  height: min(52vh, 480px);
  margin-bottom: 12px;
  border-radius: 4px;
  object-fit: contain;
  background: #080a0d;
}
.detail-card-head h2 { margin: 3px 0 4px; font-size: 16px; }
.detail-card-head .cluster-label { display: block; margin-bottom: 6px; font-size: 10px; }
.detail-card-head small { color: var(--dim); font: 9px/1.4 ui-monospace, Consolas, monospace; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 10px; padding: 0; list-style: none; }
.tag-list li { padding: 3px 6px; border: 1px solid #343b46; border-radius: 99px; color: #c7ccd2; font-size: 9px; }
.detail-tag-label { margin: 0 0 6px !important; color: #77808b !important; font-size: 8px !important; letter-spacing: .05em; text-transform: uppercase; }
.detail-region { margin-bottom: 9px !important; color: #cbd0d6 !important; }
.detail-note { color: #777f8a !important; font-size: 9px !important; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 285px; }
  .field select { min-width: 150px; }
  .brand { min-width: 210px; }
}

@media (max-width: 760px) {
  :root { --topbar-h: 122px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 8px; padding: 10px 12px; }
  .brand { min-width: 0; }
  .toolbar { width: 100%; justify-content: flex-start; }
  .field select { min-width: 150px; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .axis--y { display: none; }
}
