/* Secret Santa: felt-craft stop-motion North Pole.
   Tokens first; everything else uses them. */
:root {
  --night: #13304a;
  --night-2: #1d4a6e;
  --felt-red: #c8323a;
  --felt-red-dark: #8f1f26;
  --pine: #1e5b3a;
  --pine-dark: #133d27;
  --gold: #e8b33f;
  --snow: #fffaf2;
  --frost: #e7eef5;
  --cocoa: #2b1b17;
  --cocoa-soft: #6d5249;
  --stitch: rgba(43, 27, 23, 0.22);

  --font-display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.65rem;
  --step-3: clamp(2.1rem, 7vw, 3.4rem);

  --radius-patch: 22px;
  --radius-pill: 999px;
  --page: min(600px, 100% - 32px);
  --tabbar-h: 72px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  position: relative;
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--cocoa);
  background: radial-gradient(120% 70% at 50% 0%, var(--night-2), var(--night) 70%) fixed, var(--night);
  padding-bottom: calc(var(--tabbar-h) + max(150px, 15.3vw - 30px) + env(safe-area-inset-bottom));
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
a { color: var(--felt-red); text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); margin-top: 1.4em; }
h4 { font-size: var(--step-0); margin-bottom: .2em; color: var(--pine); }
p { margin: 0 0 .8em; }
code { font-size: .9em; background: var(--frost); padding: .1em .35em; border-radius: 6px; word-break: break-all; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.small { font-size: var(--step--1); color: var(--cocoa-soft); }
.center { text-align: center; }

/* ---------------------------------------------------------------- scenery */
.snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
/* Tall enough for the whole drawing at any width (viewBox is 1440x220), so the roof is never cut. */
.scene { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: max(180px, 15.3vw); z-index: 0; pointer-events: none; }

.topbar, .page, .tabbar { position: relative; z-index: 1; }
.topbar {
  width: var(--page); margin: 0 auto; padding: 18px 0 0;
  display: flex; justify-content: space-between; align-items: center;
}
.brand {
  font-family: var(--font-display); font-weight: 600; color: var(--snow);
  text-decoration: none; font-size: var(--step-0); letter-spacing: .01em;
}
.topbar-me { display: flex; align-items: baseline; gap: 8px; color: var(--frost); font-size: var(--step--1); white-space: nowrap; }
.topbar-me button { font: inherit; color: var(--gold); background: none; border: 0; padding: 0 8px; min-height: 44px; margin: -12px -8px; text-decoration: underline; cursor: pointer; }

.page { width: var(--page); margin: 0 auto; }

/* ---------------------------------------------------------------- hero type: the clay headline */
.hero, .greeting { text-align: center; color: var(--snow); padding: 36px 0 22px; }
.greeting { padding: 26px 0 18px; }
.hero-title {
  font-size: var(--step-3);
  color: var(--snow);
  letter-spacing: -.01em;
  font-weight: 700;
  text-shadow: 0 3px 0 var(--felt-red), 0 10px 22px rgba(0, 0, 0, .35);
  margin-bottom: .35em;
  text-wrap: balance;
}
.hero-sub { color: var(--frost); font-size: var(--step-0); margin: 0 auto; max-width: 34ch; text-wrap: balance; }
.hero-sub a { color: var(--gold); }
.hero-avatar { display: flex; justify-content: center; margin: 44px 0 18px; }
.greeting-me { display: flex; flex-direction: column; align-items: center; gap: 6px; }

/* ---------------------------------------------------------------- felt patches */
.patch {
  position: relative;
  background: var(--snow);
  border-radius: var(--radius-patch);
  padding: 26px 22px;
  margin: 0 0 18px;
  box-shadow: 0 2px 0 rgba(255, 255, 255, .5) inset, 0 10px 0 -2px rgba(0, 0, 0, .18), 0 18px 30px rgba(0, 0, 0, .25);
}
.patch::before { /* the stitching */
  content: ""; position: absolute; inset: 8px; border-radius: calc(var(--radius-patch) - 7px);
  border: 2px dashed var(--stitch); pointer-events: none;
}
.patch-narrow { max-width: 460px; margin-left: auto; margin-right: auto; }

.letter {
  position: relative; background: #fff3d6; color: var(--cocoa);
  padding: 20px 22px 18px; margin: 0 6px 22px; border-radius: 6px;
  transform: rotate(-1.2deg);
  box-shadow: 0 12px 24px rgba(0, 0, 0, .3);
  background-image: repeating-linear-gradient(transparent 0 30px, rgba(200, 50, 58, .12) 30px 31px);
  line-height: 31px;
}
.letter::after { /* a strip of tape */
  content: ""; position: absolute; top: -10px; left: 50%; width: 90px; height: 22px;
  translate: -50% 0; rotate: 3deg; background: rgba(232, 179, 63, .75); border-radius: 2px;
}
.letter-from { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; color: var(--felt-red); margin-bottom: 4px; }
.letter p { margin: 0; white-space: pre-line; }

.nudge {
  display: block; margin: 0 0 18px; padding: 14px 18px; border-radius: 16px;
  background: var(--gold); color: var(--cocoa); font-weight: 700; text-decoration: none;
  border: 2px dashed rgba(43, 27, 23, .35);
}

/* ---------------------------------------------------------------- avatars: ornaments in elf hats */
.avatar { --size: 56px; position: relative; display: inline-block; width: var(--size); height: var(--size); flex: none; }
.avatar-sm { --size: 36px; }
.avatar-md { --size: 56px; }
.avatar-lg { --size: 96px; }
.avatar-xl { --size: 112px; }
.avatar-face {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--felt) 70%, white), var(--felt) 70%);
  border: calc(var(--size) * .05) solid var(--snow);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .2);
  display: grid; place-items: center;
}
.avatar-face img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initials { font-family: var(--font-display); font-weight: 600; color: var(--snow); font-size: calc(var(--size) * .36); }
.avatar-hat {
  position: absolute; z-index: 2; width: calc(var(--size) * .95); left: calc(var(--size) * -.06);
  top: calc(var(--size) * -.46); rotate: -10deg; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .18));
}
.avatar-sm .avatar-face { border-width: 2px; }

