/* =========================================
   RESET & BASE
   ========================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --roxo:       #7C3AED;
  --roxo-light: #A78BFA;
  --rosa:       #EC4899;
  --amarelo:    #F59E0B;
  --verde:      #10B981;
  --azul:       #3B82F6;
  --laranja:    #F97316;
  --bg:         #FFF9F0;
  --card-bg:    #FFFFFF;
  --text:       #1E1B4B;
  --text-light: #6B7280;
  --radius:     20px;
  --shadow:     0 8px 32px rgba(124,58,237,0.12);
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* =========================================
   FUNDO ESTRELADO
   ========================================= */
.stars-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: linear-gradient(135deg, #FFF9F0 0%, #F5F0FF 50%, #FFF0F8 100%);
}
.stars-bg::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(124,58,237,0.08) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* =========================================
   HEADER
   ========================================= */
header {
  position: sticky; top: 0; z-index: 100;
  background: white;
  box-shadow: 0 2px 20px rgba(124,58,237,0.1);
  padding: 0 24px;
}
.header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 12px; flex-wrap: wrap;
}
.logo {
  font-family: 'Fredoka One', cursive;
  font-size: 1.4rem;
  background: linear-gradient(135deg, var(--roxo), var(--rosa));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}
.header-actions { display: flex; align-items: center; gap: 10px; }

.back-btn {
  display: flex; align-items: center; gap: 6px;
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: .9rem;
  color: var(--roxo); text-decoration: none;
  background: #F3EEFF; border-radius: 50px; padding: 8px 16px;
  transition: all .2s;
}
.back-btn:hover { background: var(--roxo); color: white; }

.btn-login-nav {
  display: flex; align-items: center; gap: 6px;
  font-family: 'Fredoka One', cursive; font-size: .95rem;
  color: white; text-decoration: none;
  background: linear-gradient(135deg, var(--rosa), var(--roxo));
  border-radius: 50px; padding: 8px 18px;
  box-shadow: 0 4px 12px rgba(124,58,237,.3);
  transition: all .2s;
}
.btn-login-nav:hover { transform: translateY(-2px); }

.user-chip-nav {
  display: flex; align-items: center; gap: 6px;
  background: #F3EEFF; border: 2px solid #DDD6FE;
  border-radius: 50px; padding: 6px 14px 6px 6px;
  font-size: .85rem; font-weight: 800; color: var(--roxo);
}
.user-chip-nav .av {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--rosa), var(--roxo));
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 900; color: white;
}

/* =========================================
   BANNER DE CONVERSÃO
   ========================================= */
.conversion-banner {
  position: relative; z-index: 1;
  background: linear-gradient(135deg, #7C3AED, #EC4899);
  color: white;
  padding: 14px clamp(1rem, 4vw, 3rem);
  display: flex; align-items: center; justify-content: center;
  gap: 16px; flex-wrap: wrap; text-align: center;
}
.conversion-banner p {
  font-weight: 800; font-size: .95rem;
  display: flex; align-items: center; gap: 8px;
}
.conversion-banner a {
  background: white; color: var(--roxo);
  font-family: 'Fredoka One', cursive; font-size: .95rem;
  padding: 7px 20px; border-radius: 50px; text-decoration: none;
  box-shadow: 0 3px 10px rgba(0,0,0,.2);
  transition: all .2s; flex-shrink: 0;
}
.conversion-banner a:hover { transform: scale(1.05); }

/* =========================================
   HERO
   ========================================= */
.hero {
  position: relative; z-index: 1;
  text-align: center; padding: 52px 24px 36px;
}
.hero-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--amarelo), var(--laranja));
  color: white; font-family: 'Fredoka One', cursive;
  font-size: 1rem; padding: 6px 20px; border-radius: 50px;
  margin-bottom: 16px; letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(249,115,22,0.35);
}
.hero h1 {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2rem, 6vw, 3.5rem);
  line-height: 1.1;
  background: linear-gradient(135deg, var(--roxo), var(--rosa), var(--amarelo));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}
.hero p {
  font-size: 1.1rem; color: var(--text-light); font-weight: 600;
  max-width: 500px; margin: 0 auto;
}

/* =========================================
   SECTION LABELS
   ========================================= */
.section-label {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 0 auto;
  padding: 0 24px 14px;
  display: flex; align-items: center; gap: 10px;
}
.section-label-text {
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem; color: var(--text);
}
.section-label-badge {
  font-size: .75rem; font-weight: 800; text-transform: uppercase;
  padding: 3px 10px; border-radius: 99px; letter-spacing: .06em;
}
.badge-free     { background: #D1FAE5; color: #065F46; }
.badge-premium  { background: #EDE9FE; color: var(--roxo); }

/* =========================================
   GAME GRID
   ========================================= */
.game-grid {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 0 auto;
  padding: 0 24px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
}

/* =========================================
   GAME CARD
   ========================================= */
.game-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .25s, box-shadow .25s;
  cursor: pointer;
  border: 2px solid transparent;
}
.game-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 48px rgba(124,58,237,0.18);
}
.game-card.active {
  grid-column: 1 / -1;
  cursor: default;
  border-color: var(--roxo-light);
}

