:root {
  --paper: #f3f1ea;
  --ink: #1b1b1b;
  --muted: #6b6a64;
  --teal: #0f766e;
  --red: #d62828;
  --amber: #f4a11a;
  --green: #39ff88;
  --monitor: #0b0f0c;
  --line: #d9d5c8;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.testing { overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.hidden { display: none !important; }

button { font: inherit; cursor: pointer; }
.btn-primary, .btn-secondary {
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0.8em 1.8em;
  font-weight: 700;
  font-size: 1.05rem;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--teal); border-color: var(--teal); }
.btn-secondary { background: transparent; color: var(--ink); }
.btn-secondary:hover { background: #e7e3d6; }

.kicker { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal); margin: 0 0 0.5rem; }
.fine { font-size: 0.85rem; color: var(--muted); }

/* ───────── INTRO ───────── */
#intro { min-height: 100%; display: flex; flex-direction: column; align-items: center; padding: 6vh 1.25rem 2rem; }
.clinic { max-width: 640px; width: 100%; }
h1 { font-size: clamp(2.4rem, 7vw, 4.2rem); line-height: 1.02; margin: 0 0 1rem; letter-spacing: -0.03em; }
h1 sub { font-size: 0.5em; }
.lede { font-size: 1.15rem; margin: 0 0 1.75rem; }
.protocol {
  border: 2px dashed var(--ink);
  border-radius: 12px;
  padding: 1rem 1.4rem;
  margin-bottom: 1.75rem;
  background: #fbfaf5;
}
.protocol h2 { font-family: var(--mono); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.08em; margin: 0.2rem 0 0.5rem; }
.protocol ol { margin: 0; padding-left: 1.3rem; }
.protocol li { margin: 0.15rem 0; }
.stats { font-family: var(--mono); font-size: 0.85rem; min-height: 1.5em; }
footer { margin-top: auto; padding-top: 3rem; font-size: 0.8rem; color: var(--muted); text-align: center; }

