:root {
  --paper: #fbf7ef;
  --grid: rgba(105, 140, 185, .2);
  --ink: #2f2a38;
  --ink-soft: #6e6777;
  --red: #c4344c;
  --red-dark: #97233a;
  --green: #2d6a50;
  --gold: #d6a03a;
  --card: #fffefa;
  --card-warm: #fffaf0;
  --line: #c9b9a6;
  --hl-1: rgba(232, 120, 135, .28);
  --hl-2: rgba(232, 120, 135, .28);
  --hl-3: rgba(232, 120, 135, .28);
  --shadow: 0 6px 18px rgba(70, 50, 40, .14);
  --hand: 'Caveat', 'Comic Sans MS', cursive;
  --letter: 'Marck Script', 'Caveat', cursive;
  --type: 'Courier New', Courier, 'PT Mono', monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--hand);
  font-size: 24px;
  line-height: 1.32;
  overflow-x: hidden;
}
body.locked { overflow: hidden; }

.lettering { font-family: var(--letter); font-weight: 400; color: var(--red); margin: 0 0 .3em; line-height: 1.15; }
h1.lettering { font-size: 52px; }
h2.lettering { font-size: 38px; }
.hand { font-family: var(--hand); }
.muted { color: var(--ink-soft); margin: 0 0 1em; }

/* ---------- экраны ---------- */
.screen { display: none; position: relative; z-index: 5; min-height: 100vh; min-height: 100dvh; padding: 64px 16px 24px; }
.screen.active { display: block; }
#login.active, #intro.active { display: flex; align-items: center; justify-content: center; }
.screen.enter { animation: fadeIn .7s ease backwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* перелистывание страницы */
.flip-wrap { position: fixed; inset: 0; z-index: 50; perspective: 1800px; pointer-events: none; }
.flip-page {
  position: absolute; inset: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  transform-origin: left center;
  box-shadow: 8px 0 30px rgba(60, 40, 30, .25);
  animation: pageTurn 1.1s cubic-bezier(.55, .05, .35, 1) forwards;
  backface-visibility: hidden;
}
@keyframes pageTurn { 0% { transform: rotateY(0); } 100% { transform: rotateY(-100deg); opacity: .2; } }

/* ---------- гирлянда ---------- */
.garland {
  position: absolute; top: 0; left: 0; right: 0; height: 52px;
  pointer-events: none; z-index: 3; overflow: hidden;
}
.garland svg { position: absolute; top: 0; left: 0; width: 100%; height: 30px; }
.garland .bulbs { position: absolute; inset: 0; display: flex; justify-content: space-around; padding: 0 6px; }
.bulb {
  position: relative; width: 9px; height: 14px; margin-top: 12px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--c); box-shadow: 0 0 10px 2px var(--c);
  animation: blink 3.2s ease-in-out infinite;
}
.bulb:nth-child(even) { margin-top: 20px; animation-delay: 1.6s; }
.bulb:nth-child(3n) { animation-delay: .8s; }
.bulb::before {
  content: ''; position: absolute; top: -4px; left: 2px; width: 7px; height: 5px;
  background: #8a8476; border-radius: 2px;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .55; box-shadow: 0 0 4px 0 var(--c); } }

/* ---------- снег ---------- */
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }

/* ---------- лист бумаги ---------- */
.sheet {
  position: relative;
  width: 100%; max-width: 460px; margin: 0 auto;
  background: var(--card);
  border-radius: 6px;
  padding: 34px 22px 26px;
  box-shadow: var(--shadow);
  text-align: center;
  z-index: 5;
}
.sheet.lined {
  text-align: left;
  background-image:
    linear-gradient(90deg, transparent 38px, rgba(196, 52, 76, .4) 38px, rgba(196, 52, 76, .4) 40px, transparent 40px),
    repeating-linear-gradient(transparent 0 33px, rgba(105, 140, 185, .35) 33px 34px);
  padding-left: 52px;
  line-height: 34px;
}

/* прозрачный скотч */
.tape {
  position: absolute; top: -13px; left: 50%;
  width: 112px; height: 28px; margin-left: -56px;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, .55) 45%, rgba(255, 255, 255, 0) 60%),
    rgba(240, 242, 238, .42);
  border-top: 1px solid rgba(255, 255, 255, .7);
  transform: rotate(-3deg);
  clip-path: polygon(0 0, 100% 0, 97% 14%, 100% 28%, 97% 42%, 100% 57%, 97% 71%, 100% 85%, 97% 100%, 0 100%, 3% 86%, 0 72%, 3% 58%, 0 43%, 3% 29%, 0 15%);
  backdrop-filter: blur(.6px) saturate(1.1);
  -webkit-backdrop-filter: blur(.6px) saturate(1.1);
  z-index: 6;
}
.tape.corner-l { left: 10px; margin-left: 0; width: 76px; transform: rotate(-32deg); top: -6px; }
.tape.corner-r { left: auto; right: 8px; margin-left: 0; width: 76px; transform: rotate(30deg); top: -6px; }

