:root {
  --bg: #6b6bc2;
  --bg-deep: #5756ad;
  --shell: #8f8aea;
  --shell-hi: #b9b3ff;
  --bezel: #221d48;
  --screen: #7cb7f4;
  --screen-hi: #a9d2ff;
  --ink: #221d48;
  --cream: #f5f2ff;
  --tongue: #ff5fa2;
  --tongue-deep: #d93d82;
  --mint: #7ff0c3;
  --hat: #ffd34d;
  --radius: 28px;
  --display: 'Bricolage Grotesque', ui-rounded, system-ui, sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--display);
  color: var(--cream);
  background:
    radial-gradient(1200px 700px at 70% -10%, #8584dc 0%, transparent 60%),
    radial-gradient(900px 600px at -10% 110%, #4f4ea3 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
a { color: inherit; }
button { font: inherit; color: inherit; }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 40px);
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-bot svg { width: 44px; height: auto; display: block; filter: none; }
.brand-name { font-weight: 800; font-size: 22px; letter-spacing: -0.03em; }
nav { display: flex; gap: 6px; align-items: center; }
nav a {
  text-decoration: none; font-family: var(--mono); font-size: 14px;
  padding: 9px 14px; border-radius: 999px; transition: background .15s;
}
nav a:hover { background: rgba(255,255,255,.12); }
nav a.active { background: rgba(34,29,72,.35); }
nav .s { display: none; }
nav a.nav-cta { background: var(--cream); color: var(--ink); font-weight: 500; }
nav a.nav-cta:hover { background: #fff; }

main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 8px clamp(16px, 4vw, 40px) 60px; }

.foot {
  text-align: center; font-family: var(--mono); font-size: 12px; opacity: .75;
  padding: 24px 16px 32px;
}
.foot .fine { opacity: .7; }
.foot .est { margin-top: 6px; }

/* ---------- mascot ---------- */
.bot { display: block; filter: drop-shadow(0 30px 30px rgba(34,29,72,.35)); }
.bot.bob { animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-10px) rotate(1deg); } }
.bot .tongue { transform-origin: 100px 100px; animation: wag 1.6s ease-in-out infinite; }
@keyframes wag { 0%,100% { transform: rotate(-5deg); } 50% { transform: rotate(6deg); } }

