*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: #0d1117;
  color: #e6edf3;
  font-family: 'Segoe UI', system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
header {
  padding: 10px 20px;
  background: #161b22;
  border-bottom: 2px solid #f0b429;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
header h1 {
  font-size: 1rem;
  color: #f0b429;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.sidebar {
  width: 280px;
  background: #161b22;
  border-right: 1px solid #30363d;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 10px;
  flex-shrink: 0;
}
.sidebar label {
  font-size: 0.72rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.spread-control {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.input-control {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.spread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.spread-head label {
  margin: 0;
}
#spread-input {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  appearance: none;
  background: linear-gradient(90deg, #f0b429 var(--spread-pct, 4.5%), #30363d var(--spread-pct, 4.5%));
  outline: none;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px #00000055;
}
#spread-input::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: transparent;
}
#spread-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f0b429;
  border: 2px solid #0d1117;
  margin-top: -4px;
  box-shadow: 0 0 0 1px #f0b42988;
}
#spread-input::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: transparent;
}
#spread-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f0b429;
  border: 2px solid #0d1117;
  box-shadow: 0 0 0 1px #f0b42988;
}
#spread-input:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px #f0b4293d;
}
#spread-input:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 4px #f0b4293d;
}
#dfs-start-input {
  width: 100%;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #3b424b;
  background: linear-gradient(180deg, #151b23 0%, #10161d 100%);
  color: #e6edf3;
  padding: 0 12px;
  font-size: 0.84rem;
  font-family: 'Consolas', 'Cascadia Code', monospace;
  font-weight: 600;
  letter-spacing: 0.2px;
  outline: none;
  box-shadow: inset 0 1px 0 #ffffff0d, inset 0 0 0 1px #0000002a;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
  appearance: textfield;
  -moz-appearance: textfield;
}
#dfs-start-input::placeholder {
  color: #7b8491;
}
#dfs-start-input:focus-visible {
  border-color: #f0b429;
  background: linear-gradient(180deg, #1a212b 0%, #121923 100%);
  box-shadow: 0 0 0 3px #f0b4292a, inset 0 1px 0 #ffffff14;
}
#dfs-start-input:hover {
  border-color: #4a535e;
}
#dfs-start-input::-webkit-outer-spin-button,
#dfs-start-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#dfs-start-hint {
  font-size: 0.72rem;
  color: #f0b429;
  font-family: 'Consolas', 'Cascadia Code', monospace;
  background: #f0b4291a;
  border: 1px solid #f0b42944;
  border-radius: 999px;
  padding: 1px 8px;
}
#spread-value {
  font-size: 0.72rem;
  color: #f0b429;
  font-family: 'Consolas', 'Cascadia Code', monospace;
  background: #f0b4291a;
  border: 1px solid #f0b42944;
  border-radius: 999px;
  padding: 1px 8px;
}
textarea {
  display: none;
}
.btn-row { display: flex; gap: 8px; }
button {
  background: #f0b429;
  color: #0d1117;
  border: none;
  border-radius: 6px;
  padding: 9px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  transition: background 0.15s;
}
.btn-row button { flex: 1; }
button:hover { background: #d4a017; }
button.secondary {
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
}
button.secondary:hover { background: #30363d; }
#graph-area {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #0d1117;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  cursor: grab;
}
#graph-area.panning { cursor: grabbing; }
svg#graph-svg { display: block; width: 100%; height: 100%; }
#graph-area.optimize-running #graph-svg {
  animation: optimizePulse 650ms ease;
}
@keyframes optimizePulse {
  0%   { filter: saturate(1) brightness(1); }
  45%  { filter: saturate(1.35) brightness(1.2); }
  100% { filter: saturate(1) brightness(1); }
}
.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #484f58;
  pointer-events: none;
  user-select: none;
}
.empty-state svg { opacity: 0.4; }
.empty-state p { font-size: 0.85rem; margin-top: 10px; }
.error-msg {
  background: #3d1a1a;
  border: 1px solid #8b2e2e;
  border-radius: 6px;
  color: #ff8080;
  font-size: 0.78rem;
  padding: 8px 10px;
  display: none;
}
