/* The unlock sheet — js/unlock-sheet.js. Ported from
   /static/unlock-takeover-preview.html (approved 2026-10-13).
   Sits above every sheet in the app (home-board 4151, wallet 4250) and below
   the reward ceremonies (10000+), which play over it when a check-in lands. */
@property --us-f { syntax: '<number>'; inherits: true; initial-value: 0; }

#us-root, #us-mapdial {
    /* Paper, not navy (2026-11-02): matches the place card and pass sheets. */
    --us-paper: #F4F1EA; --us-ink: #1a1a1a; --us-mute: #6b665c; --us-line: rgba(26, 26, 26, .12);
    --us-gold: #F2B705; --us-gold-ink: #8a6300; --us-green: #27ae60; --us-red: #e74c3c;
    --us-logo: url(static/stamps/dpad-logo.svg);
    font-family: var(--font-ui, 'Figtree', sans-serif);
}

/* Dims, doesn't black out. Tap = hide (it keeps counting). */
#us-root .us-scrim {
    position: fixed; inset: 0; z-index: 4300; background: rgba(26, 26, 26, .32);
    opacity: 0; pointer-events: none; transition: opacity .35s;
}
#us-root .us-scrim.on { opacity: 1; pointer-events: auto; }

#us-root .us-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 4301;
    min-height: 54vh; max-height: 88vh; overflow-y: auto;
    background: var(--us-paper); color: var(--us-ink);
    border-radius: 24px 24px 0 0;
    padding: 10px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    display: flex; flex-direction: column;
    transform: translateY(105%); visibility: hidden;
    transition: transform .45s cubic-bezier(.2, .9, .25, 1.05), visibility 0s linear .45s;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .22);
}
#us-root .us-sheet.on { transform: none; visibility: visible; transition: transform .45s cubic-bezier(.2, .9, .25, 1.05); }
@media (min-width: 600px) {
    #us-root .us-sheet { left: 50%; right: auto; width: 480px; margin-left: -240px; }
}
#us-root .us-grab { width: 42px; height: 5px; border-radius: 3px; background: var(--us-line); margin: 0 auto 12px; flex: 0 0 auto; }
#us-root .us-kicker { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: .2em; color: var(--us-gold-ink); }
#us-root .us-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--us-gold); animation: us-blink 1.2s infinite; }
@keyframes us-blink { 50% { opacity: .25; } }
#us-root.is-done .us-kicker { color: #1e7a45; }
#us-root.is-done .us-dot { background: var(--us-green); animation: none; }
#us-root.is-paused .us-kicker { color: var(--us-mute); }
#us-root.is-paused .us-dot { background: var(--us-mute); animation: none; }
#us-root .us-place { font-family: var(--font-display, 'Archivo Black', sans-serif); font-size: 24px; letter-spacing: .02em; margin: 6px 0 2px; line-height: 1.15; overflow-wrap: anywhere; }
#us-root .us-where { font-size: 14px; color: var(--us-mute); }

#us-root .us-mid { display: flex; align-items: center; gap: 18px; margin: 18px 0 6px; }
/* The D-PAD symbol as a mask over a conic gradient — fills clockwise from
   twelve, the miles ring's motion: a hand going round says "how long". */
