:root {
  --bg: #0a0a0b;
  --panel: #151210;
  --panel-2: #1d1814;
  --gold: #e8c374;
  --gold-hi: #f7e1a8;
  --gold-lo: #9c7430;
  --green: #5fd38d;
  --line: rgba(232, 195, 116, 0.28);
  --text: #f4ead3;
  --muted: #b9ab8c;
  --danger: #ef9a8f;
  --radius: 16px;
  --script: 'Great Vibes', 'Snell Roundhand', cursive;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg) radial-gradient(ellipse 90% 50% at 50% 30%, #2a150c 0%, transparent 70%) no-repeat;
  color: var(--text);
  font: 17px/1.55 var(--sans);
}
img { max-width: 100%; display: block; }
button, input { font: inherit; }
.wrap { width: min(100% - 32px, 1080px); margin-inline: auto; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; text-align: center; padding: 28px 0 14px; }
@media (max-width: 719px) { .lead { display: none; } .when { margin-top: 12px; } .banner { margin-bottom: 14px; padding: 12px 14px; font-size: 1.05rem; } .section-title { font-size: 1.4rem; margin-bottom: 10px; } .pager { margin-bottom: 6px; } .swipe-hint { margin-bottom: 18px; } }
.eyebrow {
  font: 600 1.05rem/1.4 var(--serif);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-hi);
  text-shadow: 0 0 14px rgba(232, 195, 116, 0.5);
  margin: 0;
}
.script {
  font: 400 clamp(2.9rem, 14vw, 5.2rem)/1.05 var(--script);
  margin: 6px 0 0;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 0.1em;
}
.when { margin: 22px auto 0; font-family: var(--serif); letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-hi); }
.when .month { font-size: 1.1rem; font-weight: 600; }
.when .row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; max-width: 420px; margin: 8px auto; }
.when .row span:not(.day) { border-block: 1px solid var(--gold); padding: 4px 0; font-size: 1.05rem; font-weight: 600; }
.when .day { font-size: 3rem; line-height: 1; font-weight: 500; }
.where { margin: 10px 0 0; font: 600 1rem/1.4 var(--serif); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text); }
.where a { color: inherit; text-decoration: none; }
.lead { max-width: 30em; margin: 18px auto 0; color: var(--muted); }

.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i {
  position: absolute; top: -16px; display: block; border-radius: 1px; opacity: 0.85;
  animation: fall linear infinite;
}
@keyframes fall {
  to { transform: translateY(520px) rotate(540deg); opacity: 0; }
}
.hero > :not(.confetti) { position: relative; }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* ---------- banner ---------- */
.banner {
  margin: 8px auto 26px; padding: 16px 18px; max-width: 640px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  text-align: center;
}
.banner strong { color: var(--gold-hi); }
.banner.error { border-color: var(--danger); }
.banner .btn { margin-top: 12px; }

