/* ============ Палітра, шрифти, текстури ============ */
:root {
  --paper: #fbf1df;
  --paper-hi: #fffaf0;
  --sheet: #fffdf6;
  --ink: #4a3428;
  --ink-soft: #85664f;
  --peach: #ffc6a5;
  --peach-d: #f79a6e;
  --peach-l: #ffe3d2;
  --peach-ink: #c4673f;
  --mint: #c4ecd8;
  --mint-d: #7ccaa5;
  --mint-l: #e2f6ec;
  --yellow: #ffe08a;
  --yellow-d: #ffc93f;
  --cream: #fff4dc;
  --tear: #b5e4ec;

  --hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --shadow: 0 1px 1px rgba(74, 52, 40, .12), 2px 7px 14px -6px rgba(74, 52, 40, .45);
  --shadow-lift: 0 1px 1px rgba(74, 52, 40, .1), 4px 14px 22px -8px rgba(74, 52, 40, .5);
  --wobbly: 255px 16px 225px 16px / 16px 225px 16px 255px;
  --wobbly-2: 16px 225px 16px 255px / 255px 16px 225px 16px;
  --blob: 28px 11px 26px 9px / 11px 24px 9px 27px;
  --blob-2: 11px 27px 9px 24px / 26px 9px 28px 11px;
  --spring: cubic-bezier(.28, 1.75, .45, 1);

  /* дрібне зерно паперу */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .29 0 0 0 0 .2 0 0 0 0 .12 0 0 0 .6 -.24'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* великі плями та волокна */
  --mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='480' height='480'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.007 .018' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .62 0 0 0 0 .45 0 0 0 0 .26 0 0 0 .5 -.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font: 400 1rem/1.45 var(--body);
  background-color: var(--paper);
  background-image: var(--grain), var(--mottle);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }
