/* North Pole Live. One night-time look across every room. The painted room backgrounds come
   later; for now each room has a simple scene drawn in code. */

@font-face {
  font-family: "Fredoka";
  src: url("/app/fonts/fredoka.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --night: #0d1b3e;
  --night-2: #16306b;
  --night-3: #23458f;
  --snow: #f5f8ff;
  --mist: #c9d6f2;
  --gold: #ffcf5c;
  --gold-2: #f5a623;
  --red: #e2453c;
  --green: #2f9e6e;
  --wood: #7a4a2b;
  --card: rgba(255, 255, 255, 0.08);
  --card-line: rgba(255, 255, 255, 0.14);
  --radius: 22px;
  --font: "Fredoka", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--snow);
  background: radial-gradient(120% 70% at 50% 0%, var(--night-3) 0%, var(--night-2) 35%, var(--night) 75%) fixed;
  background-color: var(--night);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

.shell {
  position: relative; z-index: 1;
  max-width: 560px; margin: 0 auto; min-height: 100%;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px calc(env(safe-area-inset-bottom, 0px) + 112px);
  display: flex; flex-direction: column; gap: 14px;
}

/* ---- top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.15rem; letter-spacing: 0.01em; }
.brand img { border-radius: 9px; }
.sleeps {
  background: var(--gold); color: var(--night);
  font-weight: 700; font-size: 1rem; padding: 7px 14px; border-radius: 999px;
  box-shadow: 0 4px 0 var(--gold-2);
  white-space: nowrap;
}
.test-time {
  margin: 0; font-size: 0.8rem; text-align: center; color: var(--night);
  background: #9fe3c5; border-radius: 10px; padding: 6px 10px;
}

/* ---- a room */
#room { outline: none; display: flex; flex-direction: column; gap: 14px; }
.room-title { margin: 4px 0 0; font-size: clamp(1.7rem, 7vw, 2.3rem); font-weight: 700; line-height: 1.05; }
.room-sub { margin: 0; color: var(--mist); font-size: 1.05rem; line-height: 1.35; }

.scene {
  border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 10;
  background: var(--night-2); box-shadow: inset 0 0 0 1px var(--card-line);
}
.scene svg { display: block; width: 100%; height: 100%; }

.card {
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius);
  padding: 18px 18px 20px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.label { margin: 0 0 4px; color: var(--mist); font-size: 0.95rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; }
.big {
  margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.05;
  font-size: clamp(2.1rem, 10.5vw, 3.4rem); color: var(--gold);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}
.big.small { font-size: clamp(1.6rem, 7.5vw, 2.4rem); color: var(--snow); }
.note { margin: 8px 0 0; color: var(--mist); font-size: 1rem; line-height: 1.4; }
.note strong { color: var(--snow); font-weight: 600; }
.pair { display: grid; grid-template-columns: 1fr; gap: 14px; }

.sacks { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.sacks li { display: flex; justify-content: space-between; gap: 12px; font-size: 1.08rem; }
.sacks li span:last-child { color: var(--mist); white-space: nowrap; }
.sacks li:first-child { color: var(--gold); font-weight: 600; }

/* ---- countdown */
.sleeps-big { text-align: center; padding: 26px 18px 24px; }
.sleeps-big .num {
  display: block; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 0.9;
  font-size: clamp(6rem, 38vw, 10rem); color: var(--gold); text-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}
.sleeps-big .word { display: block; font-size: clamp(1.4rem, 6vw, 1.9rem); font-weight: 600; margin-top: 6px; }
.clock-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.clock-row div { background: rgba(0, 0, 0, 0.18); border-radius: 14px; padding: 10px 4px 8px; text-align: center; }
.clock-row b { display: block; font-size: clamp(1.5rem, 7vw, 2.1rem); font-variant-numeric: tabular-nums; font-weight: 700; }
.clock-row span { font-size: 0.8rem; color: var(--mist); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---- holding screens (quiet, flight, Christmas Day, rest) */
.holding { text-align: center; padding: 28px 18px; }
.holding .room-title { margin-bottom: 8px; }

/* ---- room tabs */
.tabs {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 2;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  width: min(528px, calc(100% - 32px));
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  background: rgba(13, 27, 62, 0.88); border: 1px solid var(--card-line); border-radius: 24px;
  padding: 6px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px;
  border-radius: 18px; color: var(--mist); text-decoration: none; font-size: clamp(0.72rem, 3.3vw, 0.92rem); font-weight: 600; white-space: nowrap;
  min-height: 56px; justify-content: center;
}
.tabs a svg { width: 26px; height: 26px; }
.tabs a[aria-current="page"] { background: var(--gold); color: var(--night); }

.grownups {
  align-self: center; color: var(--mist); font-size: 0.85rem; text-decoration: underline;
  text-underline-offset: 3px; padding: 8px; opacity: 0.85;
}

/* ---- little moving parts in the scenes */
@keyframes slide { from { transform: translateX(0); } to { transform: translateX(-160px); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes glow { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.belt { animation: slide 6s linear infinite; }
.bob { animation: bob 3s ease-in-out infinite; transform-box: fill-box; }
.twinkle { animation: glow 2.4s ease-in-out infinite; }
.d1 { animation-delay: 0.7s; }
.d2 { animation-delay: 1.4s; }
.d3 { animation-delay: 2.1s; }

@media (prefers-reduced-motion: reduce) {
  .belt, .bob, .twinkle { animation: none; }
}

@media (min-width: 600px) {
  .pair { grid-template-columns: 1fr 1fr; }
}

/* ---- version 2 fun: hints, bubbles, taps, doors, crackers, the globe, confetti, sky */
.hint { margin: -6px 0 0; color: var(--mist); font-size: 0.9rem; text-align: center; }
.scene { position: relative; }
[data-tap] { cursor: pointer; }
.bubble {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  background: var(--snow); color: var(--night); font-weight: 600; font-size: 1.05rem;
  padding: 8px 14px; border-radius: 16px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis;
  animation: pop-in 0.25s ease-out;
}
@keyframes pop-in { from { transform: translateX(-50%) scale(0.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

.gift, .elf, .arm { transform-box: fill-box; }
.gift.pop { animation: gift-pop 0.6s ease-out; transform-origin: 50% 100%; }
@keyframes gift-pop { 0% { transform: scale(1); } 30% { transform: translateY(-18px) scale(1.15); } 60% { transform: translateY(0) scale(0.95); } 100% { transform: scale(1); } }
.elf.wave .arm { animation: wave 0.9s ease-in-out; transform-origin: 0% 0%; }
@keyframes wave { 0%, 100% { transform: rotate(0); } 25%, 75% { transform: rotate(-70deg); } 50% { transform: rotate(-40deg); } }
.elf.tumble { animation: tumble 1.4s ease-in-out; transform-origin: 50% 100%; }
@keyframes tumble { 0% { transform: rotate(0); } 30% { transform: rotate(80deg) translateY(6px); } 70% { transform: rotate(80deg) translateY(6px); } 100% { transform: rotate(0); } }
.aurora { animation: aurora 6s ease-in-out infinite; }
@keyframes aurora { 0%, 100% { opacity: 0.6; transform: translateY(0); } 50% { opacity: 1; transform: translateY(3px); } }

.doors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.door {
  font: inherit; aspect-ratio: 3 / 4; border: 0; border-radius: 14px; cursor: pointer; position: relative;
  background: linear-gradient(160deg, #c8382f, #9e2a23); color: var(--snow);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.18), 0 4px 0 #6e1d18;
  display: flex; align-items: center; justify-content: center; padding: 6px;
}
.door:nth-child(3n) { background: linear-gradient(160deg, #2f9e6e, #217552); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.18), 0 4px 0 #165238; }
.door:nth-child(4n+1) { background: linear-gradient(160deg, #3a6fd8, #2a54a8); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.18), 0 4px 0 #1d3c78; }
.door-num { font-weight: 700; font-size: clamp(1.4rem, 6vw, 2rem); }
.door.open { background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2); }
.door.open .door-num { position: absolute; top: 6px; left: 9px; font-size: 0.95rem; color: var(--mist); }
.door-pic svg { width: 100%; height: auto; display: block; }
.door.today { background: linear-gradient(160deg, #ffcf5c, #f5a623); color: var(--night); box-shadow: 0 0 0 3px var(--snow), 0 0 22px 4px rgba(255, 207, 92, 0.75), 0 4px 0 #b9761a; animation: glow-door 1.6s ease-in-out infinite; }
@keyframes glow-door { 50% { box-shadow: 0 0 0 3px var(--snow), 0 0 34px 10px rgba(255, 207, 92, 0.9), 0 4px 0 #b9761a; } }
.door.nope { animation: nope 0.4s ease-in-out; }
@keyframes nope { 20%, 60% { transform: translateX(-5px) rotate(-2deg); } 40%, 80% { transform: translateX(5px) rotate(2deg); } }

.sheet-back {
  position: fixed; inset: 0; z-index: 10; background: rgba(5, 10, 28, 0.6);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
}
.sheet {
  width: min(520px, 100%); background: var(--night-2); border: 1px solid var(--card-line); border-radius: 26px;
  padding: 22px 20px 18px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); animation: sheet-up 0.3s ease-out;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { margin: 0 0 8px; font-size: 1.6rem; }
.sheet p { margin: 0 0 14px; font-size: 1.15rem; line-height: 1.45; }
.door-sheet { text-align: center; }
.door-big svg { width: 120px; height: 120px; }
.btn {
  font: inherit; font-weight: 700; font-size: 1.1rem; color: var(--night); background: var(--gold);
  border: 0; border-radius: 999px; padding: 12px 24px; box-shadow: 0 5px 0 var(--gold-2); cursor: pointer; width: 100%; min-height: 50px;
}

.party { margin: 0 0 6px; font-weight: 700; font-size: 1.25rem; color: var(--night); background: var(--gold); display: inline-block; padding: 4px 14px; border-radius: 999px; }

.cracker, .globe { font: inherit; background: none; border: 0; padding: 0; width: 100%; cursor: pointer; display: block; }
.cracker svg { width: 100%; height: auto; display: block; }
.half { transition: transform 0.5s cubic-bezier(.3, 1.6, .5, 1); }
.cracker.pulled .left { transform: translateX(-14px) rotate(-6deg); }
.cracker.pulled .right { transform: translateX(14px) rotate(6deg); }
.bang { font-family: var(--font); font-weight: 700; font-size: 20px; fill: var(--gold); opacity: 0; }
.cracker.pulled .bang { opacity: 1; transition: opacity 0.2s 0.15s; }
.joke { min-height: 5.5em; }
.joke-q { margin: 6px 0 4px; font-size: 1.1rem; }
.joke-a { margin: 0; font-size: 1.3rem; font-weight: 700; color: var(--gold); }
.globe canvas { width: min(100%, 240px); aspect-ratio: 1; display: block; margin: 0 auto; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.confetti i { position: absolute; width: 9px; height: 14px; border-radius: 2px; }

#flypast {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 74px); left: 0; width: 260px; z-index: 3;
  pointer-events: none; transform: translateX(-280px); opacity: 0;
}
#flypast svg { width: 100%; display: block; }
#flypast.fly { animation: fly 7s linear; }
@keyframes fly {
  0% { transform: translateX(-280px) translateY(0); opacity: 1; }
  50% { transform: translateX(calc(50vw - 130px)) translateY(-14px); }
  100% { transform: translateX(calc(100vw + 20px)) translateY(0); opacity: 1; }
}

#snowbank { position: fixed; left: 0; right: 0; bottom: 0; height: 10px; z-index: 0; pointer-events: none; transition: height 1s ease; }
#snowbank svg { width: 100%; height: 100%; display: block; }

@media (prefers-reduced-motion: reduce) {
  .gift.pop, .elf.wave .arm, .elf.tumble, .aurora, .door.today, .door.nope, #flypast.fly, .bubble, .sheet, .half { animation: none; transition: none; }
}
