/* ============================================
   joguinhos.takk.space — estilo global kid-friendly
   Fonte: Fredoka (Google Fonts) — arredondada, amigável
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&display=swap');

:root {
  /* paleta quente e vibrante, sem ser berrante */
  --c-cream:       #fff9e8;
  --c-cream-2:     #ffecc2;
  --c-coral:       #ff6b6b;
  --c-coral-dark:  #e84a4a;
  --c-yellow:      #ffd93d;
  --c-yellow-dark: #f5bf00;
  --c-pink:        #ff99c8;
  --c-blue:        #5fc7ff;
  --c-blue-soft:   #a8e6ff;
  --c-green:       #8bd17c;
  --c-purple:      #b892ff;
  --c-ink:         #3d2645;  /* roxo escuro no lugar de preto — mais suave */
  --c-ink-soft:    #6b5577;

  /* sombras "chunky" — pseudo-3D offset sólido + difusão */
  --shadow-sm:        0 4px 0 rgba(61,38,69,0.15), 0 6px 12px rgba(61,38,69,0.08);
  --shadow-md:        0 8px 0 rgba(61,38,69,0.15), 0 12px 24px rgba(61,38,69,0.12);
  --shadow-md-hover:  0 12px 0 rgba(61,38,69,0.18), 0 18px 30px rgba(61,38,69,0.18);
  --shadow-btn:       0 6px 0 var(--c-coral-dark);
  --shadow-btn-active: 0 2px 0 var(--c-coral-dark);

  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-pill: 999px;

  --font: 'Fredoka', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-weight: 500;
  color: var(--c-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* Fundo de papel craft — textura sutil de fibra sobre base creme */
  background:
    /* fibra diagonal fina (simula textura de papel) */
    repeating-linear-gradient(
      135deg,
      transparent,
      transparent 3px,
      rgba(180, 155, 120, 0.04) 3px,
      rgba(180, 155, 120, 0.04) 5px
    ),
    /* grão horizontal mais sutil */
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 7px,
      rgba(160, 140, 110, 0.025) 7px,
      rgba(160, 140, 110, 0.025) 9px
    ),
    /* mancha de cor quente nos cantos (como lápis esfumado) */
    radial-gradient(ellipse at 10% 5%, rgba(255, 200, 140, 0.2) 0, transparent 35%),
    radial-gradient(ellipse at 90% 95%, rgba(200, 160, 255, 0.15) 0, transparent 35%),
    /* base: papel creme quente */
    linear-gradient(180deg, #fdf6e8 0%, #f5e9d0 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  position: relative;
}

/* rabiscos decorativos de lápis nos cantos — CSS puro */
body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.12;
}
/* canto superior direito: espiral de lápis */
body::before {
  width: 200px;
  height: 200px;
  top: 30px;
  right: 30px;
  border: 6px solid var(--c-coral);
  border-radius: 50%;
  border-top-color: transparent;
  border-left-color: transparent;
  transform: rotate(-25deg);
}
/* canto inferior esquerdo: estrela de lápis */
body::after {
  width: 0;
  height: 0;
  bottom: 60px;
  left: 40px;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-bottom: 70px solid var(--c-yellow);
  filter: blur(1px);
}

/* ==================== Header ==================== */
.site-header {
  text-align: center;
  padding: clamp(32px, 6vw, 64px) 16px 16px;
  position: relative;
  z-index: 1;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--c-coral);
  text-shadow:
    0 4px 0 var(--c-coral-dark),
    0 8px 20px rgba(255, 107, 107, 0.3);
  animation: wiggle 4s ease-in-out infinite;
  display: inline-block;
}
@keyframes wiggle {
  0%, 100% { transform: rotate(-1deg); }
  50%      { transform: rotate(1deg); }
}

.tagline {
  margin: 16px 0 0;
  color: var(--c-ink-soft);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 500;
}

