:root {
  color-scheme: dark;
  --bg: #171614;
  --panel: #242220;
  --ink: #f4f0e8;
  --muted: #c8bfb2;
  --line: #3c3834;
  --accent: #d7a15f;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
header, main { padding: 16px; }
h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2, h3 { margin: 0 0 8px; }
p { color: var(--muted); line-height: 1.4; }
nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 8px;
}
button, input, select {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
button { min-height: 48px; padding: 10px 14px; }
button:hover, button.active { border-color: var(--accent); }
label { display: block; margin: 12px 0; }
input[type="text"], input[type="password"], input[type="number"] {
  display: block;
  width: min(100%, 640px);
  min-height: 48px;
  padding: 8px 12px;
  margin-top: 4px;
}
img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #0e0d0c;
  border-radius: 12px;
}
.keys, .row, .pair, .buckets { display: grid; gap: 8px; }
.keys { grid-template-columns: repeat(5, 1fr); }
.row { grid-template-columns: repeat(2, 1fr); margin-top: 8px; }
.pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compare-choice { padding: 0; min-width: 0; }
.compare-side { min-width: 0; }
.compare-side .compare-choice { width: 100%; }
.compare-side a { display: block; padding: 8px 0; color: var(--accent); text-align: center; }
.compare-choice img { display: block; height: clamp(150px, 45dvh, 480px); border-radius: 7px 7px 0 0; }
.compare-choice span { display: block; padding: 10px 4px; }
.compare-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.compare-actions button { padding-inline: 4px; }
#compare-mode, #compare-reason-choice, #prediction-criterion {
  display: block;
  min-height: 44px;
  max-width: 100%;
  margin-top: 4px;
  padding: 4px 8px;
}
#compare-prompt { color: var(--ink); font-weight: 600; }
#compare-reason-options { margin-top: 12px; }
#compare-reason-options summary { cursor: pointer; color: var(--accent); }
#prediction-tools[hidden] { display: none; }
#list-feedback-status:empty { display: none; }
.criterion-progress { list-style: none; padding: 0; }
.criterion-progress li { margin-bottom: 8px; }
.criterion-progress strong, .criterion-progress span { display: block; }
#panel-compare button:disabled { cursor: default; color: var(--muted); }
.buckets { grid-template-columns: 1fr; }
.card {
  background: var(--panel);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}
.rate-traits { margin-top: 10px; }
.rate-traits p { margin: 8px 0; }
.rate-traits p:empty { display: none; }
#rate-trait-picker[hidden] { display: none; }
#rate-trait-choice { display: block; min-height: 44px; max-width: 100%; margin-top: 4px; padding: 4px 8px; }
#rate-trait-custom-options { margin-top: 12px; }
#rate-trait-custom-options summary { cursor: pointer; color: var(--accent); }
#rate-keys button:disabled { opacity: 0.65; }
.trait-field {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 10px 0;
  min-width: 0;
  padding: 8px;
}
.trait-field legend { padding-inline: 4px; }
.trait-endpoints {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}
.trait-endpoints span:last-child { text-align: right; }
.trait-scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin-top: 6px;
}
.trait-option { margin: 0; }
.trait-option input { position: absolute; opacity: 0; }
.trait-option span {
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.trait-option input:checked + span { border-color: var(--accent); background: #3b3026; }
.trait-option input:focus-visible + span { outline: 2px solid var(--accent); }
.trait-option input:disabled + span { cursor: default; opacity: 0.65; }
.trait-unknown { grid-column: 1 / -1; }
.trait-custom { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 12px; }
.trait-custom label { flex: 1 1 160px; margin: 0; }
.sorter-preview-link { display: block; color: var(--accent); }
.sorter-preview { display: block; height: clamp(180px, 45vh, 420px); margin-bottom: 8px; }
.sorter-preview[hidden] { display: none; }
.review-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.gallery-image { aspect-ratio: auto 3 / 2; }
pre {
  white-space: pre-wrap;
  background: var(--panel);
  padding: 12px;
  border-radius: 10px;
}
.check { display: flex; gap: 8px; align-items: flex-start; }
@media (min-width: 800px) {
  .buckets { grid-template-columns: 1fr 1fr; }
  .row { grid-template-columns: repeat(4, 1fr); }
}
