.story-page {
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.modal-back {
  align-items: center;
  padding: 20px;
  overflow-y: auto;
}

.modal {
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  padding: 20px;
}

.story-page {
  display: flex;
  flex-direction: column;
}

.story-page .modal-foot {
  margin-top: auto;
  padding-top: 16px;
}

.story-art {
  position: relative;
  min-height: 160px;
  padding: 16px;
  background: linear-gradient(160deg, #eaf6ff 0%, #f7fbef 54%, #fff5da 100%);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.story-scene {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 78% 22%, rgba(255, 224, 138, .95) 0 17%, transparent 18%),
    radial-gradient(circle at 50% 130%, #b8dcad 0 38%, transparent 39%),
    radial-gradient(circle at 12% 120%, #9cc9ef 0 26%, transparent 27%);
  animation: scene-in .45s ease-out;
}

.story-art[data-page="2"] .story-scene {
  background:
    radial-gradient(circle at 72% 24%, rgba(255, 183, 138, .92) 0 15%, transparent 16%),
    radial-gradient(circle at 50% 128%, #d8c7a6 0 38%, transparent 39%),
    radial-gradient(circle at 14% 116%, #a8c7e8 0 26%, transparent 27%);
}

.story-art[data-page="3"] .story-scene {
  background:
    radial-gradient(circle at 75% 20%, rgba(255, 236, 178, .9) 0 14%, transparent 15%),
    radial-gradient(circle at 50% 130%, #c8dfb6 0 38%, transparent 39%),
    radial-gradient(circle at 16% 112%, #9ad7e0 0 25%, transparent 26%);
}

.story-art[data-page="4"] .story-scene {
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 219, 158, .88) 0 13%, transparent 14%),
    radial-gradient(circle at 50% 130%, #d1c5e6 0 38%, transparent 39%),
    radial-gradient(circle at 80% 110%, #a6cfe8 0 25%, transparent 26%);
}

.story-art[data-page="5"] .story-scene {
  background:
    radial-gradient(circle at 68% 18%, rgba(255, 228, 146, .9) 0 12%, transparent 13%),
    radial-gradient(circle at 50% 130%, #b6dcaa 0 38%, transparent 39%),
    radial-gradient(circle at 18% 112%, #f0c9b6 0 25%, transparent 26%);
}

.story-art .big {
  position: relative;
  z-index: 2;
  font-size: 72px;
  line-height: 1;
  filter: drop-shadow(0 12px 12px rgba(44, 66, 50, .18));
  animation: character-in .5s ease-out;
}

.story-buddy {
  display: grid;
  place-items: center;
  font-size: 64px;
  position: absolute;
  right: 24px;
  bottom: 18px;
  width: 76px;
  height: 76px;
  object-fit: contain;
  z-index: 2;
  filter: drop-shadow(0 10px 10px rgba(44, 66, 50, .18));
  animation: buddy-float 3.6s ease-in-out infinite;
}

.story-copy h3 {
  font-size: 24px;
  font-weight: 800;
  color: var(--navy, #17365d);
  margin: 0 0 10px;
  line-height: 1.3;
}

.story-copy p {
  font-size: 17px;
  line-height: 1.8;
  color: #41597a;
  margin: 0;
}

.story-copy {
  padding: 21px 24px 24px;
}

.story-page h3,
.story-page p {
  position: relative;
  z-index: 2;
}

.story-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.narration-btn {
  white-space: nowrap;
}

.narration-btn.speaking {
  background: #ffe9c8;
  color: #825c22;
}

.modal-foot {
  gap: 10px;
}

@keyframes scene-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes character-in {
  from { opacity: 0; transform: translateY(14px) scale(.88); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes buddy-float {
  50% { transform: translateY(-7px); }
}

@media (max-width: 650px) {
  .modal-back {
    padding: 12px;
    align-items: center;
  }

  .modal {
    padding: 16px;
    max-height: 95vh;
    max-height: 95dvh;
    overflow-y: auto;
    border-radius: 20px;
  }

  .story-art {
    min-height: 130px;
    padding: 16px;
  }

  .story-art .big {
    font-size: 44px;
  }

  .story-buddy {
    width: 46px;
    height: 46px;
    right: 14px;
    bottom: 10px;
    font-size: 40px;
  }

  .story-copy {
    padding: 16px;
  }

  .story-copy h3 {
    font-size: 19px;
    margin: 0 0 8px;
  }

  .story-copy p {
    font-size: 15px;
    line-height: 1.7;
    margin: 0;
  }

  .modal-foot {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 16px;
  }

  .story-controls {
    width: 100%;
  }

  .story-controls span {
    display: none;
  }

  .story-controls button {
    width: 100%;
  }

  .modal-foot button {
    width: 100%;
    padding: 13px 16px;
    font-size: 15px;
  }

  .child-action {
    padding: 14px 0;
    gap: 10px;
  }

  .action-left {
    gap: 10px;
    flex: 1;
  }

  .action-icon {
    width: 38px;
    height: 38px;
    font-size: 19px;
    flex-shrink: 0;
  }

  .child-action strong {
    font-size: 15px;
    line-height: 1.4;
  }

  .child-action div div {
    font-size: 12px;
  }

  .done-btn {
    padding: 10px 16px;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
    border-radius: 10px;
  }
}