#us-root .us-dial, #us-mapdial .us-dial { --d: 140px; position: relative; width: var(--d); height: var(--d); flex: 0 0 auto; transition: --us-f .9s linear; }
#us-root .us-dial i, #us-mapdial .us-dial i {
    position: absolute; inset: 0;
    background: conic-gradient(from 0deg, var(--us-gold) calc(var(--us-f) * 1turn), rgba(26, 26, 26, .12) 0);
    -webkit-mask: var(--us-logo) center / contain no-repeat; mask: var(--us-logo) center / contain no-repeat;
}
#us-root .us-halo, #us-mapdial .us-halo { position: absolute; inset: -14px; border-radius: 50%; background: radial-gradient(circle, rgba(242, 183, 5, .25), transparent 65%); animation: us-breathe 2.4s ease-in-out infinite; }
@keyframes us-breathe { 50% { transform: scale(1.07); opacity: .6; } }
#us-root .us-dial.paused i, #us-mapdial .us-dial.paused i { background: conic-gradient(from 0deg, rgba(26, 26, 26, .38) calc(var(--us-f) * 1turn), rgba(26, 26, 26, .10) 0); }
#us-root .us-dial.paused .us-halo, #us-mapdial .us-dial.paused .us-halo { animation: none; opacity: 0; }
#us-root .us-dial.done i, #us-mapdial .us-dial.done i { background: var(--us-green); }
#us-root .us-dial.done, #us-mapdial .us-dial.done { animation: us-pop .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes us-pop { 40% { transform: scale(1.12); } }
#us-root .us-clock { min-width: 0; }
#us-root .us-t { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 44px; letter-spacing: .02em; line-height: 1; }
#us-root .us-s { font-size: 14px; color: var(--us-mute); margin-top: 6px; line-height: 1.35; }
#us-root .us-s b { color: var(--us-ink); }
@media (max-width: 360px) {
    #us-root .us-sheet .us-dial { --d: 110px; }
    #us-root .us-t { font-size: 36px; }
}

#us-root .us-why { margin-top: 14px; }
#us-root .us-why h4 { margin: 0 0 8px; font-size: 11px; letter-spacing: .2em; color: #8a8270; font-weight: 800; }
#us-root .us-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: #fff; box-shadow: 0 1px 0 rgba(26, 26, 26, .06); margin-bottom: 8px; transition: background .3s; }
#us-root .us-ic { width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; font-size: 20px; background: var(--us-paper); color: var(--us-ink); overflow: hidden; }
#us-root .us-ic.us-art img { width: 100%; height: 100%; object-fit: contain; }
#us-root .dw-coin.us-coin { width: 40px; height: 40px; flex: 0 0 auto; }
#us-root .us-tx { flex: 1; min-width: 0; }
#us-root .us-tx b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#us-root .us-tx small { font-size: 12.5px; color: var(--us-mute); }
#us-root .us-st { font-size: 12px; font-weight: 800; color: var(--us-gold-ink); white-space: nowrap; }
#us-root .us-item.got { background: #e3f4ea; }
#us-root .us-item.got .us-st { color: #1e7a45; }

#us-root .us-note { font-size: 12.5px; color: var(--us-mute); margin: 6px 2px 0; min-height: 1em; }
#us-root .us-note.warn { color: #b35a00; }

#us-root .us-acts { display: flex; gap: 10px; margin-top: auto; padding-top: 16px; }
#us-root .us-btn { flex: 1; border: 0; border-radius: 100px; padding: 15px 12px; font: 800 15px var(--font-ui, 'Figtree', sans-serif); cursor: pointer; }
#us-root .us-pri { background: var(--us-ink); color: var(--us-paper); }
#us-root .us-ghost { background: transparent; color: var(--us-ink); box-shadow: inset 0 0 0 1.5px rgba(26, 26, 26, .25); }
#us-root .us-danger { background: var(--us-red); color: #fff; }
#us-root .us-confirm { display: none; margin-top: auto; padding-top: 14px; }
#us-root .us-confirm p { margin: 0 0 10px; font-size: 14px; color: var(--us-ink); }
#us-root .us-sheet.asking .us-main { display: none; }
#us-root .us-sheet.asking .us-confirm { display: block; }
#us-root .us-confirm .us-acts { padding-top: 0; }

/* Docked: hidden but still counting. Off-screen AND transparent when away,
   so no edge of it peeks under the status bar. */