img { max-width: none; }
[tabindex="-1"]:focus { outline: none; }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ============ Каркас: сторінки над сценою ============ */
.app {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.scene {
  position: relative;
  flex: none;
  height: min(25%, 190px);
  pointer-events: none;
}

.screen {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding:
    max(22px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    6px
    max(16px, env(safe-area-inset-left));
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.inner {
  margin: auto;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(14px, 2.6vh, 24px);
}

/* ---- переходи між екранами: сторінка блокнота ---- */
.screen.leave-fwd,
.screen.enter-back {
  z-index: 3;
  background-color: var(--paper);
  background-image: var(--grain), var(--mottle);
  box-shadow: 6px 0 22px rgba(74, 52, 40, .2);
  transform-origin: 0 50%;
  pointer-events: none;
}
.screen.leave-fwd { animation: pageOut .62s cubic-bezier(.45, .05, .55, .95) forwards; }
.screen.enter-back { animation: pageIn .7s cubic-bezier(.3, .6, .35, 1) both; }
.screen.enter-fwd { z-index: 1; animation: settle .75s ease-out both; transform-origin: 50% 100%; }
.screen.leave-back { z-index: 1; animation: sink .6s ease forwards; pointer-events: none; }

.screen.leave-fwd::after,
.screen.enter-back::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(90deg, rgba(74, 52, 40, 0) 30%, rgba(74, 52, 40, .22));
  pointer-events: none;
  animation: shade .62s ease forwards;
}
.screen.enter-back::after { animation-direction: reverse; }

@keyframes pageOut {
  0% { transform: perspective(1600px) rotateY(0); }
  100% { transform: perspective(1600px) rotateY(-100deg); }
}
@keyframes pageIn {
  0% { transform: perspective(1600px) rotateY(-100deg); }
  68% { transform: perspective(1600px) rotateY(5deg); }
  84% { transform: perspective(1600px) rotateY(-2deg); }
  100% { transform: perspective(1600px) rotateY(0); }
}
@keyframes settle {
  0% { transform: translateX(16px) rotate(1deg); opacity: .3; }
  45% { transform: translateX(-5px) rotate(-.7deg); opacity: 1; }
  70% { transform: translateX(2px) rotate(.35deg); }
  100% { transform: none; }
}
@keyframes sink {
  to { transform: scale(.96) rotate(-1deg); opacity: 0; }
}
@keyframes shade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============ Заголовки й каракулі ============ */
.title-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  padding: 0 .12em;
  font-size: clamp(2.4rem, min(11vw, 7vh), 3.4rem);
}
.title-wrap--xl { font-size: clamp(3rem, min(14.5vw, 9vh), 4.6rem); }
.title-wrap--lg { font-size: clamp(2.7rem, min(12vw, 7.6vh), 3.7rem); }
.title-wrap--md { font-size: clamp(2.1rem, min(9vw, 6vh), 2.9rem); }

.title {
  position: relative;
  z-index: 2;
  margin: 0;
  font: 700 1em/1.02 var(--hand);
  color: var(--ink);
  letter-spacing: .005em;
  text-wrap: balance;
}

.doodle {
  position: absolute;
  z-index: 1;
  display: block;
  pointer-events: none;
}
.doodle svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.d-underline { left: 5%; right: 5%; bottom: -.3em; }
.d-underline--short { left: 16%; right: 12%; bottom: -.36em; }

.draw {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: var(--len, 4000px);
  stroke-dashoffset: var(--len, 4000px);
}
.draw.has-fill { fill: var(--fill); fill-opacity: 0; }
.is-in .draw {
  animation: draw var(--dur, .75s) cubic-bezier(.6, .05, .35, 1) var(--delay, 0s) forwards;
}
.is-in .draw.has-fill {
  animation:
    draw var(--dur, .75s) cubic-bezier(.6, .05, .35, 1) var(--delay, 0s) forwards,
    fillIn .4s ease calc(var(--delay, 0s) + var(--dur, .75s) * .7) forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fillIn { to { fill-opacity: 1; } }

/* рукописна поява тексту */
.js .screen:not(.is-in) .reveal {
  -webkit-clip-path: inset(-40% 102% -40% -10%);
  clip-path: inset(-40% 102% -40% -10%);
}
.is-in .reveal { animation: reveal 1s cubic-bezier(.55, .12, .35, 1) var(--rdelay, .15s) backwards; }
@keyframes reveal {
  from { -webkit-clip-path: inset(-40% 102% -40% -10%); clip-path: inset(-40% 102% -40% -10%); }
  to { -webkit-clip-path: inset(-40% -10% -40% -10%); clip-path: inset(-40% -10% -40% -10%); }
}

.js .screen:not(.is-in) .fade-up,
.js .screen:not(.is-in) .pop-in { opacity: 0; }
.is-in .fade-up { animation: fadeUp .65s cubic-bezier(.3, .7, .4, 1) var(--fdelay, .45s) backwards; }
.is-in .pop-in { animation: popIn .7s var(--spring) var(--pdelay, .75s) backwards; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px) rotate(-1.5deg); }
}
@keyframes popIn {
  0% { opacity: 0; transform: scale(.3) rotate(-10deg); }
  50% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}

.lead {
  margin: 0;
  max-width: 21ch;
  font: 700 clamp(1.12rem, 4.8vw, 1.32rem)/1.38 var(--body);
  color: var(--ink-soft);
}

.cta-wrap { position: relative; margin-top: 8px; }
.d-arrow { width: 70px; left: -76px; top: -40px; }

/* ============ Кнопки ============ */
.btn {
  --tilt: -1.2deg;
  --bg: var(--peach);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  min-height: 52px;
  margin: 0;
  padding: .36em 1.2em .44em;
  font: 700 1.6rem/1 var(--hand);
  color: var(--ink);
  background: var(--bg);
  border: 2.5px solid var(--ink);
  border-radius: var(--blob);
  box-shadow: var(--shadow);
  rotate: var(--tilt);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition:
    transform .5s var(--spring),
    scale .55s var(--spring),
    box-shadow .25s ease,
    background-color .3s ease,
    opacity .25s ease;
}
.btn::after {
  content: '';
  position: absolute;
  inset: -5px -3px -3px -6px;
  border: 1.5px solid var(--ink);
  border-radius: var(--blob-2);
  opacity: .35;
  rotate: 1.4deg;
  pointer-events: none;
  transition: opacity .25s;
}
@media (hover: hover) {
  .btn:not(:disabled):hover { transform: translateY(-2px) rotate(.8deg); box-shadow: var(--shadow-lift); }
}
.btn:not(:disabled):not(.is-running):active {
  transform: scale(.86) rotate(-1.5deg);
  box-shadow: 0 1px 2px rgba(74, 52, 40, .3);
  transition: transform .08s ease-out, box-shadow .08s ease-out;
}
.btn:focus-visible { outline: 3px dashed var(--peach-d); outline-offset: 7px; }
.btn:disabled {
  cursor: not-allowed;
  background: transparent;
  border-style: dashed;
  color: var(--ink-soft);
  box-shadow: none;
  opacity: .65;
}
.btn:disabled::after { opacity: 0; }

