:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #11110f;
  color: #f2eee4;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: #11110f; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, [tabindex]:focus-visible, input:focus-visible { outline: 2px solid #d6ff45; outline-offset: 4px; }
.hidden { display: none !important; }

.shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #3a3933; font-size: 12px; letter-spacing: .12em; }
.brand { color: inherit; display: flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 800; }
.brand-mark { width: 19px; height: 19px; border-radius: 50%; background: conic-gradient(#d6ff45, #ff5577, #775cff, #29ddca, #d6ff45); box-shadow: inset 0 0 0 4px #11110f; }
.session-stat { color: #8f8d84; }
.session-stat span { color: #f2eee4; font-weight: 800; }

.hero { padding: 84px 0 70px; display: grid; grid-template-columns: 1.55fr .8fr; gap: 60px; align-items: end; }
.eyebrow, .number { color: #d6ff45; font-size: 11px; letter-spacing: .18em; font-weight: 800; }
.hero .eyebrow { grid-column: 1 / -1; margin-bottom: -38px; }
h1 { margin: 0; font-size: clamp(46px, 7.1vw, 94px); line-height: .98; letter-spacing: -.065em; font-weight: 680; }
h1 em { color: #11110f; font-style: normal; -webkit-text-stroke: 1px #8c8980; }
.hero p { margin: 0 0 8px; color: #aaa79d; font-size: 16px; line-height: 1.8; }

.experiment { border-top: 1px solid #3a3933; border-bottom: 1px solid #3a3933; display: grid; grid-template-columns: 1.08fr .92fr; }
.stage-card { padding: 34px 48px 48px 0; border-right: 1px solid #3a3933; }
.controls-card { padding: 34px 0 48px 48px; opacity: .5; transition: opacity .3s; }
.controls-card.active { opacity: 1; }
.stage-meta { display: flex; justify-content: space-between; color: #8f8d84; font-size: 11px; letter-spacing: .14em; margin-bottom: 18px; }
.stage-meta span:first-child { color: #d6ff45; font-weight: 800; }
.color-stage { position: relative; overflow: hidden; min-height: 390px; background: #24231f; border: 1px solid #44433c; }
.target-color, .curtain, .ready-copy { position: absolute; inset: 0; }
.target-color { background: hsl(190 60% 50%); }
.ready-copy, .curtain { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; background: #1b1b18; }
.ready-ring { width: 96px; height: 96px; border: 1px solid #67655d; border-radius: 50%; margin-bottom: 28px; position: relative; }
.ready-ring::before, .ready-ring::after { content: ""; position: absolute; inset: 21px; border: 1px solid #4a4943; border-radius: 50%; }
.ready-ring::after { inset: 43px; background: #d6ff45; border: 0; }
.ready-copy strong, .curtain strong { font-size: 21px; margin-bottom: 10px; }
.ready-copy small, .curtain small { color: #8f8d84; line-height: 1.6; }
.curtain { background: #191917; display: none; }
.curtain.visible { display: flex; }
.curtain-noise { width: 106px; height: 106px; border-radius: 50%; margin-bottom: 25px; background: repeating-radial-gradient(circle, #2c2b27 0 2px, #191917 3px 6px); }
.memory-progress { height: 3px; background: #292824; }
.memory-progress i { display: block; height: 100%; width: 0; background: #d6ff45; }
.memory-progress i.running { animation: countdown 5s linear forwards; }
@keyframes countdown { from { width: 100%; } to { width: 0; } }
.stage-actions { min-height: 70px; display: flex; align-items: flex-end; gap: 12px; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }
.primary, .ghost { height: 48px; padding: 0 19px; text-transform: uppercase; font-size: 12px; letter-spacing: .1em; font-weight: 800; }
.primary { background: #d6ff45; color: #11110f; }
.primary span { margin-left: 28px; }
.ghost { background: transparent; border: 1px solid #57564e; }

.controls-head, .result-heading, .history-head { display: flex; justify-content: space-between; align-items: flex-start; }
.controls-head > div, .result-heading > div, .history-head > div { display: flex; align-items: center; gap: 16px; }
h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.controls-head output { min-width: 92px; padding: 8px 10px; border: 1px solid #55534d; font: 700 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: #11110f; text-align: center; }
.picker-wrap { margin-top: 34px; }
.sl-plane { height: 238px; position: relative; cursor: crosshair; touch-action: none; background-color: hsl(0 100% 50%); background-image: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent); }
.sl-plane span { position: absolute; width: 20px; height: 20px; border: 2px solid white; border-radius: 50%; transform: translate(-50%, -50%); left: 0; top: 50%; box-shadow: 0 1px 7px #000a; pointer-events: none; }
.hue-label { display: grid; grid-template-columns: 42px 1fr 38px; gap: 12px; align-items: center; margin-top: 24px; color: #8f8d84; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
input[type="range"] { appearance: none; width: 100%; height: 7px; border-radius: 0; background: linear-gradient(to right, #f44, #ff4, #4f4, #4ff, #44f, #f4f, #f44); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 21px; background: white; border: 2px solid #11110f; }
input[type="range"]::-moz-range-thumb { width: 11px; height: 19px; border-radius: 0; background: white; border: 2px solid #11110f; }
.hue-label output { text-align: right; }
.channel-row { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid #3a3933; border-bottom: 1px solid #3a3933; margin-top: 28px; }
.channel-row span { padding: 14px 8px; color: #77756d; font-size: 11px; }
.channel-row span + span { border-left: 1px solid #3a3933; }
.channel-row b { float: right; color: #f2eee4; }
.submit { width: 100%; height: 52px; margin-top: 18px; background: #f2eee4; color: #11110f; font-size: 12px; letter-spacing: .08em; font-weight: 800; }
.control-hint { color: #77756d; font-size: 11px; line-height: 1.5; text-align: center; margin: 12px 0 0; }

.result-panel { margin-top: 72px; background: #d6ff45; color: #11110f; padding: 38px 42px 42px; }
.result-panel .number { color: #11110f; opacity: .55; }
.result-heading strong { font-size: 56px; letter-spacing: -.06em; line-height: .8; }
.result-heading strong::after { content: "/100"; font-size: 12px; letter-spacing: 0; margin-left: 5px; opacity: .6; }
.swatch-compare { display: grid; grid-template-columns: 1fr 1fr; margin-top: 34px; border: 1px solid #11110f; }
.swatch-compare > div { display: grid; grid-template-columns: 72px 1fr auto; align-items: center; gap: 16px; padding-right: 20px; }
.swatch-compare > div + div { border-left: 1px solid #11110f; }
.swatch-compare i { height: 70px; border-right: 1px solid #11110f; }
.swatch-compare span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .65; }
.swatch-compare b { font: 700 12px ui-monospace, monospace; }
.errors { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid #11110f; margin-top: 34px; }
.error-item { padding: 18px 0 0; }
.error-item + .error-item { padding-left: 28px; border-left: 1px solid #11110f; }
.error-item span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; opacity: .6; }
.error-item strong { display: block; font-size: 28px; margin-top: 5px; }
.result-sentence { margin: 28px 0 0; font-size: 16px; font-weight: 700; }

.insights { padding: 84px 0; display: grid; grid-template-columns: .85fr 1.15fr; align-items: center; gap: 70px; border-bottom: 1px solid #3a3933; }
.insight-copy h2 { font-size: 32px; margin: 13px 0 20px; }
.insight-copy > p { color: #8f8d84; line-height: 1.75; max-width: 440px; }
.bias-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 32px; }
.bias-grid div { border: 1px solid #3a3933; padding: 16px; }
.bias-grid span { display: block; color: #77756d; font-size: 10px; letter-spacing: .1em; margin-bottom: 8px; }
.bias-grid strong { font-size: 14px; }
.radar-wrap { min-height: 390px; display: grid; place-items: center; position: relative; border: 1px solid #3a3933; background: #151512; }
#radar { width: min(100%, 440px); height: auto; }
.radar-empty { position: absolute; text-align: center; color: #67655d; line-height: 1.6; font-size: 13px; }

.history-section { padding: 72px 0 86px; }
.history-head { align-items: center; margin-bottom: 24px; }
.history-head button { background: transparent; border-bottom: 1px solid #77756d; color: #8f8d84; padding: 5px 0; font-size: 11px; letter-spacing: .1em; }
.history-list { border-top: 1px solid #3a3933; }
.history-item { display: grid; grid-template-columns: 38px 1fr 1fr 90px; align-items: center; gap: 18px; padding: 14px 0; border-bottom: 1px solid #2e2d29; font-size: 12px; }
.history-item .index { color: #68665f; font: 11px ui-monospace, monospace; }
.mini-pair { display: flex; align-items: center; gap: 8px; }
.mini-pair i { width: 25px; height: 25px; border: 1px solid #4c4a44; }
.mini-pair span { color: #8f8d84; }
.history-errors { color: #8f8d84; }
.history-score { font-weight: 800; text-align: right; }
.empty-history { padding: 32px 0; color: #67655d; font-size: 13px; }
footer { height: 80px; border-top: 1px solid #3a3933; display: flex; align-items: center; justify-content: space-between; color: #67655d; font-size: 10px; letter-spacing: .12em; }

@media (max-width: 800px) {
  .shell { width: min(100% - 30px, 620px); }
  .topbar { height: 70px; }
  .hero { padding: 58px 0 48px; grid-template-columns: 1fr; gap: 28px; }
  .hero .eyebrow { margin: 0 0 -8px; }
  .hero p { max-width: 520px; }
  .experiment { grid-template-columns: 1fr; }
  .stage-card { padding: 28px 0 38px; border-right: 0; border-bottom: 1px solid #3a3933; }
  .controls-card { padding: 36px 0 42px; }
  .color-stage { min-height: 330px; }
  .insights { grid-template-columns: 1fr; gap: 34px; padding: 62px 0; }
  .result-panel { margin-left: -15px; margin-right: -15px; padding: 30px 22px; }
  .swatch-compare { grid-template-columns: 1fr; }
  .swatch-compare > div + div { border-left: 0; border-top: 1px solid #11110f; }
  .history-item { grid-template-columns: 30px 1fr 65px; }
  .history-item .guess { display: none; }
}

@media (max-width: 480px) {
  h1 { font-size: 44px; }
  .session-stat { font-size: 10px; }
  .color-stage { min-height: 285px; }
  .sl-plane { height: 220px; }
  .controls-head > div, .result-heading > div { gap: 9px; }
  .result-heading strong { font-size: 42px; }
  .errors { gap: 0; }
  .error-item + .error-item { padding-left: 12px; }
  .error-item strong { font-size: 22px; }
  .swatch-compare > div { grid-template-columns: 55px 1fr auto; gap: 10px; }
  .swatch-compare i { height: 58px; }
  .bias-grid { grid-template-columns: 1fr; }
  footer { align-items: flex-start; padding-top: 25px; gap: 8px; flex-direction: column; justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .memory-progress i.running { animation-timing-function: steps(5); }
}
