.story-body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: #d8cce8;
  transition: background 0.6s ease;
}

.top-nav {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: flex;
  gap: 10px;
}

.top-nav .home-link {
  position: static;
}

.scene-name-tag {
  position: fixed;
  z-index: 10;
  bottom: 16px;
  left: 16px;
  background: rgba(255,255,255,0.85);
  color: var(--text-dark);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 14px;
  box-shadow: 0 3px 0 rgba(0,0,0,0.1);
}

/* ---------- Split layout: narrator | scene ---------- */
.story-layout {
  display: flex;
  max-width: 1300px;
  height: 88vh;
  min-height: 560px;
  margin: 70px auto 16px;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0,0,0,0.35);
}

.narrator-panel {
  flex: 0 0 460px;
  border-radius: 28px 0 0 28px;
  display: flex;
  flex-direction: column;
  padding: 32px 20px;
  transition: background 0.6s ease;
}

.narrator-top {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
}

.narrator-audio-block {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  border-radius: 16px;
  background: #241b4e;
}

.narrator-avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid #fff;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.narrator-bubble {
  position: relative;
  background: #fff;
  border-radius: 18px;
  padding: 20px 24px;
  font-family: 'Chewy', cursive;
  font-size: 1.4rem;
  font-weight: 400;
  min-height: 24px;
  flex-shrink: 0;
  box-shadow: 0 5px 0 rgba(0,0,0,0.1);
  width: 100%;
  text-align: center;
}

.narrator-bubble::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 8px 10px 8px;
  border-style: solid;
  border-color: transparent transparent #fff transparent;
}

.narrator-audio-label {
  font-family: 'Baloo 2', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--cream);
  text-align: center;
  opacity: 0.9;
  flex-shrink: 0;
}

.narrator-spotify {
  width: 100%;
  border: none;
  flex-shrink: 0;
}

.scene-panel {
  flex: 1;
  position: relative;
  overflow: hidden;
  border-radius: 0 28px 28px 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hidden { display: none; }

/* ---------- Intro title page ---------- */
#intro-narrator-panel {
  background: #d8cce8;
}

.intro-panel {
  flex: 1;
  border-radius: 0 28px 28px 0;
  background: linear-gradient(160deg, #241b4e 0%, #4a3b7a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 32px;
}

.intro-amy {
  width: 220px;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.4));
}

.intro-title {
  font-family: 'Chewy', cursive;
  font-size: 2.2rem;
  color: var(--accent-yellow);
  text-align: center;
  margin: 0;
  text-shadow:
    -2px -2px 0 #fff, 2px -2px 0 #fff,
    -2px 2px 0 #fff, 2px 2px 0 #fff;
}

.intro-next-btn {
  font-size: 1.2rem;
  padding: 14px 32px;
}

/* ---------- Scene background ---------- */
.scene-backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.story-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  transition: opacity 0.3s ease;
}

.magic-light {
  position: absolute;
  top: 12%;
  right: 20%;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(150,210,255,0.9), rgba(80,150,255,0.3) 60%, transparent 80%);
  box-shadow: 0 0 70px 34px rgba(120, 180, 255, 0.5);
  opacity: 0;
  transition: opacity 0.8s ease;
  animation: pulse-light 2.5s ease-in-out infinite;
  z-index: 1;
  pointer-events: none;
}

.magic-light.is-on { opacity: 1; }

