/* ==========================================
   RUTICUTI
   O SAPO APAIXONADO
   GAME — O PULO DO AMOR
========================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", sans-serif;
  color: #24382d;
  background:
    radial-gradient(
      circle at top,
      #fff7c5 0%,
      #d9f2d1 45%,
      #91cbb3 100%
    );
}

button,
a {
  font-family: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  width: min(1000px, calc(100% - 28px));
  margin: 22px auto 50px;
}

/* ==========================================
   BARRA SUPERIOR
========================================== */

.game-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.game-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.1;
}

.game-heading span {
  color: #4e765b;
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.game-heading strong {
  margin-top: 4px;
  color: #174f2a;
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 900;
}

.top-btn {
  width: max-content;
  min-height: 44px;
  padding: 10px 17px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: #177c42;
  box-shadow: 0 5px 0 #0c5229;
  font-size: 0.92rem;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.top-btn:hover {
  background: #10934a;
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #0c5229;
}

.top-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #0c5229;
}

.restart-btn {
  justify-self: end;
}

/* ==========================================
   INSTRUÇÕES
========================================== */

.instruction-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 15px 18px;
  border: 3px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 28px rgba(28, 73, 45, 0.16);
  backdrop-filter: blur(8px);
}

.instruction-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #ffec83;
  font-size: 2rem;
}

.instruction-card h1 {
  margin: 0 0 3px;
  color: #174f2a;
  font-size: clamp(1.05rem, 2.4vw, 1.5rem);
  font-weight: 900;
}

.instruction-card p {
  margin: 0;
  color: #456451;
  font-size: 0.97rem;
  font-weight: 700;
}

.progress-box {
  min-width: 88px;
  padding: 9px 14px;
  border-radius: 17px;
  color: #ffffff;
  background: #ee4b61;
  text-align: center;
  box-shadow: 0 5px 0 #b92e44;
}

.progress-box strong,
.progress-box span {
  display: block;
}

.progress-box strong {
  font-size: 1.1rem;
  font-weight: 900;
}

.progress-box span {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

/* ==========================================
   TABULEIRO
========================================== */

.game-board {
  position: relative;
  width: min(760px, 100%);
  margin: 0 auto;
  aspect-ratio: 20 / 21;
  overflow: hidden;
  border: 7px solid #ffffff;
  border-radius: 30px;
  background:
    url("assets/game/personagem/lago.png")
    center / 100% 100% no-repeat;
  box-shadow:
    0 18px 45px rgba(24, 67, 41, 0.25),
    inset 0 0 0 2px rgba(16, 92, 53, 0.12);
  isolation: isolate;
}

/* ==========================================
   PEDRAS
========================================== */

.stone {
  position: absolute;
  z-index: 3;
  width: 15%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 7px 4px rgba(20, 56, 70, 0.25));
  transition:
    transform 0.2s ease,
    filter 0.2s ease;
}

.stone img {
  display: block;
  width: 100%;
  pointer-events: none;
}

.stone:hover {
  transform: translateY(-5px) scale(1.05);
  filter:
    brightness(1.08)
    drop-shadow(0 10px 5px rgba(20, 56, 70, 0.32));
}

.stone.active {
  animation: stoneGlow 1.25s ease-in-out infinite;
}