.game-header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 24px;
}
.game-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; flex-shrink: 0;
}
.game-meta h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem; margin-bottom: 2px;
}
.game-meta p { font-size: .85rem; color: var(--text-light); font-weight: 600; }

.play-btn {
  margin-left: auto;
  background: linear-gradient(135deg, var(--roxo), var(--rosa));
  color: white; border: none; border-radius: 50px;
  font-family: 'Fredoka One', cursive; font-size: 1rem;
  padding: 10px 22px; cursor: pointer;
  box-shadow: 0 4px 12px rgba(124,58,237,0.3);
  transition: transform .15s, box-shadow .15s;
  flex-shrink: 0;
}
.play-btn:hover { transform: scale(1.05); box-shadow: 0 6px 20px rgba(124,58,237,0.4); }

.close-btn {
  background: #F3F4F6; color: var(--text); border: none;
  border-radius: 50px; font-family: 'Fredoka One', cursive;
  font-size: .9rem; padding: 8px 18px; cursor: pointer;
  transition: background .15s;
}
.close-btn:hover { background: #E5E7EB; }

.game-area {
  display: none; padding: 0 24px 28px;
}
.game-card.active .game-area { display: block; }

/* =========================================
   CARD PREMIUM (bloqueado)
   ========================================= */
.game-card-premium {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 2.5px solid #EDE9FE;
  cursor: default;
}
.lock-overlay {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 28px 24px; text-align: center; gap: 10px;
  background: rgba(245,243,255,.97);
}
.lock-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--roxo), var(--rosa));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; margin-bottom: 4px;
  box-shadow: 0 6px 20px rgba(124,58,237,.3);
}
.lock-title  { font-family: 'Fredoka One', cursive; font-size: 1.1rem; color: var(--roxo); }
.lock-desc   { font-size: .85rem; color: var(--text-light); font-weight: 700; max-width: 240px; line-height: 1.5; }
.lock-tag    {
  font-size: .72rem; font-weight: 800; text-transform: uppercase;
  background: linear-gradient(135deg, var(--roxo), var(--rosa));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: .08em;
}
.lock-cta {
  display: inline-block; margin-top: 4px;
  background: linear-gradient(135deg, var(--rosa), var(--roxo));
  color: white; font-family: 'Fredoka One', cursive; font-size: 1rem;
  padding: 10px 26px; border-radius: 50px; text-decoration: none;
  box-shadow: 0 4px 14px rgba(124,58,237,.35);
  transition: all .2s;
}
.lock-cta:hover { transform: translateY(-3px) scale(1.03); }

/* =========================================
   SCORE BAR
   ========================================= */
.score-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  background: #F9FAFB; border-radius: 12px;
  padding: 10px 18px; margin-bottom: 18px;
}
.score-item { font-weight: 800; font-size: .9rem; }
.score-item span { color: var(--roxo); font-family: 'Fredoka One', cursive; font-size: 1.1rem; }

.btn-restart {
  background: var(--verde); color: white; border: none; border-radius: 50px;
  font-family: 'Fredoka One', cursive; font-size: .9rem;
  padding: 7px 18px; cursor: pointer; transition: opacity .15s;
}
.btn-restart:hover { opacity: .85; }

/* =========================================
   1. FORCA
   ========================================= */
#forca-canvas {
  width: 100%; max-width: 260px; height: 200px;
  margin: 0 auto 16px; display: block;
  background: #F9FAFB; border-radius: 12px;
}
#forca-palavra {
  display: flex; justify-content: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 14px;
}
#forca-palavra .letra {
  width: 32px; height: 40px;
  border-bottom: 3px solid var(--roxo);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka One', cursive; font-size: 1.4rem;
  color: var(--text); text-transform: uppercase;
}
#forca-dica {
  text-align: center; font-size: .9rem;
  color: var(--text-light); font-weight: 700; margin-bottom: 14px;
}
.forca-letras {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.forca-letras button {
  width: 38px; height: 38px; border-radius: 10px;
  border: 2px solid #E5E7EB; background: white;
  font-family: 'Fredoka One', cursive; font-size: 1rem;
  cursor: pointer; transition: all .15s; color: var(--text);
}
.forca-letras button:hover:not(:disabled) {
  background: var(--roxo); color: white; border-color: var(--roxo);
}
.forca-letras button:disabled  { opacity: .4; cursor: not-allowed; }
.forca-letras button.errada    { background: #FEE2E2; border-color: #F87171; color: #DC2626; }
.forca-letras button.certa     { background: #D1FAE5; border-color: #10B981; color: var(--verde); }

/* =========================================
   2. LIGA OS PONTOS
   ========================================= */
#pontos-wrap {
  position: relative;
  width: 100%;
  user-select: none;
}
#pontos-canvas {
  display: block;
  width: 100%;
  border-radius: 12px;
  background: #F9FAFB;
  cursor: crosshair;
  touch-action: none;
}
#pontos-hint {
  text-align: center; font-size: .85rem;
  color: var(--text-light); font-weight: 700;
  margin-top: 10px;
}

