* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sidebar-width: 320px;
  --bg:            #0d1117;
  --surface:       #161b22;
  --border:        #30363d;
  --text:          #e6edf3;
  --text-muted:    #8b949e;
  --accent:        #2f9e44;
}

body {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── Sidebar ────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 10;
}

#sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

#sidebar-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

#sidebar-header p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Map ────────────────────────────────────────────────── */
#map {
  flex: 1;
  position: relative;
}

#sidebar-vars {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

#var-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.var-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}

.var-btn:hover {
  background: var(--border);
  color: var(--text);
}

.var-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ── Toolpit  ───────────────────────────────────────── */
#tooltip {
  display: none;
  position: absolute;
  background: rgba(13, 17, 23, 0.93);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 10px 14px;
  pointer-events: none;
  z-index: 20;
  min-width: 160px;
  max-width: 220px;
}

.tooltip-name {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 4px;
  line-height: 1.3;
}

.tooltip-id {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
}

.tooltip-value {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.tooltip-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Detail panel ───────────────────────────────────────── */
#detail-panel {
  position: absolute;
  bottom: 32px;
  left: 16px;
  width: 300px;
  max-height: 60vh;
  overflow-y: auto;
  background: rgba(13, 17, 23, 0.93);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  z-index: 20;
  backdrop-filter: blur(6px);
}

#detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

#detail-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
  padding-right: 8px;
}

#detail-title span {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}

#detail-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

#detail-close:hover {
  color: var(--text);
}

#detail-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-row-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.detail-row-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-row-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.detail-bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.detail-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.detail-row-pct {
  font-size: 9px;
  color: var(--text-muted);
  text-align: right;
}