.page--story {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

.page--story .page__body {
  display: grid;
  min-height: 0;
  overflow: hidden;
  padding: 0.85rem 0;
}

.story-reader-shell,
.story-route__missing-card {
  border: 1px solid rgba(220, 239, 225, 0.92);
  border-radius: calc(var(--radius-panel) - 2px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 250, 244, 0.9)),
    rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.story-reader-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.85rem;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0.85rem;
}

.story-reader__header {
  min-width: 0;
}

.story-reader__header-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
}

.story-route__title,
.story-route__missing-title {
  margin: 0;
  font-family: var(--font-brand);
  line-height: 1.05;
}

.story-route__title--compact {
  display: block;
  width: 100%;
  padding: 0.72rem 1.1rem;
  border-radius: calc(var(--radius-card) - 10px);
  background: linear-gradient(180deg, #ffad8d, var(--brand-peach));
  color: #fff;
  box-shadow: 0 12px 28px rgba(255, 158, 126, 0.2);
  font-size: clamp(1.18rem, 1.7vw, 1.65rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.story-reader__progress {
  margin: 0;
  padding: 0.38rem 0.8rem;
  border: 1px solid rgba(220, 239, 225, 0.96);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.82);
  color: var(--brand-muted);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.story-reader {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.85rem;
  min-height: 0;
}

.story-reader__viewport {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(18rem, 0.82fr);
  gap: 0.95rem;
  min-height: 0;
}

.story-reader__media,
.story-reader__page-panel,
.story-reader__narration-panel,
.story-reader__footer,
.story-route__missing-card {
  min-height: 0;
  border-radius: calc(var(--radius-card) - 4px);
  border: 1px solid rgba(220, 239, 225, 0.92);
  background: rgba(255, 255, 255, 0.84);
}

.story-reader__media {
  padding: 0.8rem;
  background:
    radial-gradient(circle at top, rgba(114, 214, 146, 0.1), rgba(114, 214, 146, 0)),
    linear-gradient(180deg, rgba(242, 250, 244, 0.94), rgba(255, 255, 255, 0.92));
}

.story-reader__frame {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: calc(var(--radius-card) - 10px);
}

.story-reader__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.story-reader__copy {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  min-height: 0;
}

.story-reader__page-panel,
.story-reader__narration-panel {
  display: grid;
  gap: 0.68rem;
  overflow: hidden;
  padding: 0.95rem 1rem;
}

.story-reader__page-label {
  margin: 0;
  color: var(--brand-green-deep);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.story-reader__page-title {
  margin: 0;
  font-family: var(--font-brand);
  font-size: clamp(1.38rem, 2vw, 1.9rem);
  line-height: 1.12;
}

.story-reader__text {
  display: grid;
  align-content: start;
  gap: 0.62rem;
  min-height: 0;
  overflow: hidden;
}

.story-reader__line,
.story-reader__narration,
.story-route__missing-body {
  margin: 0;
  color: var(--brand-muted);
  line-height: 1.62;
}

.story-reader__line,
.story-reader__narration {
  font-size: clamp(0.96rem, 1.06vw, 1.04rem);
}

.story-reader__footer {
  padding: 0.8rem 0.9rem;
}

.story-reader__controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
}

.story-reader__button {
  width: 100%;
  min-height: 46px;
}

.story-reader__button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.story-reader__auto-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.48rem;
  min-height: 46px;
  padding: 0 0.9rem;
  border: 1px solid rgba(220, 239, 225, 0.96);
  border-radius: var(--radius-pill);
  background: rgba(244, 251, 246, 0.92);
  color: var(--brand-muted);
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.story-reader__auto-play input {
  width: 1rem;
  height: 1rem;
}

.story-route {
  display: grid;
  height: 100%;
  min-height: 0;
}

.story-route--missing {
  align-content: center;
}

.story-route__missing-card {
  display: grid;
  gap: 0.9rem;
  padding: 1.4rem;
}

@media (max-width: 959px) {
  .page--story .page__body {
    padding: 0.7rem 0;
  }

  .story-reader-shell {
    gap: 0.7rem;
    padding: 0.72rem;
  }

  .story-reader__header-top {
    gap: 0.6rem;
  }

  .story-route__title--compact {
    font-size: clamp(1.02rem, 2.6vw, 1.24rem);
  }

  .story-reader__viewport {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(0, 0.98fr);
  }

  .story-reader__copy {
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .story-reader__controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr) minmax(0, 1fr) auto;
    gap: 0.55rem;
  }

  .story-reader__button,
  .story-reader__auto-play {
    min-height: 42px;
  }

  .story-reader__auto-play {
    padding-inline: 0.65rem;
    font-size: 0.84rem;
  }
}

@media (max-width: 719px) {
  .story-route__title--compact {
    font-size: 0.98rem;
  }

  .story-reader__progress {
    padding-inline: 0.65rem;
    font-size: 0.8rem;
  }

  .story-reader__page-panel,
  .story-reader__narration-panel {
    padding: 0.82rem 0.85rem;
  }

  .story-reader__page-title {
    font-size: 1.18rem;
  }

  .story-reader__line,
  .story-reader__narration {
    font-size: 0.92rem;
    line-height: 1.56;
  }

  .story-reader__controls {
    gap: 0.45rem;
  }

  .story-reader__button {
    min-height: 40px;
    padding-inline: 0.35rem;
    font-size: 0.84rem;
  }

  .story-reader__auto-play {
    min-height: 40px;
    padding-inline: 0.55rem;
    font-size: 0.78rem;
  }
}