.btn-primary { --bg: var(--peach); }
.btn-ghost { --bg: var(--paper-hi); --tilt: 1.3deg; }
.btn-lg { min-height: 58px; font-size: 1.85rem; padding-inline: 1.35em; }
.btn-xl {
  min-height: 64px;
  width: 100%;
  max-width: 340px;
  padding-inline: .7em;
  font-size: clamp(1.65rem, 7.6vw, 1.95rem);
  white-space: nowrap;
}
.btn-sm { min-height: 44px; font-size: 1.35rem; padding-inline: 1em; }

.btn.wake { animation: wake .6s var(--spring); }
@keyframes wake {
  0% { transform: scale(1); }
  35% { transform: scale(1.14) rotate(2deg); }
  65% { transform: scale(.95) rotate(-1deg); }
  100% { transform: none; }
}

.nav {
  position: sticky;
  bottom: 0;
  z-index: 5;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 14px 6px 10px;
}
/* подкладка под кнопками нужна, только если экран прокручивается */
.nav { isolation: isolate; }
.screen.is-scrolly .nav::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -16px -16px 0;
  background-color: var(--paper);
  background-image: var(--grain);
  -webkit-mask-image: linear-gradient(to top, #000 75%, transparent);
  mask-image: linear-gradient(to top, #000 75%, transparent);
}
.nav .btn { flex: 1 1 0; max-width: 170px; }
.nav--solo { position: static; justify-content: center; background: none; padding-top: 0; }
.nav--solo .btn { flex: none; }
.screen.is-scrolly .nav--solo::before { display: none; }

/* ============ Полароїди ============ */
.polaroid {
  position: relative;
  margin: 0;
  padding: 9px 9px 32px;
  background: #fffdf8;
  border-radius: 2px;
  box-shadow: var(--shadow);
  rotate: -3deg;
}
.polaroid img {
  display: block;
  width: var(--ph);
  height: var(--ph);
  object-fit: cover;
  object-position: 50% 50%;
  border-radius: 1px;
  background: #ece2d4;
}
.polaroid::before,
.mini-photo::before {
  content: '';
  position: absolute;
  z-index: 3;
  top: -14px;
  left: 50%;
  width: 92px;
  height: 28px;
  margin-left: -46px;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 45%),
    rgba(255, 224, 138, .72);
  rotate: -5deg;
  box-shadow: 0 1px 2px rgba(74, 52, 40, .15);
  -webkit-clip-path: polygon(3% 0, 97% 0, 100% 14%, 96% 29%, 100% 44%, 96% 59%, 100% 74%, 96% 88%, 98% 100%, 2% 100%, 0 86%, 4% 72%, 0 57%, 4% 42%, 0 27%, 4% 12%);
  clip-path: polygon(3% 0, 97% 0, 100% 14%, 96% 29%, 100% 44%, 96% 59%, 100% 74%, 96% 88%, 98% 100%, 2% 100%, 0 86%, 4% 72%, 0 57%, 4% 42%, 0 27%, 4% 12%);
}
.polaroid--cool { rotate: 3.5deg; }
.polaroid--cool::before { rotate: 4deg; background-color: rgba(196, 236, 216, .78); }

/* ============ Екран із хом'яком ============ */
.photo-stage {
  --ph: clamp(120px, min(52vw, 26vh), 220px);
  position: relative;
  display: grid;
  place-items: center;
  margin-top: 16px;
}
.photo-stage > .photo-fly,
.photo-stage > .cool-wrap { grid-area: 1 / 1; }

