/* Home (index.html, en/ e es/) — carregado depois de home/base.css e só
   acrescenta/sobrescreve o que é do layout focado em levar o visitante
   direto pra um jogo. Tokens de cor, topbar, botões, formulário e rodapé
   continuam vindo de base.css. */

body.home{
  --letfall:      #1D4ED8;
  --letfall-tint: #EAF0FE;
  --letrix:       #0E8A78;
  --letrix-tint:  #E6F5F2;
  --letmaze:      #B4761F;
  --letmaze-tint: #FDF1E0;
  --letchess:      #6D28D9;
  --letchess-tint: #EDE9FE;
}
html.night body.home{
  --letfall:  #7EA2FF;
  --letrix:   #3CC7B1;
  --letmaze:  #E5A54B;
  --letchess: #A78BFA;
  --letfall-tint:  #16213D;
  --letrix-tint:   #10302B;
  --letmaze-tint:  #33260F;
  --letchess-tint: #241A3D;
}

.home header.topbar{ padding-top: 14px; padding-bottom: 6px; }

/* ---------- bloco principal: jogos acima da dobra ---------- */
section.play{
  padding: 20px 24px 44px;
  border-bottom: 1px solid var(--border);
}
.play-inner{
  max-width: 1080px;
  margin: 0 auto;
}
.play h1{
  font-size: clamp(24px, 3.6vw, 34px);
  text-align: center;
  margin: 8px 0 8px;
}
.play-lead{
  text-align: center;
  color: var(--muted);
  font-size: clamp(14.5px, 1.5vw, 16.5px);
  margin: 0 auto 26px;
  max-width: 560px;
}

/* ---------- continuar jogando ---------- */
.resume{
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 420px;
  margin: 4px auto 18px;
  padding: 10px 14px 10px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--g, var(--primary));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: box-shadow .15s ease, transform .15s ease;
}
.resume[hidden]{ display: none; }
.resume:hover{ box-shadow: var(--shadow-hover); }
.resume-icon{
  flex: none;
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--g-tint, var(--primary-tint));
  color: var(--g, var(--primary));
  font-size: 14px;
}
.resume-text{ display: flex; flex-direction: column; line-height: 1.25; flex: 1; }
.resume-label{ font-size: 12.5px; color: var(--muted); font-weight: 600; }
.resume-text strong{ font-size: 16px; }
.resume-go{ color: var(--g, var(--primary)); display: flex; }
.resume.letfall{  --g: var(--letfall);  --g-tint: var(--letfall-tint); }
.resume.letrix{   --g: var(--letrix);   --g-tint: var(--letrix-tint); }
.resume.letmaze{  --g: var(--letmaze);  --g-tint: var(--letmaze-tint); }
.resume.letchess{ --g: var(--letchess); --g-tint: var(--letchess-tint); }

