:root {
  --bg: #f6f0e4;
  --paper: #fffaf1;
  --ink: #1f2a24;
  --muted: #6b6f63;
  --line: #e2d8c4;
  --pine: #1e4d3a;
  --pine-ink: #f6f0e4;
  --berry: #b3312c;
  --gold: #c99a3b;
  --ok: #2f7a4f;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111a15;
    --paper: #18241d;
    --ink: #efe8da;
    --muted: #a4a898;
    --line: #2b3a31;
    --pine: #7fc4a0;
    --pine-ink: #10201a;
    --berry: #e0645d;
    --gold: #e1b75e;
    --ok: #7fc4a0;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Inter", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}
.wrap { max-width: 460px; margin: 0 auto; padding: 48px 16px 64px; }
.wrap.wide { max-width: 720px; }
h1, h2, .display { font-family: "Fraunces", Georgia, serif; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 40px; line-height: 1.05; margin: 0 0 8px; }
h2 { font-size: 22px; margin: 0 0 12px; }
.kicker { text-transform: uppercase; letter-spacing: 0.14em; font-size: 12px; color: var(--berry); font-weight: 600; margin: 0 0 10px; }
.lede { color: var(--muted); margin: 0 0 28px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.tabs { display: flex; gap: 4px; background: var(--line); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 10px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
label:first-child { margin-top: 0; }
.hint { font-weight: 400; color: var(--muted); }
input, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--pine); outline-offset: 1px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 18px; padding: 13px 16px; border: 0; border-radius: 10px;
  background: var(--pine); color: var(--pine-ink); font: inherit; font-weight: 600; cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--berry); color: #fff; }
.btn.small { width: auto; margin: 0; padding: 7px 12px; font-size: 14px; }
.msg { margin-top: 14px; font-size: 14px; min-height: 1em; }
.msg.err { color: var(--berry); }
.msg.ok { color: var(--ok); }
.note { font-size: 13px; color: var(--muted); margin-top: 18px; }
.hidden { display: none !important; }

/* Envelope */
.envelope { text-align: center; padding: 8px 0 4px; }
.env-shape {
  width: 220px; height: 140px; margin: 10px auto 22px; position: relative; transition: margin-top .6s ease;
  background: var(--berry); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.15);
}
.env-shape::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 80px;
  background: color-mix(in srgb, var(--berry) 80%, #000);
  clip-path: polygon(0 0, 100% 0, 50% 100%); border-radius: 8px 8px 0 0;
  transform-origin: top; transition: transform .6s ease;
}
.env-shape .seal {
  position: absolute; left: 50%; top: 62px; width: 34px; height: 34px; margin-left: -17px;
  border-radius: 50%; background: var(--gold); z-index: 1; transition: opacity .3s;
}
.envelope.open .env-shape { margin-top: 90px; }
.envelope.open .env-shape::before { transform: rotateX(180deg); }
.envelope.open .seal { opacity: 0; }
.reveal { animation: rise .6s ease both .35s; }
.reveal .giftee { font-family: "Fraunces", Georgia, serif; font-size: 44px; line-height: 1.1; margin: 4px 0 14px; color: var(--berry); }
.reveal .wish { background: var(--bg); border-radius: 10px; padding: 12px 14px; text-align: left; white-space: pre-wrap; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Admin */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
td.email { color: var(--muted); font-size: 13px; word-break: break-all; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--line); color: var(--muted); white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.stats { display: flex; gap: 12px; margin-bottom: 16px; }
.stat { flex: 1; }
.stat b { display: block; font-family: "Fraunces", Georgia, serif; font-size: 30px; }
.stat span { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row .btn { flex: 1; min-width: 160px; }
@media (max-width: 520px) { .email { display: none; } h1 { font-size: 34px; } }
