/* ===================================================================
   Jogos do Dandan — Home "Caderno de Aventuras"
   Estética: figurinhas/adesivos desenhados a giz de cera.
   Contornos grossos de marcador, sombras duras, cores vibrantes,
   botões enormes (ótimos pro toque), tudo arredondado e fofo.
   =================================================================== */

/* ---------- Tokens ---------- */
:root {
  --paper: #fff4e2;
  --paper-2: #ffead0;
  --ink: #3a2b22;          /* marrom-giz escuro (mais fofo que preto) */
  --ink-soft: #6b5848;

  --sun: #ffc23c;
  --sky: #4fc3e8;
  --grass: #57c777;
  --tomato: #ff6f5e;
  --grape: #a585e8;
  --bubblegum: #ff93c4;

  --radius: 28px;
  --radius-sm: 18px;
  --line: 3px;
  --shadow: 0 6px 0 var(--ink);
  --shadow-lg: 8px 8px 0 var(--ink);
  --font-display: "Fredoka", "Baloo 2", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  /* papel quentinho com pontinhos sutis */
  background-image:
    radial-gradient(circle at 50% 0%, var(--paper-2), transparent 60%),
    radial-gradient(rgba(58, 43, 34, 0.06) 1.6px, transparent 1.6px);
  background-size: 100% 700px, 26px 26px;
  background-attachment: fixed, fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.05; }

a { color: inherit; }

img { max-width: 100%; display: block; }

/* foco bem visível pra acessibilidade (teclado) */
:focus-visible {
  outline: 4px solid var(--ink);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- Doodles de fundo flutuando ---------- */
.doodles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.doodle {
  position: absolute;
  font-size: clamp(1.8rem, 5vw, 3.4rem);
  opacity: 0.5;
  animation: float 9s ease-in-out infinite;
  filter: drop-shadow(2px 3px 0 rgba(58, 43, 34, 0.12));
  user-select: none;
}
.doodle.d1 { top: 12%;  left: 6%;  animation-delay: 0s;   }
.doodle.d2 { top: 26%;  right: 8%; animation-delay: 1.1s; }
.doodle.d3 { top: 58%;  left: 4%;  animation-delay: 2.3s; }
.doodle.d4 { top: 72%;  right: 6%; animation-delay: .7s;  }
.doodle.d5 { top: 40%;  left: 48%; animation-delay: 1.8s; }
.doodle.d6 { top: 86%;  left: 30%; animation-delay: 3s;   }

@keyframes float {
  0%,100% { transform: translateY(0) rotate(-6deg); }
  50%     { transform: translateY(-22px) rotate(8deg); }
}

/* ---------- Layout base ---------- */
.wrap { width: min(1080px, 92vw); margin-inline: auto; position: relative; z-index: 1; }

/* ---------- Barra topo ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 244, 226, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: var(--line) solid var(--ink);
}
.topbar-inner {
  width: min(1080px, 92vw);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
}
.brand img { width: 40px; height: 44px; }
.brand .brand-x { color: var(--tomato); }
.nav-chips { margin-left: auto; display: flex; gap: .5rem; }
.chip {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  padding: .5rem .95rem;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform .12s, box-shadow .12s, background .12s;
  white-space: nowrap;
}
.chip:hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--ink); }
.chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.chip.chip-sky { background: var(--sky); }
.chip.chip-grape { background: var(--grape); }

/* ---------- HERO ---------- */
.hero {
  position: relative;
  padding: clamp(2rem, 6vw, 4rem) 0 clamp(2.5rem, 7vw, 4.5rem);
  text-align: center;
}
.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.mascot-stage { position: relative; }
.mascot {
  width: clamp(170px, 40vw, 240px);
  height: auto;
  animation: bob 3.4s ease-in-out infinite;
  filter: drop-shadow(0 12px 0 rgba(58, 43, 34, 0.12));
}
@keyframes bob {
  0%,100% { transform: translateY(0) rotate(-1.5deg); }
  50%     { transform: translateY(-14px) rotate(1.5deg); }
}
.speech {
  position: absolute;
  top: -6px;
  right: -64px;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: 18px;
  padding: .5rem .85rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  box-shadow: var(--shadow);
  transform: rotate(5deg);
  animation: pop 4s ease-in-out infinite;
}
.speech::after {
  content: "";
  position: absolute;
  left: -10px; bottom: 12px;
  width: 18px; height: 18px;
  background: #fff;
  border-left: var(--line) solid var(--ink);
  border-bottom: var(--line) solid var(--ink);
  transform: rotate(45deg);
}
@keyframes pop {
  0%,92%,100% { transform: rotate(5deg) scale(1); }
  96%         { transform: rotate(5deg) scale(1.08); }
}

.hero-eyebrow {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  color: var(--ink-soft);
  margin: 0;
}
.hero h1 {
  font-size: clamp(3rem, 13vw, 6rem);
  font-weight: 700;
  letter-spacing: -1px;
  text-shadow:
    3px 3px 0 #fff,
    6px 6px 0 var(--ink);
  margin: .1em 0;
}
.hero h1 .pop-y { color: var(--sun); }
.hero h1 .pop-b { color: var(--sky); }
.hero h1 .pop-r { color: var(--tomato); }
.hero h1 .pop-g { color: var(--grass); }
.hero h1 .pop-p { color: var(--grape); }

.hero-sub {
  max-width: 30ch;
  margin: .3rem auto 0;
  font-size: clamp(1.05rem, 3.5vw, 1.3rem);
  font-weight: 700;
  color: var(--ink-soft);
}

/* botão gigante "JOGAR" */
.btn-big {
  --c: var(--sun);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-top: 1.4rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.3rem, 4.5vw, 1.7rem);
  text-decoration: none;
  color: var(--ink);
  background: var(--c);
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  padding: .8rem 1.8rem;
  box-shadow: var(--shadow-lg);
  transition: transform .12s, box-shadow .12s;
}
.btn-big:hover { transform: translate(-2px,-2px); box-shadow: 10px 10px 0 var(--ink); }
.btn-big:active { transform: translate(4px,4px); box-shadow: 2px 2px 0 var(--ink); }
.btn-big .play-emoji { animation: wiggle 1.4s ease-in-out infinite; }
@keyframes wiggle {
  0%,100% { transform: rotate(-10deg); }
  50%     { transform: rotate(10deg); }
}

