:root {
  --bg: #1f1f1f;
  --panel: #262626;
  --panel-2: #2f2f2f;
  --tool: #474747;
  --tool-hover: #565656;
  --line: #3a3a3a;
  --text: #e9e9e9;
  --muted: #9a9a9a;
  --accent: #ff2d5a;
  --good: #3ddc84;
  --radius: 14px;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); overflow: hidden; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
kbd {
  font: 600 11px/1 ui-monospace, Consolas, monospace;
  padding: 3px 5px; border-radius: 5px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12);
}

/* ---------- top bar ---------- */
.topbar {
  height: 54px; display: flex; align-items: center; gap: 24px;
  padding: 0 20px; background: #1b1b1b; position: relative;
}
/* thin spectrum line under the top bar, taken from the logo's colors */
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; opacity: .75;
  background: linear-gradient(90deg, #ef1c24, #f2a01f, #f3cb22, #00a84f, #22c8d6, #24156e, #c0278f, #d42131);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: .2px; color: var(--text); text-decoration: none; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-mark-unused {
  width: 22px; height: 22px; border-radius: 50%;
  background: conic-gradient(from 0deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  box-shadow: inset 0 0 0 5px #1b1b1b, 0 0 0 1px #444;
}
.art-picker { display: flex; gap: 6px; flex: 1; overflow-x: auto; }
.chip {
  border: 1px solid #3d3d3d; background: #2a2a2a; border-radius: 999px;
  padding: 6px 13px; font-size: 13px; cursor: pointer; white-space: nowrap; color: #cfcfcf;
}
.chip:hover { background: #333; }
.chip.active { background: var(--text); color: #161616; border-color: var(--text); }
.chip.ghost { border-style: dashed; }
.stats { display: flex; align-items: center; gap: 22px; }
.stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.stat b { font-size: 17px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }

/* download menu */
.dl-wrap { position: relative; }
.dl-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #fff; border: 0; font-weight: 600; font-size: 14px;
}
.dl-btn:hover { filter: brightness(1.08); }
.dl-btn svg, .dl-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dl-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 330px; z-index: 40;
  background: #262626; border: 1px solid #3a3a3a; border-radius: 14px; padding: 6px; box-shadow: 0 14px 40px rgba(0,0,0,.55);
}
.dl-item {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 10px; border-radius: 10px; border: 0;
  background: transparent; color: var(--text); text-align: left; text-decoration: none; cursor: pointer; font: inherit;
}
.dl-item:hover { background: #323232; }
.dl-item b { display: block; font-size: 14px; }
.dl-item small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.dl-ic { flex: none; width: 34px; height: 34px; border-radius: 9px; background: #353535; display: grid; place-items: center; }
.dl-item[aria-disabled="true"] { display: none; }
.dl-note { margin: 4px 10px 8px; font-size: 12.5px; line-height: 1.45; color: #e6c5ce; background: #3a2229; padding: 9px 11px; border-radius: 8px; }

/* ---------- layout ---------- */
.app {
  height: calc(100% - 54px - 34px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px minmax(420px, 600px);
  gap: 16px; padding: 16px;
}

/* ---------- artwork ---------- */
.art-panel {
  position: relative; border-radius: 6px; overflow: hidden;
  background:
    repeating-conic-gradient(#2c2c2c 0 25%, #282828 0 50%) 0 0 / 24px 24px;
  min-height: 0;
}
.art-panel canvas#artCanvas { position: absolute; inset: 0; display: block; }
.art-panel.pick canvas#artCanvas { cursor: crosshair; }
.art-panel.hand canvas#artCanvas { cursor: grab; }
.art-panel.panning canvas#artCanvas { cursor: grabbing; }

.target-card {
  position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #ddd;
  text-shadow: 0 1px 2px rgba(0,0,0,.6); pointer-events: none;
}
.target-swatch {
  width: 132px; height: 112px; border-radius: 8px; border: 4px solid #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,.45);
}

.loupe {
  position: absolute; pointer-events: none; z-index: 5;
  width: 158px; border-radius: 10px; overflow: hidden; border: 3px solid #fff;
  box-shadow: 0 8px 28px rgba(0,0,0,.55); background: #111;
}
.loupe canvas { display: block; width: 152px; height: 152px; }
.loupe-swatch { height: 26px; border-top: 3px solid #fff; }

.art-hud {
  position: absolute; left: 12px; bottom: 12px; font-size: 12px; color: #ddd;
  background: rgba(20,20,20,.7); padding: 5px 9px; border-radius: 6px; pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.empty-hint {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: var(--muted); text-align: center; padding: 30px;
}
.empty-hint b { color: var(--text); }
.drop-overlay {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center; z-index: 20;
  background: rgba(255,45,90,.12); border: 3px dashed var(--accent); border-radius: 6px;
  font-size: 20px; font-weight: 600;
}
.drop-overlay.show { display: flex; }

.isolate {
  position: absolute; inset: 0; z-index: 15; background: #777; /* neutral mid gray */
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  color: #222; text-align: center; padding: 30px;
}
.isolate-swatch { width: min(46%, 340px); aspect-ratio: 1; border-radius: 10px; }
.isolate p { max-width: 420px; font-size: 14px; }
.isolate kbd { background: rgba(0,0,0,.12); border-color: rgba(0,0,0,.2); }

/* ---------- toolbar ---------- */
.toolbar {
  background: var(--tool); border-radius: 18px; padding: 14px 9px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; align-self: start;
  background: #3d3d3d;
}
.tool {
  width: 54px; height: 50px; border: 0; border-radius: 6px; background: var(--tool-hover);
  display: grid; place-items: center; cursor: pointer; transition: background .12s, transform .08s;
}
.tool svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { background: #686868; }
.tool:active { transform: scale(.96); }
.tool.active { background: #1c1c1c; color: #fff; box-shadow: inset 0 0 0 1px #000; }
.tool.on { background: var(--text); color: #1a1a1a; }
.tool.text { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tool-sep { width: 30px; height: 1px; background: #5a5a5a; margin: 4px 0; }

/* ---------- wheel panel ---------- */
.wheel-panel {
  display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; padding-right: 2px;
}
.wheel-head { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.picker-group { display: flex; flex-direction: column; gap: 5px; }
.mini-label { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }

/* picker style switcher: small colorful icons so you can see what each style is */
.picker-styles { display: flex; gap: 4px; background: #2a2a2a; padding: 4px; border-radius: 12px; border: 1px solid #383838; }
.pstyle {
  width: 42px; height: 38px; border-radius: 8px; border: 2px solid transparent; background: transparent;
  display: grid; place-items: center; cursor: pointer; transition: background .12s, border-color .12s;
}
.pstyle:hover { background: #363636; }
.pstyle.active { background: #3d3d3d; border-color: var(--accent); }
.ic { position: relative; display: block; width: 24px; height: 24px; }
.ic-wheel {
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0, rgba(255,255,255,0) 72%),
    conic-gradient(#f00, #f80, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.ic-square {
  width: 26px;
  background: linear-gradient(to top, #000, rgba(0,0,0,0)), linear-gradient(to right, #fff, #f02);
  clip-path: inset(0 7px 0 0 round 2px);
}
.ic-square i {
  position: absolute; right: 0; top: 0; width: 5px; height: 24px; border-radius: 1px;
  background: linear-gradient(#f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.ic-ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(#f00, #f80, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  -webkit-mask: radial-gradient(circle, transparent 54%, #000 57%); mask: radial-gradient(circle, transparent 54%, #000 57%);
}
.ic-ring i { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.ic-ring i.sq { width: 9px; height: 9px; background: linear-gradient(to top, #000, rgba(0,0,0,0)), linear-gradient(to right, #fff, #f02); }
.ic-ring i.tri {
  width: 11px; height: 10px; margin-top: 1px;
  background: linear-gradient(to right, #000, #fff 55%, #f02); clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.wheel-toggles { display: flex; gap: 6px; }
.chip.toggle::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #555; margin-right: 7px; vertical-align: 1px; }
.chip.toggle.on::before { background: var(--good); }

.score { margin-left: auto; text-align: right; line-height: 1; }
.score-num { font-size: 40px; font-weight: 300; font-variant-numeric: tabular-nums; transition: color .3s; }
.score-label { font-size: 13px; color: #cfcfcf; margin-top: 2px; }
.score-label small { font-size: 11px; color: var(--muted); }

.wheel-wrap { flex: 1 1 auto; min-height: 330px; display: flex; flex-direction: column; gap: 8px; }
.wheel-stage { position: relative; flex: 1 1 auto; min-height: 0; }
#wheelCanvas { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: block; touch-action: none; }
#wheelCanvas.panning { cursor: grabbing; }

/* bar right under the picker: hover readout | main button | zoom */
.wheel-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.wheel-hud {
  justify-self: start; font-size: 12px; color: #ccc; font-variant-numeric: tabular-nums; white-space: nowrap;
  background: rgba(20,20,20,.75); padding: 5px 9px; border-radius: 6px; pointer-events: none;
}
.wheel-hud:empty { visibility: hidden; }
.wheel-hud i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -3px; margin-right: 7px; box-shadow: 0 0 0 1px rgba(255,255,255,.5); }
.wheel-zoom {
  justify-self: end; display: flex; align-items: center; gap: 4px;
  background: rgba(30,30,30,.85); border: 1px solid #3a3a3a; padding: 4px; border-radius: 10px;
}
.wheel-zoom.off { visibility: hidden; }
.wheel-zoom span { min-width: 44px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; color: #ccc; }

.lock-zone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lock-btn {
  display: inline-flex; align-items: center; gap: 10px; min-width: 240px; justify-content: center;
  padding: 11px 20px; border-radius: 999px; font-size: 15px; font-weight: 600; cursor: pointer;
  border: 2px solid transparent; transition: background .15s, color .15s, box-shadow .2s, transform .08s;
}
.lock-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.lock-btn kbd { margin-left: 2px; }
.lock-btn:active:not(:disabled) { transform: scale(.97); }
/* waiting: it's an instruction, not a broken button */
.lock-btn.waiting { background: transparent; border: 2px dashed #555; color: #cfcfcf; cursor: default; }
.lock-btn.ready { background: var(--accent); color: #fff; box-shadow: 0 0 0 0 rgba(255,45,90,.6); animation: ready-pulse 1.8s ease-out 2; }
.lock-btn.ready:hover { filter: brightness(1.08); }
.lock-btn.ready kbd { background: rgba(0,0,0,.18); border-color: rgba(0,0,0,.15); color: #fff; }
.lock-btn.next { background: var(--text); color: #161616; }
.lock-btn.next:hover { background: #fff; }
.lock-btn.next kbd { background: rgba(0,0,0,.08); border-color: rgba(0,0,0,.12); }
.lock-btn.shake { animation: shake .35s; }
.lock-hint { font-size: 11.5px; color: var(--muted); text-align: center; white-space: nowrap; }
@keyframes ready-pulse { 0% { box-shadow: 0 0 0 0 rgba(255,45,90,.55); } 100% { box-shadow: 0 0 0 14px rgba(255,45,90,0); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.toast {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); margin: 0; white-space: nowrap;
  background: #ffe2e9; color: #5a0f22; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.4); z-index: 3;
}
.toast::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: #ffe2e9; }
.toast.pop { animation: pop .2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 4px); } to { opacity: 1; transform: translate(-50%, 0); } }

.icon-btn {
  width: 30px; height: 30px; border-radius: 7px; border: 0; background: #3a3a3a; cursor: pointer; font-size: 16px; line-height: 1;
}
.icon-btn:hover { background: #4a4a4a; }
.icon-btn.small { width: 28px; height: 28px; border-radius: 50%; font-weight: 700; }

/* big Target | Your color panel: the two halves touch so small differences are easy to see */
.match {
  display: grid; grid-template-columns: 1fr 1fr; height: 78px; flex: 0 0 auto; margin-bottom: 6px; position: relative;
  border-radius: 12px; overflow: hidden; border: 3px solid #fff; box-shadow: 0 6px 22px rgba(0,0,0,.35);
}
.match-half {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  padding: 8px 12px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.match-half.dark-ink { color: #141414; text-shadow: none; }
.match-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; opacity: .85; }
.match-half b { font: 600 14px ui-monospace, Consolas, monospace; min-height: 1.2em; }
.match-half.empty { background: repeating-linear-gradient(45deg, #2c2c2c 0 8px, #333 8px 16px); color: #8a8a8a; text-shadow: none; }
.match-half.empty b { font: 13px "Segoe UI", system-ui, sans-serif; }
.match-half.hidden-guess { background: #2b2b2b; color: #8a8a8a; text-shadow: none; }
.match-half.hidden-guess::before {
  content: "?"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; font-weight: 700; color: #555;
}
.match-half.hidden-guess b { font: 13px "Segoe UI", system-ui, sans-serif; }

/* sliders */
.sliders { display: flex; flex-direction: column; gap: 12px; }
.slider-row { display: grid; grid-template-columns: 22px 1fr 54px 12px; align-items: center; gap: 10px; }
.slider-row label { font-size: 24px; font-weight: 300; color: #ddd; }
.slider-row input {
  width: 54px; background: #2c2c2c; border: 1px solid #3c3c3c; border-radius: 6px; color: var(--text);
  padding: 5px 6px; font: 13px/1 ui-monospace, Consolas, monospace; text-align: right;
}
.slider-row input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.slider-row input::-webkit-inner-spin-button { opacity: .4; }
.unit { font-size: 12px; color: var(--muted); }
.slider { position: relative; height: 30px; cursor: pointer; touch-action: none; outline: none; }
.slider .track { position: absolute; left: 0; right: 0; top: 50%; height: 16px; transform: translateY(-50%); border-radius: 999px; background: #c4c4c4; }
.slider .thumb {
  position: absolute; top: 50%; width: 28px; height: 28px; border-radius: 50%;
  transform: translate(-50%, -50%); border: 3px solid #fff; background: #d9d9d9;
  box-shadow: 0 2px 8px rgba(0,0,0,.5); pointer-events: none;
}
.slider:focus-visible .thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.slider .tick {
  position: absolute; top: 50%; width: 4px; height: 30px; transform: translate(-50%, -50%);
  background: #fff; border-radius: 2px; box-shadow: 0 0 0 1.5px #111; pointer-events: none;
}
.slider .tick::after {
  content: "target"; position: absolute; top: -15px; left: 50%; transform: translateX(-50%);
  font-size: 9px; text-transform: uppercase; letter-spacing: .5px; color: #ccc;
}

.breakdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; flex: none; }
.bd {
  background: var(--panel-2); border-radius: 10px; padding: 6px 10px; border: 1px solid transparent; min-width: 0;
}
.bd.worst { border-color: rgba(255,45,90,.6); }
.bd .k { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.bd .v { font-size: 16px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.bd .d { font-size: 11.5px; color: #bbb; margin-top: 2px; line-height: 1.25; }
.bd.placeholder .v { color: #555; }
.history { flex: none; border-top: 1px solid var(--line); padding-top: 10px; }
.history-head { display: flex; justify-content: space-between; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 8px; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; padding: 0; }
.link:hover { color: var(--text); }
.history-strip { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; }
.hist { height: 32px; border-radius: 4px; position: relative; }
.hist.empty { background: #4a4a4a; opacity: .55; }
.hist span {
  position: absolute; left: 2px; bottom: 2px; font-size: 10px; font-weight: 700; padding: 0 3px; border-radius: 3px;
  background: rgba(0,0,0,.55); color: #fff; font-variant-numeric: tabular-nums;
}
.insight { margin: 8px 0 0; font-size: 12.5px; color: #c9c9c9; line-height: 1.4; min-height: 1.4em; }

/* help modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; }
.modal-card { background: #262626; border: 1px solid #3a3a3a; border-radius: 16px; padding: 26px 30px; width: min(620px, 92vw); }
.modal-card h2 { margin: 0 0 10px; font-size: 20px; }
.modal-card h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.modal-card ol { margin: 0; padding-left: 20px; line-height: 1.6; color: #ddd; font-size: 14px; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 13px; color: #ccc; margin-bottom: 20px; }

/* narrow screens */
@media (max-width: 1100px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; height: auto; }
  .art-panel { height: 60vh; }
  .toolbar { flex-direction: row; flex-wrap: wrap; justify-content: center; align-self: stretch; }
  .tool-sep { width: 1px; height: 30px; margin: 0 4px; }
  .wheel-wrap { min-height: 460px; }
  .stats .stat:nth-child(3) { display: none; }
}

.fmt-btn {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  background: rgba(20,20,20,.7); color: #eee; border: 1px solid rgba(255,255,255,.25); border-radius: 999px;
  font: 600 11px ui-monospace, Consolas, monospace; padding: 3px 9px; cursor: pointer;
}
.fmt-btn:hover { background: rgba(20,20,20,.9); }
.sliders { flex: none; gap: 8px !important; }
.slider-row label { font-size: 20px !important; }

/* credits footer */
.site-footer {
  height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 20px; border-top: 1px solid var(--line); background: #1b1b1b; font-size: 12.5px; color: var(--muted);
}
.site-footer a { color: #d6d6d6; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.credit a { font-weight: 600; color: var(--text); }
.credit a:hover { color: var(--accent); }
.footer-links { display: flex; gap: 16px; }
.footer-links a { display: inline-flex; align-items: center; gap: 6px; }
.footer-links svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 1100px) {
  .site-footer { height: auto; flex-wrap: wrap; padding: 10px 16px; }
  .footer-links { flex-wrap: wrap; gap: 12px; }
}

.credit { display: inline-flex; align-items: center; gap: 8px; }
.credit img { height: 15px; width: auto; }
.modal-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.modal-brand img { width: 120px; height: auto; }
.modal-brand h2 { margin: 0; font-size: 24px; }
.modal-brand p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.modal-sub { font-size: 16px !important; }

/* general buttons (help modal, empty state) */
.btn {
  border: 1px solid #444; background: #333; border-radius: 10px; padding: 10px 18px; cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; color: var(--text);
}
.btn:hover { background: #3c3c3c; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