#us-root .us-pill {
    position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 72px); z-index: 4302;
    transform: translate(-50%, -220px); opacity: 0; pointer-events: none;
    transition: transform .4s cubic-bezier(.2, .9, .25, 1.1), opacity .25s;
    display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 8px; border-radius: 100px;
    background: var(--us-paper); color: var(--us-ink); box-shadow: 0 8px 24px rgba(0, 0, 0, .22), inset 0 0 0 1px var(--us-line);
    cursor: pointer; max-width: calc(100vw - 32px); border: 0; font: inherit;
}
#us-root .us-pill.on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
#us-root .us-pill .us-dial { --d: 34px; }
#us-root .us-pill .us-halo { inset: -6px; }
#us-root .us-pt { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#us-root .us-pc { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--us-gold-ink); font-size: 14px; white-space: nowrap; }
#us-root .us-chev { opacity: .5; font-size: 16px; }
#us-root .us-pill.done { background: var(--us-green); color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .22); }
#us-root .us-pill.done .us-pc { color: #fff; }
#us-root .us-pill.done .us-dial i { background: #fff; }

/* ── The big D-PAD, centred (2026-11-20; /static/checkin-sheet-v3-preview.html) ──
   Layers cut from the same logo: base (faint), ring (the outer circle, filled
   clockwise by a conic sweep of --us-f), four arms that light as it passes:
   right ¼, down ½, left ¾, up last. Done = the whole symbol green + a tick. */
#us-root .us-sheet .us-kicker { justify-content: center; }
#us-root .us-sheet .us-place, #us-root .us-sheet .us-where { text-align: center; }
#us-root .us-sheet .us-mid { flex-direction: column; gap: 4px; margin: 20px 0 4px; }
#us-root .us-sheet .us-clock { text-align: center; }
#us-root .us-sheet .us-s { max-width: 290px; margin-left: auto; margin-right: auto; }
#us-root .us-dial.us-big, #us-mapdial .us-dial.us-big { --d: 220px; }
@media (max-height: 700px), (max-width: 360px) { #us-root .us-dial.us-big { --d: 170px; } }
#us-root .us-big .us-halo, #us-mapdial .us-big .us-halo { inset: -22px; }
#us-root .us-big b, #us-mapdial .us-big b {
    position: absolute; inset: 0; display: block;
    -webkit-mask-image: var(--us-logo), var(--us-cut); mask-image: var(--us-logo), var(--us-cut);
    -webkit-mask-size: contain, 100% 100%; mask-size: contain, 100% 100%;
    -webkit-mask-position: center; mask-position: center;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-composite: source-in; mask-composite: intersect;
}
#us-root .us-big .us-base, #us-mapdial .us-big .us-base { --us-cut: linear-gradient(#000, #000); background: rgba(26, 26, 26, .13); }
#us-root .us-big .us-ring, #us-mapdial .us-big .us-ring { --us-cut: radial-gradient(circle closest-side, transparent 74%, #000 74.5%);
    background: conic-gradient(var(--us-gold) calc(var(--us-f) * 1turn), transparent 0); }