/* ---------- Cabeçalho de seção ---------- */
.section { padding: clamp(2rem, 6vw, 3.5rem) 0; position: relative; }
.section-head {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-bottom: 1.6rem;
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.count-pill {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  padding: .25rem .8rem;
  box-shadow: 0 3px 0 var(--ink);
}
.section-sub {
  margin: 0 0 1.4rem;
  font-weight: 700;
  color: var(--ink-soft);
  font-size: clamp(1rem, 3vw, 1.15rem);
  max-width: 60ch;
}

/* ---------- História ---------- */
.story-card {
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: clamp(1.4rem, 4vw, 2.2rem);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.2rem;
  align-items: start;
}
.story-card .story-ico {
  font-size: clamp(2.5rem, 9vw, 3.6rem);
  line-height: 1;
  background: var(--sun);
  border: var(--line) solid var(--ink);
  border-radius: 20px;
  width: clamp(64px, 16vw, 84px);
  height: clamp(64px, 16vw, 84px);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 0 var(--ink);
  transform: rotate(-5deg);
}
.story-card h2 { font-size: clamp(1.4rem, 5vw, 2rem); margin-bottom: .5rem; }
.story-card p { margin: 0 0 .7rem; font-weight: 600; line-height: 1.5; font-size: clamp(1rem, 3vw, 1.12rem); }
.story-card p:last-child { margin-bottom: 0; }

/* ---------- JOGOS ---------- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.4rem;
}
.game-card {
  --c: var(--sun);
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--ink);
  background: var(--c);
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.4rem 1.4rem 1.6rem;
  overflow: hidden;
  transition: transform .14s, box-shadow .14s;
}
.game-card:nth-child(odd)  { transform: rotate(-1deg); }
.game-card:nth-child(even) { transform: rotate(1deg); }
.game-card:hover {
  transform: translateY(-6px) rotate(0deg);
  box-shadow: 12px 14px 0 var(--ink);
}
.game-card:active { transform: translateY(-1px) rotate(0deg); box-shadow: 5px 6px 0 var(--ink); }

/* "palco" com os personagens do jogo */
.game-stage {
  position: relative;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.18) 0 12px, rgba(255,255,255,0) 12px 24px),
    rgba(255,255,255,.35);
  border: var(--line) solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1rem;
  text-align: center;
  margin-bottom: 1rem;
}
.game-emoji {
  font-size: clamp(3rem, 12vw, 4.2rem);
  line-height: 1;
  filter: drop-shadow(2px 4px 0 rgba(58,43,34,.18));
  transition: transform .2s;
}
.game-card:hover .game-emoji { transform: scale(1.12) rotate(-6deg); }
.game-cast {
  margin-top: .5rem;
  font-size: clamp(1.2rem, 5vw, 1.7rem);
  letter-spacing: .15rem;
}
.game-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .8rem;
  padding: .3rem .7rem;
  border-radius: 999px;
  transform: rotate(4deg);
  box-shadow: 0 3px 0 rgba(0,0,0,.25);
  border: 2px solid #fff;
}
.game-title { font-size: clamp(1.5rem, 5.5vw, 2.1rem); margin-bottom: .25rem; }
.game-desc { font-weight: 700; color: var(--ink); line-height: 1.4; margin: 0 0 1rem; opacity: .85; }
.game-play {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  padding: .55rem 1.3rem;
  box-shadow: 0 4px 0 var(--ink);
}
.game-card:hover .game-play { background: var(--sun); }
.game-play .arrow { transition: transform .2s; }
.game-card:hover .game-play .arrow { transform: translateX(4px); }