/* ───────── TEST ───────── */
#test { position: fixed; inset: 0; display: flex; flex-direction: column; background: #ece9df; }
.monitor {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  background: var(--monitor);
  color: var(--green);
  font-family: var(--mono);
  padding: 0.6rem 1rem;
  border-bottom: 3px solid #000;
}
.monitor-left { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.72rem; letter-spacing: 0.08em; }
.rec { color: var(--red); animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
#ecg { width: 100%; height: 64px; display: block; }
.readouts { display: flex; gap: 1.25rem; }
.readouts > div { display: flex; flex-direction: column; align-items: flex-end; }
.ro-label { font-size: 0.65rem; letter-spacing: 0.1em; opacity: 0.7; }
.ro-value { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 4ch; text-align: right; }
.ro-value.hot { color: var(--red); }
.ro-value.warm { color: var(--amber); }
.ro-value.overtime { color: var(--amber); font-size: 1.1rem; }
#flashes { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; z-index: 60; padding-top: 6px; }
.flash {
  background: var(--red); color: #fff; font-family: var(--mono); font-weight: 700; font-size: 0.85rem;
  padding: 0.25rem 0.7rem; border-radius: 4px; animation: flash 1.6s ease-out forwards; white-space: nowrap;
}
@keyframes flash { 0% { transform: scale(1.4); opacity: 0; } 10% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }

.ticker { background: var(--amber); color: #000; font-weight: 700; font-family: var(--mono); font-size: 0.85rem; overflow: hidden; white-space: nowrap; border-bottom: 2px solid #000; }
.ticker-track { display: inline-block; padding: 0.35rem 0; animation: ticker 40s linear infinite; }
.ticker.fast .ticker-track { animation-duration: 12s; }
@keyframes ticker { from { transform: translateX(100vw); } to { transform: translateX(-100%); } }

#stage { flex: 1; display: grid; grid-template-columns: 1fr 340px; gap: 1.25rem; padding: 1.25rem; overflow: hidden; }
.feed { display: flex; flex-direction: column; gap: 0.75rem; overflow: hidden; justify-content: flex-end; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0.85rem 1rem;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04); font-size: 1.05rem; animation: rise 0.3s ease-out;
}
.card .who { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); display: block; margin-bottom: 0.2rem; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
.side { display: flex; flex-direction: column; gap: 1rem; overflow: hidden; }

.poster {
  align-self: center; width: 220px; background: #fff; border: 10px solid #5b3b1f; padding: 1rem; text-align: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18); transform: rotate(1.4deg); transition: transform 1.2s ease;
}
.poster .cat { font-size: 3.4rem; display: block; line-height: 1; }
.poster .caption { font-family: Impact, "Arial Black", sans-serif; font-size: 1.5rem; letter-spacing: 0.02em; }

.chat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 0.8rem; }
.chat-head { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.9rem; margin-bottom: 0.5rem; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #8ecae6; display: grid; place-items: center; font-size: 0.9rem; }
.bubble { background: #e9e9eb; border-radius: 16px; padding: 0.45rem 0.8rem; display: inline-block; margin: 0.15rem 0; font-size: 0.95rem; }
.typing { color: var(--muted); font-size: 0.8rem; font-style: italic; min-height: 1.3em; }
.dots span { animation: dot 1.2s infinite; display: inline-block; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }

.progress { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem; font-size: 0.85rem; }
.progress .bar { height: 12px; background: #e6e3da; border-radius: 6px; overflow: hidden; margin-top: 0.4rem; }
.progress .fill { height: 100%; width: 0; background: var(--teal); transition: width 0.6s ease; }
.progress .pct { float: right; font-family: var(--mono); }

.cookie {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; border-top: 3px solid var(--ink);
  min-height: 130px; padding: 1rem 1.25rem; display: flex; gap: 1rem; align-items: flex-start; animation: slideup 0.4s ease-out;
}
@keyframes slideup { from { transform: translateY(100%); } }
.cookie p { margin: 0; max-width: 520px; font-size: 0.92rem; }
.cookie .accept { margin-left: auto; }
.cookie .reject { position: absolute; left: 70%; top: 60%; transition: left 0.15s ease, top 0.15s ease; }
.cookie button { border: 2px solid var(--ink); border-radius: 8px; padding: 0.5rem 1.1rem; font-weight: 700; background: #fff; }
.cookie .accept { background: var(--teal); color: #fff; border-color: var(--teal); }

#toasts { position: fixed; top: 132px; left: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 50; width: min(340px, calc(100vw - 2rem)); }
.toast {
  background: #fff; border-radius: 12px; padding: 0.7rem 2.2rem 0.7rem 0.9rem; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  font-size: 0.9rem; position: relative; animation: rise 0.3s ease-out;
}
.toast .x { position: absolute; top: 0.35rem; right: 0.4rem; background: none; border: 0; font-size: 1.1rem; color: var(--muted); padding: 0.2rem 0.4rem; }

.ad {
  position: fixed; left: 1rem; bottom: 150px; z-index: 45; width: 280px; background: #111; color: #fff; border-radius: 10px;
  padding: 0.9rem; font-size: 0.88rem; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3); animation: rise 0.3s ease-out;
}
.ad .sponsored { font-size: 0.65rem; letter-spacing: 0.1em; opacity: 0.6; text-transform: uppercase; }
.ad strong { display: block; font-size: 1.05rem; margin: 0.2rem 0; }
.ad .skip { margin-top: 0.6rem; background: rgba(255, 255, 255, 0.12); color: #fff; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 4px; padding: 0.35rem 0.7rem; font-size: 0.8rem; }

.end-early {
  position: fixed; right: 1rem; bottom: 150px; z-index: 44; background: var(--teal); color: #fff; border: 0; border-radius: 999px;
  padding: 0.8rem 1.3rem; font-weight: 700; box-shadow: 0 6px 18px rgba(15, 118, 110, 0.45); animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.06); } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 70; display: grid; place-items: center; animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 14px; padding: 1.4rem 1.6rem; max-width: 360px; text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); }
.modal h3 { margin: 0 0 0.4rem; }
.modal .row { display: flex; gap: 0.6rem; justify-content: center; margin-top: 1rem; }
.modal button { border: 2px solid var(--ink); background: #fff; border-radius: 8px; padding: 0.5rem 1.1rem; font-weight: 700; }

.survey { position: fixed; right: 1rem; bottom: 220px; z-index: 46; background: #fff; border-radius: 12px; padding: 0.9rem; width: 320px; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.2); font-size: 0.88rem; animation: rise 0.3s; }
.survey .nps { display: flex; gap: 3px; margin-top: 0.5rem; }
.survey .nps button { flex: 1; padding: 0.3rem 0; border: 1px solid var(--line); background: #faf9f5; border-radius: 4px; font-size: 0.78rem; }

.finish {
  position: fixed; inset: 0; z-index: 80; background: rgba(243, 241, 234, 0.96); display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 1rem; animation: fade 0.3s;
}
.finish h2 { font-size: clamp(2.5rem, 8vw, 5rem); margin: 0; }
.finish .confetti { font-size: 3rem; letter-spacing: 0.3em; }
.finish.jk h2 { color: var(--red); }

/* ───────── REPORT ───────── */
#report { min-height: 100%; padding: 4vh 1rem 2rem; display: flex; flex-direction: column; align-items: center; }
.paper {
  width: 100%; max-width: 760px; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 2rem clamp(1.1rem, 4vw, 2.5rem); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  background-image: repeating-linear-gradient(#fff 0 31px, #f1efe8 31px 32px);
}
.paper-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 0.8rem; }
.paper-head h2 { margin: 0; font-size: 1.4rem; }
.patient { display: flex; flex-direction: column; font-family: var(--mono); font-size: 0.8rem; text-align: right; }
.headline { display: grid; grid-template-columns: auto 1fr; gap: 2rem; align-items: center; margin: 1.5rem 0; }
.big { display: flex; flex-direction: column; }
.big-label { font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.big-score { font-size: clamp(5rem, 16vw, 8rem); font-weight: 800; line-height: 0.95; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.big-unit { font-size: 0.8rem; color: var(--muted); }
.stamp {
  display: inline-block; border: 4px solid var(--red); color: var(--red); font-family: var(--mono); font-weight: 800;
  text-transform: uppercase; font-size: clamp(1.1rem, 3.5vw, 1.6rem); padding: 0.2rem 0.7rem; transform: rotate(-4deg);
  border-radius: 6px; letter-spacing: 0.04em; mix-blend-mode: multiply;
}
.stamp.good { border-color: var(--teal); color: var(--teal); }
.verdict p { margin: 0.8rem 0 0; }
.percentile { font-family: var(--mono); font-size: 0.9rem; min-height: 1.4em; }
.vitals { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.9rem; margin-bottom: 1.25rem; }
.vitals th { text-align: left; font-weight: 400; color: var(--muted); padding: 0.3rem 0; border-bottom: 1px dotted var(--line); }
.vitals td { text-align: right; font-weight: 700; padding: 0.3rem 0; border-bottom: 1px dotted var(--line); }
.baits h3, .coach h3 { font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 0.4rem; }
.baits ul { margin: 0 0 1.25rem; padding-left: 1.2rem; }
.handwriting { font-family: "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive; font-size: 1.25rem; color: #1d3fbf; margin: 0; }
.signature { font-size: 0.8rem; color: var(--muted); margin: 0.3rem 0 1rem; }
.rx { border-top: 2px solid var(--ink); padding-top: 0.8rem; }
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.25rem; }

@media (max-width: 760px) {
  .monitor { grid-template-columns: 1fr auto; }
  .monitor-left { display: none; }
  .ro-value { font-size: 1.3rem; }
  #stage { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #stage { padding: 0.75rem; gap: 0.75rem; }
  .side { order: -1; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; align-items: start; }
  .poster { display: none; }
  .chat, .progress { padding: 0.55rem; font-size: 0.8rem; }
  .bubble { font-size: 0.8rem; }
  .mute { grid-column: 1 / -1; font-size: 0.85rem !important; padding: 0.4rem 1rem !important; }
  #toasts { top: 300px; left: 1rem; }
  .ad { width: calc(100vw - 2rem); bottom: 140px; }
  .end-early { bottom: 240px; }
  .survey { width: calc(100vw - 2rem); }
  .headline { grid-template-columns: 1fr; gap: 1rem; }
  .patient { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation-duration: 80s; }
  .end-early { animation: none; }
}

/* ───────── v2: feedback, new bait, challenge ───────── */
#test.hit::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 90;
  box-shadow: inset 0 0 140px rgba(214, 40, 40, 0.6); animation: hitfade 0.5s ease-out forwards;
}
#test.hit #stage { animation: shake 0.3s; }
@keyframes hitfade { to { opacity: 0; } }
@keyframes shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
.ro-value.frozen { color: var(--amber); animation: blink 0.8s steps(2) infinite; }

.countdown {
  position: fixed; inset: 0; z-index: 95; background: rgba(11, 15, 12, 0.92); color: var(--green); font-family: var(--mono);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
}
.count-label { letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.95rem; }
.count { font-size: clamp(6rem, 24vw, 12rem); font-weight: 800; line-height: 1; }

.pause { position: fixed; inset: 0; z-index: 65; background: rgba(11, 15, 12, 0.6); display: grid; place-items: center; cursor: pointer; animation: fade 0.2s; }
.pause-box {
  background: var(--monitor); color: var(--amber); font-family: var(--mono); border: 2px solid var(--amber); border-radius: 10px;
  padding: 1.2rem 1.8rem; display: flex; flex-direction: column; gap: 0.4rem; text-align: center; max-width: calc(100vw - 2rem);
}
.pause-box strong { font-size: 1.5rem; letter-spacing: 0.06em; }

.captcha {
  position: fixed; left: 50%; top: 34%; transform: translateX(-50%); z-index: 48; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 1rem; width: min(340px, calc(100vw - 2rem)); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22); animation: fade 0.3s;
}
.captcha-title { font-size: 0.9rem; margin-bottom: 0.7rem; }
.captcha-title:last-child { margin-bottom: 0; }
.captcha-box {
  display: flex; align-items: center; gap: 0.8rem; width: 100%; background: #f9f9f9; border: 1px solid #d3d3d3; border-radius: 4px;
  padding: 0.9rem; font-size: 1rem; text-align: left;
}
.captcha-box .check { width: 26px; height: 26px; border: 2px solid #c1c1c1; border-radius: 3px; background: #fff; flex: none; }

.fly { position: fixed; left: -6vw; top: 40vh; z-index: 55; font-size: 1.7rem; padding: 0.4rem; cursor: pointer; transition: left 0.45s ease-in-out, top 0.45s ease-in-out, transform 0.2s; }

.challenge {
  display: inline-block; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 0.9rem; font-weight: 700;
  padding: 0.45rem 0.9rem; border-radius: 6px; margin: 0 0 1rem; transform: rotate(-1deg);
}
.versus { font-weight: 700; }
.also { color: var(--muted); font-size: 0.85rem; }
#intro-best:empty, #r-versus:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  #test.hit #stage { animation: none; }
}

@media (max-width: 760px) {
  #toasts .toast:nth-last-child(n + 3) { display: none; }
  .captcha { top: auto; bottom: 150px; }
}

/* ───────── v3: the fake funnel ───────── */
#gate { min-height: 100%; background: #fff; color: #313131; }
.gate-wrap { max-width: 60rem; margin: 0 auto; padding: 8rem 1.5rem 2rem; }
.gate-host { font-size: 2.5rem; font-weight: 500; letter-spacing: 0; line-height: 3.75rem; margin: 0; }
.gate-lead { font-size: 1.5rem; font-weight: 500; line-height: 2.25rem; margin: 0 0 2rem; }
.gate-widget {
  width: 300px; max-width: 100%; height: 65px; border: 1px solid #e0e0e0; background: #fafafa; display: flex; align-items: center;
  justify-content: space-between; padding: 0 12px; font-size: 14px;
}
.gate-left { display: flex; align-items: center; gap: 12px; }
.gate-check { width: 28px; height: 28px; border: 2px solid #6d6d6d; border-radius: 3px; background: #fff; padding: 0; }
.gate-check:hover { border-color: #313131; }
.gate-ok { width: 28px; height: 28px; border-radius: 50%; background: #2db35d; color: #fff; display: grid; place-items: center; font-weight: 700; }
.spinner { width: 28px; height: 28px; border: 3px solid #e0e0e0; border-top-color: #2db35d; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gate-brand { display: flex; flex-direction: column; align-items: flex-end; font-size: 8px; color: #595959; gap: 3px; }
.gate-brand strong { font-size: 10px; letter-spacing: 0.06em; color: #313131; }
.gate-note { font-size: 1.5rem; line-height: 2.25rem; margin: 2rem 0 0; }
.gate-foot { margin-top: 6rem; padding-top: 1rem; border-top: 1px solid #d9d9d9; text-align: center; font-size: 0.75rem; line-height: 1.6; color: #313131; }
.gate-challenge { width: 300px; max-width: 100%; border: 1px solid #e0e0e0; background: #fff; margin-top: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); }
.gate-ch-head { background: #1a73e8; color: #fff; padding: 14px; display: flex; flex-direction: column; font-size: 14px; }
.gate-ch-head strong { font-size: 24px; }
.gate-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px; }
.gate-tile { aspect-ratio: 1; font-size: 2.2rem; background: #f1f1f1; border: 0; padding: 0; transition: transform 0.1s; }
.gate-tile.on { transform: scale(0.82); outline: 4px solid #1a73e8; }
.gate-verify { display: block; margin: 4px 6px 8px auto; background: #1a73e8; color: #fff; border: 0; border-radius: 3px; padding: 0.6rem 1.4rem; font-weight: 600; text-transform: uppercase; font-size: 0.85rem; }

.cmp-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.55); display: flex; align-items: flex-end; animation: fade 0.25s; }
.cmp { background: #fff; width: 100%; padding: 1.5rem clamp(1rem, 4vw, 3rem); display: flex; gap: 2rem; align-items: center; box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2); animation: slideup 0.35s ease-out; max-height: 90vh; overflow: auto; }
.cmp h2 { font-size: 1.1rem; margin: 0 0 0.5rem; color: #1b1b1b; }
.cmp p { font-size: 0.82rem; line-height: 1.5; color: #444; margin: 0 0 0.5rem; }
.cmp .cmp-sub { color: #6b6b6b; font-size: 0.76rem; }
.cmp-btns { display: flex; flex-direction: column; gap: 0.5rem; flex: none; min-width: 220px; }
.cmp-btn { border-radius: 4px; padding: 0.75rem 1.2rem; font-weight: 600; font-size: 0.9rem; border: 1px solid #0b57d0; }
.cmp-btn.solid { background: #0b57d0; color: #fff; order: -1; }
.cmp-btn.outline { background: #fff; color: #0b57d0; }
.cmp-btn.ghost { background: none; border-color: transparent; color: #0b57d0; text-decoration: underline; font-weight: 500; padding: 0.4rem; }
.cmp.prefs { flex-direction: column; align-items: stretch; gap: 1rem; max-width: 560px; margin: 0 auto 6vh; border-radius: 8px; }
.cmp.prefs .cmp-btns { flex-direction: row; justify-content: flex-end; }
.cmp.prefs .cmp-btn.solid { order: 0; }
.cmp-row { display: flex; justify-content: space-between; align-items: center; padding: 0.7rem 0; border-bottom: 1px solid #e6e6e6; font-size: 0.9rem; }
.cmp-row em { font-style: normal; color: #0b57d0; font-size: 0.8rem; font-weight: 600; }
.switch { appearance: none; width: 40px; height: 22px; border-radius: 11px; background: #bbb; position: relative; cursor: pointer; margin: 0; transition: background 0.15s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.switch:checked { background: #0b57d0; }
.switch:checked::after { left: 20px; }

.wall-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 1rem; animation: fade 0.25s; }
.wall { background: #fff; border-radius: 24px; width: min(400px, 100%); padding: 2rem 1.75rem 1.5rem; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.wall-logo { width: 44px; height: 44px; }
.wall h2 { font-size: 1.6rem; margin: 0.6rem 0 0.2rem; letter-spacing: -0.02em; }
.wall-sub { color: #555; margin: 0 0 1.25rem; font-size: 0.95rem; }
.wall-btn { display: flex; align-items: center; justify-content: center; gap: 0.7rem; width: 100%; border: 1px solid #dadce0; background: #fff; border-radius: 999px; padding: 0.75rem 1rem; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.6rem; }
.wall-btn:first-of-type { background: #e60023; border-color: #e60023; color: #fff; }
.wall-btn:hover { filter: brightness(0.96); }
.wall-icon { width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #333; display: grid; place-items: center; font-size: 0.8rem; font-weight: 800; border: 1px solid #dadce0; }
.wall-msg { font-size: 0.85rem; color: var(--teal); font-weight: 600; margin: 0.4rem 0 0; min-height: 0; }
.wall-msg:empty { display: none; }
.wall-or { color: #999; font-size: 0.8rem; margin: 0.5rem 0 0.2rem; }
.wall-guest { background: none; border: 0; color: #767676; font-size: 0.8rem; text-decoration: underline; padding: 0.3rem; }
.wall-fine { font-size: 0.68rem; color: #999; margin: 1rem 0 0; }

.perm { position: fixed; top: 96px; left: 90px; z-index: 58; background: #fff; border-radius: 12px; padding: 1rem; width: 320px; max-width: calc(100vw - 2rem); box-shadow: 0 6px 30px rgba(0, 0, 0, 0.3); font-size: 0.9rem; animation: fade 0.2s; }
.perm-title { font-weight: 600; margin-bottom: 0.5rem; }
.perm-row { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
.perm-row button { border: 1px solid #dadce0; background: #fff; color: #0b57d0; border-radius: 999px; padding: 0.45rem 1.2rem; font-weight: 600; }

@media (max-width: 760px) {
  .gate-wrap { padding-top: 4rem; }
  .gate-host { font-size: 1.9rem; }
  .gate-lead, .gate-note { font-size: 1.15rem; line-height: 1.75rem; }
  .cmp { flex-direction: column; align-items: stretch; gap: 1rem; }
  .perm { left: 1rem; }
}
.cmp-btn.ghost { order: 1; }
.cmp.prefs .cmp-btn.ghost { order: 0; }
.cookie .accept { background: #0b57d0; border-color: #0b57d0; border-radius: 4px; }
.cookie .reject { color: #0b57d0; border: 1px solid #0b57d0; border-radius: 4px; }

/* ───────── v4: the funnel is the bait ───────── */
.gate-err { color: #d93025; font-size: 13px; font-weight: 600; padding: 6px 10px 0; min-height: 0; }
.gate-err:empty { display: none; }
.gate-ch-head span:last-child:not(:first-child) { font-size: 12px; margin-top: 4px; opacity: 0.9; }
.gate-tile { transition: transform 0.1s, opacity 1.4s ease; }
.gate-tile.fading { opacity: 0; }
.cmp-bar { height: 8px; background: #e6e6e6; border-radius: 4px; overflow: hidden; margin: 0.25rem 0 0.75rem; }
.cmp-fill { height: 100%; width: 0; background: #0b57d0; transition: width 0.1s linear; }
.cmp-list { max-height: 44vh; overflow: auto; }
.sheet { background: #fff; width: 100%; border-radius: 18px 18px 0 0; padding: 1.25rem 1.25rem 1.75rem; animation: slideup 0.3s ease-out; max-width: 560px; margin: 0 auto; }
.sheet h2 { font-size: 1.05rem; margin: 0 0 0.9rem; text-align: center; }
.sheet-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 0; }
.sheet-icon { font-size: 1.6rem; }
.sheet-name { flex: 1; font-weight: 600; }
.sheet-open, .sheet-continue { border-radius: 999px; padding: 0.55rem 1.4rem; font-weight: 700; font-size: 0.9rem; min-width: 110px; }
.sheet-open { background: #d93a00; color: #fff; border: 1px solid #d93a00; }
.sheet-continue { background: #e9ebed; color: #1b1b1b; border: 1px solid #e9ebed; }
.reveal { background: var(--monitor); color: #e8ffe8; border-radius: 12px; padding: 1.1rem 1.4rem; margin-bottom: 1.25rem; font-size: 0.95rem; }
.reveal h2 { color: var(--green); font-family: var(--mono); font-size: 1rem; margin: 0 0 0.4rem; }
.reveal p { margin: 0 0 0.5rem; }
.reveal ul { margin: 0 0 0.7rem; padding-left: 1.2rem; }
.reveal li { margin: 0.2rem 0; }
.reveal-score { font-family: var(--mono); font-weight: 700; color: var(--amber); margin: 0 !important; }
/* Until the visitor gets in, the page behind the walls shows only the headline. */
#intro.locked .protocol, #intro.locked #begin, #intro.locked .fine, #intro.locked .stats { display: none; }

/* ───────── v5: part 2 is a course of unfair tasks ───────── */
#stage { display: flex; align-items: flex-start; justify-content: center; padding: clamp(0.75rem, 4vh, 2.5rem) 1rem 1rem; overflow: auto; }
.task { width: min(560px, 100%); }
.task-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem 1.4rem 1.1rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); animation: rise 0.25s ease-out; }
.task-n { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--teal); margin: 0 0 0.3rem; }
.task-card h2 { font-size: clamp(1.4rem, 4.5vw, 1.9rem); line-height: 1.15; margin: 0 0 0.25rem; letter-spacing: -0.02em; }
.task-sub { color: var(--muted); margin: 0 0 1rem; }
.task-sub:empty { display: none; }
.task-msg { font-family: var(--mono); font-size: 0.85rem; font-weight: 700; color: var(--red); margin: 0.9rem 0 0; min-height: 2.6em; }
.task-row { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.task-col { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 0.82rem; padding: 0.3rem; }

.arena { position: relative; height: clamp(190px, 34vh, 280px); border: 2px dashed var(--line); border-radius: 10px; overflow: hidden; }
.runner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); white-space: nowrap; transition: left 0.14s ease-out, top 0.14s ease-out; }

.vol-out { font-size: 4rem; font-weight: 800; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.vol-row { display: flex; align-items: center; gap: 0.6rem; margin: 0.9rem 0 1.1rem; }
.vol { flex: 1; min-width: 0; height: 32px; accent-color: var(--teal); touch-action: none; }
.vol-nudge { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 2px solid var(--ink); background: #fff; font-weight: 800; font-size: 1.1rem; padding: 0; }

.terms { max-height: min(30vh, 240px); overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 0.3rem 0.9rem; margin-bottom: 1rem; font-size: 0.9rem; background: #fbfaf5; touch-action: pan-y; overscroll-behavior: contain; }
.terms p { margin: 0.75rem 0; }

.quiz-q { font-size: 1.3rem; font-weight: 700; margin: 0 0 0.8rem; }
.quiz-opts { display: flex; flex-direction: column; gap: 0.5rem; }
.quiz-opt { text-align: left; border: 2px solid var(--ink); background: #fff; border-radius: 10px; padding: 0.7rem 1rem; font-weight: 600; }
.quiz-opt:hover { background: #f4f2ea; }
.quiz-opt.wrong { border-color: var(--red); color: var(--red); background: #fdecec; }
.lines { display: flex; flex-direction: column; align-items: center; font-family: var(--mono); font-size: 1.3rem; line-height: 1.5; margin-bottom: 0.8rem; }

.type-out { font-family: var(--mono); font-size: 2.6rem; font-weight: 800; text-align: center; letter-spacing: 0.1em; margin-bottom: 0.9rem; }
.kb { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
.key { border: 1px solid #c9c5b8; border-bottom-width: 3px; background: #fbfaf5; border-radius: 8px; padding: 0.75rem 0; font-family: var(--mono); font-weight: 700; font-size: 1.1rem; }
.key:active { transform: translateY(2px); border-bottom-width: 1px; }

.wait-n { font-family: var(--mono); font-size: clamp(5rem, 22vw, 8rem); font-weight: 800; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.wait-n.bad { color: var(--red); }
.wait-n + .link-btn { display: block; margin: 0.6rem auto 0; }

.calc-bar { height: 14px; background: #e6e3da; border-radius: 7px; overflow: hidden; }
.calc-fill { height: 100%; width: 0; background: var(--teal); transition: width 0.5s ease; }
.calc-pct { font-family: var(--mono); font-weight: 700; text-align: right; margin-top: 0.3rem; }

.adbox { background: #111; color: #fff; border-radius: 10px; padding: 1.4rem 1.1rem; display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; }
.adbox .sponsored { font-size: 0.65rem; letter-spacing: 0.1em; opacity: 0.6; text-transform: uppercase; }
.adbox strong { font-size: 1.3rem; }
.skipbtn { display: block; margin: 0.7rem 0 0 auto; background: #e9e7de; color: #6b6a64; border: 1px solid #c9c5b8; border-radius: 4px; padding: 0.45rem 0.9rem; font-size: 0.82rem; font-weight: 600; }
.skipbtn.ready { background: var(--ink); color: #fff; border-color: var(--ink); }

.testbar { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.4rem 1rem calc(0.4rem + env(safe-area-inset-bottom)); min-height: 2.6rem; }
.bar-btn { background: none; border: 1px solid #c9c5b8; border-radius: 999px; padding: 0.3rem 0.9rem; font-size: 0.78rem; color: var(--muted); }
.giveup { margin-left: auto; }
#toasts { top: auto; bottom: 3.4rem; left: 1rem; }
#r-kevin { color: var(--muted); }

@media (max-width: 760px) {
  #stage { display: flex; padding: 0.75rem; }
  #toasts { top: auto; left: 0.75rem; bottom: 3.2rem; }
  .task-card { padding: 1rem 1rem 0.9rem; }
  .task-msg { min-height: 3.6em; }
}
