﻿:root {
  --paper: #fff8ea;
  --paper-deep: #f7e4bf;
  --ink: #4d332f;
  --muted: #875f58;
  --red: #e84f74;
  --pink: #ff9db8;
  --yellow: #f8c84f;
  --green: #4aa875;
  --blue: #5f8fd8;
  --shadow: 0 28px 70px rgba(111, 66, 46, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 16%, rgba(255, 157, 184, 0.28), transparent 26%),
    radial-gradient(circle at 86% 14%, rgba(248, 200, 79, 0.28), transparent 22%),
    linear-gradient(135deg, #fff3d8 0%, #ffe7ec 45%, #e6f6ff 100%);
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body.mama2-page {
  --paper: #fff7ee;
  --paper-deep: #efd5cb;
  --ink: #312636;
  --muted: #715368;
  --red: #d93c5f;
  --pink: #ffa0ba;
  --yellow: #f2c75a;
  --green: #457c69;
  --blue: #536aa8;
  --shadow: 0 28px 80px rgba(32, 20, 41, 0.24);
  background:
    radial-gradient(circle at 18% 15%, rgba(217, 60, 95, 0.3), transparent 24%),
    radial-gradient(circle at 82% 18%, rgba(38, 31, 54, 0.28), transparent 27%),
    radial-gradient(circle at 55% 86%, rgba(242, 199, 90, 0.2), transparent 22%),
    linear-gradient(135deg, #fff0e8 0%, #f7d8e2 46%, #e7eaf8 100%);
}

body.mama2-page h1 {
  color: #5c2444;
}

body.mama2-page .primary-button,
body.mama2-page .control-button {
  background: linear-gradient(135deg, #2b2339, #d93c5f);
  box-shadow: 0 14px 30px rgba(43, 35, 57, 0.24);
}

body.mama2-page .input-wrap input {
  border-color: rgba(43, 35, 57, 0.38);
}

button,
input {
  font: inherit;
}

.app {
  min-height: 100vh;
}

.login-view,
.story-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.paper {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(rgba(142, 102, 75, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(142, 102, 75, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px, 36px 36px, auto;
  border: 2px solid rgba(127, 84, 55, 0.16);
  box-shadow: var(--shadow);
}

.paper::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.75), transparent 18%),
    radial-gradient(circle at 78% 82%, rgba(111, 66, 46, 0.07), transparent 24%);
  mix-blend-mode: multiply;
}

.login-paper {
  width: min(720px, 100%);
  min-height: 620px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(34px, 7vw, 76px);
  border-radius: 8px;
  transform: rotate(-0.7deg);
}

.paper-pin {
  position: absolute;
  top: 26px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: inset -5px -6px 0 rgba(112, 29, 54, 0.15), 0 9px 16px rgba(111, 66, 46, 0.18);
}

.paper-pin-left {
  left: 32px;
}

.paper-pin-right {
  right: 32px;
  background: var(--blue);
}

.title-doodle {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 22px;
}

.title-doodle span {
  width: 44px;
  height: 38px;
  background: var(--pink);
  transform: rotate(-10deg);
  clip-path: path("M22 35 C-16 11 5 -9 22 11 C39 -9 60 11 22 35 Z");
}

.title-doodle span:nth-child(2) {
  width: 55px;
  height: 48px;
  background: var(--red);
  transform: translateY(-6px) rotate(7deg);
}

.title-doodle span:nth-child(3) {
  background: var(--yellow);
  transform: rotate(13deg);
}

h1 {
  margin: 0 0 28px;
  color: #7b2f42;
  font-family: "Gaegu", "Patrick Hand", cursive;
  font-size: clamp(52px, 10vw, 92px);
  font-weight: 700;
  line-height: 0.88;
  text-align: center;
  letter-spacing: 0;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.68);
}

.login-form {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
}

.login-form label {
  max-width: 540px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(18px, 3vw, 23px);
  font-weight: 800;
  line-height: 1.24;
  text-align: center;
}

.input-wrap {
  position: relative;
  width: min(480px, 100%);
  margin: 0 auto;
}

.input-wrap input {
  width: 100%;
  min-height: 66px;
  padding: 0 68px 0 22px;
  color: #613734;
  background: rgba(255, 255, 255, 0.68);
  border: 3px dashed rgba(232, 79, 116, 0.55);
  border-radius: 8px;
  outline: none;
  font-family: "Patrick Hand", cursive;
  font-size: 34px;
  line-height: 1;
  box-shadow: inset 0 3px 12px rgba(111, 66, 46, 0.08);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.input-wrap input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 5px rgba(232, 79, 116, 0.13), inset 0 3px 12px rgba(111, 66, 46, 0.08);
  transform: translateY(-1px);
}

.input-heart {
  position: absolute;
  right: 22px;
  top: 50%;
  color: var(--red);
  font-size: 32px;
  transform: translateY(-50%);
}

.live-hint {
  min-height: 56px;
  width: min(560px, 100%);
  margin: 0 auto;
  color: #8c3950;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.28;
  text-align: center;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.live-hint.show {
  opacity: 1;
  transform: translateY(0);
}

.primary-button,
.control-button {
  justify-self: center;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #e84f74, #a93d8d);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(169, 61, 141, 0.24);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 0 30px;
  font-size: 21px;
  font-weight: 900;
}

.primary-button strong {
  font-weight: 900;
  opacity: 0.88;
}

.primary-button:hover,
.control-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(169, 61, 141, 0.28);
  filter: saturate(1.04);
}

.primary-button:active,
.control-button:active {
  transform: translateY(0);
}

.story-view {
  padding: clamp(12px, 3vw, 32px);
}

.story-shell {
  width: min(1200px, 100%, calc((100vh - 290px) * 1.579));
  min-width: min(100%, 560px);
}

.story-toolbar {
  width: min(680px, 72vw);
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin: 0 auto -16px;
  padding: 13px 18px 25px;
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(127, 84, 55, 0.13);
  border-radius: 8px 8px 0 0;
  box-shadow: 0 12px 35px rgba(111, 66, 46, 0.14);
}

.crayon {
  width: 76px;
  height: 18px;
  border-radius: 999px 5px 5px 999px;
  box-shadow: inset -14px 0 rgba(255, 255, 255, 0.23), 0 4px 9px rgba(111, 66, 46, 0.13);
  transform: rotate(var(--angle, -3deg));
}

.crayon.red {
  --angle: -5deg;
  background: var(--red);
}

.crayon.yellow {
  --angle: 2deg;
  background: var(--yellow);
}

.crayon.green {
  --angle: -2deg;
  background: var(--green);
}

.crayon.blue {
  --angle: 4deg;
  background: var(--blue);
}

.crayon.pink {
  --angle: -1deg;
  background: var(--pink);
}

.story-paper {
  min-height: auto;
  border-radius: 8px;
  transform: rotate(0.35deg);
}

.story-progress {
  width: min(900px, calc(100% - 28px));
  display: grid;
  gap: 9px;
  margin: 16px auto 0;
  padding: 13px 14px 11px;
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(127, 84, 55, 0.12);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(111, 66, 46, 0.12);
  backdrop-filter: blur(8px);
}

.progress-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #7b2f42;
  font-size: 15px;
  font-weight: 900;
}

.progress-status time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  background: rgba(127, 84, 55, 0.13);
  border-radius: 999px;
}

.progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green), var(--blue));
  border-radius: inherit;
  transition: width 120ms linear;
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.progress-step {
  min-width: 0;
  display: grid;
  gap: 4px;
  color: rgba(77, 51, 47, 0.62);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
}