.stone.completed {
  filter:
    brightness(1.18)
    saturate(1.15)
    drop-shadow(0 0 9px #fff15c);
}

.stone.wrong {
  animation: stoneShake 0.5s ease;
}

.stone-1 {
  left: 12%;
  bottom: 22%;
  width: 14%;
}

.stone-2 {
  left: 29%;
  bottom: 36%;
  width: 13%;
}

.stone-3 {
  left: 47%;
  bottom: 25%;
  width: 15%;
}

.stone-4 {
  left: 63%;
  bottom: 40%;
  width: 13%;
}

.stone-5 {
  left: 78%;
  bottom: 27%;
  width: 14%;
}

.stone-6 {
  left: 39%;
  bottom: 49%;
  width: 12%;
}

.stone-7 {
  left: 61%;
  bottom: 16%;
  width: 12%;
}

@keyframes stoneGlow {
  0%,
  100% {
    filter:
      brightness(1)
      drop-shadow(0 7px 4px rgba(20, 56, 70, 0.25));
  }

  50% {
    filter:
      brightness(1.25)
      drop-shadow(0 0 13px #fff470);
  }
}

@keyframes stoneShake {
  0%,
  100% {
    transform: translateX(0) rotate(0);
  }

  20% {
    transform: translateX(-9px) rotate(-5deg);
  }

  40% {
    transform: translateX(9px) rotate(5deg);
  }

  60% {
    transform: translateX(-7px) rotate(-4deg);
  }

  80% {
    transform: translateX(7px) rotate(4deg);
  }
}

/* ==========================================
   PERSONAGENS
========================================== */

.frog {
  position: absolute;
  z-index: 6;
  left: 2%;
  bottom: 13%;
  width: 15%;
  pointer-events: none;
  filter: drop-shadow(0 8px 5px rgba(17, 56, 31, 0.28));
  transition:
    left 0.72s cubic-bezier(0.4, 0, 0.2, 1),
    bottom 0.72s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.36s ease;
}

.frog.jumping {
  animation: frogJump 0.72s ease;
}

@keyframes frogJump {
  0%,
  100% {
    transform: translateY(0) rotate(0) scale(1);
  }

  45% {
    transform: translateY(-70%) rotate(-7deg) scale(1.08);
  }
}

.spider {
  position: absolute;
  z-index: 5;
  top: 48%;
  right: 5%;
  width: 9%;
  pointer-events: none;
  filter: drop-shadow(0 5px 4px rgba(30, 20, 45, 0.25));
  animation: spiderSwing 2.2s ease-in-out infinite;
  transform-origin: top center;
}

@keyframes spiderSwing {
  0%,
  100% {
    transform: rotate(-6deg);
  }

  50% {
    transform: rotate(6deg);
  }
}

.love-heart {
  position: absolute;
  z-index: 7;
  top: 49%;
  right: 13%;
  width: 7%;
  opacity: 0;
  pointer-events: none;
  transform: scale(0);
}

.love-heart.show {
  animation: heartAppear 1.1s ease forwards;
}

@keyframes heartAppear {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-15deg);
  }

  55% {
    opacity: 1;
    transform: scale(1.35) rotate(8deg);
  }

  75% {
    transform: scale(0.9) rotate(-3deg);
  }

  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

/* ==========================================
   MENSAGEM
========================================== */

.message-bubble {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 3%;
  width: max-content;
  max-width: 82%;
  padding: 10px 17px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  color: #174f2a;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(22, 67, 39, 0.2);
  font-size: clamp(0.78rem, 2.2vw, 1rem);
  font-weight: 900;
  text-align: center;
  transform: translateX(-50%);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

/* ==========================================
   CORAÇÕES FLUTUANTES
========================================== */

.floating-heart {
  position: absolute;
  z-index: 9;
  bottom: 17%;
  color: #ef304f;
  font-size: clamp(1.2rem, 4vw, 2.3rem);
  pointer-events: none;
  animation: floatingHeart 2.4s ease-out forwards;
}

@keyframes floatingHeart {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.4) rotate(0);
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(-380px) scale(1.3) rotate(22deg);
  }
}

/* ==========================================
   VITÓRIA
========================================== */

.victory-overlay {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 58, 34, 0.66);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
}

.victory-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.victory-card {
  width: min(500px, 94%);
  padding: clamp(22px, 5vw, 38px);
  border: 5px solid #ffffff;
  border-radius: 30px;
  background:
    radial-gradient(circle at top, #fffbd3 0%, #fff5a6 45%, #ffe56a 100%);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.28);
  text-align: center;
  transform: scale(0.78) translateY(25px);
  transition: transform 0.42s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.victory-overlay.show .victory-card {
  transform: scale(1) translateY(0);
}

.victory-characters {
  margin-bottom: 4px;
  font-size: clamp(2.2rem, 8vw, 4.1rem);
}

.victory-card h2 {
  margin: 0;
  color: #177c42;
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 900;
}

.victory-card p {
  max-width: 390px;
  margin: 8px auto 20px;
  color: #3f5c49;
  font-size: clamp(0.94rem, 2.8vw, 1.1rem);
  font-weight: 800;
}

.victory-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.victory-btn {
  padding: 11px 17px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.victory-btn:hover {
  transform: translateY(-3px);
}

.play-again-btn {
  background: #177c42;
  box-shadow: 0 4px 0 #0c5229;
}

.clip-btn {
  background: #ee4b61;
  box-shadow: 0 4px 0 #b92e44;
}

.book-btn {
  background: #5569c9;
  box-shadow: 0 4px 0 #3549a9;
}

/* ==========================================
   RODAPÉ
========================================== */

.game-footer {
  margin-top: 20px;
  text-align: center;
}

.game-footer span {
  color: #177c42;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.game-footer p {
  margin: 2px 0 0;
  color: #52705d;
  font-size: 0.88rem;
  font-weight: 700;
}

/* ==========================================
   RESPONSIVO
========================================== */

@media (max-width: 700px) {
  .game-shell {
    width: min(100% - 14px, 760px);
    margin-top: 10px;
  }

  .game-topbar {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .game-heading {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .top-btn {
    grid-row: 2;
    padding: 9px 13px;
    font-size: 0.76rem;
  }

  .restart-btn {
    justify-self: end;
  }

  .instruction-card {
    grid-template-columns: auto 1fr;
    gap: 11px;
    padding: 11px;
    border-radius: 18px;
  }

  .instruction-icon {
    width: 47px;
    height: 47px;
    font-size: 1.6rem;
  }

  .instruction-card p {
    font-size: 0.78rem;
  }

  .progress-box {
    grid-column: 1 / -1;
    width: 100%;
    padding: 6px;
  }

  .progress-box strong,
  .progress-box span {
    display: inline;
  }

  .game-board {
    border-width: 4px;
    border-radius: 20px;
  }

  .message-bubble {
    top: 2%;
    padding: 7px 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}