.photo-scale {
  transform: scale(var(--hs, 1));
  transform-origin: 50% 45%;
  transition: transform .55s var(--spring);
}
.photo-sway.is-sad { animation: sadSway 2.6s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes sadSway {
  0%, 100% { transform: rotate(-2.6deg); }
  50% { transform: rotate(2.6deg); }
}
.polaroid.shake { animation: shake .5s ease; }
@keyframes shake {
  0%, 100% { transform: none; }
  15% { transform: translateX(-7px) rotate(-2.2deg); }
  30% { transform: translateX(6px) rotate(2deg); }
  45% { transform: translateX(-4px) rotate(-1.3deg); }
  60% { transform: translateX(3px) rotate(.8deg); }
  78% { transform: translateX(-1.5px); }
}

.tears {
  position: absolute;
  left: 9px;
  top: 9px;
  width: var(--ph);
  height: var(--ph);
  overflow: visible;
  pointer-events: none;
}
.tear { opacity: 0; transition: opacity .35s ease; }
.tear.is-on { opacity: 1; }
.tear path { fill: var(--tear); stroke: var(--ink); stroke-width: 1.1; opacity: 0; }
.tear.is-on path { animation: tearFall var(--td, 1.6s) cubic-bezier(.5, 0, .85, .55) var(--tdl, 0s) infinite; }
@keyframes tearFall {
  0% { transform: translate(0, 0) scale(.2); opacity: 0; }
  14% { transform: translate(0, 1px) scale(1); opacity: 1; }
  78% { opacity: 1; }
  100% { transform: translate(var(--tx, 0px), 64px) scale(.85); opacity: 0; }
}

.cool-wrap { visibility: hidden; }

.burst {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--ph) * 1.8);
  translate: -50% -50%;
  pointer-events: none;
}
.burst .doodle { position: relative; width: 100%; }

.swap { display: grid; width: 100%; }
.swap > * { grid-area: 1 / 1; }
.ask-block,
.yes-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2vh, 18px);
}

.yn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  min-height: 78px;
}
.btn-yes { scale: var(--ys, 1); }
.btn-yes.is-begging { animation: nudge 1.5s ease-in-out infinite; }
@keyframes nudge {
  0%, 100% { rotate: -2.5deg; }
  50% { rotate: 2.5deg; }
}

.runaway {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  pointer-events: none;
}
.btn-no.is-running {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  transform-origin: 0 0;
  animation: none;
  transition:
    translate .45s cubic-bezier(.25, 1.45, .5, 1),
    scale .4s var(--spring),
    rotate .4s ease,
    opacity .3s ease;
}
.btn-no.is-gone { opacity: 0; scale: .2 !important; pointer-events: none; }

.hint {
  margin: 0;
  min-height: 2.2em;
  max-width: 15em;
  font: 700 clamp(1.75rem, 7.4vw, 2.1rem)/1.05 var(--hand);
  color: var(--peach-ink);
}
.hint.rewrite,
.copy-hint.rewrite { animation: reveal .75s cubic-bezier(.55, .12, .35, 1) backwards; }

/* стан «Так» */
.ask.is-yes .photo-fly { animation: flyAway .75s cubic-bezier(.5, -.35, .7, .4) forwards; pointer-events: none; }
.ask.is-yes .cool-wrap { visibility: visible; animation: bang .85s var(--spring) .32s backwards; }
.ask.is-yes .burst { display: block; animation: burstIn .7s var(--spring) .28s backwards; }
.ask.is-yes .ask-block { animation: fadeAway .35s ease forwards; pointer-events: none; }
.ask.is-settled .photo-fly { display: none; }
.ask.is-settled .cool-wrap { animation: none; }
.ask.is-settled .ask-block { visibility: hidden; animation: none; }
.ask.is-settled .burst { animation: burstPulse 3.2s ease-in-out infinite; }