.progress-step::before {
  content: "";
  width: 13px;
  height: 13px;
  justify-self: center;
  border-radius: 999px;
  background: rgba(127, 84, 55, 0.18);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.72);
}

.progress-step.is-done,
.progress-step.is-active {
  color: #7b2f42;
}

.progress-step.is-done::before {
  background: var(--green);
}

.progress-step.is-active::before {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(232, 79, 116, 0.18), inset 0 0 0 2px rgba(255, 255, 255, 0.76);
}

.story-controls {
  width: min(760px, calc(100% - 28px));
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px auto 0;
  padding: 11px;
  background: rgba(255, 255, 255, 0.74);
  border: 2px solid rgba(127, 84, 55, 0.13);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(111, 66, 46, 0.14);
}

.control-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  font-size: 14px;
  font-weight: 900;
}

.control-button[disabled] {
  cursor: not-allowed;
  opacity: 0.46;
  filter: grayscale(0.4);
  transform: none;
}

.control-icon {
  position: relative;
  width: 17px;
  height: 17px;
  display: inline-block;
  flex: 0 0 auto;
}

.play-icon {
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 13px solid currentColor;
}

.pause-icon::before,
.pause-icon::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 5px;
  height: 13px;
  border-radius: 2px;
  background: currentColor;
}

