:root {
  --ink: #0d0b1a; --night: #16122c; --panel: #1d1740; --line: #3a3170; --deep: #07050f;
  --cream: #f4ecd8; --muted: #a79fc9; --gold: #ffd65a; --mint: #7ef0b6; --coral: #ff5d6c; --sky: #5ab8ff;
  --px: 2px;
  --head: "Pixelify Sans", ui-monospace, monospace;
  --label: "Silkscreen", ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--deep); overflow: hidden; }
body {
  color: var(--cream); font-family: var(--head); font-size: 17px; line-height: 1.35;
  background: var(--deep) radial-gradient(#1a1536 1px, transparent 1.5px) 0 0 / 10px 10px;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button, input, a { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app {
  position: relative; margin: 0 auto; width: 100%; max-width: 460px; height: 100dvh;
  overflow: hidden; overflow: clip; background: var(--ink);
}
#app::after { /* faint scanlines, pure decoration */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.025) 0 1px, transparent 1px calc(var(--px) * 2));
}
#stage { position: absolute; inset: 0 auto auto 0; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; }

/* header */
.top { position: absolute; z-index: 10; inset: 0 0 auto 0; display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 0; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { font-family: var(--label); font-size: 13px; letter-spacing: .06em; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 10px; height: 10px; background: var(--gold); box-shadow: 0 0 0 2px var(--deep), 4px 4px 0 0 var(--coral); animation: blink 1.6s steps(2) infinite; }
@keyframes blink { 50% { background: var(--mint); } }
.mini {
  font-family: var(--label); font-size: 11px; letter-spacing: .06em; background: var(--panel); border: 0; padding: 6px 9px; cursor: pointer;
  box-shadow: 0 -2px 0 0 var(--line), 0 2px 0 0 var(--line), -2px 0 0 0 var(--line), 2px 0 0 0 var(--line);
}
.mini[aria-pressed="false"] { color: var(--muted); }

/* panels */
.panel {
  position: absolute; z-index: 5; left: 0; right: 0; top: var(--panel-top); bottom: 0; padding: 4px 20px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto; opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .2s steps(3), transform .2s steps(3);
}
.panel.on { opacity: 1; transform: none; pointer-events: auto; }
#p-intro, #p-result, #p-dealing { top: var(--reveal-top); }
.panel.leaving { opacity: 0; transform: translateY(6px); }

h1 { font-size: 34px; line-height: 1.02; font-weight: 700; letter-spacing: -.01em; margin-bottom: 12px; text-wrap: balance; }
h1 em { font-style: normal; color: var(--gold); text-shadow: var(--px) var(--px) 0 var(--coral); }
h2 { font-size: 26px; line-height: 1.08; font-weight: 700; text-wrap: balance; }
.lede { color: #d9d2f0; margin-bottom: 18px; }
.lede.small { font-size: 15px; margin: 6px 0 16px; }
.fine { font-size: 13px; color: var(--muted); margin-top: 12px; text-align: center; }
.kicker { font-family: var(--label); font-size: 12px; letter-spacing: .08em; color: var(--gold); margin-bottom: 6px; }

/* pixel buttons: notched corners from box-shadows, chunky drop, press = sink */
.btn {
  --b: var(--px); --face: var(--cream); --edge: var(--deep);
  display: flex; align-items: center; justify-content: center; gap: 10px; width: calc(100% - var(--b) * 2); margin: calc(var(--b) * 2) var(--b) calc(var(--b) * 5);
  padding: 13px 14px; border: 0; cursor: pointer; text-decoration: none; text-align: center;
  font-family: var(--label); font-size: 14px; letter-spacing: .05em; color: var(--ink); background: var(--face);
  box-shadow:
    inset 0 var(--b) 0 0 rgba(255,255,255,.55), inset 0 calc(var(--b) * -1) 0 0 rgba(0,0,0,.2),
    0 calc(var(--b) * -1) 0 0 var(--edge), 0 var(--b) 0 0 var(--edge), calc(var(--b) * -1) 0 0 0 var(--edge), var(--b) 0 0 0 var(--edge),
    0 calc(var(--b) * 3) 0 0 var(--edge);
  transition: transform 40ms steps(1);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active, .btn.picked { transform: translateY(calc(var(--b) * 2)); box-shadow:
    inset 0 var(--b) 0 0 rgba(255,255,255,.55), inset 0 calc(var(--b) * -1) 0 0 rgba(0,0,0,.2),
    0 calc(var(--b) * -1) 0 0 var(--edge), 0 var(--b) 0 0 var(--edge), calc(var(--b) * -1) 0 0 0 var(--edge), var(--b) 0 0 0 var(--edge); }
.btn:focus-visible { outline: var(--b) dashed var(--gold); outline-offset: calc(var(--b) * 3); }
.btn:disabled { cursor: default; }
.btn.primary { --face: var(--mint); }
.btn.gold { --face: var(--gold); }
.btn.ghost { --face: var(--panel); color: var(--cream); }
.btn.big { font-size: 17px; padding: 16px; }

/* question options */
.q h2 { font-size: 24px; margin-bottom: 14px; }
.opts { display: grid; gap: 2px; }
.btn.opt { justify-content: flex-start; text-align: left; font-family: var(--head); font-size: 17px; letter-spacing: 0; padding: 11px 12px; animation: optIn .28s steps(4) both; animation-delay: calc(var(--i) * 60ms); }
.btn.opt .key { font-family: var(--label); font-size: 12px; min-width: 22px; height: 22px; display: grid; place-items: center; background: var(--ink); color: var(--gold); }
.btn.opt:hover .key, .btn.opt.picked .key { background: var(--coral); color: var(--cream); }
.btn.opt.picked { --face: var(--gold); }
@keyframes optIn { from { opacity: 0; transform: translateX(-16px); } }

/* dealing */
.dealing { font-family: var(--label); font-size: 16px; letter-spacing: .08em; text-align: center; margin-top: 18px; color: var(--gold); }
.dots i { font-style: normal; animation: dot 0.9s steps(1) infinite; }
.dots i:nth-child(2) { animation-delay: .3s; } .dots i:nth-child(3) { animation-delay: .6s; }
@keyframes dot { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }

/* result */
.r-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tier-badge {
  flex: none; width: 54px; height: 54px; display: grid; place-items: center; font-family: var(--label); font-size: 30px; color: var(--ink);
  background: var(--gold); box-shadow: 0 0 0 3px var(--deep), 5px 5px 0 0 var(--coral); transform: scale(0) rotate(-20deg);
}
.tier-badge[data-tier="nofee"] { background: var(--mint); } .tier-badge[data-tier="starter"] { background: var(--sky); } .tier-badge[data-tier="F"] { background: var(--coral); }
.tier-badge[data-len="2"] { font-size: 22px; } .tier-badge[data-len="3"] { font-size: 17px; }
.tier-badge.stamp { animation: stamp .32s steps(5) forwards; }
@keyframes stamp { 0% { transform: scale(2.6) rotate(-20deg); opacity: 0; } 70% { transform: scale(.9) rotate(4deg); opacity: 1; } 100% { transform: scale(1) rotate(-6deg); opacity: 1; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 10px; }
.chip { font-family: var(--label); font-size: 11px; letter-spacing: .04em; padding: 4px 8px; background: var(--panel); color: var(--mint); box-shadow: 0 0 0 2px var(--line); }
.chip::before { content: "✓ "; }
.take { min-height: 4.2em; margin-bottom: 14px; color: #ece6ff; }
.take .who { color: var(--gold); }
.row-links { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.link { background: none; border: 0; cursor: pointer; font-family: var(--label); font-size: 12px; letter-spacing: .05em; color: var(--muted); padding: 6px 0; }
.link:hover { color: var(--cream); }
.hint { font-size: 12px; color: var(--muted); text-align: right; }

/* tier list */
#p-tiers { top: 52px; padding-top: 10px; }
.back { margin-bottom: 8px; }
.tier-wrap { position: relative; margin-bottom: 18px; }
.tier-group { display: grid; grid-template-columns: 44px 1fr; gap: 10px; margin-bottom: 14px; }
.tier-tag { font-family: var(--label); font-size: 24px; color: var(--ink); display: grid; place-items: center; background: var(--gold); min-height: 64px; box-shadow: 0 0 0 2px var(--deep); }
.tier-tag[data-tier="nofee"] { background: var(--mint); } .tier-tag[data-tier="starter"] { background: var(--sky); } .tier-tag[data-tier="F"] { background: var(--coral); }
.tier-tag[data-len="2"] { font-size: 18px; } .tier-tag[data-len="3"] { font-size: 14px; }
.tier-title { font-family: var(--label); font-size: 11px; letter-spacing: .06em; color: var(--muted); padding: 2px 0 0; }
.chip.mine { color: var(--ink); background: var(--coral); box-shadow: 0 0 0 2px var(--deep); }
.chip.mine::before { content: "♥ "; }
.chip.sm { display: inline-block; font-size: 9px; padding: 2px 6px; margin-top: 4px; }
.tier-rows { display: grid; gap: 8px; }
.tier-row { display: grid; grid-template-columns: 88px 1fr; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 8px; border: 0; cursor: pointer; background: var(--panel); box-shadow: 0 0 0 2px var(--line); }
.tier-row:not(.locked):hover { box-shadow: 0 0 0 2px var(--gold); }
.tier-row .thumb { width: 88px; height: auto; image-rendering: pixelated; display: block; }
.tier-name { font-weight: 700; font-size: 16px; line-height: 1.15; }
.tier-take { font-size: 14px; color: #d9d2f0; max-height: 0; overflow: hidden; transition: max-height .25s steps(4); }
.tier-row.open .tier-take { max-height: 9em; margin-top: 4px; }
.tier-row.locked { cursor: default; filter: saturate(.6); }
.tier-row.locked .tier-name { color: var(--muted); letter-spacing: .1em; }
.gate {
  position: absolute; inset: 40px 6px auto; padding: 18px 16px 10px; background: var(--night);
  box-shadow: 0 0 0 3px var(--gold), 0 0 0 6px var(--deep), 8px 8px 0 6px rgba(0,0,0,.5);
}
.gate[hidden] { display: none; }
.gate.opening { animation: gateOut .3s steps(4) forwards; }
@keyframes gateOut { to { transform: translateY(-30px) scale(.92); opacity: 0; } }
.gate-lock { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lock { width: 28px; height: 28px; color: var(--gold); shape-rendering: crispEdges; animation: wiggle 2.4s steps(2) infinite; }
@keyframes wiggle { 0%, 80%, 100% { transform: none; } 85% { transform: rotate(-10deg); } 90% { transform: rotate(10deg); } }
.gate-title { font-size: 22px; font-weight: 700; }
.gate p { font-size: 15px; color: #d9d2f0; margin-bottom: 12px; }
.gate input {
  width: calc(100% - 4px); margin: 2px; padding: 12px; border: 0; background: var(--ink); color: var(--cream); font-size: 17px;
  box-shadow: 0 0 0 2px var(--line); outline: none;
}
.gate input:focus { box-shadow: 0 0 0 2px var(--gold); }
.gate input.nope { animation: nope .3s steps(6); box-shadow: 0 0 0 2px var(--coral); }
@keyframes nope { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* pre-order sheet */
.sheet { position: absolute; inset: 0; z-index: 30; background: rgba(7,5,15,.72); display: flex; align-items: flex-end; opacity: 0; pointer-events: none; transition: opacity .18s steps(3); }
.sheet.on { opacity: 1; pointer-events: auto; }
.sheet-card { position: relative; width: 100%; max-height: 92%; overflow-y: auto; background: var(--night); padding: 22px 20px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 0 0 var(--gold), 0 -8px 0 0 var(--deep); transform: translateY(100%); transition: transform .28s steps(6); }
.sheet.on .sheet-card { transform: none; }
.close { position: absolute; top: 14px; right: 14px; }
.price { font-family: var(--label); font-size: 13px; color: var(--mint); margin: 6px 0 14px; }
.perks { list-style: none; display: grid; gap: 10px; margin-bottom: 6px; }
.perks li { position: relative; padding-left: 22px; font-size: 15px; color: #ddd6f3; }
.perks li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 8px; height: 8px; background: var(--gold); box-shadow: 3px 3px 0 0 var(--coral); }
.perks b { color: var(--cream); }

#toast {
  position: absolute; z-index: 40; left: 16px; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); padding: 12px 14px; font-size: 15px; background: var(--cream); color: var(--ink);
  box-shadow: 0 0 0 3px var(--deep), 6px 6px 0 0 var(--coral); transform: translateY(calc(100% + 60px)); transition: transform .2s steps(4);
}
#toast.on { transform: none; }

@media (min-width: 461px) { #app { box-shadow: 0 0 0 4px var(--line), 0 0 0 8px var(--deep); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; } }

/* free-result estimate */
.est { margin: 2px 0 14px; padding: 12px 14px; background: var(--night); box-shadow: 0 0 0 2px var(--mint), 0 0 0 4px var(--deep); }
.est[hidden] { display: none; }
.est-num { font-family: var(--label); font-size: 22px; color: var(--mint); letter-spacing: .02em; }
.est-sub { font-size: 14px; color: #d9d2f0; margin-top: 2px; }

/* audit sales sheet */
.sheet-lede { color: #e4ddf7; margin: 6px 0 12px; }
.price-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.price-now { font-family: var(--label); font-size: 30px; color: var(--gold); }
.price-was { font-family: var(--label); font-size: 16px; color: var(--muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.price-note { font-family: var(--label); font-size: 11px; letter-spacing: .04em; color: var(--ink); background: var(--mint); padding: 3px 7px; }
.mini-kicker { font-family: var(--label); font-size: 11px; letter-spacing: .08em; color: var(--gold); margin: 4px 0 8px; }
.preview { display: grid; justify-items: center; gap: 14px; margin-bottom: 18px; }
.wall { width: 264px; height: 468px; image-rendering: pixelated; box-shadow: 0 0 0 6px var(--deep), 0 0 0 9px var(--line), 10px 10px 0 9px rgba(0,0,0,.45); border-radius: 2px; }
.preview-txt { width: 100%; }
.sample { margin: 4px 0 18px; padding: 14px; background: var(--cream); color: var(--ink); box-shadow: 0 0 0 3px var(--deep), 6px 6px 0 3px var(--coral); }
.sample .mini-kicker { color: var(--coral); }
.sample-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 2px dashed #d5c9ad; font-size: 16px; }
.v { font-family: var(--label); font-weight: 400; font-size: 12px; padding: 2px 8px; color: var(--cream); }
.v.cut { background: var(--coral); } .v.keep { background: #2c9a66; } .v.add { background: #2a63c9; }
.sample-total { font-weight: 700; font-size: 18px; margin-top: 10px; }
.sample-total em { font-style: normal; color: #c2263a; }
.sample-note { font-size: 12px; color: #7a6f5c; margin-top: 4px; }
.steps { padding-left: 22px; display: grid; gap: 8px; margin-bottom: 8px; color: #ddd6f3; font-size: 15px; }
.steps li::marker { font-family: var(--label); color: var(--gold); }

/* in-site order form */
#p-order, #p-paid { top: 52px; padding-top: 6px; }
.order-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.o-steps { display: flex; gap: 6px; }
.o-steps i { width: 26px; height: 8px; background: var(--line); }
.o-steps i.on { background: var(--gold); }
#order-form { border: 0; }
.o-step { display: none; border: 0; animation: optIn .28s steps(4) both; }
.o-step.on { display: block; }
.o-step h2 { margin-bottom: 4px; }
.o-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 14px; }
.o-card {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 7px 8px; text-align: left; cursor: pointer; border: 0;
  background: var(--panel); color: var(--cream); font-size: 13px; line-height: 1.15; box-shadow: 0 0 0 2px var(--line);
  -webkit-tap-highlight-color: transparent;
}
.o-card i { flex: none; width: 22px; height: 14px; }
.o-card.on { background: #2b2360; box-shadow: 0 0 0 2px var(--gold), 3px 3px 0 2px var(--deep); }
.o-card.on::after { content: "✓"; margin-left: auto; font-family: var(--label); color: var(--gold); }
.o-label { display: block; font-family: var(--label); font-size: 11px; letter-spacing: .05em; color: var(--muted); margin: 14px 2px 6px; }
.o-input {
  display: block; width: calc(100% - 4px); margin: 2px; padding: 12px; border: 0; background: var(--ink); color: var(--cream); font-size: 16px;
  box-shadow: 0 0 0 2px var(--line); outline: none; resize: vertical;
}
.o-input:focus { box-shadow: 0 0 0 2px var(--gold); }
.o-input.short { width: 110px; }
.o-grid { display: grid; gap: 8px; margin: 10px 0 4px; }
.o-money { display: grid; grid-template-columns: 1fr auto 90px auto; align-items: center; gap: 6px; padding: 8px 10px; background: var(--panel); box-shadow: 0 0 0 2px var(--line); }
.o-money span { font-size: 14px; }
.o-money b { font-family: var(--label); color: var(--gold); font-weight: 400; }
.o-money input { width: 90px; padding: 6px 8px; border: 0; background: var(--ink); color: var(--cream); font-size: 16px; text-align: right; outline: none; box-shadow: 0 0 0 2px var(--line); }
.o-money input:focus { box-shadow: 0 0 0 2px var(--gold); }
.o-money em { font-style: normal; font-size: 12px; color: var(--muted); }
.o-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.o-pills button { border: 0; cursor: pointer; padding: 9px 12px; font-size: 14px; background: var(--panel); color: var(--cream); box-shadow: 0 0 0 2px var(--line); -webkit-tap-highlight-color: transparent; }
.o-pills button.on { background: var(--gold); color: var(--ink); box-shadow: 0 0 0 2px var(--deep), 3px 3px 0 2px var(--coral); }
.o-step .btn { margin-top: 18px; }
.o-summary, .ticket { margin: 16px 0 6px; padding: 12px 14px; background: var(--cream); color: var(--ink); box-shadow: 0 0 0 3px var(--deep), 6px 6px 0 3px var(--gold); }
.ticket-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 2px dashed #d5c9ad; font-family: var(--label); font-size: 12px; }
.ticket-row:last-child { border-bottom: 0; }
.ticket-row b { font-weight: 400; text-align: right; word-break: break-all; }
.ticket-row b.ok { color: #1f8a57; }
.o-check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 2px 0; font-size: 14px; color: #ddd6f3; cursor: pointer; }
.o-check input { width: 20px; height: 20px; accent-color: var(--gold); flex: none; margin-top: 1px; }
#o-pay:disabled { filter: saturate(.4); }

/* you're in */
#p-paid h1 { margin-top: 4px; }
#p-paid .ticket { margin: 18px 0 18px; }
