@font-face { font-family: "Fredoka"; src: url("/static/fredoka.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
:root {
  --gold: #f3cd6b; --gold2: #c9952e; --red: #b51f31; --wine: #8c1626; --cream: #fbf1df; --ink: #2a140f;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #3d1c14; color: var(--cream); font-family: "Fredoka", ui-rounded, system-ui, sans-serif; font-weight: 500; overflow: hidden; overscroll-behavior: none; }
body { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button { font-family: inherit; }

/* ------------------------------------------------ stage / world */
#stage { position: fixed; inset: 0; overflow: hidden; background: radial-gradient(120% 80% at 50% 30%, #5e2c20, #2a120c); }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; opacity: 0; transition: opacity .8s ease; }
body.ready #world { opacity: 1; }
.scene { position: absolute; inset: 0; display: block; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(140% 100% at 50% 45%, transparent 55%, rgba(20, 6, 3, .55)); }

.flake { animation: fall linear infinite; }
@keyframes fall { from { transform: translate(0, 0); } to { transform: translate(var(--dx), 520px); } }
.bulb { animation: twinkle 2.6s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 45% { opacity: .35; } 60% { opacity: .95; } }
.starglow { animation: breathe 4s ease-in-out infinite; transform-origin: 500px 566px; }
@keyframes breathe { 0%, 100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
.steam { animation: steam 3.5s ease-in-out infinite; }
@keyframes steam { 0%, 100% { opacity: .2; transform: translateY(0); } 50% { opacity: .6; transform: translateY(-6px); } }

/* ------------------------------------------------ doors */
.door { position: absolute; perspective: 800px; cursor: pointer; }
.door .inside, .door .leaf { position: absolute; inset: 0; border-radius: 14px; }
.door .inside { background: radial-gradient(circle at 50% 45%, #ffe7b0, #e9a54a 55%, #7a3b12); box-shadow: inset 0 0 0 4px var(--gold2), inset 0 6px 14px rgba(0, 0, 0, .45); overflow: hidden; display: grid; place-items: center; }
.door .inside .ih { font-size: 40px; color: #d3304b; text-shadow: 0 0 14px #fff3c4; }
.door .inside img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s; }
.door .inside.has-img img { opacity: 1; }
.door .inside.has-img::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 4px var(--gold2), inset 0 0 12px rgba(0,0,0,.5); border-radius: 14px; }
.door .leaf {
  transform-origin: 0 50%; transform-style: preserve-3d;
  background: linear-gradient(150deg, #e2465a 0%, var(--red) 45%, #7d0f1e 100%);
  box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 0 7px rgba(0, 0, 0, .18), inset 0 0 0 9px rgba(243, 205, 107, .55), 0 6px 14px rgba(0, 0, 0, .45);
  display: grid; place-items: center;
  transition: transform 1.15s cubic-bezier(.3, 1.25, .45, 1), filter 1.15s;
}
.door.alt .leaf { background: linear-gradient(150deg, #c9416a 0%, #9d1d3f 50%, #640b24 100%); }
.door .num { font-weight: 700; font-size: 46px; line-height: 1; color: var(--gold); text-shadow: 0 2px 0 #6b3d0a, 0 0 10px rgba(255, 210, 120, .55); letter-spacing: -1px; }
.door .knob { position: absolute; right: 10px; top: 50%; width: 9px; height: 9px; margin-top: -4px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6cf, var(--gold2)); box-shadow: 0 1px 2px rgba(0,0,0,.5); }
.door.open .leaf { transform: rotateY(-84deg); filter: brightness(.75); }
.door .num, .door .knob { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.door.open { cursor: pointer; }
.door.past .leaf { box-shadow: inset 0 0 0 3px var(--gold), 0 4px 10px rgba(0, 0, 0, .35); }
.door .lock { position: absolute; right: -10px; top: -14px; font-size: 26px; opacity: 0; transform: scale(.3); transition: transform .4s cubic-bezier(.3, 1.6, .5, 1), opacity .3s; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.door.locked .lock { opacity: 1; transform: scale(1); }
.door.glow .leaf { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 0 9px rgba(243, 205, 107, .55), 0 0 10px 2px rgba(255, 214, 120, .5); } 50% { box-shadow: inset 0 0 0 3px #fff3c4, inset 0 0 0 9px rgba(255, 236, 170, .8), 0 0 28px 10px rgba(255, 214, 120, .85); } }
.door.rattle .leaf { animation: rattle .6s ease-in-out 2; }
@keyframes rattle { 0%, 100% { transform: rotateY(0); } 20% { transform: rotateY(-14deg); } 40% { transform: rotateY(-4deg); } 60% { transform: rotateY(-11deg); } 80% { transform: rotateY(-2deg); } }
.door.burst::before { content: ""; position: absolute; inset: -60%; border-radius: 50%; background: radial-gradient(circle, rgba(255, 244, 200, .95), rgba(255, 205, 110, .4) 40%, transparent 70%); animation: burst 1.2s ease-out forwards; pointer-events: none; }
@keyframes burst { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }

/* star (door 24) */
.door.star .inside, .door.star .leaf { border-radius: 0; }
.door.star .leaf { background: radial-gradient(circle at 45% 40%, #fff6c8 0%, #f6d063 35%, #d79a22 75%, #9c6510 100%); box-shadow: none; }
.door.star .inside { background: radial-gradient(circle, #fff3c8, #f0b54a 60%, #8d4f0c); box-shadow: none; }
.door.star .num { color: #a3172b; font-size: 54px; margin-top: 10px; text-shadow: 0 1px 0 #fff1c0, 0 0 8px rgba(255, 255, 255, .7); }
.door.star .knob { display: none; }
.door.star .lock { right: 18px; top: 6px; }
.door.star::after { content: ""; position: absolute; inset: 0; pointer-events: none; }

/* hearts / sparkles */
.hearts { position: absolute; inset: 0; pointer-events: none; }
.fheart { position: absolute; opacity: 0; animation: floatUp linear infinite; filter: drop-shadow(0 0 6px rgba(255, 120, 150, .55)); }
@keyframes floatUp {
  0% { transform: translate(0, 0) rotate(-8deg); opacity: 0; }
  10% { opacity: .9; }
  50% { transform: translate(var(--sway), -480px) rotate(8deg); }
  85% { opacity: .75; }
  100% { transform: translate(calc(var(--sway) * -1), -960px) rotate(-6deg); opacity: 0; }
}
.sparkles { position: absolute; inset: 0; pointer-events: none; }
.sparkles span { position: absolute; color: #fff1b0; transform: translate(-50%, -50%); text-shadow: 0 0 8px #ffd25c, 0 0 2px #fff; animation: spark 1.6s ease-in-out infinite; }
@keyframes spark { 0%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(0); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(45deg); } }

/* ------------------------------------------------ overlays */
#greet { position: fixed; left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top) + 22px) 18px 30px; text-align: center; pointer-events: none;
  background: linear-gradient(rgba(30, 10, 6, .72), rgba(30, 10, 6, .35) 65%, transparent); opacity: 0; transform: translateY(-14px); transition: opacity 1.2s ease, transform 1.2s ease; }
#greet.show { opacity: 1; transform: none; }
#greet-text { display: inline-block; font-size: clamp(24px, 7vw, 38px); font-weight: 600; color: var(--cream); text-shadow: 0 2px 10px rgba(0, 0, 0, .6), 0 0 22px rgba(255, 190, 120, .35); line-height: 1.2; }
#countdown { margin: 10px auto 0; display: inline-block; padding: 8px 16px; border-radius: 999px; font-size: 17px; color: #3a1a08; background: linear-gradient(#ffe9a8, #f1c056); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
#countdown[hidden] { display: none; }
#hint { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 9vh); transform: translate(-50%, 10px); padding: 14px 26px; border-radius: 999px; font-size: 22px; font-weight: 600; white-space: nowrap;
  color: var(--ink); background: linear-gradient(#fff4d1, #f3cd6b); box-shadow: 0 8px 24px rgba(0, 0, 0, .45), 0 0 0 3px rgba(255, 255, 255, .35); opacity: 0; transition: opacity .6s, transform .6s; pointer-events: none; }
#hint.show { opacity: 1; transform: translate(-50%, 0); animation: bob 1.8s ease-in-out .6s infinite; }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -6px); } }

#intro { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(25, 8, 5, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity .5s; z-index: 5; }
#intro.show { opacity: 1; }
#intro .card { position: relative; max-width: 360px; width: 100%; text-align: center; padding: 42px 26px 28px; border-radius: 28px; color: var(--ink);
  background: linear-gradient(170deg, #fffaf0, #f6e3c2); box-shadow: 0 20px 60px rgba(0, 0, 0, .55), inset 0 0 0 3px #f3cd6b, inset 0 0 0 8px #fffaf0, inset 0 0 0 10px #e6b84f;
  transform: translateY(20px) scale(.96); transition: transform .6s cubic-bezier(.3, 1.3, .5, 1); }
#intro.show .card { transform: none; }
.card-star { position: absolute; left: 50%; top: -34px; transform: translateX(-50%); font-size: 60px; color: #f3c64e; text-shadow: 0 0 18px rgba(255, 220, 120, .9), 0 3px 0 #b07f16; }
#intro h1 { margin: 0 0 12px; font-size: 30px; line-height: 1.1; font-weight: 700; color: var(--wine); }
#intro p { margin: 0 0 10px; font-size: 18px; line-height: 1.35; font-weight: 400; }
#intro p.small { font-size: 15px; opacity: .75; }
#intro button, #ended button { margin-top: 14px; border: 0; border-radius: 999px; padding: 14px 30px; font-size: 21px; font-weight: 600; color: #fff; cursor: pointer;
  background: linear-gradient(#e04459, #a8182c); box-shadow: 0 6px 16px rgba(140, 20, 40, .45), inset 0 1px 0 rgba(255, 255, 255, .35); }
#intro button:active, #ended button:active { transform: scale(.97); }

#player { position: fixed; inset: 0; z-index: 10; background: #000; display: grid; place-items: center; opacity: 0; transition: opacity .35s; }
#player.show { opacity: 1; }
#player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
#close { position: absolute; top: calc(env(safe-area-inset-top) + 12px); right: 12px; width: 48px; height: 48px; border-radius: 50%; border: 0; font-size: 22px; color: #fff; background: rgba(255, 255, 255, .18); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); cursor: pointer; }
#bigplay { position: absolute; width: 96px; height: 96px; border-radius: 50%; border: 0; font-size: 40px; color: var(--ink); background: linear-gradient(#fff4d1, #f3cd6b); box-shadow: 0 10px 30px rgba(0,0,0,.5); cursor: pointer; padding-left: 8px; }
#ended { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 8vh); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
#ended #again { background: rgba(255, 255, 255, .2); box-shadow: none; }
[hidden] { display: none !important; }
#preview-badge { position: fixed; left: 10px; bottom: 10px; z-index: 20; padding: 4px 10px; border-radius: 8px; font-size: 12px; background: rgba(0, 0, 0, .55); color: #ffd; }

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

/* ------------------------------------------------ simple pages */
body.simple { display: grid; place-items: center; min-height: 100%; background: radial-gradient(120% 90% at 50% 20%, #3b1a2a, #120713 70%); }
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.bigheart { position: relative; font-size: 96px; color: #e8314f; animation: beat 1.6s ease-in-out infinite; filter: drop-shadow(0 0 24px rgba(255, 80, 110, .6)); }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.14); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }
.msg { position: relative; text-align: center; padding: 24px; }
.msg h1 { font-size: 28px; margin: 16px 0 8px; font-weight: 600; }
.msg p { margin: 0; opacity: .75; font-weight: 400; font-size: 18px; }