/* маркеры */
mark.hl {
  background-color: transparent;
  color: inherit; padding: 0 .12em; margin: 0 -.06em;
  border-radius: .8em .3em .9em .2em;
  background-repeat: no-repeat;
  background-size: 0% 100%;
  background-image: linear-gradient(100deg, transparent 0 1%, var(--hl) 3% 97%, transparent 99%);
  background-position: 0 85%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background-size .9s cubic-bezier(.6, .1, .3, 1) .2s;
}
mark.hl.hl-1 { --hl: var(--hl-1); }
mark.hl.hl-2 { --hl: var(--hl-2); }
mark.hl.hl-3 { --hl: var(--hl-3); }
.in mark.hl, .note mark.hl, .screen.active:not(#journey) mark.hl, mark.hl.on { background-size: 100% 58%; }

/* наклейки */
.sticker {
  position: absolute; z-index: 7;
  font-size: var(--size, 40px); line-height: 1;
  transform: rotate(var(--rot, -8deg));
  text-shadow:
    2px 0 #fff, -2px 0 #fff, 0 2px #fff, 0 -2px #fff,
    1.6px 1.6px #fff, -1.6px -1.6px #fff, 1.6px -1.6px #fff, -1.6px 1.6px #fff,
    0 4px 5px rgba(60, 40, 30, .25);
  user-select: none; cursor: pointer; background: none; border: 0; padding: 0;
  animation: stickIn .5s cubic-bezier(.2, .9, .3, 1.4) both;
}
.sticker.boing { animation: boing .55s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes stickIn { from { opacity: 0; transform: scale(.3) rotate(calc(var(--rot, -8deg) - 30deg)); } to { opacity: 1; transform: rotate(var(--rot, -8deg)); } }
@keyframes boing {
  0% { transform: rotate(var(--rot, -8deg)) scale(1); }
  40% { transform: rotate(calc(var(--rot, -8deg) + 14deg)) scale(1.3); }
  100% { transform: rotate(var(--rot, -8deg)) scale(1); }
}

/* ---------- логин: ремешок и замочек ---------- */
#login { overflow: hidden; }
.login-sheet { padding-top: 92px; }
.login-sheet .sticker.s1 { left: -10px; bottom: -14px; }
.login-sheet .sticker.s2 { right: -8px; bottom: 30%; --size: 34px; --rot: 12deg; }
.strap {
  position: absolute; top: 34px; left: -7px; right: -7px; height: 34px;
  display: flex; pointer-events: none;
}
.strap i {
  flex: 1; display: block;
  background: linear-gradient(#cc3f57, #962239);
  box-shadow: 0 3px 6px rgba(90, 20, 30, .28);
  position: relative;
  transition: transform .7s cubic-bezier(.5, 0, .75, 0), opacity .7s;
}
.strap i::after {
  content: ''; position: absolute; inset: 5px 0;
  border-top: 2px dashed rgba(255, 236, 210, .75);
  border-bottom: 2px dashed rgba(255, 236, 210, .75);
}
.strap-l { border-radius: 4px 0 0 4px; }
.strap-r { border-radius: 0 4px 4px 0; }

.lock {
  position: absolute; top: 4px; left: 50%;
  width: 66px; height: 82px; margin-left: -33px;
  padding: 0; border: 0; background: none; cursor: pointer;
  transform-origin: 50% 20%;
  filter: drop-shadow(0 4px 5px rgba(120, 60, 20, .3));
  animation: lockIdle 4s ease-in-out infinite;
  z-index: 8;
}
.lock svg { display: block; width: 100%; height: 100%; overflow: visible; }
.lock .shackle { transform-box: fill-box; transform-origin: 100% 100%; transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes lockIdle { 0%, 88%, 100% { transform: rotate(0); } 92% { transform: rotate(-6deg); } 96% { transform: rotate(5deg); } }
.lock.jiggle { animation: jiggle .5s; }
@keyframes jiggle {
  15% { transform: rotate(-16deg); } 35% { transform: rotate(13deg); }
  55% { transform: rotate(-9deg); } 75% { transform: rotate(5deg); } 100% { transform: rotate(0); }
}
.unlocking .lock { animation: none; }
.unlocking .lock .shackle { transform: translateY(-9px) rotate(28deg); }
.unlocking.drop .lock { animation: lockFall .8s cubic-bezier(.5, 0, .9, .4) forwards; }
@keyframes lockFall {
  0% { transform: translateY(0) rotate(0); }
  20% { transform: translateY(-10px) rotate(-8deg); }
  100% { transform: translateY(110vh) rotate(55deg); }
}
.unlocking.drop .strap-l { transform: translateX(-110%) rotate(-4deg); opacity: 0; }
.unlocking.drop .strap-r { transform: translateX(110%) rotate(4deg); opacity: 0; }

/* ---------- логин: форма ---------- */
#loginForm { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.pwd-label { font-size: 22px; color: var(--ink); margin-bottom: -6px; }
#pwd {
  font-family: var(--hand); font-size: 26px; color: var(--ink);
  text-align: center; letter-spacing: 1px;
  border: 0; border-bottom: 2px dashed var(--line);
  background: transparent; padding: 10px 4px; outline: none;
}
#pwd::placeholder { color: #c3bbb0; letter-spacing: 2px; }
#pwd:focus { border-bottom-color: var(--red); }
.err { min-height: 1.4em; color: var(--red); font-size: 26px; margin: 12px 0 0; }
.shake { animation: shake .45s; }
@keyframes shake {
  20%, 60% { transform: translateX(-9px) rotate(-1deg); }
  40%, 80% { transform: translateX(9px) rotate(1deg); }
}

/* ---------- кнопки ---------- */
.btn {
  font-family: var(--hand); font-size: 26px; font-weight: 700;
  color: #fff; background: var(--red);
  border: 0; border-radius: 999px; padding: 10px 26px;
  box-shadow: 0 4px 0 var(--red-dark);
  cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-dark); }
.btn.big { margin-top: 18px; background: var(--green); box-shadow: 0 4px 0 #1d4a37; }
.btn.big:active { box-shadow: 0 1px 0 #1d4a37; }

/* ---------- полароид / медиа ---------- */
.polaroid {
  position: relative;
  background: #fff; padding: 10px 10px 14px;
  box-shadow: var(--shadow);
  border-radius: 3px;
}
.video-wrap { margin: 14px auto 16px; transform: rotate(-1.2deg); }
.video-wrap .sticker { right: -12px; top: -16px; --rot: 14deg; }
.polaroid video, .polaroid img { display: block; width: 100%; border-radius: 2px; background: #efe9df; }
.placeholder {
  display: flex; align-items: center; justify-content: center; text-align: center;
  aspect-ratio: 4 / 3; background: #f4efe6; color: var(--ink-soft);
  border: 2px dashed var(--line); border-radius: 4px; font-size: 22px; padding: 12px;
}
.intro-text p { margin: 0 0 .5em; }
#intro .sheet > .sticker.s1 { left: -12px; bottom: 58px; --rot: -14deg; }

/* ---------- хронология ---------- */
#journey { padding-bottom: 40px; }
.journey-head { position: relative; text-align: center; margin: 4px 0 22px; z-index: 5; }
.countdown {
  display: inline-block; margin-top: 4px;
  background: #fff6c9; padding: 6px 14px 8px; font-size: 22px;
  box-shadow: 0 3px 8px rgba(70, 50, 30, .15);
  transform: rotate(-2deg); position: relative;
}
.countdown b { color: var(--red); font-size: 28px; }
.timeline { position: relative; max-width: 520px; margin: 0 auto; z-index: 5; }
.month { position: relative; padding-left: 34px; margin-bottom: 18px; }
.month::before {
  content: ''; position: absolute; left: 12px; top: 0; bottom: -18px;
  border-left: 2px dashed var(--line);
}
.month-title {
  font-family: var(--letter); font-size: 40px; color: var(--green);
  margin: 0 0 12px -34px; padding: 4px 0; font-weight: 400;
  position: relative; z-index: 1;
}
.month-title span { background: var(--paper); padding: 0 10px 0 6px; box-shadow: 0 0 0 4px var(--paper); }
.month-title .sticker { position: relative; display: inline-block; vertical-align: middle; margin-left: 4px; --size: 34px; }
.entry { position: relative; margin: 0 0 22px; }
/* ёлочный шарик */
.entry::before {
  content: ''; position: absolute; left: -31px; top: 18px;
  width: 17px; height: 17px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, .85) 0 2px, var(--ball, var(--red)) 3px);
  box-shadow: 0 2px 4px rgba(60, 30, 20, .25);
}
.entry::after {
  content: ''; position: absolute; left: -26px; top: 14px;
  width: 7px; height: 5px; border-radius: 1px; background: var(--gold);
}
.entry:nth-child(3n+2)::before { --ball: var(--green); }
.entry:nth-child(3n+3)::before { --ball: var(--gold); }
.entry-date { font-size: 21px; color: var(--ink-soft); margin: 0 0 2px; }
.card {
  display: block; width: 100%; text-align: left;
  font-family: var(--hand); font-size: 24px; color: var(--ink);
  background: var(--card); border: 0; border-radius: 4px;
  padding: 20px 18px 14px; box-shadow: var(--shadow);
  cursor: pointer; transition: transform .2s;
  position: relative; transform: rotate(-.8deg);
}
.entry:nth-child(even) .card { transform: rotate(.9deg); background: var(--card-warm); }
.card:active { transform: scale(.98) !important; }
.card .tape { top: -12px; }
.card .sticker { right: -10px; bottom: -14px; --size: 34px; }
.card h3 { font-family: var(--hand); font-weight: 700; font-size: 29px; margin: 0 0 4px; color: var(--ink); display: inline; }
.card p { margin: 6px 0 0; color: var(--ink-soft); }
.card .clip { position: absolute; right: 12px; top: 10px; font-size: 18px; color: var(--ink-soft); }
.card .more { display: inline-block; margin-top: 6px; color: var(--red); font-weight: 600; }

/* появление при скролле */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- записка (модалка) ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(40, 30, 40, .35); backdrop-filter: blur(2px); animation: fadeIn .3s both; }
.note-wrap { position: relative; width: 100%; max-width: 460px; animation: noteIn .45s cubic-bezier(.2, .9, .3, 1.25) both; }
.note {
  position: relative; width: 100%; max-height: 84vh; max-height: 84dvh; overflow-y: auto;
  background: var(--card-warm); border-radius: 4px; padding: 30px 20px 22px;
  box-shadow: 0 14px 40px rgba(40, 25, 30, .3);
}
@keyframes noteIn { from { opacity: 0; transform: scale(.6) rotate(-6deg); } to { opacity: 1; transform: rotate(-1deg); } }
.close {
  position: absolute; top: 6px; right: 10px; z-index: 2;
  font-size: 34px; line-height: 1; background: none; border: 0; color: var(--ink-soft); cursor: pointer;
}
.note h3 { font-family: var(--letter); font-weight: 400; font-size: 34px; color: var(--red); margin: 0 0 6px; }
.note .note-date { color: var(--ink-soft); font-size: 20px; margin: 0; }
.note p { margin: 0 0 .6em; }
.gallery { display: grid; gap: 18px; margin-top: 16px; }
.gallery .polaroid:nth-child(odd) { transform: rotate(-1.5deg); }
.gallery .polaroid:nth-child(even) { transform: rotate(1.2deg); }
.gallery .caption { margin: 6px 0 0; font-size: 20px; text-align: center; color: var(--ink-soft); }
.gallery audio { width: 100%; }

/* ---------- финал ---------- */
.finale { margin-top: 34px; }
.finale h2 { text-align: center; }
.finale p { margin: 0 0 34px; }
.finale p:last-child { margin-bottom: 0; }
.finale .sticker.s1 { right: -12px; top: -22px; --size: 46px; --rot: 10deg; }
.finale .sticker.s2 { left: -14px; bottom: 40px; --size: 38px; }
.signature { text-align: right; font-size: 34px; margin-top: 10px; }

.ps {
  position: relative; z-index: 5;
  display: block; margin: 26px auto 0; max-width: 460px;
  font-size: 24px; color: var(--ink-soft);
  background: none; border: 0; cursor: pointer; text-decoration: underline wavy var(--gold);
  text-underline-offset: 6px; animation: wiggle 3s ease-in-out infinite;
}
@keyframes wiggle { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(-2deg); } 96% { transform: rotate(2deg); } }
.footer-space { height: 70px; }

.fab {
  position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 30;
  font-family: var(--hand); font-size: 20px; font-weight: 700;
  background: #fff; color: var(--red);
  border: 2px solid rgba(196, 52, 76, .35); border-radius: 999px;
  padding: 6px 14px; box-shadow: var(--shadow); cursor: pointer;
}

/* ---------- салют и Кузя ---------- */
.hearts { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.heart {
  position: absolute; bottom: -40px;
  font-size: var(--s, 28px);
  animation: fly var(--d, 2.6s) cubic-bezier(.25, .6, .4, 1) forwards;
}
@keyframes fly {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--x, 0), -110vh) rotate(var(--r, 30deg)); opacity: 0; }
}
.kuzya {
  position: fixed; inset: 0; z-index: 55;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(40, 30, 40, .25);
}
.kuzya[hidden] { display: none; }
.kuzya .polaroid { width: 100%; max-width: 320px; text-align: center; animation: noteIn .5s cubic-bezier(.2, .9, .3, 1.3) both; }
.kuzya .polaroid p { margin: 8px 0 0; font-size: 24px; }
.kuzya .placeholder { font-size: 64px; }

