/* Story modal overlay */
#story-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  padding: 0;
}

#story-modal.flex {
  display: flex !important;
}

#story-modal .story-modal__container {
  width: 100%;
  max-width: 800px;
  height: 100%;
  max-height: 100vh;
  background: #0b0d14;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 640px) {
  #story-modal .story-modal__container {
    height: auto;
    max-height: 90vh;
    border: 1px solid #334155;
    border-radius: 1rem;
  }
}

/* Scrollable content area */
#story-modal .story-modal__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem;
  -webkit-overflow-scrolling: touch;
}

#story-modal .story-modal__scroll::-webkit-scrollbar {
  width: 6px;
}

#story-modal .story-modal__scroll::-webkit-scrollbar-track {
  background: transparent;
}

#story-modal .story-modal__scroll::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

/* Episode title */
#story-modal .story-modal__title {
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
  text-align: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #1e293b;
}

/* Illustration */
#story-modal .story-modal__illust {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  background: #1e293b;
}

/* Text blocks */
#story-modal .story-modal__text {
  margin-bottom: 1.25rem;
  line-height: 1.75;
  font-size: 0.95rem;
  color: #e2e8f0;
}

#story-modal .story-modal__text--narration {
  color: #e2e8f0;
}

#story-modal .story-modal__text--dialogue {
  color: #f1f5f9;
}

#story-modal .story-modal__speaker {
  font-weight: 700;
  color: #ffd06b;
  margin-bottom: 0.25rem;
}

#story-modal .story-modal__text--flashback {
  color: #94a3b8;
  border-left: 3px solid #64748b;
  padding-left: 0.75rem;
  background: rgba(30, 41, 59, 0.4);
  padding: 0.75rem;
  border-radius: 0 0.5rem 0.5rem 0;
}

/* Continue button area */
#story-modal .story-modal__footer {
  flex-shrink: 0;
  padding: 1rem;
  border-top: 1px solid #1e293b;
  background: #0b0d14;
}

#story-modal .story-modal__continue-btn {
  width: 100%;
  padding: 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid #ffd06b;
  background: rgba(255, 208, 107, 0.1);
  color: #ffd06b;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

#story-modal .story-modal__continue-btn:hover {
  background: #ffd06b;
  color: #0b0d14;
}

#story-modal .story-modal__continue-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#story-modal .story-modal__continue-btn--disabled {
  background: rgba(255, 208, 107, 0.05);
  color: #a68b4b;
  border-color: #a68b4b;
}

#story-modal .story-modal__continue-btn--disabled:hover {
  background: rgba(255, 208, 107, 0.05);
  color: #a68b4b;
}

#story-modal .story-modal__scroll-hint {
  text-align: center;
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 0.75rem;
  animation: storyScrollHintPulse 1.5s ease-in-out infinite;
}

#story-modal .story-modal__scroll-hint.hidden {
  display: none;
}

@keyframes storyScrollHintPulse {
  0%, 100% { opacity: 0.6; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(2px); }
}

/* Transition animation */
@keyframes storyFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#story-modal.flex {
  animation: storyFadeIn 0.3s ease;
}

/* Placeholder illustration */
#story-modal .story-modal__illust-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  font-size: 0.875rem;
}