#us-root .us-big .us-arm, #us-mapdial .us-big .us-arm {
    -webkit-mask-image: var(--us-logo), radial-gradient(circle closest-side, #000 74%, transparent 74.5%), var(--us-q);
    mask-image: var(--us-logo), radial-gradient(circle closest-side, #000 74%, transparent 74.5%), var(--us-q);
    -webkit-mask-size: contain, 100% 100%, 100% 100%; mask-size: contain, 100% 100%, 100% 100%;
    -webkit-mask-composite: source-in, source-in; mask-composite: intersect, intersect;
    background: var(--us-gold); opacity: 0; transform: scale(.92);
    transition: opacity .35s, transform .45s cubic-bezier(.3, 1.7, .5, 1);
}
#us-root .us-big .us-arm.on, #us-mapdial .us-big .us-arm.on { opacity: 1; transform: none; }
#us-root .us-big .up, #us-mapdial .us-big .up { --us-q: conic-gradient(from -45deg, #000 90deg, transparent 0); }
#us-root .us-big .rt, #us-mapdial .us-big .rt { --us-q: conic-gradient(from 45deg, #000 90deg, transparent 0); }
#us-root .us-big .dn, #us-mapdial .us-big .dn { --us-q: conic-gradient(from 135deg, #000 90deg, transparent 0); }
#us-root .us-big .lt, #us-mapdial .us-big .lt { --us-q: conic-gradient(from 225deg, #000 90deg, transparent 0); }
#us-root .us-big.paused .us-ring, #us-mapdial .us-big.paused .us-ring { background: conic-gradient(rgba(26, 26, 26, .38) calc(var(--us-f) * 1turn), transparent 0); }
#us-root .us-big.paused .us-arm, #us-mapdial .us-big.paused .us-arm { background: rgba(26, 26, 26, .38); }
#us-root .us-big.done .us-base, #us-mapdial .us-big.done .us-base { background: var(--us-green); }
#us-root .us-big.done .us-ring, #us-mapdial .us-big.done .us-ring, #us-root .us-big.done .us-arm, #us-mapdial .us-big.done .us-arm { display: none; }
#us-root .us-big.done .us-halo, #us-mapdial .us-big.done .us-halo { background: radial-gradient(circle, rgba(39, 174, 96, .25), transparent 65%); animation: none; }
#us-root .us-tick, #us-mapdial .us-tick { display: none; }
#us-root .us-big.done .us-tick, #us-mapdial .us-big.done .us-tick {
    display: block; position: absolute; right: -4px; bottom: 6px; width: 62px; height: 62px; border-radius: 50%;
    background: var(--us-green); color: #fff; font: 900 34px/62px var(--font-ui, 'Figtree', sans-serif); text-align: center;
    box-shadow: 0 6px 16px rgba(39, 174, 96, .4), 0 0 0 5px var(--us-paper);
    animation: us-tick .5s .25s cubic-bezier(.3, 1.7, .5, 1) both;
}
@keyframes us-tick { from { transform: scale(0); } }
#us-root.is-done .us-sheet .us-t { font: 800 22px var(--font-ui, 'Figtree', sans-serif); margin-top: 6px; }


/* ── Map + dock layout (2026-11-23, user: the check-in pop-up "the same size as the
   pop-up that comes up when I return back on the app… so I can see the map", and the
   D-PAD that fills "just on the Mapbox map… above the cursor") ──
   The sheet becomes the welcome-back card: dark, compact, above the dock, no dimming.
   The big D-PAD leaves it and floats over your blue dot (#us-mapdial, a map marker). */
