/* Color Match — No. 099
 * The target colour IS the page, so every piece of chrome has to survive being
 * dropped on any hue. JS flips --chrome / --chrome-bg by target luminance and
 * everything else reads from those two tokens. Self-contained. */

:root {
  --ink: #f2f3f7;
  --target: #6b7280;
  --mine: #9ca3af;
  /* set from JS: light chrome on a dark target, dark chrome on a light one */
  --chrome: rgba(255, 255, 255, 0.62);
  --chrome-strong: rgba(255, 255, 255, 0.95);
  --chrome-bg: rgba(14, 14, 18, 0.72);
  --chrome-line: rgba(255, 255, 255, 0.18);
  --chrome-ink: #ffffff;
  --chrome-inv: #14141a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #1b1b20;
  color: var(--ink);
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ------------------------------------------------------------- the colours */

.field {
  position: fixed;
  inset: 0;
  background: var(--target);
  transition: background 260ms ease;
}

.swatch {
  position: fixed;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  width: min(430px, 78vw);
  height: min(380px, 38vh);
  border-radius: 20px;
  background: var(--mine);
  display: grid;
  place-items: center;
  /* no border and no shadow on purpose — any edge treatment would give the
     match away, and vanishing cleanly into the field is the whole payoff */
  transition: transform 260ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.swatch.is-locked { transform: translate(-50%, -50%) scale(1.04); }

.swatch__verdict {
  padding: 14px 20px;
  border-radius: 14px;
  text-align: center;
  background: var(--chrome-bg);
  border: 1px solid var(--chrome-line);
  color: var(--chrome-ink);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: vpop 380ms cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
.swatch__verdict[hidden] { display: none; }
.swatch__verdict b {
  display: block;
  font-size: clamp(30px, 8vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}
.swatch__verdict span {
  display: block;
  margin-top: 5px;
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.72;
}
@keyframes vpop { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

/* ------------------------------------------------------------------ frame */

.frame { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.frame__corner {
  position: absolute;
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--chrome);
  transition: color 260ms ease;
}
.frame__corner--tl { top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); }
.frame__corner--tr { top: max(14px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); }
.frame__corner--bl { top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); pointer-events: auto; white-space: nowrap; }
.frame__corner--bl a { color: inherit; text-decoration: none; }
.frame__corner--bl a:hover { color: var(--chrome-strong); }
.frame__corner--bl a:focus-visible { outline: 2px solid var(--chrome-strong); outline-offset: 3px; }

/* ------------------------------------------------------------ sound button */

.sound-btn {
  position: fixed;
  top: max(44px, calc(env(safe-area-inset-top) + 44px));
  right: max(14px, env(safe-area-inset-right));
  z-index: 7;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--chrome-bg);
  border: 1px solid var(--chrome-line);
  border-radius: 50%;
  color: var(--chrome-ink);
  font-size: 14px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.sound-btn:focus-visible { outline: 2px solid var(--chrome-strong); outline-offset: 3px; }
.sound-btn[aria-pressed="false"] { opacity: 0.45; }

/* ------------------------------------------------------------------- dock */

.dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 8;
  width: min(430px, calc(100% - 24px));
  padding: 14px 16px 15px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--chrome-bg);
  border: 1px solid var(--chrome-line);
  border-radius: 18px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
  color: var(--chrome-ink);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.dock[hidden] { display: none; }

.dock__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.dock__round {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.66;
}
.pips { display: inline-flex; gap: 5px; }
.pip { width: 20px; height: 4px; border-radius: 99px; background: currentColor; opacity: 0.22; }
.pip.is-on { opacity: 0.95; }

/* ---- sliders ---- */
.slider { display: grid; grid-template-columns: 42px 1fr 44px; align-items: center; gap: 10px; }
.slider label {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.66;
}
.slider output {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  opacity: 0.86;
}

input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 99px;
  background: var(--track, #888);
  border: 1px solid rgba(0, 0, 0, 0.22);
}
input[type="range"]::-moz-range-track {
  height: 12px;
  border-radius: 99px;
  background: var(--track, #888);
  border: 1px solid rgba(0, 0, 0, 0.22);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.42);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.42);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
input[type="range"]:focus-visible { outline: 2px solid var(--chrome-strong); outline-offset: 4px; border-radius: 99px; }

.lock {
  margin-top: 4px;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--chrome-inv);
  background: var(--chrome-ink);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.16s ease;
}
.lock:hover { transform: translateY(-1px); filter: brightness(0.94); }
.lock:active { transform: translateY(1px); }
.lock:focus-visible { outline: 2px solid var(--chrome-strong); outline-offset: 3px; }

/* ---------------------------------------------------------------- overlay */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(120% 100% at 50% 30%, rgba(46, 46, 60, 0.8) 0%, rgba(10, 10, 14, 0.96) 74%);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: ovIn 0.35s ease both;
}
.overlay[hidden] { display: none; }
@keyframes ovIn { from { opacity: 0; } to { opacity: 1; } }

