/* Family scrapbook: kraft pages, instant prints, tape, gift tags and stamps on a cork board. */
:root {
    --kraft: #C8A06A;
    --kraft-d: #9C7646;
    --cork: #AE7743;
    --cream: #FBF6EA;
    --paper: #FCF8EF;
    --tape: #EFE5C8;
    --ink: #2A1F17;
    --ink-2: #5A4535;
    --red: #C0312B;
    --red-d: #8E1F1A;
    --pine: #24513E;
    --pine-d: #163627;
    --gold: #D9A53F;
    --pink: #E8A39A;
    --mint: #A3CFB8;
    --sky: #A8C3DA;
    --butter: #F2CF7A;
    --f-mk: 'Shantell Sans', 'Segoe Print', cursive;
    --f-hand: 'Neucha', 'Segoe Print', cursive;
    --f-type: 'Courier Prime', 'Courier New', monospace;
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23g)' opacity='.6'/%3E%3C/svg%3E");
    --fiber: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012' numOctaves='3' seed='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .27 0 0 0 0 .12 0 0 0 1.5 -.62'/%3E%3C/filter%3E%3Cfilter id='k'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8 .45' numOctaves='2' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .18 0 0 0 0 .07 0 0 0 8 -5.05'/%3E%3C/filter%3E%3Crect width='360' height='360' filter='url(%23m)'/%3E%3Crect width='360' height='360' filter='url(%23k)'/%3E%3C/svg%3E");
    --cork-tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.035' numOctaves='3' seed='5' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .16 0 0 0 0 .06 0 0 0 2.2 -1'/%3E%3C/filter%3E%3Cfilter id='c'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.42' numOctaves='3' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .26 0 0 0 0 .13 0 0 0 0 .05 0 0 0 6 -3.25'/%3E%3C/filter%3E%3Cfilter id='d'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.38' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .8 0 0 0 0 .6 0 0 0 0 .38 0 0 0 -6 2.5'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23m)'/%3E%3Crect width='300' height='300' filter='url(%23c)'/%3E%3Crect width='300' height='300' filter='url(%23d)'/%3E%3C/svg%3E");
    /* hand-drawn pen strokes, used as masks so they take the text colour */
    --i-go: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 18' fill='none' stroke='%23000' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 9.5c7-.6 14-.8 21-.3M16 2.5l7 6.7-7.5 6.4'/%3E%3C/svg%3E");
    --i-back: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 16' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 8.5C14 8 8 8.3 2.5 8.6M8 2.5L2 8.6l6.4 5.6'/%3E%3C/svg%3E");
    --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 46 42' fill='none' stroke='%23000' stroke-width='4.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 24c5 3 9 8 12 14C21 24 30 11 43 3'/%3E%3C/svg%3E");
    --i-ring: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M26 4C12 3 4 14 4 25c0 12 9 20 21 19 12-1 19-10 19-21C44 12 36 5 22 6c-5 0-9 3-12 6'/%3E%3C/svg%3E");
    --i-spark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linejoin='round'%3E%3Cpath d='M12 2.5c.6 5 1.6 8 9.5 9.5-7.9 1.5-8.9 4.5-9.5 9.5-.6-5-1.6-8-9.5-9.5 7.9-1.5 8.9-4.5 9.5-9.5z'/%3E%3C/svg%3E");
    --i-tally: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-2 -2 74 34' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M8 4v22M18 3v23M28 4v22M38 3v23M2 22C16 15 30 10 46 6'/%3E%3Cpath d='M56 4v22M66 4v22' stroke-dasharray='3 4' opacity='.5'/%3E%3C/svg%3E");
    --i-replay: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12a8 8 0 1 0 2.4-5.7M4 4v4.5h4.5'/%3E%3C/svg%3E");
    --i-nowifi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round'%3E%3Cpath d='M7 21c10-8.5 24-8.5 34 0M13.5 28c6.5-5.5 14.5-5.5 21 0M20 35c2.5-2 5.5-2 8 0M24 41.5h.01M9 8.5l30.5 31'/%3E%3C/svg%3E");
    --torn: polygon(0 0, 100% 0, 100% calc(100% - 3.1px), 95.83% calc(100% - 5.8px), 91.67% calc(100% - 1.2px), 87.5% calc(100% - 6.4px), 83.33% calc(100% - 2.7px), 79.17% calc(100% - 4.9px), 75% calc(100% - .8px), 70.83% calc(100% - 5.5px), 66.67% calc(100% - 3.6px), 62.5% calc(100% - 6.9px), 58.33% calc(100% - 1.9px), 54.17% calc(100% - 4.2px), 50% calc(100% - .4px), 45.83% calc(100% - 5.1px), 41.67% calc(100% - 2.3px), 37.5% calc(100% - 6.1px), 33.33% calc(100% - 3.9px), 29.17% calc(100% - 1.4px), 25% calc(100% - 5.7px), 20.83% calc(100% - 2.9px), 16.67% calc(100% - 4.6px), 12.5% calc(100% - .9px), 8.33% calc(100% - 6.6px), 4.17% calc(100% - 3.3px), 0 calc(100% - 1.7px));
    --tape-cut: polygon(0 6%, 5% 0, 95% 5%, 100% 0, 98% 30%, 100% 55%, 97% 78%, 100% 100%, 5% 95%, 0 100%, 3% 70%, 0 45%, 3% 22%);
    --shadow-print: 0 1px 1px rgba(0, 0, 0, 0.18), 0 10px 18px -8px rgba(0, 0, 0, 0.42);
    --tap: 44px;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100dvh;
    font: 400 21px/1.3 var(--f-hand);
    color: var(--ink);
    background-color: var(--cork);
    background-image: var(--cork-tex);
    touch-action: manipulation;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

body.is-busy { cursor: progress; }

button { -webkit-tap-highlight-color: transparent; }

:is(button, input, select, a):focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 3px;
}

/* ---------- textures and shared pieces ---------- */

.kraft {
    background-color: var(--kraft);
    background-image: var(--grain), var(--fiber), linear-gradient(172deg, rgba(255, 238, 205, 0.3), transparent 40%, transparent 70%, rgba(90, 55, 20, 0.22));
    background-blend-mode: soft-light, normal, normal;
}

.cork { background-color: var(--cork); background-image: var(--cork-tex); }

