*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: #0d1117;
  color: #c9d1d9;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 13px;
}

/* ─── Sidebar ─────────────────────────────────────────────────── */
#sidebar {
  width: 260px;
  min-width: 260px;
  background: #161b22;
  border-right: 1px solid #30363d;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  gap: 20px;
  overflow-y: auto;
}

.sidebar-title {
  font-size: 20px;
  font-weight: 700;
  color: #58a6ff;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

section {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #8b949e;
}

.value-badge {
  background: #1c2a3a;
  color: #58a6ff;
  border: 1px solid #264b72;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 24px;
  text-align: center;
}

/* Range */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #30363d;
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #58a6ff;
  border: 2px solid #0d1117;
  cursor: pointer;
  transition: background 0.15s;
}
input[type=range]::-webkit-slider-thumb:hover { background: #79b8ff; }
input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #58a6ff;
  border: 2px solid #0d1117;
  cursor: pointer;
}

.range-hints {
  display: flex;
  justify-content: space-between;
  color: #6e7681;
  font-size: 13px;
  margin-top: -4px;
}

/* Colors */
.color-row {
  display: flex;
  gap: 12px;
}
.color-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.color-label {
  font-size: 10px;
  color: #6e7681;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
input[type=color] {
  width: 100%;
  height: 40px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
  cursor: pointer;
  padding: 3px;
  transition: border-color 0.15s;
}
input[type=color]:hover { border-color: #58a6ff; }

/* Branch widget */
.hint {
  font-size: 12px;
  color: #6e7681;
  line-height: 1.65;
}
.dot-hint { color: #c9d1d9; }

#branchCanvas {
  display: block;
  border: 1px solid #30363d;
  border-radius: 8px;
  margin: 0 auto;
  cursor: default;
}

/* Segment badge (footer of sidebar) */
#segmentBadge {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid #6e7681;
  text-align: center;
}
#segmentCount {
  font-size: 13px;
  color: #6e7681;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}
#segmentCount.warn  { color: #f0883e; }

/* ─── WebGL canvas ────────────────────────────────────────────── */
#glCanvas {
  flex: 1;
  display: block;
  min-width: 0;
}
