:root {
  --navy: #0b1d3a;
  --navy2: #122a52;
  --navy3: #1b3a6b;
  --ink: #e9eef7;
  --muted: #9fb0cc;
  --orange: #ff8c1a;
  --orange2: #e67300;
  --card: #10254a;
  --line: #24467d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  background: var(--navy);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--orange); }
.top { padding: 18px 16px 8px; max-width: 1100px; margin: 0 auto; }
.brand {
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: none;
  color: var(--orange);
  font-size: 13px;
  text-transform: uppercase;
}
h1 { margin: 4px 0 2px; font-size: 26px; }
.sub { margin: 0; color: var(--muted); }
.page-modes { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.page-modes button.on { background: var(--orange); color: #1a0d00; border-color: var(--orange); }
main { max-width: 1100px; margin: 0 auto; padding: 8px 12px 24px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 12px 0;
}
.card h2 { font-size: 18px; margin: 0 0 8px; }
.pill {
  font-size: 12px;
  font-weight: 500;
  background: var(--navy3);
  border-radius: 999px;
  padding: 2px 10px;
  color: var(--ink);
}
.big { color: var(--orange); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="number"], input[type="range"] { font: inherit; }
input[type="text"], input[type="number"] {
  background: var(--navy);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}
input:focus, button:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
}
button {
  background: var(--orange);
  color: #1a0d00;
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: var(--orange2); }
button.ghost {
  background: transparent;
  color: var(--orange);
  border: 1px solid var(--orange);
}
button.ghost:hover { background: rgba(255, 140, 26, .12); }
button.mini { padding: 6px 10px; font-size: 12.5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.foot { max-width: 1100px; margin: 0 auto; padding: 6px 16px 30px; color: var(--muted); font-size: 12.5px; }
.bar { height: 4px; background: var(--navy3); border-radius: 2px; overflow: hidden; margin: 6px 0; }
.bar > i { display: block; height: 100%; background: var(--orange); width: 0; }
.status { min-height: 1.4em; margin: 8px 0 0; color: var(--muted); }

.color-anchor { position: relative; }
.color-line { display: flex; gap: 8px; align-items: flex-end; }
.color-line .grow { flex: 1; min-width: 0; }
.swatch {
  width: 42px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
  flex: none;
}
.swatch.empty, .big-swatch.empty {
  background-color: var(--navy);
  background-image:
    linear-gradient(45deg, var(--navy3) 25%, transparent 25%),
    linear-gradient(-45deg, var(--navy3) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--navy3) 75%),
    linear-gradient(-45deg, transparent 75%, var(--navy3) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
label.picker { flex: none; }
input[type="color"] {
  width: 46px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--navy);
  cursor: pointer;
}
.resolved { min-height: 1.2em; margin: 4px 0 0; }
.suggest {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--navy2);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: min(280px, 46vh);
  overflow: auto;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .35);
}
.suggest-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 6px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 500;
  padding: 6px 8px;
}
.suggest-item .swatch { width: 22px; height: 22px; }
.suggest-item .suggest-hex { margin-left: auto; color: var(--muted); font-size: 12px; }
.suggest-item.on, .suggest-item:hover { background: var(--navy3); color: var(--ink); }

.compare-stage {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: stretch;
  margin-top: 6px;
}
.swatch-card { margin: 0; }
.big-swatch {
  min-height: 180px;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
.swatch-name { margin-top: 8px; font-weight: 700; }
.swatch-hex { font-size: 13px; }
.sim-readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 8.5em;
  text-align: center;
}
.sim-label { color: var(--muted); font-size: 13px; }
.sim-readout .big { font-size: 34px; }
.sim-readout .bar { width: 100%; }

.target-grid {
  display: grid;
  grid-template-columns: 1.5fr .7fr 1fr;
  gap: 12px;
  align-items: start;
}
.tol-row { display: flex; gap: 8px; align-items: center; }
.tol-row input[type="range"] { flex: 1; accent-color: var(--orange); }
.tol-row input[type="number"] { width: 5.2em; flex: none; }
.tol-readout { color: var(--orange); font-weight: 700; }

.guess-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9.5em auto;
  gap: 10px;
  align-items: end;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.guess-row .pct { width: 100%; }

.results { list-style: none; margin: 8px 0 0; padding: 0; }
.result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 8px 4px;
  border-top: 1px solid var(--line);
}
.result:hover { background: var(--navy2); }
.result .swatch { width: 42px; height: 42px; }
.result-name { font-weight: 700; }
.result-meta { color: var(--muted); font-size: 12.5px; }
.result-score { color: var(--orange); font-weight: 700; font-variant-numeric: tabular-nums; }
.result-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.devs { list-style: none; margin: 4px 0 0; padding: 0; }
.devs li { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
  flex: none;
}
.total { color: var(--orange); font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .grid2, .target-grid, .compare-stage { grid-template-columns: 1fr; }
  .sim-readout { padding: 4px 0 8px; }
  .big-swatch { min-height: 120px; }
  .guess-row { grid-template-columns: minmax(0, 1fr) auto; }
  .guess-row .color-mount { grid-column: 1 / -1; }
  .result { grid-template-columns: auto minmax(0, 1fr); }
  .result-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