/* ---------- ÁLBUM DE HERÓIS ---------- */
.filter-bar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.filter-btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  padding: .5rem 1.2rem;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform .12s, box-shadow .12s, background .12s;
}
.filter-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.filter-btn[aria-pressed="true"] { background: var(--sun); }
.filter-btn.f-heroi[aria-pressed="true"] { background: var(--grass); }
.filter-btn.f-vilao[aria-pressed="true"] { background: var(--grape); }

.heroes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.4rem;
}
.hero-card {
  --frame: var(--grass);
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin: 0;
  display: flex;
  flex-direction: column;
  transition: transform .14s, box-shadow .14s;
}
.hero-card.is-vilao { --frame: var(--grape); }
.hero-card:hover { transform: translateY(-5px) rotate(-1deg); box-shadow: 12px 14px 0 var(--ink); }

.hero-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .4rem;
  padding: .9rem;
  background: var(--frame);
  border-bottom: var(--line) solid var(--ink);
}
.hero-side { position: relative; }
.hero-side img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: var(--line) solid var(--ink);
  border-radius: 14px;
  background: #fff;
  cursor: zoom-in;
  transition: transform .15s;
}
.hero-side img:hover { transform: scale(1.04); }
.side-label {
  position: absolute;
  bottom: 6px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .72rem;
  padding: .15rem .55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.hero-arrow { font-size: 1.6rem; color: var(--ink); animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 0%,100% { transform: translateX(-2px);} 50% { transform: translateX(3px);} }

.hero-info { padding: .9rem 1.1rem 1.2rem; }
.hero-tag {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .82rem;
  color: #fff;
  background: var(--frame);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: .18rem .7rem;
  margin-bottom: .45rem;
}
.hero-name { font-size: 1.35rem; margin-bottom: .25rem; }
.hero-power { margin: 0; font-weight: 700; color: var(--ink-soft); line-height: 1.35; font-size: .98rem; }

/* ---------- Vazio ---------- */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  background: #fff;
  border: var(--line) dashed var(--ink);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
}
.empty-emoji { font-size: 3rem; }
.empty p { font-weight: 700; margin: .4rem 0; }
.empty-hint { color: var(--ink-soft); }

/* ---------- Rodapé ---------- */
.footer {
  margin-top: 2rem;
  text-align: center;
  padding: 2.2rem 1rem 3rem;
  border-top: var(--line) dashed var(--ink);
  position: relative;
  z-index: 1;
}
.footer p { font-weight: 700; color: var(--ink-soft); margin: .3rem 0; }
.footer .heart { color: var(--tomato); }
.footer-mascot { width: 60px; margin: 0 auto .6rem; animation: bob 3.4s ease-in-out infinite; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(58, 43, 34, 0.86);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.lightbox[hidden] { display: none; }
.lightbox-content {
  margin: 0;
  max-width: min(90vw, 640px);
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
}
.lightbox-content img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: var(--line) solid var(--ink);
}
.lightbox-content figcaption {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  margin-top: .8rem;
  font-size: 1.1rem;
}
.lightbox-close {
  position: absolute;
  top: 1.1rem; right: 1.1rem;
  width: 56px; height: 56px;
  font-size: 1.5rem;
  cursor: pointer;
  background: var(--tomato);
  color: #fff;
  border: var(--line) solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 0 rgba(0,0,0,.3);
}
.lightbox-close:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.3); }

/* ---------- Responsivo ---------- */
@media (max-width: 540px) {
  .speech { right: -16px; top: -12px; font-size: .9rem; }
  .story-card { grid-template-columns: 1fr; }
  .story-card .story-ico { margin: 0 auto; }
  .nav-chips .chip { padding: .45rem .75rem; font-size: .92rem; }
  .brand span { font-size: 1.05rem; }
}

/* ---------- Acessibilidade: menos movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
