/* Secret Santa: night sky, gold type and glass, one screen at a time */

:root {
  --gold-hi: #fff3c8;
  --gold: #f0c463;
  --gold-lo: #b07a2a;
  --cranberry: #c42f3d;
  --pine: #1f6b4f;
  --snow: #eef4ff;
  --paper: #f5ecd9;
  --ink: #2b1d14;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-edge: rgba(255, 255, 255, 0.14);
  --serif: ui-serif, "New York", Georgia, serif;
  --round: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  /* the tab bar floats just above the home line, like the iPhone's own apps */
  --tabs-bottom: max(env(safe-area-inset-bottom) - 14px, 12px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }

/* manipulation is the only value (besides none) that stops iOS double-tap zoom; pinches are stopped in app.js */
html { background: #060e20; touch-action: manipulation; }
/* no rubber-band bounce past the top or bottom, so the village's snowy edge never shows */
html { overscroll-behavior: none; }
/* in iOS 26 home-screen apps, a page shorter than the screen ends a status-bar height above the bottom */
@media (display-mode: standalone) {
  html { min-height: min(100lvh, calc(100% + env(safe-area-inset-top))); }
}
body {
  min-height: 100dvh;
  color: var(--snow);
  font-family: var(--round);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* the sky stays put while screens change on top of it */
.sky {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(130% 70% at 50% -10%, #24508a 0%, #0f2447 42%, #060e20 82%);
}

/* the northern lights */
.sky::before {
  content: "";
  position: absolute;
  inset: -12% -30% auto;
  height: 55%;
  background:
    radial-gradient(38% 42% at 28% 55%, rgba(70, 230, 175, 0.38), transparent 70%),
    radial-gradient(34% 40% at 72% 40%, rgba(125, 140, 255, 0.3), transparent 70%),
    radial-gradient(30% 30% at 50% 70%, rgba(40, 200, 220, 0.2), transparent 70%);
  filter: blur(28px);
  transform: rotate(-9deg);
}

/* two star tiles of different sizes, so the repeat is hard to spot */
.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 23px 41px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 97px 13px, #fff, transparent),
    radial-gradient(1px 1px at 141px 88px, #cfe3ff, transparent),
    radial-gradient(1px 1px at 61px 129px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 17px 171px, #fff8dc, transparent),
    radial-gradient(1px 1px at 201px 57px, #fff, transparent),
    radial-gradient(1px 1px at 233px 199px, #cfe3ff, transparent);
  background-size: 173px 211px, 241px 197px, 173px 211px, 241px 197px, 173px 211px, 241px 197px, 241px 197px;
  opacity: 0.75;
  mask-image: linear-gradient(#000 0 55%, transparent 85%);
}

/* each flake layer falls one tile height per loop, so the loop is seamless */
.snow {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2.5px 2.5px at 30px 60px, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1.8px 1.8px at 110px 150px, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(3.5px 3.5px at 170px 30px, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(2px 2px at 70px 210px, rgba(255, 255, 255, 0.75), transparent);
  background-size: 190px 240px, 230px 260px, 260px 300px, 210px 250px;
  animation: snowfall 14s linear infinite;
}
@keyframes snowfall {
  to { background-position: 20px 240px, -30px 520px, 40px 300px, -10px 500px; }
}
@media (prefers-reduced-motion: reduce) {
  .snow { animation: none; }
}

.screen {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 24px) 24px calc(env(safe-area-inset-bottom) + 24px);
  text-align: center;
}
.actions { margin-top: auto; padding-top: 28px; }
.small-print { margin-top: 12px; font-size: 13px; color: rgba(238, 244, 255, 0.5); }

/* ---------- shared pieces ---------- */


.eyebrow { font: 700 12px var(--round); letter-spacing: 3px; text-transform: uppercase; color: var(--gold); }

.gold-text {
  background: linear-gradient(180deg, var(--gold-hi) 0%, var(--gold) 48%, var(--gold-lo) 100%);
  -webkit-background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 14px rgba(240, 196, 99, 0.35));
}

.title { font: 600 34px/1.1 var(--serif); letter-spacing: -0.5px; }
.muted { color: rgba(238, 244, 255, 0.62); font-size: 15px; line-height: 1.45; }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: 24px;
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 56px;
  border-radius: 28px;
  font: 700 17px var(--round);
}
.button.gold {
  color: #3a2508;
  background: linear-gradient(180deg, #ffe9a8, #f0c463 55%, #d39a3c);
  box-shadow: 0 10px 30px rgba(240, 196, 99, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.button.ghost { color: var(--snow); background: var(--glass); border: 1px solid var(--glass-edge); }

/* floating glass tab bar */
.tabs {
  position: fixed;
  left: 22px;
  right: 22px;
  bottom: var(--tabs-bottom);
  height: 66px;
  padding: 6px;
  display: flex;
  border-radius: 33px;
  background: rgba(16, 26, 50, 0.6);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  z-index: 9;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 27px;
  font: 600 11px var(--round);
  color: rgba(238, 244, 255, 0.55);
}
.tab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--gold); background: rgba(255, 255, 255, 0.1); }

/* pine silhouettes + a snow drift along the bottom */
.horizon { position: absolute; inset: auto 0 0; height: 260px; z-index: 1; }
.pines {
  position: absolute;
  inset: auto 0 70px;
  height: 150px;
  background: #081329;
  clip-path: polygon(0 100%, 0 55%, 6% 20%, 12% 55%, 15% 40%, 21% 8%, 27% 45%, 31% 60%, 36% 35%, 41% 62%, 60% 66%, 66% 30%, 71% 0%, 77% 42%, 81% 30%, 87% 14%, 93% 50%, 97% 38%, 100% 52%, 100% 100%);
}
.drift {
  position: absolute;
  inset: auto -20% -60px;
  height: 160px;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(180deg, #dfe9fb, #9fb4d9 70%);
  box-shadow: 0 -10px 40px rgba(190, 215, 255, 0.25);
}

/* ---------- 1. install ---------- */

.app-icon {
  width: 88px;
  height: 88px;
  border-radius: 21px;
  margin: 16px auto 8px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(70% 60% at 30% 20%, rgba(70, 230, 175, 0.45), transparent 70%),
    radial-gradient(120% 90% at 50% 0%, #2a5a9a, #0b1a38 75%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 20px 50px rgba(240, 196, 99, 0.25), 0 0 80px rgba(70, 230, 175, 0.2);
}
.app-icon svg { width: 50px; height: 50px; }
.icon-label { text-align: center; font: 600 13px system-ui; margin-bottom: 16px; }

.steps { padding: 4px 18px; text-align: left; }
.intro { margin: 10px 0 20px; text-wrap: balance; }
.step { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.step + .step { border-top: 1px solid rgba(255, 255, 255, 0.08); }
.step-number {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 800 15px var(--round);
  color: #3a2508;
  background: linear-gradient(180deg, #ffe9a8, #e0aa48);
}
.step-text { flex: 1; font-size: 16px; line-height: 1.3; }
.step-text b { color: var(--gold-hi); }
.chip {
  flex: none;
  height: 34px;
  min-width: 34px;
  padding: 0 9px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  font: 700 15px system-ui;
}
.chip svg { width: 18px; height: 18px; fill: none; stroke: #8ec2ff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* room for START HERE, which is 52pt tall */
#install { padding-bottom: 64px; }

/* the page already stops above Safari's toolbar, whose buttons start 16pt below the page's edge
   (measured on an iOS 26 iPhone), and Safari clips anything past that edge, so the arrow rests on it,
   above the page button, which sits 114pt from the left edge on every iPhone width */
.start-here {
  position: fixed;
  left: 114px;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 9;
  text-align: center;
  font: 800 13px var(--round);
  color: var(--gold);
  letter-spacing: 1px;
  white-space: nowrap;
  filter: drop-shadow(0 0 8px rgba(240, 196, 99, 0.55));
}
.start-here svg {
  display: block;
  margin: 2px auto 0;
  width: 20px;
  height: 34px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: nudge 1.4s ease-in-out infinite;
}
/* bounces up, not down, so the tip never crosses into the toolbar */
@keyframes nudge { 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .start-here svg { animation: none; } }

/* only tall phones (Plus, Pro Max) have room for the big icon; the rest lose it so the guide never scrolls,
   because scrolling shrinks Safari's toolbar and moves the button START HERE points at */
@media (max-height: 700px) {
  #install .app-icon, #install .icon-label { display: none; }
  #install .title { margin-top: 18px; }
}

/* ---------- people: a glossy bauble in each person's colour ---------- */

.bauble {
  --size: 46px;
  position: relative;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffffff 0 5%, var(--tint) 30%, color-mix(in srgb, var(--tint), #000 55%) 100%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45), 0 0 18px color-mix(in srgb, var(--tint), transparent 55%);
}
.bauble::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(var(--size) * -0.1);
  translate: -50%;
  width: calc(var(--size) * 0.26);
  height: calc(var(--size) * 0.15);
  border-radius: 2px;
  background: linear-gradient(90deg, #a8742a, #ffe9a8, #a8742a);
}
.person { display: flex; flex-direction: column; align-items: center; gap: 10px; font: 700 13px var(--round); color: rgba(238, 244, 255, 0.6); }
.person.picked { color: var(--gold); }
.person.picked .bauble { box-shadow: 0 0 0 3px var(--gold), 0 0 30px rgba(240, 196, 99, 0.8); }

.confetti { position: absolute; inset: 0; z-index: 1; }
.confetti { position: fixed; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 7px; height: 13px; border-radius: 2px; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(110dvh) rotate(540deg); } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }
#christmas { position: relative; z-index: 2; text-align: center; }
.christmas-title { font-size: 42px; margin-top: 6px; }
.own-up { margin-top: 20px; padding: 16px 12px 18px; }
.own-up strong { display: block; font: 700 16px var(--round); margin-bottom: 14px; }
.own-up .bauble { --size: 56px; }
.own-up .suspects { margin-top: 0; }
.reveal-list { text-align: left; }
.reveal-row .bauble.waiting { opacity: 0.3; }

.header-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.countdown {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 8px;
  border-radius: 20px;
  font: 700 14px var(--round);
  /* held down for the secret switch, so no text selection or iOS callout */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.countdown svg { width: 26px; height: 26px; }

/* ---------- 2. who's this ---------- */

.people-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 34px 0; margin-top: 44px; }
.people-grid .bauble { --size: 96px; }
.big-title { font-size: 44px; margin: 10px 0 8px; }
/* room for the italic ? to lean out, or the gold fill cuts it off */
.big-title .gold-text { padding-right: 0.15em; }
.people-grid .person { gap: 16px; font: 600 21px var(--serif); color: var(--snow); }
.people-grid .person.picked { color: var(--gold); }

/* ---------- 3 + 4. wish lists ---------- */

.person-strip { display: flex; justify-content: space-between; margin: 26px 8px 0; }
.person-strip .bauble { --size: 50px; }
.list-card { margin-top: 22px; padding: 18px 18px 4px; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.list-head h2 { font: 600 24px var(--serif); }
.list-head small { display: block; font: 600 13px var(--round); color: rgba(238, 244, 255, 0.5); margin-top: 2px; }
.budget-pill { padding: 6px 12px; border-radius: 12px; background: rgba(240, 196, 99, 0.14); border: 1px solid rgba(240, 196, 99, 0.35); font: 800 13px var(--round); color: var(--gold); }
.list-card, .sheet { text-align: left; }
.wish { display: flex; align-items: center; gap: 12px; padding: 14px 0; }
.wish + .wish { border-top: 1px solid rgba(255, 255, 255, 0.08); }
.wish .glyph { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(240, 196, 99, 0.1); }
.wish .glyph svg { width: 22px; height: 22px; }
.wish .text { flex: 1; font-size: 13px; line-height: 1.35; color: rgba(238, 244, 255, 0.55); }
.wish .text strong { display: block; font: 700 16px var(--round); color: var(--snow); }
.wish .remove { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.06); }
.wish .remove svg { width: 14px; height: 14px; fill: none; stroke: rgba(238, 244, 255, 0.55); stroke-width: 2.4; stroke-linecap: round; }
.wish .link { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: rgba(142, 194, 255, 0.14); }
.wish .link svg { width: 16px; height: 16px; fill: none; stroke: #8ec2ff; stroke-width: 2.2; stroke-linecap: round; }
#wishes:not(:empty) + .wish.add { border-top: 1px solid rgba(255, 255, 255, 0.08); }
.wish.add { width: 100%; color: var(--gold); font: 700 16px var(--round); }
.wish.add .glyph { border: 1.5px dashed rgba(240, 196, 99, 0.5); background: none; }
.wish.add .glyph svg { width: 18px; height: 18px; fill: none; stroke: var(--gold); stroke-width: 2.4; stroke-linecap: round; }
.list-note { text-align: center; font-size: 13px; margin-top: 16px; }

/* screens with the tab bar leave room for it, so the last row never hides behind it */
.screen.tabbed { padding-bottom: calc(var(--tabs-bottom) + 96px); }


.sheet {
  inset: auto 0 0;
  border: 0;
  width: 100%;
  max-width: none;
  max-height: 92dvh;
  margin: 0;
  color: var(--snow);
  padding: 12px 24px calc(env(safe-area-inset-bottom) + 24px);
  border-radius: 32px 32px 0 0;
  background: linear-gradient(180deg, #17264d, #0c1630);
  border-top: 1px solid var(--glass-edge);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
}
.sheet::backdrop { background: rgba(2, 5, 14, 0.62); }
.sheet[open] { animation: slide-up 0.3s ease-out; }
@keyframes slide-up { from { transform: translateY(100%); } }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); margin: 0 auto 18px; }
.sheet h2 { font: 600 26px var(--serif); margin-bottom: 18px; }
.field { margin-bottom: 14px; }
.field { display: block; text-align: left; }
.field-name { display: block; font: 700 12px var(--round); letter-spacing: 1.5px; text-transform: uppercase; color: rgba(238, 244, 255, 0.5); margin-bottom: 7px; }
.field .input { height: 50px; border-radius: 14px; padding: 0 16px; display: flex; align-items: center; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--glass-edge); font: 600 17px var(--round); }
.field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: inherit; font: inherit; }
.field input::placeholder { color: rgba(238, 244, 255, 0.35); font-weight: 500; }
.field .input:focus-within { border-color: var(--gold); }
.sheet-error { margin-top: 12px; font: 600 14px var(--round); color: #ff9a9a; }
.sheet .button { margin-top: 22px; }

/* ---------- 5. guess your santa ---------- */

.suspects { display: flex; justify-content: space-around; margin-top: 32px; }
.suspects .bauble { --size: 80px; }
.suspects .person { gap: 14px; font: 600 19px var(--serif); color: rgba(238, 244, 255, 0.5); }
.suspects .person.picked { color: var(--gold); }
.suspects .person:not(.picked) .bauble { opacity: 0.6; }
.case-notes { margin-top: 30px; padding: 18px 20px; }
.case-notes small { font: 700 12px var(--round); letter-spacing: 1.5px; text-transform: uppercase; color: rgba(238, 244, 255, 0.5); }
.case-notes { display: block; text-align: left; }
.case-notes textarea { display: block; width: 100%; margin-top: 8px; resize: none; border: 0; outline: 0; background: none; font: italic 500 19px/1.35 var(--serif); color: var(--gold-hi); }
.case-notes textarea::placeholder { color: rgba(255, 233, 176, 0.35); }
.guess-status { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 14px 18px; font-size: 14px; color: rgba(238, 244, 255, 0.6); }
.guess-status { text-align: left; }
.guess-status strong { display: block; font: 700 16px var(--round); color: var(--snow); }
.huddle { display: flex; padding-left: 8px; }
.huddle .bauble { --size: 28px; margin-left: -8px; }
.huddle .bauble.waiting { opacity: 0.25; }
.guess-actions { margin-top: 20px; }

/* ---------- 6 + 7. the games: Stack and Chimney Drop ---------- */

.game-sky { background: radial-gradient(120% 60% at 50% 0%, rgba(29, 63, 114, 0.9), rgba(11, 26, 58, 0.6) 50%, transparent 90%); }
.play { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
/* the tab bar slides away while a present is moving, and comes back when you pause */
.tabs { transition: translate 0.3s, opacity 0.3s, visibility 0.3s; }
.playing ~ .tabs { translate: 0 120%; opacity: 0; visibility: hidden; }

/* while a game runs nothing else moves or re-blurs, so the phone only redraws the moving present */
body:has(.playing) .snow { animation-play-state: paused; }
.playing .glass { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(12, 22, 48, 0.8); }
.tower, .mover { will-change: translate; }
.moon {
  position: absolute;
  right: 44px;
  top: calc(env(safe-area-inset-top) + 64px);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #fffaf0, #f1e4c6 60%, #d8c49a);
  box-shadow: 0 0 60px 18px rgba(255, 240, 200, 0.18);
}
.hud { position: absolute; inset: calc(env(safe-area-inset-top) + 14px) 20px auto; height: 40px; display: grid; place-items: center; z-index: 5; }
/* plain words, not a pill, so it reads as a label rather than a button */
.hud .target { font: 700 11px var(--round); letter-spacing: 2px; text-transform: uppercase; color: rgba(238, 244, 255, 0.5); }
.hud .target em { font-style: normal; color: var(--gold); }
.pause, .back { position: absolute; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.pause { right: 0; }
.back { left: 0; }
.pause svg, .back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
/* mid-game the back button hides with the tab bar, so a stray tap can't leave the game */
.playing .back { visibility: hidden; }
.score { position: absolute; inset: calc(env(safe-area-inset-top) + 56px) 0 auto; text-align: center; font: 600 84px/1 var(--serif); z-index: 5; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.5); }
.toast { position: absolute; inset: calc(env(safe-area-inset-top) + 150px) 0 auto; text-align: center; font: 800 15px var(--round); letter-spacing: 4px; z-index: 5; }
.toast.red { color: #ffb4b4; }
.streak { position: absolute; inset: calc(env(safe-area-inset-top) + 180px) 0 auto; display: flex; justify-content: center; align-items: center; gap: 6px; z-index: 5; font: 700 11px var(--round); letter-spacing: 1.5px; text-transform: uppercase; color: rgba(238, 244, 255, 0.55); }
.streak i { width: 20px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); }
.streak i.on { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.streak span { margin-left: 6px; }

.tower { position: absolute; left: 0; right: 0; bottom: calc(var(--tabs-bottom) + 92px); height: 100%; transition: translate 0.3s ease-out; }
.snowbank { position: absolute; left: -15%; right: -15%; top: calc(100% - 4px); height: 100vh; border-radius: 50% 50% 0 0 / 46px 46px 0 0; background: linear-gradient(180deg, #e3ecfb, #a9bde0 140px, #6f86b3); }
.mover { position: absolute; inset: 0; }
.gift {
  position: absolute;
  left: calc(50% + var(--x) - var(--w) / 2);
  bottom: var(--y);
  width: var(--w);
  height: var(--h);
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent calc(50% - var(--band, 7px)), var(--ribbon) calc(50% - var(--band, 7px)) calc(50% + var(--band, 7px)), transparent calc(50% + var(--band, 7px))),
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 42%, rgba(0, 0, 0, 0.22)),
    var(--wrap, none),
    var(--colour);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 3px 6px rgba(0, 0, 0, 0.35);
}
.gift.with-bow::before,
.gift.with-bow::after {
  content: "";
  position: absolute;
  bottom: calc(100% - 4px);
  left: 50%;
  width: 22px;
  height: 15px;
  border: 5px solid var(--ribbon);
  border-radius: 50%;
}
.gift.with-bow::before { translate: -100% 0; rotate: 18deg; }
.gift.with-bow::after { rotate: -18deg; }
.ghost-gift { opacity: 0.14; translate: calc(var(--direction) * var(--trail) * -16px) 0; }
.drop-guide { position: absolute; left: 50%; width: 0; border-left: 2px dashed rgba(240, 196, 99, 0.35); z-index: 1; }
.milestone {
  position: absolute;
  left: 16px;
  right: 16px;
  border-top: 1.5px dashed rgba(238, 244, 255, 0.28);
  font: 700 11px var(--round);
  letter-spacing: 2px;
  color: rgba(238, 244, 255, 0.55);
  padding-top: 5px;
  text-align: left;
  text-transform: uppercase;
  z-index: 0;
}
.milestone.passed { border-color: rgba(240, 196, 99, 0.5); color: var(--gold); }
.milestone.passed::after { content: " \2713"; }
.tap-hint { position: absolute; left: 50%; top: 46%; translate: -50% 0; padding: 9px 18px; border-radius: 99px; background: rgba(8, 14, 34, 0.72); backdrop-filter: blur(10px); text-align: center; font: 700 13px var(--round); letter-spacing: 3px; color: rgba(238, 244, 255, 0.55); z-index: 5; }

.village {
  position: absolute;
  inset: auto 0 0;
  height: 190px;
  z-index: 1;
  /* the snowy ground is drawn wider and deeper than the screen; without this the results page scrolls sideways */
  overflow: hidden;
}
.village .roofs {
  position: absolute;
  inset: 0 0 60px;
  background: #091530;
  clip-path: polygon(0 100%, 0 60%, 8% 35%, 16% 60%, 16% 45%, 26% 20%, 36% 45%, 36% 100%, 62% 100%, 62% 50%, 70% 30%, 78% 50%, 78% 38%, 90% 12%, 100% 40%, 100% 100%);
}
.window { position: absolute; width: 9px; height: 11px; border-radius: 2px; background: #ffd27a; box-shadow: 0 0 12px rgba(255, 200, 100, 0.8); }
.village .ground { position: absolute; inset: auto -10% -40px; height: 110px; border-radius: 50% 50% 0 0; background: linear-gradient(180deg, #e3ecfb, #a9bde0); }

.result { position: absolute; left: 24px; right: 24px; top: calc(env(safe-area-inset-top) + 16px); padding: 22px 20px 20px; text-align: center; z-index: 6; }
.result .big { font: 600 80px/1 var(--serif); }
.result .label { font: 700 13px var(--round); letter-spacing: 3px; color: rgba(238, 244, 255, 0.6); margin-top: 4px; }
.unlock { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: rgba(240, 196, 99, 0.12); border: 1px solid rgba(240, 196, 99, 0.3); text-align: left; margin: 14px 0 16px; }
.swatch { flex: none; width: 42px; height: 42px; border-radius: 9px; }
.unlock.locked { background: var(--glass); border-color: var(--glass-edge); }
.unlock.locked strong { color: var(--snow); }
.unlock.locked .swatch { opacity: 0.45; }
.unlock .text { font-size: 13px; color: rgba(238, 244, 255, 0.65); }
.unlock strong { display: block; font-size: 15px; color: var(--gold-hi); }
.segmented { display: flex; padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); margin: 18px 0 6px; }
.segmented button { flex: 1; padding: 8px 0; border-radius: 10px; font: 700 13px var(--round); color: rgba(238, 244, 255, 0.5); }
.segmented .on { background: rgba(255, 255, 255, 0.12); color: var(--snow); }
.board-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; text-align: left; }
.board-row .rank { width: 16px; font: 800 15px var(--round); color: rgba(238, 244, 255, 0.45); }
.board-row .bauble { --size: 30px; }
.board-row .name { flex: 1; font: 700 16px var(--round); }
.board-row .points { font: 800 18px var(--round); }
.board-row.me { border-radius: 14px; background: rgba(240, 196, 99, 0.12); }
.board-row.me .name, .board-row.me .points { color: var(--gold); }
.board-row.waiting { opacity: 0.5; }
.board-row.waiting .points { font: 600 13px var(--round); }
.board { margin-bottom: 14px; font-size: 14px; color: rgba(238, 244, 255, 0.6); }
.result .buttons { display: flex; gap: 10px; }
.result .buttons .button { flex: 1; }

/* chimney drop: the sleigh stays put and the street slides under it */
.sleigh { position: absolute; left: 22px; top: calc(env(safe-area-inset-top) + 236px); width: 120px; height: 64px; z-index: 4; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5)); animation: bob 2.4s ease-in-out infinite; }
.sleigh svg { width: 100%; height: 100%; }
@keyframes bob { 50% { translate: 0 -5px; } }

.side-pill { position: absolute; top: calc(env(safe-area-inset-top) + 182px); padding: 7px 12px; border-radius: 16px; background: rgba(12, 22, 48, 0.72); font: 700 12px var(--round); letter-spacing: 1px; z-index: 5; }
.wind { left: 20px; }
.spares { right: 20px; display: flex; gap: 6px; }
.spares svg { width: 18px; height: 18px; }
.spares svg.lost { opacity: 0.2; }

/* streaks of wind blowing across the sky, faster for a stronger wind, flipped for a wind from the right */
.gusts i { position: absolute; left: 0; width: 80px; height: 1.5px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5)); z-index: 2; animation: gust calc(3.2s / (1 + var(--strength, 1))) linear infinite; }
.gusts i:nth-child(1) { top: 36%; animation-delay: -0.5s; }
.gusts i:nth-child(2) { top: 50%; animation-delay: -1.1s; }
.gusts i:nth-child(3) { top: 62%; }
.gusts.left i { scale: -1 1; animation-direction: reverse; }
@keyframes gust { from { translate: -100px 0; } to { translate: 100vw 0; } }

/* hidden until chimney.js fades it in for a moment */
.wind-warning { position: absolute; inset: 44% 0 auto; text-align: center; opacity: 0; pointer-events: none; z-index: 5; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.wind-warning .arrows { font: 800 34px var(--round); letter-spacing: 2px; color: var(--gold); }
.wind-warning .words { margin-top: 4px; font: 800 15px var(--round); letter-spacing: 4px; }

/* the street is a point on the ground line: houses stand on it and presents fall to it */
.street { position: absolute; left: 0; bottom: calc(var(--tabs-bottom) + 64px); z-index: 2; will-change: translate; }
.drifts { position: absolute; inset: auto -10% 0; height: calc(var(--tabs-bottom) + 70px); border-radius: 50% 50% 0 0 / 30px 30px 0 0; background: linear-gradient(180deg, #e3ecfb, #a9bde0 120px, #6f86b3); z-index: 3; }
.house { position: absolute; bottom: 0; height: calc(var(--wall) + var(--roof)); isolation: isolate; }
.house::before { content: ""; position: absolute; inset: 0 -6px; background: #e9f0fb; clip-path: polygon(0 var(--roof), 50% 0, 100% var(--roof), 100% calc(var(--roof) + 8px), 0 calc(var(--roof) + 8px)); }
.house::after { content: ""; position: absolute; inset: 8px 0 0; background: linear-gradient(#162a52, #0a1630); clip-path: polygon(0 calc(var(--roof) - 2px), 50% 0, 100% calc(var(--roof) - 2px), 100% 100%, 0 100%); }
.house .window { z-index: 1; left: 24%; bottom: calc(var(--wall) * 0.4); background: #24304f; box-shadow: none; transition: background 0.4s, box-shadow 0.4s; }
.house .window + .window { left: auto; right: 24%; }
.house.delivered .window { background: #ffd27a; box-shadow: 0 0 12px rgba(255, 200, 100, 0.8); }
.chimney { position: absolute; bottom: 0; z-index: -1; background: repeating-linear-gradient(0deg, #7d2727 0 9px, #561919 9px 10px); }
.chimney::before { content: ""; position: absolute; left: -5px; right: -5px; top: -7px; height: 10px; border-radius: 6px; background: #eef4ff; }
.chimney.target::after { content: ""; position: absolute; left: 50%; top: -34px; width: 74px; height: 44px; translate: -50% 0; border-radius: 50%; background: radial-gradient(rgba(255, 216, 130, 0.6), transparent 70%); animation: glow 0.9s ease-in-out infinite alternate; }
@keyframes glow { from { scale: 0.8; } }
/* its own layer, so moving it each frame doesn't redraw the street */
.gift.flying { --band: 3px; will-change: transform; }


/* ---------- 8. crackers ---------- */

.progress { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); margin-top: 10px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #d39a3c, #ffe9a8); transition: width 0.4s; }
.progress-label { display: flex; justify-content: space-between; font: 700 13px var(--round); color: rgba(238, 244, 255, 0.6); margin-top: 16px; }
.progress-label b { color: var(--gold); }

/* runs edge to edge, so the pulled halves can fly off the sides without widening the page */
.cracker { position: relative; height: 380px; margin: auto -24px; overflow-x: clip; }
.cracker:not(.pulled) { touch-action: none; }
.cracker:not(.pulled) :is(.torn, .crown, .bang, .slip) { display: none; }

.cracker-half { position: absolute; top: 56px; height: 58px; width: 150px; display: flex; z-index: 3; transition: translate 0.08s linear; }
.cracker-half .body {
  flex: 1;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 18%, var(--ribbon) 18% 24%, transparent 24% 76%, var(--ribbon) 76% 82%, transparent 82%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 40%, rgba(0, 0, 0, 0.3)),
    repeating-linear-gradient(60deg, rgba(255, 255, 255, 0.08) 0 6px, transparent 6px 14px),
    var(--colour);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}
.cracker-half .end {
  width: 46px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(0, 0, 0, 0.25)),
    var(--colour);
  clip-path: polygon(0 32%, 100% 0, 92% 12%, 100% 25%, 92% 38%, 100% 50%, 92% 62%, 100% 75%, 92% 88%, 100% 100%, 0 68%);
}
.cracker-half.left { left: calc(50% - 150px); translate: calc(-1 * var(--stretch)) 0; }
.cracker-half.left .end { order: -1; scale: -1 1; }
.cracker-half.right { left: 50%; translate: var(--stretch) 0; }
.pulled .cracker-half { transition: translate 0.5s cubic-bezier(0.2, 1.5, 0.4, 1), rotate 0.5s cubic-bezier(0.2, 1.5, 0.4, 1); }
.pulled .cracker-half.left { translate: -80px 0; rotate: -14deg; }
.pulled .cracker-half.right { translate: 80px 0; rotate: 14deg; }
.cracker-half .torn { width: 10px; background: #f3d6a0; clip-path: polygon(0 0, 100% 8%, 30% 20%, 100% 34%, 20% 50%, 100% 64%, 30% 78%, 100% 92%, 0 100%); }
.cracker-half.left .torn { order: 2; }
.cracker-half.right .torn { order: -2; scale: -1 1; }

.crown { position: absolute; left: calc(50% - 48px); top: 18px; rotate: -6deg; width: 96px; height: 52px; z-index: 4; animation: pop-out 0.5s 0.1s both cubic-bezier(0.2, 1.5, 0.4, 1); }
.bang { position: absolute; inset: 40px 0 auto; font: 700 54px var(--serif); z-index: 5; pointer-events: none; animation: bang 0.7s both; }
@keyframes pop-out { from { translate: 0 50px; scale: 0.3; opacity: 0; } }
@keyframes bang { from { scale: 0.4; } 25% { scale: 1.15; opacity: 1; } to { scale: 1.5; opacity: 0; } }
.slip {
  display: block;
  position: absolute;
  left: 34px;
  right: 34px;
  top: 120px;
  font: inherit;
  animation: pop-out 0.5s 0.25s both;
  padding: 30px 26px 28px;
  border-radius: 6px;
  rotate: -2deg;
  color: var(--ink);
  background:
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(120, 90, 50, 0.08) 31px 32px),
    linear-gradient(180deg, #fbf5e8, #efe3c9);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5);
  z-index: 3;
}
.slip .q { display: block; font: 600 24px/1.25 var(--serif); }
.slip .a { display: block; font: italic 600 26px/1.2 var(--serif); color: var(--cranberry); margin-top: 18px; transition: filter 0.3s; }
/* the punchline stays blurred until someone taps, so it can be read out round the table first */
.slip:not(.revealed) .a { filter: blur(9px); }
.slip:not(.revealed)::after { content: "Tap for the answer"; display: block; margin-top: 12px; font: 700 11px var(--round); letter-spacing: 2px; text-transform: uppercase; color: #a98a62; }
.slip .no { position: absolute; right: 16px; top: 12px; font: 700 11px var(--round); letter-spacing: 2px; color: #a98a62; }
.cracker-actions { margin-top: auto; padding-top: 20px; }
.cracker-actions .muted { text-align: center; margin-top: 12px; font-size: 13px; }

/* ---------- 9. christmas day ---------- */

.sleuths { text-align: center; margin-top: 22px; }
.sleuths svg { width: 54px; height: 30px; }
.sleuths .names { font: 600 32px var(--serif); margin-top: 4px; }
.reveal-list { margin-top: 20px; padding: 4px 18px; }
.reveal-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.reveal-row + .reveal-row { border-top: 1px solid rgba(255, 255, 255, 0.08); }
.reveal-row .bauble { --size: 34px; }
.reveal-row .text { flex: 1; font-size: 13px; color: rgba(238, 244, 255, 0.55); }
.reveal-row .text strong { display: block; font: 700 16px var(--round); color: var(--snow); }
.verdict { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 900 15px system-ui; }
.verdict.right { background: rgba(70, 230, 175, 0.18); color: #6fe7b8; }
.verdict.wrong { background: rgba(196, 47, 61, 0.25); color: #ff8a95; }
.champion { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 14px 18px; font-size: 14px; color: rgba(238, 244, 255, 0.6); }
.champion strong { display: block; font: 700 16px var(--round); color: var(--snow); }

.button:disabled { opacity: 0.45; box-shadow: none; cursor: default; }

/* ---------- 10. the Games tab and the Stats tab ---------- */

#games, #stats { text-align: left; }
#games .eyebrow, #stats .eyebrow { margin-top: 8px; }
#games .title, #stats .title { margin-top: 4px; }
#games .muted { margin-top: 6px; }
.section-label { margin: 22px 4px 8px; font: 800 11px var(--round); letter-spacing: 2.5px; text-transform: uppercase; color: rgba(238, 244, 255, 0.5); }

/* each game keeps one colour wherever it shows up */
.game-icon { flex: none; width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.game-icon svg { width: 40px; height: 40px; fill: none; stroke: #ffe9a8; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.game-icon.stack { background: linear-gradient(160deg, #d8434f, #8e1f2b); }
.game-icon.drop { background: linear-gradient(160deg, #3b63c4, #1c2f6b); }
.game-icon.crackers { background: linear-gradient(160deg, #2c8a63, #144a37); }

.game-card { display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px; margin-top: 14px; text-align: left; }
.game-card .text { flex: 1; }
.game-card strong { display: block; font: 600 24px/1.1 var(--serif); }
.game-card .how { display: block; margin-top: 4px; font-size: 13px; line-height: 1.35; color: rgba(238, 244, 255, 0.6); }
.game-card .best { display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 10px; font: 700 12px var(--round); background: rgba(240, 196, 99, 0.12); color: var(--gold); }
.game-card .best:empty { display: none; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.tile { padding: 14px 12px 12px; border-radius: 18px; }
.tile b { display: block; font: 600 30px/1 var(--serif); }
.tile b.gold-text { padding-bottom: 2px; }
.tile span { display: block; margin-top: 6px; font: 700 11px/1.3 var(--round); color: rgba(238, 244, 255, 0.55); }

.league { padding: 6px 12px; border-radius: 20px; }
.league .row { display: grid; grid-template-columns: 1fr repeat(var(--columns), 50px); align-items: center; height: 44px; font: 700 15px var(--round); font-variant-numeric: tabular-nums; text-align: right; }
.league .row + .row { border-top: 1px solid rgba(255, 255, 255, 0.07); }
.league .row.head { height: 30px; font: 800 10px var(--round); letter-spacing: 1.5px; color: rgba(238, 244, 255, 0.45); }
.league .who { display: flex; align-items: center; gap: 10px; text-align: left; }
.league .who .bauble { --size: 24px; }
.league .lead { color: var(--gold); }

.chart-card { padding: 14px 14px 10px; border-radius: 20px; }
.chart-card svg { display: block; width: 100%; overflow: visible; }
.chart-card text { font: 700 11px var(--round); fill: rgba(238, 244, 255, 0.75); }
.chart-card text.axis { font-weight: 600; fill: rgba(238, 244, 255, 0.4); }
.chart-card .key { display: flex; gap: 14px; margin-top: 8px; font: 600 11px var(--round); color: rgba(238, 244, 255, 0.5); }
.chart-card .key i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); }
.chart-card .key i.mean { rotate: 45deg; background: var(--gold); }

.fact { display: flex; gap: 12px; align-items: flex-start; padding: 14px; margin-top: 10px; border-radius: 18px; }
.fact .bauble { --size: 30px; margin-top: 2px; }
.fact strong { display: block; font: 700 15px var(--round); }
.fact span { display: block; margin-top: 2px; font-size: 13px; line-height: 1.4; color: rgba(238, 244, 255, 0.6); }
.fact em { font-style: normal; color: var(--gold); }
