:root {
  color-scheme: light;
  --bg: #eef2f8;
  --panel: #ffffff;
  --ink: #18202f;
  --muted: #5f6c80;
  --accent: #0b66d8;
  --accent-dark: #084d9f;
  --border: #d7deea;
  --shadow: 0 12px 30px rgba(22, 34, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #f8fbff, var(--bg));
  color: var(--ink);
}

.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 20px 18px;
  text-align: center;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  letter-spacing: -0.04em;
}

.hero p {
  margin: 0 auto;
  max-width: 820px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

main {
  max-width: 1220px;
  margin: 0 auto;
  padding: 12px 20px 50px;
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  align-items: end;
}

.control-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-card canvas {
  width: 120px;
  height: 120px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #f9fbff;
}

.compact {
  min-width: 130px;
}

label {
  color: var(--ink);
  font-weight: 700;
  font-size: 0.92rem;
}

input,
select,
button {
  font: inherit;
}

input[type="file"],
input[type="number"],
select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
}

button {
  border: 0;
  border-radius: 11px;
  padding: 11px 14px;
  background: #e7edf7;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  filter: brightness(0.97);
}

button.primary {
  background: var(--accent);
  color: white;
  min-height: 46px;
}

button.primary:hover {
  background: var(--accent-dark);
}

.reference {
  margin-top: 16px;
}

.reference ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 18px;
  margin: 12px 0;
  padding-left: 22px;
}

.note {
  color: #8a5a00;
  background: #fff8e5;
  border: 1px solid #ffe0a3;
  border-radius: 12px;
  padding: 10px 12px;
}

.status {
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: #12213b;
  color: #fff;
  font-weight: 700;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  min-height: 78px;
}

.stat {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #f8fbff;
}

.stat strong,
.stat span {
  display: block;
}

.stat strong {
  color: var(--muted);
  font-size: 0.82rem;
}

.stat span {
  margin-top: 5px;
  font-size: 1.35rem;
  font-weight: 800;
}

.previews {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px;
}

.preview {
  overflow: auto;
}

.preview h2,
.exports h2,
.panel h2 {
  margin-top: 0;
}

.preview canvas {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}

.exports {
  margin: 18px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.exports h2 {
  width: 100%;
  margin-bottom: 0;
}

#algoList {
  min-height: 120px;
  max-height: 260px;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  line-height: 1.45;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f5f8fd;
  color: var(--muted);
  font-size: 0.85rem;
}

code {
  white-space: nowrap;
}

.generator-panel {
  margin-top: 18px;
}

.small-status {
  margin: 10px 0 16px;
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.candidate-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #f8fbff;
}

.candidate-card h3 {
  margin: 0 0 8px;
}

.candidate-previews {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  overflow: auto;
  margin: 10px 0;
}

.candidate-previews canvas {
  max-width: 48%;
  border: 1px solid var(--border);
  image-rendering: pixelated;
}

.candidate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bias-card {
  min-width: 260px;
}

.bias-grid {
  display: grid;
  grid-template-columns: repeat(6, auto 1fr);
  gap: 6px;
  align-items: center;
}

.bias-grid input {
  width: 58px;
  padding: 6px;
}

@media (max-width: 680px) {
  main {
    padding-inline: 12px;
  }

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