:root {
  --cream: #fff0f1; --white: #fffaf8; --blush: #ffe0e9; --pink: #ff5e9a; --red: #c80f2a; --wine: #6d0b25;
  --emerald: #0b5c4e; --gold: #efae36; --ink: #3d1522; --muted: #8a4658;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; background: var(--cream); }
body { font-family: 'Manrope', 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; }
#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));
  padding-bottom: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}
#calendar > svg { display: block; width: 100%; height: auto; }

.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(--wine); font-size: 16px; line-height: 1.5; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #ffc4d6; border-top-color: var(--red); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- окошки ---------- */
.day { cursor: pointer; outline: none; transform-box: fill-box; transform-origin: center; transition: transform .12s ease-out; }
.day:active { transform: scale(.96); }
.day:focus-visible > rect:first-of-type { stroke: var(--ink); stroke-width: 10; }
.halo, .badge, .no-hit { pointer-events: none; }
.halo.pulse { animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }

/* ---------- конфетти ---------- */
#flakes { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
#flakes i { position: absolute; top: -10px; border-radius: 50%; 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(60 6 22 / .68); 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;
  box-shadow: 0 -12px 40px rgb(60 6 22 / .35); animation: rise .34s cubic-bezier(.2, .8, .2, 1);
}
#sheet::before { content: ''; position: absolute; inset: 8px 8px 0; border: 1.5px solid var(--gold); border-bottom: 0; border-radius: 22px 22px 0 0; pointer-events: none; opacity: .7; }
/* крестик живёт в своей верхней полоске и не наезжает на текст */
#sheet-body { margin-top: 64px; overflow-y: auto; overscroll-behavior: contain; padding: 4px 24px calc(24px + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); }
#close { position: absolute; top: 14px; right: 16px; z-index: 2; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--blush); color: var(--wine); display: grid; place-items: center; }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

#win { position: relative; width: 140px; height: 160px; margin: 0 auto 20px; perspective: 600px; }
#win-view { position: absolute; inset: 0; display: grid; place-items: center; }
#win-view svg { width: 140px; height: 160px; }
.shutter { position: absolute; top: 0; bottom: 0; width: 50%; background: var(--red); box-shadow: inset 0 0 0 5px var(--red), inset 0 0 0 6.5px var(--gold); transition: transform .8s cubic-bezier(.3, .7, .2, 1); }
.shutter::after { content: ''; position: absolute; top: calc(50% - 5px); width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }
.shutter.left { left: 0; border-radius: 12px 0 0 12px; transform-origin: left center; }
.shutter.right { right: 0; border-radius: 0 12px 12px 0; transform-origin: right center; }
.shutter.left::after { right: 11px; }
.shutter.right::after { left: 11px; }
#win.open .shutter.left { transform: rotateY(-108deg); }
#win.open .shutter.right { transform: rotateY(108deg); }

#content { text-align: center; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--emerald); margin-bottom: 8px; }
h2 { font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 28px; line-height: 1.2; color: var(--wine); margin-bottom: 12px; text-wrap: balance; overflow-wrap: anywhere; }
.text { font-size: 16px; line-height: 1.6; text-wrap: pretty; white-space: pre-line; overflow-wrap: anywhere; }
h2.hello { font-family: 'Great Vibes', 'Snell Roundhand', cursive; font-weight: 400; font-size: 38px; line-height: 1.25; color: var(--red); margin-bottom: 14px; }
#content .text { margin-top: 14px; }
#content h2 + .text { margin-top: 0; }
/* главная мысль дня */
.accent { position: relative; margin: 26px 0 12px; padding: 28px 20px 24px; border-radius: 20px; background: var(--wine); color: var(--white); font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 20px; line-height: 1.4; text-wrap: balance; overflow-wrap: anywhere; box-shadow: inset 0 0 0 5px var(--wine), inset 0 0 0 6px rgb(239 174 54 / .75); }
.accent::before { content: '✦'; position: absolute; top: -15px; left: 50%; transform: translateX(-50%); width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: var(--wine); font: 16px/30px system-ui, sans-serif; }
.loud { margin: 20px 0 6px; padding: 14px 0; border-top: 1.5px solid var(--gold); border-bottom: 1.5px solid var(--gold); color: var(--red); font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 18px; line-height: 1.45; text-wrap: balance; }
.label { margin-top: 28px; color: var(--emerald); font-size: 13px; font-weight: 700; letter-spacing: .1em; line-height: 1.5; text-wrap: balance; }
.task { margin-top: 14px; padding: 18px; border-radius: 20px; background: var(--blush); display: grid; gap: 12px; font-size: 16px; line-height: 1.55; font-weight: 600; color: var(--wine); text-wrap: pretty; }
.questions { list-style: none; counter-reset: q; display: grid; gap: 10px; margin-top: 12px; text-align: left; }
.questions li { counter-increment: q; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1.5px solid #ffc4d6; border-radius: 16px; font-size: 16px; line-height: 1.5; }
.questions li::before { content: counter(q); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: var(--white); font-family: 'Playfair Display', Georgia, serif; font-size: 15px; line-height: 28px; text-align: center; }
.sign { margin-top: 24px; font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 18px; line-height: 1.5; color: var(--wine); text-wrap: balance; }
/* клуб «Сначала я» */
.club { margin-top: 24px; padding: 22px 16px 16px; border-radius: 22px; background: var(--emerald); color: var(--white); box-shadow: inset 0 0 0 5px var(--emerald), inset 0 0 0 6px rgb(239 174 54 / .75); }
.club-kicker { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #ffd77a; }
.club-name { font-family: 'Great Vibes', 'Snell Roundhand', cursive; font-size: 40px; line-height: 1.3; margin-bottom: 12px; }
.club-cta { width: 100%; min-height: 56px; padding: 12px 18px; border: 0; border-radius: 16px; background: var(--white); color: var(--wine); font-size: 16px; font-weight: 700; line-height: 1.35; text-wrap: balance; }
.club-cta:active { transform: scale(.98); }
.code { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 18px; border: 2px dashed var(--red); border-radius: 16px; text-align: left; }
.code small { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.code strong { font-size: 19px; letter-spacing: .06em; color: var(--wine); user-select: all; overflow-wrap: anywhere; }
.code button { flex: none; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--red); color: var(--red); background: transparent; font-size: 14px; font-weight: 600; }
.cta { margin-top: 20px; width: 100%; min-height: 52px; padding: 12px 20px; border: 0; border-radius: 16px; background: var(--red); color: var(--white); 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 { font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 34px; line-height: 1.25; color: var(--red); }
.date-pill { display: inline-block; margin-top: 12px; padding: 8px 18px; border-radius: 99px; background: var(--blush); color: var(--wine); font-size: 15px; font-weight: 600; }

#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: var(--wine); color: var(--white); 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; }
}
