/* Hansen No. 2 — warm paper, deep ink, gold foil. The accent turns pink or blue at the reveal. */
:root {
  --paper: #fbf5ec;
  --paper-2: #f3eadb;
  --paper-3: #eadfcb;
  --ink: #23203b;
  --ink-2: #4a4663;
  --muted: #67627c; /* 5.5:1 on paper, so 13–15px labels pass AA */
  --line: rgba(35, 32, 59, 0.12);
  --gold: #c8a15a;
  --gold-hi: #f1d9a0;
  --gold-lo: #8f6d2f;
  --boy: #6e9fd6;
  --girl: #e3869e;
  --accent: #e9a23b;
  --accent-ink: #23203b;
  --stage: #16142b;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(35, 32, 59, 0.06), 0 8px 24px rgba(35, 32, 59, 0.08);
  --shadow-lg: 0 2px 4px rgba(20, 16, 40, 0.15), 0 24px 60px rgba(20, 16, 40, 0.28);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Figtree', system-ui, sans-serif;
  color-scheme: light;
}
body[data-reveal='girl'] { --accent: var(--girl); }
body[data-reveal='boy'] { --accent: var(--boy); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 18px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.05; margin: 0; font-variation-settings: 'SOFT' 100, 'WONK' 0; letter-spacing: -0.01em; }
p { margin: 0; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }

/* Paper grain over everything light */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .14 0 0 0 0 .12 0 0 0 0 .23 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, header, footer { position: relative; z-index: 1; }

/* ---------- Top bar ---------- */
.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.mark { font-family: var(--serif); font-weight: 700; font-size: 20px; text-decoration: none; display: flex; align-items: baseline; gap: 6px; }
.mark i { font-style: italic; font-weight: 500; color: var(--accent); transition: color 0.6s; filter: brightness(0.85); }
.bar nav { display: flex; gap: 4px; }
.bar nav a {
  text-decoration: none; font-weight: 600; font-size: 15px;
  padding: 8px 12px; border-radius: 999px; color: var(--ink-2);
}
.bar nav a:hover { background: var(--paper-2); }
.bar nav a .dot { display: inline-block; min-width: 20px; height: 20px; border-radius: 10px; background: var(--ink); color: var(--paper); font-size: 12px; line-height: 20px; text-align: center; margin-left: 4px; padding: 0 5px; }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 28px; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 13px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2);
}
.eyebrow::before, .eyebrow::after { content: ''; width: 22px; height: 1px; background: currentColor; opacity: 0.5; }
.hero h1 {
  font-size: clamp(64px, 19vw, 132px);
  font-weight: 700;
  margin: 18px 0 10px;
  font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
}
.hero h1 em {
  display: block; font-style: italic; font-weight: 500; font-size: 0.62em;
  color: var(--accent); transition: color 0.8s;
  filter: saturate(1.1) brightness(0.92);
}
.hero .greet { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--ink-2); margin-bottom: 4px; }
.hero .lede { max-width: 30ch; margin: 0 auto; color: var(--ink-2); font-size: 19px; }

