* {
  box-sizing: border-box;
}

:root {
  --pink: #dc6c52;
  --pink-dark: #a94e3b;
  --nav: #e88772;
  --nav-dark: #b95f4d;
  --cream: #f3e4cf;
  --cream-light: #fff8ee;
  --green: #9fb58a;
  --green-dark: #76895f;
  --yellow: #f2cf72;
  --yellow-dark: #c49b3f;
  --text: #352315;
  --shadow: rgba(52, 35, 21, 0.18);
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(242, 207, 114, 0.25) 0, transparent 30%),
    linear-gradient(135deg, #fff8ee, #f3e4cf);
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 10px;
}

.book-shell {
  width: min(1280px, 100%);
  height: min(720px, calc(100vh - 20px));
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) 64px;
  gap: 10px;
  padding: 14px;
  border-radius: 30px;
  background: rgba(255, 248, 238, 0.86);
  border: 4px solid rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 60px var(--shadow);
}

.book-topbar {
  display: grid;
  grid-template-columns: 150px 1fr 150px;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 22px;
  background: var(--cream);
}

.top-btn,
.logo-pill,
.nav-btn,
.sound-btn {
  border: none;
  outline: none;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease;
}

.top-btn,
.logo-pill {
  border-radius: 999px;
  padding: 10px 12px;
  font-size: 15px;
  color: white;
  text-align: center;
  background: var(--nav);
  box-shadow: 0 5px 0 var(--nav-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.page-status {
  display: grid;
  justify-items: center;
  gap: 7px;
  font-size: 17px;
}

.progress-track {
  width: min(420px, 100%);
  height: 13px;
  background: #ead9f7;
  border: 2px solid white;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  width: 10%;
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--yellow));
}

.book-main {
  display: grid;
  grid-template-columns: 65% 35%;
  gap: 14px;
  min-height: 0;
}

.stage-area,
.text-panel {
  min-height: 0;
  border-radius: 28px;
  border: 5px solid white;
  overflow: hidden;
  box-shadow: 0 14px 35px rgba(97, 44, 89, 0.18);
}

.stage-area {
  position: relative;
  display: grid;
  place-items: center;
  background: #bde8f0;
}

.scene-box {
  position: relative;
  height: 100%;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  overflow: hidden;
  border-radius: 18px;
  background: #bde8f0;
}

.stage-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.personagem {
  position: absolute;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.sapo {
  left: 32%;
  bottom: 29%;
  width: 24%;
  z-index: 10;
  transform-origin: center bottom;
  animation: sapoRespira 2.8s ease-in-out infinite;
}

.coracao {
  left: 33%;
  top: 27%;
  width: 11%;
  z-index: 12;
  transform-origin: center center;
  animation: coracaoPulsa 1.2s ease-in-out infinite;
}

.text-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 18px;
  background: linear-gradient(180deg, var(--cream-light), #f5e6d0);
}

.story-card {
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.64);
  border: 3px solid rgba(255, 255, 255, 0.86);
  min-height: 0;
}

.story-card p {
  margin: 0;
  font-family: "Nunito", Arial, Helvetica, sans-serif;
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1.16;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.sound-buttons {
  display: grid;
  gap: 10px;
}

.sound-btn {
  width: 100%;
  min-height: 46px;
  border-radius: 17px;
  padding: 10px 12px;
  font-size: 16px;
  color: white;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.18);
}

.story-btn {
  background: var(--pink);
  box-shadow: 0 5px 0 var(--pink-dark);
}

.music-btn {
  background: var(--yellow);
  color: #5b3b17;
  box-shadow: 0 5px 0 var(--yellow-dark);
}

.play-btn {
  background: var(--green);
  box-shadow: 0 5px 0 var(--green-dark);
}

.book-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  border-radius: 22px;
  background: var(--cream);
}

.nav-btn {
  min-width: 220px;
  min-height: 46px;
  border-radius: 18px;
  padding: 10px 18px;
  font-size: 16px;
  color: white;
  background: var(--nav);
  box-shadow: 0 5px 0 var(--nav-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sound-btn:hover,
.nav-btn:hover,
.top-btn:hover,
.logo-pill:hover {
  transform: translateY(-3px) scale(1.03);
  filter: brightness(1.07);
}

.sound-btn:active,
.nav-btn:active,
.top-btn:active,
.logo-pill:active {
  transform: translateY(4px) scale(0.96);
  filter: brightness(0.95);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.sound-btn.is-playing {
  animation: botaoTocando 0.9s ease-in-out infinite;
}

.sapo.brincando {
  animation: sapoPula 0.8s ease-in-out;
}

.coracao.brincando {
  animation: coracaoFeliz 0.8s ease-in-out;
}

@keyframes botaoTocando {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }

  50% {
    transform: scale(1.04);
    filter: brightness(1.12);
  }
}

@keyframes sapoRespira {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-5px) rotate(-1deg);
  }
}