@keyframes flyAway {
  0% { transform: none; opacity: 1; }
  22% { transform: translate(10%, -4%) rotate(8deg); opacity: 1; }
  100% { transform: translate(-190%, -50%) rotate(-55deg) scale(.7); opacity: 0; }
}
@keyframes bang {
  0% { transform: scale(0) rotate(-30deg); }
  55% { transform: scale(1.18) rotate(6deg); }
  75% { transform: scale(.94) rotate(-2deg); }
  90% { transform: scale(1.03) rotate(1deg); }
  100% { transform: none; }
}
@keyframes burstIn {
  0% { transform: scale(.2) rotate(-25deg); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
@keyframes burstPulse {
  0%, 100% { transform: scale(1) rotate(0); }
  50% { transform: scale(1.04) rotate(3deg); }
}
@keyframes fadeAway {
  to { opacity: 0; transform: translateY(18px) rotate(2deg); }
}

/* ============ Календар ============ */
.sheet {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 30px 12px 12px;
  background-color: var(--sheet);
  background-image:
    linear-gradient(rgba(110, 150, 190, .16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 150, 190, .16) 1px, transparent 1px);
  background-size: 15px 15px;
  background-position: -1px -1px;
  border-radius: 4px 9px 6px 11px / 10px 5px 9px 6px;
  box-shadow: var(--shadow);
  rotate: -.8deg;
}
.sheet::before {
  content: '';
  position: absolute;
  top: 9px;
  left: 18px;
  right: 18px;
  height: 11px;
  background:
    radial-gradient(circle at 5.5px 5.5px, var(--paper) 0 3.4px, rgba(74, 52, 40, .35) 3.9px, transparent 4.6px)
    0 0 / 23px 11px repeat-x;
}

.calendar { --cell: clamp(34px, min(10.6vw, 5.8vh), 44px); }

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}
.cal-month { font: 700 1.95rem/1 var(--hand); }

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--paper-hi);
  border: 2px solid var(--ink);
  border-radius: var(--wobbly);
  box-shadow: var(--shadow);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .45s var(--spring), opacity .2s ease;
}
.icon-btn svg { width: 26px; height: 26px; overflow: visible; }
.icon-btn:not(:disabled):active { transform: scale(.82) rotate(-6deg); transition-duration: .08s; }
.icon-btn:disabled { opacity: .25; cursor: default; box-shadow: none; border-style: dashed; }
.icon-btn:focus-visible { outline: 3px dashed var(--peach-d); outline-offset: 4px; }

.ink {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 4px 0 4px;
  font: 700 1.25rem/1 var(--hand);
  color: var(--ink-soft);
}
.cal-week .we { color: var(--peach-ink); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 2px;
}
.cal-grid.slide-next { animation: calNext .38s ease; }
.cal-grid.slide-prev { animation: calPrev .38s ease; }
@keyframes calNext { from { opacity: 0; transform: translateX(26px) rotate(1deg); } }
@keyframes calPrev { from { opacity: 0; transform: translateX(-26px) rotate(-1deg); } }

.day {
  position: relative;
  height: var(--cell);
  padding: 0;
  border: 0;
  background: none;
  font: 700 1.55rem/1 var(--hand);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.day.we { color: var(--peach-ink); }
.day::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 31px;
  margin: -15px 0 0 -17px;
  border-radius: 48% 52% 45% 55% / 55% 45% 55% 45%;
  background: var(--peach);
  opacity: 0;
  transform: scale(.3) rotate(-20deg);
  transition: opacity .2s ease, transform .4s var(--spring);
}
.day.is-selected::before { opacity: .9; transform: rotate(-6deg); }
.day.is-selected { color: var(--ink); }
.day .num { position: relative; display: inline-block; transition: transform .3s var(--spring); }
.day.is-selected .num { animation: hop .55s var(--spring); }
.day:not(:disabled):active .num { transform: scale(.8); transition-duration: .08s; }
.day:disabled { color: rgba(74, 52, 40, .2); cursor: default; }
.day:focus-visible { outline: 2.5px dashed var(--peach-d); outline-offset: -2px; border-radius: 10px; }

.ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  overflow: visible;
  pointer-events: none;
}
.ring-today path {
  fill: none;
  stroke: var(--mint-d);
  stroke-width: 2.2;
  stroke-linecap: round;
}
.ring-sel .draw { stroke-width: 2.5; --dur: .55s; }

@keyframes hop {
  0% { transform: none; }
  30% { transform: translateY(-9px) scale(1.07); }
  55% { transform: translateY(2px) scale(.97); }
  75% { transform: translateY(-3px); }
  100% { transform: none; }
}

/* ============ Час ============ */
.slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px 13px;
  width: 100%;
  max-width: 360px;
  padding: 4px 6px;
}
.slot {
  --c: var(--peach);
  --cd: var(--peach-d);
  position: relative;
  height: clamp(50px, 7.2vh, 60px);
  padding: 0;
  border: 0;
  border-radius: 3px 6px 4px 8px / 6px 3px 8px 4px;
  background: var(--c);
  color: var(--ink);
  font: 700 1.7rem/1 var(--hand);
  box-shadow: var(--shadow);
  rotate: var(--r, 0deg);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .45s var(--spring), background-color .3s ease, box-shadow .3s ease;
}
.slot::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  border-radius: 0 0 8px 0;
  background: linear-gradient(-45deg, var(--paper) 50%, rgba(74, 52, 40, .16) 50%, rgba(255, 255, 255, .7) 60%, rgba(255, 255, 255, .35));
}
.slot:not(:disabled):active { transform: scale(.88); transition-duration: .08s; }
.slot.is-selected {
  background: var(--cd);
  box-shadow: var(--shadow-lift), inset 0 0 0 2.5px var(--ink);
  animation: hop .6s var(--spring);
}
.slot:disabled { opacity: .3; box-shadow: none; cursor: default; }
.slot .check,
.card .check {
  position: absolute;
  width: 30px;
  right: -9px;
  top: -14px;
  pointer-events: none;
}
.check .draw { stroke-width: 3; --dur: .45s; }