/* ---------- gift grid ---------- */
.section-title { font: 600 1.7rem/1.2 var(--serif); text-align: center; margin: 0 0 18px; color: var(--gold-hi); letter-spacing: 0.06em; }
/* Phones: one gift at a time, swipe right-to-left for the next. Wider screens: a grid. */
.grid {
  --cw: min(62vw, 230px);
  display: flex; gap: 12px; list-style: none; margin: 0 -16px 4px;
  padding: 4px calc((100% - var(--cw)) / 2) 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: calc((100% - var(--cw)) / 2);
  overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.grid::-webkit-scrollbar { display: none; }
.grid > .card { flex: 0 0 var(--cw); scroll-snap-align: center; scroll-snap-stop: always; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 0 0 12px; color: var(--muted); }
.pager button {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--gold); background: transparent;
  color: var(--gold-hi); font-size: 1.4rem; cursor: pointer;
}
.pager button:disabled { opacity: 0.3; cursor: default; }
.pager .count { min-width: 5.5em; text-align: center; font: 600 1.2rem/1 var(--serif); color: var(--gold-hi); letter-spacing: 0.08em; }
.swipe-hint { text-align: center; margin: 0 0 32px; font-size: 1rem; color: var(--muted); }
@media (min-width: 720px) {
  .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 0 0 36px; padding: 0; overflow: visible; }
  .pager, .swipe-hint { display: none; }
}
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.card .pic { padding: 0; border: 0; background: none; cursor: zoom-in; display: block; width: 100%; }
.card img { width: 100%; aspect-ratio: 16 / 10; max-height: 26vh; object-fit: cover; background: #120d0a; }.card .body { display: flex; flex-direction: column; gap: 8px; padding: 10px; flex: 1; }
.card h3 { margin: 0; font: 600 1.15rem/1.2 var(--serif); min-height: 2.4em; }
.card .btn { min-height: 42px; padding: 6px 14px; }
.card .status { margin-top: auto; font-size: 1.1rem; letter-spacing: 0.03em; color: var(--muted); }
.card .status.mine { color: var(--green); font-weight: 700; font-size: 1.25rem; }

/* A gift someone has already selected: dark overlay over the whole card with a big label in the middle. */
.card.taken h3 { color: var(--muted); }
.card .overlay {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: 14px;
  background: rgba(8, 7, 6, 0.8); text-align: center; pointer-events: none;
  font: 700 1.7rem/1.15 var(--serif); letter-spacing: 0.04em; color: var(--gold-hi); text-shadow: 0 2px 10px #000;
}
.card .left { font-size: 1rem; font-weight: 700; color: var(--gold-hi); }
/* The gift chosen on this guest's own link: green tinted overlay with a big tick in the middle. */
.card .overlay.mine { flex-direction: column; gap: 6px; background: rgba(5, 30, 18, 0.88); text-shadow: none; }
.overlay.mine .tick {
  display: flex; align-items: center; justify-content: center; width: 76px; height: 76px; border-radius: 50%;
  background: var(--green); color: #06210f; font: 900 3rem/1 var(--sans); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}
.overlay.mine .tick-label { font: 700 1.5rem/1.1 var(--serif); color: #b8f5d0; text-shadow: 0 2px 10px #000; }
/* The gift chosen on this guest's own link gets a green outline. */
.card.mine { border-color: var(--green); box-shadow: 0 0 0 3px var(--green), 0 0 24px rgba(95, 211, 141, 0.35); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border: 0; border-radius: 999px; cursor: pointer;
  font-weight: 700; letter-spacing: 0.02em; color: #1a1209;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 60%, #c79c4a);
  transition: transform 0.12s, filter 0.12s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--gold-hi); border: 1px solid var(--gold); }
.btn.block { width: 100%; }
:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 2px; }

/* ---------- dialogs (bottom sheet on phones) ---------- */
dialog {
  width: min(100% - 24px, 440px); padding: 0; border: 1px solid var(--gold); border-radius: 22px;
  background: var(--panel); color: var(--text); text-align: center;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.78); }
dialog .inner { padding: 20px 20px 22px; }
dialog img { border-radius: 12px; border: 1px solid var(--line); margin: 0 auto 14px; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
dialog h2 { margin: 0 0 6px; font: 600 1.6rem/1.2 var(--serif); color: var(--gold-hi); }
dialog p { margin: 0 0 16px; color: var(--muted); }
dialog .actions { display: grid; gap: 10px; }
@media (max-width: 560px) {
  dialog { margin: auto 0 0; width: 100%; max-width: none; border-radius: 22px 22px 0 0; border-bottom: 0; }
}

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding: 26px 0 46px; text-align: center; color: var(--muted); font-size: 1.05rem; }
.foot p { max-width: 38em; margin: 0 auto 10px; }
.foot a { color: var(--gold-hi); }

/* ---------- admin ---------- */
.admin-head { text-align: center; padding: 40px 0 10px; }
.admin-head .script { font-size: clamp(2.4rem, 11vw, 3.6rem); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 auto 18px; max-width: 640px; }
.panel h2 { margin: 0 0 10px; font: 600 1.4rem/1.2 var(--serif); color: var(--gold-hi); }
.field { display: grid; gap: 8px; margin-bottom: 12px; }
.field input, .linkbox {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: #0d0b0a; color: var(--text);
}
.btn-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 12px; }
.stats { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); margin-bottom: 14px; }
.stats b { color: var(--gold-hi); }
.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.links li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.links .meta { flex: 1 1 160px; font-size: 1rem; color: var(--muted); }
.links .meta b { display: block; color: var(--text); }
.chip { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.chip.used { color: #1a1209; background: var(--gold); border-color: var(--gold); }
.links .btn { min-height: 40px; padding: 6px 16px; }
.msg { min-height: 1.4em; color: var(--danger); margin: 6px 0 0; }
.msg.ok { color: var(--gold-hi); }
.hidden { display: none !important; }
[hidden] { display: none !important; }

/* ---------- guest page extras ---------- */
.pre { white-space: pre-line; }
.foot-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.countdown { margin: 10px 0 0; font: 600 1.25rem/1.3 var(--serif); letter-spacing: 0.08em; color: var(--gold-hi); }
.event-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 1rem; }
a.btn { text-decoration: none; }
.small-note { font-size: 1rem; color: var(--muted); margin: 6px 0 0; }
.banner-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }

