:root {
  --ink: #10264a;
  --ink-soft: #4b6488;
  --ink-faint: #5a7395;
  --red: #c8102e;
  --red-bright: #ef3349;
  --gold: #ffd45c;
  --ice: #dcecff;
  --line: #cfe0f3;
  --festive: 'Mountains of Christmas', 'Georgia', serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: #fff;
  background: #050d1f;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  line-height: 1.15;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}

/* ---- the scene ------------------------------------------------------------ */

#sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #040b1c 0%, #0a1a35 30%, #16335d 62%, #33598c 88%, #4a74a8 100%);
}

#stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.aurora {
  position: absolute;
  left: -15vw;
  width: 130vw;
  height: 42vh;
  filter: blur(36px);
  mix-blend-mode: screen;
  opacity: 0.55;
  pointer-events: none;
}
.aurora.one {
  top: 2vh;
  background: radial-gradient(ellipse 40% 45% at 30% 55%, rgba(70, 255, 190, 0.45), transparent 70%),
    radial-gradient(ellipse 35% 35% at 55% 40%, rgba(60, 200, 255, 0.35), transparent 70%);
  animation: aurora 22s ease-in-out infinite alternate;
}
.aurora.two {
  top: 10vh;
  background: radial-gradient(ellipse 30% 40% at 72% 45%, rgba(150, 120, 255, 0.35), transparent 70%),
    radial-gradient(ellipse 30% 30% at 88% 60%, rgba(80, 255, 200, 0.25), transparent 70%);
  animation: aurora 28s ease-in-out infinite alternate-reverse;
}
@keyframes aurora {
  from {
    transform: translateX(-4vw) skewX(-8deg) scaleY(0.9);
    opacity: 0.35;
  }
  to {
    transform: translateX(5vw) skewX(10deg) scaleY(1.15);
    opacity: 0.65;
  }
}

#moon {
  position: absolute;
  top: 9vh;
  right: 11vw;
  width: clamp(56px, 8vw, 116px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 34%, #fffef6, #f3eed9 58%, #d9d2b6);
  box-shadow: 0 0 40px 10px rgba(255, 250, 220, 0.35), 0 0 140px 50px rgba(190, 215, 255, 0.18);
}
#moon::before,
#moon::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(190, 180, 150, 0.35);
}
#moon::before {
  width: 22%;
  height: 22%;
  top: 30%;
  left: 52%;
}
#moon::after {
  width: 14%;
  height: 14%;
  top: 60%;
  left: 30%;
}

#sleigh {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
  width: 220px;
  opacity: 0;
  transition: opacity 0.8s;
  pointer-events: none;
  filter: drop-shadow(0 0 8px rgba(255, 230, 160, 0.45));
  will-change: transform;
}
#sleigh svg {
  display: block;
  width: 100%;
  height: auto;
}
#sleigh.flip svg {
  transform: scaleX(-1);
}
.deer {
  animation: gallop 0.42s ease-in-out infinite alternate;
}
.legs path {
  stroke: #6e4521;
  stroke-width: 3;
  stroke-linecap: round;
  fill: none;
}
.legs {
  transform-box: fill-box;
  transform-origin: 50% 0;
}
.legs.front {
  animation: legs 0.42s ease-in-out infinite alternate;
}
.legs.back {
  animation: legs 0.42s ease-in-out infinite alternate-reverse;
}
.rudolph {
  animation: nose 0.9s ease-in-out infinite alternate;
}
@keyframes gallop {
  to {
    transform: translateY(-3px);
  }
}
@keyframes legs {
  from {
    transform: rotate(-22deg);
  }
  to {
    transform: rotate(22deg);
  }
}
@keyframes nose {
  from {
    filter: drop-shadow(0 0 2px #ff3b3b);
  }
  to {
    filter: drop-shadow(0 0 7px #ff3b3b) brightness(1.3);
  }
}

#landscape {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: clamp(250px, 27.5vw, 44vh);
  pointer-events: none;
}
#landscape svg {
  display: block;
  width: 100%;
  height: 100%;
}
.twinkle,
.bulb {
  animation: twinkle 1.5s ease-in-out infinite alternate;
}
.bulb {
  animation-duration: 1.1s;
}
@keyframes twinkle {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 1;
  }
}
.tree-star {
  animation: twinkle 2.2s ease-in-out infinite alternate;
}
.smoke {
  transform-box: fill-box;
  transform-origin: center;
  animation: smoke 4s linear infinite;
  opacity: 0;
}
@keyframes smoke {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0.7;
  }
  100% {
    transform: translate(14px, -46px) scale(2.6);
    opacity: 0;
  }
}
.glint {
  animation: glint 3.4s ease-in-out infinite;
  opacity: 0;
}
@keyframes glint {
  50% {
    opacity: 1;
  }
}
.lorry-text {
  font-family: var(--festive);
  font-weight: 700;
  font-size: 34px;
  fill: #fff;
}