/* label-maker strip */
.dymo {
    display: inline-block;
    width: fit-content;
    margin: 0;
    padding: 6px 10px 5px;
    border-radius: 2px;
    font: 400 13px/1 var(--f-type);
    letter-spacing: 0.16em;
    word-spacing: -0.3em;
    text-transform: uppercase;
    color: #F6F1E6;
    background: linear-gradient(#2C2B2A, #121212);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8), 0 -1px 0 rgba(255, 255, 255, 0.28);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.35);
    transform: rotate(var(--r, -2deg));
}

.dymo.red { background: linear-gradient(#C8352E, #9A231D); }
.dymo.green { background: linear-gradient(#2C6049, #183A2C); }

.tape {
    position: absolute;
    z-index: 3;
    display: block;
    width: var(--w, 70px);
    height: 22px;
    transform: rotate(var(--r, 0deg));
    background: var(--bg, rgba(232, 163, 154, 0.82));
    clip-path: polygon(0 8%, 4% 0, 8% 10%, 92% 4%, 96% 0, 100% 12%, 97% 35%, 100% 58%, 96% 80%, 100% 100%, 94% 94%, 6% 100%, 2% 92%, 0 70%, 3% 48%, 0 26%);
    box-shadow: inset 0 0 0 40px rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

.t-pink { --bg: repeating-linear-gradient(45deg, rgba(232, 150, 140, 0.85) 0 6px, rgba(244, 196, 186, 0.85) 6px 12px); }
.t-mint { --bg: radial-gradient(circle, rgba(255, 255, 255, 0.75) 0 2px, transparent 2.5px) 0 0 / 9px 9px, rgba(139, 196, 168, 0.85); }
.t-gold { --bg: linear-gradient(rgba(217, 165, 63, 0.84), rgba(217, 165, 63, 0.84)); }
.t-red { --bg: linear-gradient(90deg, rgba(255, 255, 255, 0.35) 50%, transparent 0) 0 0 / 10px 10px, linear-gradient(rgba(255, 255, 255, 0.35) 50%, transparent 0) 0 0 / 10px 10px, rgba(192, 49, 43, 0.85); }
.t-sky { --bg: repeating-linear-gradient(90deg, rgba(150, 184, 214, 0.86) 0 4px, rgba(196, 216, 234, 0.86) 4px 8px); }
.t-mask { --bg: rgba(236, 226, 196, 0.9); }

/* instant print: blank white bottom margin, no caption */
.pol {
    position: absolute;
    margin: 0;
    width: var(--w, 120px);
    padding: 7px 7px calc(var(--fs, 18px) + 16px);
    transform: rotate(var(--r, 0deg));
    background-color: var(--paper);
    background-image: var(--grain);
    background-blend-mode: soft-light;
    box-shadow: var(--shadow-print);
    pointer-events: none;
}

.pol img {
    display: block;
    width: 100%;
    height: var(--h, 100px);
    object-fit: cover;
    object-position: var(--p, 50% 50%);
    filter: saturate(1.06) contrast(1.04) sepia(0.06);
}

.pol .tape { top: -10px; left: var(--tx, 30%); --w: var(--tw, 60px); --r: var(--tr, -6deg); }

/* pushpin */
.pin {
    position: absolute;
    z-index: 4;
    top: -6px;
    left: 50%;
    width: 15px;
    height: 15px;
    margin-left: -7px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.85) 0 14%, transparent 42%), var(--pc, var(--red));
    box-shadow: 2px 4px 3px rgba(0, 0, 0, 0.4), inset -2px -2px 3px rgba(0, 0, 0, 0.3);
}

/* a small pinned print: a person's head on coloured paper */
.mini {
    position: relative;
    margin: 0;
    padding: 6px 6px 0;
    background-color: var(--paper);
    background-image: var(--grain);
    background-blend-mode: soft-light;
    transform: rotate(var(--r, 0deg));
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 8px 12px -6px rgba(0, 0, 0, 0.45);
}

.mini .ph {
    position: relative;
    display: block;
    height: var(--ph, 92px);
    overflow: hidden;
    background: var(--c, var(--pink));
}

.mini .ph .sticker { position: absolute; inset: 0; }
.mini .ph .sticker img { object-position: 50% 100%; transform: translateY(6px) scale(1.06); filter: none; }

.mini .nm {
    display: block;
    padding: 6px 0 8px;
    font: 400 var(--nf, 22px)/1 var(--f-hand);
    text-align: center;
    overflow-wrap: anywhere;
}

.mini .nm small { font-size: 0.72em; color: var(--ink-2); }
.mini .nm small.state { display: block; margin-top: 2px; }

/* undecided: a dashed empty print with a question mark */
.mini.is-pending .ph, .mini.is-maybe .ph {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2.5px dashed rgba(42, 31, 23, 0.55);
    background: repeating-linear-gradient(135deg, rgba(42, 31, 23, 0.05) 0 6px, transparent 6px 12px);
}

.mini .qm { font: 400 56px/1 var(--f-hand); color: var(--ink-2); animation: bob 2.4s ease-in-out infinite; }

/* can't make it: greyed print with a paper slip */
.mini.is-no { background-color: #E7E1D6; }
.mini.is-no .ph { background: #C9C2B6; }
.mini.is-no .ph img { filter: grayscale(1) contrast(0.8); opacity: 0.5; }
.mini.is-no .nm { color: #5A5148; }

.slip {
    position: absolute;
    z-index: 5;
    top: 12px;
    left: -6px;
    right: -8px;
    padding: 5px 2px;
    font: 400 19px/1 var(--f-hand);
    text-align: center;
    color: var(--red-d);
    background: var(--tape);
    transform: rotate(-9deg);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25);
}

/* round rubber stamp */
.stamp {
    position: absolute;
    z-index: 5;
    top: calc(var(--ph, 92px) - 28px);
    right: -12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 2.5px solid var(--pine);
    border-radius: 50%;
    font: 800 14px/1 var(--f-mk);
    text-transform: uppercase;
    color: var(--pine);
    background: rgba(252, 248, 239, 0.82);
    transform: rotate(-14deg);
}

@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(6deg); } }

/* ---------- page: a kraft sheet on the cork board ---------- */

.sheet {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100dvh;
    margin: 0 auto;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    overflow-x: clip;
}

.sheet:has(.reveal) {
    background-color: var(--pine);
    background-image: var(--grain), var(--fiber);
    background-blend-mode: soft-light, soft-light;
}

.deco { display: none; }

@media (min-width: 720px) {
    .sheet {
        width: 440px;
        min-height: calc(100dvh - 64px);
        margin: 32px auto;
        box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25), 0 34px 50px -20px rgba(0, 0, 0, 0.6);
    }

    .sheet::before, .sheet::after {
        content: '';
        position: absolute;
        z-index: 6;
        top: -11px;
        width: 92px;
        height: 24px;
        background: rgba(236, 226, 196, 0.9);
        clip-path: var(--tape-cut);
    }

    .sheet::before { left: 18px; transform: rotate(-7deg); }
    .sheet::after { right: 18px; transform: rotate(6deg); background: repeating-linear-gradient(45deg, rgba(232, 150, 140, 0.85) 0 6px, rgba(244, 196, 186, 0.85) 6px 12px); }
}

/* loose family prints pinned on the cork beside the page, desktop only */
@media (min-width: 1000px) {
    .deco { position: fixed; inset: 0; z-index: 0; display: block; overflow: hidden; pointer-events: none; }
    .deco .pol { --w: 150px; --h: 170px; --fs: 18px; }
    .deco .d1 { left: calc(50% - 460px); top: 5vh; --r: -8deg; --h: 190px; --p: 50% 40%; --tr: -6deg; }
    .deco .d2 { left: calc(50% - 440px); top: 39vh; --r: 7deg; --p: 50% 72%; --tr: 8deg; }
    .deco .d3 { left: calc(50% - 470px); top: 70vh; --r: -5deg; --h: 150px; --p: 50% 58%; --tr: -10deg; }
    .deco .d4 { left: calc(50% + 300px); top: 7vh; --r: 7deg; --h: 180px; --p: 50% 62%; --tr: 5deg; }
    .deco .d5 { left: calc(50% + 280px); top: 41vh; --r: -6deg; --h: 190px; --p: 50% 60%; --tr: -4deg; }
    .deco .d6 { left: calc(50% + 310px); top: 73vh; --r: 5deg; --h: 130px; --p: 40% 60%; --tr: 7deg; }
}

/* ---------- chrome: practice label, back, language ---------- */

.practice-banner {
    position: relative;
    z-index: 6;
    display: block;
    max-width: calc(100% - 32px);
    margin: 10px auto 0;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    --r: -1.5deg;
}

.practice-tools {
    position: relative;
    z-index: 6;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 8px 16px 0;
}

.practice-tools[hidden] {
    display: none;
}

.practice-tools .ghost {
    font-size: 19px;
}

.topbar {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 60px;
    padding: 8px 16px 2px;
}

.btn-back {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--tap);
    min-width: 92px;
    padding: 0 16px 0 12px;
    border: 0;
    font: 400 24px/1 var(--f-hand);
    color: var(--ink);
    background: none;
    transform: rotate(-2deg);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
    cursor: pointer;
}

.btn-back::before {
    content: '';
    width: 20px;
    height: 16px;
    background: currentColor;
    -webkit-mask: var(--i-back) center / contain no-repeat;
    mask: var(--i-back) center / contain no-repeat;
}

.btn-back::after, .lang::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--tape);
    clip-path: var(--tape-cut);
}

