/* ==========================================================
   LUTHERIELAB DARK THEME (Color-blind safe • Okabe & Ito)
   ========================================================== */
:root {
  /* ---- Neutrals ---- */
  --bg: #0f1115;
  --panel: #151922;
  --panel-hover: #1a1f2b;
  --ink: #e6e9ef;
  --muted: #9aa4b2;
  --radius: 14px;
  --white: var(--ink);
  --border-strong: color-mix(in srgb, var(--ink) 12%, var(--bg));
  --border-soft: color-mix(in srgb, var(--ink) 6%, var(--bg));
  --thumb-border: color-mix(in srgb, var(--panel) 80%, var(--bg));
  --track-neutral: color-mix(in srgb, var(--ink) 16%, var(--bg));
  --track-muted: color-mix(in srgb, var(--muted) 65%, var(--bg));

  /* ---- Okabe & Ito palette ---- */
  --orange:  #E69F00; /* Total / main accent */
  --blue:    #56B4E9; /* Top */
  --green:   #009E73; /* Back */
  --purple:  #CC79A7; /* Air */
  --yellow:  #F0E442; /* Sides */
  --vermilion: #D55E00; /* Alert / secondary contrast */
}

/* ==========================================================
   BASE ELEMENTS
   ========================================================== */
* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial;
  background: var(--bg);
  color: var(--ink);
}

/* ---------- Header ---------- */
header {
  padding: 14px 18px;
  border-bottom: 1px solid #1c2130;
  background: var(--panel);
}
header h1 {
  margin: 0 0 6px 0;
  font-size: 17px;
  letter-spacing: 0.2px;
}
header .muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

/* ---------- Grid layout ---------- */
main {
  display: grid;
  gap: 16px;
  padding: 16px;
  grid-template-columns: 360px 1fr;
}
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
}

/* ---------- Card panels ---------- */
.card {
  background: var(--panel);
  border: 1px solid #1c2230;
  border-radius: var(--radius);
  transition: background 0.2s ease;
}
.card:hover { background: var(--panel-hover); }

.pad { padding: 14px; }

/* ==========================================================
   TYPOGRAPHY
   ========================================================== */
h3.section {
  border-bottom: 1px solid #222a3a;
  padding-bottom: 6px;
  margin: 14px 0 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
label { color: var(--muted); }
.val {
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}
.small {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* ==========================================================
   CONTROLS
   ========================================================== */
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
}
input[type=range] {
  width: 100%;
  cursor: pointer;
}
select,
input[type="range"]#model_order {
  width: 100%;
}

button {
  border: 1px solid #2a3245;
  background: var(--panel-hover);
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.2s ease, color 0.2s ease;
}
button:hover {
  background: var(--orange);
  color: #000;
}
button:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* ==========================================================
   CANVAS + LEGEND
   ========================================================== */
canvas {
  display: block;
  width: 100%;
  height: 440px;
  background: #0b0f16;
  border-radius: var(--radius);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 12px;
  color: var(--muted);
  align-items: center;
  font-size: 16px;
}
.legend > div {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.sw {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 6px;
}
.sw.total  { background: var(--orange); }
.sw.top    { background: var(--blue); }
.sw.back   { background: var(--green); }
.sw.air    { background: var(--purple); }
.sw.sides  { background: var(--yellow); }
.sw.dipole { background: #fdae36; }
.sw.tripole{ background: #a855f7; }
.sw.muted  { opacity: 0.3; }
.sw.current { background: #61a8ff; }
.sw.whatif  { background: #ff9a5c; }

/* ==========================================================
   BADGES + PEAK LIST
   ========================================================== */
.badge {
  display: inline-block;
  background: #1f2636;
  border: 1px solid #2a3245;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}

#peak_list {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}
#peak_list .pl-item {
  margin: 0;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

/* ==========================================================
   SCROLLBAR (optional polish)
   ========================================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--orange);
}