/* ==================== Grid de jogos ==================== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 28px;
  padding: 32px 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
  position: relative;
  z-index: 1;
}

.game-card {
  --card-color: var(--c-coral);
  position: relative;
  background: white;
  border-radius: var(--radius-xl);
  padding: 28px 20px 24px;
  text-decoration: none;
  color: inherit;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 4px solid white;
  outline: none;
}

/* cada card numa cor diferente, cicla em 6 */
.game-card:nth-child(6n+1) { --card-color: var(--c-coral); }
.game-card:nth-child(6n+2) { --card-color: var(--c-blue); }
.game-card:nth-child(6n+3) { --card-color: var(--c-green); }
.game-card:nth-child(6n+4) { --card-color: var(--c-yellow-dark); }
.game-card:nth-child(6n+5) { --card-color: var(--c-purple); }
.game-card:nth-child(6n+6) { --card-color: var(--c-pink); }

.game-card:hover,
.game-card:focus-visible {
  transform: translateY(-6px) rotate(-1deg);
  box-shadow: var(--shadow-md-hover);
  border-color: var(--card-color);
}
.game-card:active {
  transform: translateY(-2px);
}

.game-icon {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--card-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  line-height: 1;
  box-shadow:
    inset 0 -6px 0 rgba(0,0,0,0.12),
    0 6px 0 rgba(61,38,69,0.18);
  margin-bottom: 4px;
  transition: transform 0.3s ease;
  overflow: hidden;
}
/* Quando o ícone é uma imagem em vez de emoji */
.game-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.game-card:hover .game-icon {
  animation: pop 0.5s ease;
}
@keyframes pop {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.15) rotate(-5deg); }
}

.game-card h2 {
  margin: 6px 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--c-ink);
}

.game-card p {
  margin: 0;
  color: var(--c-ink-soft);
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.3;
}

.age {
  display: inline-block;
  margin-top: 8px;
  background: var(--card-color);
  color: white;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  box-shadow: 0 3px 0 rgba(0,0,0,0.12);
}

/* ==================== Footer ==================== */
.site-footer {
  text-align: center;
  padding: 32px 16px;
  color: var(--c-ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  z-index: 1;
}
.site-footer a {
  color: var(--c-coral);
  text-decoration: none;
  font-weight: 700;
}
.site-footer a:hover { text-decoration: underline; }

/* ==================== Botão voltar (injetado por back-to-menu.js) ==================== */
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--c-coral);
  color: white;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  font-family: var(--font);
  box-shadow: var(--shadow-btn);
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.back-button:hover  { transform: translateY(-2px); }
.back-button:active {
  transform: translateY(4px);
  box-shadow: var(--shadow-btn-active);
}

/* ==================== Botões reutilizáveis ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  text-decoration: none;
  color: white;
  background: var(--c-coral);
  box-shadow: var(--shadow-btn);
  transition: transform 0.1s ease;
}
.btn:hover  { transform: translateY(-2px); }
.btn:active {
  transform: translateY(4px);
  box-shadow: var(--shadow-btn-active);
}
.btn.btn-yellow {
  background: var(--c-yellow);
  color: var(--c-ink);
  box-shadow: 0 6px 0 var(--c-yellow-dark);
}
.btn.btn-yellow:active { box-shadow: 0 2px 0 var(--c-yellow-dark); }

.btn.btn-ghost {
  background: white;
  color: var(--c-ink);
  box-shadow: 0 6px 0 rgba(61,38,69,0.15);
}
.btn.btn-ghost:active { box-shadow: 0 2px 0 rgba(61,38,69,0.15); }

.btn.active {
  background: var(--c-coral);
  color: white;
  box-shadow: 0 6px 0 var(--c-coral-dark);
}

/* ==================== Utilidades ==================== */
.hidden { display: none !important; }

.game-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  position: relative;
  z-index: 1;
}

.game-page h1 {
  text-align: center;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  color: var(--c-coral);
  text-shadow: 0 3px 0 var(--c-coral-dark);
  margin: 12px 0 20px;
}
