/* ─── Tokens ─────────────────────────────────────────────────── */
:root {
  --bg:           #0f172a;
  --surface:      #1e293b;
  --surface-alt:  #162032;
  --border:       #2d3f55;
  --text:         #f1f5f9;
  --muted:        #64748b;
  --accent:       #378ADD;
  --win:          #1D9E75;
  --loss:         #D85A30;
  --mono:         "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  padding: 2rem 1.5rem;
  min-height: 100vh;
}

/* ─── Layout ─────────────────────────────────────────────────── */
.container { max-width: 1060px; margin: 0 auto; }

header {
  text-align: center;
  margin-bottom: 2rem;
}
header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
header p {
  color: var(--muted);
  margin-top: 0.25rem;
}

main {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 700px) {
  main { grid-template-columns: 1fr; }
  .sidebar { position: static !important; }
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 1.5rem;
}

/* Hero metric */
.metric-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
}
.metric-hero .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}
.metric-hero .val {
  font-size: 2.25rem;
  font-weight: 700;
  font-family: var(--mono);
  transition: color 0.2s;
  color: var(--text);
}

/* Mini grid */
.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mini {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}
.mini .ml {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 3px;
}
.mini .mv {
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--text);
}

/* Positive / negative / neutral state */
.pos     { color: var(--win)  !important; }
.neg     { color: var(--loss) !important; }
.neutral { color: var(--text) !important; }

/* Equation box */
.eq-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.875rem 1rem;
}
.eq-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}
.eq-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  padding: 2px 0;
}
.eq-row span:last-child {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}
.eq-row.total span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.eq-divider {
  border-top: 1px solid var(--border);
  margin: 6px 0;
}

/* Bar chart */
.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  height: 180px;
  position: relative;
}

/* ─── Panels ─────────────────────────────────────────────────── */
.panels {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.panel-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.panel-title i { font-size: 16px; }

.win-title   { color: var(--win);  }
.loss-title  { color: var(--loss); }
.scale-title { color: var(--accent); }

/* ─── Slider rows ────────────────────────────────────────────── */
.row {
  margin-bottom: 14px;
}
.row:last-child { margin-bottom: 0; }

.row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text);
}
.rval {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

/* Track + fill */
.track-wrap {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
}
.track-fill {
  position: absolute;
  left: 0;
  height: 4px;
  border-radius: 2px;
  pointer-events: none;
  transition: width 0.04s linear;
}
.win-fill   { background: var(--win);    }
.loss-fill  { background: var(--loss);   }
.scale-fill { background: var(--accent); }

/* ─── Range input ────────────────────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
  position: relative;
  z-index: 1;
  cursor: pointer;
}
input[type="range"]:focus { outline: none; }

/* Track */
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}
input[type="range"]::-moz-range-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

/* Thumb */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  margin-top: -6px;
  transition: transform 0.1s, box-shadow 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