/* ---------------------------------------------------------------- forms */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; font-weight: 700; }
.field small { font-weight: 400; color: var(--cocoa-soft); font-size: var(--step--1); }
.opt { font-weight: 400; font-style: normal; color: var(--cocoa-soft); font-size: var(--step--1); }
input, select, textarea {
  font: inherit; font-weight: 400; font-size: max(16px, 1rem); /* 16px stops iOS zoom */
  width: 100%; padding: 13px 14px; color: var(--cocoa);
  background: #fff; border: 2px solid #dccfc4; border-radius: 14px; appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%232b1b17' stroke-width='2.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 20px; padding-right: 40px;
}
input:focus, select:focus, textarea:focus { border-color: var(--pine); outline: none; box-shadow: 0 0 0 4px rgba(30, 91, 58, .15); }
textarea { resize: vertical; min-height: 64px; }
.code-input { font-size: 2rem; letter-spacing: .4em; text-align: center; font-family: var(--font-display); font-weight: 600; }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0; text-align: center; }
.facts div { background: var(--frost); border-radius: 14px; padding: 10px 4px; }
.facts dt { font-size: var(--step--1); color: var(--cocoa-soft); }
.facts dd { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); color: var(--pine); }

/* ---------------------------------------------------------------- buttons */
.btn {
  --bg: var(--felt-red); --edge: var(--felt-red-dark); --fg: var(--snow);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 26px; border: 0; border-radius: var(--radius-pill);
  font: 600 var(--step-0) / 1 var(--font-display); color: var(--fg); background: var(--bg);
  box-shadow: 0 5px 0 var(--edge); cursor: pointer; text-decoration: none;
  transition: transform .08s ease, box-shadow .08s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn::after { content: ""; position: absolute; inset: 5px; border-radius: inherit; border: 2px dashed rgba(255, 255, 255, .45); pointer-events: none; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--edge); }
