/* ---------- Tokens ---------- */
:root {
  --bg: #fbfbfd;
  --bg-alt: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --line: rgba(0, 0, 0, 0.09);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-text: #0066cc;
  --good: #1a8a3a;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.04), 0 18px 48px rgba(0, 0, 0, 0.08);
  --nav-bg: rgba(251, 251, 253, 0.78);
  --radius-l: 28px;
  --radius-m: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-alt: #0d0d0f;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #86868b;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #0071e3;
    --accent-hover: #0a7cf0;
    --accent-text: #2997ff;
    --good: #30d158;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 18px 48px rgba(0, 0, 0, 0.5);
    --nav-bg: rgba(0, 0, 0, 0.72);
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --bg-alt: #0d0d0f;
  --surface: #1c1c1e;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #86868b;
  --line: rgba(255, 255, 255, 0.12);
  --accent-text: #2997ff;
  --good: #30d158;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 18px 48px rgba(0, 0, 0, 0.5);
  --nav-bg: rgba(0, 0, 0, 0.72);
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(0, 125, 250, 0.6); outline-offset: 2px; }
.wrap { width: min(980px, 100% - 32px); margin-inline: auto; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 48px;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.wordmark { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--text); letter-spacing: -0.01em; }
.wordmark:hover { text-decoration: none; }
.wordmark svg { width: 18px; height: 18px; }
.nav-cta { font-size: 13px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 22px;
  border: 0;
  border-radius: 980px;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.15s, opacity 0.2s;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.btn-lg { min-height: 52px; padding: 14px 30px; font-size: 18px; }
.btn-sm { min-height: 30px; padding: 5px 14px; font-size: 13px; }
.btn-secondary { background: transparent; color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-text); }
.btn-secondary:hover { background: rgba(0, 113, 227, 0.08); }
.link-arrow::after { content: " ›"; }

