/* Secret Santa: deep night sky, red / forest green / gold. Mobile first. */

:root {
  --night: #0a1128;
  --night-2: #111c40;
  --ink: #fbf5e9;
  --muted: #a9b3d1;
  --line: rgba(255, 255, 255, 0.1);
  --card: rgba(19, 30, 66, 0.72);
  --card-2: rgba(255, 255, 255, 0.05);
  --red: #c8283a;
  --red-2: #e2484f;
  --red-deep: #8f1424;
  --green: #1d7a50;
  --green-2: #2fa36b;
  --gold: #f2c14e;
  --gold-2: #ffdf8a;
  --gold-deep: #c8912a;
  --radius: 20px;
  --nav-h: 66px;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--night); }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(47, 163, 107, 0.22), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(80, 110, 220, 0.18), transparent 60%),
    radial-gradient(800px 500px at 50% 115%, rgba(200, 40, 58, 0.22), transparent 60%),
    linear-gradient(180deg, var(--night) 0%, var(--night-2) 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
/* A few twinkly stars and a pine-tree skyline. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff8, transparent),
    radial-gradient(1px 1px at 28% 8%, #fff9, transparent),
    radial-gradient(1.5px 1.5px at 47% 22%, #fff6, transparent),
    radial-gradient(1px 1px at 66% 12%, #fffa, transparent),
    radial-gradient(1.5px 1.5px at 83% 26%, #fff7, transparent),
    radial-gradient(1px 1px at 92% 6%, #fff9, transparent),
    radial-gradient(1px 1px at 6% 40%, #fff5, transparent),
    radial-gradient(1px 1px at 74% 44%, #fff5, transparent);
}
body::after {
  content: '';
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 120px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 120' preserveAspectRatio='none'%3E%3Cpath fill='%23060b1c' d='M0 120V86l14-22 10 16 14-38 16 30 10-18 16 28 14-40 18 34 10-16 14 24 16-44 16 34 12-20 14 26 16-36 14 30 12-14 14 22 18-42 16 36 12-18 14 26 14-30 16 28 10-12 16 20L400 74V120Z'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
}
#snow { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }

a { color: var(--gold-2); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.4em; }
h1 { font-family: var(--display); font-weight: 800; font-size: 1.8rem; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; margin-top: 1.4em; color: var(--gold-2); }
p { margin: 0 0 0.8em; }
.display { font-family: var(--display); font-weight: 800; font-size: clamp(2.4rem, 11vw, 3.4rem); letter-spacing: -0.02em; line-height: 1.02; }
.display.sm { font-size: clamp(1.9rem, 8.5vw, 2.6rem); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.75rem; font-weight: 600; color: var(--gold); margin-bottom: 0.4em; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; word-break: break-all; background: #0006; padding: 10px 12px; border-radius: 12px; }
.opt { font-weight: 400; color: var(--muted); font-size: 0.8em; }
.big-emoji { font-size: 3rem; line-height: 1; margin-bottom: 8px; }

/* ---------------------------------------------------------------- layout */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: linear-gradient(180deg, rgba(10, 17, 40, 0.95), rgba(10, 17, 40, 0.7));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 800; font-size: 1.2rem; }
.top-me { text-decoration: none; }
.top-me .avatar { width: 36px; height: 36px; font-size: 0.85rem; }

