@font-face { font-family: 'Unbounded'; src: url('fonts/unbounded.ttf') format('truetype'); font-weight: 200 900; font-display: swap; }
@font-face { font-family: 'Inter Tight'; src: url('fonts/inter-tight.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }

:root {
  --ink: #2b2450; --plum: #3b2a7a; --coral: #c9372c; --teal: #0b7f72; --cream: #fff1e0;
  --sun: #ffc93c; --pink: #ffe4ec; --sky: #ddf3ff; --white: #fff; --snow: #f7fbff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; background: var(--plum); }
body { font-family: 'Inter Tight', system-ui, sans-serif; color: var(--ink); -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(--plum); }
#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(--plum) 70%, var(--snow) 70%); padding-bottom: 0; }
.after-snow { position: relative; margin-top: -2px; background: var(--snow); 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(--white); font-size: 18px; line-height: 1.5; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgb(255 255 255 / .3); border-top-color: var(--white); 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(24 16 52 / .66); 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(--white); border-radius: 28px 28px 0 0; outline: none; border: 3px solid var(--ink); border-bottom: 0;
  box-shadow: 0 -12px 40px rgb(20 12 46 / .4); animation: rise .34s cubic-bezier(.2, .8, .2, 1);
}
#sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 28px 22px calc(24px + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); }
#close { position: absolute; top: 14px; right: 14px; z-index: 2; width: 48px; height: 48px; border: 2px solid var(--ink); 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: 140px; height: 166px; margin: 0 auto 20px; perspective: 600px; }
#win-view { position: absolute; inset: 0; border-radius: 70px 70px 12px 12px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #fff3c4, var(--cream) 72%); border: 4px solid var(--ink); display: grid; place-items: center; }
#win-view svg { width: 114px; height: 138px; }
.shutter { position: absolute; top: 4px; bottom: 4px; width: calc(50% - 4px); background: #0e9f8e; border: 3px solid var(--ink); transition: transform .8s cubic-bezier(.3, .7, .2, 1); }
.shutter::after { content: ''; position: absolute; top: 55%; width: 12px; height: 12px; border-radius: 50%; background: var(--sun); border: 2px solid var(--ink); }
.shutter.left { left: 4px; border-radius: 66px 0 0 8px; transform-origin: left center; }
.shutter.right { right: 4px; border-radius: 0 66px 8px 0; transform-origin: right center; }
.shutter.left::after { right: 8px; }
.shutter.right::after { left: 8px; }
#win.open .shutter.left { transform: rotateY(-108deg); }
#win.open .shutter.right { transform: rotateY(108deg); }

/* тексти великі: календарем користуються й люди зі слабким зором */
#content { text-align: center; }
.eyebrow { font-size: 15px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--coral); margin-bottom: 8px; }
h2 { font-family: 'Unbounded', system-ui, sans-serif; font-weight: 700; font-size: 25px; line-height: 1.25; margin-bottom: 12px; text-wrap: balance; }
.text { font-size: 18px; line-height: 1.5; text-wrap: pretty; }
.sample { display: inline-block; margin-bottom: 12px; padding: 6px 14px; border-radius: 99px; background: var(--pink); color: #8f1f3c; font-size: 15px; font-weight: 600; }
.list { margin-top: 16px; text-align: left; background: var(--cream); border-radius: 18px; padding: 16px 18px; }
.list h3 { font-family: 'Unbounded', system-ui, sans-serif; font-size: 16px; margin-bottom: 10px; }
.list ul { list-style: none; display: grid; gap: 10px; }
.list li { position: relative; padding-left: 20px; font-size: 18px; line-height: 1.4; }
.list li::before { content: ''; position: absolute; left: 0; top: .45em; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); }
.note { margin-top: 16px; font-size: 15px; line-height: 1.45; color: #55507a; }
.price { margin-top: 16px; font-size: 17px; }
.code { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 18px; border: 3px dashed var(--plum); border-radius: 16px; text-align: left; }
.code small { display: block; font-size: 14px; color: #55507a; margin-bottom: 2px; }
.code strong { font-size: 22px; letter-spacing: .05em; user-select: all; overflow-wrap: anywhere; }
.code button { flex: none; min-height: 48px; padding: 0 16px; border-radius: 12px; border: 2px solid var(--plum); background: transparent; font-size: 16px; font-weight: 700; }
.cta { margin-top: 20px; width: 100%; min-height: 56px; border: 0; border-radius: 16px; background: var(--coral); color: var(--white); font-size: 19px; font-weight: 800; }
.cta:active, .code button:active { transform: scale(.98); }
.wait-date { margin: 4px 0 6px; font-size: 20px; line-height: 1.5; }
.countdown { display: inline-block; margin-top: 14px; padding: 10px 20px; border-radius: 99px; background: var(--sky); font-size: 18px; font-weight: 700; }

#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: 13px 18px; border-radius: 14px; background: #17102f; color: var(--white); font-size: 16px; 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; }
}