.btn-secondary { --bg: var(--pine); --edge: var(--pine-dark); }
.btn-ghost { --bg: transparent; --edge: transparent; --fg: var(--frost); box-shadow: none; text-decoration: underline; }
.btn-ghost::after { display: none; }
.btn-block { width: 100%; }
.btn-xl { min-height: 64px; padding: 16px 40px; font-size: var(--step-1); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-icon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; color: var(--cocoa-soft); cursor: pointer;
}
.btn-icon:hover { background: var(--frost); color: var(--felt-red); }
.btn-icon svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.5; fill: none; stroke-linecap: round; }

/* ---------------------------------------------------------------- toasts */
.toast { padding: 12px 16px; border-radius: 14px; margin: 14px 0; font-weight: 700; }
.toast-ok { background: #d9efe0; color: var(--pine-dark); }
.toast-err { background: #fbe0e0; color: var(--felt-red-dark); }
.page > .toast { margin-top: 18px; }

/* ---------------------------------------------------------------- the draw */
.draw { text-align: center; overflow: hidden; }
.draw-waiting .sack {
  width: 120px; height: 120px; margin: 0 auto 12px; border-radius: 46% 46% 40% 40%;
  background: radial-gradient(circle at 40% 35%, #d94a4f, var(--felt-red) 60%, var(--felt-red-dark));
  position: relative; animation: wobble 3s ease-in-out infinite;
}
.draw-waiting .sack::before { content: ""; position: absolute; top: -8px; left: 30%; width: 40%; height: 22px; background: var(--gold); border-radius: 10px; }
.reel { margin: 4px auto 18px; }
.reel-window {
  position: relative; height: 190px; overflow: hidden; border-radius: 18px;
  mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent);
}
.reel-strip { display: flex; flex-direction: column; align-items: center; }
.reel-item { height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding-top: 46px; font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); }
.reel-item .avatar { --size: 84px; }
.draw.is-spinning .draw-title, .draw.is-spinning .draw-copy { opacity: .4; }
.draw-result { font-family: var(--font-display); font-weight: 600; font-size: var(--step-2); color: var(--felt-red); min-height: 1em; margin: 12px 0 0; }

.recipient-head { display: flex; gap: 22px; align-items: center; padding-top: 34px; }
.kicker { margin: 0; color: var(--cocoa-soft); font-weight: 700; }
.recipient-name { font-size: var(--step-2); color: var(--felt-red); margin: 0 0 .2em; }

/* ---------------------------------------------------------------- gifts */
.gifts { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.gift { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; align-items: start; padding: 12px; border-radius: 14px; background: #fff; border: 2px solid #f0e6dc; }
.gift-tag { width: 22px; height: 26px; margin-top: 2px; background: var(--gold); clip-path: polygon(0 25%, 50% 0, 100% 25%, 100% 100%, 0 100%); position: relative; }
.gift-tag::after { content: ""; position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #fff; top: 7px; left: 8px; }
.gift-title { font-weight: 700; overflow-wrap: anywhere; }
.gift-note { margin: 2px 0 0; color: var(--cocoa-soft); font-size: var(--step--1); }
.gift-body { min-width: 0; }
.empty { color: var(--cocoa-soft); font-style: italic; margin: 0; }

.progress { display: flex; align-items: center; gap: 14px; color: var(--snow); margin: 0 0 18px; padding: 0 4px; }
.progress p { margin: 0; font-weight: 700; }
.progress-bulbs { display: flex; gap: 10px; padding: 8px 12px; position: relative; }
.progress-bulbs::before { content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 8px; border-top: 2px solid #557086; border-radius: 50%; }
.bulb { width: 16px; height: 22px; border-radius: 50% 50% 45% 45%; background: #42607a; position: relative; }
.bulb::before { content: ""; position: absolute; top: -5px; left: 4px; width: 8px; height: 6px; background: #8aa0b3; border-radius: 2px; }
.bulb.on { background: var(--gold); box-shadow: 0 0 14px 3px rgba(232, 179, 63, .7); }
.bulb.on:nth-child(3n+2) { background: #e8505a; box-shadow: 0 0 14px 3px rgba(232, 80, 90, .6); }
.bulb.on:nth-child(3n) { background: #4fc27d; box-shadow: 0 0 14px 3px rgba(79, 194, 125, .6); }

.ideas { border-top: 2px dashed var(--stitch); padding-top: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: var(--step--1); padding: 8px 14px; border-radius: var(--radius-pill); border: 2px solid #dccfc4; background: #fff; color: var(--cocoa); cursor: pointer; }
.chip:hover { border-color: var(--pine); color: var(--pine); }

.about-them { display: grid; gap: 12px; margin-top: 18px; padding: 14px; background: var(--frost); border-radius: 14px; }
.about-them p { margin: 0; }

.ask { margin-top: 22px; padding-top: 18px; border-top: 2px dashed var(--stitch); }
.qa { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 12px; }
.qa li { padding: 12px 14px; background: #fff; border-radius: 14px; border: 2px solid #f0e6dc; }
.qa .q { font-weight: 700; margin: 0 0 4px; }
.qa .a { margin: 0; color: var(--pine); }
.qa .a.pending { color: var(--cocoa-soft); font-style: italic; }
.answer { grid-template-columns: 1fr auto; align-items: end; gap: 8px; margin-top: 8px; }

.signout { text-align: center; }
.mail pre { white-space: pre-wrap; font-family: var(--font-body); }
.roster { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.roster th, .roster td { padding: 8px 6px; text-align: left; border-bottom: 1px solid #eee2d6; }
.roster-person { display: flex; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------- tab bar */
.tabbar {
  position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); translate: -50% 0;
  display: flex; gap: 4px; padding: 6px; width: min(420px, 100% - 24px);
  background: rgba(255, 250, 242, .96); border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); z-index: 5;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; border-radius: 18px; text-decoration: none; color: var(--cocoa-soft);
  font-size: .8rem; font-weight: 700;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { background: var(--felt-red); color: var(--snow); }

@keyframes wobble { 0%, 100% { rotate: -3deg; } 50% { rotate: 3deg; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .snow { display: none; }
}
@media (max-width: 420px) {
  .patch { padding: 22px 16px; }
  .recipient-head { flex-direction: column; text-align: center; gap: 10px; }
}


/* ---------------------------------------------------------------- mystery card in the hat */
.reel-mystery { gap: 8px; color: var(--cocoa-soft); padding-top: 34px; }
.mystery-gift { width: 104px; height: 104px; animation: wobble 2.4s ease-in-out infinite; }

/* ---------------------------------------------------------------- picture upload */
.upload {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 14px;
  border: 2px dashed #cdbcae; border-radius: 16px; background: #fff; cursor: pointer;
}
.upload:hover, .upload:focus-within { border-color: var(--pine); }
.upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; padding: 0; border: 0; }
.upload::before { /* picture icon with a plus badge */
  content: ""; flex: none; width: 48px; height: 48px; border-radius: 12px; background: var(--frost)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28' fill='none' stroke='%231e5b3a' stroke-width='2' stroke-linejoin='round' stroke-linecap='round'%3E%3Crect x='3' y='6' width='17' height='15' rx='2'/%3E%3Ccircle cx='9' cy='11' r='2'/%3E%3Cpath d='M20 18l-5-5-9 8'/%3E%3Ccircle cx='21' cy='7' r='5.5' fill='%231e5b3a' stroke='none'/%3E%3Cpath d='M21 4.5v5M18.5 7h5' stroke='%23fff'/%3E%3C/svg%3E") center / 30px no-repeat;
}
.upload.has-file::before { display: none; }
.upload-preview { flex: none; width: 48px; height: 48px; border-radius: 12px; object-fit: cover; }
.upload-copy { display: grid; gap: 2px; min-width: 0; }
.upload-copy strong { overflow-wrap: anywhere; font-family: var(--font-display); font-weight: 600; font-size: var(--step-0); color: var(--pine); }
.upload-copy small { color: var(--cocoa-soft); font-size: var(--step--1); }

.gift.has-image { grid-template-columns: 64px 1fr auto; }
.gift-pic { display: block; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--frost); }
.gift-pic img { width: 100%; height: 100%; object-fit: cover; }

h2.letter-from { font-size: var(--step-1); margin-bottom: 4px; }
.draw-after { text-align: center; color: var(--frost); font-size: var(--step--1); margin: 4px auto 0; max-width: 34ch; }
.brand { overflow-wrap: anywhere; }
.topbar { gap: 12px; }

/* ---------------------------------------------------------------- the family crowd
   Flex-wrap + centred rows: any headcount lays out evenly and the last row sits centred.
   Phone: 5 across. Home patch on desktop: 7 across. Join hero on desktop: a wide band, 7 across. */
.crowd {
  --person: 60px; --avatar: 46px;
  list-style: none; margin: 0 auto; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 20px 6px;
}
.crowd-person { width: var(--person); display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: calc(var(--avatar) * .45); }
.crowd .avatar { --size: var(--avatar); }
.crowd-name {
  max-width: 100%; font-family: var(--font-display); font-weight: 600; font-size: .8rem; line-height: 1.1;
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 639px) { .crowd-name { font-size: .72rem; letter-spacing: -.01em; } }
.hero .crowd { margin-top: 22px; }
.hero .crowd-name { color: var(--snow); }
.crowd-person.is-waiting .avatar { opacity: .4; filter: grayscale(.7); }
.crowd-person.is-waiting .crowd-name { color: var(--cocoa-soft); }
.family .crowd { margin-top: 4px; }
.family p.small { margin: 18px 0 0; text-align: center; }

@media (min-width: 640px) {
  .crowd { --person: 70px; --avatar: 54px; gap: 24px 6px; }
  .crowd-name { font-size: .85rem; }
}
@media (max-width: 420px) {
  .brand { font-size: var(--step--1); }
}

/* ================================================================ layouts
   Phones: one column, in reading order (CSS order below).
   Desktop (>= 1000px): the page widens and splits into two columns. */
.layout { display: flex; flex-direction: column; }
.layout > .col { display: contents; }
/* Phones: the person you're buying for comes first; the long rules letter waits further down. */
.layout-home .recipient, .layout-home .draw-waiting { order: 1; }
.layout-home .nudge { order: 2; }
.layout-home #questions { order: 3; }
.layout-home .letter { order: 4; }
.layout-home .family { order: 5; }

@media (min-width: 1000px) {
  .page.page-wide, .topbar { width: min(1160px, 100% - 64px); }
  .brand { white-space: nowrap; font-size: var(--step-1); }

  .layout { display: grid; gap: 0 32px; align-items: start; }
  .layout > .col { display: block; min-width: 0; }

  .layout-home { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); grid-template-areas: "main side" "family family"; }
  .layout-home .col-main { grid-area: main; }
  .layout-home .col-side { grid-area: side; }
  .layout-home .col-side-bottom { grid-area: family; }
  .layout-home .family .crowd { --person: 74px; --avatar: 56px; gap: 26px 4px; }
  .layout-home .letter { margin: 8px 6px 26px; }

  .layout-join { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; gap: 0 56px; padding-top: 24px; }
  .layout-join .hero { text-align: left; padding: 20px 0; }
  .layout-join .hero-sub { margin: 0; max-width: 62ch; }
  .layout-join .crowd { justify-content: flex-start; --person: 80px; --avatar: 60px; gap: 28px 6px; margin-top: 30px; }
  .layout-join .crowd-name { font-size: .95rem; }
  .join-form { margin: 0; }


  .greeting .hero-sub { max-width: 60ch; }
  .scene { height: max(230px, 15.3vw); }
}

/* ---------------------------------------------------------------- headshot editing */
.photo-edit { position: relative; display: inline-block; margin-top: 40px; }
.photo-edit-btn {
  position: absolute; right: -4px; bottom: -2px; z-index: 3; width: 38px; height: 38px;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  background: var(--snow); color: var(--pine); box-shadow: 0 3px 0 rgba(0, 0, 0, .25);
  border: 2px solid var(--pine);
}
.photo-edit-btn:hover, .photo-edit-btn:focus-within { background: var(--pine); color: var(--snow); }
.photo-edit-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.photo-edit-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; padding: 0; }
.photo-edit.is-uploading .avatar { opacity: .5; }

/* ---------------------------------------------------------------- address */
.hero-place { margin: 10px 0 0; }
.place { display: inline-flex; align-items: center; gap: 6px; color: var(--gold); font-weight: 700; text-decoration: none; }
.place:hover { text-decoration: underline; }
.place svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; }

.small-light { font-size: var(--step--1); margin-top: 8px; opacity: .9; }
.btn-ghost-dark { --fg: var(--cocoa-soft); margin-top: 6px; }
@media (max-width: 420px) { .topbar-me span { display: none; } }

/* ---------------------------------------------------------------- flying elves (desktop) */
.flyers { position: fixed; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; contain: strict; }
.flyer { position: absolute; left: 0; top: 0; will-change: transform; padding-top: 30px; }
.flyer .avatar { --size: 60px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); }
.flyer.corner .avatar { animation: corner-pop .9s ease-out; }
@keyframes corner-pop { 0% { scale: 1; } 30% { scale: 1.5; } 100% { scale: 1; } }
@media (max-width: 899px), (pointer: coarse) {
  .flyer { padding-top: 20px; opacity: .9; }
  .flyer .avatar { --size: 42px; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .3)); }
}

/* Desktop: the tab bar sits over the middle of the scene, so Santa, the elf and the
   reindeer move into the open snow on the left. Phones crop the sides, so they stay put. */
@media (min-width: 1000px) {
  .scene .c-santa { transform: translate(-262px, 0); }
  .scene .c-elf { transform: translate(-262px, 2px); }
  .scene .c-snowman { transform: translate(48px, 0); }
  .scene .c-reindeer-a { transform: translate(-795px, 6px); }
  .scene .c-reindeer-b { transform: translate(-830px, 10px); }
}

/* ---------------------------------------------------------------- crop editor */
.cropper { border: 0; padding: 0; background: transparent; width: min(460px, 100vw - 24px); max-height: 100dvh; }
.cropper::backdrop { background: rgba(10, 24, 40, .78); }
.cropper-box { background: var(--snow); border-radius: var(--radius-patch); padding: 18px 18px 14px; }
.cropper-title { margin: 0 0 12px; font-size: var(--step-1); text-align: center; }
.cropper-stage { position: relative; width: 100%; overflow: hidden; border-radius: 14px; background: #10202f;
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.cropper-stage:active { cursor: grabbing; }
.cropper-stage img { position: absolute; left: 0; top: 0; max-width: none; width: auto; height: auto;
  transform-origin: 0 0; pointer-events: none; }
.cropper-stage.is-round::after { content: ""; position: absolute; inset: 0; border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(16, 32, 47, .6); border: 3px solid rgba(255, 255, 255, .9); pointer-events: none; }
.cropper-hint { margin: 10px 0 4px; text-align: center; font-size: var(--step--1); color: var(--cocoa-soft); }
.cropper-zoom { display: flex; align-items: center; gap: 10px; margin: 6px 4px 14px; font-weight: 700; font-size: 1.3rem; color: var(--cocoa-soft); }
.cropper-zoom input { flex: 1; min-height: 44px; border: 0; box-shadow: none; background: none; padding: 0;
  -webkit-appearance: none; appearance: none; }
.cropper-zoom input::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: #dccfc4; }
.cropper-zoom input::-moz-range-track { height: 6px; border-radius: 3px; background: #dccfc4; }
.cropper-zoom input::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px;
  border-radius: 50%; background: var(--felt-red); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.cropper-zoom input::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--felt-red);
  border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.cropper-actions { display: grid; gap: 4px; }

/* ---------------------------------------------------------------- credit line (in the snow) */
.credit { position: absolute; right: 16px; bottom: calc(6px + env(safe-area-inset-bottom)); z-index: 1;
  margin: 0; text-align: right; font-size: 11px; letter-spacing: .02em; color: rgba(43, 27, 23, .5); pointer-events: none; }
.snowfloor { display: none; }
/* Phones with the menu bar: lift the scene above the bar and lay a strip of snow under it,
   so the small print sits in the snow instead of under the menu. */
@media (max-width: 999px) {
  body:has(.tabbar) { padding-bottom: calc(var(--tabbar-h) * 2 + 168px + env(safe-area-inset-bottom)); }
  body:has(.tabbar) .scene { bottom: calc(var(--tabbar-h) + 26px + env(safe-area-inset-bottom)); }
  body:has(.tabbar) .snowfloor { display: block; position: absolute; left: 0; right: 0; bottom: 0; z-index: 0;
    height: calc(var(--tabbar-h) + 27px + env(safe-area-inset-bottom)); background: #fff; }
  body:has(.tabbar) .credit { bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); }
}
@media (min-width: 1000px) { .credit { right: 28px; } }

/* ---------------------------------------------------------------- practice round + danger zone */
.patch.danger h2 { color: var(--felt-red); }
.check-ok { color: var(--pine); font-weight: 700; }
.check-bad { color: var(--felt-red); font-weight: 700; }
.btn-link { background: none; border: 0; padding: 8px 4px; min-height: 44px; font: inherit; font-weight: 700;
  color: var(--felt-red); text-decoration: underline; cursor: pointer; }
.roster-email td { padding-top: 0; font-size: var(--step--1); color: var(--cocoa-soft); border-top: 0; }
.check-field { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; font-weight: 600; }
.check-field input { -webkit-appearance: checkbox; appearance: auto; width: 24px; height: 24px; min-height: 0;
  padding: 0; margin: 1px 0 0; border: 0; border-radius: 4px; box-shadow: none; flex: none; accent-color: var(--felt-red); }
.pairs-head { font-weight: 800; margin: 12px 0 4px; }
.pairs { list-style: none; margin: 0 0 12px; padding: 0; }
.pairs li { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px dashed #e4d7cc; }
.pair-person { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; line-height: 1.2; }
.pair-arrow { color: var(--felt-red); font-weight: 800; }
.photo-editor { position: relative; display: inline-block; vertical-align: middle; }
.photo-editor-xl { margin-top: 40px; }
.photo-editor .pe-upload, .photo-editor .pe-adjust { display: contents; }
.photo-editor .pe-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
/* the familiar round badge on the corner of the picture: camera = add, pencil = edit */
.pe-btn { position: absolute; right: -6px; bottom: -4px; z-index: 2; display: grid; place-items: center;
  width: 24px; height: 24px; padding: 0; border: 2px solid var(--snow); border-radius: 50%;
  background: var(--felt-red); color: #fff; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,.25); }
.pe-btn::after { content: ""; position: absolute; inset: -10px; }  /* bigger tap target */
.pe-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.4;
  stroke-linejoin: round; stroke-linecap: round; }
.pe-btn.is-edit { background: var(--pine); }
.pe-btn:hover, .pe-btn:focus-visible { transform: scale(1.08); }
.pe-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.photo-editor-xl .pe-btn { right: 2px; bottom: 2px; width: 40px; height: 40px; border-width: 3px; }
.photo-editor-xl .pe-btn svg { width: 20px; height: 20px; }
.photo-editor.is-uploading .avatar { opacity: .5; }
/* organiser table: picture, Add/Edit photo and name stack so it fits a phone */
.roster:not(.pairs) { table-layout: fixed; width: 100%; }
.roster th:nth-child(1) { width: 36%; } .roster th:nth-child(2) { width: 17%; }
.roster th:nth-child(3) { width: 16%; } .roster th:nth-child(4) { width: 13%; } .roster th:nth-child(5) { width: 18%; }
.roster-who { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; overflow-wrap: anywhere; font-weight: 600; }
.roster .btn-link { padding: 8px 0; }
/* uploading: a spinning ring on the picture, and a quiet busy button */
.photo-editor.is-uploading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 60%; aspect-ratio: 1;
  border-radius: 50%; border: 3px solid rgba(255,255,255,.5); border-top-color: var(--felt-red);
  animation: spin .8s linear infinite; pointer-events: none; }
.photo-editor-xl.is-uploading::after { top: 40px; }
@keyframes spin { to { transform: rotate(360deg); } }
form.is-uploading [type=submit]:disabled { opacity: .85; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .photo-editor.is-uploading::after { animation: none; } }
.letter .kids-note { margin-top: 14px; }
.kids { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 2px 12px; font-weight: 500; }
.kids li::before { content: "🎄 "; font-size: .85em; }
.letter .signoff { margin-top: 14px; font-weight: 700; }