body.md-on #us-root .us-scrim { display: none; }
body.md-on #us-root .us-sheet {
    left: 12px; right: 12px; max-width: 520px; margin: 0 auto; width: auto;
    bottom: calc(max(14px, env(safe-area-inset-bottom, 0px)) + 86px);
    min-height: 0; max-height: none; border-radius: 22px; padding: 14px 14px 12px;
    background: rgba(20, 26, 46, .94); color: #fff; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    transform: translateY(calc(100% + 140px));
}
body.md-on #us-root .us-sheet.on { transform: none; }
@media (min-width: 600px) { body.md-on #us-root .us-sheet { left: 12px; right: 12px; width: auto; margin: 0 auto; } }
body.md-on #us-root .us-grab, body.md-on #us-root .us-sheet .us-dial, body.md-on #us-root .us-why { display: none; }
body.md-on #us-root .us-sheet .us-kicker { justify-content: flex-start; font-size: 11px; color: #FFD93D; }
body.md-on #us-root.is-done .us-kicker { color: #7ee2a0; }
body.md-on #us-root .us-sheet .us-place { text-align: left; font-family: var(--font-ui, Figtree, sans-serif); font-weight: 800; font-size: 16px; margin: 4px 0 0; }
body.md-on #us-root .us-sheet .us-where { text-align: left; font-size: 12.5px; color: rgba(255, 255, 255, .65); }
body.md-on #us-root .us-sheet .us-mid { flex-direction: row; align-items: baseline; gap: 10px; margin: 8px 0 0; }
body.md-on #us-root .us-sheet .us-clock { text-align: left; display: flex; align-items: baseline; gap: 10px; }
body.md-on #us-root .us-t { font-size: 18px; color: #FFD93D; }
body.md-on #us-root.is-done .us-sheet .us-t { font-size: 15px; margin: 0; color: #7ee2a0; }
body.md-on #us-root .us-sheet .us-s { font-size: 12.5px; color: rgba(255, 255, 255, .75); margin: 0; max-width: none; }
body.md-on #us-root .us-s b { color: #fff; }
body.md-on #us-root .us-note { color: rgba(255, 255, 255, .6); font-size: 12px; margin-top: 4px; min-height: 0; }
body.md-on #us-root .us-note.warn { color: #ffb36b; }
body.md-on #us-root .us-acts { padding-top: 10px; gap: 8px; }
body.md-on #us-root .us-btn { padding: 9px 10px; font-size: 13.5px; }
body.md-on #us-root .us-pri { background: #FFD93D; color: #1a1a1a; }
body.md-on #us-root .us-ghost { color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .3); }
body.md-on #us-root .us-confirm p { color: #fff; font-size: 13px; }

/* the D-PAD over your blue dot */
#us-mapdial { pointer-events: none; }
#us-mapdial .us-dial.us-big { --d: 60px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .35)); }
#us-mapdial .us-big .us-base { background: rgba(255, 255, 255, .78); }
#us-mapdial .us-big .us-halo { inset: -9px; }
#us-mapdial .us-big.done .us-tick { width: 24px; height: 24px; right: -6px; bottom: -3px; font-size: 14px; line-height: 24px; box-shadow: 0 3px 8px rgba(39, 174, 96, .4), 0 0 0 3px #fff; }

/* Find-me stays reachable above the check-in card (2026-11-24); during a
   check-in it frames the check-in again (auto-checkin.js _track). */
body.md-on.us-open #dep5-locate {
    bottom: calc(max(14px, env(safe-area-inset-bottom, 0px)) + 86px + var(--us-card-h, 190px) + 12px) !important;
    transition: bottom .3s;
}
/* Swipe it away (down or sideways; unlock-sheet.js swipeable). */
body.md-on #us-root .us-sheet { touch-action: none; }

/* ── The D-PAD stands up on the card's top-right corner (2026-12-02, user: "put the check in
   dial where the red circle is"; unlock-sheet.js mapDialOn adds .dial-card instead of the map
   marker; ?dialmap=1 = the old place over your head). Same layers, sounds and fill. */
body.md-on #us-root.dial-card .us-sheet { overflow: visible; }
body.md-on #us-root.dial-card .us-sheet .us-dial.us-big {
    display: block; position: absolute; right: 14px; top: -46px; --d: 84px; z-index: 2;
    border-radius: 50%; background: #F4F1EA; box-shadow: 0 8px 20px rgba(0, 0, 0, .4), 0 0 0 4px rgba(20, 26, 46, .94);
}
body.md-on #us-root.dial-card .us-sheet .us-big b { inset: 8px; }
body.md-on #us-root.dial-card .us-sheet .us-big .us-halo { inset: -12px; }
body.md-on #us-root.dial-card .us-sheet .us-big.done .us-tick { width: 28px; height: 28px; right: -6px; bottom: -4px; font-size: 16px; line-height: 28px; box-shadow: 0 3px 8px rgba(39, 174, 96, .4), 0 0 0 3px #F4F1EA; }
body.md-on #us-root.dial-card .us-sheet :is(.us-kicker, .us-place, .us-where) { padding-right: 96px; }
body.md-on.us-open #us-root.dial-card ~ #dep5-locate, body.md-on.us-open #dep5-locate { --us-dial-up: 52px; }
body.md-on.us-open #dep5-locate {
    bottom: calc(max(14px, env(safe-area-inset-bottom, 0px)) + 86px + var(--us-card-h, 190px) + 12px + var(--us-dial-up, 0px)) !important;
}