.lang {
    position: relative;
    isolation: isolate;
    display: flex;
    margin-left: auto;
    padding: 0 4px;
    transform: rotate(1.5deg);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

.lang button {
    min-width: var(--tap);
    min-height: var(--tap);
    padding: 0 4px;
    border: 0;
    font: 700 15px/1 var(--f-type);
    letter-spacing: 0.1em;
    color: var(--ink);
    background: none;
    cursor: pointer;
}

.lang button[aria-pressed='true'] {
    color: #F6F1E6;
    background: linear-gradient(#2C2B2A, #121212) center / 38px 26px no-repeat;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}

/* ---------- screen layout ---------- */

.screen {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 4px 16px 24px;
    overflow-x: clip; /* tilted prints may poke past the page edge */
}

.screen > * {
    flex: 1;
    display: flex;
    flex-direction: column;
    animation: rise 0.35s ease both;
}

.screen.is-redraw > * { animation: none; } /* same screen with fresh data: no entrance again */
.screen h1:focus { outline: none; } /* focused only to start keyboard users on the new screen */

@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

h1 {
    margin: 0;
    font: 800 35px/0.98 var(--f-mk);
    letter-spacing: 0.01em;
    text-wrap: balance;
}

.lead { margin: 6px 0 0; font: 400 23px/1.2 var(--f-hand); text-wrap: pretty; }

/* ---------- buttons ---------- */

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 58px;
    padding: 10px 22px;
    border: 0;
    border-radius: 16px 20px 14px 22px / 20px 14px 22px 16px;
    font: 800 22px/1.1 var(--f-mk);
    letter-spacing: 0.02em;
    text-align: center;
    color: #FFF8EC;
    background-color: var(--red);
    background-image: var(--grain);
    background-blend-mode: soft-light;
    box-shadow: 0 5px 0 var(--red-d), 0 12px 18px -6px rgba(0, 0, 0, 0.41);
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
}

.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--red-d), 0 6px 10px -6px rgba(0, 0, 0, 0.41); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* a pen arrow on the buttons that move forward */
:is(.gifts, .intro, .pin-form) .btn::after {
    content: '';
    flex: none;
    width: 26px;
    height: 18px;
    background: currentColor;
    -webkit-mask: var(--i-go) center / contain no-repeat;
    mask: var(--i-go) center / contain no-repeat;
}

/* hand-drawn outline button */
.ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tap);
    padding: 4px 14px;
    border: 2.4px solid var(--ink);
    border-radius: 12px 16px 10px 18px / 16px 10px 18px 12px;
    font: 400 23px/1.05 var(--f-hand);
    color: var(--ink);
    background: rgba(252, 248, 239, 0.35);
    cursor: pointer;
}

.btn-link, .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    align-self: center;
    min-height: var(--tap);
    padding: 4px 12px;
    border: 0;
    font: 400 22px/1.1 var(--f-hand);
    color: var(--ink);
    background: none;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 4px;
    cursor: pointer;
}

.not-you { margin-top: auto; padding-top: 14px; }

:is(.ghost, .btn-link, .btn-ghost, .btn-back, .lang button, .opt, .card, .gift-option):disabled { cursor: progress; }

/* ---------- stickers ---------- */

.sticker {
    position: relative;
    display: grid;
    place-items: center;
    container-type: inline-size;
}

/* Absolute so a tall PNG never stretches its box. */
.sticker img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.12)) drop-shadow(0 4px 5px rgba(0, 0, 0, 0.26));
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}

.initials {
    display: grid;
    place-items: center;
    width: 78%;
    aspect-ratio: 1;
    border: 4px solid #fff;
    border-radius: 50%;
    font: 800 30cqw/1 var(--f-mk);
    color: #fff;
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
    background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.38), transparent 46%), var(--badge);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.32);
}

/* ---------- WHO ---------- */

.who { position: relative; }
.who .dymo { margin: 4px 0 0 4px; }
.who h1 { max-width: calc(100% - 132px); margin-top: 14px; font-size: clamp(38px, 11.6vw, 46px); line-height: 0.94; }
.who .lead { margin-top: 12px; font-size: 25px; }
.who-pol { --w: 116px; --h: 90px; --p: 50% 60%; --r: 7deg; --fs: 17px; --tx: 28px; --tr: -10deg; top: 10px; right: 0; }

.who-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px 6px;
    margin: 22px -8px 0;
}

.card {
    position: relative;
    flex: 0 0 calc((100% - 12px) / 3);
    min-width: 0;
    max-width: 136px;
    height: clamp(168px, 50vw, 194px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 0;
    border: 0;
    border-radius: 18px;
    font: inherit;
    color: var(--ink);
    background: none;
    transform: rotate(var(--r, 0deg));
    cursor: pointer;
    transition: transform 0.18s;
}

.card:active:not(:disabled) { transform: rotate(var(--r, 0deg)) scale(0.96); }
.card .sticker { width: 100%; flex: 1; min-height: 0; }
.card .sticker img { object-position: 50% 100%; }

.card-name {
    position: relative;
    z-index: 2;
    isolation: isolate;
    margin-top: -10px;
    padding: 4px 11px 5px;
    font: 400 clamp(21px, 6.4vw, 26px)/1 var(--f-hand);
    white-space: nowrap;
    transform: rotate(var(--lr, -3deg));
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.22));
}

.card-name::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--tape);
    clip-path: polygon(0 10%, 5% 0, 95% 8%, 100% 0, 98% 45%, 100% 100%, 94% 92%, 5% 100%, 0 92%, 2% 50%);
}

@media (hover: hover) {
    .card:hover .card-name { color: #FFF8EC; }
    .card:hover .card-name::before { background: var(--red); }
}

/* already in the draw: a small green check stamp */
.card.is-in::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 4px;
    width: 34px;
    height: 34px;
    border: 2.5px solid var(--pine);
    border-radius: 50%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 46 42' fill='none' stroke='%2324513E' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 24c5 3 9 8 12 14C21 24 30 11 43 3'/%3E%3C/svg%3E") 55% 45% / 18px no-repeat, rgba(252, 248, 239, 0.85);
    transform: rotate(-14deg);
}