.progress { max-width: 420px; margin: 0 auto 10px; text-align: center; }
.progress .bar { height: 10px; border-radius: 999px; background: #1d1814; border: 1px solid var(--line); overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); transition: width 0.6s ease; }
.progress .label { margin-top: 6px; font: 600 1.05rem/1.3 var(--serif); color: var(--gold-hi); letter-spacing: 0.04em; }

/* Swipe cue: pulsing arrows, plus a one-time nudge of the cards so people see they move. */
.swipe-hint {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 6px;
  font-weight: 700; font-size: 1.05rem; color: var(--gold-hi);
}
.swipe-hint .arrow { font-size: 1.8rem; line-height: 1; animation: pulse 1.4s ease-in-out infinite; }
.swipe-hint .arrow.l { animation-name: pulse-l; }
.swipe-hint .arrow.r { animation-name: pulse-r; }
@keyframes pulse-l { 50% { transform: translateX(-6px); opacity: 0.5; } }
@keyframes pulse-r { 50% { transform: translateX(6px); opacity: 0.5; } }
.grid.nudge > .card { animation: nudge 1.4s ease-in-out 0.8s 2; }
@keyframes nudge { 40% { transform: translateX(-34px); } 70% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .swipe-hint .arrow, .grid.nudge > .card { animation: none; } }
@media (min-width: 720px) { .swipe-hint { display: none; } }

.card .meta { font-size: 0.95rem; color: var(--muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pickup { max-width: 640px; margin: 8px auto 28px; padding: 14px 16px; text-align: center; border: 1px dashed var(--gold); border-radius: var(--radius); background: var(--panel); }
.pickup h3 { margin: 0 0 4px; font: 600 1.2rem/1.2 var(--serif); color: var(--gold-hi); }
.pickup p { margin: 0; color: var(--text); font-size: 1.05rem; }
.tip { color: var(--gold-hi); font-size: 1rem; }

dialog textarea {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #0d0b0a; color: var(--text); resize: vertical;
}
dialog .note-label { font-size: 1rem; color: var(--muted); text-align: left; margin-top: 6px; }
dialog { max-height: 92dvh; overflow-y: auto; }
dialog img { aspect-ratio: 16 / 10; max-height: 30vh; }

/* ---------- admin tabs, editor ---------- */
/* ---------- celebration burst (confetti falls, balloons rise) ---------- */
.celebrate {
  position: fixed; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0;
  background: transparent; overflow: hidden; pointer-events: none; z-index: 9999;
}
.celebrate .bit { position: absolute; top: -20px; display: block; border-radius: 1px; animation: bit-fall 1.7s ease-in forwards; }
@keyframes bit-fall { to { transform: translateY(105vh) rotate(720deg); opacity: 0.9; } }
.celebrate .balloon {
  position: absolute; bottom: -90px; width: 40px; height: 50px; border-radius: 50% 50% 50% 50% / 58% 58% 42% 42%;
  box-shadow: inset -6px -8px 12px rgba(0, 0, 0, 0.25), inset 6px 6px 10px rgba(255, 255, 255, 0.35);
  animation: balloon-rise 2s ease-out forwards;
}
.celebrate .balloon::after { content: ''; position: absolute; left: 50%; top: 100%; width: 1px; height: 34px; background: rgba(247, 225, 168, 0.7); }
@keyframes balloon-rise {
  0% { transform: translate(0, 0); opacity: 1; }
  50% { transform: translate(var(--sway), -55vh); }
  100% { transform: translate(calc(var(--sway) * -0.5), -125vh); opacity: 0.95; }
}
@media (prefers-reduced-motion: reduce) { .celebrate { display: none; } }

.points { margin: 0 0 14px; padding-left: 22px; }
.points li { margin-bottom: 6px; }
.points li::marker { color: var(--gold); }
.app-bar { display: flex; justify-content: flex-end; max-width: 640px; margin: 0 auto 10px; }
.tabs { display: flex; gap: 8px; max-width: 640px; margin: 0 auto 16px; }
.tabs button { flex: 1; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--gold); color: #1a1209; border-color: var(--gold); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.links .note { flex-basis: 100%; margin: 0; padding: 8px 10px; border-left: 3px solid var(--gold); background: #0d0b0a; border-radius: 6px; font-size: 1rem; }
.thumb { width: 64px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--gold); }
.field textarea { width: 100%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: #0d0b0a; color: var(--text); }
.field .hint { font-size: 0.95rem; color: var(--muted); }
.editor-preview { width: 100%; max-height: 180px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
dialog.form { text-align: left; }
dialog.form .field { margin-bottom: 10px; }