.scream-icon-wrap {
  position: absolute;
  top: 8%;
  right: 10%;
  z-index: 1;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.scream-icon-wrap.is-visible { opacity: 1; transform: scale(1); }

.scream-icon {
  display: block;
  width: 220px;
  filter: drop-shadow(0 6px 6px rgba(0,0,0,0.4));
}

@keyframes pulse-light {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ---------- Character stage (fade in/out) ---------- */
.character-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.char-sprite {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.char-sprite.is-visible { opacity: 1; }

#tanya-sprite { left: 42%; }
#amy-sprite-wrap { left: 58%; }

.walker-figure {
  display: inline-block;
  font-size: 4.5rem;
  filter: drop-shadow(0 6px 4px rgba(0,0,0,0.3));
}

.amy-sprite {
  width: 90px;
  display: block;
  filter: drop-shadow(0 6px 4px rgba(0,0,0,0.3));
}

/* ---------- Character speech bubbles ---------- */
.speech-bubble--character {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 10px;
  background: #fff;
  border-radius: 16px;
  padding: 8px 14px;
  font-family: 'Chewy', cursive;
  font-size: 1.05rem;
  font-weight: 400;
  white-space: nowrap;
  box-shadow: 0 4px 0 rgba(0,0,0,0.1);
  transition: opacity 0.3s ease;
}

.speech-bubble--character::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px 6px 0 6px;
  border-style: solid;
  border-color: #fff transparent transparent transparent;
}

.speech-bubble--character.hidden { opacity: 0; }

/* ---------- Scene-scoped progress track ---------- */
.progress-row {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 8% 20px;
}

.play-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--accent-yellow);
  color: var(--text-dark);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.2);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.play-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(0,0,0,0.2); }
.play-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.2); }

.progress-track {
  position: relative;
  z-index: 3;
  flex: 1;
  height: 16px;
  background: rgba(255,255,255,0.5);
  border-radius: 10px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
}

.progress-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0%;
  background: var(--accent-yellow);
  border-radius: 10px;
  transition: width 0.1s linear;
}

.track-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -60%);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}

.track-handle img {
  width: 130px;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.3));
}

.track-handle:active { cursor: grabbing; }

.track-handle.is-dragging {
  animation: walk-bob 0.5s ease-in-out infinite;
}

.track-handle.is-playing {
  animation: walk-bob-slow 1.1s ease-in-out infinite;
}

@keyframes walk-bob {
  0%, 100% { transform: translate(-50%, -60%) rotate(-4deg); }
  50% { transform: translate(-50%, -70%) rotate(4deg); }
}

@keyframes walk-bob-slow {
  0%, 100% { transform: translate(-50%, -60%) rotate(-2deg); }
  50% { transform: translate(-50%, -64%) rotate(2deg); }
}

.track-hint {
  position: relative;
  z-index: 3;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
  margin-bottom: 8px;
  transition: opacity 0.4s ease;
}

.track-hint.hidden { opacity: 0; }

/* ---------- Scene navigation ---------- */
.scene-nav {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding-bottom: 24px;
}

.nav-btn {
  font-family: 'Baloo 2', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
  background: var(--accent-yellow);
  border: none;
  border-radius: 40px;
  padding: 12px 26px;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0,0,0,0.2);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.2s ease;
}

.nav-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 0 rgba(0,0,0,0.2);
}

.nav-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(0,0,0,0.2);
}

.nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.nav-btn.is-inviting {
  animation: invite-pulse 1.1s ease-in-out infinite;
}

@keyframes invite-pulse {
  0%, 100% { box-shadow: 0 5px 0 rgba(0,0,0,0.2), 0 0 0 0 rgba(255,207,77,0.6); }
  50% { box-shadow: 0 5px 0 rgba(0,0,0,0.2), 0 0 0 10px rgba(255,207,77,0); }
}

.scene-dots {
  display: flex;
  gap: 8px;
}

.scene-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  border: 2px solid #fff;
}

.scene-dot--active { background: var(--accent-yellow); transform: scale(1.2); }
.scene-dot--done { background: var(--accent-green); }

@media (max-width: 760px) {
  .story-layout {
    flex-direction: column;
    height: auto;
    min-height: unset;
    margin: 80px 16px 24px;
    border-radius: 20px;
  }
  .narrator-panel {
    flex: 0 0 auto;
    border-radius: 20px 20px 0 0;
  }
  .scene-panel {
    min-height: 60vh;
    border-radius: 0 0 20px 20px;
  }
}