#heads {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
#snow {
  position: fixed;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#frost {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(ellipse 34% 30% at 0 0, rgba(225, 242, 255, 0.32), transparent 70%),
    radial-gradient(ellipse 34% 30% at 100% 0, rgba(225, 242, 255, 0.28), transparent 70%),
    radial-gradient(ellipse 30% 26% at 0 100%, rgba(255, 255, 255, 0.22), transparent 70%),
    radial-gradient(ellipse 30% 26% at 100% 100%, rgba(255, 255, 255, 0.22), transparent 70%);
  box-shadow: inset 0 0 110px rgba(190, 225, 255, 0.3);
}
#icicles {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  height: 34px;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 20, 60, 0.3));
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='34' viewBox='0 0 120 34'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='0' y1='0' y2='1'%3E%3Cstop offset='0' stop-color='%23ffffff'/%3E%3Cstop offset='1' stop-color='%23bfe3ff' stop-opacity='.6'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 0H120V5L114 7L110 22L106 7L98 8L95 30L91 8L82 6L79 16L76 6L66 7L62 26L58 7L48 6L45 14L42 6L33 8L29 32L25 8L16 6L13 18L10 6L4 7L2 12L0 6Z' fill='url(%23g)'/%3E%3C/svg%3E")
    repeat-x top left / 120px 34px;
}

/* ---- layout ------------------------------------------------------------------ */

#app {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
body.in-family #app {
  pointer-events: none;
  overflow: hidden;
}
body.in-family #app > * {
  pointer-events: auto;
}
#layer {
  position: relative;
  z-index: 20;
}

.center {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 64px 16px clamp(110px, 22vh, 260px);
}

