/* Guess the Age: Karen at 60
   Palette taken from the photos: school-portrait backdrop blue, ginger,
   the red bow, gingham green, and 1970s birthday-badge yellow. */
@font-face { font-family: 'Shrikhand'; src: url('/fonts/shrikhand.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Karla'; src: url('/fonts/karla.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }

:root {
  --backdrop: #a9bfcf;
  --backdrop-light: #cddbe5;
  --backdrop-dark: #87a1b5;
  --ink: #1e2747;
  --ink-soft: #46506e;
  --print: #fbfaf6;
  --red: #d2352b;
  --red-dark: #a8251d;
  --yellow: #f6c428;
  --green: #4e7a3a;
  --ginger: #c8561e;
  --blue: #2f5aa8;
  --ok: #2f7a3e;
  --radius: 14px;
  --display: 'Shrikhand', 'Georgia', serif;
  --body: 'Karla', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--backdrop);
  background-image:
    radial-gradient(ellipse 70% 50% at 28% 18%, var(--backdrop-light) 0%, transparent 70%),
    radial-gradient(ellipse 60% 45% at 85% 92%, var(--backdrop-dark) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 10% 85%, #9bb3c5 0%, transparent 70%);
  background-attachment: fixed;
}
/* faint film grain, like an old studio backdrop */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: multiply;
  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='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .25 0 0 0 0 .35 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.1; margin: 0 0 0.4em; letter-spacing: 0.005em; }
h1 { font-size: clamp(2.1rem, 9vw, 3rem); }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
a { color: var(--blue); }

.wrap { width: 100%; max-width: 32rem; margin: 0 auto; padding: 20px 16px 40px; }
.center { text-align: center; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.9rem; }
.hidden { display: none !important; }
.stack > * + * { margin-top: 14px; }

/* ---------- buttons ---------- */
.btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 22px;
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--red);
  color: #fff;
  font: 700 1.1rem/1.1 var(--body);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
  touch-action: manipulation;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { background: #b9b4a8; color: #f4f2ec; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.secondary { background: var(--print); color: var(--ink); }
.btn.yellow { background: var(--yellow); color: var(--ink); }
.btn.green { background: var(--green); }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 0.95rem; box-shadow: 0 3px 0 var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink); text-decoration: underline; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

/* ---------- form ---------- */
label.field { display: block; font-weight: 700; }
label.field span { display: block; margin-bottom: 6px; }
input[type='text'], input[type='number'], input[type='password'], textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--print);
  color: var(--ink);
  font: 600 1.15rem var(--body);
}
input::placeholder { color: #8f95a8; font-weight: 500; }

/* ---------- the paper card ---------- */
.card {
  background: var(--print);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 5px 0 var(--ink);
}

/* ---------- photo print ---------- */
.print {
  background: var(--print);
  padding: 10px 10px 34px;
  border-radius: 3px;
  box-shadow: 0 2px 2px rgba(30, 39, 71, 0.25), 0 14px 30px -10px rgba(30, 39, 71, 0.55);
}
.print img { display: block; width: 100%; height: auto; border-radius: 1px; background: #ddd; }

/* ---------- badge ---------- */
.badge { display: block; width: 100%; height: auto; overflow: visible; }
.badge text { font-family: var(--display); }
.badge text.lbl { font-family: var(--body); }

/* ---------- emoji picker ---------- */
.emoji-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.emoji-row button {
  width: 100%; aspect-ratio: 1; max-width: 52px; justify-self: center;
  font-size: 1.5rem; padding: 0;
  border-radius: 50%;
  border: 2.5px solid transparent;
  background: rgba(251, 250, 246, 0.6);
  cursor: pointer;
  touch-action: manipulation;
}
.emoji-row button[aria-pressed='true'] { border-color: var(--ink); background: var(--yellow); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  max-width: calc(100% - 32px);
  z-index: 50;
}

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(20, 24, 40, 0.94);
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox img { max-width: none; width: 100%; height: auto; }
.lightbox .close {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  z-index: 41;
}

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