.late-note {
  margin: 0;
  font: 700 1.5rem/1.15 var(--hand);
  color: var(--peach-ink);
}

/* ============ Транспорт ============ */
.cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 400px;
}
.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: clamp(82px, 12.4vh, 104px);
  padding: 6px 16px 6px 6px;
  text-align: left;
  background: var(--paper-hi);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 24px 9px 28px 10px / 10px 26px 9px 24px;
  box-shadow: var(--shadow);
  rotate: var(--r, 0deg);
  font: 700 clamp(1.6rem, 7vw, 2rem)/1 var(--hand);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .3s ease, box-shadow .3s ease, transform .45s var(--spring);
}
.card:not(:disabled):active { transform: scale(.95); transition-duration: .08s; }
.card:focus-visible { outline: 3px dashed var(--peach-d); outline-offset: 5px; }
.card.is-selected { background: var(--mint); box-shadow: var(--shadow-lift); animation: hop .6s var(--spring); }
.card .art {
  flex: none;
  width: clamp(104px, 34vw, 138px);
  height: clamp(64px, 10.4vh, 86px);
}
.card .art svg { display: block; width: 100%; height: 100%; overflow: visible; }
.card .check { right: -6px; top: -16px; }

.spin {
  animation: spin 1.9s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.is-fast .spin { animation-duration: .6s; }
@keyframes spin { to { transform: rotate(360deg); } }

.speed { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; opacity: 0; transition: opacity .3s; }
.card.is-selected .speed { opacity: .8; animation: whoosh .5s linear infinite; }
@keyframes whoosh {
  0% { transform: translateX(6px); }
  100% { transform: translateX(-6px); }
}
.qmark { animation: bob 1.6s ease-in-out infinite; }
.card.is-selected .qmark { animation-duration: .7s; }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-5px) rotate(6deg); }
}
.ground { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; opacity: .45; stroke-dasharray: 10 6; }

/* спільні деталі велосипеда й самоката (і в картках, і в сцені) */
.tire { fill: var(--cream); stroke: var(--ink); stroke-width: 2.3; }
.tire-in { fill: none; stroke: var(--ink); stroke-width: 1; opacity: .4; }
.spokes { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-linecap: round; }
.hub { fill: var(--ink); }
.frame-o { fill: none; stroke: var(--ink); stroke-width: 6.2; stroke-linecap: round; stroke-linejoin: round; }
.frame { fill: none; stroke: var(--peach-d); stroke-width: 3.1; stroke-linecap: round; stroke-linejoin: round; }
.frame.is-mint { stroke: var(--mint-d); }
.saddle { fill: none; stroke: var(--ink); stroke-width: 3.6; stroke-linecap: round; }
.chainring { fill: var(--yellow); stroke: var(--ink); stroke-width: 1.6; }
.q { fill: none; stroke: var(--ink); stroke-width: 3.4; stroke-linecap: round; }
.qdot { fill: var(--ink); }

/* ============ Фінал ============ */
.note {
  --lh: 2.15rem;
  position: relative;
  width: 100%;
  max-width: 370px;
  margin-top: 14px;
  padding: calc(var(--lh) - .2rem) 18px calc(var(--lh) * .7) 50px;
  text-align: left;
  background-color: var(--sheet);
  background-image:
    linear-gradient(90deg, transparent 37px, rgba(232, 120, 105, .5) 37px 39px, transparent 39px),
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--lh) - 1px), rgba(110, 150, 190, .34) calc(var(--lh) - 1px) var(--lh));
  background-position: 0 0, 0 -.2rem;
  border-radius: 3px 8px 5px 10px / 9px 4px 8px 5px;
  box-shadow: var(--shadow);
  rotate: 1deg;
}
.note-float {
  float: right;
  width: 72px;
  height: calc(var(--lh) * 1.5);
}
.mini-photo {
  position: absolute;
  z-index: 2;
  right: -12px;
  top: -30px;
  margin: 0;
  padding: 5px 5px 16px;
  background: #fffdf8;
  box-shadow: var(--shadow);
  rotate: 8deg;
}
.mini-photo img {
  display: block;
  width: 78px;
  height: 78px;
  object-fit: cover;
}
.mini-photo::before { width: 56px; height: 20px; margin-left: -28px; top: -10px; rotate: -8deg; }