.card,
.hero,
.sheet {
  color: var(--ink);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(226, 240, 255, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 70px rgba(2, 8, 26, 0.5), inset 0 1px 0 #fff;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.card {
  position: relative;
  width: min(480px, 100%);
  border-radius: 30px;
  padding: 30px 28px 26px;
}

/* A bumpy drift of snow resting on top of cards and panels. */
.card::before,
.hero::before,
.sheet::before {
  content: '';
  position: absolute;
  top: -15px;
  left: 18px;
  right: 18px;
  height: 26px;
  pointer-events: none;
  background: radial-gradient(circle at 6% 100%, #fff 14px, transparent 15px), radial-gradient(circle at 17% 100%, #fff 20px, transparent 21px),
    radial-gradient(circle at 30% 100%, #fff 13px, transparent 14px), radial-gradient(circle at 44% 100%, #fff 22px, transparent 23px),
    radial-gradient(circle at 58% 100%, #fff 15px, transparent 16px), radial-gradient(circle at 71% 100%, #fff 21px, transparent 22px),
    radial-gradient(circle at 84% 100%, #fff 14px, transparent 15px), radial-gradient(circle at 95% 100%, #fff 18px, transparent 19px);
  filter: drop-shadow(0 -2px 2px rgba(120, 170, 220, 0.25));
}

.title {
  font-family: var(--festive);
  font-weight: 700;
  font-size: clamp(50px, 10vw, 74px);
  color: var(--red);
  margin: 0;
  line-height: 1;
  text-shadow: 0 2px 0 #fff, 0 0 22px rgba(255, 255, 255, 0.85);
}
.title.small {
  font-size: 44px;
}
.lede {
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.5;
}
.muted {
  color: var(--ink-faint);
}
.small {
  font-size: 13px;
}
.fine {
  font-size: 13px;
  color: var(--ink-faint);
  margin: 18px 0 0;
}

.login {
  text-align: center;
}
.login-gift {
  font-size: 70px;
  line-height: 1;
  margin: -74px auto 6px;
  animation: bounce 2.4s ease-in-out infinite;
  filter: drop-shadow(0 10px 18px rgba(0, 10, 40, 0.35));
}
@keyframes bounce {
  0%,
  100% {
    transform: translateY(0) rotate(-4deg);
  }
  50% {
    transform: translateY(-10px) rotate(4deg);
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stack.tight {
  gap: 8px;
}
.stack > .btn:not(.big) {
  align-self: flex-start;
}
.settings-sheet form {
  margin-top: 14px;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.row.between {
  justify-content: space-between;
}
.row.end {
  justify-content: flex-end;
}
.row.center {
  justify-content: center;
}
.row.grow > * {
  flex: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
  font-size: 14px;
  color: #34557f;
  min-width: 0;
}
.field.narrow {
  flex: 0 0 130px;
}

input[type='text'],
input[type='email'],
textarea {
  width: 100%;
  padding: 13px 15px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea {
  resize: vertical;
  line-height: 1.45;
}
input:focus,
textarea:focus {
  border-color: #6fb6ff;
  box-shadow: 0 0 0 4px rgba(111, 182, 255, 0.25);
}
::placeholder {
  color: #9bb0c9;
}

/* ---- buttons ---------------------------------------------------------------------- */

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s;
}
.btn:hover {
  filter: brightness(1.05);
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}
.btn.big {
  padding: 16px 26px;
  font-size: 18px;
}
.btn.small {
  padding: 8px 14px;
  font-size: 14px;
}
.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, var(--red-bright), var(--red));
  box-shadow: 0 8px 18px rgba(200, 16, 46, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn.ice {
  color: #12407a;
  background: linear-gradient(180deg, #ffffff, var(--ice));
  box-shadow: inset 0 0 0 1.5px #b9d6f5, 0 4px 10px rgba(18, 64, 122, 0.12);
}
.btn.ghost {
  color: #34557f;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px #c9dbef;
}
.btn.ghost.light {
  color: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.6);
}
.btn.danger {
  color: #b0142b;
  background: #fff0f2;
  box-shadow: inset 0 0 0 1.5px #f5c2ca;
}
.dialog .btn.danger {
  color: #fff;
  background: linear-gradient(180deg, #e2354b, #b0142b);
  box-shadow: none;
}
.btn.kiss {
  color: #fff;
  background: linear-gradient(180deg, #ff86b8, #ff4f8b);
  box-shadow: 0 8px 18px rgba(255, 79, 139, 0.35);
}
.btn.fart {
  color: #fff;
  background: linear-gradient(180deg, #a9c86a, #6b8a37);
  box-shadow: 0 8px 18px rgba(107, 138, 55, 0.35);
}

.icon-btn {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.12s;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}
.icon-btn:active {
  transform: scale(0.94);
}
.icon-btn.small {
  width: 34px;
  height: 34px;
  font-size: 15px;
  border: 0;
  background: #eef5fd;
}
.icon-btn.small:hover {
  background: #dfeaf8;
}

.me-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 10, 40, 0.25);
}
.me-chip > span {
  padding-right: 10px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e4effb;
  color: #34557f;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.badge.gold {
  background: linear-gradient(180deg, #ffeeb5, var(--gold));
  color: #6a4200;
}
.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

/* ---- avatars and floating heads ----------------------------------------------------- */

.avatar {
  --a: 44px;
  width: var(--a);
  height: var(--a);
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #ffffff, #d7e9fb 70%, #b9d4f1);
  box-shadow: 0 0 0 3px #fff, 0 4px 12px rgba(8, 25, 60, 0.25);
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar .emoji {
  font-size: calc(var(--a) * 0.58);
  line-height: 1;
}
.avatar.sm {
  --a: 36px;
  box-shadow: 0 0 0 2px #fff;
}
.avatar.md {
  --a: 58px;
}
.avatar.lg {
  --a: 78px;
}
.avatar.xl {
  --a: 120px;
}
.avatar.glow {
  box-shadow: 0 0 0 3px var(--gold), 0 0 26px rgba(255, 212, 92, 0.85);
}

.head {
  position: absolute;
  left: 0;
  top: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.head:focus-visible {
  outline: none;
}
.head:focus-visible .bubble {
  outline: 3px solid #6fb6ff;
  outline-offset: 6px;
}
.head .bubble {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  container-type: size;
  background: radial-gradient(circle at 35% 28%, #ffffff, #e0efff 55%, #a9cbef);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.95), 0 0 0 8px rgba(160, 210, 255, 0.3), 0 12px 30px rgba(0, 10, 40, 0.45),
    0 0 46px rgba(170, 220, 255, 0.35);
  transition: transform 0.2s;
}
.head:hover .bubble {
  transform: scale(1.07);
}
.head.grabbed {
  cursor: grabbing;
}
.head.grabbed .bubble {
  transform: scale(1.12);
}
.head .bubble img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.head .bubble .emoji {
  font-size: 58cqw;
  line-height: 1;
}
.head .hat {
  position: absolute;
  width: 64%;
  top: -27%;
  left: 30%;
  transform: rotate(16deg);
  pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.25));
}
.head .label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 10px);
  white-space: nowrap;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}
.head.me .label {
  background: var(--ink);
  color: #fff;
}
.head .tag {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 40px);
  white-space: nowrap;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffeeb5, var(--gold));
  color: #6a4200;
  font-weight: 900;
  font-size: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}
.head.assigned .bubble {
  animation: gold-pulse 2.2s ease-in-out infinite;
}
@keyframes gold-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px var(--gold), 0 0 0 9px rgba(255, 212, 92, 0.3), 0 0 40px rgba(255, 212, 92, 0.55), 0 12px 30px rgba(0, 10, 40, 0.45);
  }
  50% {
    box-shadow: 0 0 0 4px var(--gold), 0 0 0 13px rgba(255, 212, 92, 0.18), 0 0 70px rgba(255, 212, 92, 0.85), 0 12px 30px rgba(0, 10, 40, 0.45);
  }
}

/* ---- family view: top bar and hero ------------------------------------------------- */

.topbar {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 22px;
  background: rgba(8, 22, 46, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.family-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.family-title strong {
  font-family: var(--festive);
  font-size: 28px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 14px rgba(160, 210, 255, 0.7);
}

.hero {
  position: absolute;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(520px, calc(100% - 24px));
  border-radius: 26px;
  padding: 14px 18px 10px;
}
.hero-assigned {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 2px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.hero-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.hero-text small {
  font-weight: 800;
  color: var(--ink-faint);
  font-size: 14px;
}
.hero-text strong {
  font-family: var(--festive);
  font-size: 38px;
  line-height: 1.05;
  color: var(--red);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-cta {
  font-weight: 800;
  color: #1a5fb4;
  font-size: 15px;
}
.hero-assigned:hover .hero-cta {
  text-decoration: underline;
}
.hero-waiting {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.hero-waiting strong {
  font-size: 18px;
}
.hero-waiting small {
  color: var(--ink-soft);
  font-size: 14px;
}
.hero-hint {
  margin: 10px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ---- home ---------------------------------------------------------------------------------- */

.home h2 {
  font-size: 18px;
  margin: 18px 0 10px;
}
.family-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.family-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 0 #d9e7f6, 0 8px 18px rgba(16, 38, 74, 0.08);
  transition: transform 0.15s;
}
.family-link:hover {
  transform: translateY(-2px);
}
.family-icon {
  font-size: 30px;
}
.family-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.family-text small {
  color: var(--ink-faint);
}
.chev {
  font-size: 30px;
  color: #9cbfe6;
  line-height: 1;
}
details.create {
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  padding: 2px 16px;
}
details.create summary {
  cursor: pointer;
  font-weight: 900;
  padding: 12px 0;
  color: var(--red);
  list-style: none;
}
details.create summary::-webkit-details-marker {
  display: none;
}
details.create form {
  padding-bottom: 16px;
}

.photo-row {
  display: flex;
  align-items: center;
  gap: 18px;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
}
.emoji-grid button {
  aspect-ratio: 1;
  font-size: 24px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #fff;
  cursor: pointer;
  transition: transform 0.12s;
  padding: 0;
}
.emoji-grid button:hover {
  transform: scale(1.08);
}
.emoji-grid button.on {
  border-color: var(--red);
  background: #fff1f3;
}

/* ---- sheets --------------------------------------------------------------------------------- */

.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}
.sheet-wrap.open {
  pointer-events: auto;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 10, 28, 0.42);
  opacity: 0;
  transition: opacity 0.3s;
}
.sheet-wrap.open .sheet-backdrop {
  opacity: 1;
}
.sheet {
  position: absolute;
  top: 24px;
  right: 14px;
  bottom: 14px;
  width: min(480px, calc(100% - 28px));
  display: flex;
  flex-direction: column;
  border-radius: 28px;
  transform: translateX(calc(100% + 30px));
  transition: transform 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.05);
}
.sheet-wrap.open .sheet {
  transform: none;
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px 28px;
  border-radius: 28px;
}
.sheet-body h2 {
  margin: 0 0 4px;
  font-size: 24px;
  padding-right: 40px;
}
.sheet-body h3 {
  margin: 24px 0 10px;
  font-size: 17px;
}
.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: #eef5fd;
  color: #34557f;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.sheet-close:hover {
  background: #dfeaf8;
}

@media (max-width: 640px) {
  .sheet {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 90dvh;
    border-radius: 28px 28px 0 0;
    transform: translateY(105%);
  }
  .sheet-body {
    padding: 26px 18px calc(24px + env(safe-area-inset-bottom));
  }
  .me-chip > span {
    display: none;
  }
  .family-title strong {
    font-size: 23px;
  }
  .family-title .chip {
    display: none;
  }
  .hero-text strong {
    font-size: 32px;
  }
  .card {
    padding: 26px 20px 22px;
  }
}

.person-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding-right: 40px;
}
.person-head h2 {
  padding-right: 0;
}
.person-head p {
  margin: 0 0 6px;
  word-break: break-all;
}
.notice {
  background: #eaf4ff;
  border: 1.5px dashed #9cc6f0;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  color: #23497a;
}
.poke-row {
  margin-bottom: 18px;
}
.poke-row .btn {
  flex: 1;
}
.list-summary {
  margin: 0 0 10px;
}

.items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 2px 0 #d9e7f6, 0 6px 14px rgba(16, 38, 74, 0.06);
  transition: background 0.2s, opacity 0.2s;
}
.item.claimed:not(.mine) {
  opacity: 0.68;
}
.item.claimed:not(.mine) .item-title {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(200, 16, 46, 0.55);
}
.item.mine {
  background: #effbf2;
  box-shadow: 0 2px 0 #bfe6c9, 0 6px 14px rgba(16, 74, 38, 0.08);
}
.item .item-form {
  flex: 1;
}
.tick {
  flex: none;
  position: relative;
  width: 30px;
  height: 30px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2.5px solid #9cbfe6;
  background: #fff;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.tick:hover:not(:disabled) {
  transform: scale(1.1);
  border-color: #2fa35a;
}
.tick[aria-pressed='true'] {
  background: #2fa35a;
  border-color: #2fa35a;
}
.tick[aria-pressed='true']::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 16px;
}
.item.claimed:not(.mine) .tick {
  background: #9aa9bb;
  border-color: #9aa9bb;
  cursor: default;
}
.item-body {
  flex: 1;
  min-width: 0;
}
.item-title {
  font-weight: 800;
  overflow-wrap: anywhere;
}
.item-note {
  font-size: 14px;
  color: var(--ink-soft);
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 6px;
  font-size: 13px;
}
.item-meta:empty {
  display: none;
}
.item-link {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eaf3ff;
  color: #1a5fb4;
  font-weight: 700;
  text-decoration: none;
}
.item-link:hover {
  background: #dbeaff;
}
.item-status {
  color: #2c7a48;
  font-weight: 800;
}
.item.claimed:not(.mine) .item-status {
  color: #6b7a8f;
}
.item-bullet {
  font-size: 22px;
  line-height: 1.2;
}
.item-actions {
  display: flex;
  gap: 4px;
}
.add-title {
  margin-top: 22px !important;
}
.empty {
  text-align: center;
  padding: 18px 10px;
  color: var(--ink-soft);
}
.empty p {
  margin: 6px 0;
}
.empty-icon {
  font-size: 46px;
}
.loading {
  text-align: center;
  padding: 20px 0;
}

.members {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.members li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: #fff;
}
.member-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.member-text small {
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-row code {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1.5px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

/* ---- dialogs and toasts ------------------------------------------------------------------- */

.dialog-wrap {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 10, 28, 0.5);
  animation: fade-in 0.2s;
}
.dialog {
  width: min(390px, 100%);
  padding: 22px;
  border-radius: 22px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  animation: pop-in 0.25s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.dialog h3 {
  margin: 0 0 8px;
}
.dialog p {
  color: var(--ink-soft);
  margin: 0 0 18px;
  overflow-wrap: anywhere;
}

#toasts {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: min(440px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(10, 26, 51, 0.94);
  color: #fff;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.3s cubic-bezier(0.3, 1.4, 0.5, 1);
  transition: opacity 0.5s, transform 0.5s;
}
.toast.error {
  background: #b0142b;
}
.toast.out {
  opacity: 0;
  transform: translateY(-10px);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.95);
  }
}

.burst {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  line-height: 1;
  transform: translate(-50%, -50%);
  animation: burst 1.4s cubic-bezier(0.15, 0.7, 0.3, 1) both;
}
@keyframes burst {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 40px)) rotate(var(--rot)) scale(1);
    opacity: 0;
  }
}