/* =========================================
   3. COLORIR
   ========================================= */
.colorir-wrap {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start;
}
.palette {
  display: flex; flex-wrap: wrap; gap: 8px; max-width: 180px;
}
.palette-color {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: transform .15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.palette-color.selected { border-color: var(--text); transform: scale(1.15); }
.palette-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.palette-actions button {
  background: #F3F4F6; border: none; border-radius: 10px;
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: .8rem;
  padding: 8px 12px; cursor: pointer; transition: background .15s;
}
.palette-actions button:hover { background: #E5E7EB; }

#colorir-canvas {
  flex: 1; min-width: 200px;
  background: white; border-radius: 12px;
  border: 2px solid #E5E7EB;
  cursor: crosshair;
  display: block;
  max-height: 380px;
}

/* =========================================
   4. MEMÓRIA
   ========================================= */
.memoria-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(4, 1fr);
  max-width: 380px; margin: 0 auto;
}
.mem-card {
  aspect-ratio: 1; border-radius: 12px;
  background: linear-gradient(135deg, var(--roxo), var(--roxo-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; cursor: pointer; user-select: none;
  transition: transform .2s;
  border: 3px solid transparent;
}
.mem-card:hover:not(.revealed):not(.matched) { transform: scale(1.05); }
.mem-card .front { display: none; }
.mem-card .back  { font-size: 1.4rem; color: rgba(255,255,255,.5); }
.mem-card.revealed,
.mem-card.matched { background: white; border-color: var(--roxo-light); }
.mem-card.revealed .front,
.mem-card.matched  .front { display: block; }
.mem-card.revealed .back,
.mem-card.matched  .back  { display: none; }
.mem-card.matched { border-color: var(--verde); opacity: .7; cursor: default; }

/* =========================================
   5. QUIZ
   ========================================= */
.quiz-question {
  background: linear-gradient(135deg, var(--roxo), var(--rosa));
  color: white; border-radius: 16px; padding: 20px 24px;
  font-family: 'Fredoka One', cursive; font-size: 1.15rem;
  line-height: 1.4; margin-bottom: 18px; text-align: center;
}
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quiz-opt {
  background: white; border: 2px solid #E5E7EB;
  border-radius: 12px; padding: 14px 12px; cursor: pointer;
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: .9rem;
  text-align: center; transition: all .15s; color: var(--text);
}
.quiz-opt:hover:not(:disabled) { border-color: var(--roxo); background: #F5F0FF; }
.quiz-opt.certa  { background: #D1FAE5; border-color: var(--verde); color: var(--verde); }
.quiz-opt.errada { background: #FEE2E2; border-color: #F87171; color: #DC2626; }
.quiz-progress {
  display: flex; gap: 6px; justify-content: center; margin-bottom: 14px;
}
.quiz-dot        { width: 10px; height: 10px; border-radius: 50%; background: #E5E7EB; }
.quiz-dot.done   { background: var(--verde); }
.quiz-dot.active { background: var(--roxo); }

/* =========================================
   6. JOGO DA VELHA
   ========================================= */
.velha-board {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; max-width: 300px; margin: 0 auto 16px;
}
.velha-cell {
  aspect-ratio: 1; border-radius: 14px;
  background: #F3EEFF;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka One', cursive; font-size: 2.4rem;
  cursor: pointer;
  transition: background .15s, transform .1s;
  border: 3px solid transparent;
}
.velha-cell:hover:not(.taken) { background: #EDE9FE; transform: scale(1.03); }
.velha-cell.taken { cursor: default; }
.velha-cell.win   { background: #D1FAE5; border-color: var(--verde); }
.velha-cell[data-p="X"] { color: var(--roxo); }
.velha-cell[data-p="O"] { color: var(--rosa); }

.velha-status {
  text-align: center; font-family: 'Fredoka One', cursive;
  font-size: 1.1rem; margin-bottom: 12px;
}
.velha-scores {
  display: flex; justify-content: center; gap: 24px; margin-bottom: 14px;
}
.velha-score-box {
  text-align: center; background: #F9FAFB;
  border-radius: 12px; padding: 8px 20px;
}
.velha-score-box .label { font-size: .75rem; font-weight: 800; color: var(--text-light); }
.velha-score-box .val   { font-family: 'Fredoka One', cursive; font-size: 1.5rem; }

/* =========================================
   FOOTER
   ========================================= */
footer {
  position: relative; z-index: 1;
  text-align: center; padding: 32px 24px;
  font-size: .85rem; color: var(--text-light); font-weight: 700;
  border-top: 2px dashed #EDE9FE; margin-top: 20px;
}
footer a { color: var(--roxo); text-decoration: none; }

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 600px) {
  .quiz-options     { grid-template-columns: 1fr; }
  .memoria-grid     { gap: 7px; }
  .mem-card         { font-size: 1.3rem; }
  .velha-cell       { font-size: 1.8rem; }
  .colorir-wrap     { flex-direction: column; }
  .palette          { max-width: 100%; }
  .conversion-banner { flex-direction: column; gap: 10px; }
}