.msg {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
  font: 700 1.62rem/var(--lh) var(--hand);
  color: #3d2b20;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}
.msg::selection { background: var(--yellow); }

#btn-copy.is-copied { --bg: var(--mint); }
.copy-hint {
  margin: -4px 0 0;
  min-height: 1.2em;
  max-width: 16em;
  font: 700 1.65rem/1.15 var(--hand);
  color: var(--peach-ink);
}

/* ============ Сцена ============ */
.scene svg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.sc-ink { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sc-thin { stroke-width: 1.3; }
.sc-far { fill: #d5efe1; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.sc-field { fill: #ffe6d4; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.sc-grass { fill: #b9e4cc; }
.sc-road { fill: #f9e2a4; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.sc-dash { fill: none; stroke: rgba(74, 52, 40, .42); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 7 11; }
.sc-stone { fill: #e9cfa0; stroke: var(--ink); stroke-width: 1.2; }
.sc-bump { fill: #ecc98a; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.sc-trunk { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.sc-crown { fill: #a7dcbf; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.sc-flower { stroke: var(--ink); stroke-width: 1.1; }
.cloud { fill: #fffaf1; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.sun-body { fill: var(--yellow); stroke: var(--ink); stroke-width: 2; }
.sun-cheek { fill: var(--peach); opacity: .8; }
.sun-rays { animation: spin-view 28s linear infinite; }
@keyframes spin-view { to { transform: rotate(360deg); } }
.crown { animation: sway 3.8s ease-in-out infinite alternate; }
@keyframes sway {
  from { transform: rotate(-3.2deg); }
  to { transform: rotate(3.2deg); }
}

.sc-limb { fill: none; stroke: var(--ink); stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.sc-limb.is-far { opacity: .55; }
.sc-torso-o { fill: none; stroke: var(--ink); stroke-width: 8.6; stroke-linecap: round; }
.sc-torso { fill: none; stroke: var(--mint-d); stroke-width: 5.4; stroke-linecap: round; }
.sc-torso.is-peach { stroke: var(--peach-d); }
.sc-head { fill: #fff0de; stroke: var(--ink); stroke-width: 1.9; }
.sc-eye { fill: var(--ink); }
.sc-blush { fill: var(--peach); opacity: .85; }
.sc-cap { fill: var(--peach-d); stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.sc-hair { fill: none; stroke: #6a4632; stroke-width: 3.6; stroke-linecap: round; }
.sc-hair-fill { fill: #6a4632; }
.sc-scarf-o { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.sc-scarf { fill: none; stroke: var(--peach-d); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.sc-scarf.is-yellow { stroke: var(--yellow-d); }
.sc-knot { fill: var(--peach-d); stroke: var(--ink); stroke-width: 1.4; }
.sc-knot.is-yellow { fill: var(--yellow-d); }
.sc-wind { fill: none; stroke: var(--ink-soft); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 9 24; opacity: .75; }

/* ============ Конфеті ============ */
.confetti {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  overflow: hidden;
  pointer-events: none;
  perspective: 700px;
}
.cf {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  will-change: transform, opacity;
}

.noscript {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 24px;
  font: 700 2rem/1.2 var(--hand);
  text-align: center;
  background: var(--paper);
}

/* ============ Ширші екрани ============ */
@media (min-width: 560px) {
  .slots { grid-template-columns: repeat(4, 1fr); max-width: 420px; }
}

/* ============ Менше руху ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0s !important;
  }
  .draw { stroke-dasharray: none !important; stroke-dashoffset: 0 !important; }
  .draw.has-fill { fill-opacity: 1 !important; }
  .tear.is-on path { animation: none !important; opacity: 1; }
  .photo-sway.is-sad,
  .btn-yes.is-begging { animation: none !important; }
}