.card:nth-child(8n+1) { --r: -3deg; --lr: -4deg; }
.card:nth-child(8n+2) { --r: 2deg; --lr: 3deg; }
.card:nth-child(8n+3) { --r: -1deg; --lr: -2deg; }
.card:nth-child(8n+4) { --r: 3deg; --lr: 2deg; }
.card:nth-child(8n+5) { --r: -2deg; --lr: -3deg; }
.card:nth-child(8n+6) { --r: 2deg; --lr: 4deg; }
.card:nth-child(8n+7) { --r: -2deg; --lr: -3deg; }
.card:nth-child(8n+8) { --r: 3deg; --lr: 2deg; }

/* ---------- RSVP ---------- */

.hello { display: flex; align-items: center; gap: 8px; }
.hello .sticker { flex: none; width: 46px; height: 46px; }
.hello h1 { font: 400 26px/1.1 var(--f-hand); }

.rsvp-prints { position: relative; height: 252px; margin-top: 6px; }
.rsvp-a { --w: 250px; --h: 196px; --p: 50% 50%; --r: -3.5deg; --fs: 20px; --tx: 90px; --tw: 78px; --tr: -3deg; top: 12px; left: 6px; }
.rsvp-b { --w: 132px; --h: 98px; --p: 50% 45%; --r: 9deg; --fs: 17px; --tw: 62px; --tr: 12deg; top: 92px; right: 0; }

.q { margin: 14px 4px 0; font: 800 31px/1.02 var(--f-mk); text-wrap: balance; }

.stack { display: flex; flex-direction: column; gap: 12px; margin: 16px 2px 0; }

.opt {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 78px;
    padding: 12px 16px 12px 14px;
    border: 0;
    border-radius: 3px;
    font: 800 21px/1.1 var(--f-mk);
    text-align: left;
    color: var(--ink);
    background-color: var(--paper);
    background-image: linear-gradient(transparent 21px, rgba(192, 49, 43, 0.45) 21px 22.5px, transparent 22.5px), var(--grain);
    background-blend-mode: normal, soft-light;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 6px 10px -6px rgba(0, 0, 0, 0.38);
    transform: rotate(var(--r, 0deg));
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.opt:nth-child(1) { --r: -1deg; }
.opt:nth-child(2) { --r: 0.8deg; }
.opt:nth-child(3) { --r: -0.6deg; }

.opt .cb {
    position: relative;
    flex: none;
    width: 34px;
    height: 34px;
    border: 2.6px solid var(--ink);
    border-radius: 5px 8px 4px 9px;
    transform: rotate(-4deg);
}

.opt .cb::after {
    content: '';
    position: absolute;
    top: -14px;
    left: -4px;
    display: none;
    width: 46px;
    height: 42px;
    background: var(--red);
    -webkit-mask: var(--i-check) center / contain no-repeat;
    mask: var(--i-check) center / contain no-repeat;
}

.opt .tape { display: none; top: -9px; right: 16px; --r: 8deg; --w: 54px; }

/* the answer already given, and the one being tapped, get the tick */
.opt.is-on, .opt:active:not(:disabled) { box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 16px 22px -10px rgba(0, 0, 0, 0.49); transform: rotate(-1.6deg) translateY(-2px); }
:is(.opt.is-on, .opt:active:not(:disabled)) .cb::after, .opt.is-on .tape { display: block; }
.opt.is-on .hl { margin: 0 -3px; padding: 0 3px; background: linear-gradient(100deg, transparent 2%, rgba(247, 214, 74, 0.85) 4% 96%, transparent 98%) 0 62% / 100% 62% no-repeat; }

/* ---------- GIFTS ---------- */

.gifts h1 { margin-top: 8px; font-size: 31px; line-height: 1.03; }
.gifts .lead { font-size: 22px; }

.gift-options {
    display: flex;
    justify-content: space-evenly;
    margin: 6px -16px 0;
    padding: 30px 6px 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 390 60' preserveAspectRatio='none'%3E%3Cpath d='M-10 18Q195 52 400 14' fill='none' stroke='%236E4E2C' stroke-width='2.6' stroke-dasharray='6 2'/%3E%3Cpath d='M-10 19Q195 53 400 15' fill='none' stroke='%23D7B27A' stroke-width='1' stroke-dasharray='2 6'/%3E%3C/svg%3E") 0 8px / 100% 60px no-repeat;
}

.gift-option {
    position: relative;
    flex: 0 0 104px;
    height: 150px;
    margin-top: var(--t, 0);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 0 0;
    border: 0;
    font: inherit;
    color: var(--ink);
    background: none;
    transform: rotate(var(--r)) scale(var(--s, 1));
    transform-origin: 50% 0;
    filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.3));
    cursor: pointer;
    transition: transform 0.15s;
}

.gift-option:nth-child(1) { --r: -6deg; --t: -2px; }
.gift-option:nth-child(2) { --r: 2deg; --t: 2px; }
.gift-option:nth-child(3) { --r: 6deg; --t: -4px; }
.gift-option:active:not(:disabled) { --s: 0.97; }
.gift-option[aria-pressed='true'] { --s: 1.08; color: #FFF8EC; }

.tag-bg {
    position: absolute;
    inset: 0;
    background-color: var(--paper);
    background-image: var(--grain);
    background-blend-mode: soft-light;
    clip-path: polygon(22% 0, 78% 0, 100% 15%, 100% 100%, 0 100%, 0 15%);
}

.tag-bg::after {
    content: '';
    position: absolute;
    inset: 7px;
    border: 1.5px dashed rgba(42, 31, 23, 0.35);
    clip-path: inherit;
}

.gift-option[aria-pressed='true'] .tag-bg { background-color: var(--red); }
.gift-option[aria-pressed='true'] .tag-bg::after { border-color: rgba(255, 240, 220, 0.55); }

.peg {
    position: absolute;
    z-index: 2;
    top: -22px;
    left: 50%;
    width: 12px;
    height: 40px;
    margin-left: -6px;
    border-radius: 3px;
    background: linear-gradient(90deg, #B98B56, #E4C28E 45%, #B98B56);
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.35);
}

.peg::after { content: ''; position: absolute; top: 15px; left: 0; right: 0; height: 2px; background: rgba(60, 35, 15, 0.6); }

.gift-option .n { position: relative; font: 800 62px/1 var(--f-mk); }
.gift-option .l { position: relative; margin-top: 2px; font: 400 25px/1 var(--f-hand); }

/* a gold pen sparkle beside the chosen tag */
.gift-option[aria-pressed='true']::after {
    content: '';
    position: absolute;
    z-index: 3;
    bottom: 10px;
    left: -10px;
    width: 26px;
    height: 26px;
    background: var(--gold);
    -webkit-mask: var(--i-spark) center / contain no-repeat;
    mask: var(--i-spark) center / contain no-repeat;
    animation: twinkle 3.2s ease-in-out infinite;
}

@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(0.72) rotate(18deg); opacity: 0.75; } }

.note-row { position: relative; margin-top: 10px; padding-bottom: 122px; }

/* lined notebook paper */
.note {
    position: relative;
    z-index: 1;
    width: min(272px, 80%);
    margin: 0 0 0 4px;
    padding: 14px 16px 22px 30px;
    font: 400 22px/30px var(--f-hand);
    background-color: #FDFBF4;
    background-image: linear-gradient(90deg, transparent 20px, rgba(192, 49, 43, 0.5) 20px 21.5px, transparent 21.5px), repeating-linear-gradient(transparent 0 29px, rgba(110, 150, 200, 0.4) 29px 30px), var(--grain);
    background-position: 0 0, 0 12px, 0 0;
    background-blend-mode: normal, normal, soft-light;
    transform: rotate(-2deg);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 12px 18px -10px rgba(0, 0, 0, 0.45);
}

