:root {
  --bg: #f5f3ee;
  --paper: #ffffff;
  --ink: #16161a;
  --muted: #6d6b66;
  --faint: #e7e4dc;
  --line: #e2dfd7;
  --accent: #d97757;      /* Claude clay */
  --accent-ink: #b85c3e;
  --good: #2f8f5b;
  --bad: #c7412f;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(22, 22, 26, .04), 0 12px 40px -12px rgba(22, 22, 26, .12);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 24px;
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 14px; }
.brand b { font-weight: 600; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.progress { display: flex; gap: 6px; }
.progress i { width: 22px; height: 4px; border-radius: 4px; background: var(--faint); transition: background .4s; }
.progress i.done { background: var(--ink); }
.progress i.now { background: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.timer { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.timer-label { font-family: var(--sans); color: var(--muted); font-size: 12px; margin-right: 4px; }
.icon-btn, .ghost-btn {
  height: 32px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
  font-size: 13px; padding: 0 12px; transition: border-color .2s, transform .15s;
}
.icon-btn { width: 32px; padding: 0; font-weight: 600; }
.icon-btn:hover, .ghost-btn:hover { border-color: var(--ink); }
.icon-btn:active, .ghost-btn:active { transform: scale(.96); }

/* ---------- stage + card ---------- */
.stage { flex: 1; display: grid; place-items: center; padding: 24px 16px 48px; }
.card {
  width: min(640px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 36px;
  position: relative;
  animation: cardIn .6s cubic-bezier(.2, .8, .2, 1) both;
}
.card.out { animation: cardOut .35s ease-in both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes cardOut { to { opacity: 0; transform: translateY(-14px) scale(.98); } }
.card.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.eyebrow { font-family: var(--mono); font-size: 12px; color: var(--accent-ink); letter-spacing: .02em; }
h1 { font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1.05; margin: 8px 0 10px; letter-spacing: -.01em; }
h1 em { color: var(--accent); }
.instruction { color: var(--muted); margin: 0 0 24px; }
.card-body { position: relative; }

/* ---------- shared controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border-radius: 12px; border: 1px solid transparent;
  background: var(--ink); color: #fff; font-weight: 500; font-size: 14px;
  transition: transform .15s, background .2s, box-shadow .2s, opacity .2s;
  user-select: none; -webkit-user-select: none; text-decoration: none;
}
.btn:hover { box-shadow: 0 6px 18px -6px rgba(22, 22, 26, .35); }
.btn:active { transform: scale(.97); }
.btn.accent { background: var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); box-shadow: none; }
.btn.meh { background: #f0eee8; color: #a9a6a0; }
.btn.block { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { height: 16px; }
.muted { color: var(--muted); }
.tiny { font-size: 11px; }
.link { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

.field {
  width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--line);
  padding: 0 14px; background: #fcfbf8; outline: none; transition: border-color .2s, box-shadow .2s;
}
.field:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(22, 22, 26, .06); }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
label.lbl { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 14px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .4);
  animation: toastIn .35s cubic-bezier(.2, .9, .3, 1.3) both;
}
.toast.bad { background: var(--bad); }
.toast.good { background: var(--good); }
.toast.leave { animation: toastOut .3s ease-in both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ---------- cleared overlay ---------- */
.cleared { position: fixed; inset: 0; display: grid; place-items: center; z-index: 90; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(6px); animation: fade .25s both; }
.cleared[hidden] { display: none; }
.cleared-inner { text-align: center; }
.cleared p { font-family: var(--serif); font-size: 40px; margin: 12px 0 2px; }
.cleared small { color: var(--muted); }
.check { width: 72px; height: 72px; }
.check circle { stroke: var(--good); stroke-width: 2; stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw .6s ease forwards; }
.check path { stroke: var(--good); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .35s .45s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } }

.foot { text-align: center; padding: 18px; font-size: 12px; color: var(--muted); }

/* =========================================================
   LEVEL 1 — the shy button
   ========================================================= */
.arena { position: relative; height: 300px; border-radius: 16px; background: repeating-linear-gradient(0deg, transparent 0 23px, var(--faint) 23px 24px), repeating-linear-gradient(90deg, transparent 0 23px, var(--faint) 23px 24px); background-color: #fcfbf8; overflow: hidden; border: 1px solid var(--line); }
.runner { position: absolute; transition: left .22s cubic-bezier(.3, 1.4, .5, 1), top .22s cubic-bezier(.3, 1.4, .5, 1); white-space: nowrap; }
.secret { cursor: text; }

/* =========================================================
   LEVEL 2 — terms
   ========================================================= */
.tos { height: 200px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; font-size: 13px; color: var(--muted); background: #fcfbf8; overscroll-behavior: contain; }
.tos h4 { color: var(--ink); margin: 14px 0 4px; font-size: 13px; }
.tos h4:first-child { margin-top: 0; }
.tos p { margin: 0 0 8px; }
.checks { display: grid; gap: 10px; margin: 18px 0; transition: opacity .3s; }
.checks.locked { opacity: .35; pointer-events: none; }
.check-row { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ink); flex: none; }

/* =========================================================
   LEVEL 3 — password
   ========================================================= */
.mirror { transform: scaleX(-1); }
.rules { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.rule { font-size: 13px; padding: 10px 12px; border-radius: 10px; display: flex; gap: 10px; align-items: center; animation: cardIn .4s both; }
.rule.ok { background: #eef7f1; color: var(--good); }
.rule.no { background: #fbeeec; color: var(--bad); }
.rule b { font-family: var(--mono); font-weight: 500; font-size: 11px; opacity: .7; }

/* =========================================================
   LEVEL 4 — pin
   ========================================================= */
.target { font-family: var(--mono); letter-spacing: .3em; }
.pin { display: flex; gap: 12px; justify-content: center; margin: 8px 0 22px; }
.digit {
  width: 72px; height: 96px; border-radius: 16px; border: 1px solid var(--line); background: #fcfbf8;
  font-family: var(--mono); font-size: 44px; display: grid; place-items: center; transition: transform .15s, background .2s;
}
.digit:hover { background: #fff; border-color: var(--ink); }
.digit.bump { animation: bump .25s; }
@keyframes bump { 50% { transform: translateY(-6px); } }

/* =========================================================
   LEVEL 5 — cookies
   ========================================================= */
.site { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #fcfbf8; }
.site-bar { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.site-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.site-content { padding: 18px; min-height: 140px; }
.skeleton { height: 10px; border-radius: 6px; background: var(--faint); margin-bottom: 10px; }
.cookie { margin: 0 12px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.cookie p { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.toggles { display: grid; gap: 4px; margin: 6px 0 14px; }
.tg { display: flex; justify-content: space-between; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--faint); font-size: 14px; }
.tg small { display: block; color: var(--muted); font-size: 12px; }
.tg-state { font-size: 11px; font-family: var(--mono); color: var(--muted); margin-right: 8px; }
.switch { width: 42px; height: 24px; border-radius: 999px; border: 0; position: relative; background: #cfd8d2; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
/* the crime: green means OFF */
.switch.on { background: #d5d2cb; }
.switch.off { background: var(--good); }
.switch.on::after { transform: translateX(18px); }
.switch[disabled] { opacity: .5; cursor: not-allowed; }
details.li { margin-top: 4px; font-size: 13px; }
details.li summary { color: var(--muted); cursor: pointer; padding: 8px 2px; }

/* =========================================================
   LEVEL 6 — captcha
   ========================================================= */
.captcha { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fcfbf8; display: flex; align-items: center; gap: 14px; width: 300px; max-width: 100%; }
.cbox { width: 28px; height: 28px; border: 2px solid #c9c6bf; border-radius: 4px; background: #fff; display: grid; place-items: center; }
.cbox.spin { border-color: transparent; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.grid9 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0 16px; }
.tile { aspect-ratio: 1; font-size: 44px; border-radius: 10px; border: 2px solid transparent; background: #f3f1ec; display: grid; place-items: center; transition: transform .15s, border-color .15s; }
.tile.sel { border-color: var(--ink); transform: scale(.92); }
.patience { text-align: center; padding: 18px 0 6px; }
.patience .big { font-family: var(--serif); font-size: 88px; line-height: 1; }
.ring { width: 160px; height: 160px; margin: 0 auto; position: relative; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }

/* =========================================================
   LEVEL 7 — date
   ========================================================= */
.date3 { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 10px; margin-bottom: 18px; }

/* =========================================================
   LEVEL 8 — hold
   ========================================================= */
.hold { position: relative; overflow: hidden; height: 64px; width: 100%; border-radius: 16px; font-size: 16px; touch-action: none; }
.hold .fill { position: absolute; inset: 0; width: 0; background: var(--accent); transition: width .08s linear; }
.hold span { position: relative; }
.pct { text-align: center; font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 12px; min-height: 20px; }

/* =========================================================
   LEVEL 9 — unsubscribe
   ========================================================= */
.mail { border: 1px solid var(--line); border-radius: 16px; padding: 22px; background: #fcfbf8; }
.mail h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 0 0 14px; line-height: 1.15; }
.mail .row { margin-top: 16px; }
.counter { margin-top: 14px; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.radios { display: grid; gap: 8px; }

/* =========================================================
   LEVEL 10 — hydra
   ========================================================= */
.victory { text-align: center; padding: 34px 0 10px; }
.victory .emoji { font-size: 56px; }
.modal-layer { position: absolute; inset: -20px; z-index: 5; }
.modal {
  position: absolute; width: 280px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px 20px 14px; box-shadow: 0 24px 60px -18px rgba(22, 22, 26, .35); text-align: center;
  animation: pop .35s cubic-bezier(.2, .9, .3, 1.3) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
.modal h4 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 4px 0 6px; }
.modal p { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.modal .x { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: #f0eee8; font-size: 15px; line-height: 1; }
.modal .nope { display: block; margin: 12px auto 0; background: none; border: 0; font-size: 10px; color: #dcd9d2; }
.modal .timer-pill { display: inline-block; font-family: var(--mono); font-size: 11px; color: var(--bad); background: #fbeeec; padding: 2px 8px; border-radius: 999px; }
.bar { height: 8px; border-radius: 8px; background: var(--faint); overflow: hidden; margin: 18px 0 8px; }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .25s; }

/* =========================================================
   FINAL
   ========================================================= */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 6px 0 22px; }
.stat { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fcfbf8; }
.stat b { display: block; font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  .progress { order: 3; width: 100%; }
  .progress i { flex: 1; }
  .timer-label { display: none; }
  .card { padding: 24px 20px; }
  h1 { font-size: 34px; }
  .digit { width: 60px; height: 82px; font-size: 36px; }
  .date3 { grid-template-columns: 1fr; }
  .modal { width: 240px; }
}