.pause-icon::before {
  left: 3px;
}

.pause-icon::after {
  right: 3px;
}

.stop-icon {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: currentColor;
}

.replay-icon::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
}

.replay-icon::after {
  content: "";
  position: absolute;
  right: 0;
  top: 1px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid currentColor;
  transform: rotate(24deg);
}

.rewind-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 3px;
  width: 11px;
  height: 11px;
  border: 3px solid currentColor;
  border-left-color: transparent;
  border-radius: 999px;
  transform: rotate(-35deg);
}

.rewind-icon::after {
  content: "1";
  position: absolute;
  right: -1px;
  bottom: -2px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.home-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 13px;
  height: 9px;
  border-radius: 2px;
  background: currentColor;
}

.home-icon::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 1px;
  width: 15px;
  height: 15px;
  border-left: 4px solid currentColor;
  border-top: 4px solid currentColor;
  transform: rotate(45deg);
  border-radius: 2px 0 0 0;
}

.drawing {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 68px);
  aspect-ratio: 1200 / 760;
}

.draw-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: var(--path, 900);
  stroke-dashoffset: var(--path, 900);
  filter: url(#pencilRough);
}

.draw-fill {
  fill: currentColor;
  opacity: 0;
}

.person,
.best-things,
.flowers,
.sun,
.music-doodle,
.bouquet {
  color: #5b413e;
}

body.mama2-page .sun,
body.mama2-page .music-doodle,
body.mama2-page .best-things {
  color: #34293b;
}

body.mama2-page .mom {
  color: #9c3156;
}

body.mama2-page .mom-photo-ring {
  stroke: #2b2339;
}

body.mama2-page .beautiful-text,
body.mama2-page .close-text,
body.mama2-page .sun-text,
body.mama2-page .best-text,
body.mama2-page .worth-text,
body.mama2-page .final-line {
  color: #642345;
}

body.mama2-page .final-line {
  font-size: 54px;
}

body.mama2-page .money-number,
body.mama2-page .money-dollar {
  color: #2f725e;
}

.child {
  color: #5d73c7;
}

.alek {
  color: #5ca4cf;
}

.oliwer {
  color: #4e7ec4;
}

.alek-hair,
.oliwer-hair {
  color: #d8ad43;
}

.mom {
  color: #b44164;
}

.mom-hair {
  color: #5c4134;
}

.face-dot {
  color: #4d332f;
}

.flower-center {
  color: var(--yellow);
}

