/* ==========================================
   RUTICUTI
   PATA BETA E CADELA SARAH
   LIGUE OS PONTOS DA AMIZADE
========================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 22px 0 50px;
  font-family: "Nunito", sans-serif;
  color: #3d3026;
  background:
    radial-gradient(
      circle at top,
      #fff8c9 0%,
      #f8dfad 46%,
      #d99f81 100%
    );
}

button,
a {
  font-family: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  width: min(1050px, calc(100% - 28px));
  margin: 0 auto;
}

/* ==========================================
   TOPO
========================================== */

.game-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.game-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.12;
  text-align: center;
}

.game-title span {
  color: #b55758;
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.game-title strong {
  margin-top: 4px;
  color: #703c35;
  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: #d45f65;
  box-shadow: 0 5px 0 #963c43;
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease;
}

.top-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #963c43;
}

.top-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #963c43;
}

.restart-btn {
  justify-self: end;
}

/* ==========================================
   INSTRUÇÃO
========================================== */

.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.82);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 28px rgba(97, 56, 43, 0.18);
  backdrop-filter: blur(8px);
}

.instruction-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #ffdf73;
  font-size: 2rem;
}

.instruction-card h1 {
  margin: 0 0 3px;
  color: #703c35;
  font-size: clamp(1.05rem, 2.4vw, 1.5rem);
  font-weight: 900;
}

.instruction-card p {
  margin: 0;
  color: #72584a;
  font-size: 0.96rem;
  font-weight: 700;
}

.progress-box {
  min-width: 100px;
  padding: 9px 14px;
  border-radius: 17px;
  color: #ffffff;
  background: #6757b8;
  box-shadow: 0 5px 0 #403483;
  text-align: center;
}

.progress-box strong,
.progress-box span {
  display: block;
}

.progress-box strong {
  font-size: 1.05rem;
  font-weight: 900;
}

.progress-box span {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

/* ==========================================
   ÁREA DO JOGO
========================================== */

.game-board {
  position: relative;
  width: min(850px, 100%);
  margin: 0 auto;
  aspect-ratio: 10 / 7;
  overflow: hidden;
  border: 7px solid #ffffff;
  border-radius: 30px;
  background:
    url("assets/game/personagem/bg_8.png")
    center / cover no-repeat;
  box-shadow:
    0 20px 50px rgba(82, 49, 39, 0.28),
    inset 0 0 0 2px rgba(115, 61, 51, 0.12);
  isolation: isolate;
}

.drawing-layer,
.dots-layer {
  position: absolute;
  z-index: 5;
  inset: 0;
  width: 100%;
  height: 100%;
}

.drawing-layer {
  pointer-events: none;
}

.dots-layer {
  pointer-events: none;
}

/* ==========================================
   IMAGEM REVELADA
========================================== */

.final-picture {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 53%;
  width: 58%;
  height: 65%;
  object-fit: contain;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 12px 8px rgba(68, 38, 29, 0.26));
  transform:
    translate(-50%, -50%)
    scale(0.65)
    rotate(-3deg);
  transition:
    opacity 0.7s ease,
    transform 0.9s cubic-bezier(0.2, 1.35, 0.4, 1);
}

.final-picture.show {
  opacity: 1;
  transform:
    translate(-50%, -50%)
    scale(1)
    rotate(0);
}

/* ==========================================
   PONTOS
========================================== */

.dot {
  position: absolute;
  z-index: 7;
  display: grid;
  place-items: center;
  width: clamp(30px, 5vw, 48px);
  aspect-ratio: 1;
  padding: 0;
  border: 4px solid #ffffff;
  border-radius: 50%;
  color: #ffffff;
  background: #d65f67;
  box-shadow:
    0 5px 0 #973b43,
    0 7px 14px rgba(70, 34, 35, 0.25);
  font-size: clamp(0.75rem, 2vw, 1rem);
  font-weight: 900;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  transition:
    transform 0.17s ease,
    background 0.17s ease,
    opacity 0.3s ease,
    filter 0.17s ease;
}

.dot:hover {
  transform:
    translate(-50%, -50%)
    scale(1.12);
  filter: brightness(1.08);
}

.dot.next {
  color: #594209;
  background: #ffe269;
  box-shadow:
    0 5px 0 #c49d24,
    0 0 20px #fff5a3;
  animation: nextDot 1.05s ease-in-out infinite;
}

.dot.completed {
  color: #ffffff;
  background: #62a85c;
  box-shadow: 0 4px 0 #357a36;
  transform:
    translate(-50%, -50%)
    scale(0.82);
}

