@font-face { font-family: 'Rami'; src: url('fonts/rami-riolic.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'Evolventa'; src: url('fonts/evolventa.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Evolventa'; src: url('fonts/evolventa-bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --blue: #336071; --blue-dark: #27505f; --olive: #4d6e6d; --choc: #a08470; --choc-text: #735a49;
  --sky: #e6f1f7; --cream: #f9f3e7; --pink: #f9edef; --vanilla: #fffdf9; --red: #c94a44;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; background: var(--blue); }
body { font-family: 'Evolventa', system-ui, sans-serif; color: var(--blue); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }

#scroll { height: 100vh; height: 100dvh; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; background: var(--blue); }
#calendar {
  max-width: 560px; margin: 0 auto; min-height: 100%;
  padding-top: calc(var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px));
}
#calendar > svg { display: block; width: 100%; height: auto; overflow: hidden; }
/* сніг під будинком триває до самого низу */
#calendar.ready { background: linear-gradient(var(--blue) 70%, var(--vanilla) 70%); padding-bottom: 0; }
.after-snow { position: relative; margin-top: -2px; background: var(--vanilla); min-height: calc(24px + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.state { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; color: var(--vanilla); font-size: 16px; line-height: 1.5; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgb(255 253 249 / .3); border-top-color: var(--vanilla); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- віконця ---------- */
.day { cursor: pointer; outline: none; }
.halo, .badge { pointer-events: none; }
.halo.pulse { animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.day:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.day:active { opacity: .82; }
.no-hit { pointer-events: none; }

/* ---------- сніг ---------- */
#flakes { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
#flakes i { position: absolute; top: -10px; border-radius: 50%; background: #fff; animation: fall linear infinite; }
@keyframes fall { to { transform: translate3d(24px, 105vh, 0); } }

/* ---------- картка дня ---------- */
#overlay { position: fixed; inset: 0; z-index: 5; display: flex; align-items: flex-end; justify-content: center; }
#backdrop { position: absolute; inset: 0; background: rgb(20 40 48 / .62); animation: fade .2s ease-out; }
#sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--vanilla); border-radius: 28px 28px 0 0; outline: none;
  box-shadow: 0 -12px 40px rgb(10 30 38 / .35); animation: rise .34s cubic-bezier(.2, .8, .2, 1);
}
#sheet::before { content: ''; position: absolute; inset: 8px 8px 0; border: 1px solid var(--choc); border-bottom: 0; border-radius: 22px 22px 0 0; pointer-events: none; opacity: .55; }
#sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 28px 24px calc(24px + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); }
#close { position: absolute; top: 16px; right: 16px; z-index: 2; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--cream); display: grid; place-items: center; }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

#win { position: relative; width: 132px; height: 160px; margin: 0 auto 20px; perspective: 600px; }
#win-view { position: absolute; inset: 0; border-radius: 66px 66px 10px 10px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #fff3cf, var(--cream) 70%); border: 4px solid var(--choc); display: grid; place-items: center; }
#win-view svg { width: 104px; height: 132px; }
.shutter { position: absolute; top: 4px; bottom: 4px; width: calc(50% - 4px); background: var(--blue); border: 2px solid var(--choc); box-shadow: inset 0 0 0 5px var(--blue), inset 0 0 0 6px rgb(249 243 231 / .5); transition: transform .8s cubic-bezier(.3, .7, .2, 1); }
.shutter::after { content: ''; position: absolute; top: 55%; width: 7px; height: 7px; border-radius: 50%; background: var(--cream); }
.shutter.left { left: 4px; border-radius: 62px 0 0 6px; transform-origin: left center; }
.shutter.right { right: 4px; border-radius: 0 62px 6px 0; transform-origin: right center; }
.shutter.left::after { right: 9px; }
.shutter.right::after { left: 9px; }
#win.open .shutter.left { transform: rotateY(-108deg); }
#win.open .shutter.right { transform: rotateY(108deg); }

#content { text-align: center; }
.eyebrow { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--choc-text); margin-bottom: 8px; }
h2 { font-family: 'Rami', 'Times New Roman', serif; font-weight: 400; font-size: 32px; line-height: 1.15; margin-bottom: 12px; text-wrap: balance; }
.text { font-size: 16px; line-height: 1.55; color: var(--blue-dark); text-wrap: pretty; }
.sample { display: inline-block; margin-bottom: 12px; padding: 5px 12px; border-radius: 99px; background: var(--pink); color: #8f2f2b; font-size: 13px; }
.list { margin-top: 20px; text-align: left; background: var(--cream); border-radius: 18px; padding: 16px 18px; }
.list h3 { font-size: 14px; margin-bottom: 10px; }
.list ul { list-style: none; display: grid; gap: 9px; }
.list li { position: relative; padding-left: 18px; font-size: 15px; line-height: 1.45; color: var(--blue-dark); }
.list li::before { content: ''; position: absolute; left: 1px; top: .5em; width: 7px; height: 7px; transform: rotate(45deg); background: var(--choc); }
.price { margin-top: 16px; font-size: 15px; color: var(--choc-text); }
.code { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 18px; border: 2px dashed var(--choc); border-radius: 16px; text-align: left; }
.code small { display: block; font-size: 12px; color: var(--choc-text); margin-bottom: 2px; }
.code strong { font-size: 19px; letter-spacing: .06em; user-select: all; overflow-wrap: anywhere; }
.code button { flex: none; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1.5px solid var(--blue); background: transparent; font-size: 14px; }
.cta { margin-top: 20px; width: 100%; min-height: 52px; border: 0; border-radius: 16px; background: var(--blue); color: var(--vanilla); font-size: 16px; font-weight: 700; }
.cta:active, .code button:active { transform: scale(.98); }
.wait-date { margin: 4px 0 6px; font-size: 18px; line-height: 1.5; }
.countdown { display: inline-block; margin-top: 14px; padding: 8px 18px; border-radius: 99px; background: var(--sky); font-size: 15px; }

#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 9; transform: translate(-50%, 12px); width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px; background: #17343f; color: var(--vanilla); font-size: 14px; line-height: 1.4; text-align: center; opacity: 0; pointer-events: none; transition: .22s ease; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

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