@keyframes coracaoPulsa {
  0%, 100% {
    transform: scale(1) rotate(0deg);
  }

  50% {
    transform: scale(1.14) rotate(-4deg);
  }
}

@keyframes sapoPula {
  0% {
    transform: translateY(0) rotate(0deg);
  }

  35% {
    transform: translateY(-18px) rotate(-3deg);
  }

  70% {
    transform: translateY(3px) rotate(2deg);
  }

  100% {
    transform: translateY(0) rotate(0deg);
  }
}

@keyframes coracaoFeliz {
  0% {
    transform: scale(1) rotate(0deg);
  }

  35% {
    transform: scale(1.25) rotate(-8deg);
  }

  70% {
    transform: scale(0.96) rotate(5deg);
  }

  100% {
    transform: scale(1) rotate(0deg);
  }
}

@media (max-width: 900px) {
  body {
    padding: 10px;
  }

  .book-shell {
    height: auto;
    min-height: 0;
    grid-template-rows: auto auto auto;
    padding: 12px;
    border-radius: 24px;
  }

  .book-topbar {
    grid-template-columns: 1fr;
  }

  .book-main {
    grid-template-columns: 1fr;
  }

  .stage-area {
    aspect-ratio: 1 / 1;
  }

  .scene-box {
    width: 100%;
    height: auto;
  }

  .text-panel {
    min-height: 360px;
  }

  .book-footer {
    flex-direction: column;
  }

  .nav-btn {
    width: 100%;
  }
}
/* ===============================
   O SAPO APAIXONADO — PÁGINA 2
================================ */

.pag2-progress {
  width: 20%;
}

.sapo-pg2 {
  left: 33%;
  bottom: 30%;
  width: 23%;
  z-index: 10;
  transform-origin: center bottom;
  animation: sapoRespira 2.8s ease-in-out infinite;
}

.sapo-pg2.brincando {
  animation: sapoPula 0.8s ease-in-out;
}
/* ===============================
   O SAPO APAIXONADO — PÁGINA 4
================================ */

.pag4-progress {
  width: 40%;
}

.casal-pag4 {
  left: -12;
  bottom: 0;
  width: 100%;
  z-index: 10;
  transform-origin: center bottom;
  animation: casalBalanca 3s ease-in-out infinite;
}

.casal-pag4.brincando {
  animation: casalFeliz 0.8s ease-in-out;
}

@keyframes casalBalanca {
  0%, 100% {
    transform: rotate(0deg);
  }

  50% {
    transform: rotate(-0.7deg);
  }
}

@keyframes casalFeliz {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }

  35% {
    transform: translateY(-12px) rotate(-2deg);
  }

  70% {
    transform: translateY(3px) rotate(2deg);
  }
}
/* ===============================
   O SAPO APAIXONADO — PÁGINA 6
================================ */

.pag6-progress {
  width: 60%;
}

.sapo-pg6 {
  left: 23%;
  bottom: 2%;
  width: 27%;
  z-index: 10;
  transform-origin: center bottom;
  animation: noivoFeliz 2.8s ease-in-out infinite;
}

.aranha-pg6 {
  left: 54%;
  bottom: 2%;
  width: 28%;
  z-index: 11;
  transform-origin: center bottom;
  animation: noivaFeliz 3s ease-in-out infinite;
}

.sapo-pg6.brincando {
  animation: sapoPula 0.8s ease-in-out;
}

@keyframes noivoFeliz {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-4px) rotate(-0.5deg);
  }
}

@keyframes noivaFeliz {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-3px) rotate(0.5deg);
  }
}
/* ===============================
   O SAPO APAIXONADO — PÁGINA 7
================================ */

.pag7-progress {
  width: 100%;
}

.casal-pag7 {
  left: 0;
  bottom: -8%;
  width: 100%;
  z-index: 10;
  transform-origin: center bottom;
  animation: redeBalanca 3.2s ease-in-out infinite;
}

.casal-pag7.brincando {
  animation: casalComemora 0.9s ease-in-out;
}

@keyframes redeBalanca {
  0%, 100% {
    transform: rotate(0deg);
  }

  50% {
    transform: rotate(-1deg);
  }
}

@keyframes casalComemora {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }

  35% {
    transform: translateY(-10px) rotate(-2deg);
  }

  70% {
    transform: translateY(3px) rotate(2deg);
  }
}
/* Progresso final — livro com 7 páginas */

.pag1-progress {
  width: 14%;
}

.pag2-progress {
  width: 29%;
}

.pag3-progress {
  width: 43%;
}

.pag4-progress {
  width: 57%;
}

.pag5-progress {
  width: 71%;
}

.pag6-progress {
  width: 86%;
}

.pag7-progress {
  width: 100%;
}