/* ---------- home ---------- */
.hero {
  display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 24px;
  padding: clamp(10px, 4vw, 40px) 0 20px;
}
.hero h1 {
  font-size: clamp(48px, 8.4vw, 104px); line-height: .9; letter-spacing: -0.055em;
  margin: 0 0 22px; font-weight: 800;
}
.hero h1 em { display: inline-block; line-height: .98; margin: .04em 0; font-style: normal; color: var(--ink); background: var(--screen); padding: 0 .12em; border-radius: .18em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.hero p.lede { font-size: clamp(18px, 2.1vw, 22px); line-height: 1.4; max-width: 34ch; margin: 0 0 28px; font-weight: 500; opacity: .95; }
.hero .bot { width: min(100%, 420px); margin-left: auto; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stats { margin-top: 26px; font-family: var(--mono); font-size: 13px; opacity: .85; min-height: 1.4em; }
.stats b { font-weight: 500; color: var(--mint); }

.rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 56px; }
.rule {
  background: rgba(34,29,72,.22); border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px; padding: 22px;
}
.rule .n { font-family: var(--mono); font-size: 12px; opacity: .7; }
.rule h3 { margin: 6px 0 6px; font-size: 22px; letter-spacing: -0.02em; }
.rule p { margin: 0; opacity: .85; line-height: 1.45; }

.eyebrow {
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--hat); margin-bottom: 16px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 0; cursor: pointer; text-decoration: none;
  font-weight: 700; font-size: 18px; letter-spacing: -0.01em;
  padding: 16px 24px; border-radius: 18px;
  background: var(--cream); color: var(--ink);
  box-shadow: 0 5px 0 #c9c2f2, 0 14px 24px rgba(34,29,72,.25);
  transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #c9c2f2, 0 6px 12px rgba(34,29,72,.25); }
.btn.hot { background: var(--tongue); color: #fff; box-shadow: 0 5px 0 var(--tongue-deep), 0 14px 24px rgba(34,29,72,.3); }
.btn.hot:active { box-shadow: 0 1px 0 var(--tongue-deep); }
.btn.ghost { background: transparent; color: var(--cream); box-shadow: inset 0 0 0 2px rgba(255,255,255,.5); }
.btn.ghost:active { transform: translateY(2px); }
.btn.small { font-size: 15px; padding: 10px 16px; border-radius: 14px; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.linkish {
  background: none; border: 0; cursor: pointer; font-family: var(--mono); font-size: 13px;
  opacity: .7; text-decoration: underline; text-underline-offset: 3px; padding: 6px;
}
.linkish:hover { opacity: 1; }

/* ---------- the device card ---------- */
.device {
  position: relative;
  background: linear-gradient(160deg, var(--shell-hi) 0%, var(--shell) 35%, #6f6ad3 100%);
  border-radius: 46px;
  padding: 16px;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.5),
    inset 0 -6px 18px rgba(34,29,72,.25),
    0 40px 60px -20px rgba(34,29,72,.55);
}
.bezel { background: var(--bezel); border-radius: 34px; padding: 12px; }
.screen {
  background:
    radial-gradient(120% 90% at 20% 0%, var(--screen-hi) 0%, transparent 55%),
    var(--screen);
  color: var(--ink);
  border-radius: 24px;
  padding: clamp(20px, 4vw, 40px);
  min-height: 320px;
  position: relative;
  overflow: hidden;
}
.screen::after { /* faint scanlines */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(34,29,72,.035) 0 2px, transparent 2px 4px);
}

.stage { max-width: 720px; margin: 10px auto 0; }
.stage-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.stage-head .bot { width: 84px; filter: none; }
.stage-head h1 { margin: 0; font-size: clamp(26px, 4vw, 38px); letter-spacing: -0.04em; line-height: 1; }
.stage-head p { margin: 4px 0 0; font-family: var(--mono); font-size: 13px; opacity: .8; }

.chip {
  display: inline-flex; gap: 6px; align-items: center;
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  background: var(--ink); color: var(--screen-hi);
  padding: 6px 11px; border-radius: 999px;
}
.chip.closed { background: var(--tongue); color: #fff; }
.chip.open { background: rgba(34,29,72,.12); color: var(--ink); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

.q {
  font-size: clamp(28px, 4.6vw, 46px); line-height: 1.02; letter-spacing: -0.045em;
  margin: 18px 0 26px; font-weight: 800; overflow-wrap: anywhere;
}

.opts { display: grid; gap: 12px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt {
  cursor: pointer; text-align: left;
  font-weight: 700; font-size: clamp(18px, 2.4vw, 22px); letter-spacing: -0.02em;
  background: var(--cream); color: var(--ink);
  border: 0; border-radius: 18px; padding: 20px 22px;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform .08s, box-shadow .08s, background .12s;
  overflow-wrap: anywhere;
  position: relative; z-index: 1;
}
.opt:hover { background: #fff; transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.opt:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.opt:disabled { cursor: default; }

.bars { display: grid; gap: 10px; position: relative; z-index: 1; }
.bar {
  position: relative; border-radius: 16px; overflow: hidden;
  background: rgba(34,29,72,.12); padding: 16px 18px;
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  font-weight: 700; font-size: 19px; letter-spacing: -0.02em;
}
.bar .fill {
  position: absolute; inset: 0 auto 0 0; width: 0; background: var(--cream);
  transition: width .9s cubic-bezier(.2,.9,.2,1);
}
.bar.lead .fill { background: var(--mint); }
.bar span { position: relative; overflow-wrap: anywhere; }
.bar .pct { font-family: var(--mono); font-weight: 500; font-size: 15px; white-space: nowrap; }
.bar .you {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  background: var(--ink); color: var(--screen-hi); padding: 3px 7px; border-radius: 6px; margin-left: 8px;
  vertical-align: middle;
}

.meta { font-family: var(--mono); font-size: 13px; margin: 22px 0 0; opacity: .85; position: relative; z-index: 1; }
.below { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.quip {
  font-size: clamp(20px, 3vw, 26px); font-weight: 800; letter-spacing: -0.03em;
  margin: 0 0 16px; position: relative; z-index: 1;
}

/* ---------- verdict ---------- */
.verdict {
  position: relative; z-index: 1;
  background: var(--ink); color: var(--cream);
  border-radius: 20px; padding: 22px 120px 22px 24px; margin: 0 0 22px;
}
.verdict .stamp {
  position: absolute; right: 18px; top: 18px; transform: rotate(-11deg);
  font-family: var(--mono); font-weight: 500; font-size: 15px; text-transform: uppercase; letter-spacing: .16em;
  color: var(--hat); border: 3px solid var(--hat); border-radius: 8px; padding: 4px 10px 3px;
  opacity: .92; animation: stamp .45s cubic-bezier(.3,1.6,.5,1) .15s both;
}
@keyframes stamp { from { transform: rotate(-11deg) scale(2.4); opacity: 0; } }
.verdict .label { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--tongue); }
.verdict .win { font-size: clamp(30px, 5vw, 52px); font-weight: 800; letter-spacing: -0.05em; line-height: 1; margin: 8px 0 8px; overflow-wrap: anywhere; }
.verdict p { margin: 0; opacity: .85; }

/* ---------- forms ---------- */
.field { margin-bottom: 22px; position: relative; z-index: 1; }
.field > label, .field > .lbl {
  display: block; font-family: var(--mono); font-size: 12px; text-transform: uppercase;
  letter-spacing: .08em; margin-bottom: 8px; opacity: .85;
}
.input, textarea.input {
  width: 100%; font: inherit; color: var(--ink);
  font-weight: 700; letter-spacing: -0.02em;
  background: var(--cream); border: 0; border-radius: 16px;
  padding: 16px 18px; font-size: 19px;
  box-shadow: inset 0 3px 0 rgba(34,29,72,.12);
  outline: none;
}
textarea.input { font-size: clamp(22px, 3vw, 28px); line-height: 1.1; resize: none; letter-spacing: -0.035em; }
.input:focus { box-shadow: inset 0 3px 0 rgba(34,29,72,.12), 0 0 0 3px var(--ink); }
.input::placeholder { color: rgba(34,29,72,.38); }
.count { position: absolute; right: 12px; bottom: 10px; font-family: var(--mono); font-size: 11px; opacity: .5; }
.opt-inputs { display: grid; gap: 10px; }
.opt-input { display: flex; gap: 8px; align-items: center; }
.opt-input .x { background: rgba(34,29,72,.15); border: 0; border-radius: 12px; width: 44px; height: 44px; cursor: pointer; font-size: 18px; color: var(--ink); flex: none; }
.helpers { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pill {
  cursor: pointer; font-family: var(--mono); font-size: 13px;
  border: 0; border-radius: 999px; padding: 9px 14px;
  background: rgba(34,29,72,.12); color: var(--ink);
}
.pill:hover { background: rgba(34,29,72,.2); }
.pill[aria-pressed="true"] { background: var(--ink); color: var(--screen-hi); }
.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; position: relative; z-index: 1; }
.err { color: var(--ink); background: var(--tongue); color: #fff; border-radius: 12px; padding: 10px 14px; font-family: var(--mono); font-size: 13px; margin: 0 0 14px; position: relative; z-index: 1; }

/* ---------- share ---------- */
.share {
  margin-top: 18px; padding: 18px 20px; border-radius: 20px;
  background: rgba(34,29,72,.22); border: 1px solid rgba(255,255,255,.14);
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.share code { font-family: var(--mono); font-size: 14px; flex: 1; min-width: 200px; overflow-wrap: anywhere; }

/* ---------- mine ---------- */
.list { display: grid; gap: 12px; }
.item {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  text-decoration: none; padding: 18px 20px; border-radius: 20px;
  background: rgba(34,29,72,.22); border: 1px solid rgba(255,255,255,.12);
  transition: background .15s, transform .15s;
}
.item:hover { background: rgba(34,29,72,.32); transform: translateY(-1px); }
.item h3 { margin: 0 0 6px; font-size: 21px; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.item .sub { font-family: var(--mono); font-size: 13px; opacity: .8; }
.item .sub b { color: var(--mint); font-weight: 500; }
.item .right { font-family: var(--mono); font-size: 12px; text-align: right; opacity: .85; white-space: nowrap; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 30px 0 10px; position: relative; z-index: 1; }
.empty .bot { width: 180px; margin: 0 auto 8px; filter: none; }
.empty h2 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.04em; margin: 0 0 8px; }
.empty p { margin: 0 0 22px; font-size: 18px; opacity: .85; }

.loading { display: grid; place-items: center; min-height: 260px; font-family: var(--mono); font-size: 14px; position: relative; z-index: 1; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%);
  background: var(--ink); color: var(--cream);
  font-family: var(--mono); font-size: 14px;
  padding: 12px 18px; border-radius: 14px;
  box-shadow: 0 16px 30px rgba(0,0,0,.25);
  transition: transform .3s cubic-bezier(.2,.9,.2,1);
  z-index: 50; max-width: calc(100vw - 32px);
  opacity: 0; visibility: hidden;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

.pop { animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .hero .bot { order: -1; width: 240px; margin: 0 auto; }
  .rules { grid-template-columns: 1fr; }
  .opts.two { grid-template-columns: 1fr; }
  .brand-name { display: none; }
  nav .l { display: none; }
  nav .s { display: inline; }
  .verdict { padding-right: 24px; padding-top: 52px; }
  nav { gap: 2px; }
  nav a { padding: 8px 10px; font-size: 13px; }
  .device { border-radius: 34px; padding: 10px; }
  .bezel { border-radius: 26px; padding: 8px; }
  .screen { border-radius: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .bot.bob, .bot .tongue, .verdict .stamp { animation: none; }
  .bar .fill { transition: none; }
}
