:root {
  color-scheme: dark;
  --background: #171326;
  --surface: #211b37;
  --foreground: #f6f3ff;
  --muted: #b8b1ca;
  --border: rgba(255, 255, 255, 0.13);
  --border-strong: rgba(255, 255, 255, 0.22);
  --accent: #b59cff;
  --accent-bright: #d9ceff;
  --series-1: #7ec8ff;
  --series-2: #ffad66;
  --series-3: #79df9a;
  --series-4: #ff84bd;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 280px;
  background: var(--background);
}

body {
  margin: 0;
  color: var(--foreground);
  background:
    radial-gradient(circle at 92% 0, rgba(124, 90, 201, 0.25), transparent 25rem),
    var(--background);
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"] {
  cursor: pointer;
}

#dipole-real-height-bands {
  width: 100%;
  max-width: 960px;
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(16px, 3.5vw, 34px);
}

.embed-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.embed-heading p,
.embed-heading h1 {
  margin: 0;
}

.embed-heading p {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.embed-heading h1 {
  font-size: clamp(1.45rem, 4vw, 2.35rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.embed-heading > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.controls {
  display: grid;
  grid-template-columns: auto minmax(220px, 0.85fr) minmax(280px, 1.4fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 10px;
}

.controls label {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.button,
select {
  min-height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--foreground);
  background: var(--surface);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  font-weight: 800;
}

.button:hover,
.button:focus-visible,
select:hover,
select:focus-visible {
  border-color: var(--accent);
  outline: none;
  background: #332851;
}

.button[aria-pressed="true"] {
  border-color: var(--accent);
  color: #1b152b;
  background: var(--accent-bright);
}

select {
  width: 100%;
  padding: 0 38px 0 12px;
}

.range-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.range-head output {
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 42px;
  margin: 0;
  accent-color: var(--accent);
}

input[type="range"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.plot-wrap {
  width: 100%;
  overflow: hidden;
}

.plot {
  display: block;
  width: 100%;
  height: auto;
  max-height: 455px;
  color: var(--foreground);
}

.grid {
  fill: none;
  stroke: var(--border);
  stroke-width: 1;
}

.axis {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.2;
}

.band-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.band-40 {
  stroke: var(--series-1);
}

.band-20 {
  stroke: var(--series-2);
  stroke-dasharray: 9 4;
}

.band-15 {
  stroke: var(--series-3);
  stroke-dasharray: 12 4 2 4;
}

.band-10 {
  stroke: var(--series-4);
  stroke-dasharray: 2 5;
}

.label {
  fill: var(--muted);
  font-size: 12px;
}

.strong-label {
  fill: var(--foreground);
  font-size: 12px;
  font-weight: 700;
}

.legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

.legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend strong {
  color: var(--foreground);
}

.swatch {
  display: inline-block;
  width: 21px;
  height: 3px;
  margin-right: 2px;
  border-radius: 999px;
}

.swatch-40 {
  background: var(--series-1);
}

.swatch-20 {
  background: var(--series-2);
}

.swatch-15 {
  background: var(--series-3);
}

.swatch-10 {
  background: var(--series-4);
}

.detail {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

@media (max-width: 700px) {
  .controls {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .range-wrap {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .embed-heading {
    display: grid;
    gap: 8px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .range-wrap {
    grid-column: auto;
  }

  .plot {
    width: 130%;
    max-width: none;
    margin-left: -15%;
  }

  .legend {
    gap-inline: 12px;
  }
}
