:root {
  --bg: #fdf6e6;
  --ink: #3c2a22;
  --card: #fffaf1;
  --primary: #cd5602;
  --primary-ink: #fff8ee;
  --muted: #7a5f52;
  --line: #ead9c4;
  --ok: #e7f6ea;
  --err: #fde8e4;
  --shadow: 0 18px 40px rgba(60, 42, 34, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #fff8ea, var(--bg) 42%);
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 28px 16px 64px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.brand { font-family: "Pinyon Script", cursive; font-size: 2.1rem; color: inherit; text-decoration: none; }
.nav, .row, .inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nav a, .ghost, .nav button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.card {
  background: var(--card);
  border-radius: 28px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.script { margin: 0; font-family: "Pinyon Script", cursive; font-size: 1.8rem; color: var(--primary); }
h1, h2 { font-family: Fraunces, Georgia, serif; margin: 0 0 8px; }
h1 { font-size: 2.2rem; }
.muted { color: var(--muted); }
form { display: grid; gap: 12px; margin-top: 16px; }
label { display: grid; gap: 6px; font-size: 0.85rem; font-weight: 700; }
input {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: inherit;
}
.pill, a.pill {
  border: 0;
  background: var(--primary);
  color: var(--primary-ink);
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.stack { display: grid; gap: 12px; }
.flash { border-radius: 16px; padding: 12px 14px; }
.flash.ok { background: var(--ok); }
.flash.err { background: var(--err); }
.banner { background: #fff1e4; border-radius: 16px; padding: 12px 14px; font-weight: 700; }
.stamps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  max-width: 420px;
  padding: 0;
  margin: 18px 0;
}
.stamps li {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px dashed var(--line);
  color: var(--muted);
  font-weight: 700;
}
.stamps li .mark { position: relative; z-index: 1; }
.stamps li.on { background: #fff1e4; border-style: solid; border-color: var(--primary); font-size: 1.4rem; }
.stamps li.pop { z-index: 2; }
.stamps li.pop .mark { animation: stamp-slam 1.05s cubic-bezier(.16, 1.4, .3, 1); }
.stamps li.pop::before,
.stamps li.pop::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  border: 3px solid var(--primary);
  pointer-events: none;
}
.stamps li.pop::before { animation: stamp-ring .9s ease-out forwards; }
.stamps li.pop::after { animation: stamp-ring 1.15s ease-out .12s forwards; opacity: 0; }
@keyframes stamp-slam {
  0% { transform: translateY(-46px) scale(1.7) rotate(-22deg); opacity: 0; filter: blur(1px); }
  48% { transform: translateY(3px) scale(1.2) rotate(8deg); opacity: 1; filter: none; }
  68% { transform: translateY(-3px) scale(.9) rotate(-6deg); }
  84% { transform: translateY(0) scale(1.06) rotate(2deg); }
  100% { transform: none; }
}
@keyframes stamp-ring {
  0% { transform: scale(.55); opacity: .9; }
  100% { transform: scale(1.65); opacity: 0; }
}
.card.celebrate { animation: card-glow 1.2s ease; }
@keyframes card-glow {
  0%, 100% { box-shadow: var(--shadow); }
  35% { box-shadow: 0 0 0 8px rgba(205, 86, 2, .16), 0 24px 48px rgba(205, 86, 2, .22); }
}
.seal {
  position: fixed;
  z-index: 40;
  display: grid;
  place-items: center;
  font-size: 2rem;
  pointer-events: none;
  animation: seal-drop .95s cubic-bezier(.15, .85, .2, 1.15) forwards;
  filter: drop-shadow(0 12px 10px rgba(60, 42, 34, .28));
}
@keyframes seal-drop {
  0% { transform: translateY(-90px) scale(1.9) rotate(-28deg); opacity: 0; }
  58% { transform: translateY(6px) scale(1.12) rotate(8deg); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 0; }
}
.crumb {
  position: fixed;
  z-index: 39;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary);
  font-size: 12px;
  line-height: 8px;
  pointer-events: none;
  animation: crumb-fly .85s ease-out forwards;
}
@keyframes crumb-fly {
  to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; }
}
.stamp-toast {
  position: fixed;
  left: 50%;
  top: 14%;
  z-index: 41;
  margin: 0;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 800;
  pointer-events: none;
  animation: toast-in 1.7s ease forwards;
}
@keyframes toast-in {
  0% { opacity: 0; transform: translateX(-50%) translateY(16px) scale(.85); }
  14% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-18px); }
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}
.card-intro { min-width: 0; }
.card-intro .script { font-size: 1.7rem; overflow-wrap: anywhere; }
.card-intro h1 { margin: 0; font-size: clamp(1.55rem, 6vw, 2.2rem); }
.qr-open {
  display: grid;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.qr { display: grid; place-items: center; }
.qr svg { width: 92px; height: 92px; border-radius: 12px; background: white; }
.qr-zoom {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 72px 20px 24px;
  background: rgba(60, 42, 34, .72);
}
.qr-zoom[hidden] { display: none; }
.qr-close { position: absolute; top: 16px; right: 16px; margin: 0; background: white; }
.qr-stage .qr svg { width: min(78vw, 360px); height: min(78vw, 360px); border-radius: 20px; background: white; }
.actions { display: flex; gap: 8px; margin-top: 8px; }
.actions form { flex: 1; margin: 0; }
.actions button { width: 100%; }
.actions button.ghost { margin-top: 0; }
button:disabled { opacity: .45; cursor: not-allowed; }
.reader { margin-top: 12px; overflow: hidden; border-radius: 16px; }
button.ghost { margin-top: 8px; }
.people, .log { list-style: none; padding: 0; margin: 16px 0 0; }
.people a, .log li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.people a { flex-direction: column; }
.people span, .log span { color: var(--muted); font-size: 0.85rem; }
button.ghost { background: white; }
