:root {
    --ink: #1f1d2b;
    --paper: #fff8ec;
    --hot: #ff4d6d;
    --lime: #b6f23f;
    --cyan: #00e0f0;
    --muted: #7a7290;
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    font-family: 'Fredoka', system-ui, sans-serif;
    color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #14111f; overscroll-behavior: none; }
[hidden] { display: none !important; }
button { font: inherit; }

.logo { font-family: 'Permanent Marker', 'Fredoka', cursive; font-size: clamp(44px, 14vw, 64px); line-height: .95; color: var(--ink); letter-spacing: 1px; transform: rotate(-3deg); }
.logo span { display: block; color: var(--hot); text-shadow: 3px 3px 0 var(--lime); margin-left: 18px; }
.logo.small { font-size: 26px; color: #fff; transform: rotate(-3deg); }
.logo.small span { display: inline; margin-left: 6px; text-shadow: 2px 2px 0 rgba(182,242,63,.6); }

.btn { border: 3px solid var(--ink); background: #fff; color: var(--ink); font-weight: 700; font-size: 17px; padding: 12px 18px; border-radius: 16px;
    box-shadow: 0 4px 0 var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .5; }
.btn.hot { background: var(--hot); color: #fff; }
.btn.lime { background: var(--lime); }
.btn.big { width: 100%; font-size: 20px; padding: 14px; }
.btn.small { font-size: 14px; padding: 7px 12px; border-radius: 12px; box-shadow: 0 3px 0 var(--ink); }
.btn.ghost-dark { background: rgba(20,17,31,.6); color: #fff; border-color: rgba(255,255,255,.6); box-shadow: none; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn.link { border: 0; background: none; box-shadow: none; color: var(--muted); text-decoration: underline; padding: 6px; }
.field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; text-align: left; }
input { font: inherit; font-size: 18px; padding: 12px 14px; border-radius: 14px; border: 3px solid var(--ink); background: #fff; color: var(--ink); outline: none; width: 100%; }
input:focus { box-shadow: 0 0 0 4px rgba(255,77,109,.25); }

/* welcome */
.welcome { min-height: 100dvh; display: grid; place-items: center; padding: 20px 16px;
    background: radial-gradient(circle at 20% 15%, rgba(255,77,109,.35), transparent 45%), radial-gradient(circle at 85% 85%, rgba(0,224,240,.3), transparent 45%), #14111f; }
.sticker { width: min(420px, 100%); background: var(--paper); border: 4px solid var(--ink); border-radius: 26px; padding: 26px 22px; box-shadow: 8px 8px 0 var(--hot);
    display: flex; flex-direction: column; gap: 16px; text-align: center; position: relative; transform: rotate(-1deg); }
.sticker::before { content: ''; position: absolute; top: -14px; left: 50%; width: 110px; height: 28px; transform: translateX(-50%) rotate(3deg); background: rgba(182,242,63,.75); border-radius: 4px; }
.lede { margin: 0; font-size: 18px; line-height: 1.4; }

/* scanner */
.scan { position: fixed; inset: 0; overflow: hidden; background: #000; }
.cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vf { position: absolute; left: 50%; top: 46%; width: min(74vw, 340px); aspect-ratio: 1.25; transform: translate(-50%, -50%); box-shadow: 0 0 0 100vmax rgba(10,8,18,.45); border-radius: 22px; }
.vf i { position: absolute; width: 40px; height: 40px; border: 6px solid var(--lime); border-radius: 6px; }
.vf .tl { left: -4px; top: -4px; border-right: 0; border-bottom: 0; border-top-left-radius: 22px; }
.vf .tr { right: -4px; top: -4px; border-left: 0; border-bottom: 0; border-top-right-radius: 22px; }
.vf .bl { left: -4px; bottom: -4px; border-right: 0; border-top: 0; border-bottom-left-radius: 22px; }
.vf .br { right: -4px; bottom: -4px; border-left: 0; border-top: 0; border-bottom-right-radius: 22px; }
.vf .laser { position: absolute; left: 6%; right: 6%; height: 3px; top: 10%; background: var(--hot); box-shadow: 0 0 14px 3px rgba(255,77,109,.7); border-radius: 3px; animation: laser 1.8s ease-in-out infinite alternate; }
@keyframes laser { to { top: 88%; } }
.topbar { position: absolute; top: 0; left: 0; right: 0; padding: calc(12px + var(--sat)) 14px 10px; display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(rgba(10,8,18,.75), transparent); }
.top-actions { display: flex; gap: 6px; }
.chip { border: 2px solid rgba(255,255,255,.7); background: rgba(20,17,31,.55); color: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 14px; cursor: pointer; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.scan-status { position: absolute; left: 0; right: 0; top: calc(46% + min(37vw, 170px) / 1.25 + 26px); margin: 0; text-align: center; color: #fff; font-weight: 600; font-size: 16px; text-shadow: 0 2px 6px rgba(0,0,0,.6); padding: 0 20px; }
.bottombar { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 14px calc(18px + var(--sab)); display: flex; gap: 10px; justify-content: center; background: linear-gradient(transparent, rgba(10,8,18,.8)); }
.bottombar .btn { flex: 1; max-width: 200px; font-size: 15px; }

/* bottom sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-back { position: absolute; inset: 0; background: rgba(10,8,18,.6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .2s; }
.sheet { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 20px - var(--sat)); overflow-y: auto; background: var(--paper); border: 4px solid var(--ink); border-bottom: 0;
    border-radius: 28px 28px 0 0; padding: 22px 18px calc(22px + var(--sab)); animation: up .32s cubic-bezier(.2, 1.3, .4, 1); }
.sheet-x { position: absolute; top: 10px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; font-size: 16px; font-weight: 700; cursor: pointer; z-index: 2; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { margin: 0; font-size: 24px; padding-right: 40px; }
.sheet p { margin: 0; }
.muted { color: var(--muted); }
.code-text { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: #fff; border: 2px dashed #d8cfe0; border-radius: 10px; padding: 6px 10px; word-break: break-all; color: var(--muted); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { border: 3px solid var(--ink); border-radius: 22px; background: #fff; padding: 18px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; font-size: 17px; cursor: pointer; box-shadow: 0 5px 0 var(--ink); position: relative; }
.choice:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.choice b { font-size: 40px; }
.choice small { color: var(--muted); font-weight: 500; font-size: 13px; }
.choice input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.row { display: flex; gap: 10px; }
.row > .btn { flex: 1; }

/* the claim polaroid */
.polaroid { align-self: center; width: min(320px, 82vw); background: #fff; padding: 12px 12px 16px; border-radius: 6px; box-shadow: 0 10px 24px rgba(20,17,31,.25), 0 2px 0 rgba(0,0,0,.1);
    transform: rotate(-2.5deg); position: relative; animation: drop .5s cubic-bezier(.2, 1.4, .4, 1); }
.polaroid::before { content: ''; position: absolute; top: -12px; left: 50%; width: 96px; height: 26px; transform: translateX(-50%) rotate(-4deg); background: rgba(255,210,63,.75); }
.polaroid .pic { width: 100%; aspect-ratio: 1; background: #f3eee6 center / cover no-repeat; border-radius: 3px; overflow: hidden; position: relative; display: grid; place-items: center; }
.polaroid .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.polaroid.hidden-img .pic img { filter: blur(22px) saturate(.6); transform: scale(1.1); }
.polaroid .pic .veil { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #fff; font-weight: 700; text-shadow: 0 2px 6px rgba(0,0,0,.6); padding: 10px; }
.polaroid .cap { font-family: 'Permanent Marker', cursive; font-size: 22px; text-align: center; margin-top: 10px; color: var(--ink); }
.stamp { position: absolute; right: -10px; top: 18px; transform: rotate(12deg); background: var(--hot); color: #fff; font-weight: 800; padding: 6px 12px; border: 3px solid var(--ink); border-radius: 10px; font-size: 14px; box-shadow: 3px 3px 0 var(--ink); }
.stamp.mine { background: var(--lime); color: var(--ink); }
.meta { text-align: center; color: var(--muted); font-size: 14px; }
.kind-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #efe7ff; font-size: 12px; font-weight: 600; margin-left: 6px; color: #5b3fc4; }

/* doodle */
.doodle { display: flex; flex-direction: column; gap: 10px; }
.doodle-sheet { width: 100%; aspect-ratio: 1; max-height: calc(100dvh - 330px); display: grid; place-items: center; }
.doodle-canvas { border-radius: 16px; border: 3px solid var(--ink); background: #fff; touch-action: none; cursor: crosshair; box-shadow: 0 4px 0 var(--ink); }
.doodle-tools { display: flex; flex-direction: column; gap: 8px; }
.swatches { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; }
.sw { aspect-ratio: 1; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 0 0 2px var(--ink); cursor: pointer; padding: 0; position: relative; overflow: hidden; }
.sw.on { transform: scale(1.18); box-shadow: 0 0 0 3px var(--hot); }
.sw.custom { background: conic-gradient(#ff4d6d, #ffd23f, #3ddc84, #00c2d1, #8338ec, #ff7eb6, #ff4d6d); }
.sw.custom.on { background: var(--c); }
.sw.custom input { position: absolute; inset: -6px; opacity: 0; width: 200%; height: 200%; padding: 0; border: 0; cursor: pointer; }
.tool-row { display: flex; gap: 6px; justify-content: center; }
.tb { min-width: 46px; height: 42px; border-radius: 12px; border: 3px solid var(--ink); background: #fff; font-size: 19px; cursor: pointer; display: grid; place-items: center; }
.tb.on { background: #ffe1e8; }
.tb:disabled { opacity: .4; }
.tb.size i { width: var(--d); height: var(--d); border-radius: 50%; background: var(--c); display: block; }

/* PIN */
.pin { font-size: 30px; letter-spacing: 12px; text-align: center; font-weight: 700; font-family: ui-monospace, Menlo, monospace; }
.err { color: #d1284d; font-weight: 600; text-align: center; }

/* my claims */
.mine-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mine-item { border: 3px solid var(--ink); border-radius: 14px; background: #fff; padding: 6px; cursor: pointer; text-align: center; font-size: 12px; font-weight: 600; }
.mine-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; margin-bottom: 4px; background: #f3eee6; }

.toasts { position: fixed; left: 50%; bottom: calc(90px + var(--sab)); transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 14px; font-weight: 600; animation: pop .3s cubic-bezier(.3, 1.6, .5, 1); box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.toast.good { background: #1f9d55; } .toast.bad { background: #d1284d; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 5px solid #e8dff5; border-top-color: var(--hot); animation: spin .8s linear infinite; margin: 20px auto; }

@keyframes up { from { transform: translateY(40%); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }
@keyframes drop { from { transform: translateY(-30px) rotate(-12deg); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