.panel {
  width: min(460px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 26px 26px 24px;
  text-align: center;
  background: linear-gradient(170deg, rgba(38, 38, 50, 0.95) 0%, rgba(14, 14, 19, 0.97) 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  color: var(--ink);
}
.panel__eyebrow {
  margin: 0 0 8px;
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #8be0c8;
}
.panel__title {
  margin: 0 0 12px;
  font-size: clamp(32px, 7.4vw, 46px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}
.panel__text { margin: 0 0 20px; font-size: 14.5px; line-height: 1.6; color: rgba(242, 243, 247, 0.78); }
.panel__text b { color: var(--ink); font-weight: 700; }
.panel__keys {
  margin: 14px 0 0;
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(242, 243, 247, 0.38);
}

/* the five round results, target over yours */
.pairs { display: flex; gap: 8px; justify-content: center; margin: 0 0 20px; flex-wrap: wrap; }
.pairs[hidden] { display: none; }
.pair { width: 56px; }
.pair__sw { height: 26px; border-radius: 7px 7px 0 0; }
.pair__sw + .pair__sw { border-radius: 0 0 7px 7px; }
.pair__n {
  margin: 5px 0 0;
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px;
  color: rgba(242, 243, 247, 0.6);
}

.play-btn {
  display: inline-block;
  padding: 13px 34px;
  font-size: 14.5px;
  font-weight: 800;
  font-family: inherit;
  color: #06231c;
  background: linear-gradient(180deg, #b6f4dd 0%, #6fdcb8 56%, #34b48d 100%);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(52, 180, 141, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.14s ease, filter 0.18s ease;
}
.play-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.play-btn:active { transform: translateY(1px); }
.play-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* -------------------------------------------------- shared-badge docking
 * The dock owns the bottom and the swatch owns the middle. */
.opt-tipjar.opt-tipjar { top: calc(max(88px, env(safe-area-inset-top) + 88px)); bottom: auto; transform: none; }
.opt-fs.opt-fs { top: calc(max(142px, env(safe-area-inset-top) + 142px)); bottom: auto; transform: none; }
.opt-tipjar.opt-tipjar.tj-nudge { animation: none; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 560px) {
  .panel { padding: 22px 18px 20px; border-radius: 15px; }
  .pair { width: 48px; }
}
@media (max-height: 560px) {
  .swatch { top: 33%; height: min(190px, 30vh); }
  .dock { padding: 10px 14px 12px; gap: 7px; }
  .panel { padding: 16px 18px 16px; }
  .panel__title { font-size: clamp(22px, 5vh, 30px); margin-bottom: 6px; }
  .panel__text { font-size: 12.5px; margin-bottom: 12px; }
  .panel__keys { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .overlay, .swatch__verdict { animation: none; }
  .field, .swatch, .lock, .frame__corner { transition: none; }
}
