/* Layout: one centered column of "gift tags" over a snowy night/day field. */
:root {
  --bg: #eef4f1;
  --bg-2: #dfeae4;
  --paper: #ffffff;
  --ink: #15302a;
  --muted: #586e66;
  --line: #cfdcd5;
  --pine: #1d5b44;
  --pine-ink: #ffffff;
  --berry: #c3203a;
  --berry-soft: #fbe3e6;
  --gold: #c99212;
  --gold-soft: #fbf0d3;
  --snow: rgba(29, 91, 68, .18);
  --shadow: 0 1px 0 rgba(21,48,42,.06), 0 10px 30px -12px rgba(21,48,42,.28);
  --font-display: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --font-body: "Nunito", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1b19; --bg-2: #10241f; --paper: #142a25; --ink: #eef5f1; --muted: #9fb6ad;
    --line: #27443d; --pine: #5fbf91; --pine-ink: #08201a; --berry: #ff6b7f; --berry-soft: #3a1820;
    --gold: #f2c552; --gold-soft: #33290f; --snow: rgba(255,255,255,.55);
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 14px 34px -14px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.toplinks { display: flex; gap: 16px; align-items: center; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, var(--bg-2), var(--bg)) fixed, var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font-body);
  min-height: 100vh;
}
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.wrap {
  position: relative; z-index: 1;
  max-width: 640px; margin: 0 auto;
  padding-block: 28px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; gap: 20px;
}
.wrap.wide { max-width: 860px; }

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 400; letter-spacing: .01em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2rem, 7vw, 2.9rem); line-height: 1.05; }
h2 { font-size: 1.45rem; line-height: 1.15; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; color: var(--berry); }

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.15rem; color: var(--pine); }
.brand svg { width: 30px; height: 30px; flex: none; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Gift tag card */
.tag {
  position: relative; background: var(--paper); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 26px 22px 22px; display: grid; gap: 14px;
  border: 1px solid var(--line);
}
.tag.hole::before {
  content: ""; position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line);
}
.tag.hole { padding-top: 40px; }
.section { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }

/* Controls */
label { font-weight: 700; font-size: .92rem; display: grid; gap: 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=url], select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 2px solid var(--line);
  border-radius: 12px; padding: 10px 12px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pine); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; min-width: 0; }
.row > .shrink { flex: 0 0 auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--pine); }

.btn {
  font: 800 1rem/1 var(--font-body); border: 0; border-radius: 999px; padding: 13px 20px;
  background: var(--pine); color: var(--pine-ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s ease, filter .12s ease; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.berry { background: var(--berry); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.btn.small { padding: 8px 13px; font-size: .88rem; }
.btn.big { font-size: 1.2rem; padding: 18px 26px; font-family: var(--font-display); font-weight: 400; letter-spacing: .02em; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--pine); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn.danger { color: var(--berry); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-weight: 800; font-size: .85rem; background: var(--gold-soft); color: var(--ink); white-space: nowrap; }
.pill.green { background: color-mix(in srgb, var(--pine) 16%, transparent); }
.pill.red { background: var(--berry-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.msg { padding: 10px 14px; border-radius: 12px; font-weight: 700; font-size: .95rem; }
.msg.err { background: var(--berry-soft); color: var(--ink); border-left: 4px solid var(--berry); }
.msg.ok { background: color-mix(in srgb, var(--pine) 14%, transparent); border-left: 4px solid var(--pine); }
.msg.warn { background: var(--gold-soft); border-left: 4px solid var(--gold); }

/* PIN entry */
.pin-input { font-family: var(--font-mono) !important; font-size: 1.5rem !important; letter-spacing: .12em; text-align: center; text-transform: uppercase; padding: 14px !important; }

/* Gift box reveal */
.giftstage { display: grid; justify-items: center; gap: 18px; padding: 8px 0 4px; text-align: center; }
.box { position: relative; width: 190px; height: 170px; cursor: pointer; border: 0; background: none; padding: 0; }
.box .base { position: absolute; bottom: 0; left: 10px; right: 10px; height: 120px; background: var(--berry); border-radius: 10px; box-shadow: inset 0 -10px 0 rgba(0,0,0,.12); }
.box .lid { position: absolute; top: 28px; left: 0; right: 0; height: 40px; background: var(--berry); border-radius: 10px; box-shadow: inset 0 -6px 0 rgba(0,0,0,.14); transition: transform .7s cubic-bezier(.3,1.6,.5,1); transform-origin: 15% 100%; z-index: 2; }
.box .rib-v { position: absolute; left: 50%; transform: translateX(-50%); width: 26px; top: 0; bottom: 0; background: var(--gold); }
.box .bow { position: absolute; top: -26px; left: 50%; width: 80px; height: 34px; transform: translateX(-50%); }
.box .bow::before, .box .bow::after { content: ""; position: absolute; top: 4px; width: 36px; height: 28px; border: 8px solid var(--gold); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.box .bow::before { left: 0; transform: rotate(-18deg); }
.box .bow::after { right: 0; transform: rotate(18deg); }
.box:hover .lid { transform: translateY(-4px) rotate(-3deg); }
.box.open .lid { transform: translate(-30px, -60px) rotate(-28deg); }
.box.wiggle { animation: wiggle 1.8s ease-in-out infinite; }
@keyframes wiggle { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-5deg); } 82% { transform: rotate(5deg); } 89% { transform: rotate(-3deg); } }

.reveal { display: grid; gap: 6px; justify-items: center; animation: rise .7s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes rise { from { transform: translateY(30px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.giftee { font-family: var(--font-display); font-size: clamp(2.6rem, 12vw, 4.2rem); line-height: 1; color: var(--berry); word-break: break-word; }
.cover { filter: blur(14px); user-select: none; }

.facts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* Wish lists */
.wishes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wishes li { display: flex; align-items: center; gap: 10px; padding: 11px 13px; background: var(--bg); border-radius: 12px; border: 1px solid var(--line); }
.wishes li .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.wishes li a { color: var(--pine); font-weight: 700; }
.star { flex: none; width: 18px; height: 18px; color: var(--gold); }
.empty { padding: 14px; border: 2px dashed var(--line); border-radius: 12px; text-align: center; color: var(--muted); }

/* Admin people list */
.people { display: grid; gap: 10px; }
.person { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.person .name { font-weight: 800; font-size: 1.05rem; overflow-wrap: anywhere; }
.person .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.person .acts { display: flex; gap: 12px; align-items: center; }
.sendout { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.sendout pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: .88rem/1.5 var(--font-mono); background: var(--paper); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; }
.code { font-family: var(--font-mono); font-weight: 500; letter-spacing: .06em; }
.rules { display: grid; gap: 8px; }
.rule { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 13px; border-radius: 12px; background: var(--berry-soft); font-weight: 700; }
.rule span { overflow-wrap: anywhere; min-width: 0; }
.groups { display: grid; gap: 10px; }
.group-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); color: inherit; text-decoration: none; font-weight: 800; }
.group-link:hover { border-color: var(--pine); }
.confirm { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--gold-soft); border: 1px solid var(--gold); }
.footer { text-align: center; font-size: .85rem; color: var(--muted); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--pine); animation: sp 0.8s linear infinite; margin: 30px auto; }
@keyframes sp { to { transform: rotate(360deg); } }

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