/* ---------- Landing ---------- */
.hero { padding: clamp(56px, 10vw, 120px) 0 clamp(48px, 7vw, 88px); text-align: center; overflow: hidden; }
.eyebrow { margin: 0 0 10px; font-size: clamp(17px, 2vw, 21px); font-weight: 600; color: var(--text-2); letter-spacing: -0.01em; }
.hero h1 {
  margin: 0;
  font-size: clamp(52px, 10.5vw, 104px);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.045em;
}
.hero h1 .grad {
  background: linear-gradient(100deg, #6e7bff 0%, #b06bff 45%, #ff7aa8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .sub { margin: 18px auto 0; max-width: 620px; font-size: clamp(21px, 2.6vw, 28px); line-height: 1.25; font-weight: 600; letter-spacing: -0.03em; color: var(--text); }
.hero .cta { margin-top: 34px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.meta { font-size: 14px; color: var(--text-3); letter-spacing: -0.01em; }

.hero-art { position: relative; margin: clamp(48px, 7vw, 80px) auto 0; width: min(760px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 2vw, 20px); }
.art-card {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: clamp(14px, 2.4vw, 24px);
  overflow: hidden;
  box-shadow: var(--shadow);
  background:
    radial-gradient(circle at 68% 30%, rgba(255, 250, 235, 0.95) 0 7%, rgba(255, 220, 170, 0.5) 7.5%, transparent 18%),
    linear-gradient(180deg, #ff9a7a 0%, #ffc6a0 46%, #ffe1c4 60%);
}
.art-card::before,
.art-card::after { content: ""; position: absolute; inset: auto 0 0 0; }
.art-card::before { height: 46%; background: #b65c6a; clip-path: polygon(0 40%, 14% 22%, 30% 38%, 46% 10%, 62% 34%, 78% 18%, 100% 36%, 100% 100%, 0 100%); }
.art-card::after { height: 30%; background: #4a2842; clip-path: polygon(0 30%, 20% 10%, 38% 34%, 58% 16%, 80% 38%, 100% 18%, 100% 100%, 0 100%); }
.art-card.b { filter: saturate(1.06) contrast(1.03); }
.art-label {
  position: absolute;
  z-index: 1;
  top: clamp(10px, 1.6vw, 16px);
  left: clamp(10px, 1.6vw, 16px);
  min-width: 34px;
  height: 34px;
  padding: 0 12px;
  display: grid;
  place-items: center;
  border-radius: 980px;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}
.art-q {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: clamp(48px, 7vw, 64px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--text);
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  box-shadow: var(--shadow);
  z-index: 2;
}

.section { padding: clamp(64px, 9vw, 112px) 0; }
.section.alt { background: var(--bg-alt); }
.section-head { max-width: 720px; }
.section h2 { margin: 0 0 18px; font-size: clamp(36px, 5.6vw, 56px); line-height: 1.07; font-weight: 700; letter-spacing: -0.04em; }
.lede { margin: 0; font-size: clamp(19px, 2.2vw, 24px); line-height: 1.38; color: var(--text-2); font-weight: 500; letter-spacing: -0.025em; }
.lede strong { color: var(--text); font-weight: 600; }
.prose { margin-top: 28px; max-width: 680px; color: var(--text-2); }
.prose p { margin: 0 0 16px; }
.prose strong { color: var(--text); font-weight: 600; }

.tiles { margin-top: clamp(36px, 5vw, 56px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tile { background: var(--surface); border-radius: var(--radius-m); padding: 26px 24px 24px; box-shadow: var(--shadow); }
.tile-k { font-size: 14px; font-weight: 600; color: var(--text-3); letter-spacing: -0.01em; }
.tile-v { margin-top: 6px; font-size: 28px; line-height: 1.12; font-weight: 700; letter-spacing: -0.035em; }
.tile-d { margin-top: 8px; font-size: 15px; line-height: 1.4; color: var(--text-2); letter-spacing: -0.015em; }
.footnote { margin-top: 20px; font-size: 13px; color: var(--text-3); letter-spacing: -0.01em; }

.rules { margin: clamp(32px, 4vw, 48px) 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; counter-reset: rule; }
.rules li { counter-increment: rule; position: relative; background: var(--surface); border-radius: var(--radius-m); padding: 24px 24px 24px 72px; box-shadow: var(--shadow); }
.rules li::before {
  content: counter(rule);
  position: absolute;
  left: 22px;
  top: 22px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--text);
  color: var(--bg);
  font-size: 15px;
  font-weight: 600;
}
.rules h3 { margin: 0 0 4px; font-size: 19px; line-height: 1.25; font-weight: 600; letter-spacing: -0.025em; }
.rules p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--text-2); letter-spacing: -0.015em; }

.closing { text-align: center; }
.closing h2 { margin-bottom: 26px; }
.closing .meta { margin-top: 14px; }

.footer { padding: 28px 0 40px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--text-3); letter-spacing: -0.005em; }

@media (max-width: 760px) {
  .tiles, .rules { grid-template-columns: 1fr; }
}

/* ---------- Test stage (always dark: photos are judged best on black) ---------- */
.stage {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: #000;
  color: #f5f5f7;
  --line: rgba(255, 255, 255, 0.14);
}
.stage-top { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
.stage-count { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; }
.stage-count span { color: #86868b; font-weight: 400; }
.progress { width: min(320px, 38vw); height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: #f5f5f7; border-radius: 4px; transition: width 0.45s cubic-bezier(0.25, 0.1, 0.25, 1); }
.icon-btn {
  justify-self: end;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  color: #f5f5f7;
  cursor: pointer;
  transition: background-color 0.2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.2); }
.icon-btn svg { width: 14px; height: 14px; }

.pair {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr);
  gap: 14px;
  padding: 4px 16px 16px;
}
.shot { margin: 0; min-width: 0; min-height: 0; container-type: size; display: flex; align-items: center; justify-content: center; }
.frame {
  position: relative;
  display: block;
  width: min(100cqw, 100cqh * var(--ar, 1.3333));
  aspect-ratio: var(--ar, 1.3333);
  border: 0;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #161618;
  cursor: zoom-in;
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow 0.25s, transform 0.25s;
}
.frame img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.35s; }
.frame img.loaded { opacity: 1; }
.frame.chosen { box-shadow: 0 0 0 3px #2997ff, 0 0 0 7px rgba(41, 151, 255, 0.25); }
.frame .spinner { position: absolute; inset: 0; margin: auto; }
.chip {
  position: absolute;
  top: 12px;
  left: 12px;
  min-width: 32px;
  height: 32px;
  padding: 0 11px;
  display: grid;
  place-items: center;
  border-radius: 980px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  pointer-events: none;
}
.frame.chosen .chip { background: #0071e3; }
.expand {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  pointer-events: none;
}
.expand svg { width: 14px; height: 14px; }

.stage-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px 22px;
  flex-wrap: wrap;
  padding: 14px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(22, 22, 24, 0.9);
}
.question { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; text-align: center; }
.choice-row { display: flex; align-items: center; gap: 12px; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 980px; background: rgba(255, 255, 255, 0.12); }
.segmented button {
  min-width: 64px;
  min-height: 38px;
  padding: 6px 18px;
  border: 0;
  border-radius: 980px;
  background: transparent;
  color: #f5f5f7;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.segmented button:hover { background: rgba(255, 255, 255, 0.08); }
.segmented button[aria-pressed="true"] { background: #f5f5f7; color: #1d1d1f; }
.stage .btn:disabled { opacity: 0.3; }

.stage-msg { flex: 1; display: grid; place-items: center; text-align: center; padding: 24px; }
.stage-msg h2 { margin: 18px 0 6px; font-size: 28px; letter-spacing: -0.03em; }
.stage-msg p { margin: 0 0 22px; color: #a1a1a6; }

@media (max-width: 820px) {
  .pair { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding: 0 12px 10px; }
  .frame { border-radius: 12px; }
  .chip { top: 10px; left: 10px; }
  .expand { right: 10px; bottom: 10px; }
  .stage-bar { gap: 10px 14px; padding-top: 12px; }
  .question { width: 100%; font-size: 16px; }
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.85);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Full-screen viewer ---------- */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #000;
  color: #f5f5f7;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  animation: fade-in 0.2s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }
.viewer-canvas { position: absolute; inset: 0; overflow: hidden; cursor: zoom-in; }
.viewer-canvas.zoomed { cursor: grab; }
.viewer-canvas.dragging { cursor: grabbing; }
.viewer-layer { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.viewer-layer.animate { transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1); }
.viewer-layer img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; }
.viewer-layer img.off { visibility: hidden; }
.viewer-top { position: absolute; inset: 0 0 auto 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); pointer-events: none; }
.viewer-top > * { pointer-events: auto; }
.viewer-badge { font-size: 15px; font-weight: 600; padding: 7px 14px; border-radius: 980px; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.viewer-bottom {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  pointer-events: none;
}
.viewer-bottom > * { pointer-events: auto; }
.viewer-hint { font-size: 13px; color: rgba(255, 255, 255, 0.7); letter-spacing: -0.01em; pointer-events: none; }
.viewer-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.viewer .segmented { background: rgba(40, 40, 42, 0.8); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

/* ---------- Result page ---------- */
.result { padding: clamp(48px, 9vw, 104px) 0 clamp(64px, 9vw, 112px); text-align: center; }
.verified { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--good); letter-spacing: -0.01em; }
.verified svg { width: 16px; height: 16px; }
.score { margin: 14px 0 0; font-size: clamp(96px, 22vw, 184px); line-height: 0.95; font-weight: 700; letter-spacing: -0.06em; font-variant-numeric: tabular-nums; }
.score .of { color: var(--text-3); }
.score-cap { margin: 14px 0 0; font-size: clamp(20px, 2.6vw, 26px); font-weight: 600; letter-spacing: -0.03em; }
.dots { margin: 26px auto 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; max-width: 420px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.dot.on { background: var(--text); }
.verdict { margin: clamp(40px, 6vw, 60px) auto 0; max-width: 640px; text-align: left; background: var(--surface); border-radius: var(--radius-l); padding: clamp(26px, 4vw, 40px); box-shadow: var(--shadow); }
.verdict h2 { margin: 0 0 10px; font-size: clamp(26px, 3.6vw, 34px); line-height: 1.12; font-weight: 700; letter-spacing: -0.035em; }
.verdict p { margin: 0; color: var(--text-2); }
.bar { position: relative; margin-top: 26px; height: 8px; border-radius: 8px; background: var(--bg-alt); }
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 8px; background: var(--text); }
.bar-chance { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: var(--text-3); }
.bar-legend { margin-top: 10px; display: flex; justify-content: space-between; font-size: 13px; color: var(--text-3); letter-spacing: -0.01em; }
.facts { margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 24px; border-top: 1px solid var(--line); }
.facts dt { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.facts dd { margin: 4px 0 0; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 480px) {
  .facts { grid-template-columns: 1fr 1.25fr 0.75fr; }
  .facts dd { font-size: 15px; }
}
.result-actions { margin-top: 36px; display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.fine { margin: 28px auto 0; max-width: 520px; font-size: 13px; line-height: 1.5; color: var(--text-3); letter-spacing: -0.01em; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  translate: -50% 0;
  z-index: 60;
  padding: 11px 18px;
  border-radius: 980px;
  background: rgba(29, 29, 31, 0.92);
  color: #f5f5f7;
  font-size: 15px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: toast 2.2s ease forwards;
  pointer-events: none;
}
@keyframes toast {
  0% { opacity: 0; transform: translateY(8px); }
  12%, 80% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