/* ---------- grade de jogos ---------- */
.games{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  scroll-margin-top: 16px;
}
.game{
  --g: var(--primary);
  --g-tint: var(--primary-tint);
  display: flex;
  flex-direction: column;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.game:hover{
  box-shadow: var(--shadow-hover);
  border-color: var(--g);
  transform: translateY(-2px);
}
.game:focus-visible{ outline: 3px solid var(--g); outline-offset: 2px; }
.game.letfall{  --g: var(--letfall);  --g-tint: var(--letfall-tint); }
.game.letrix{   --g: var(--letrix);   --g-tint: var(--letrix-tint); }
.game.letmaze{  --g: var(--letmaze);  --g-tint: var(--letmaze-tint); }
.game.letchess{ --g: var(--letchess); --g-tint: var(--letchess-tint); }

.game-body{
  display: flex;
  flex-direction: column;
  padding: 14px 16px 16px;
  flex: 1;
}
.game-cat{
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--g);
}
.game h2{
  font-size: 20px;
  margin: 2px 0 4px;
  letter-spacing: -.01em;
}
.game-body p{
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 0 14px;
  flex: 1;
}
.game-play{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--g);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 11px 14px;
  border-radius: 9px;
}
html.night .game-play{ color: #0B0F17; }

/* ---------- prévias ilustradas (só CSS/SVG, sem imagens) ---------- */
.preview{
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--g-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}

/* Letfall: tabuleiro escuro, peças encaixadas e uma letra caindo */
.lf-board{
  position: relative;
  width: 62%;
  height: 84%;
  background: #363636;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  padding: 5px;
}
.lf-row{ display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.lf-row b, .lf-row i, .lf-drop{
  aspect-ratio: 1;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font: 700 clamp(10px, 1.3vw, 14px) "Courier New", monospace;
  font-style: normal;
}
.lf-row b{ background: #B7AC90; color: #1B1A17; }
.lf-row i{ background: transparent; }
.lf-drop{
  position: absolute;
  top: 6%;
  left: calc(5px + (100% - 10px - 15px) / 6 * 3 + 9px);
  width: calc((100% - 10px - 15px) / 6);
  background: #9C7A28;
  color: #1B1A17;
  animation: lf-fall 2.6s cubic-bezier(.5,0,.8,.6) infinite;
}
@keyframes lf-fall{
  0%   { transform: translateY(0); opacity: 0; }
  10%  { opacity: 1; }
  75%  { transform: translateY(220%); opacity: 1; }
  100% { transform: translateY(220%); opacity: 0; }
}

/* Letrix: grade de letras com uma palavra marcada */
.lx-grid{
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  width: 64%;
}
.lx-grid span{
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-alt);
  border-radius: 4px;
  font-weight: 700;
  font-size: clamp(10px, 1.25vw, 14px);
  color: var(--muted);
}
.lx-grid span.hit{
  background: var(--g);
  color: #fff;
  animation: lx-pop 2.8s ease-in-out infinite;
}
.lx-grid span.hit:nth-child(7){ animation-delay: .12s; }
.lx-grid span.hit:nth-child(8){ animation-delay: .24s; }
.lx-grid span.hit:nth-child(9){ animation-delay: .36s; }
.lx-grid span.hit:nth-child(10){ animation-delay: .48s; }
@keyframes lx-pop{
  0%, 55%, 100% { transform: scale(1); }
  65% { transform: scale(1.14); }
}

/* Letmaze: labirinto em SVG com ovelha, lobo e chegada */
.pv-letmaze svg{ width: 78%; height: 84%; color: var(--g); }
.pv-letmaze .mz-path{ stroke: var(--muted-2); opacity: .7; }
.pv-letmaze span{
  position: absolute;
  font-size: clamp(14px, 1.9vw, 22px);
  line-height: 1;
}
.mz-sheep{ left: 17%; top: 14%; animation: mz-bob 1.6s ease-in-out infinite; }
.mz-wolf{ left: 47%; top: 38%; }
.mz-goal{ right: 22%; top: 55%; }
@keyframes mz-bob{
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* Letchess: canto de tabuleiro com um lance de cavalo em destaque */
.ch-board{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 46%;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(16,24,40,.18);
}
.ch-board span{
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(14px, 2vw, 24px);
  line-height: 1;
  color: #1B1A17;
  background: #EEEED2;
}
/* casas escuras em xadrez: linhas pares começam escuras na 2ª casa, ímpares na 1ª */
.ch-board span:nth-child(8n+2), .ch-board span:nth-child(8n+4),
.ch-board span:nth-child(8n+5), .ch-board span:nth-child(8n+7){ background: #769656; }
.ch-board span.to{ box-shadow: inset 0 0 0 3px rgba(246,246,105,.95); }

@media (prefers-reduced-motion: reduce){
  .lf-drop, .lx-grid span.hit, .mz-sheep{ animation: none; }
  .lf-drop{ transform: translateY(110%); }
  .game, .game:hover{ transform: none; }
}

/* ---------- rodapé do bloco principal ---------- */
.play-foot{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
}
.surprise{ font-size: 14px; }
.chips{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
}
.chips li{
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.chips li::before{
  content: "";
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--teal-tint) no-repeat center / 9px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12l6 6L20 6' fill='none' stroke='%230E8A78' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ---------- detalhes de cada jogo ---------- */
.details{
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.detail{
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.detail .icon-box{ flex: none; }
.detail-text{ flex: 1; min-width: 0; }
.detail h3{ margin: 0 0 4px; font-size: 17px; }
.detail p{ margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.detail p.detail-age{
  margin-top: -4px;
  font-size: 13px;
}
.detail p.detail-age::before{
  content: "";
  display: inline-block;
  vertical-align: -2px;
  margin-right: 6px;
  width: 14px; height: 14px;
  background: var(--muted-2);
  /* silhueta de pessoa: indica faixa etária sem depender de emoji */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0z'/%3E%3C/svg%3E") no-repeat center / contain;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0z'/%3E%3C/svg%3E") no-repeat center / contain;
}
.detail p.detail-age strong{ color: var(--ink); font-weight: 600; white-space: nowrap; }
.detail .tags{ display: flex; flex-wrap: wrap; gap: 6px; }
.detail .tags span{
  font-size: 12px;
  color: var(--muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 6px;
}
.detail .btn{ flex: none; }

/* ---------- turmas (faixa compacta) ---------- */
section.schools{ padding: 40px 24px; }
.schools-inner{
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 28px;
}
.schools-inner .kicker{
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 6px;
}
.schools-inner h2{ font-size: 20px; margin: 0 0 6px; }
.schools-inner p{ margin: 0; color: var(--muted); font-size: 14px; }
.schools-inner .btn{ flex: none; }

/* ---------- barra fixa (celular) ---------- */
.sticky-play{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: none;
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 14px rgba(16,24,40,.08);
  transform: translateY(110%);
  transition: transform .2s ease;
}
.sticky-play.show{ transform: translateY(0); }
.sticky-play .btn{ justify-content: center; }
.sticky-play .btn-primary{ flex: 1; font-size: 15px; }

/* ---------- diálogo "não sei qual escolher" ---------- */
/* padding 0 no <dialog> e padding no .age-step: assim um clique cujo alvo é
   o próprio <dialog> só pode ser no fundo (ver home.js). */
.age-dialog{
  width: min(420px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-alt);
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(16,24,40,.22);
  font-family: var(--font-ui);
}
.age-dialog button{ font-family: inherit; }
.age-dialog::backdrop{ background: rgba(11,15,23,.55); }
.age-step{
  padding: 28px 24px 24px;
  text-align: center;
}
.age-step h2{
  margin: 0 0 18px;
  font-size: 20px;
  letter-spacing: -.01em;
}
.age-step .kicker{
  display: block;
  margin-bottom: 4px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--teal);
}
#age-result h2{ margin-bottom: 2px; font-size: 24px; }
.age-desc{ margin: 0 0 10px; font-size: 15px; font-weight: 400; color: var(--muted); }
.age-options{ display: flex; flex-direction: column; gap: 10px; }
.age-options .btn{ justify-content: center; font-size: 15.5px; }
.age-reason{ margin: 0 0 18px; font-size: 14px; color: var(--muted); }
.age-reason strong{ color: var(--ink); font-weight: 600; }
#age-play{ width: 100%; justify-content: center; font-size: 15.5px; }
.age-more{
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 14px;
}
.age-link{
  background: none;
  border: 0;
  padding: 4px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--mood);
  cursor: pointer;
}
html.night .age-link{ color: var(--muted); }
.age-link:hover{ text-decoration: underline; }
.age-link[hidden]{ display: none; }
.age-close-form{ position: absolute; top: 8px; right: 8px; margin: 0; }
.age-close{
  width: 32px; height: 32px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted-2);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.age-close:hover{ color: var(--ink); background: var(--border); }

/* ---------- responsivo ---------- */
@media (max-width: 960px){
  .games{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 660px){
  /* No celular o nav em segunda linha empurraria os jogos pra baixo da
     dobra; as seções continuam acessíveis rolando a página. */
  .home header.topbar nav{ display: none; }
  .home header.topbar{ padding: 12px 16px 4px; }

  section.play{ padding: 12px 16px 32px; }
  .play h1{ font-size: 22px; margin-top: 4px; }
  .play-lead{ font-size: 14px; margin-bottom: 16px; }
  .resume{ margin-bottom: 14px; }

  .games{ gap: 10px; }
  .game{ border-radius: 12px; }
  .game-body{ padding: 10px 11px 12px; }
  .game h2{ font-size: 17px; }
  .game-body p{ font-size: 12.5px; margin-bottom: 10px; line-height: 1.4; }
  .game-cat{ font-size: 10.5px; }
  .game-play{ font-size: 14px; padding: 9px 10px; }

  .chips{ gap: 6px 14px; }
  .chips li{ font-size: 12.5px; }

  section.alt, section.schools{ padding: 36px 16px; }
  .detail{ flex-wrap: wrap; padding: 16px; gap: 12px 14px; }
  .detail .btn{ width: 100%; justify-content: center; }
  .schools-inner{ flex-direction: column; align-items: flex-start; gap: 16px; }

  .sticky-play:not([hidden]){ display: flex; }
  body.home{ padding-bottom: 72px; }
}
