
@font-face { font-family: Fredoka; src: url(fredoka-bold.woff2) format('woff2'); font-weight: 500 700; font-display: swap; }
:root { --paper: #fff6ea; --ink: #4a3438; --peach: #ffc8a8; --honey: #f2c45e; --lilac: #cfb6ef; --dusk: #2a2140; --amber: #ffd28a; --pumpkin: #f58f33; --soft: #f6e6d6; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); font-family: Fredoka, 'Nunito', system-ui, -apple-system, sans-serif; font-weight: 500; line-height: 1.35; transition: background .9s ease, color .9s ease; overflow-x: hidden; }
body.night { background: var(--dusk); color: #fff6ea; }
body.night .top, body.night footer { color: #fff6ea; }
a { color: inherit; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; max-width: 390px; margin: 0 auto; font-size: 15px; }
.top .brand { text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 14px; height: 14px; border-radius: 50% 50% 46% 46%; background: var(--pumpkin); box-shadow: inset -3px -2px 0 rgba(90,40,10,.35), 0 0 0 2px var(--ink); }
.top nav a { text-decoration: none; opacity: .8; border-bottom: 2px solid currentColor; }
main { max-width: 390px; margin: 0 auto; padding: 0 12px 32px; }
h1 { font-size: 27px; line-height: 1.12; margin: 14px 0 6px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 21px; margin: 26px 0 10px; font-weight: 700; }
.sub { margin: 0 0 10px; opacity: .78; }
.carve-wrap { text-align: left; }
#carve { display: block; margin: 4px auto 0; touch-action: none; cursor: crosshair; border-radius: 24px; background: transparent; }
#carve.wobble { animation: wob .35s ease; }
@keyframes wob { 0%{transform:rotate(0)} 25%{transform:rotate(-2deg)} 60%{transform:rotate(2deg)} 100%{transform:rotate(0)} }
.meterwrap { height: 4px; width: 60%; margin: 6px auto 12px; background: rgba(74,52,56,.12); border-radius: 4px; overflow: hidden; }
body.night .meterwrap { background: rgba(255,246,234,.15); }
body.night #carve { border-radius: 50%; box-shadow: 0 0 90px 30px rgba(255,170,60,.14); transition: box-shadow .9s ease; }
.meter { height: 100%; width: 0; background: var(--honey); transition: width .2s; }
body.night .tools, body.night .stencils, body.night .meterwrap { display: none; }
.tools { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.group { display: flex; gap: 6px; }
.tool { font: inherit; font-weight: 600; font-size: 15px; color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 9px 12px; min-height: 42px; min-width: 42px; cursor: pointer; box-shadow: 0 3px 0 var(--ink); transition: transform .08s, box-shadow .08s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tool:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.tool.on { background: var(--honey); }
.tool:disabled { opacity: .4; cursor: default; }
.tool.quiet { background: transparent; box-shadow: none; border-color: transparent; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
body.night .tool { background: #3b3160; color: #fff6ea; border-color: #fff6ea; box-shadow: 0 3px 0 #fff6ea; }
body.night .tool.on { background: var(--amber); color: var(--ink); }
body.night .tool.quiet { background: transparent; box-shadow: none; border-color: transparent; }
.dot { display: block; border-radius: 50%; background: var(--ink); }
.dot.s { width: 8px; height: 8px; } .dot.m { width: 14px; height: 14px; } .dot.l { width: 22px; height: 22px; }
body.night .dot { background: #fff6ea; }
.stencils { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 2px 0 10px; }
.lbl { font-size: 13px; opacity: .7; margin-right: 2px; display: inline-block; }
.chip { font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); background: var(--soft); border: 2px solid transparent; border-radius: 999px; padding: 6px 11px; cursor: pointer; }
.chip.on { border-color: var(--ink); background: var(--peach); }
body.night .chip { background: #3b3160; color: #fff6ea; }
body.night .chip.on { border-color: var(--amber); background: #5a4a86; }
.big { display: block; width: 100%; font: inherit; font-size: 20px; font-weight: 700; color: var(--ink); background: var(--honey); border: 2.5px solid var(--ink); border-radius: 18px; padding: 15px 18px; cursor: pointer; box-shadow: 0 4px 0 var(--ink); transition: transform .08s, box-shadow .08s; text-align: center; text-decoration: none; }
.big:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.big:disabled { opacity: .45; cursor: default; }
body.night .big { background: var(--amber); }
.step { margin-top: 8px; }
.cast { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.who { font: inherit; color: inherit; background: transparent; border: 2px solid transparent; border-radius: 16px; padding: 6px 2px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.who canvas { width: 64px; height: 64px; }
.who b { font-size: 15px; } .who i { font-style: normal; font-size: 11px; opacity: .7; line-height: 1.1; text-align: center; }
.who.on { border-color: var(--ink); background: rgba(255,255,255,.5); }
body.night .who.on { border-color: var(--amber); background: rgba(255,255,255,.08); }
#stage { display: block; margin: 12px auto 4px; border-radius: 20px; border: 2px solid var(--ink); }
body.night #stage { border-color: rgba(255,246,234,.4); }
.field { display: block; font-size: 15px; margin: 4px 0 10px; }
.field small { opacity: .65; font-weight: 500; }
.field input, .linkbox, .code { display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 17px; padding: 11px 12px; border: 2px solid var(--ink); border-radius: 14px; background: #fff; color: var(--ink); }
body.night .field input, body.night .linkbox, body.night .code { background: #3b3160; color: #fff6ea; border-color: rgba(255,246,234,.5); }
.row { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.row .tool { flex: 1; }
.linkbox { font-size: 13px; opacity: .85; }
.fine { font-size: 13px; opacity: .7; margin: 6px 0 0; }
.cardwrap img { display: block; width: 56%; margin: 14px auto; border-radius: 16px; border: 2px solid var(--ink); }
.count { font-size: 14px; margin: 14px 0 0; opacity: .8; }
.hats { margin-top: 36px; padding-top: 20px; border-top: 2px dashed rgba(74,52,56,.25); }
body.night .hats { border-top-color: rgba(255,246,234,.25); }
.hats p { margin: 6px 0; font-size: 15px; }
#hatPeek { display: block; width: 100%; height: 150px; border-radius: 18px; background: #3b3160; margin: 4px 0 10px; }
body.night #hatPeek { background: #1d1733; }
.code { width: auto; flex: 1; margin-top: 0; min-width: 140px; text-transform: uppercase; }
.code.shake { animation: wob .35s ease; }
.hats .row .big { flex: 1.2; }
.hatrow { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.hatrow::-webkit-scrollbar { display: none; }
.hat { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 14px; border: 2px solid transparent; background: rgba(255,255,255,.6); padding: 0; cursor: pointer; }
.hat canvas { width: 100%; height: 100%; }
.hat.on { border-color: var(--ink); background: var(--peach); }
body.night .hat { background: rgba(255,255,255,.1); }
body.night .hat.on { border-color: var(--amber); }
.shared { background: var(--amber); color: var(--ink); border-radius: 14px; padding: 10px 12px; font-size: 15px; margin: 8px 0 0; }
footer { max-width: 390px; margin: 0 auto; padding: 18px 16px 40px; font-size: 13px; opacity: .8; }
footer p { margin: 6px 0; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 5; transform: translate(-50%, 20px); background: var(--ink); color: #fff6ea; padding: 10px 14px; border-radius: 14px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }
@media (min-width: 760px) { main, .top, footer { max-width: 440px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* r3: sound toggle, try-on, payoff, what-you-get */
.top nav { display: flex; align-items: center; gap: 10px; }
.sndbtn { font: 600 13px Fredoka, system-ui, sans-serif; border: 2px solid #4a3438; border-radius: 999px; padding: 4px 10px; background: #fff6ea; color: #4a3438; cursor: pointer; }
.sndbtn.off { opacity: .75; }
body.night .sndbtn { background: #2a2140; color: #fff6ea; border-color: #fff6ea; }
.hatlead { font-size: 15px; }
.hat { position: relative; }
.hat.trying { border-color: #c38bff; box-shadow: 0 0 0 3px rgba(195,139,255,.35); }
.hat.on { border-color: #4a3438; }
body.night .hat.on { border-color: #fff6ea; }
.trybar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; margin: 2px 0 10px; border-radius: 14px; background: rgba(195,139,255,.18); font-size: 14px; }
.getlist { list-style: none; padding: 0; margin: 6px 0 10px; font-size: 15px; }
.getlist li { padding: 3px 0 3px 22px; position: relative; }
.getlist li::before { content: "✓"; position: absolute; left: 2px; font-weight: 700; color: #e8893a; }
body.night .getlist li::before { color: #ffd28a; }
.payoff { display: flex; align-items: center; gap: 10px; width: 100%; margin: 10px 0; padding: 8px 12px 8px 6px; border-radius: 18px; border: 2px dashed #c38bff; background: rgba(195,139,255,.12); color: inherit; font: 500 15px Fredoka, system-ui, sans-serif; text-align: left; cursor: pointer; }
.payoff canvas { width: 96px; height: 96px; flex: 0 0 96px; }
.sharedtry { display: block; width: 100%; margin: -4px 0 12px; border: 2px dashed #c38bff; }
[hidden] { display: none !important; }