/* ---------- Sections ---------- */
section.block { padding: 36px 0; }
.block-head { margin-bottom: 18px; }
.block-head h2 { font-size: clamp(32px, 8vw, 44px); }
.block-head p { color: var(--ink-2); margin-top: 8px; max-width: 46ch; }
.kicker { font: 700 13px/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

.panel {
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 26px;
  border: 0; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-weight: 700; font-size: 18px; text-decoration: none;
  box-shadow: 0 2px 0 rgba(0,0,0,.15), 0 10px 24px rgba(35, 32, 59, 0.22);
  transition: transform 0.15s, box-shadow 0.15s, background 0.3s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.99); box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.gold {
  color: #3a2a0c;
  background: linear-gradient(135deg, #f6e3ad 0%, #d6ae5e 40%, #f3dc9f 60%, #b88a3b 100%);
  box-shadow: 0 2px 0 #8f6d2f, 0 10px 24px rgba(143, 109, 47, 0.35);
}
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.linkish { background: none; border: 0; padding: 8px 4px; text-decoration: underline; color: var(--ink-2); font-size: 17px; }
.linkish.light { color: rgba(255,255,255,.85); }
.opt { font-weight: 500; color: var(--muted); font-size: 14px; }

/* ---------- Guess ---------- */
.guess-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.guess-btn {
  position: relative;
  aspect-ratio: 1 / 1.05;
  border-radius: 22px; border: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--serif); font-weight: 700; font-size: clamp(30px, 8vw, 42px);
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, outline-color 0.2s;
  outline: 3px solid transparent; outline-offset: 3px;
  overflow: hidden;
}
.guess-btn small { font: 600 14px/1 var(--sans); color: var(--ink-2); }
.guess-btn.boy { background: linear-gradient(160deg, #e6effa, #c9dcf3); }
.guess-btn.girl { background: linear-gradient(160deg, #fbe9ee, #f5ccd7); }
.guess-btn:hover { transform: translateY(-3px) rotate(-0.6deg); box-shadow: var(--shadow-lg); }
.guess-btn.girl:hover { transform: translateY(-3px) rotate(0.6deg); }
.guess-btn.picked { outline-color: var(--ink); }
.guess-btn svg { width: 46px; height: 46px; opacity: 0.85; }

.tally { margin-top: 18px; }
.tally-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--paper-3); }
.tally-bar span { transition: width 0.8s cubic-bezier(.2,.8,.2,1); }
.tally-bar .b { background: var(--boy); }
.tally-bar .g { background: var(--girl); }
.tally-legend { display: flex; justify-content: space-between; font-size: 15px; color: var(--ink-2); margin-top: 8px; font-weight: 600; }

/* Guess board: who's on which team; after the reveal the winners wear a crown. */
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.team { padding: 14px; border-radius: 16px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; transition: opacity .4s; }
.team.boy { background: linear-gradient(160deg, #e6effa, #d4e3f5); }
.team.girl { background: linear-gradient(160deg, #fbe9ee, #f6d6de); }
.team.lost { opacity: .55; }
.team b { width: 100%; display: flex; align-items: center; gap: 6px; font: 700 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 4px; }
.team b svg { color: var(--gold-lo); }
.team span { font-weight: 600; font-size: 15px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.75); }
@media (max-width: 400px) { .teams { grid-template-columns: 1fr; } }

.field { display: grid; gap: 6px; margin-top: 14px; }
.field label { font-weight: 700; font-size: 15px; }
.field input, .field textarea, .field select {
  min-height: 54px; padding: 12px 16px;
  border-radius: 14px; border: 1.5px solid var(--line);
  background: #fff; font-size: 18px;
}
.field input:focus, .field textarea:focus { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--ink); }

.note-ok { display: flex; gap: 12px; align-items: center; margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: var(--paper-2); font-weight: 600; }
.note-ok svg { flex: none; }

/* ---------- Reveal (scratch card) ---------- */
.scratch {
  position: relative; margin: 0 auto;
  width: min(100%, 360px); aspect-ratio: 63 / 88;
  border-radius: 22px; overflow: hidden;
  box-shadow: var(--shadow-lg);
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.scratch .under {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px;
  background: radial-gradient(120% 90% at 50% 20%, #fff 0%, color-mix(in srgb, var(--reveal-c, var(--accent)) 35%, #fff) 60%, var(--reveal-c, var(--accent)) 140%);
}
.scratch .under .its { font: 700 15px/1 var(--sans); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2); }
.scratch .under .word { font-family: var(--serif); font-weight: 700; font-style: italic; font-size: 84px; line-height: 0.9; color: var(--ink); font-variation-settings: 'SOFT' 100, 'WONK' 1; }
.scratch canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; transition: opacity 0.6s; }
.scratch canvas.gone { opacity: 0; pointer-events: none; }
.scratch-hint { text-align: center; margin-top: 14px; color: var(--ink-2); font-weight: 600; }

/* ---------- Invite ---------- */
.invite {
  position: relative; overflow: hidden;
  background: var(--ink); color: var(--paper);
  border-radius: 24px; padding: 30px 24px;
  box-shadow: var(--shadow-lg);
}
.invite::after {
  content: ''; position: absolute; inset: 10px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent); pointer-events: none;
}
.invite .kicker { color: var(--gold-hi); }
.invite h2 { font-size: clamp(34px, 9vw, 50px); color: #fff; }
.invite h2 em { color: var(--gold-hi); font-weight: 500; white-space: nowrap; }
.invite dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 22px 0 0; }
.invite dt { font: 700 12px/1.9 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-hi); }
.invite dd { margin: 0; font-size: 18px; }
.rsvp-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.rsvp-row button {
  min-height: 56px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff;
  font-weight: 700; font-size: 16px; padding: 6px;
}
.rsvp-row button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- Give ---------- */
.amount-box {
  display: flex; align-items: center; gap: 4px;
  border: 2px solid var(--ink); border-radius: 18px; background: #fff;
  padding: 0 18px; min-height: 76px;
}
.amount-box span { font-family: var(--serif); font-size: 40px; font-weight: 600; color: var(--ink-2); }
.amount-box input {
  flex: 1; min-width: 0; width: 100%; border: 0; background: none; outline: none;
  font-family: var(--serif); font-size: 48px; font-weight: 700; padding: 6px 0;
  font-variation-settings: 'SOFT' 100;
}
.amount-box input::placeholder { color: #cfc8bb; }
.amount-box:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent); }
.presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.preset {
  position: relative;
  min-height: 74px; border-radius: 16px;
  border: 1.5px solid var(--line); background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: transform 0.12s, border-color 0.2s, background 0.2s;
}
.preset b { font-family: var(--serif); font-size: 28px; font-weight: 700; line-height: 1; }
.preset small { font-size: 14px; font-weight: 600; color: var(--muted); }
.preset:active { transform: scale(0.98); }
.preset.on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.preset.on small { color: var(--gold-hi); }
.impact {
  margin-top: 14px; padding: 14px 16px; border-radius: 14px;
  background: var(--paper-2); font-size: 16px; color: var(--ink-2); min-height: 52px;
}
.impact b { color: var(--ink); }
.pay-grid { display: grid; gap: 10px; margin-top: 16px; }
.pay {
  display: flex; align-items: center; gap: 14px; text-decoration: none;
  min-height: 64px; padding: 10px 18px; border-radius: 16px;
  border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: 18px; text-align: left;
}
.pay .logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; font: 800 18px/1 var(--sans); flex: none; }
.pay > span:last-child { min-width: 0; }
.pay .sub { display: block; font-weight: 500; font-size: 15px; color: var(--muted); }
.pay.on { border-color: var(--ink); background: var(--paper-2); box-shadow: inset 0 0 0 1.5px var(--ink); }
.pay-hint { font-size: 15px; color: var(--ink-2); margin: -4px 0 10px; }
.pay:hover { border-color: var(--ink); }
.steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.step-n { font: 700 12px/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; display: block; }
.honor { font-size: 16px; color: var(--muted); text-align: center; margin-top: 10px; }

/* ---------- Registry ---------- */
.reg-list { display: grid; gap: 12px; }
.reg {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center;
  padding: 16px 18px; border-radius: 16px; background: #fff; border: 1px solid var(--line);
}
.reg h3 { font-family: var(--sans); font-weight: 700; font-size: 18px; line-height: 1.25; }
.reg .price { font-family: var(--serif); font-weight: 700; font-size: 22px; }
.reg p { grid-column: 1 / -1; font-size: 15px; color: var(--ink-2); }
.reg .prog { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--paper-3); overflow: hidden; }
.reg .prog span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-hi)); border-radius: 4px; }
.reg .foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; color: var(--muted); }
.reg.done { background: linear-gradient(135deg, #fffaf0, #f7ecd4); border-color: color-mix(in srgb, var(--gold) 50%, transparent); }
.reg.done .price { text-decoration: line-through; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 14px; font-weight: 700; background: var(--paper-2); color: var(--ink-2); }
.pill.gold { background: linear-gradient(135deg, #f6e3ad, #d6ae5e); color: #3a2a0c; }
.reg .claim { background: #fff; border: 1.5px solid var(--ink); border-radius: 999px; font-weight: 700; color: var(--ink); font-size: 15px; padding: 8px 14px; min-height: 40px; }
.reg .claim:hover { background: var(--ink); color: var(--paper); }
/* Where your cards live: the link to open them on another phone. */
.mylink { background: var(--paper-2); border-radius: 14px; padding: 14px 16px; margin-bottom: 20px; font-size: 16px; color: var(--ink-2); }
.mylink b { color: var(--ink); }
.link-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.link-row code { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; font: 600 15px/1.4 ui-monospace, Menlo, monospace; color: var(--ink); }
.link-row .btn { min-height: 44px; padding: 0 18px; font-size: 16px; }
.gave { margin-top: 14px; }

/* ---------- Collection ---------- */
.coll-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.progress-ring { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.progress-ring b { font-family: var(--serif); font-size: 30px; }
.btn.trade { min-height: 44px; font-size: 15px; padding: 0 16px; gap: 8px; }
.pill svg { width: 16px; height: 16px; }
.coll-bar { height: 10px; border-radius: 5px; background: var(--paper-3); overflow: hidden; margin: 14px 0 20px; }
.coll-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-lo), var(--gold), var(--gold-hi)); transition: width 0.8s; }
.binder { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.slot {
  aspect-ratio: 63 / 88; border-radius: 10px;
  border: 1.5px dashed color-mix(in srgb, var(--ink) 22%, transparent);
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; color: color-mix(in srgb, var(--ink) 25%, transparent); font-size: 22px;
}
.slot.has { border: 0; padding: 0; background: none; }
.slot.has .card { --w: 100%; }
.count-badge { position: absolute; top: -6px; right: -6px; z-index: 3; background: var(--ink); color: #fff; font: 700 12px/22px var(--sans); min-width: 22px; height: 22px; border-radius: 11px; text-align: center; padding: 0 6px; }
.pack-cta {
  display: flex; align-items: center; gap: 18px; margin-bottom: 20px;
  padding: 18px; border-radius: 20px; background: var(--stage); color: #fff;
  box-shadow: var(--shadow-lg); overflow: hidden; position: relative;
}
.pack-cta .mini-pack { flex: none; width: 70px; }
.pack-cta h3 { color: #fff; font-size: 24px; }
.pack-cta p { color: rgba(255,255,255,.7); font-size: 15px; margin-top: 4px; }
.pack-cta .cta-btns { margin-left: auto; display: grid; gap: 8px; flex: none; }
.pack-cta .btn.ghost { color: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.45); min-height: 46px; font-size: 16px; }
.count-badge.new { background: linear-gradient(135deg, #f6e3ad, #d6ae5e); color: #3a2a0c; }
.summary.haul { max-height: 58vh; overflow-y: auto; overflow-x: hidden; padding: 10px 8px; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.stage .summary .card { cursor: pointer; }
@media (max-width: 520px) {
  .pack-cta { display: grid; grid-template-columns: 52px 1fr; }
  .pack-cta .mini-pack { width: 52px; }
  .pack-cta .cta-btns { grid-column: 1 / -1; margin-left: 0; }
  .pack-cta .btn { width: 100%; }
}

/* ---------- The card ---------- */
.card {
  --w: 300px;
  --mx: 50%; --my: 50%; --rx: 0deg; --ry: 0deg; --o: 0;
  position: relative;
  width: var(--w); aspect-ratio: 63 / 88;
  perspective: 900px;
  border: 0; padding: 0; background: none;
  -webkit-tap-highlight-color: transparent;
  container-type: inline-size;
}
/* Tilt (follows the finger) and flip (tap) live on separate layers, so tracking the finger never shortens the flip. */
.card .tilt {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
}
.card.tracking .tilt { transition: transform 0.08s linear; }
.card .inner {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
}
.card.flipped .inner { transform: rotateY(180deg); }
/* The holo, glare and blurred plate get their own compositing layers, which ignore backface-visibility and
   bleed through the back. Hide whichever face is turned away, switching at the flip's halfway point. */
.card .face { transition: visibility 0s 0.25s; }
.card.flipped .front, .card:not(.flipped) .back { visibility: hidden; }
.card .face {
  position: absolute; inset: 0;
  border-radius: 4.6% / 3.3%;
  overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 1px 1px rgba(0,0,0,.2), 0 10px 30px rgba(20,16,40,.35);
  background: #222;
}
.card .back { transform: rotateY(180deg); }
.card .art { position: absolute; inset: 0; }
.card .art svg, .card .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .art .photo { position: absolute; inset: 0; }
.card .art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(20,18,38,.35), transparent 22%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .14 0 0 0 0 .12 0 0 0 0 .23 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); background-size: 100% 100%, 120px 120px; }
.card .frame { position: absolute; inset: 3.2%; border-radius: 3% / 2.2%; border: 1px solid rgba(255,255,255,.45); pointer-events: none; }
.card.r-holo .frame, .card.r-gift .frame { border: 2px solid transparent; background: linear-gradient(135deg, #fff1c6, #c8a15a, #fff5d6, #9b7533) border-box; -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.card .num {
  position: absolute; top: 5.5%; left: 6.5%;
  font: 700 4.3cqw/1 var(--sans); letter-spacing: 0.1em; color: rgba(255,255,255,.92);
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.card .gem {
  position: absolute; top: 5%; right: 6%;
  width: 8%; aspect-ratio: 1; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 2px 6px rgba(0,0,0,.35);
}
.card.r-common .gem { background: #e9e3d6; }
.card.r-rare .gem { background: radial-gradient(circle at 35% 30%, #fff, #7fb2e6 45%, #2e5f9b); }
.card.r-holo .gem, .card.r-gift .gem { background: conic-gradient(from 0deg, #ff9a9e, #fad0c4, #a1c4fd, #c2e9fb, #d4fc79, #ff9a9e); }
.card .plate {
  position: absolute; left: 5%; right: 5%; bottom: 4.5%;
  padding: 6% 6% 5.5%;
  border-radius: 3.5% / 9%;
  background: linear-gradient(180deg, rgba(20,18,38,.25), rgba(20,18,38,.72));
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
}
.card .plate .t { font-family: var(--serif); font-weight: 700; font-size: 8.3cqw; line-height: 1.02; font-variation-settings: 'SOFT' 100, 'WONK' 1; }
.card .plate .s { font: 600 4cqw/1.3 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,.75); margin-top: 3%; }

/* Light that follows your finger */
.card .glare {
  position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(255,255,255,.55) 0%, rgba(255,255,255,.1) 30%, transparent 60%);
  mix-blend-mode: overlay; opacity: var(--o); transition: opacity 0.3s;
}
.card .holo {
  position: absolute; inset: 0; pointer-events: none; border-radius: inherit; opacity: 0;
}
.card.r-rare .holo {
  opacity: calc(var(--o) * 0.35);
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.7) 48%, transparent 66%);
  background-size: 250% 250%;
  background-position: var(--mx) var(--my);
  mix-blend-mode: soft-light;
}
.card.r-holo .holo, .card.r-gift .holo {
  opacity: calc(0.35 + var(--o) * 0.55);
  background:
    repeating-linear-gradient(110deg, #ff7eb3 0%, #ffd36e 7%, #7effc4 14%, #6ec3ff 21%, #c58bff 28%, #ff7eb3 35%),
    repeating-linear-gradient(20deg, rgba(0,0,0,.25) 0 2px, transparent 2px 6px);
  background-size: 300% 300%, 100% 100%;
  background-position: var(--mx) var(--my), center;
  mix-blend-mode: color-dodge;
  filter: brightness(0.75) contrast(1.4) saturate(1.1);
  -webkit-mask-image: radial-gradient(circle at var(--mx) var(--my), #000 0%, rgba(0,0,0,.55) 45%, rgba(0,0,0,.25) 100%);
  mask-image: radial-gradient(circle at var(--mx) var(--my), #000 0%, rgba(0,0,0,.55) 45%, rgba(0,0,0,.25) 100%);
}
/* Back of a card: the story */
.card .back {
  background: #fbf5ec;
  color: var(--ink);
  display: flex; flex-direction: column;
  padding: 9% 9% 8%;
}
.card .back::before {
  content: ''; position: absolute; inset: 3.2%; border-radius: 3% / 2.2%;
  border: 1px solid color-mix(in srgb, var(--gold) 70%, transparent); pointer-events: none;
}
.card .back .k { font: 700 3.6cqw/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-lo); }
.card .back .t { font-family: var(--serif); font-weight: 700; font-size: 8.5cqw; line-height: 1.02; margin: 5% 0 6%; font-variation-settings: 'SOFT' 100, 'WONK' 1; }
.card .back .story { font-size: 5cqw; line-height: 1.5; color: var(--ink-2); overflow: auto; }
.card .back .sig { margin-top: auto; padding-top: 6%; display: flex; justify-content: space-between; align-items: end; font: 600 3.6cqw/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.card .back .sig i { font-family: var(--serif); font-style: italic; text-transform: none; letter-spacing: 0; font-size: 5cqw; color: var(--ink-2); }
/* Face-down card (in the pack) */
.card .cover {
  background:
    radial-gradient(circle at 50% 50%, rgba(241,217,160,.18), transparent 60%),
    repeating-linear-gradient(45deg, rgba(241,217,160,.08) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(-45deg, rgba(241,217,160,.08) 0 1px, transparent 1px 12px),
    #1d1a36;
  display: grid; place-items: center;
}
.card .cover::before { content: ''; position: absolute; inset: 4%; border-radius: 3% / 2.2%; border: 1px solid rgba(241,217,160,.55); }
.card .cover .mono { font-family: var(--serif); font-weight: 700; font-style: italic; color: var(--gold-hi); font-size: 20cqw; font-variation-settings: 'SOFT' 100, 'WONK' 1; text-align: center; line-height: 1; }
.card .cover .mono small { display: block; font: 700 3.5cqw/1 var(--sans); font-style: normal; letter-spacing: 0.24em; text-transform: uppercase; margin-top: 10%; color: rgba(241,217,160,.75); }
.card .ribbon {
  position: absolute; top: 14%; left: -2%; z-index: 2;
  padding: 2% 6% 2% 8%; border-radius: 0 999px 999px 0;
  font: 800 3.6cqw/1.4 var(--sans); letter-spacing: 0.14em; text-transform: uppercase;
  background: linear-gradient(135deg, #f6e3ad, #d6ae5e 50%, #f3dc9f); color: #3a2a0c;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* ---------- Pack stage ---------- */
.stage {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(120% 80% at 50% 30%, #2a2650 0%, var(--stage) 60%, #0c0b19 100%);
  color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  opacity: 0; transition: opacity 0.35s;
  overflow: hidden;
}
.stage.on { opacity: 1; }
.stage .close {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 5;
  width: 48px; height: 48px; border-radius: 24px; border: 0;
  background: rgba(255,255,255,.22); color: #fff; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.6);
}
.stage .hint { margin-top: 26px; font-weight: 600; color: rgba(255,255,255,.75); text-align: center; min-height: 28px; }
.stage .hint b { color: var(--gold-hi); }
.stage .rays {
  position: absolute; left: 50%; top: 46%; width: 160vmax; height: 160vmax; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(241,217,160,.07) 0 6deg, transparent 6deg 18deg);
  animation: spin 40s linear infinite; pointer-events: none; opacity: 0; transition: opacity 0.6s;
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  mask-image: radial-gradient(circle, #000 0%, transparent 55%);
}
.stage .rays.on { opacity: 1; }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.pack {
  position: relative; width: min(64vw, 260px); aspect-ratio: 5 / 8;
  cursor: pointer; filter: drop-shadow(0 30px 40px rgba(0,0,0,.5));
  animation: bob 3.2s ease-in-out infinite;
  touch-action: none;
}
@keyframes bob { 50% { transform: translateY(-8px) rotate(0.6deg); } }
.pack .body, .pack .top {
  position: absolute; left: 0; right: 0;
  background:
    linear-gradient(115deg, transparent 20%, rgba(255,255,255,.35) 40%, transparent 55%),
    linear-gradient(160deg, #3b3570, #1b1838 55%, #2d2858);
  overflow: hidden;
}
.pack .top { top: 0; height: 16%; border-radius: 10px 10px 0 0; transition: transform 0.6s cubic-bezier(.3,.7,.2,1), opacity 0.6s; transform-origin: 10% 100%; }
.pack .top::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: radial-gradient(circle at 6px 8px, transparent 5px, #1b1838 5.5px) 0 0 / 12px 8px repeat-x; transform: translateY(4px); opacity: .9; }
.pack .body { top: 16%; bottom: 0; border-radius: 0 0 12px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 10%; }
.pack .crimp { position: absolute; left: 0; right: 0; height: 5%; background: repeating-linear-gradient(90deg, rgba(255,255,255,.12) 0 2px, transparent 2px 5px); }
.pack .crimp.b { bottom: 0; }
.pack .crimp.t { top: 0; }
.pack .series { font: 700 11px/1 var(--sans); letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold-hi); }
.pack .name { font-family: var(--serif); font-weight: 700; font-size: clamp(34px, 10vw, 46px); line-height: 0.95; margin: 12px 0; color: #fff; font-variation-settings: 'SOFT' 100, 'WONK' 1; }
.pack .name em { display: block; font-weight: 500; color: var(--gold-hi); }
.pack .count { font: 600 13px/1 var(--sans); color: rgba(255,255,255,.6); }
.pack .foilband { position: absolute; left: -10%; right: -10%; top: 58%; height: 22%; background: linear-gradient(90deg, #c8a15a, #f6e3ad, #b88a3b, #f3dc9f, #c8a15a); opacity: .18; transform: rotate(-8deg); }
.pack.torn { animation: none; }
.pack.torn .top { transform: translate(40px, -60px) rotate(28deg); opacity: 0; }
.pack.gone { transition: transform 0.6s cubic-bezier(.5,0,.8,.3), opacity 0.6s; transform: translateY(70vh) rotate(-6deg); opacity: 0; }
.tear-line { position: absolute; left: 0; top: 16%; height: 3px; background: var(--gold-hi); box-shadow: 0 0 12px var(--gold-hi); width: 0; border-radius: 2px; z-index: 3; }

.deck { position: relative; width: min(74vw, 320px); aspect-ratio: 63 / 88; }
.deck .card { position: absolute; inset: 0; --w: 100%; transition: transform 0.55s cubic-bezier(.2,.8,.2,1), opacity 0.4s; }
.deck .card.leaving { transform: translate(-120vw, -10vh) rotate(-24deg) !important; opacity: 0; }
.deck .card.entering { transform: translateY(40vh) scale(0.6); opacity: 0; }
.deck .card.reveal-glow .face.front { box-shadow: 0 0 0 2px rgba(241,217,160,.9), 0 0 60px 10px rgba(241,217,160,.45), 0 20px 40px rgba(0,0,0,.5); }
.rarity-label { font: 800 13px/1 var(--sans); letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold-hi); text-align: center; margin-bottom: 18px; min-height: 13px; transition: opacity .3s; }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; width: min(100%, 560px); }
.summary .card { --w: 100%; animation: pop .4s backwards; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
.stage h2 { color: #fff; font-size: 34px; text-align: center; margin-bottom: 18px; }
.stage .actions { display: grid; gap: 10px; width: min(100%, 360px); margin-top: 24px; }
.stage .btn.ghost { color: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.5); }

/* Zoomed single card viewer */
.viewer .card { --w: min(80vw, 360px); }
.binder .card .plate, .summary .card .plate { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(20,18,38,.72); }
.binder .card .holo, .summary .card .holo { -webkit-mask-image: none; mask-image: none; }
.viewer .hint { margin-top: 22px; }

/* ---------- Sheet (gift / claim) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 90; background: rgba(22,20,43,.5); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .25s; }
.sheet-wrap.on { opacity: 1; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; overflow-x: hidden;
  background: var(--paper); border-radius: 26px 26px 0 0; padding: 26px 20px calc(26px + env(safe-area-inset-bottom));
  transform: translateY(40px); transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.sheet-wrap.on .sheet { transform: none; }
.sheet h2 { font-size: 32px; margin-bottom: 6px; }
.sheet .sub { color: var(--ink-2); margin-bottom: 18px; }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 26px; } }

/* ---------- Toast + misc ---------- */
/* Hidden state slides the toast by its own height (it can be several lines tall with a button), and visibility
   drops out after the slide so nothing is left peeking above the bottom edge. */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, calc(100% + 48px)); visibility: hidden; z-index: 200; background: var(--ink); color: #fff; padding: 14px 20px; border-radius: 14px; font-weight: 600; box-shadow: var(--shadow-lg); transition: transform .35s cubic-bezier(.2,.8,.2,1), visibility 0s .35s; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 14px; }
.toast button { flex: none; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--gold-hi); color: #3a2a0c; font-weight: 700; font-size: 16px; }
.field textarea { resize: vertical; min-height: 72px; }
.toast.on { transform: translate(-50%, 0); visibility: visible; transition-delay: 0s, 0s; }
footer { padding: 40px 0 60px; text-align: center; color: var(--muted); font-size: 15px; }
footer .sig { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--ink-2); margin-bottom: 6px; }
.hidden { display: none !important; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; }
.demo { position: fixed; left: 10px; bottom: 10px; z-index: 400; background: #111; color: #fff; border-radius: 12px; padding: 6px; display: flex; flex-wrap: nowrap; overflow-x: auto; opacity: .85; gap: 6px; font: 600 12px/1 var(--sans); max-width: calc(100% - 20px); box-shadow: var(--shadow-lg); }
.demo button { flex: none; background: #333; border: 0; color: #fff; border-radius: 8px; padding: 7px 9px; font-size: 12px; }
.demo button.on { background: var(--accent); color: #111; }

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