.hand-text,
.final-line,
.money-number,
.money-dollar {
  fill: currentColor;
  paint-order: stroke;
  stroke: rgba(255, 248, 234, 0.8);
  stroke-width: 4;
  stroke-linejoin: round;
  font-family: "Patrick Hand", "Gaegu", cursive;
  letter-spacing: 0;
  opacity: 0;
  filter: url(#pencilRough);
}

.hand-text {
  color: #7b2f42;
  font-size: 55px;
}

.beautiful-text {
  color: #d04470;
  font-size: 72px;
}

.close-text,
.best-text {
  font-size: 62px;
}

.grows-text,
.sun-text,
.worth-text {
  font-size: 52px;
}

.sun-text {
  font-size: 40px;
}

.best-text {
  font-size: 50px;
}

.money-number,
.money-dollar {
  color: #2f8a5c;
  font-family: "Gaegu", cursive;
  font-size: 126px;
  font-weight: 700;
  stroke-width: 6;
}

.mom-photo-object {
  opacity: 0;
  transform-origin: 736px 300px;
}

.mom-photo-bg {
  fill: #ffdbe5;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 8;
}

.mom-photo-image {
  filter: saturate(0.9) contrast(1.08);
}

.mom-photo-ring {
  fill: none;
  stroke: #b44164;
  stroke-width: 5;
  filter: url(#pencilRough);
}

.mom-photo-object.is-empty .mom-photo-image {
  display: none;
}

.eraser {
  opacity: 0;
  transform: translate(-190px, 290px) rotate(-12deg);
}

.wipe {
  fill: var(--paper);
  opacity: 0;
  pointer-events: none;
}

.big-heart {
  fill: url(#heartHatch);
  stroke: var(--red);
  stroke-width: 11;
  stroke-linejoin: round;
  stroke-dasharray: 1700;
  stroke-dashoffset: 1700;
  filter: url(#pencilRough);
  opacity: 0;
}

.big-heart-hatch {
  fill: none;
  stroke: rgba(232, 79, 116, 0.5);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  opacity: 0;
}

.final-line {
  color: #7b2f42;
  font-size: 72px;
  text-anchor: start;
}

.tiny-heart {
  fill: rgba(232, 79, 116, 0.72);
  stroke: #d04470;
  stroke-width: 6;
  opacity: 0;
  filter: url(#pencilRough);
}

.heart-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.floating-heart {
  position: absolute;
  left: var(--x);
  bottom: -40px;
  width: var(--size);
  height: var(--size);
  color: rgba(232, 79, 116, 0.52);
  animation: floatHeart var(--duration) ease-in forwards;
}

.floating-heart::before,
.floating-heart::after {
  content: "";
  position: absolute;
  width: 50%;
  height: 80%;
  background: currentColor;
  border-radius: 999px 999px 0 0;
  transform-origin: 100% 100%;
}

.floating-heart::before {
  left: 50%;
  transform: rotate(-45deg);
}

.floating-heart::after {
  left: 0;
  transform: rotate(45deg);
  transform-origin: 0 100%;
}

.sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sparkles span {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  opacity: 0;
  animation: sparkle 2.6s ease-in-out infinite;
}

.sparkles span:nth-child(1) {
  left: 12%;
  top: 18%;
}

.sparkles span:nth-child(2) {
  left: 78%;
  top: 21%;
  animation-delay: 0.4s;
}

.sparkles span:nth-child(3) {
  left: 22%;
  top: 72%;
  animation-delay: 0.8s;
}

.sparkles span:nth-child(4) {
  left: 86%;
  top: 68%;
  animation-delay: 1.2s;
}

.sparkles span:nth-child(5) {
  left: 52%;
  top: 12%;
  animation-delay: 1.6s;
}

.story-running .draw-line {
  animation: draw 1.2s ease forwards;
  animation-delay: var(--delay, 0s);
}

.story-running .draw-fill {
  animation: popIn 0.28s ease forwards;
  animation-delay: var(--fill-delay, var(--delay, 0s));
}

.story-running .hand-text,
.story-running .final-line,
.story-running .money-number,
.story-running .money-dollar {
  animation: writeText 0.75s ease forwards;
  animation-delay: var(--delay, 0s);
}

.story-running .mom-photo-object {
  animation: photoReveal 1.15s ease forwards;
  animation-delay: 6.4s;
}

.story-running .eraser {
  animation: eraseSweepFlowers 1.45s ease-in-out forwards, eraseSweepBest 2s ease-in-out forwards, eraseSweepMillion 2s ease-in-out forwards;
  animation-delay: 18.25s, 28.6s, 38.9s;
}

.story-running .million {
  opacity: 1;
}

.story-running .wipe {
  animation: fullWipe 1.45s ease forwards;
  animation-delay: 41.05s;
}

.story-running .big-heart {
  animation: drawHeart 1.55s ease forwards;
  animation-delay: 42.4s;
}

.story-running .big-heart-hatch {
  animation: draw 1s ease forwards;
  animation-delay: 42.95s;
}

.story-running .tiny-heart {
  animation: popIn 0.6s ease forwards, gentleBounce 2.8s ease-in-out infinite;
  animation-delay: var(--delay, 0s), var(--bounce-delay, var(--delay, 0s));
}

.story-running .alek-body { --delay: 0.2s; --path: 110; }
.story-running .alek-arm-left { --delay: 0.38s; --path: 90; }
.story-running .alek-arm-right { --delay: 0.54s; --path: 90; }
.story-running .alek-leg-left { --delay: 0.68s; --path: 100; }
.story-running .alek-leg-right { --delay: 0.82s; --path: 100; }
.story-running .alek-head { --delay: 0.98s; --path: 280; }
.story-running .alek-hair { --delay: 1.16s; --path: 130; }
.story-running .alek-smile { --delay: 1.34s; --path: 70; }
.story-running .alek-eye { --delay: 1.42s; }
.story-running .label-alek { --delay: 1.7s; }
.story-running .label-arrow-alek { --delay: 1.9s; --path: 80; }

.story-running .child-body { --delay: 0.5s; --path: 140; }
.story-running .child-arm-left { --delay: 0.75s; --path: 120; }
.story-running .child-arm-right { --delay: 0.95s; --path: 120; }
.story-running .child-leg-left { --delay: 1.1s; --path: 130; }
.story-running .child-leg-right { --delay: 1.25s; --path: 130; }
.story-running .child-head { --delay: 1.45s; --path: 360; }
.story-running .face-line { --delay: 1.8s; --path: 90; }
.story-running .child-eye { --delay: 1.88s; }
.story-running .label-to-ja { --delay: 2.15s; }
.story-running .label-arrow-ja { --delay: 2.35s; --path: 80; }

.story-running .oliwer-body { --delay: 2.55s; --path: 140; }
.story-running .oliwer-arm-left { --delay: 2.72s; --path: 120; }
.story-running .oliwer-arm-right { --delay: 2.89s; --path: 120; }
.story-running .oliwer-leg-left { --delay: 3.03s; --path: 130; }
.story-running .oliwer-leg-right { --delay: 3.17s; --path: 130; }
.story-running .oliwer-head { --delay: 3.32s; --path: 360; }
.story-running .oliwer-hair { --delay: 3.5s; --path: 150; }
.story-running .oliwer-smile { --delay: 3.68s; --path: 90; }
.story-running .oliwer-eye { --delay: 3.78s; }
.story-running .label-oliwer { --delay: 4.05s; }
.story-running .label-arrow-oliwer { --delay: 4.25s; --path: 80; }

.story-running .mom-body { --delay: 3.05s; --path: 170; }
.story-running .mom-arm-left { --delay: 3.25s; --path: 170; }
.story-running .mom-arm-right { --delay: 3.45s; --path: 170; }
.story-running .mom-leg-left { --delay: 3.65s; --path: 160; }
.story-running .mom-leg-right { --delay: 3.85s; --path: 160; }
.story-running .mom-head-outline { --delay: 4.05s; --path: 520; }
.story-running .mom-hair { --delay: 4.35s; --path: 330; }
.story-running .mom-smile { --delay: 4.65s; --path: 90; }
.story-running .mom-eye { --delay: 4.75s; }
.story-running .label-mama { --delay: 5.05s; }
.story-running .label-arrow-mama { --delay: 5.35s; --path: 90; }
.story-running .beautiful-text { --delay: 7.65s; }

.story-running .close-text { --delay: 9.1s; }
.story-running .sun-core { --delay: 10.2s; --path: 360; }
.story-running .sun-rays { --delay: 10.7s; --path: 520; }
.story-running .sun-core,
.story-running .sun-rays {
  animation-duration: 1.5s;
}
.story-running .sun-text { --delay: 10.7s; }
.story-running .flower-row .draw-line { --delay: 13s; --path: 170; }
.story-running .flower-row .draw-fill { --delay: 13.25s; }
.story-running .f1 .draw-line { --delay: 13s; }
.story-running .f1 .draw-fill { --delay: 13.35s; }
.story-running .f2 .draw-line { --delay: 13.75s; }
.story-running .f2 .draw-fill { --delay: 14.1s; }
.story-running .f3 .draw-line { --delay: 14.5s; }
.story-running .f3 .draw-fill { --delay: 14.85s; }
.story-running .grows-text { --delay: 15.35s; }
.story-running .flower-row {
  animation: eraseObject 1.25s ease forwards;
  animation-delay: 18.45s;
}

.story-running .music-doodle .draw-line {
  --delay: 14.9s;
  --path: 320;
}

.mama2-page .story-running .music-doodle {
  animation: eraseObject 1.25s ease forwards;
  animation-delay: 18.45s;
}

.story-running .house .draw-line { --delay: 19.8s; --path: 430; }
.story-running .car .draw-line { --delay: 20.7s; --path: 390; }
.story-running .jet .draw-line { --delay: 21.6s; --path: 420; }
.story-running .house {
  animation: eraseObject 0.65s ease forwards;
  animation-delay: 28.95s;
}
.story-running .car {
  animation: eraseObject 0.65s ease forwards;
  animation-delay: 29.45s;
}
.story-running .jet {
  animation: eraseObject 0.65s ease forwards;
  animation-delay: 29.95s;
}
.story-running .best-text { --delay: 22.85s; }
.story-running .money-number { --delay: 31.2s; }
.story-running .worth-a { --delay: 31.9s; }
.story-running .money-dollar { --delay: 35.65s; }
.story-running .worth-b { --delay: 35.65s; }

.story-running .final-1 { --delay: 43.8s; }
.story-running .final-2 { --delay: 44.95s; }
.story-running .final-3 { --delay: 46.1s; }
.story-running .final-4 { --delay: 47.1s; }
.story-running .final-decor .draw-line { --delay: 44.3s; --path: 260; }
.story-running .final-decor .draw-fill { --delay: 44.8s; }
.story-running .h1 { --delay: 44.9s; }
.story-running .h2 { --delay: 45.7s; }
.story-running .h3 { --delay: 46.4s; }

.story-running .label-to-ja,
.story-running .label-alek,
.story-running .label-oliwer,
.story-running .label-mama {
  animation: writeText 0.75s ease forwards, eraseTextOut 0.7s steps(12, end) forwards;
  animation-delay: var(--delay, 0s), 9.85s;
}

.story-running .label-arrow-ja,
.story-running .label-arrow-alek,
.story-running .label-arrow-oliwer,
.story-running .label-arrow-mama {
  animation: draw 1.2s ease forwards, eraseStroke 0.65s ease forwards;
  animation-delay: var(--delay, 0s), 9.85s;
}

.story-running .beautiful-text {
  animation: writeText 0.75s ease forwards, fadeTextOut 0.55s ease forwards;
  animation-delay: 7.65s, 10.4s;
}

.story-running .close-text {
  animation: writeText 0.9s ease forwards, fadeTextOut 0.55s ease forwards;
  animation-delay: 9.1s, 12.7s;
}

.story-running .sun-text {
  animation: writeText 1.45s ease forwards, fadeTextOut 0.55s ease forwards;
  animation-delay: 10.7s, 14.2s;
}

.story-running .grows-text {
  animation: writeText 1s ease forwards, eraseTextOut 0.75s steps(16, end) forwards;
  animation-delay: 15.35s, 18.45s;
}

.story-running .best-text {
  animation: writeText 0.9s ease forwards, eraseTextOut 0.7s steps(18, end) forwards;
  animation-delay: 22.85s, 28.65s;
}

.story-running .money-number {
  animation: writeText 1.45s linear forwards;
  animation-delay: 31.2s;
}

.story-running .worth-a {
  animation: writeText 1.25s ease forwards;
  animation-delay: 31.9s;
}

.story-running .money-dollar {
  animation: writeText 0.55s ease forwards;
  animation-delay: 35.65s;
}

.story-running .worth-b {
  animation: writeText 0.85s ease forwards;
  animation-delay: 35.65s;
}

.story-running .money-number {
  animation: writeText 1.45s linear forwards, eraseTextOut 0.55s steps(9, end) forwards;
  animation-delay: 31.2s, 39.05s;
}

.story-running .worth-a {
  animation: writeText 1.25s ease forwards, eraseTextOut 0.55s steps(22, end) forwards;
  animation-delay: 31.9s, 39.55s;
}

.story-running .money-dollar {
  animation: writeText 0.55s ease forwards, eraseTextOut 0.45s steps(1, end) forwards;
  animation-delay: 35.65s, 40.0s;
}

.story-running .worth-b {
  animation: writeText 0.85s ease forwards, eraseTextOut 0.45s steps(8, end) forwards;
  animation-delay: 35.65s, 40.35s;
}

.story-paused *,
.story-paused *::before,
.story-paused *::after {
  animation-play-state: paused !important;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes drawHeart {
  0% {
    opacity: 1;
    stroke-dashoffset: 1700;
  }
  100% {
    opacity: 1;
    stroke-dashoffset: 0;
  }
}

@keyframes writeText {
  0% {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transform: translateY(4px);
  }
  100% {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: translateY(0);
  }
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeTextOut {
  to {
    opacity: 0;
    transform: translateY(-5px);
  }
}

@keyframes eraseTextOut {
  0% {
    opacity: 1;
    clip-path: inset(0 0 0 0);
  }
  100% {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
  }
}

@keyframes eraseStroke {
  to {
    stroke-dashoffset: var(--path, 900);
    opacity: 0;
  }
}

@keyframes photoReveal {
  0% {
    opacity: 0;
    transform: scale(0.7) rotate(-8deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes eraseSweepBest {
  0% {
    opacity: 0;
    transform: translate(-170px, 420px) rotate(-12deg);
  }
  15%,
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(1120px, 500px) rotate(8deg);
  }
}

@keyframes eraseSweepFlowers {
  0% {
    opacity: 0;
    transform: translate(-140px, 468px) rotate(-12deg);
  }
  15%,
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(1080px, 470px) rotate(8deg);
  }
}

@keyframes eraseSweepMillion {
  0% {
    opacity: 0;
    transform: translate(180px, 420px) rotate(-8deg);
  }
  18%,
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(1020px, 565px) rotate(7deg);
  }
}

@keyframes eraseObject {
  0% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 0;
    filter: blur(7px);
  }
}

@keyframes fadeAway {
  0%,
  22% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 0;
    filter: blur(7px);
  }
}

@keyframes fullWipe {
  0% {
    opacity: 0;
    transform: translateX(-1180px) rotate(-3deg);
  }
  18%,
  88% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotate(0);
  }
}

@keyframes floatHeart {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.72) rotate(-8deg);
  }
  12%,
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift), -105vh, 0) scale(1.1) rotate(14deg);
  }
}