@media (min-width: 700px) {
  body { font-size: 24px; }
  h1.lettering { font-size: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  #snow { display: none; }
}

/* ---------- печатная машинка: основной текст ---------- */
body { font-family: var(--type); font-size: 17px; line-height: 1.6; }
.intro-text, .pwd-label { font-family: var(--type); font-size: 16px; }
.pwd-label { line-height: 1.5; margin-bottom: -2px; }
#pwd { font-family: var(--type); font-size: 22px; letter-spacing: 3px; }
#pwd::placeholder { letter-spacing: 3px; }
.err { font-family: var(--hand); }
.btn { font-family: var(--type); font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; padding: 13px 26px; }
.entry-date, .note .note-date { font-family: var(--type); font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; }
.card { font-family: var(--type); font-size: 16px; }
.card h3 { font-family: var(--hand); font-size: 30px; }
.card p { font-size: 16px; }
.card .more { font-family: var(--hand); font-size: 22px; }
.note { font-size: 16px; }
.countdown { font-family: var(--type); font-size: 14px; }
.countdown b { font-size: 20px; }
#finaleText { font-family: var(--hand); font-size: 25px; }
.fab { font-family: var(--type); font-size: 13px; }
.relock {
  position: relative; z-index: 5; display: block; margin: 22px auto 0;
  font-family: var(--type); font-size: 13px; letter-spacing: 1px; color: var(--ink-soft);
  background: none; border: 1px dashed var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
@media (min-width: 700px) { body { font-size: 18px; } }

/* ---------- полотно: дни без записок ---------- */
.day { margin: 0 0 44px; }
.day::before { top: 6px; }
.day::after { top: 2px; }
.day-title { font-family: var(--hand); font-weight: 700; font-size: 31px; line-height: 1.1; margin: 2px 0 10px; color: var(--ink); }
.day-text p { margin: 0 0 .7em; }
.day .polaroid { width: 86%; margin: 22px 0 0; }
.day .polaroid.tilt-l { transform: rotate(-1.8deg); }
.day .polaroid.tilt-r { transform: rotate(1.5deg); margin-left: auto; }
.day .polaroid.reveal { opacity: 0; transform: translateY(24px) rotate(0); }
.day .polaroid.tilt-l.in { opacity: 1; transform: rotate(-1.8deg); }
.day .polaroid.tilt-r.in { opacity: 1; transform: rotate(1.5deg); }
.day .polaroid img { cursor: zoom-in; }
.day .polaroid .tape { top: -13px; }
.day .caption { margin: 8px 0 0; font-size: 21px; text-align: center; color: var(--ink-soft); }
.day .audio-box { width: 100%; padding: 12px; border-radius: 12px; }
.day .audio-box audio { width: 100%; display: block; }
.day .audio-box .caption { margin-top: 4px; }
.day > .sticker { right: 0; top: -6px; --size: 34px; }
.zoom img { display: block; width: 100%; }
.zoom .caption { margin: 8px 0 0; text-align: center; font-size: 22px; color: var(--ink-soft); }

#journey .timeline { margin-top: 24px; }

/* ---------- карусель фото ---------- */
.carousel .track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; border-radius: 2px;
}
.carousel .track::-webkit-scrollbar { display: none; }
.carousel .track { gap: 8px; }
.carousel .slide { flex: 0 0 88%; scroll-snap-align: start; }
.carousel .slide:last-child { margin-right: 4px; }
.carousel .stage { position: relative; }
.carousel .nav {
  position: absolute; top: 50%; width: 38px; height: 38px; margin-top: -19px;
  border: 0; border-radius: 50%; padding: 0 0 3px;
  background: rgba(255, 255, 255, .88); color: var(--ink);
  font-size: 28px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(40, 30, 30, .25);
  transition: opacity .25s;
}
.carousel .prev { left: 8px; }
.carousel .next { right: 8px; }
.carousel .nav.hide { opacity: 0; pointer-events: none; }
.carousel .counter {
  position: absolute; top: 8px; left: 8px;
  font-family: var(--type); font-size: 12px; letter-spacing: 1px;
  background: rgba(30, 25, 30, .55); color: #fff; padding: 3px 8px; border-radius: 999px;
}
.carousel .slide img { aspect-ratio: 3 / 4; object-fit: cover; }
.carousel .dots { display: flex; justify-content: center; gap: 8px; padding-top: 10px; }
.carousel .dot {
  width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%;
  background: #d9d1c4; cursor: pointer; transition: background .25s, transform .25s;
}
.carousel .dot.on { background: var(--red); transform: scale(1.25); }

/* бумажный стикер поверх фото */
.note-sticker {
  position: absolute; right: -14px; bottom: 54px; z-index: 7;
  max-width: 82%; padding: 10px 14px 12px;
  font-family: var(--hand); font-size: 23px; line-height: 1.15; color: var(--ink);
  background: #fffdf6; border-radius: 10px;
  box-shadow: 0 0 0 3px #fff, 0 6px 14px rgba(60, 40, 30, .25);
  transform: rotate(3.5deg);
  pointer-events: none;
}
.polaroid.reveal .note-sticker { opacity: 0; transform: rotate(-8deg) scale(.7); transition: opacity .4s .5s, transform .5s cubic-bezier(.2, .9, .3, 1.4) .5s; }
.polaroid.in .note-sticker { opacity: 1; transform: rotate(3.5deg); }

/* ---------- гирлянда v2 ---------- */
.garland .bulb { position: absolute; margin: 0 0 0 -4px; --c: #ffcf6b; box-shadow: 0 0 6px 1px rgba(255, 200, 90, .55); }
.garland .bulb:nth-child(even) { margin-top: 0; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .5; box-shadow: 0 0 2px 0 rgba(255, 200, 90, .4); } }

/* ---------- навигация по дням ---------- */
.day-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(251, 247, 239, .92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(201, 185, 166, .5);
}
.day-nav::-webkit-scrollbar { display: none; }
.day-nav .chip {
  flex: 0 0 auto; max-width: 170px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--type); font-size: 13px; color: var(--ink);
  background: #fff; border: 1px solid rgba(201, 185, 166, .7); border-radius: 999px;
  padding: 7px 13px; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.day-nav .chip.on { background: var(--red); color: #fff; border-color: var(--red); }
.day-nav .chip-video { color: var(--red); border-color: rgba(196, 52, 76, .45); }
.day-nav .chip-month {
  flex: 0 0 auto; font-family: var(--letter); font-size: 20px; color: var(--green);
  padding: 0 2px 0 6px;
}
.day, .finale { scroll-margin-top: 24px; }
.footer-space { height: 110px; }

/* ---------- штамп «ОТКАЗАТЬ» ---------- */
.stamp-wrap {
  position: absolute; left: 50%; top: 42%; z-index: 7;
  width: 240px; margin-left: -120px; pointer-events: none;
}
.stamp {
  font-family: var(--type); font-weight: 700; font-size: 34px; letter-spacing: 4px;
  color: #d0263f; text-align: center;
  border: 4px double #d0263f; border-radius: 8px; padding: 4px 10px;
  background: rgba(255, 255, 255, .55);
  transform: rotate(-12deg);
  opacity: 0;
}
.strike { position: absolute; left: 0; top: 4px; width: 100%; height: 60px; overflow: visible; }
.strike path {
  fill: none; stroke: #c4344c; stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 300; stroke-dashoffset: 300;
}
.stamp-fix {
  position: absolute; right: -6px; top: -46px;
  font-family: var(--hand); font-size: 34px; font-weight: 700; color: var(--red);
  transform: rotate(-6deg); opacity: 0;
  text-shadow: 0 0 6px #fff, 0 0 2px #fff;
}
.polaroid.in .stamp { animation: stampIn .45s cubic-bezier(.2, 1.4, .4, 1) .5s forwards; }
.polaroid.in .strike path { transition: stroke-dashoffset .5s ease-out 1.6s; stroke-dashoffset: 0; }
.polaroid.in .strike path + path { transition-delay: 2s; }
.polaroid.in .stamp-fix { animation: fixIn .5s ease-out 2.5s forwards; }
@keyframes stampIn {
  0% { opacity: 0; transform: rotate(-12deg) scale(2.4); }
  100% { opacity: .9; transform: rotate(-12deg) scale(1); }
}
@keyframes fixIn {
  0% { opacity: 0; transform: rotate(-6deg) translateY(8px); }
  100% { opacity: 1; transform: rotate(-6deg); }
}

.day-nav { display: none; }
body.on-journey .day-nav { display: flex; }

/* ---------- кружки ---------- */
.circle-note {
  position: relative; width: 68%; max-width: 300px; aspect-ratio: 1;
  margin: 18px 0 0; cursor: pointer; -webkit-user-select: none; user-select: none;
}
.circle-note .clip {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
  box-shadow: 0 0 0 5px #fff, 0 8px 20px rgba(60, 40, 30, .25);
  background: #eee6da;
  -webkit-mask-image: -webkit-radial-gradient(white, black); /* скругление видео в Safari */
}
.circle-note video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(1.04); /* срезаем белый ободок вокруг кружка */
}
.circle-note .ring { position: absolute; inset: -9px; width: calc(100% + 18px); height: calc(100% + 18px); transform: rotate(-90deg); pointer-events: none; }
.circle-note .ring circle { fill: none; stroke: var(--red); stroke-width: 2.2; stroke-linecap: round; opacity: 0; transition: opacity .3s; }
.circle-note.sound .ring circle { opacity: 1; }
.circle-note .badge {
  position: absolute; right: 8%; bottom: 8%;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  background: rgba(30, 25, 30, .55); box-shadow: 0 0 0 2px #fff;
  transition: opacity .3s;
}
.circle-note.sound .badge { opacity: 0; }
.circle-note.paused .badge { opacity: 1; }
.circle-note.paused .badge::after { content: '⏸'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(30, 25, 30, .7); border-radius: 50%; color: #fff; }
.circle-note .caption { position: absolute; left: 0; right: 0; bottom: -34px; text-align: center; margin: 0; }
.day .circle-note.tilt-r { margin-left: auto; }
.day .circle-note + .circle-note { margin-top: -26px; }
.day .circle-note.reveal { opacity: 0; transform: scale(.85); }
.day .circle-note.reveal.in { opacity: 1; transform: none; transition: opacity .6s, transform .6s cubic-bezier(.2, .9, .3, 1.3); }

/* ---------- глава «Переезд» ---------- */
.chapter-label {
  display: inline-block; position: relative;
  font-family: var(--type); font-weight: 700; font-size: 20px; letter-spacing: 3px;
  color: #5a3d22; background: #d9b27c; padding: 8px 16px 8px 14px;
  box-shadow: 0 3px 8px rgba(70, 45, 20, .25); transform: rotate(-1.5deg); margin-bottom: 6px;
}
.chapter-label::after {
  content: ''; position: absolute; left: 50%; top: -6px; bottom: -6px; width: 30px; margin-left: -15px;
  background: rgba(236, 222, 190, .75);
}
.chapter .day-title { font-size: 36px; }

/* ---------- мем: рвётся рубашка ---------- */
.rip { position: relative; height: 340px; margin: 40px 0 30px; border-radius: 10px; cursor: pointer; }
.rip.reveal { opacity: 1; transform: none; }
.rip-under {
  position: absolute; inset: 0; border-radius: 10px; overflow: hidden;
  background: var(--red-dark); color: #fff; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.rip .rays {
  position: absolute; left: 50%; top: 50%; width: 900px; height: 900px; margin: -450px 0 0 -450px;
  background: repeating-conic-gradient(rgba(255, 210, 120, .28) 0 9deg, transparent 9deg 22deg);
  animation: spin 14s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.rip-big {
  position: relative; font-family: var(--type); font-weight: 700; font-size: 92px; line-height: 1;
  letter-spacing: -2px; text-shadow: 4px 4px 0 #4d0f1d, 0 0 30px rgba(255, 200, 120, .6);
  transform: scale(.4); opacity: 0;
}
.rip-sub {
  position: relative; font-family: var(--type); font-weight: 700; font-size: 17px; line-height: 1.4;
  margin-top: 14px; text-transform: uppercase; letter-spacing: 1px; opacity: 0;
}
.shirt {
  position: absolute; top: 0; bottom: 0; width: 51%; z-index: 2;
  background:
    repeating-linear-gradient(0deg, rgba(40, 70, 130, .45) 0 6px, transparent 6px 22px),
    repeating-linear-gradient(90deg, rgba(40, 70, 130, .45) 0 6px, transparent 6px 22px),
    #7ea4d8;
  box-shadow: inset 0 0 40px rgba(20, 40, 80, .35);
}
.shirt.l { left: 0; border-radius: 10px 0 0 10px; transform-origin: 0 50%;
  clip-path: polygon(0 0, 100% 0, 94% 8%, 100% 16%, 93% 25%, 100% 34%, 94% 43%, 100% 52%, 93% 61%, 100% 70%, 94% 79%, 100% 88%, 95% 100%, 0 100%); }
.shirt.r { right: 0; border-radius: 0 10px 10px 0; transform-origin: 100% 50%;
  clip-path: polygon(6% 0, 100% 0, 100% 100%, 5% 100%, 0 88%, 6% 79%, 0 70%, 7% 61%, 0 52%, 6% 43%, 0 34%, 7% 25%, 0 16%, 6% 8%); }
.shirt .collar { position: absolute; top: 0; width: 70px; height: 56px; background: #f4f6fa; }
.shirt.l .collar { right: 0; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.shirt.r .collar { left: 0; clip-path: polygon(0 0, 100% 0, 0 100%); }
.rip .fly {
  position: absolute; left: 50%; z-index: 3; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: #f4f6fa; box-shadow: inset 0 0 0 3px #c8cfdb, 0 2px 3px rgba(0, 0, 0, .3);
}
.rip.in .shirt.l { animation: shirtShake .5s ease-in-out .5s, ripL .7s cubic-bezier(.3, 1.3, .5, 1) 1s forwards; }
.rip.in .shirt.r { animation: shirtShake .5s ease-in-out .5s, ripR .7s cubic-bezier(.3, 1.3, .5, 1) 1s forwards; }
.rip.in .fly { animation: fly2 .9s cubic-bezier(.2, .7, .4, 1) 1s forwards; }
.rip.in .rip-big { animation: punch .6s cubic-bezier(.2, 1.6, .4, 1) 1.15s forwards; }
.rip.in .rip-sub { animation: fadeUp .5s ease 1.6s forwards; }
.rip .rip-answer { right: -10px; top: -30px; bottom: auto; max-width: 74%; z-index: 4; opacity: 0; transform: none; transition: none; }
.rip.in .rip-answer { animation: stickerSlap .5s cubic-bezier(.2, 1.4, .4, 1) 2.6s forwards; }
@keyframes shirtShake { 0%, 100% { translate: 0; } 20% { translate: -4px 0; } 40% { translate: 4px 0; } 60% { translate: -5px 0; } 80% { translate: 5px 0; } }
@keyframes ripL { to { transform: translateX(-62%) rotate(-14deg); opacity: 0; } }
@keyframes ripR { to { transform: translateX(62%) rotate(14deg); opacity: 0; } }
@keyframes fly2 { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }
@keyframes punch { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes stickerSlap { 0% { opacity: 0; transform: rotate(-14deg) scale(1.6); } 100% { opacity: 1; transform: rotate(4deg) scale(1); } }

/* ярлык главы: скотч на углу, без повтора заголовка */
.chapter-label { font-size: 26px; padding: 10px 20px 10px 18px; margin: 4px 0 4px; }
.chapter-label::after { left: -10px; top: -4px; bottom: auto; width: 46px; height: 18px; margin: 0; transform: rotate(-35deg); }
.chapter .day-title { display: none; }

/* ---------- зайчик с сердечками ---------- */
.bunny {
  position: absolute; left: -20px; top: -30px; z-index: 8;
  width: 84px; height: 84px; padding: 0; border: 0; background: none; cursor: pointer;
}
.bunny .b {
  position: absolute; left: 0; bottom: 0; font-size: 66px; line-height: 1;
  transform-origin: 50% 100%;
  text-shadow:
    3px 0 #fff, -3px 0 #fff, 0 3px #fff, 0 -3px #fff,
    2px 2px #fff, -2px -2px #fff, 2px -2px #fff, -2px 2px #fff,
    0 5px 6px rgba(60, 40, 30, .25);
  animation: hop 2.4s ease-in-out infinite;
}
.bunny .h {
  position: absolute; left: 50%; top: 6px; font-size: 22px; line-height: 1;
  opacity: 0; animation: heartJump 2.4s ease-out infinite;
}
@keyframes hop {
  0%, 55%, 100% { transform: translateY(0) scale(1, 1); }
  65% { transform: translateY(0) scale(1.12, .88); }
  78% { transform: translateY(-16px) scale(.94, 1.06); }
  90% { transform: translateY(0) scale(1.06, .94); }
}
@keyframes heartJump {
  0% { opacity: 0; transform: translate(-50%, 14px) scale(.3); }
  15% { opacity: 1; transform: translate(-50%, -12px) scale(1.15); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), -78px) scale(.8) rotate(var(--r)); }
}

/* продолжение дня: без шарика и заголовка */
.day.cont::before, .day.cont::after { display: none; }
.day.cont { margin-top: -20px; }

/* ---------- крупная надпись от руки ---------- */
.big-quote { position: relative; margin: 30px 0 18px; padding: 26px 8px 14px; }
.big-quote.reveal { opacity: 1; transform: none; }
.big-text {
  margin: 0; text-align: center;
  font-family: var(--letter); font-size: 46px; line-height: 1.15; color: var(--red);
  transform: rotate(-3deg);
  clip-path: inset(0 100% 0 0);
}
.big-quote.in .big-text { animation: writeIn 1.8s cubic-bezier(.5, .1, .3, 1) .2s forwards; }
@keyframes writeIn { to { clip-path: inset(0 0 0 0); } }
.big-quote.in mark.hl { transition-delay: 1.9s; }
.big-quote .big-sticker {
  right: -8px; top: -18px; bottom: auto; max-width: 70%;
  opacity: 0; transform: none; transition: none;
}
.big-quote.in .big-sticker { animation: stickerSlap .5s cubic-bezier(.2, 1.4, .4, 1) 2.3s forwards; }

/* стикер под надписью, чтобы не закрывал текст */
.big-quote { padding: 6px 8px 56px; }
.big-quote .big-sticker { top: auto; bottom: -6px; right: -6px; max-width: 64%; }

/* отдельный стикер */
.big-quote { padding: 6px 8px 10px; }
.loose { margin: 34px 0 10px; display: flex; justify-content: flex-end; }
.loose.reveal { opacity: 1; transform: none; }
.loose .loose-sticker {
  position: relative; right: auto; bottom: auto; max-width: 80%;
  font-size: 27px; padding: 12px 18px 14px; opacity: 0; transform: none; transition: none;
}
.loose.in .loose-sticker { animation: stickerSlap .5s cubic-bezier(.2, 1.4, .4, 1) .3s forwards; }

/* ---------- закладка-ленточка и содержание ---------- */
.day-nav { display: none !important; }
.footer-space { height: 70px; }
.ribbon {
  position: fixed; right: 18px; top: 0; z-index: 30;
  width: 40px; height: 74px; padding: 0 0 14px; border: 0; cursor: pointer;
  background: linear-gradient(90deg, #a92a40, #cc3f57 45%, #a92a40);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  color: #fff; font-size: 22px; line-height: 1;
  display: none; align-items: flex-end; justify-content: center;
  filter: drop-shadow(0 3px 4px rgba(80, 20, 30, .3));
  transition: height .25s cubic-bezier(.3, 1.5, .5, 1);
}
.ribbon:active { height: 84px; }
body.on-journey .ribbon { display: flex; }

.toc { position: fixed; inset: 0; z-index: 45; display: flex; align-items: flex-end; justify-content: center; }
.toc[hidden] { display: none; }
.toc-backdrop { position: absolute; inset: 0; background: rgba(40, 30, 40, .35); animation: fadeIn .3s both; }
.toc-sheet {
  position: relative; width: 100%; max-width: 520px; max-height: 82vh; max-height: 82dvh; overflow-y: auto;
  background-color: var(--card-warm);
  background-image:
    linear-gradient(90deg, transparent 30px, rgba(196, 52, 76, .35) 30px, rgba(196, 52, 76, .35) 32px, transparent 32px),
    repeating-linear-gradient(transparent 0 37px, rgba(105, 140, 185, .3) 37px 38px);
  border-radius: 14px 14px 0 0; padding: 26px 22px calc(26px + env(safe-area-inset-bottom)) 44px;
  box-shadow: 0 -10px 40px rgba(40, 25, 30, .3);
  animation: sheetUp .4s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.toc-sheet h2 { font-size: 40px; margin: 0 0 6px; }
.toc-month { font-family: var(--letter); font-size: 26px; color: var(--green); margin: 14px 0 0; line-height: 38px; }
.toc-row {
  display: flex; align-items: baseline; gap: 6px; width: 100%;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
  font-family: var(--hand); font-size: 24px; line-height: 38px; color: var(--ink);
  position: relative;
}
.toc-row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 78%; }
.toc-row .dots { flex: 1; border-bottom: 2px dotted rgba(110, 103, 119, .45); transform: translateY(-6px); min-width: 20px; }
.toc-row .pg { font-family: var(--type); font-size: 14px; color: var(--ink-soft); }
.toc-row.on .t { color: var(--red); }
.toc-row.on::before { content: '✎'; position: absolute; left: -24px; color: var(--red); font-size: 20px; }

.toc-row .t { padding-right: 6px; }
.loose { margin-top: 70px; }