main {
  position: relative; z-index: 2;
  max-width: 560px; margin: 0 auto;
  padding: 18px 16px 40px;
  outline: none;
  overflow-x: clip;
}
body.has-nav main { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px); }
main.enter > * { animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
main.enter > *:nth-child(2) { animation-delay: 0.05s; }
main.enter > *:nth-child(3) { animation-delay: 0.1s; }
main.enter > *:nth-child(4) { animation-delay: 0.15s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(8, 14, 34, 0.88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.bottomnav:empty { display: none; }
.bottomnav a {
  flex: 1; max-width: 140px; height: var(--nav-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 0.75rem; font-weight: 600;
  position: relative;
}
.bottomnav svg { width: 26px; height: 26px; }
.bottomnav a.active { color: var(--gold); }
.bottomnav a.active::before {
  content: ''; position: absolute; top: 0; width: 36px; height: 3px; border-radius: 0 0 4px 4px;
  background: var(--gold); box-shadow: 0 0 12px var(--gold);
}

.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  color: inherit;
  text-decoration: none;
}
.card h2:last-child, .card p:last-child { margin-bottom: 0; }
.list { display: grid; gap: 12px; margin-bottom: 16px; }
.list .card { margin: 0; }
.stack { display: grid; gap: 12px; }
.page-title { margin: 4px 0 12px; }
.section-title { font-family: var(--display); font-size: 1.4rem; margin: 22px 0 12px; }
.footer-note { margin-top: 24px; }

/* ---------------------------------------------------------------- buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px;
  border-radius: 16px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--ink);
  font: 600 1rem var(--body); text-decoration: none; cursor: pointer;
  transition: transform 0.12s, filter 0.15s, background 0.15s;
  -webkit-user-select: none; user-select: none;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.big { min-height: 58px; font-size: 1.08rem; border-radius: 18px; }
.btn.block { display: flex; width: 100%; margin-bottom: 12px; }
.btn.gold {
  color: #2a1a00; border: 0;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 6px 20px rgba(242, 193, 78, 0.28), inset 0 1px 0 #fff8;
}
.btn.red { border: 0; background: linear-gradient(180deg, var(--red-2), var(--red) 60%, var(--red-deep)); box-shadow: 0 6px 20px rgba(200, 40, 58, 0.35), inset 0 1px 0 #fff4; }
.btn.green { border: 0; background: linear-gradient(180deg, var(--green-2), var(--green)); box-shadow: 0 6px 18px rgba(29, 122, 80, 0.35); }
.btn.wa { border: 0; background: #1fa855; color: #fff; }
.btn.ghost { background: rgba(255, 255, 255, 0.06); }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn.grow, .grow { flex: 1; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.danger-text { color: #ff8a8a !important; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; font: inherit; cursor: pointer; padding: 10px 0; min-height: 44px; }
.link-btn.danger { color: #ff8a8a; }
.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05); color: var(--ink); cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 0.95rem; }
input, select {
  width: 100%; min-height: 52px;
  padding: 12px 14px;
  font: 500 1.05rem var(--body); /* >=16px so iOS doesn't zoom */
  color: var(--ink);
  background: rgba(3, 8, 24, 0.55);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: #8a93b4; }
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(242, 193, 78, 0.18); }
input[type=date] { -webkit-appearance: none; appearance: none; }
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(1); }
select { -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 34px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 0.88rem; color: var(--muted); margin: -4px 0 0; }
.form-error { color: #ff9b9b; font-weight: 600; margin: 0; min-height: 0; }
.form-error:empty { display: none; }
.notice { background: rgba(242, 193, 78, 0.12); border: 1px solid rgba(242, 193, 78, 0.35); padding: 12px 14px; border-radius: 14px; color: var(--gold-2); }
.cap-msg { background: rgba(226, 72, 79, 0.15); border: 1px solid rgba(226, 72, 79, 0.45); padding: 12px 14px; border-radius: 14px; color: #ffb3b3; font-weight: 600; margin: 0; }
.pw { position: relative; display: block; }
.pw input { padding-right: 54px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.pw-toggle svg { width: 22px; height: 22px; }
.pw-toggle.on { color: var(--gold); }
.paste-row { display: flex; gap: 8px; }
.paste-row .icon-btn { height: 52px; width: 52px; }
details.more { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; }
details.more summary { cursor: pointer; color: var(--gold-2); font-weight: 600; min-height: 40px; display: flex; align-items: center; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: '▾'; margin-left: 8px; transition: transform 0.2s; }
details.more[open] summary::after { transform: rotate(180deg); }
details.more > *:not(summary) { margin-top: 12px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: rgba(0, 0, 0, 0.3); border-radius: 14px; padding: 4px; margin-bottom: 16px; }
.seg button { min-height: 44px; border: 0; border-radius: 11px; background: none; color: var(--muted); font: 600 0.95rem var(--body); cursor: pointer; }
.seg button.on { background: rgba(255, 255, 255, 0.12); color: var(--ink); }
.code-form { display: flex; gap: 10px; }
.code-form input { text-transform: uppercase; letter-spacing: 0.2em; font-weight: 700; text-align: center; }
.code-form input::placeholder { letter-spacing: 0.05em; font-weight: 500; text-transform: none; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 14px 0; font-size: 0.9rem; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------------------------------------------------------------- bits */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.chip svg { width: 16px; height: 16px; }
.chip.gold { background: rgba(242, 193, 78, 0.16); color: var(--gold-2); }
.chip.green { background: rgba(47, 163, 107, 0.18); color: #7fe0ae; }
.chip.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(242, 193, 78, 0.08), 0 0 18px rgba(242, 193, 78, 0.35); } }
.badge { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: rgba(242, 193, 78, 0.16); color: var(--gold); vertical-align: middle; }
.badge svg { width: 17px; height: 17px; }
.badge.sm { width: 22px; height: 22px; border-radius: 7px; margin-left: 4px; }
.badge.sm svg { width: 14px; height: 14px; }
.count { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); font-size: 0.9rem; margin-left: 6px; vertical-align: 2px; }
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 42px; height: 42px; border-radius: 50%;
  font-weight: 700; font-size: 0.95rem; color: #fff;
  background: #c0392b; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(255, 255, 255, 0.12);
}
.avatar[data-c="1"] { background: #1e7a52; } .avatar[data-c="2"] { background: #b8860b; }
.avatar[data-c="3"] { background: #7d3c98; } .avatar[data-c="4"] { background: #2e6da4; }
.avatar[data-c="5"] { background: #c0587e; } .avatar[data-c="6"] { background: #d35400; }
.avatar[data-c="7"] { background: #16a085; }

.toast {
  position: fixed; left: 50%; z-index: 80;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  max-width: min(92vw, 440px); width: max-content;
  padding: 14px 18px; border-radius: 16px;
  background: #1b2752; border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  font-weight: 600; text-align: center;
  transition: transform 0.25s, opacity 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { border-color: rgba(47, 163, 107, 0.6); }
.toast.bad { border-color: rgba(226, 72, 79, 0.7); background: #3a1424; }

dialog.modal {
  width: min(92vw, 440px); padding: 22px;
  border: 1px solid var(--line); border-radius: 24px;
  background: #121d44; color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
dialog.modal::backdrop { background: rgba(3, 6, 18, 0.7); backdrop-filter: blur(3px); }
dialog.modal.danger { border-color: rgba(226, 72, 79, 0.7); box-shadow: 0 0 0 4px rgba(226, 72, 79, 0.2), 0 30px 80px rgba(0, 0, 0, 0.6); }
dialog.modal.danger h2 { color: #ffb3b3; }
dialog.modal[open] { animation: pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes pop { from { opacity: 0; transform: scale(0.94); } }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
dialog.sheet { margin-bottom: max(16px, env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.sheet-head h2 { margin: 0; }

.noscript { position: relative; z-index: 3; text-align: center; padding: 40px; }
.boot { text-align: center; padding-top: 18vh; color: var(--muted); }
.boot-present { width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 12px; background: linear-gradient(90deg, transparent 42%, var(--gold) 42% 58%, transparent 58%), linear-gradient(var(--red-2), var(--red-deep)); animation: bob 1.4s ease-in-out infinite; }

/* ---------------------------------------------------------------- welcome / home */
.hero { text-align: center; padding: 10px 0 24px; }
.hero-present { display: flex; justify-content: center; margin: 4px 0 8px; }
.hero-present .present { font-size: 132px; animation: bob 3.2s ease-in-out infinite; }
.lead { font-size: 1.15rem; color: #d7dcf0; max-width: 30ch; margin: 0 auto 22px; }
.event-card { transition: transform 0.15s, border-color 0.15s; }
.event-card:active { transform: scale(0.985); }
.event-card:hover { border-color: rgba(242, 193, 78, 0.4); }
.event-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.event-card h2 { font-family: var(--display); font-size: 1.35rem; margin-bottom: 4px; }
.event-card .muted { margin-bottom: 10px; }
.empty { padding: 30px 20px; }
.install { position: relative; border-color: rgba(242, 193, 78, 0.35); background: linear-gradient(135deg, rgba(242, 193, 78, 0.14), rgba(19, 30, 66, 0.8)); padding-right: 56px; }
.install .close { position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; font-size: 0.9rem; }
.ios-share { display: inline-grid; place-items: center; width: 26px; height: 26px; vertical-align: -6px; color: #4ea1ff; }
.ios-share svg { width: 22px; height: 22px; }

/* ---------------------------------------------------------------- event */
.event-hero { text-align: center; padding: 8px 0 18px; }
.event-hero .facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.event-hero .facts span { background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); padding: 6px 12px; border-radius: 99px; font-size: 0.9rem; color: var(--muted); }
.event-hero .facts b { color: var(--ink); }
.event-hero .facts .sleeps { color: var(--gold-2); border-color: rgba(242, 193, 78, 0.35); background: rgba(242, 193, 78, 0.1); font-weight: 600; }
.cta-card {
  display: flex; align-items: center; gap: 16px;
  padding: 18px; margin-bottom: 16px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(29, 122, 80, 0.35), rgba(19, 30, 66, 0.85));
  border: 1px solid rgba(47, 163, 107, 0.4);
  color: var(--ink); text-decoration: none;
}
.cta-card h2 { font-family: var(--display); font-size: 1.3rem; margin-bottom: 4px; }
.cta-card p { margin-bottom: 10px; }
.cta-card p:last-child { margin-bottom: 0; }
.cta-card.glow {
  background: linear-gradient(135deg, rgba(200, 40, 58, 0.55), rgba(143, 20, 36, 0.6));
  border-color: rgba(242, 193, 78, 0.55);
  animation: ctaGlow 2.2s ease-in-out infinite;
}
@keyframes ctaGlow { 50% { box-shadow: 0 0 0 4px rgba(242, 193, 78, 0.12), 0 0 40px rgba(242, 193, 78, 0.35); } }
.mini-present { flex: none; }
.mini-present .present { font-size: 74px; }
.mini-present.wiggle .present { animation: wiggle 2.4s ease-in-out infinite; }
.members { list-style: none; margin: 8px 0 0; padding: 0; }
.member { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-height: 60px; }
.member:last-child { border-bottom: 0; }
.member-name { flex: 1; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.member-name .you { color: var(--muted); font-weight: 400; }
.member-items { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.member-items.has { color: #7fe0ae; }
.organiser { border-color: rgba(242, 193, 78, 0.3); }
.organiser h2 { display: flex; align-items: center; gap: 10px; }
.invite-box { text-align: center; background: rgba(0, 0, 0, 0.25); border-radius: 16px; padding: 16px; }
.code-display { font-family: var(--display); font-size: 2.4rem; font-weight: 800; letter-spacing: 0.18em; color: var(--gold); text-shadow: 0 0 24px rgba(242, 193, 78, 0.4); }
.invite-box .btn-row { justify-content: center; }
.invite-box .btn-row .btn { flex: 1 1 auto; }
.pairs { list-style: none; padding: 0; margin: 0 0 10px; }
.pairs li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-weight: 600; }
.amp { color: var(--gold); font-family: var(--display); font-style: italic; padding: 0 4px; }
.pair-form { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.pair-form .btn { grid-column: 1 / -1; }
.drawn-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.drawn-status p { margin: 0; }
.invite .facts { list-style: none; display: flex; justify-content: center; gap: 10px; padding: 0; margin: 16px 0; }
.invite .facts li { flex: 1; background: rgba(0, 0, 0, 0.25); border-radius: 14px; padding: 10px 6px; display: grid; }
.invite .facts b { font-size: 1.2rem; color: var(--gold-2); }
.invite .facts span { font-size: 0.8rem; color: var(--muted); }
.invite { text-align: center; }
.me-card .avatar { width: 72px; height: 72px; font-size: 1.6rem; margin-bottom: 10px; }

/* ---------------------------------------------------------------- present (pure CSS, sized by font-size) */
.present { position: relative; width: 1em; height: 1em; }
.p-box {
  position: absolute; left: 0.08em; right: 0.08em; bottom: 0; height: 0.6em;
  border-radius: 0.05em 0.05em 0.07em 0.07em;
  background:
    linear-gradient(90deg, transparent 42%, var(--gold) 42%, var(--gold-2) 50%, var(--gold) 50%, var(--gold-deep) 58%, transparent 58%),
    linear-gradient(180deg, #a51d2a 0%, var(--red-2) 12%, var(--red) 60%, var(--red-deep) 100%);
  box-shadow: inset 0 -0.05em 0.08em rgba(0, 0, 0, 0.35), 0 0.06em 0.12em rgba(0, 0, 0, 0.4);
}
.p-box::after { /* subtle pattern */
  content: ''; position: absolute; inset: 0; border-radius: inherit; opacity: 0.18;
  background-image: radial-gradient(circle at 25% 30%, #fff 0.012em, transparent 0.018em), radial-gradient(circle at 75% 70%, #fff 0.012em, transparent 0.018em);
  background-size: 0.16em 0.16em;
}
.p-lid {
  position: absolute; left: 0; right: 0; bottom: 0.57em; height: 0.17em; z-index: 2;
  border-radius: 0.05em;
  background:
    linear-gradient(90deg, transparent 41%, var(--gold) 41%, var(--gold-2) 50%, var(--gold) 50%, var(--gold-deep) 59%, transparent 59%),
    linear-gradient(180deg, var(--red-2), var(--red) 70%, var(--red-deep));
  box-shadow: 0 0.03em 0.05em rgba(0, 0, 0, 0.35);
  transform-origin: 20% 100%;
}
.p-bow { position: absolute; left: 50%; bottom: 100%; width: 0; height: 0; }
.p-bow i {
  position: absolute; bottom: -0.02em; width: 0.24em; height: 0.15em;
  border: 0.045em solid var(--gold); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: rgba(200, 145, 42, 0.25);
}
.p-bow i:first-child { right: 0; transform: rotate(-28deg); transform-origin: 100% 100%; }
.p-bow i:last-child { left: 0; transform: rotate(28deg); transform-origin: 0 100%; }
.p-bow::after { content: ''; position: absolute; left: -0.045em; bottom: -0.04em; width: 0.09em; height: 0.08em; border-radius: 0.03em; background: var(--gold-2); box-shadow: 0 0 0.02em rgba(0, 0, 0, 0.3); }

@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes wiggle { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-8deg); } 80% { transform: rotate(7deg); } 85% { transform: rotate(-5deg); } 90% { transform: rotate(3deg); } }

/* ---------------------------------------------------------------- reveal (the showpiece) */
.reveal { text-align: center; padding-top: 6px; }
.reveal-title { transition: opacity 0.4s, transform 0.4s; }
.gone { opacity: 0 !important; transform: translateY(-8px); pointer-events: none; }
.stage { position: relative; height: 340px; display: grid; place-items: center; margin: 10px 0 0; }
.stage-present {
  position: relative; z-index: 3;
  border: 0; background: none; padding: 20px; margin: 0; cursor: pointer;
  color: inherit;
  filter: drop-shadow(0 0 30px rgba(242, 193, 78, 0.35));
  -webkit-tap-highlight-color: transparent;
}
.stage-present .present { font-size: 190px; }
.waiting-big .stage-present { cursor: default; margin-bottom: 10px; }
.waiting-big .stage-present .present { font-size: 120px; }
.stage-present.idle .present { animation: bob 2.6s ease-in-out infinite; }
.stage-present.idle:hover .present, .stage-present.idle:focus-visible .present { animation: wiggle 1.2s ease-in-out infinite; }
.stage-present:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; border-radius: 24px; }
.stage-present.shaking .present { animation: shake 1.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes shake {
  0% { transform: none; }
  10%, 30% { transform: rotate(-4deg) translateX(-3px); }
  20%, 40% { transform: rotate(4deg) translateX(3px); }
  50%, 70%, 90% { transform: rotate(-8deg) translate(-6px, -4px) scale(1.04); }
  60%, 80% { transform: rotate(8deg) translate(6px, -4px) scale(1.06); }
  100% { transform: scale(1.08) translateY(-6px); }
}
.stage-present.opening .present { transform: scale(1.08) translateY(-6px); }
.stage-present.opening .p-lid { animation: lidOff 0.9s cubic-bezier(0.3, 0.8, 0.4, 1) forwards; }
.stage-present.opening .p-box { animation: boxSink 1.1s 0.25s ease-in forwards; }
@keyframes lidOff {
  0% { transform: none; }
  25% { transform: translateY(-0.12em) rotate(-6deg); }
  100% { transform: translate(-0.55em, -1.15em) rotate(-70deg); opacity: 0; }
}
@keyframes boxSink { to { transform: translateY(0.35em) scale(0.85); opacity: 0; } }

.rays {
  position: absolute; z-index: 1; width: 560px; height: 560px; left: 50%; top: 50%;
  margin: -280px 0 0 -280px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(242, 193, 78, 0.28) 0deg 7deg, transparent 7deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 10%, transparent 62%);
  mask: radial-gradient(circle, #000 10%, transparent 62%);
  opacity: 0; transform: scale(0.3);
  transition: opacity 0.8s 0.2s, transform 1.2s 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}
.stage.open .rays { opacity: 1; transform: scale(1); animation: raysSpin 26s linear infinite; }
@keyframes raysSpin { from { rotate: 0deg; } to { rotate: 360deg; } }
.stage::before { /* warm glow behind */
  content: ''; position: absolute; z-index: 0; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 193, 78, 0.35), transparent 65%);
  opacity: 0.5; transition: opacity 0.6s, transform 0.6s;
}
.stage.open::before { opacity: 1; transform: scale(1.4); }

.reveal-card {
  position: absolute; z-index: 4; left: 50%; top: 50%;
  width: min(88vw, 400px);
  transform: translate(-50%, -30%) scale(0.85); opacity: 0;
  padding: 26px 18px 30px; border-radius: 26px;
  background: linear-gradient(180deg, #fffaf0, #f6ead0);
  color: #2b1608;
  box-shadow: 0 0 0 6px rgba(242, 193, 78, 0.5), 0 30px 70px rgba(0, 0, 0, 0.55), 0 0 90px rgba(242, 193, 78, 0.45);
  transition: transform 0.7s cubic-bezier(0.2, 1.3, 0.3, 1), opacity 0.4s;
  pointer-events: none;
}
.reveal-card::before { /* stitched gold border */
  content: ''; position: absolute; inset: 9px; border-radius: 19px; border: 1.5px dashed rgba(200, 145, 42, 0.6); pointer-events: none;
}
.reveal-card .eyebrow { color: var(--red); font-size: 0.85rem; }
.reveal-card.shown { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }
.reveal-name {
  font-family: var(--display); font-weight: 800; font-size: clamp(2.2rem, 11vw, 3.2rem); line-height: 1.05;
  margin: 4px 0 0; color: var(--red-deep); overflow-wrap: anywhere;
}
.reveal-name span { display: inline-block; opacity: 0; transform: translateY(0.5em) scale(0.6) rotate(-8deg); }
.reveal-card.shown .reveal-name span { animation: letterIn 0.55s calc(0.25s + var(--i) * 0.06s) cubic-bezier(0.2, 1.4, 0.4, 1) forwards; }
@keyframes letterIn { to { opacity: 1; transform: none; } }
.tap-hint { margin-top: 4px; font-weight: 600; transition: opacity 0.3s; }
.rise { animation: rise 0.5s 0.3s both; margin-top: 18px; }
#afterReveal { min-height: 80px; }

.match-hero { text-align: center; padding: 8px 0 4px; }
.match-hero .display {
  background: linear-gradient(180deg, #fff, var(--gold-2) 70%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 20px rgba(242, 193, 78, 0.3));
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- wishlist items */
.item { padding: 14px; }
.item-main { display: flex; gap: 14px; }
.item-img { flex: none; width: 88px; height: 88px; border-radius: 14px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.item-img img { width: 100%; height: 100%; object-fit: contain; }
.item-img .no-img { font-size: 2.4rem; }
.item-img:has(.no-img) { background: rgba(255, 255, 255, 0.07); }
.item-text { min-width: 0; flex: 1; }
.item-text h3 { color: var(--ink); margin: 0 0 4px; font-size: 1rem; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-family: var(--display); font-weight: 800; font-size: 1.3rem; color: var(--gold); margin: 0; }
.note { font-size: 0.9rem; color: var(--muted); margin: 4px 0 0; font-style: italic; }
.item-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.item-actions .btn { min-height: 48px; padding: 0 14px; }
.item-actions .btn.grow { min-width: 0; }
.got-btn { border-color: rgba(255, 255, 255, 0.2); }
.got-btn.on { background: var(--green); border-color: var(--green-2); }
.item.got { opacity: 0.72; }
.item.got h3 { text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.4); }
.preview-img { background: #fff; border-radius: 16px; height: 180px; display: grid; place-items: center; overflow: hidden; }
.preview-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.adder h2 { font-family: var(--display); }

/* ---------------------------------------------------------------- bigger screens */
@media (min-width: 700px) {
  main { padding-top: 32px; }
  .stage { height: 380px; }
}

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal-card.shown .reveal-name span { animation-delay: 0s !important; }
  .stage.open .rays { animation: none; }
}