@keyframes sparkle {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.4);
  }
  45% {
    opacity: 0.8;
    transform: scale(1);
  }
}

@keyframes gentleBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@media (max-width: 760px) {
  .login-view,
  .story-view {
    padding: 14px;
  }

  .login-paper {
    min-height: 560px;
    transform: none;
  }

  .paper-pin {
    top: 17px;
  }

  .login-form label {
    font-size: 18px;
  }

  .input-wrap input {
    min-height: 58px;
    font-size: 29px;
  }

  .primary-button {
    width: 100%;
    justify-content: center;
    min-height: 58px;
    font-size: 18px;
  }

  .story-toolbar {
    width: 86vw;
    gap: 7px;
    padding: 10px 10px 21px;
  }

  .story-shell {
    width: 100%;
    min-width: 0;
  }

  .crayon {
    width: 52px;
  }

  .story-paper {
    width: 100%;
    min-height: auto;
    transform: none;
  }

  .story-progress {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
  }

  .progress-status {
    font-size: 13px;
  }

  .progress-steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px 4px;
  }

  .progress-step {
    font-size: 10px;
  }

  .drawing {
    height: min(58vh, 560px);
    min-height: 430px;
    object-fit: contain;
  }

  .sparkles span {
    animation-duration: 1s;
    animation-iteration-count: 1;
  }

  .story-controls {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
  }

  .control-button {
    width: 100%;
    min-width: 0;
    padding: 0 8px;
    font-size: 14px;
  }

  .replay-control,
  .home-control {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
