/* Classifier Explorer styles (shared by the SVM, Naive Bayes and XGBoost tabs) */
:root {
  --bg: #ffffff;
  --fg: #2C2C2A;
  --muted: #5F5E5A;
  --line: #D3D1C7;
  --panel: #F7F6F2;
  --accent: #2C2C2A;
  --btn-on-bg: #2C2C2A;
  --btn-on-fg: #ffffff;
  --logo: #185FA5;
}

:root[data-theme="dark"] {
  --bg: #000000;
  --fg: #F1EFE8;
  --muted: #B4B2A9;
  --line: #444441;
  --panel: #121211;
  --accent: #F1EFE8;
  --btn-on-bg: #F1EFE8;
  --btn-on-fg: #000000;
  --logo: #85B7EB;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
}

body {
  font-family: "Times New Roman", Times, serif;
  font-size: 17px;
  line-height: 1.5;
}

.stat b,
.slider span {
  font-variant-numeric: tabular-nums;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 16px 16px;
}

/* desktop: logo bottom-left (level with the formula), titles centered, toggle top-right */
header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "brand titles theme";
  align-items: end;
  text-align: center;
  margin-bottom: 8px;
  column-gap: 16px;
}

.brand {
  grid-area: brand;
  justify-self: start;
  align-self: end;
  margin-bottom: 4px;
}

.titles {
  grid-area: titles;
}

#theme {
  grid-area: theme;
  justify-self: end;
  align-self: start;
}

@media (max-width: 820px) {
  header {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand theme" "titles titles";
    align-items: center;
    row-gap: 8px;
  }

  #theme {
    align-self: center;
  }
}

.brand {
  display: block;
  color: var(--logo);
  line-height: 0;
}

.logo {
  height: 84px;
  width: auto;
  display: block;
}

/* centered on the title block; widest that keeps the heading centered */
@media (max-width: 820px) {
  .logo {
    height: 54px;
  }

  .brand {
    align-self: center;
  }
}

.app-title {
  font-size: 21px;
  font-weight: 400;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 2px;
}

.kernel {
  font-weight: 700;
  font-size: 34px;
  margin: 0;
  line-height: 1.25;
}

.sub {
  color: var(--muted);
  font-size: 18px;
}

.formula {
  font-size: 20px;
  margin-top: 2px;
  min-height: 30px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "stage aside" "byline controls";
  column-gap: 20px;
  row-gap: 0;
  margin-top: 12px;
  align-items: stretch;
}

#stage {
  grid-area: stage;
}

aside {
  grid-area: aside;
  padding-bottom: 14px;
}

.controls {
  grid-area: controls;
}

#param-slot {
  display: flow-root;
  min-height: 70px;
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "stage" "aside" "controls" "byline";
    row-gap: 16px;
  }

  .kernel {
    font-size: 27px;
  }
}

#stage {
  position: relative;
  min-height: 420px;
  border-radius: 0;
  background: transparent;
  border: 1px solid var(--line);
  cursor: grab;
  touch-action: none;
  overflow: hidden;
}

#stage:active {
  cursor: grabbing;
}

#stage canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.hint {
  position: absolute;
  left: 14px;
  bottom: 10px;
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
}

aside {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.group:first-child {
  border-top: 0;
  padding-top: 0;
}

.label {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 6px;
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

button {
  font: inherit;
  font-size: 15px;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 11px;
  cursor: pointer;
}

button:hover {
  border-color: var(--fg);
}

button.on {
  background: var(--btn-on-bg);
  color: var(--btn-on-fg);
  border-color: var(--btn-on-bg);
}

.slider {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.slider span {
  font-size: 15px;
  min-width: 64px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

input[type=range] {
  width: 100%;
  accent-color: var(--accent);
  grid-column: 1 / -1;
}

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

.stat {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 12px;
}

.stat b {
  display: block;
  font-weight: 500;
  font-size: 22px;
}

.legend div {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  margin: 3px 0;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}

.bar {
  width: 18px;
  height: 3px;
  background: var(--fg);
  flex: none;
}

.row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

@media (max-width: 820px) {
  #stage {
    height: auto;
    aspect-ratio: 1 / 1;
    min-height: 0;
  }
}

/* references footer: compact so it shows on first view at 100% zoom */
.refs {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}

.refs h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 2px;
}

.byline {
  grid-area: byline;
  align-self: end;
  padding-bottom: 7px;
  font-size: 15px;
  color: var(--fg);
}

.byline strong {
  font-weight: 700;
}

.byline .sep {
  color: var(--line);
  margin: 0 10px;
}

@media (max-width: 600px) {
  .byline {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 0;
  }

  .byline .sep {
    display: none;
  }
}

.byline a {
  color: var(--logo);
  text-decoration: none;
  font-weight: 700;
}

.byline a:hover {
  text-decoration: underline;
}

.refs ol {
  margin: 0;
  padding-left: 18px;
}

.refs li {
  margin: 1px 0;
  line-height: 1.35;
}

.refs a {
  color: var(--muted);
}

.refs a:hover {
  color: var(--fg);
}

/* model family tabs, centered under the header */
.family-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 6px;
}

.family-tabs button {
  font-size: 16px;
  padding: 6px 16px;
}

@media (max-width: 600px) {
  .family-tabs button {
    font-size: 14px;
    padding: 5px 10px;
  }
}

/* keep the page still when switching tabs: always reserve the scrollbar's space,
   so the layout does not jump sideways when the page height changes */
html {
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

#title {
  display: flex;
  align-items: center;
  justify-content: center;
}

#formula {
  display: flex;
  align-items: center;
  justify-content: center;
}

#kn {
  align-content: flex-start;
}

/* When the RBF width and Degree sliders are both shown (SVM adaptive kernels),
   put them side by side on one row, so the panel, and the plot beside it, keep
   the same height as every other model. */
#param-slot:has(#g-wrap:not([style*="none"])):has(#d-wrap:not([style*="none"])) #g-wrap,
#param-slot:has(#g-wrap:not([style*="none"])):has(#d-wrap:not([style*="none"])) #d-wrap {
  display: inline-grid;
  width: calc(50% - 6px);
  vertical-align: top;
}

#param-slot:has(#g-wrap:not([style*="none"])):has(#d-wrap:not([style*="none"])) #g-wrap {
  margin-right: 12px;
}

#param-slot:has(#g-wrap:not([style*="none"])):has(#d-wrap:not([style*="none"])) .slider span {
  min-width: 0;
}

#param-slot:has(#g-wrap:not([style*="none"])):has(#d-wrap:not([style*="none"])) .slider label {
  white-space: nowrap;
}

/* SVM adaptive kernels: comparison table shown in place of the legend */
.cmp {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.cmp th,
.cmp td {
  padding: 1px 0;
  text-align: right;
  font-weight: 400;
}

.cmp th:first-child,
.cmp td:first-child {
  text-align: left;
  color: var(--muted);
}

.cmp th {
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.cmp th.cur {
  color: var(--fg);
  font-weight: 700;
}

.cmp-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.3;
}

/* fixed column widths, so values and the bold header never shift the columns */
.cmp col.c-label {
  width: 50%;
}

.cmp col.c-val {
  width: 25%;
}

.cmp th,
.cmp td {
  white-space: nowrap;
}