:root {
  color-scheme: light;
  --page: rgb(255, 253, 249);
  --paper: rgb(255, 253, 249);
  --paper-soft: #f7f7f5;
  --ink: #000000;
  --ink-soft: #28303d;
  --muted: #39414d;
  --secondary: #6d6d6d;
  --rule: #d1d1d1;
  --rule-soft: #e5e5e5;
  --blue: #2f5f7f;
  --blue-soft: #d1dfe4;
  --gray-blue: #abb8c3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 16px;
  font-weight: 300;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  width: min(1480px, calc(100vw - 34px));
  margin: 0 auto;
  padding: 8px 0 18px;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 14px;
}

.model-wall-link {
  color: #666666;
  font-size: 0.86rem;
  font-weight: 300;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid var(--gray-blue);
}

.model-wall-link:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--secondary);
  font-size: 0.76rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  max-width: 920px;
  font-size: clamp(2.1rem, 4.5vw, 4.6rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0;
}

.workspace {
  display: grid;
  grid-template-columns: 286px minmax(520px, 1fr) 338px;
  gap: 14px;
  align-items: stretch;
}

.control-panel,
.visual-panel,
.explain-panel {
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: none;
}

.control-panel,
.explain-panel {
  border-radius: 0;
  padding: 18px;
}

.visual-panel {
  border-radius: 0;
  min-width: 0;
  overflow: hidden;
}

.control-group,
.slider-group {
  margin-bottom: 16px;
}

.how-to-use {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}

.how-to-use h2 {
  margin-bottom: 7px;
  font-size: 1rem;
  font-weight: 300;
}

.how-to-use p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 300;
}

output {
  color: var(--secondary);
  font-weight: 300;
}

select {
  width: 100%;
  min-height: 41px;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--rule);
  border-radius: 0;
  font-weight: 300;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.split-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 16px 0 18px;
  padding: 0;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-radius: 0;
}

.mode-tab {
  min-height: 37px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-weight: 300;
  cursor: pointer;
}

.mode-tab + .mode-tab {
  border-left: 1px solid var(--rule);
}

.mode-tab.active {
  color: var(--ink);
  background: var(--blue-soft);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 74px;
  gap: 8px;
  margin-top: 20px;
}

button {
  min-height: 41px;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--rule);
  border-radius: 0;
  font-weight: 300;
  cursor: pointer;
}

button:hover,
select:hover {
  border-color: var(--muted);
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(47, 95, 127, 0.35);
  outline-offset: 2px;
}

.primary-button {
  color: var(--ink);
  background: var(--blue-soft);
  border-color: var(--gray-blue);
}

.visual-header {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 13px;
  border-bottom: 1px solid var(--rule);
}

.visual-header h2 {
  margin-bottom: 5px;
  font-size: 1.26rem;
  font-weight: 300;
}

.visual-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.model-wiki-link {
  display: inline-block;
  margin-top: 7px;
  color: #666666;
  font-size: 0.84rem;
  font-weight: 300;
  text-decoration: none;
  border-bottom: 1px solid var(--gray-blue);
}

.model-wiki-link:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 0.81rem;
  font-weight: 300;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.chart-wrap {
  padding: 10px 14px 16px;
}

#chart {
  width: 100%;
  display: block;
  background: var(--page);
  border: 1px solid var(--rule-soft);
  border-radius: 0;
}

.domain-bg {
  stroke: none;
  opacity: 0.24;
}

.axis-label {
  fill: var(--secondary);
  font-size: 12px;
  font-weight: 300;
}

.sample-point {
  stroke: var(--page);
  stroke-width: 1.2;
}

.sample-point.test {
  stroke: var(--ink);
  stroke-width: 1.35;
}

.boundary-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-dasharray: 7 6;
}

.tree-split {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0.58;
}

.centroid {
  stroke: var(--ink);
  stroke-width: 1.8;
  paint-order: stroke;
}

.density-ring {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  opacity: 0.14;
}

.support-vector {
  stroke: var(--ink);
  stroke-width: 1.1;
  opacity: 0.5;
}

.graph-link {
  stroke: var(--secondary);
  stroke-width: 0.7;
  opacity: 0.2;
}

.explain-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.metric-grid div {
  min-height: 72px;
  padding: 12px;
  background: var(--paper-soft);
  border: 1px solid var(--rule-soft);
  border-radius: 0;
}

.metric-grid div:first-child {
  grid-column: span 2;
}

.metric-label {
  display: block;
  margin-bottom: 7px;
  color: var(--secondary);
  font-size: 0.7rem;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-grid strong {
  font-size: 1.18rem;
  font-weight: 300;
}

.explain-panel section {
  border-top: 1px solid var(--rule);
  padding-top: 14px;
}

.explain-panel h3 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 300;
}

.explain-panel p,
.explain-panel li {
  color: var(--muted);
  line-height: 1.58;
  font-size: 0.93rem;
}

.explain-panel ul {
  margin: 0;
  padding-left: 18px;
}

.hidden {
  display: none;
}

.site-footer {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  color: var(--secondary);
  font-size: 0.68rem;
  font-weight: 300;
  text-align: right;
}

.site-footer a {
  color: #666666;
  font-size: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--gray-blue);
}

.site-footer a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 260px 1fr;
  }

  .explain-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100vw - 18px, 760px);
    padding-top: 8px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding-bottom: 18px;
  }

  h1 {
    font-size: clamp(2.1rem, 14vw, 3.45rem);
  }

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

  .visual-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .legend {
    justify-content: flex-start;
  }
}