.note p { margin: 0; }
.note .tape { top: -11px; left: 96px; --r: -4deg; --w: 84px; }
.gifts-pol { --w: 150px; --h: 94px; --p: 50% 38%; --r: 6deg; --fs: 18px; --tx: 44px; --tr: 10deg; right: -4px; bottom: 0; z-index: 2; }
.gifts .btn { margin-top: auto; }

/* ---------- PIN ---------- */

.pin-form { align-items: center; gap: 14px; padding-top: 6px; text-align: center; }
.pin-form .mini { width: 132px; --r: -4deg; --ph: 118px; padding-bottom: 22px; }
.pin-form h1 { margin-top: 6px; font-size: 33px; }
.pin-form .lead { margin: 0; max-width: 30ch; }

.pin-input {
    width: 100%;
    max-width: 236px;
    margin-top: 4px;
    padding: 14px 0 12px;
    border: 2.6px solid var(--ink);
    border-radius: 6px 10px 5px 12px / 10px 5px 12px 6px;
    outline: none;
    font: 700 40px/1 var(--f-type);
    letter-spacing: 0.5em;
    text-indent: 0.5em;
    text-align: center;
    color: var(--ink);
    caret-color: var(--red);
    background-color: #FDFBF4;
    background-image: repeating-linear-gradient(transparent 0 29px, rgba(110, 150, 200, 0.4) 29px 30px), var(--grain);
    background-position: 0 6px, 0 0;
    background-blend-mode: normal, soft-light;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 10px 16px -10px rgba(0, 0, 0, 0.45);
    transform: rotate(-1deg);
}

.pin-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(192, 49, 43, 0.28), 0 10px 16px -10px rgba(0, 0, 0, 0.45); }
.pin-input::placeholder { color: rgba(42, 31, 23, 0.3); }
.pin-input.masked { -webkit-text-security: disc; }
.pin-form .btn { max-width: 340px; margin-top: 6px; }
.hint { margin: 0; max-width: 30ch; font-size: 21px; }
.pin-form .not-you { margin-top: 0; }

.shake { animation: shake 0.4s ease; }

@keyframes shake {
    20%, 60% { transform: translateX(-10px) rotate(-1deg); }
    40%, 80% { transform: translateX(10px) rotate(-1deg); }
}

/* ---------- WAIT ---------- */

.wait .dymo { margin: 2px 0 0 4px; --r: -1.5deg; }
.wait h1 { margin-top: 14px; }
.wait .lead { margin-top: 6px; font-size: 21px; }

.crowd {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 8px;
    margin: 14px -4px 0;
    padding: 18px 10px 16px;
    border-radius: 6px;
    box-shadow: inset 0 0 0 7px #7E552F, inset 0 0 0 9px #5B3B20, inset 0 3px 14px 9px rgba(0, 0, 0, 0.34), 0 8px 16px -8px rgba(0, 0, 0, 0.45);
}

