:root {
  --tone-base: #0f151c;
  --tone-panel: #161e27;
  --tone-raise: #1d2733;
  --tone-well: #0b1016;
  --tone-edge: #2a3644;
  --tone-text: #dfe7ee;
  --tone-muted: #8b9aa9;
  --hue-cyan: #3fd5e6;
  --hue-lime: #b6e84a;
  --hue-alert: #ff8f6b;
  --face-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --face-data: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, Menlo, monospace;
  --curve: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--tone-base);
  color: var(--tone-text);
  font: 14px/1.45 var(--face-ui);
}

.shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

.masthead {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 0 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand svg { width: 26px; height: 26px; }

.masthead h1 {
  margin: 0;
  padding-left: 14px;
  border-left: 1px solid var(--tone-edge);
  font-size: 14px;
  font-weight: 500;
  color: var(--tone-muted);
}

.bench {
  display: grid;
  grid-template-columns: minmax(0, 410px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.bench > * { grid-column: 1; }

#chartPanel {
  grid-column: 2;
  grid-row: 1 / span 3;
  position: sticky;
  top: 14px;
}

.panel {
  min-width: 0;
  margin: 0;
  padding: 14px;
  background: var(--tone-panel);
  border: 1px solid var(--tone-edge);
  border-radius: var(--curve);
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.panel h2, .dial legend {
  margin: 0;
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--hue-cyan);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

button, select, input, textarea { font: inherit; color: inherit; }

.btn, select, input[type="text"] {
  height: 34px;
  padding: 0 10px;
  background: var(--tone-raise);
  border: 1px solid var(--tone-edge);
  border-radius: var(--curve);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; flex: none; }

.btn:hover { border-color: var(--tone-muted); }

.btn:disabled { opacity: 0.45; cursor: default; }

.btn.lead {
  background: var(--hue-lime);
  border-color: var(--hue-lime);
  color: #10180a;
  font-weight: 650;
}

.btn.lead:hover { filter: brightness(1.08); }

select { max-width: 100%; cursor: pointer; }

input[type="text"] { width: 100%; }

input[type="text"]::placeholder, textarea::placeholder { color: #66758a; }

:focus-visible {
  outline: 2px solid var(--hue-cyan);
  outline-offset: 2px;
}

.tools { margin-bottom: 10px; }

.tools select { flex: 1 1 140px; min-width: 0; }

.data-box {
  display: block;
  width: 100%;
  height: 220px;
  margin-top: 6px;
  padding: 10px;
  resize: vertical;
  background: var(--tone-well);
  border: 1px solid var(--tone-edge);
  border-radius: var(--curve);
  font: 12.5px/1.5 var(--face-data);
  white-space: pre;
  overflow: auto;
  tab-size: 12;
}

.panel.dropping { border-color: var(--hue-lime); }

.panel.dropping .data-box { border-style: dashed; border-color: var(--hue-lime); }

.hint {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--tone-muted);
}

.hint.alert { color: var(--hue-alert); }

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--hue-cyan);
}

.sheet-wrap {
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
  background: var(--tone-well);
  border: 1px solid var(--tone-edge);
  border-radius: var(--curve);
}

.sheet {
  width: 100%;
  border-collapse: collapse;
  font: 12px/1.4 var(--face-data);
}

.sheet th, .sheet td {
  max-width: 180px;
  padding: 5px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  border-bottom: 1px solid #1c2530;
}

.sheet th {
  position: sticky;
  top: 0;
  background: var(--tone-raise);
  color: var(--tone-text);
  font-weight: 600;
}

.sheet th small {
  margin-left: 6px;
  font-weight: 400;
  color: var(--hue-lime);
}

.sheet th small.plain { color: var(--tone-muted); }

.sheet td { color: #b9c5d1; }

.sheet .num { text-align: right; }

.sheet tr:last-child td { border-bottom: 0; }

.stage {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 10px;
  background: var(--tone-well);
  border: 1px solid var(--tone-edge);
  border-radius: var(--curve);
}

.stage svg {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  border-radius: 3px;
}

.stage.clear svg {
  background: repeating-conic-gradient(#e6ebf0 0 25%, #ffffff 0 50%) 0 0 / 18px 18px;
}

.stage.clear.dim svg {
  background: repeating-conic-gradient(#1b242e 0 25%, #10161d 0 50%) 0 0 / 18px 18px;
}

.stage [data-tip] { cursor: crosshair; }

.stage [data-tip]:hover { opacity: 0.82; }

.stage .hit:hover { opacity: 1; }

.stage-note {
  max-width: 420px;
  margin: 0;
  padding: 24px 12px;
  text-align: center;
  color: var(--tone-muted);
}

.stage-note strong {
  display: block;
  margin-bottom: 4px;
  color: var(--tone-text);
  font-size: 15px;
}

.tip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  max-width: 260px;
  padding: 6px 9px;
  background: #05080c;
  border: 1px solid var(--tone-edge);
  border-radius: var(--curve);
  font-size: 12px;
  pointer-events: none;
}

.tip b { display: block; font-weight: 600; }

.tip span { font-family: var(--face-data); color: var(--hue-lime); }

.dials {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 14px;
}

.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tints {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tints input {
  width: 34px;
  height: 34px;
  padding: 3px;
  background: var(--tone-raise);
  border: 1px solid var(--tone-edge);
  border-radius: var(--curve);
  cursor: pointer;
}

.tints input::-webkit-color-swatch-wrapper { padding: 0; }

.tints input::-webkit-color-swatch { border: 0; border-radius: 3px; }

.tints input::-moz-color-swatch { border: 0; border-radius: 3px; }

.dial .hint { margin: 0; }

.dial { display: grid; gap: 10px; align-content: start; }

.dial legend { float: left; width: 100%; margin-bottom: 2px; }

.field { display: grid; gap: 4px; min-width: 0; }

.field > span, .group-name {
  font-size: 12px;
  color: var(--tone-muted);
}

.field select { width: 100%; }

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

.seg label { position: relative; cursor: pointer; }

.seg input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.seg label > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  background: var(--tone-raise);
  border: 1px solid var(--tone-edge);
  border-radius: var(--curve);
  white-space: nowrap;
}

.seg svg { width: 16px; height: 16px; flex: none; }

.seg input:checked + span {
  border-color: var(--hue-cyan);
  color: var(--hue-cyan);
  background: #12303a;
}

.seg input:focus-visible + span {
  outline: 2px solid var(--hue-cyan);
  outline-offset: 2px;
}

.swatches { display: inline-flex; gap: 2px; }

.swatches i {
  width: 9px;
  height: 14px;
  border-radius: 2px;
}

.picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  max-height: 132px;
  overflow: auto;
  padding: 2px;
}

.guide {
  max-width: 820px;
  margin: 44px auto 0;
  color: #c3ced9;
  font-size: 15px;
  line-height: 1.65;
}

.guide h2 {
  margin: 36px 0 8px;
  font-size: 20px;
  color: var(--tone-text);
}

.guide h3 {
  margin: 20px 0 4px;
  font-size: 15.5px;
  color: var(--tone-text);
}

.guide p, .guide ol, .guide ul { margin: 0 0 12px; }

.guide ol, .guide ul { padding-left: 22px; }

.guide li { margin-bottom: 5px; }

.guide code {
  padding: 1px 5px;
  background: var(--tone-raise);
  border-radius: 4px;
  font: 13px var(--face-data);
}

.kinds {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

.kinds th { color: var(--tone-text); white-space: nowrap; }

.colophon {
  max-width: 820px;
  margin: 40px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--tone-edge);
  font-size: 12.5px;
  color: var(--tone-muted);
}

@media (max-width: 980px) {
  .bench { grid-template-columns: minmax(0, 1fr); }
  #chartPanel { grid-column: 1; grid-row: auto; position: static; }
  .data-box { height: 170px; }
  .stage svg { max-height: 76vh; }
}

@media (max-width: 520px) {
  .shell { padding: 0 12px 36px; }
  .masthead { flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 0 12px; }
  .masthead h1 { padding-left: 0; border-left: 0; }
  .panel { padding: 12px; }
  .stage { min-height: 0; padding: 4px; }
  .data-box { height: 132px; }
  .btn, select, input[type="text"], .seg label > span { height: 40px; }
  select, input[type="text"], .data-box { font-size: 16px; }
  .tints input { width: 40px; height: 40px; }
  .check { min-height: 32px; }
  .check input { width: 18px; height: 18px; }
  .exports { width: 100%; }
  .exports .btn { flex: 1 1 auto; justify-content: center; }
  .exports .lead { flex-basis: 100%; }
  .guide { margin-top: 32px; }
  .kinds th { white-space: normal; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .seg label > span { transition: border-color 0.12s, background-color 0.12s; }
}

:root {
  --tone-base: #FFFFFF;
  --tone-panel: #FAF8F5;
  --tone-raise: #FFFFFF;
  --tone-well: #FFFFFF;
  --tone-edge: #ECE8E2;
  --tone-text: #0A0A0A;
  --tone-muted: #5F5B55;
  --hue-cyan: #82633A;
  --hue-lime: #0A0A0A;
  --hue-alert: #A3261A;
  --face-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --face-data: ui-monospace, "Cascadia Mono", "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --curve: 10px;
}
:root[data-theme="dark"] {
  --tone-base: #000000;
  --tone-panel: #0F0E0D;
  --tone-raise: #171614;
  --tone-well: #0A0909;
  --tone-edge: #24221F;
  --tone-text: #FFFFFF;
  --tone-muted: #A8A39C;
  --hue-cyan: #C9AE8A;
  --hue-lime: #FFFFFF;
  --hue-alert: #FF9A8C;
}
body { font-size: 14.5px; }
.shell { max-width: 1240px; padding: 0 32px 24px; }
.masthead { display: block; padding: 48px 0 28px; }
.masthead h1 { padding: 0; border: 0; font-size: clamp(30px, 4.6vw, 44px); line-height: 1.08; letter-spacing: -0.03em; font-weight: 650; color: var(--tone-text); max-width: 22ch; text-wrap: balance; }
.panel { border-radius: 16px; padding: 18px; }
.panel h2, .dial legend { font-family: var(--face-data); font-size: 11.5px; font-weight: 500; letter-spacing: 0.04em; text-transform: lowercase; color: var(--tone-muted); }
.btn.lead { color: var(--tone-base); font-weight: 600; }
.btn.lead:hover { filter: none; opacity: 0.86; }
input[type="text"]::placeholder, textarea::placeholder { color: #8A857E; }
.sheet th, .sheet td { border-bottom-color: var(--tone-edge); }
.sheet td { color: var(--tone-text); }
.stage.clear svg { background: repeating-conic-gradient(#EEEAE4 0 25%, #FFFFFF 0 50%) 0 0 / 18px 18px; }
.stage.clear.dim svg { background: repeating-conic-gradient(#1A1917 0 25%, #111010 0 50%) 0 0 / 18px 18px; }
.tip { background: var(--tone-text); color: var(--tone-base); border-color: var(--tone-text); }
.seg input:checked + span { border-color: var(--tone-text); color: var(--tone-base); background: var(--tone-text); }
.seg input:focus-visible + span { outline-color: var(--tone-text); }
.guide { color: var(--tone-muted); }
@media (max-width: 640px) {
  .shell { padding: 0 16px 20px; }
  .masthead { padding: 32px 0 20px; }
}
