* {
  box-sizing: border-box;
}

:root {
  --purple-dark: #2b166f;
  --purple: #5b2dbf;
  --pink: #ff4fa3;
  --yellow: #ffd84d;
  --cream: #fff7df;
  --white: #ffffff;
  --shadow: rgba(18, 10, 53, 0.24);
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--white);
  background:
    radial-gradient(circle at top left, rgba(255, 216, 77, 0.38), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(255, 79, 163, 0.35), transparent 24rem),
    linear-gradient(135deg, #1e1b4b, #4c1d95 55%, #7e22ce);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.game-shell {
  width: min(100%, 980px);
}

.hero {
  text-align: center;
  margin-bottom: 18px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 216, 77, 0.96);
  color: #432307;
  font-weight: 800;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.2rem);
  line-height: 0.95;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.subtitle {
  margin: 12px auto 0;
  max-width: 620px;
  font-size: clamp(1rem, 2.8vw, 1.25rem);
  color: rgba(255, 255, 255, 0.88);
}

.score-panel {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0 auto 18px;
}

.score-panel > div,
.score-panel button,
.win-message button {
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.16);
  color: var(--white);
  box-shadow: 0 10px 24px var(--shadow);
  backdrop-filter: blur(10px);
}

.score-panel > div {
  min-width: 120px;
  padding: 12px 18px;
  text-align: center;
}

.label {
  display: block;
  font-size: 0.82rem;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.score-panel strong {
  display: block;
  margin-top: 2px;
  font-size: 1.45rem;
}

button {
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  transition: transform 0.18s ease, filter 0.18s ease;
}

button:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
}

#restartBtn,
.win-message button {
  padding: 15px 22px;
  background: var(--yellow);
  color: #4a2500;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(68px, 1fr));
  gap: clamp(8px, 2vw, 16px);
  max-width: 760px;
  margin: 0 auto;
}

.card {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  background: transparent;
  perspective: 1000px;
}

.card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
}

.card.is-flipped .card-inner,
.card.is-matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: clamp(14px, 3vw, 26px);
  backface-visibility: hidden;
  overflow: hidden;
  box-shadow: 0 16px 28px var(--shadow);
}

.card-back {
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.38), transparent 1.6rem),
    linear-gradient(135deg, #ff4fa3, #ff8c42 48%, #ffd84d);
  border: 4px solid rgba(255, 255, 255, 0.45);
}

.card-back::before {
  content: "🐾";
  font-size: clamp(2rem, 8vw, 4.6rem);
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.18));
}

.card-front {
  transform: rotateY(180deg);
  background: var(--cream);
  border: 5px solid rgba(255, 255, 255, 0.72);
}

.card-front img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.card.is-matched {
  cursor: default;
}

.card.is-matched .card-front {
  outline: 5px solid rgba(255, 216, 77, 0.72);
}

.win-message {
  max-width: 520px;
  margin: 20px auto 0;
  padding: 22px;
  border-radius: 28px;
  text-align: center;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 34px var(--shadow);
  backdrop-filter: blur(12px);
}

.win-message h2 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.win-message p {
  margin: 0 0 16px;
  color: rgba(255,255,255,.88);
}

.hidden {
  display: none;
}

@media (max-width: 520px) {
  body {
    padding: 12px;
    align-items: flex-start;
  }

  .board {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .score-panel {
    gap: 8px;
  }

  .score-panel > div {
    min-width: 96px;
    padding: 10px 12px;
  }

  #restartBtn {
    width: 100%;
    max-width: 220px;
  }
}
.back-button {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 9999;
  display: inline-block;
  padding: 12px 18px;
  border-radius: 999px;
  background: #ffd84d;
  color: #4a2500;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(18, 10, 53, 0.24);
}

.back-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
}

@media (max-width: 520px) {
  .back-button {
    position: static;
    margin: 0 auto 14px;
    display: table;
  }
}
/* Ajuste mobile - centralizar jogo da memória */
@media (max-width: 520px) {
  body {
    justify-content: flex-start;
    align-items: center;
    padding: 14px;
  }

  .game-shell {
    width: 100%;
    margin: 0 auto;
  }

  .hero {
    padding-top: 8px;
    text-align: center;
  }

  h1,
  .subtitle {
    text-align: center;
  }

  .score-panel {
    justify-content: center;
  }

  .board {
    margin-left: auto;
    margin-right: auto;
    max-width: 360px;
  }

  .back-button {
    position: static;
    margin: 0 auto 14px;
    display: table;
  }
}
/* Ajuste final mobile - botão voltar sem empurrar o jogo */
@media (max-width: 520px) {
  .back-button {
    position: fixed !important;
    top: 10px;
    left: 10px;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 120px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    line-height: 1.1;
    margin: 0;
  }

  .game-shell {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding-top: 34px;
  }

  .hero {
    text-align: center;
    padding-top: 0;
  }

  .board {
    width: 100%;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
  }

  .score-panel {
    justify-content: center;
  }
}
/* Correção final mobile - botão voltar não empurra o jogo */
@media (max-width: 520px) {
  body {
    display: block !important;
    min-height: 100dvh;
    padding: 12px 12px 28px !important;
    overflow-x: hidden;
  }

  .back-button {
    position: fixed !important;
    top: 10px !important;
    left: 10px !important;
    z-index: 9999;
    width: 46px !important;
    height: 46px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 50% !important;
    font-size: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  .back-button::before {
    content: "←";
    font-size: 1.5rem;
    line-height: 1;
  }

  .game-shell {
    width: 100% !important;
    max-width: 380px !important;
    margin: 0 auto !important;
    padding-top: 48px !important;
  }

  .hero {
    text-align: center;
    padding-top: 0 !important;
  }

  .board {
    width: 100% !important;
    max-width: 340px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .score-panel {
    justify-content: center !important;
  }
}
public_html > games > ruticuti-memory-game