.crowd-item { align-self: center; --nf: clamp(18px, 5.4vw, 22px); }
.crowd-item:nth-child(4n+1) { --r: -4deg; --c: var(--pink); }
.crowd-item:nth-child(4n+2) { --r: 3deg; --c: var(--sky); --pc: var(--gold); }
.crowd-item:nth-child(4n+3) { --r: -2deg; --c: var(--butter); --pc: #2F7A5A; }
.crowd-item:nth-child(4n+4) { --r: 2deg; --c: var(--mint); --pc: #F3EEE2; }
.crowd-item:is(.is-pending, .is-maybe) { --pc: #6B8FB5; }
.crowd-item.is-no { --pc: #9A948A; }
.crowd-item.is-yes .ph .sticker { animation: nod 3.2s ease-in-out infinite; animation-delay: calc(var(--i) * -0.45s); }
.crowd-item:nth-child(3n) .stamp { right: -6px; }

@keyframes nod { 50% { transform: translateY(-4px) rotate(-2deg); } }

.count {
    position: relative;
    align-self: center;
    padding: 12px 6px 10px;
    text-align: center;
    background-color: #FDFBF4;
    background-image: repeating-linear-gradient(transparent 0 21px, rgba(110, 150, 200, 0.35) 21px 22px), var(--grain);
    background-blend-mode: normal, soft-light;
    transform: rotate(4deg);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 8px 12px -6px rgba(0, 0, 0, 0.45);
    --pc: var(--gold);
}

.count b { display: block; font: 800 40px/1 var(--f-mk); color: var(--red); }
.count span { display: block; font: 400 22px/1.05 var(--f-hand); }

.count::after {
    content: '';
    display: block;
    width: 70px;
    height: 30px;
    margin: 6px auto 0;
    background: var(--ink);
    -webkit-mask: var(--i-tally) center / contain no-repeat;
    mask: var(--i-tally) center / contain no-repeat;
}

.wait .foot { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.wait-pol { position: relative; flex: none; --w: 132px; --h: 66px; --r: -5deg; --fs: 16px; --p: 30% 55%; --tx: 36px; --tw: 56px; --tr: -8deg; }
.foot-side { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.wait .pill { margin: 0; font-size: 21px; line-height: 1.15; }

/* ---------- INTRO ---------- */

.intro-head { display: grid; grid-template-columns: 1fr auto; align-items: start; column-gap: 10px; }
.intro h1 { grid-area: 1 / 1; margin: 4px 0 0 4px; font: 400 14px/31px var(--f-type); transform: rotate(-2deg); }
/* a long label prints as two strips, like a label maker would */
.intro h1 .dymo { display: inline; font-size: 14px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

.ready {
    grid-area: 2 / 1;
    margin: 8px 0 0;
    font: 800 clamp(40px, 13vw, 58px)/1.05 var(--f-mk);
    transform: rotate(-3deg);
    transform-origin: 0 50%;
}

/* the Spanish word is too long to sit beside the print, so it goes under it */
:lang(es) .ready { grid-area: 3 / 1 / 4 / 3; margin-top: 6px; font-size: clamp(34px, 11.4vw, 48px); }
.intro-pol { position: relative; grid-area: 1 / 2 / 3 / 3; z-index: 4; margin-top: -4px; --w: 104px; --h: 92px; --p: 50% 65%; --r: 8deg; --fs: 17px; --tx: 26px; --tw: 56px; --tr: -12deg; }

.board {
    position: relative;
    height: clamp(330px, 50dvh, 420px);
    margin: 30px 0 0;
    padding: 10px;
    border-radius: 8px;
    background: repeating-linear-gradient(92deg, rgba(60, 30, 10, 0.12) 0 2px, transparent 2px 9px), linear-gradient(135deg, #9A6A3E, #7A4E2A 50%, #8E603A);
    box-shadow: 0 14px 20px -10px rgba(0, 0, 0, 0.52), inset 0 0 0 1px rgba(255, 220, 170, 0.25);
}

.board-in {
    position: relative;
    height: 100%;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.41);
}

/* rows of coloured pushpins, staggered like a pachinko board */
.board-in::before {
    content: '';
    position: absolute;
    top: 92px;
    left: 8px;
    right: 8px;
    bottom: 74px;
    --pin: rgba(255, 255, 255, 0.85) 0 1.6px, transparent 2.2px;
    background:
        radial-gradient(circle at 4px 4px, var(--pin)), radial-gradient(circle at 6px 6px, #C0312B 0 5.6px, rgba(0, 0, 0, 0.3) 6px, transparent 6.8px),
        radial-gradient(circle at 46px 4px, var(--pin)), radial-gradient(circle at 48px 6px, #D9A53F 0 5.6px, rgba(0, 0, 0, 0.3) 6px, transparent 6.8px),
        radial-gradient(circle at 88px 4px, var(--pin)), radial-gradient(circle at 90px 6px, #2F7A5A 0 5.6px, rgba(0, 0, 0, 0.3) 6px, transparent 6.8px),
        radial-gradient(circle at 25px 40px, var(--pin)), radial-gradient(circle at 27px 42px, #F3EEE2 0 5.6px, rgba(0, 0, 0, 0.3) 6px, transparent 6.8px),
        radial-gradient(circle at 67px 40px, var(--pin)), radial-gradient(circle at 69px 42px, #6B8FB5 0 5.6px, rgba(0, 0, 0, 0.3) 6px, transparent 6.8px),
        radial-gradient(circle at 109px 40px, var(--pin)), radial-gradient(circle at 111px 42px, #E8A39A 0 5.6px, rgba(0, 0, 0, 0.3) 6px, transparent 6.8px);
    background-size: 126px 72px;
    background-position: center top;
}

/* a few strands of yarn between the pins */
.board-in::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 338 400' preserveAspectRatio='none' fill='none' stroke-linecap='round'%3E%3Cpath d='M26 128Q60 140 98 150' stroke='%23B3261E' stroke-width='2.4'/%3E%3Cpath d='M312 196Q276 206 240 218' stroke='%23B3261E' stroke-width='2.4'/%3E%3Cpath d='M40 262Q72 276 104 286' stroke='%23E8D9B5' stroke-width='2.2'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
    pointer-events: none;
}

.gate { position: absolute; z-index: 2; top: 12px; left: 10px; right: 10px; display: flex; justify-content: center; gap: 6px; }

.marble {
    position: relative;
    flex: 0 1 40px;
    aspect-ratio: 1;
    min-width: 0;
    border: 2.5px solid #fff;
    border-radius: 50%;
    overflow: hidden;
    background: var(--c, var(--pink));
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.34);
    animation: jiggle 1.6s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * -0.27s);
}

.marble:nth-child(4n+2) { --c: var(--mint); }
.marble:nth-child(4n+3) { --c: var(--sky); }
.marble:nth-child(4n+4) { --c: var(--butter); }
.marble .sticker { position: absolute; inset: 0; }
.marble .sticker img { filter: none; transform: scale(1.18) translateY(7%); object-fit: cover; }

.marble::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.95) 0 6%, rgba(255, 255, 255, 0.25) 16%, transparent 32%), radial-gradient(circle at 65% 80%, transparent 45%, rgba(0, 0, 0, 0.32) 78%);
}

@keyframes jiggle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px) rotate(-6deg); } }

.ruler {
    position: absolute;
    z-index: 1;
    top: 60px;
    left: 10px;
    right: 10px;
    height: 18px;
    border-radius: 2px;
    transform: rotate(-1deg);
    background: repeating-linear-gradient(90deg, rgba(58, 40, 22, 0.85) 0 1px, transparent 1px 7px) 0 0 / 100% 5px no-repeat, repeating-linear-gradient(90deg, rgba(58, 40, 22, 0.9) 0 1.5px, transparent 1.5px 35px) 0 0 / 100% 9px no-repeat, linear-gradient(#EFD39B, #D9B472);
    box-shadow: 0 3px 3px rgba(0, 0, 0, 0.3);
}

.ruler span, .gift-box b { position: absolute; font: 700 12px/1 var(--f-type); letter-spacing: 0.12em; text-transform: uppercase; color: #3A2816; }
.ruler span { right: 8px; bottom: 2px; }

.ghostball {
    position: absolute;
    z-index: 2;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 2.5px solid #fff;
    border-radius: 50%;
    font: 400 24px/1 var(--f-hand);
    color: var(--ink);
    background: radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.95) 0 8%, rgba(255, 255, 255, 0.3) 22%, transparent 40%), radial-gradient(circle at 60% 70%, #F3E6CC, #D9C29A);
    box-shadow: 0 4px 5px rgba(0, 0, 0, 0.34);
    offset-path: path('M150 70 Q150 98 126 108 Q104 118 108 146 Q112 172 140 182 Q170 192 172 220 Q174 246 150 258 Q128 270 132 300 Q136 322 150 346');
    offset-rotate: 0deg;
    animation: fall 3.6s cubic-bezier(0.45, 0, 0.75, 1) infinite;
}

@keyframes fall { 0% { offset-distance: 0%; opacity: 0; } 8% { opacity: 1; } 88% { opacity: 1; } 100% { offset-distance: 100%; opacity: 0; } }

/* sewing buttons tucked between the pins */
.sbtn {
    position: absolute;
    z-index: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 38%, rgba(0, 0, 0, 0.55) 0 2px, transparent 2.5px), radial-gradient(circle at 62% 38%, rgba(0, 0, 0, 0.55) 0 2px, transparent 2.5px), radial-gradient(circle at 38% 62%, rgba(0, 0, 0, 0.55) 0 2px, transparent 2.5px), radial-gradient(circle at 62% 62%, rgba(0, 0, 0, 0.55) 0 2px, transparent 2.5px), radial-gradient(circle, transparent 56%, rgba(0, 0, 0, 0.18) 58% 64%, transparent 66%), var(--c);
    box-shadow: 2px 4px 4px rgba(0, 0, 0, 0.34);
}

.sbtn:nth-of-type(1) { top: 47%; left: 14%; --c: #E9C95A; }
.sbtn:nth-of-type(2) { top: 68%; right: 16%; --c: #8FC1D9; }

.finish { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; height: 62px; }
.finish::before { content: ''; display: block; height: 16px; background: conic-gradient(#222 25%, #F3ECDD 0 50%, #222 0 75%, #F3ECDD 0) 0 0 / 12px 12px; }

.gift-box {
    position: absolute;
    bottom: -8px;
    left: 50%;
    width: 120px;
    height: 52px;
    margin-left: -60px;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(90deg, transparent 52px, var(--red) 52px 68px, transparent 68px), linear-gradient(#C99A5E, #A97A42);
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.26);
}

.gift-box::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -6px;
    right: -6px;
    height: 14px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent 58px, var(--red) 58px 74px, transparent 74px), linear-gradient(#D8AB6E, #B4864B);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.26);
}

.gift-box b { top: 18px; left: 0; right: 0; text-align: center; }

.btn-xl { position: relative; min-height: 64px; margin-top: 20px; font-size: clamp(20px, 6.1vw, 25px); }

.intro .btn-xl::before {
    content: '';
    position: absolute;
    inset: -6px;
    border: 3px solid var(--red);
    border-radius: 22px;
    opacity: 0;
    animation: pulse 2s ease-out infinite;
    pointer-events: none;
}

@keyframes pulse { 0% { opacity: 0.7; transform: scale(0.97); } 100% { opacity: 0; transform: scale(1.08); } }

.intro .pill { margin: 16px 8px 0; font-size: 22px; line-height: 1.3; text-align: center; text-wrap: balance; }

/* ---------- REVEAL ---------- */

.reveal { position: relative; color: #FFF6E6; }
.reveal .rays { position: absolute; inset: -4px -16px 0; overflow: hidden; pointer-events: none; }

.reveal .rays::before {
    content: '';
    position: absolute;
    top: 330px;
    left: 50%;
    width: 760px;
    height: 760px;
    margin: -380px 0 0 -380px;
    border-radius: 50%;
    background: repeating-conic-gradient(rgba(255, 240, 210, 0.09) 0 7deg, transparent 7deg 15deg);
    -webkit-mask: radial-gradient(circle, #000 18%, transparent 62%);
    mask: radial-gradient(circle, #000 18%, transparent 62%);
    animation: spin 60s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.strip {
    position: relative;
    z-index: 6;
    margin: 6px 2px 0;
    padding: 18px 20px 24px;
    text-align: center;
    color: var(--ink);
    background-color: var(--paper);
    background-image: var(--grain);
    background-blend-mode: soft-light;
    clip-path: var(--torn);
    transform: rotate(-1.5deg);
}

.strip-wrap { position: relative; z-index: 6; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.34)); }
.strip-wrap .tape { top: -4px; }
.strip-wrap .t-gold { left: 24px; --r: -8deg; }
.strip-wrap .t-pink { right: 22px; --r: 7deg; }
.reveal-title { font-size: 29px; line-height: 1.05; }

.stage { position: relative; height: 410px; margin-top: 4px; }

.reveal-grid {
    position: absolute;
    z-index: 3;
    top: 0;
    left: -6px;
    right: -6px;
    display: flex;
    justify-content: center;
    gap: 14px;
    padding-top: 22px;
}

.reveal-item {
    flex: 0 1 158px;
    min-width: 0;
    container-type: inline-size;
    margin-top: var(--t, 0);
    padding: 10px 9px 0;
    color: var(--red);
    background-color: var(--paper);
    background-image: var(--grain);
    background-blend-mode: soft-light;
    box-shadow: 0 14px 20px -10px rgba(0, 0, 0, 0.49);
    transform: rotate(var(--r, 0deg));
    animation: pop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both, floaty 4s ease-in-out 0.7s infinite;
}

.reveal-item:nth-child(1) { --r: -8deg; --bgc: linear-gradient(90deg, rgba(255, 255, 255, 0.35) 50%, transparent 0) 0 0 / 14px 14px, linear-gradient(rgba(255, 255, 255, 0.35) 50%, transparent 0) 0 0 / 14px 14px, var(--pink); }
.reveal-item:nth-child(2) { --r: 7deg; --t: 14px; --bgc: radial-gradient(circle, rgba(255, 255, 255, 0.55) 0 2.5px, transparent 3px) 0 0 / 12px 12px, var(--mint); animation-delay: 0.18s, -1.3s; }
.reveal-item:nth-child(3) { --r: -2deg; --t: 4px; --bgc: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.35) 0 6px, transparent 6px 12px), var(--sky); animation-delay: 0.36s, -2.6s; }
.n1 .reveal-item { flex-basis: 184px; --r: -4deg; }
.n3 { gap: 6px; }
.n3 .reveal-item { flex-basis: 106px; padding: 8px 6px 0; }
.n3 .reveal-item:nth-child(1) { --r: -6deg; --t: 12px; }
.n3 .reveal-item:nth-child(3) { --r: 6deg; --t: 14px; }
.n3 .reveal-item .bg { height: clamp(118px, 33vw, 140px); }

/* the longest word of the name (--len letters) always fits the card */
.reveal-item strong { display: block; padding: 2px 0 8px; font: 800 min(30px, 100cqw / (var(--len, 7) * 0.66))/1.05 var(--f-mk); text-align: center; }
.reveal-item .bg { display: flex; align-items: flex-end; justify-content: center; height: clamp(140px, 42vw, 166px); overflow: hidden; background: var(--bgc); }
.reveal-item .sticker { width: 96%; height: 92%; }
.reveal-item .sticker img { object-position: 50% 100%; }

@keyframes pop { from { opacity: 0; transform: scale(0.4) rotate(-8deg); } }
@keyframes floaty { 0%, 100% { transform: rotate(var(--r)) translateY(0); } 50% { transform: rotate(var(--r)) translateY(-8px); } }

/* the envelope the cards are tucked into */
.env { position: absolute; z-index: 2; top: 186px; left: 8px; right: 8px; height: 206px; }
.env i { position: absolute; display: block; }
.env .bk { inset: 0; border-radius: 4px; background: linear-gradient(#8A6438, #7A5630); }
.env .flap { bottom: 100%; left: 0; right: 0; height: 118px; background: linear-gradient(0deg, #8E683B, #A47A48); clip-path: polygon(0 100%, 50% 0, 100% 100%); }

.env .front {
    z-index: 5;
    inset: 0;
    border-radius: 0 0 4px 4px;
    background-color: #C89B62;
    background-image: linear-gradient(to top right, transparent 49.6%, rgba(90, 60, 25, 0.25) 50%, transparent 50.6%), linear-gradient(to top left, transparent 49.6%, rgba(90, 60, 25, 0.25) 50%, transparent 50.6%), var(--grain), linear-gradient(160deg, rgba(255, 235, 200, 0.2), transparent 60%);
    background-blend-mode: normal, normal, soft-light, normal;
    clip-path: polygon(0 0, 50% 34%, 100% 0, 100% 100%, 0 100%);
    box-shadow: 0 18px 24px -12px rgba(0, 0, 0, 0.52);
}

.env .label {
    position: absolute;
    z-index: 6;
    bottom: 14px;
    left: 16px;
    width: calc(100% - 132px);
    margin: 0;
    padding: 10px 12px;
    font: 400 14px/1.45 var(--f-type);
    word-spacing: -0.2em;
    color: var(--ink);
    background: var(--paper);
    transform: rotate(-1.5deg);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25);
}

.env .label b { display: block; font: 800 19px/1.15 var(--f-mk); word-spacing: normal; color: var(--red); }

.secret {
    position: absolute;
    z-index: 7;
    top: 292px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    margin: 0;
    padding: 8px;
    border: 3.5px solid #7E1810;
    border-radius: 50%;
    font: 700 16px/1.2 var(--f-type);
    text-align: center;
    text-transform: uppercase;
    color: #7E1810;
    box-shadow: inset 0 0 0 4px rgba(200, 155, 98, 0.9), inset 0 0 0 6px rgba(126, 24, 16, 0.75);
    transform: rotate(14deg);
}

.reveal .note { width: auto; margin: 4px 6px 0; color: var(--ink); transform: rotate(-1deg); }
.reveal .btn-ghost, .reveal .not-you { color: #FFF6E6; }
.reveal .btn-ghost { margin-top: auto; font-size: 24px; }
.reveal .not-you { margin-top: 0; padding-top: 4px; }
.reveal .btn-ghost::before { content: ''; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--i-replay) center / contain no-repeat; mask: var(--i-replay) center / contain no-repeat; }
.sheet:has(.reveal) :focus-visible { outline-color: #FFF6E6; }
.sheet:has(.reveal) .lang :focus-visible { outline-color: var(--ink); }

.burst { position: fixed; inset: 0; z-index: 60; overflow: hidden; pointer-events: none; }

/* paper-punch confetti */
.burst i {
    position: absolute;
    top: 40%;
    left: 50%;
    width: 6px;
    height: 14px;
    border-radius: 1px;
    background: var(--c);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    animation: confetti 2.2s cubic-bezier(0.15, 0.7, 0.3, 1) var(--d) both;
}

.burst i:nth-child(even) { width: 10px; height: 10px; border-radius: 50%; }

@keyframes confetti {
    0% { transform: translate(0, 0) rotate(0) scale(0.3); opacity: 1; }
    55% { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 1; }
    100% { transform: translate(var(--x), calc(var(--y) + 240px)) rotate(calc(var(--r) * 2)); opacity: 0; }
}

/* ---------- MESSAGES, loading ---------- */

.message, .loading { align-items: center; justify-content: center; gap: 14px; text-align: center; }
.message h1 { max-width: 14em; margin-top: 10px; font-size: 33px; }
.message .lead { margin: 0; max-width: 28ch; }
.message .btn { max-width: 340px; margin-top: 10px; }
.message .not-you { margin-top: 4px; }
.message .mini { width: 132px; --ph: 118px; --r: -4deg; }
.message .mini.is-no { --r: 3deg; }

/* sealed envelope: the draw is done */
.sealed { position: relative; width: 200px; height: 128px; transform: rotate(-4deg); }
.sealed i { position: absolute; display: block; }
.sealed .bk { inset: 0; border-radius: 4px; background-color: #C89B62; background-image: var(--grain), linear-gradient(to top right, transparent 49.4%, rgba(90, 60, 25, 0.28) 50%, transparent 50.6%), linear-gradient(to top left, transparent 49.4%, rgba(90, 60, 25, 0.28) 50%, transparent 50.6%); background-blend-mode: soft-light, normal, normal; box-shadow: 0 14px 20px -10px rgba(0, 0, 0, 0.5); }
.sealed .flap { inset: 0 0 auto; height: 74px; background: linear-gradient(#A47A48, #8E683B); clip-path: polygon(0 0, 100% 0, 50% 100%); filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3)); }
.sealed .seal { top: 52px; left: 50%; width: 46px; height: 46px; margin-left: -23px; border-radius: 46% 54% 50% 50%; background: radial-gradient(circle at 38% 34%, #E0574E 0 18%, #B32A23 50%, #84170F); box-shadow: 0 3px 4px rgba(0, 0, 0, 0.4), inset 0 0 0 5px rgba(120, 15, 10, 0.45); }

/* red rubber stamp with a pen-drawn "no signal" mark */
.offline {
    position: relative;
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    border: 4px solid var(--red-d);
    border-radius: 50%;
    color: var(--red-d);
    box-shadow: inset 0 0 0 5px rgba(200, 155, 98, 0.6), inset 0 0 0 7.5px var(--red-d);
    transform: rotate(-10deg);
}

.offline::before { content: ''; width: 56px; height: 56px; background: currentColor; -webkit-mask: var(--i-nowifi) center / contain no-repeat; mask: var(--i-nowifi) center / contain no-repeat; }

.spinner {
    width: 56px;
    height: 56px;
    background: var(--red);
    -webkit-mask: var(--i-ring) center / contain no-repeat;
    mask: var(--i-ring) center / contain no-repeat;
    animation: spin 1.1s linear infinite;
}

.loading p { margin: 0; font-size: 24px; }

/* ---------- toast, race ---------- */

.toast {
    position: fixed;
    z-index: 80;
    bottom: calc(env(safe-area-inset-bottom) + 18px);
    left: 16px;
    right: 16px;
    width: fit-content;
    max-width: 420px;
    margin: 0 auto;
    padding: 16px 18px 14px;
    font: 400 21px/1.3 var(--f-hand);
    color: var(--ink);
    background-color: #FDFBF4;
    background-image: var(--grain);
    background-blend-mode: soft-light;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 16px 26px -10px rgba(0, 0, 0, 0.55);
    transform: rotate(-1deg);
    pointer-events: none; /* never blocks the buttons under it */
    animation: drop 0.3s ease both;
}

.toast::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 20px;
    width: 64px;
    height: 22px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.35) 50%, transparent 0) 0 0 / 10px 10px, linear-gradient(rgba(255, 255, 255, 0.35) 50%, transparent 0) 0 0 / 10px 10px, rgba(192, 49, 43, 0.85);
    clip-path: var(--tape-cut);
    transform: rotate(-6deg);
}

@keyframes drop { from { opacity: 0; transform: translateY(16px) rotate(-1deg); } }

.race {
    position: fixed;
    inset: 0;
    z-index: 70;
    background-color: var(--cork);
    background-image: var(--cork-tex);
}

body:has(.race:not([hidden])) { overflow: hidden; }

/* ---------- admin page: plain and legible, a light kraft touch ---------- */

.admin-page {
    font: 400 16px/1.45 system-ui, -apple-system, 'Segoe UI', sans-serif;
    background-color: #E9D6B4;
    background-image: var(--grain);
    background-blend-mode: soft-light;
}

.admin {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.admin h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0 12px; font-size: 30px; line-height: 1.1; }
.admin p { color: var(--ink); }
.admin a { color: var(--red-d); text-underline-offset: 3px; }
.admin .space-badge { font-size: 14px; --r: -2deg; }
.admin .space-badge.is-main { background: linear-gradient(#2C6049, #183A2C); }
.admin .space-badge:not(.is-main) { background: linear-gradient(#C8352E, #9A231D); }

.admin .bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin: 12px 0;
}

.admin .table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(42, 31, 23, 0.25);
    border-radius: 6px;
    background: var(--paper);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 10px 18px -12px rgba(0, 0, 0, 0.4);
}

.admin table { width: 100%; border-collapse: collapse; font-size: 15px; }
.admin th, .admin td { padding: 8px 10px; text-align: left; vertical-align: middle; border-bottom: 1px solid rgba(42, 31, 23, 0.14); white-space: nowrap; }
.admin tr:last-child td { border-bottom: 0; }
.admin th { font: 700 12px/1.2 var(--f-type); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); background: rgba(200, 160, 106, 0.18); }
.admin .thumb { width: 44px; height: 44px; }
.admin .giftees { white-space: normal; font-weight: 600; color: var(--red-d); }
.admin .draw-panel { margin-top: 18px; }
.admin .draw-panel h2 { margin: 0; font-size: 22px; }

.admin select, .admin input {
    min-height: 40px;
    padding: 6px 10px;
    border: 1.5px solid rgba(42, 31, 23, 0.45);
    border-radius: 6px;
    font: inherit;
    color: var(--ink);
    background: #fff;
}

.admin select:disabled { color: var(--ink-2); background: #F1ECE2; }

.admin .btn-small {
    min-height: 40px;
    padding: 6px 14px;
    border: 1.5px solid var(--ink);
    border-radius: 8px 10px 7px 11px;
    font: 600 15px/1 system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--ink);
    background: var(--cream);
    cursor: pointer;
}

.admin .btn-small:hover:not(:disabled) { background: #fff; }
.admin .btn-small:disabled { opacity: 0.45; cursor: default; }
.admin .btn-small.danger { border-color: var(--red); color: #fff; background: var(--red); }
.admin .yes { font-weight: 700; color: var(--pine); }
.admin .login { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.admin.is-busy { pointer-events: none; opacity: 0.7; }
.admin [aria-current='page'] { font-weight: 700; color: var(--ink); text-decoration: none; }
.admin .temp-pin { padding: 12px 16px; border: 2px solid var(--gold); border-radius: 6px; background: #FFF6DC; }
.admin .temp-pin strong { font: 700 22px/1 var(--f-type); letter-spacing: 0.12em; }

/* ---------- motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition: none !important;
    }

    .ghostball { offset-distance: 42%; }
    .spinner { animation: spin 2s linear infinite !important; }
}
