/* ============================================================
   VIZ 1.2 — Supply & demand clearing
   ============================================================ */

.viz12 {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px 24px 18px;
  gap: 12px;
}

/* ----- Mode toggle ----- */
.viz12-header {
  display: flex;
  justify-content: center;
}
.viz12-mode-toggle {
  display: inline-flex;
  background: rgba(26, 36, 54, 0.06);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
body.theme-dark .viz12-mode-toggle {
  background: rgba(255, 255, 255, 0.06);
}
.viz12-mode-btn {
  background: none;
  border: none;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-family: inherit;
}
.viz12-mode-btn:hover { color: var(--text); }
.viz12-mode-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(26, 36, 54, 0.10);
}
body.theme-dark .viz12-mode-btn.active {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.viz12-mode-btn i { font-size: 15px; }

/* ----- Chart ----- */
.viz12-chart-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.viz12-chart {
  width: 100%;
  height: auto;
  max-height: 100%;
  font-family: "Lato", -apple-system, sans-serif;
}

/* Dark mode adjustments */
body.theme-dark .viz12-chart line[stroke="#1a2436"],
body.theme-dark .viz12-chart line[stroke="#4a5670"] {
  stroke: #b8bacc;
}
body.theme-dark .viz12-chart text[fill="#1a2436"] { fill: #e8e8ef; }
body.theme-dark .viz12-chart text[fill="#4a5670"] { fill: #b8bacc; }
body.theme-dark .viz12-chart text[fill="#8090a8"] { fill: #8090a8; }
body.theme-dark .viz12-chart circle[fill="#1a2436"] { fill: #e8e8ef; }
body.theme-dark .viz12-chart circle[stroke="#fff"] { stroke: #232639; }

/* ----- Controls ----- */
.viz12-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.viz12-slider-label {
  font-size: 12px;
  color: var(--text-mute);
  text-align: center;
  letter-spacing: 0.3px;
}
#viz12-slider {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(26, 36, 54, 0.15);
  appearance: none;
  outline: none;
  cursor: pointer;
}
body.theme-dark #viz12-slider {
  background: rgba(255, 255, 255, 0.15);
}
#viz12-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(26, 36, 54, 0.2);
  transition: transform 0.15s;
}
#viz12-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
#viz12-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
  border: 2px solid var(--bg-card);
}

.viz12-readouts {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  padding: 10px 0 4px;
  border-top: 0.5px solid var(--rule);
  border-bottom: 0.5px solid var(--rule);
}
.viz12-readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}
.viz12-readout-label {
  font-size: 10px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.viz12-readout-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.viz12-readout-price { color: var(--accent); }
.viz12-readout-marginal { font-size: 14px; }
.viz12-readout-unit {
  font-size: 10px;
  color: var(--text-mute);
}

.viz12-story {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-soft);
  text-align: center;
  font-style: italic;
  min-height: 32px;
  padding: 0 8px;
}

@media (max-width: 900px) {
  .viz12 { padding: 16px; }
  .viz12-mode-btn { padding: 6px 14px; font-size: 12px; }
  .viz12-readout-value { font-size: 16px; }
}