/* ---- gates, reveals, kisses and farts -------------------------------------------------------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  color: #fff;
  cursor: pointer;
  background: radial-gradient(circle at 50% 45%, rgba(20, 45, 90, 0.6), rgba(2, 6, 20, 0.88));
  animation: fade-in 0.4s;
}
.gate.reveal {
  cursor: default;
}
.gate-inner,
.reveal-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 520px;
}
.gate p,
.reveal-stage p {
  font-size: 18px;
  margin: 0 0 8px;
  color: #dcebff;
}
.gate .title {
  color: #fff;
  text-shadow: 0 0 24px rgba(160, 210, 255, 0.9);
}
.gate-present,
.reveal-present {
  font-size: clamp(100px, 22vmin, 150px);
  line-height: 1;
  animation: wiggle 1.1s ease-in-out infinite;
  filter: drop-shadow(0 14px 30px rgba(255, 200, 100, 0.45));
}
.reveal-present {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  margin-top: 8px;
}
.gate.opening,
.gate.closing {
  animation: fade-out 0.45s forwards;
}
.gate.opening .gate-present,
.reveal-present.pop {
  animation: pop 0.5s forwards;
}
.reveal-stage {
  animation: pop-in 0.45s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.reveal-kicker {
  font-weight: 800;
  font-size: 20px !important;
}
.reveal-person .avatar.xl {
  --a: clamp(120px, 30vmin, 170px);
  animation: float 3s ease-in-out infinite;
}
.reveal-name {
  color: var(--gold) !important;
  font-size: clamp(58px, 13vw, 100px);
  text-shadow: 0 0 34px rgba(255, 212, 92, 0.65) !important;
}

.show {
  position: fixed;
  inset: 0;
  z-index: 46;
  overflow: hidden;
  pointer-events: none;
  animation: fade-in 0.3s;
}
.show.out {
  animation: fade-out 0.45s forwards;
}
.kiss-show {
  background: radial-gradient(circle at 50% 50%, rgba(255, 120, 170, 0.35), rgba(60, 0, 30, 0.45));
}
.lips,
.lipstick {
  position: absolute;
  left: 50%;
  top: 50%;
}
.lips svg,
.lipstick svg {
  display: block;
  width: 100%;
  height: auto;
}
/* Drawn at full size and scaled down, so it is never blown up and blurry. */
.lips {
  width: min(80vmin, 640px);
  animation: lips 3.6s cubic-bezier(0.3, 0.7, 0.3, 1) forwards;
  filter: drop-shadow(0 20px 40px rgba(255, 60, 120, 0.55));
}
@keyframes lips {
  0% {
    transform: translate(-50%, 60vh) scale(0.08) rotate(-20deg);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  26% {
    transform: translate(-50%, -50%) scale(0.42) rotate(-6deg);
  }
  30% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
  34% {
    transform: translate(-50%, -50%) scale(0.8);
  }
  38% {
    transform: translate(-50%, -50%) scale(0.88);
  }
  80% {
    transform: translate(-50%, -50%) scale(0.85) rotate(4deg);
    opacity: 1;
  }
  100% {
    transform: translate(60vw, -90vh) scale(0.15) rotate(40deg);
    opacity: 0;
  }
}
.lipstick {
  width: min(66vmin, 520px);
  opacity: 0;
  animation: stamp 2.6s forwards;
  filter: blur(1px);
}
@keyframes stamp {
  0% {
    opacity: 0.55;
  }
  70% {
    opacity: 0.35;
  }
  100% {
    opacity: 0;
  }
}
.fart-show {
  background: radial-gradient(circle at 50% 60%, rgba(150, 170, 60, 0.28), rgba(30, 24, 8, 0.45));
}
.poo {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: min(34vmin, 260px);
  line-height: 1;
  animation: poo 3.9s forwards;
  filter: drop-shadow(0 20px 30px rgba(40, 20, 0, 0.5));
}
@keyframes poo {
  0% {
    transform: translate(-50%, -150vh) rotate(-20deg);
  }
  17% {
    transform: translate(-50%, -38%) rotate(0deg) scale(1.35, 0.7);
  }
  23% {
    transform: translate(-50%, -78%) scale(0.92, 1.1);
  }
  30% {
    transform: translate(-50%, -46%) scale(1.15, 0.88);
  }
  35% {
    transform: translate(-50%, -56%) scale(1);
  }
  40%,
  82% {
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    transform: translate(-200vw, -60%) rotate(-720deg);
  }
}
.fly {
  position: absolute;
  left: 40%;
  top: 40%;
  font-size: 0.16em;
  animation: orbit 1.6s linear infinite;
}
.fly.f2 {
  animation-duration: 2.2s;
  animation-direction: reverse;
}
@keyframes orbit {
  from {
    transform: rotate(0deg) translateX(min(24vmin, 180px)) rotate(0deg);
  }
  to {
    transform: rotate(360deg) translateX(min(24vmin, 180px)) rotate(-360deg);
  }
}
.gas {
  position: absolute;
  left: 50%;
  top: 56%;
  width: 34vmin;
  height: 34vmin;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(160, 190, 60, 0.75), rgba(120, 150, 40, 0.35) 50%, transparent 70%);
  filter: blur(6px);
  animation: gas 2.8s ease-out both;
}
@keyframes gas {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
  }
  20% {
    opacity: 0.95;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.9);
    opacity: 0;
  }
}
.show-caption {
  position: absolute;
  left: 50%;
  bottom: 12vh;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: 92vw;
  padding: 10px 22px 10px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-weight: 900;
  font-size: clamp(18px, 3.2vw, 26px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  animation: caption-in 0.5s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}
@keyframes caption-in {
  from {
    opacity: 0;
    transform: translate(-50%, 30px) scale(0.85);
  }
}

body.shake #sky,
body.shake #landscape,
body.shake #heads,
body.shake #app {
  animation: shake 0.45s linear infinite;
}
@keyframes shake {
  0%,
  100% {
    translate: 0 0;
  }
  20% {
    translate: -9px 4px;
  }
  40% {
    translate: 8px -5px;
  }
  60% {
    translate: -6px -3px;
  }
  80% {
    translate: 6px 5px;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes fade-out {
  to {
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
}
@keyframes pop {
  40% {
    transform: scale(1.35) rotate(-6deg);
    opacity: 1;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}
@keyframes wiggle {
  0%,
  100% {
    transform: rotate(-7deg) scale(1);
  }
  25% {
    transform: rotate(7deg) scale(1.05);
  }
  50% {
    transform: rotate(-5deg) scale(1);
  }
  75% {
    transform: rotate(5deg) scale(1.04);
  }
}
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .aurora,
  .login-gift,
  .gate-present,
  .reveal-present,
  .head.assigned .bubble {
    animation: none;
  }
}

/* ---- invites ------------------------------------------------------------------------------ */

.invite-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff6d6, #ffe9a3);
  color: #6a4200;
  font-weight: 700;
  text-align: left;
  box-shadow: inset 0 0 0 1.5px #f3d27a;
  animation: pop-in 0.4s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.invite-icon {
  font-size: 26px;
}
.join-form {
  margin-top: 18px;
}
.row.nowrap {
  flex-wrap: nowrap;
}
.join-form input {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
}
.join-form input::placeholder {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.invite-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.invite-panel p {
  margin: 0;
}
.invite-panel > .btn {
  align-self: stretch;
}
.code-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  border: 2px dashed #9cc6f0;
}
.code-box small {
  color: var(--ink-faint);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}
.code-box strong {
  font-size: 30px;
  letter-spacing: 0.08em;
  color: var(--red);
}