.dot.wrong {
  animation: wrongDot 0.48s ease;
}

.game-complete .dot {
  opacity: 0;
  pointer-events: none;
}

@keyframes nextDot {
  0%,
  100% {
    transform:
      translate(-50%, -50%)
      scale(1);
  }

  50% {
    transform:
      translate(-50%, -50%)
      scale(1.18);
  }
}

@keyframes wrongDot {
  0%,
  100% {
    transform: translate(-50%, -50%);
  }

  25% {
    transform:
      translate(calc(-50% - 8px), -50%)
      rotate(-7deg);
  }

  50% {
    transform:
      translate(calc(-50% + 8px), -50%)
      rotate(7deg);
  }

  75% {
    transform:
      translate(calc(-50% - 5px), -50%)
      rotate(-4deg);
  }
}

/* ==========================================
   LINHAS
========================================== */

.friendship-line {
  fill: none;
  stroke: #ffde4f;
  stroke-width: 13;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter:
    drop-shadow(0 4px 0 rgba(130, 85, 20, 0.45))
    drop-shadow(0 0 5px #ffffff);
  animation: drawLine 0.38s ease forwards;
}

@keyframes drawLine {
  from {
    opacity: 0;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
  }

  to {
    opacity: 1;
    stroke-dasharray: 40;
    stroke-dashoffset: 0;
  }
}

/* ==========================================
   MENSAGEM
========================================== */

.game-message {
  position: absolute;
  z-index: 10;
  left: 50%;
  top: 2.5%;
  width: max-content;
  max-width: 85%;
  padding: 9px 17px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  color: #653d35;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 20px rgba(82, 43, 35, 0.2);
  font-size: clamp(0.75rem, 2vw, 1rem);
  font-weight: 900;
  text-align: center;
  transform: translateX(-50%);
}

/* ==========================================
   CORAÇÕES
========================================== */

.floating-heart {
  position: absolute;
  z-index: 14;
  bottom: -10%;
  color: #ef4f68;
  font-size: clamp(1.3rem, 4vw, 2.5rem);
  pointer-events: none;
  animation: floatingHeart 2.7s ease-out forwards;
}

@keyframes floatingHeart {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.35) rotate(0);
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform:
      translateY(-560px)
      scale(1.35)
      rotate(22deg);
  }
}

/* ==========================================
   VITÓRIA
========================================== */

.victory-overlay {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  background: rgba(79, 45, 48, 0.65);
  backdrop-filter: blur(4px);
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
}

.victory-overlay.show {
  visibility: visible;
  opacity: 1;
  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,
      #fffbd4 0%,
      #ffe99a 55%,
      #ffd66d 100%
    );
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.3);
  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-icons {
  margin-bottom: 4px;
  font-size: clamp(2.2rem, 8vw, 4rem);
}

.victory-card h2 {
  margin: 0;
  color: #c94f5b;
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 900;
}

.victory-card p {
  margin: 7px auto 20px;
  color: #69473c;
  font-size: clamp(0.95rem, 2.8vw, 1.15rem);
  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: #d45f65;
  box-shadow: 0 4px 0 #963c43;
}

.clip-btn {
  background: #6757b8;
  box-shadow: 0 4px 0 #403483;
}

.book-btn {
  background: #52a45b;
  box-shadow: 0 4px 0 #307139;
}

/* ==========================================
   RODAPÉ
========================================== */

.game-footer {
  margin-top: 20px;
  text-align: center;
}

.game-footer strong {
  color: #c55058;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.game-footer p {
  margin: 2px 0 0;
  color: #765749;
  font-size: 0.88rem;
  font-weight: 800;
}

/* ==========================================
   CELULAR
========================================== */

@media (max-width: 700px) {
  body {
    padding-top: 10px;
  }

  .game-shell {
    width: min(100% - 14px, 850px);
  }

  .game-topbar {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .game-title {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .top-btn {
    grid-row: 2;
    padding: 9px 12px;
    font-size: 0.75rem;
  }

  .instruction-card {
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 11px;
    border-radius: 18px;
  }

  .instruction-icon {
    width: 47px;
    height: 47px;
    font-size: 1.6rem;
  }

  .instruction-card p {
    font-size: 0.76rem;
  }

  .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;
  }

  .dot {
    width: clamp(25px, 7vw, 38px);
    border-width: 3px;
  }

  .friendship-line {
    stroke-width: 16;
  }

  .game-message {
    top: 1.8%;
    padding: 6px 10px;
  }
}