*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --pink: #f4a7b9;
  --pink-deep: #e8789a;
  --cream: #fff8ee;
  --ink: #3d2c2e;
  --ink-soft: #6b5456;
  --lake: #5ec4c9;
  --gold: #f5c842;
  --radius: 20px;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: "Lora", Georgia, serif;
  color: var(--ink);
  background: linear-gradient(180deg, #a8d8ea 0%, #d4eef7 35%, #e8f6fb 70%, #f5efe6 100%);
  overflow-x: hidden;
}

.sky {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 255, 255, 0.5), transparent),
    linear-gradient(180deg, #87ceeb 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.stars {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 30% 8%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 70% 12%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 85% 20%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 55% 5%, rgba(255, 255, 255, 0.5), transparent);
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

.site-header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.5rem 1rem 0.75rem;
}

.site-header h1 {
  font-family: "Fredoka", sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 600;
  color: var(--ink);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.6);
}

.subtitle {
  font-style: italic;
  color: var(--ink-soft);
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

.story-container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

.scene {
  display: flex;
  flex-direction: column;
  background: var(--cream);
  border-radius: var(--radius);
  box-shadow:
    0 4px 12px rgba(61, 44, 46, 0.1),
    0 16px 40px rgba(61, 44, 46, 0.12);
  overflow: hidden;
}

.illustration {
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 220px;
  max-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #d4eef7 0%, #e8f6fb 100%);
  padding: 0.5rem;
}

.illustration svg,
.scene-image {
  width: 100%;
  height: 100%;
  max-height: 400px;
  object-fit: cover;
  object-position: center;
  filter: drop-shadow(0 4px 16px rgba(61, 44, 46, 0.12));
}

.scene-body {
  padding: 1.5rem 1.75rem 1rem;
  flex: 1;
}

.scene-meta {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.page-number {
  font-family: "Fredoka", sans-serif;
  font-size: 0.8rem;
  color: var(--ink-soft);
  opacity: 0.45;
}

.story-text h2 {
  font-family: "Fredoka", sans-serif;
  font-size: clamp(1.25rem, 3.5vw, 1.6rem);
  font-weight: 500;
  color: var(--pink-deep);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.story-text p {
  font-size: clamp(1rem, 2.4vw, 1.1rem);
  line-height: 1.8;
  color: var(--ink);
}

.ending-badge {
  display: inline-block;
  font-family: "Fredoka", sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--gold);
  color: var(--ink);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
  letter-spacing: 0.03em;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem 1.75rem 1.5rem;
  border-top: 1px solid rgba(61, 44, 46, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 248, 238, 0.8) 100%);
}

.choice-btn {
  font-family: "Fredoka", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  padding: 0.9rem 1.25rem;
  border: 2px solid var(--pink);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.choice-btn:hover {
  background: var(--pink);
  color: white;
  border-color: var(--pink-deep);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(232, 120, 154, 0.3);
}

.choice-btn:active {
  transform: translateY(0) scale(0.99);
}

.choice-btn:focus-visible {
  outline: 3px solid var(--lake);
  outline-offset: 2px;
}

.scene-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.btn {
  font-family: "Fredoka", sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border: 2px solid rgba(61, 44, 46, 0.15);
  backdrop-filter: blur(4px);
}

.btn-ghost:hover {
  background: white;
  border-color: var(--pink);
  color: var(--pink-deep);
  box-shadow: 0 4px 16px rgba(61, 44, 46, 0.1);
}

.btn-ghost:focus-visible {
  outline: 3px solid var(--lake);
  outline-offset: 2px;
}

.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1rem 1rem 2rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-style: italic;
}

.fade-in {
  animation: fadeIn 0.45s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scene-advance {
  animation: sceneAdvance 0.4s ease;
}

@keyframes sceneAdvance {
  0% {
    opacity: 0.5;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 500px) {
  .scene-body,
  .choices {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .illustration {
    aspect-ratio: 4 / 3;
    min-height: 180px;
  }
}
