/* KidFun — estilos base (mobile-first) */
:root {
  --purple: #7C5CFC;
  --purple-dark: #5b3fd6;
  --pink: #F72585;
  --teal: #00B8A9;
  --yellow: #FFB703;
  --red: #FF6B6B;
  --blue: #3A86FF;
  --ink: #2A2350;
  --muted: #7A749C;
  --bg: #F4F1FF;
  --card: #FFFFFF;
  --ring: rgba(124, 92, 252, .35);
  --shadow: 0 10px 30px rgba(60, 40, 140, .12);
  --radius: 22px;
  --font-head: 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: radial-gradient(1200px 600px at 50% -10%, #EAE3FF 0%, var(--bg) 55%);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, .brand { font-family: var(--font-head); font-weight: 800; margin: 0; }
a { color: var(--purple-dark); }

/* Layout */
.wrap { width: 100%; max-width: 480px; margin: 0 auto; padding: 20px 16px 40px; }
.wrap-wide { max-width: 900px; }
.center-screen { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.text-center { text-align: center; }

/* Marca */
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 28px; color: var(--purple-dark); }
.brand .dot { color: var(--pink); }

/* Logo (PNG com fundo transparente) */
.logo { display: block; height: auto; margin: 0 auto; }
.logo-lg { width: min(200px, 52vw); }
.logo-md { width: min(150px, 42vw); }
.logo-sm { width: 46px; }   /* no cabeçalho o logo vira ícone e o nome vem em texto ao lado */

/* Cartões */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* Botões */
.btn {
  font-family: var(--font-head); font-weight: 700; font-size: 17px;
  border: none; border-radius: 999px; padding: 14px 22px;
  background: var(--purple); color: #fff; cursor: pointer;
  transition: transform .08s ease, filter .15s ease, box-shadow .15s ease;
  box-shadow: 0 8px 18px var(--ring);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px;
}
.btn:active { transform: translateY(2px) scale(.99); }
.btn:hover { filter: brightness(1.05); }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--purple-dark); box-shadow: inset 0 0 0 2px var(--ring); }
.btn.soft { background: #EFEAFF; color: var(--purple-dark); box-shadow: none; }
.btn.pink { background: var(--pink); box-shadow: 0 8px 18px rgba(247,37,133,.3); }
.btn.small { font-size: 14px; padding: 8px 14px; min-height: 40px; }
.btn.danger { background: #fff; color: var(--red); box-shadow: inset 0 0 0 2px rgba(255,107,107,.4); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Campos */
label.field { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; color: var(--ink); }
.input {
  width: 100%; font-family: var(--font-body); font-size: 16px; font-weight: 600;
  padding: 14px 16px; border-radius: 16px; border: 2px solid #E7E1FF; background: #FBFAFF;
  color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--purple); box-shadow: 0 0 0 4px var(--ring); }

/* Campo de senha com botão mostrar/esconder */
.senha-wrap { position: relative; }
.senha-wrap .input { padding-right: 56px; }
.ver-senha {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: #6B6585;
}
.ver-senha:hover { color: var(--ink); }
.ver-senha:hover, .ver-senha:focus-visible { background: #EFEAFF; outline: none; }

/* Login social e "manter conectado" */
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-weight: 700; font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 2px; background: #EFEAFF; border-radius: 2px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 700; font-size: 14px; }
.check input { width: 22px; height: 22px; accent-color: var(--purple); cursor: pointer; flex: none; }
.social { display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 44px; }

/* Abas */
.tabs { display: flex; background: #EFEAFF; border-radius: 999px; padding: 5px; margin-bottom: 18px; }
.tabs button {
  flex: 1; border: none; background: transparent; font-family: var(--font-head); font-weight: 700;
  font-size: 15px; padding: 10px; border-radius: 999px; color: var(--muted); cursor: pointer;
}
.tabs button.active { background: #fff; color: var(--purple-dark); box-shadow: 0 4px 10px rgba(124,92,252,.18); }

/* Grade de avatares (seleção de perfil) */
.avatars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.avatar-pick { border: none; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.avatar-face {
  width: 100%; aspect-ratio: 1; border-radius: 26px; display: grid; place-items: center;
  font-size: clamp(40px, 14vw, 64px); background: #fff; box-shadow: var(--shadow);
  border: 4px solid transparent; transition: transform .1s, border-color .1s;
}
.avatar-pick:active .avatar-face { transform: scale(.95); }
.avatar-pick.selected .avatar-face,
.avatar-pick:hover .avatar-face { border-color: var(--purple); }
.avatar-name { font-family: var(--font-head); font-weight: 700; font-size: 15px; }
.avatar-add .avatar-face { background: #EFEAFF; color: var(--purple-dark); }

/* Grade de jogos */
.games { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (min-width: 640px) { .games { grid-template-columns: repeat(3, 1fr); } }
.game {
  position: relative; border: none; cursor: pointer; text-align: left;
  border-radius: 24px; padding: 18px; color: #fff; min-height: 148px;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: var(--shadow); transition: transform .1s;
  font-family: var(--font-body);
}
.game:active { transform: scale(.97); }
.game .emoji { font-size: 46px; line-height: 1; filter: drop-shadow(0 4px 6px rgba(0,0,0,.15)); }
.game .title { font-family: var(--font-head); font-weight: 800; font-size: 18px; }
.game .cat { font-size: 12px; font-weight: 700; opacity: .85; }
.game.locked { filter: grayscale(.35); opacity: .8; cursor: default; }
.badge-soon {
  position: absolute; top: 12px; right: 12px; background: rgba(0,0,0,.28);
  font-family: var(--font-head); font-weight: 700; font-size: 11px; padding: 4px 10px; border-radius: 999px;
}

/* Modal */
.overlay {
  position: fixed; inset: 0; background: rgba(30, 20, 70, .5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 18px; z-index: 50; animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
/* Janela maior que a tela (ex.: cadastro com muitos avatares) rola por dentro */
.modal { width: 100%; max-width: 420px; max-height: calc(100dvh - 36px); overflow-y: auto; overscroll-behavior: contain; }

/* PIN pad */
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 14px 0 20px; }
.pin-dot { width: 18px; height: 18px; border-radius: 50%; background: #E7E1FF; transition: background .1s; }
.pin-dot.on { background: var(--purple); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.key {
  font-family: var(--font-head); font-weight: 700; font-size: 24px; padding: 16px;
  border-radius: 18px; border: none; background: #F3EFFF; color: var(--ink); cursor: pointer; min-height: 60px;
}
.key:active { background: #E4DBFF; }
.key.wide { grid-column: span 1; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 100; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); }

/* Splash */
.splash { text-align: center; }
.splash .brand { font-size: 40px; animation: bob 1.6s ease-in-out infinite; }
.splash .logo { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }

/* Cabeçalho de página */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.pill { background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; box-shadow: var(--shadow); }

/* --- Base compartilhada dos jogos --- */
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.stat {
  background: #fff; border-radius: 16px; padding: 8px 14px; white-space: nowrap;
  font-family: var(--font-head); font-weight: 700; box-shadow: var(--shadow);
}
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.level-btn {
  border: 4px solid transparent; cursor: pointer; background: #F3EFFF; border-radius: 22px;
  padding: 16px 6px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .1s, border-color .1s;
}
.level-btn:hover { border-color: var(--purple); }
.level-btn:active { transform: scale(.96); }
.level-btn .big { font-size: clamp(30px, 9vw, 42px); line-height: 1; }
.level-btn .lbl { font-family: var(--font-head); font-weight: 800; }
.level-btn .sub { font-size: 12px; color: var(--muted); font-weight: 700; line-height: 1.25; }
.hearts { font-size: 20px; letter-spacing: 3px; }
.hearts .off { filter: grayscale(1); opacity: .3; }
.stars { font-size: 38px; letter-spacing: 4px; }

@keyframes kf-shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-5px); } }
@keyframes kf-pop { 40% { transform: scale(1.1); } }
.anim-shake { animation: kf-shake .4s; }
.anim-pop { animation: kf-pop .35s; }

.sfx-toggle {
  position: fixed; left: 14px; bottom: 14px; z-index: 70;
  width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  background: #fff; box-shadow: var(--shadow); font-size: 20px; line-height: 1;
}
.sfx-toggle:active { transform: scale(.94); }

/* Lista de histórico */
.event { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #EFEAFF; }
.event:last-child { border-bottom: none; }
.event .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: #F3EFFF; font-size: 20px; }
.event .when { margin-left: auto; font-size: 12px; color: var(--muted); }
