.relu-regions-widget.relu-widget {
  width: 100%;
  margin: 1.5rem auto;
  padding: 1rem;
  box-sizing: border-box;
  border: 1px solid var(--pst-color-border, #d8dee9);
  border-radius: 0.75rem;
  background: var(--pst-color-surface, #ffffff);
  color: var(--pst-color-text-base, #172033);
}

.relu-widget__layout {
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
  justify-content: center;
  gap: 1.25rem;
  align-items: stretch;
}

/* .relu-widget__controls {
  display: grid;
  gap: 0.85rem;
  position: sticky;
  top: 1rem;
} */
.relu-widget__controls {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-self: stretch;
}

.relu-widget__section-title {
  margin: 0.15rem 0 -0.25rem;
  font-size: 0.93rem;
  font-weight: 700;
}

.relu-widget__section-title--output {
  margin-top: auto;
}

.relu-widget__equation {
  padding: 0.5rem;
  border-radius: 0.5rem;
  background: var(--pst-color-background, #f4f7fb);
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}

.relu-widget__control {
  display: grid;
  gap: 0.35rem;
  margin: 0;
}

.relu-widget__control-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}

.relu-widget__value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.relu-widget__control input[type="range"] {
  width: 100%;
  margin: 0;
}

.relu-widget__toggles {
  display: grid;
  gap: 0.45rem;
  padding: 0.7rem;
  border-radius: 0.5rem;
  background: var(--pst-color-background, #f4f7fb);
}

.relu-widget__toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-size: 0.88rem;
}

.relu-widget__toggle input {
  margin: 0;
}

/* Vertical legend */
/* .relu-widget__legend {
  display: grid;
  gap: 0.45rem;
  font-size: 0.83rem;
} */

/* Horizontal legend */
.relu-widget__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  margin-top: 0.7rem;
  font-size: 0.83rem;
}

.relu-widget__legend > span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.relu-widget__legend-swatch {
  width: 1.15rem;
  height: 0.85rem;
  border: 1px solid #94a3b8;
  border-radius: 0.2rem;
  flex: 0 0 auto;
}

.relu-widget__legend-swatch--class0 {
  background: #dbeafe;
}

.relu-widget__legend-swatch--class1 {
  background: #fee2e2;
}

.relu-widget__legend-line {
  width: 1.35rem;
  height: 0;
  flex: 0 0 auto;
}

.relu-widget__legend-line--threshold {
  border-top: 2px dashed #6b7280;
}

.relu-widget__legend-line--decision {
  border-top: 3px solid #111827;
}

.relu-widget__reset {
  width: 100%;
  padding: 0.48rem 0.75rem;
  border: 1px solid var(--pst-color-border, #aab4c3);
  border-radius: 0.4rem;
  background: var(--pst-color-surface, #ffffff);
  color: inherit;
  cursor: pointer;
}

.relu-widget__reset:hover {
  background: var(--pst-color-background, #f4f7fb);
}

.relu-widget__reset:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.relu-widget__figures {
  display: grid;
  gap: 1.5rem;
  min-width: 0;
}

.relu-widget__figure {
  min-width: 0;
  margin: 0;
}

.relu-widget__figure + .relu-widget__figure {
  padding-top: 1.25rem;
  border-top: 1px solid var(--pst-color-border, #d8dee9);
}

.relu-widget__figure-title {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 700;
}

.relu-widget__figure-description {
  margin: 0 0 0.65rem;
  color: var(--pst-color-text-muted, #536174);
  font-size: 0.88rem;
}

.relu-widget__canvas {
  display: block;
  width: 100%;
  height: auto;
  min-height: 320px;
  border: 1px solid var(--pst-color-border, #d8dee9);
  border-radius: 0.5rem;
  background: #ffffff;
}

.relu-widget__status {
  margin: 0.55rem 0 0;
  color: var(--pst-color-text-muted, #536174);
  font-size: 0.84rem;
}

@media (max-width: 760px) {
  .relu-regions-widget.relu-widget {
    width: 100%;
  }

  .relu-widget__layout {
    grid-template-columns: 1fr;
  }

  .relu-widget__controls {
    position: static;
  }

  .relu-widget__canvas {
    min-height: 280px;
  }
}

@media (prefers-color-scheme: dark) {
  .relu-regions-widget.relu-widget {
    background: var(--pst-color-surface, #1f2630);
    color: var(--pst-color-text-base, #e8edf4);
  }

  .relu-widget__equation,
  .relu-widget__toggles,
  .relu-widget__reset:hover {
    background: var(--pst-color-background, #161b22);
  }

  .relu-widget__reset {
    background: var(--pst-color-surface, #1f2630);
  }
}
