/* App Família · Mundo de Cada Um · v0.4
 * Layout: uma coluna de até 520 px, botões grandes, cada tela com uma tarefa só.
 * Paleta: a do protótipo em papel e do episódio 1 (sálvia, lavanda #B8AFC4, azul de céu, creme).
 * Tema: "auto" segue o aparelho; "noite" força o escuro suave; "claro" força o claro.
 */
:root {
  --bg: #F6EADA;
  --paper: #FFFDF8;
  --ink: #4A3A30;
  --quiet: #75614F;
  --line: #DCCBB5;
  --accent: #6F8166;          /* sálvia escura: botão principal, passo atual */
  --accent-ink: #FFFDF8;
  --principal: #A8B5A0;
  --soft: #F3EBDD;
  --focus: #8F86A0;
  --muda: #8F86A0;

  /* fundos claros dos cartões e bordas, por cor */
  --t-sage: #E4EADF; --b-sage: #9FAE96;
  --t-lav: #EAE6F0;  --b-lav: #A79EB6;
  --t-blue: #E2ECF1; --b-blue: #9DB6C3;
  --t-creme: #F4EAD9; --b-creme: #CDB89A;

  /* preenchimentos dos pictogramas */
  --tinta-figura: #4A3A30;
  --f-sage: #A8B5A0; --f-lav: #B8AFC4; --f-blue: #B9CCD6; --f-creme: #F1DFC3;
  --f-rosa: #E6B8A8; --f-amarelo: #E8C77E; --f-branco: #FFFDF8; --f-marrom: #9A6B4A;
  --f-agua: #8FB3C6; --f-caramelo: #B5804F; --f-orelha: #5E3722;

  /* Cacau (mesmas cores do episódio 1) */
  --cacau-pelo: #7B4B2F; --cacau-caramelo: #B5804F; --cacau-orelha: #5E3722; --cacau-tinta: #6E5242;

  --raio: 20px;
  --toque: 64px;
  --fonte: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}

/* modo noite: escuro quente, contraste suave, nada de branco puro */
:root[data-tema="noite"] {
  --bg: #221D24; --paper: #2E2731; --ink: #EFE5D8; --quiet: #BDAFA0; --line: #463D4A;
  --accent: #8E9F85; --accent-ink: #1E1A20; --principal: #7E8F75; --soft: #3A3240; --focus: #B8AFC4; --muda: #B8AFC4;
  --t-sage: #313A2F; --b-sage: #6E7F66; --t-lav: #383141; --b-lav: #8A80A0;
  --t-blue: #2C3840; --b-blue: #6F8794; --t-creme: #3D342C; --b-creme: #8E7A62;
  --tinta-figura: #2A2124;
  --f-sage: #9AA892; --f-lav: #ABA2BA; --f-blue: #A9BEC9; --f-creme: #DCCBB0;
  --f-rosa: #D3A797; --f-amarelo: #D4B572; --f-branco: #EAE3D7; --f-marrom: #8C6145; --f-agua: #85A6B8;
  --cacau-tinta: #2A2124;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-tema="auto"] {
    --bg: #221D24; --paper: #2E2731; --ink: #EFE5D8; --quiet: #BDAFA0; --line: #463D4A;
    --accent: #8E9F85; --accent-ink: #1E1A20; --principal: #7E8F75; --soft: #3A3240; --focus: #B8AFC4; --muda: #B8AFC4;
    --t-sage: #313A2F; --b-sage: #6E7F66; --t-lav: #383141; --b-lav: #8A80A0;
    --t-blue: #2C3840; --b-blue: #6F8794; --t-creme: #3D342C; --b-creme: #8E7A62;
    --tinta-figura: #2A2124;
    --f-sage: #9AA892; --f-lav: #ABA2BA; --f-blue: #A9BEC9; --f-creme: #DCCBB0;
    --f-rosa: #D3A797; --f-amarelo: #D4B572; --f-branco: #EAE3D7; --f-marrom: #8C6145; --f-agua: #85A6B8;
    --cacau-tinta: #2A2124;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--fonte);
  font-size: 18px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
body.texto-grande #app { zoom: 1.15; }

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding-block: max(18px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1 { font-size: 28px; margin: 0; line-height: 1.2; text-wrap: balance; font-weight: 800; }
h2 { font-size: 21px; margin: 0; font-weight: 800; }
h3 { font-size: 18px; margin: 0; font-weight: 800; }
p { margin: 0; }
.sub { color: var(--quiet); font-size: 16px; }
.aviso { font-size: 14px; color: var(--quiet); text-align: center; }
.rotulo { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }

/* ---------- botões ---------- */
button {
  font: inherit;
  color: var(--ink);
  min-height: var(--toque);
  border: 2px solid var(--line);
  border-radius: var(--raio);
  background: var(--paper);
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
button:focus-visible, input:focus-visible, video:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
.principal { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.discreto { background: transparent; font-weight: 650; }
.pequeno { min-height: 48px; padding: 8px 14px; font-size: 16px; }
.perigo { border-color: #B58B7A; color: #9A5A48; background: transparent; }
:root[data-tema="noite"] .perigo { color: #E2A896; }

.topo { display: flex; align-items: center; gap: 12px; }
.topo .voltar { min-height: 48px; padding: 8px 14px; font-size: 16px; flex: none; }
.topo h1 { flex: 1; font-size: 24px; min-width: 0; }

.acoes { display: flex; gap: 12px; }
.acoes > * { flex: 1; }
.rodape { margin-top: auto; display: flex; flex-direction: column; gap: 10px; align-items: center; padding-top: 8px; }
.pilha { display: flex; flex-direction: column; gap: 12px; }

/* ---------- figuras e cores ---------- */
.figura {
  display: grid; place-items: center; flex: none;
  border-radius: 16px; border: 2px solid transparent;
  font-weight: 800; color: var(--quiet);
}
.figura .picto { width: 82%; height: 82%; }
.cor-sage { background: var(--t-sage); border-color: var(--b-sage); }
.cor-lav { background: var(--t-lav); border-color: var(--b-lav); }
.cor-blue { background: var(--t-blue); border-color: var(--b-blue); }
.cor-creme { background: var(--t-creme); border-color: var(--b-creme); }

/* ---------- início ---------- */
.saudacao { display: flex; align-items: center; gap: 12px; }
.saudacao .cacau { width: 120px; flex: none; }
.saudacao p { color: var(--quiet); font-size: 16px; }
.grade-inicio { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bloco {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px;
  min-height: 132px; padding: 14px; text-align: left; font-size: 19px; line-height: 1.15;
}
.bloco .figura { width: 56px; height: 56px; border-radius: 14px; }
.bloco small { display: block; font-size: 14px; font-weight: 600; color: var(--quiet); margin-top: 2px; }
.bloco.largo { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-start; gap: 16px; min-height: 92px; }

/* ---------- listas ---------- */
.lista { display: flex; flex-direction: column; gap: 12px; }
.item-lista { display: flex; gap: 10px; align-items: stretch; }
.item-lista .abrir { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; text-align: left; font-size: 20px; min-height: 84px; }
.item-lista .abrir .figura { width: 52px; height: 52px; }
.item-lista .abrir small { display: block; font-size: 14px; font-weight: 600; color: var(--quiet); }
.item-lista .editar { flex: none; background: transparent; font-size: 15px; padding: 8px 12px; }

/* ---------- rotina: primeiro / depois ---------- */
.agora {
  background: var(--paper); border: 3px solid var(--accent); border-radius: 28px;
  padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
}
.agora .figura { width: min(58vw, 210px); height: min(58vw, 210px); border-radius: 28px; font-size: 48px; }
.agora .texto { font-size: 30px; font-weight: 800; line-height: 1.15; }
.depois { display: flex; align-items: center; gap: 14px; background: var(--paper); border: 2px dashed var(--line); border-radius: var(--raio); padding: 12px 14px; }
.depois .figura { width: 64px; height: 64px; }
.depois .texto { font-size: 20px; font-weight: 700; }
.depois .rotulo { color: var(--quiet); }
.feito { min-height: 80px; font-size: 24px; }

.passos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.passos li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 2px solid var(--line); border-radius: 16px; background: var(--paper); font-size: 17px; }
.passos li .figura { width: 44px; height: 44px; border-radius: 12px; font-size: 14px; }
.passos li.atual { border-color: var(--accent); font-weight: 800; }
.passos li.passou { opacity: .45; }
.marca { margin-left: auto; font-size: 13px; font-weight: 800; color: var(--quiet); }

/* ---------- telas de pausa e de fim ---------- */
.tela-calma { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 20px; text-align: center; }
.tela-calma .circulo { width: 150px; height: 150px; border-radius: 50%; background: var(--t-lav); border: 3px solid var(--b-lav); display: grid; place-items: center; }
.tela-calma .circulo.sage { background: var(--t-sage); border-color: var(--b-sage); }
.tela-calma .circulo .picto { width: 70%; height: 70%; }
.tela-calma h1 { font-size: 30px; }
.tela-calma .acoes { width: 100%; flex-direction: column; }

/* ---------- agenda do dia ---------- */
.dia { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

.agenda { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.agenda li { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border: 2px solid var(--line); border-radius: var(--raio); background: var(--paper); }
.agenda li .figura { width: 60px; height: 60px; }
.agenda li .hora { font-size: 14px; font-weight: 800; color: var(--quiet); font-variant-numeric: tabular-nums; }
.agenda li .texto { font-size: 20px; font-weight: 750; line-height: 1.2; }
.agenda li .corpo { flex: 1; min-width: 0; }
.agenda li.atual { border: 3px solid var(--accent); }
.agenda li.passou { opacity: .45; }
.agenda li.muda { border: 3px dashed var(--muda); background: var(--t-lav); }
.agenda li .antes { font-size: 14px; color: var(--quiet); }
.agenda li .tag-muda { display: inline-block; font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--muda); }
.agenda li button { min-height: 52px; font-size: 16px; padding: 8px 14px; flex: none; }

/* ---------- cartões ---------- */
.abas { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.abas::-webkit-scrollbar { display: none; }
.abas .aba { flex: none; min-height: 48px; padding: 8px 16px; font-size: 16px; border-radius: 999px; }
.abas .aba[aria-pressed="true"] { background: var(--t-lav); border-color: var(--b-lav); }
.grade-cartoes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cartao {
  min-height: 150px; border-radius: 24px; border-width: 2px;
  font-size: 21px; font-weight: 800; line-height: 1.15; padding: 12px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.cartao .picto { width: 76px; height: 76px; }

body.modo-cartao #app { padding: 0; max-width: none; }
.cartao-cheio {
  flex: 1; width: 100%; min-height: 100vh; min-height: 100dvh; border: 0; border-radius: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 24px;
}
.cartao-cheio .picto { width: min(60vw, 260px); height: min(60vw, 260px); }
.cartao-cheio .palavra { font-size: clamp(44px, 14vw, 88px); font-weight: 900; line-height: 1.05; text-align: center; overflow-wrap: anywhere; }
.cartao-cheio .dica { font-size: 15px; font-weight: 600; color: var(--quiet); }

/* ---------- termômetro ---------- */
.termometro { display: flex; flex-direction: column-reverse; gap: 8px; }
.nivel {
  display: flex; align-items: center; gap: 14px; text-align: left;
  min-height: 72px; padding: 10px 14px; font-size: 20px;
}
.nivel .barra { height: 22px; border-radius: 11px; background: var(--b-lav); flex: none; }
.nivel .num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; background: var(--soft); flex: none; }
.nivel[data-n="1"] .barra { width: 18px; background: var(--b-sage); }
.nivel[data-n="2"] .barra { width: 34px; background: var(--b-sage); }
.nivel[data-n="3"] .barra { width: 50px; background: var(--b-blue); }
.nivel[data-n="4"] .barra { width: 66px; background: var(--b-lav); }
.nivel[data-n="5"] .barra { width: 82px; background: var(--focus); }
.nivel .barra-caixa { width: 86px; flex: none; }

/* ---------- cantinho da calma ---------- */
.respirar { flex: 1; min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; }
.palco { position: relative; width: min(84vw, 380px); aspect-ratio: 1; max-width: 100%; display: grid; place-items: center; }
.palco .bolha { position: absolute; inset: 6%; border-radius: 50%; background: var(--t-lav); border: 3px solid var(--b-lav); transform: scale(.62); }
.palco .cacau { position: relative; width: 82%; margin-top: 18%; }
.cacau-respira { transform-box: fill-box; transform-origin: 50% 100%; }
.cacau-cabeca { transform-box: view-box; }
.fala { font-size: 28px; font-weight: 800; text-align: center; min-height: 1.4em; }
@keyframes respirar { 0%, 100% { transform: scale(.62); } 50% { transform: scale(1); } }
@keyframes respirar-suave { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes barriga { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.09); } }
@keyframes cabeca { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-.35px); } }
.respirar.rodando .bolha { animation: respirar calc(var(--fase) * 2) ease-in-out infinite; }
.respirar.rodando .cacau-respira { animation: barriga calc(var(--fase) * 2) ease-in-out infinite; }
.respirar.rodando .cacau-cabeca { animation: cabeca calc(var(--fase) * 2) ease-in-out infinite; }

/* ---------- timer ---------- */
.grade-minutos { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.grade-minutos button { min-height: 80px; font-size: 22px; }
.disco-caixa { display: grid; place-items: center; padding: 8px 0; }
.disco { width: min(78vw, 320px); height: auto; max-width: 100%; }
.disco-fundo { fill: var(--paper); stroke: var(--line); stroke-width: 1.5; }
.disco-tempo { fill: none; stroke: var(--principal); stroke-width: 48; transition: stroke-dasharray .5s linear; }
.restante { font-size: 26px; font-weight: 800; text-align: center; }

/* ---------- histórias ---------- */
.historia-card { display: flex; gap: 14px; align-items: center; text-align: left; padding: 10px; }
.historia-card img { width: 84px; height: 150px; object-fit: cover; border-radius: 14px; flex: none; }
.historia-card .corpo { min-width: 0; }
.historia-card small { display: block; color: var(--quiet); font-size: 14px; font-weight: 600; margin-top: 4px; }
.video-caixa { display: grid; place-items: center; background: #1E1A20; border-radius: 22px; overflow: hidden; }
.video-caixa video { width: 100%; max-height: 70vh; display: block; background: #1E1A20; }
.texto-adulto { display: flex; flex-direction: column; gap: 12px; background: var(--paper); border: 2px solid var(--line); border-radius: var(--raio); padding: 16px; font-size: 17px; }
.texto-adulto ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.selo { font-size: 13px; color: var(--quiet); border-top: 2px dashed var(--line); padding-top: 10px; }
.som { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--paper); border: 2px solid var(--line); border-radius: var(--raio); }
.som h3 { font-size: 18px; }
.som .opcoes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.som .opcoes button { min-height: 52px; font-size: 15px; padding: 6px; }
.som .opcoes button[aria-pressed="true"][data-v="gosto"] { background: var(--t-sage); border-color: var(--b-sage); }
.som .opcoes button[aria-pressed="true"][data-v="tantofaz"] { background: var(--t-blue); border-color: var(--b-blue); }
.som .opcoes button[aria-pressed="true"][data-v="incomoda"] { background: var(--t-lav); border-color: var(--b-lav); }

/* ---------- área do adulto ---------- */
.nota-adulto { font-size: 15px; color: var(--quiet); background: var(--soft); border-radius: 14px; padding: 12px 14px; }
.secao { display: flex; flex-direction: column; gap: 10px; }
.secao > h2 { font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: var(--quiet); }
.opcao { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--paper); border: 2px solid var(--line); border-radius: var(--raio); padding: 12px 14px; }
.opcao > div { min-width: 0; }
.opcao b { display: block; }
.interruptor { flex: none; min-width: 112px; min-height: 52px; }
.interruptor[aria-checked="true"] { background: var(--t-sage); border-color: var(--b-sage); }
.segmentos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.segmentos button { min-height: 52px; font-size: 15px; padding: 6px; }
.segmentos button[aria-pressed="true"] { background: var(--t-lav); border-color: var(--b-lav); }

/* trava: segurar para entrar */
.segurar { position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.segurar .enche { position: absolute; inset: 0; width: 0; background: var(--t-lav); }
.segurar.segurando .enche { width: 100%; transition: width 1.6s linear; }
.segurar .txt { position: relative; }

/* ---------- editor ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label { font-size: 15px; font-weight: 800; color: var(--quiet); }
input[type="text"], input[type="time"] {
  font: inherit; color: var(--ink); min-height: 52px; padding: 10px 14px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--paper); width: 100%; min-width: 0;
}
.passo-edit { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 2px solid var(--line); border-radius: var(--raio); background: var(--paper); }
.passo-edit .linha { display: flex; gap: 10px; align-items: center; }
.passo-edit .linha .figura { width: 52px; height: 52px; padding: 0; min-height: 0; }
.passo-edit .ferramentas { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.passo-edit .ferramentas button { min-height: 44px; padding: 6px 12px; font-size: 15px; background: transparent; }
.cores { display: flex; gap: 8px; margin-right: auto; }
.passo-edit .cores button { width: 44px; padding: 0; border-radius: 12px; }
.passo-edit .cores .cor-sage { background: var(--t-sage); } .passo-edit .cores .cor-lav { background: var(--t-lav); }
.passo-edit .cores .cor-blue { background: var(--t-blue); } .passo-edit .cores .cor-creme { background: var(--t-creme); }
.cores button[aria-pressed="true"] { border-width: 3px; border-color: var(--ink); }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; padding: 8px; background: var(--soft); border-radius: 14px; }
.galeria button { min-height: 64px; padding: 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; border-radius: 12px; }
.galeria button .picto { width: 36px; height: 36px; }
.galeria button[aria-pressed="true"] { border-color: var(--ink); border-width: 3px; }
.extra { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; min-height: 44px; }
.check input { width: 26px; height: 26px; accent-color: var(--muda); }

/* ---------- boas-vindas ---------- */
.boas { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px; }
.boas .ilustra { display: grid; place-items: center; min-height: 180px; }
.boas .ilustra .cacau { width: min(80vw, 320px); }
.boas .ilustra .picto { width: 140px; height: 140px; }
.boas h1 { font-size: 30px; }
.boas p { font-size: 18px; color: var(--quiet); max-width: 34ch; }
.pontos { display: flex; gap: 8px; justify-content: center; }
.pontos span { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.pontos span.on { background: var(--accent); }

/* ---------- impressão dos cartões ---------- */
.folha-impressao { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.cartao-papel { aspect-ratio: 1; max-width: 100%; border: 2px dashed var(--ink); border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 8px; font-size: 22px; font-weight: 800; }
.cartao-papel .picto { width: 60%; height: auto; }
.rodape-impressao { font-size: 12px; color: var(--quiet); }
body:not(.modo-impressao) .rodape-impressao { display: none; }

/* ---------- menos movimento ---------- */
@media (prefers-reduced-motion: no-preference) {
  body:not(.menos-movimento) .passos li, body:not(.menos-movimento) .agenda li { transition: opacity .2s ease, border-color .2s ease; }
}
@media (prefers-reduced-motion: reduce) {
  .respirar.rodando .bolha { animation-name: respirar-suave; transform: none; }
  .respirar.rodando .cacau-respira, .respirar.rodando .cacau-cabeca { animation: none; }
  .disco-tempo, .segurar.segurando .enche { transition: none; }
}
body.menos-movimento .respirar.rodando .bolha { animation-name: respirar-suave; transform: none; }
body.menos-movimento .respirar.rodando .cacau-respira, body.menos-movimento .respirar.rodando .cacau-cabeca { animation: none; }
body.menos-movimento .disco-tempo { transition: none; }

@media print {
  @page { size: A4; margin: 12mm; }
  :root { --ink: #4A3A30; --paper: #fff; }
  body { background: #fff; color: #4A3A30; }
  #app { max-width: none; padding: 0; }
  .so-tela { display: none !important; }
  .folha-impressao { grid-template-columns: repeat(2, 80mm); gap: 6mm; justify-content: center; }
  .cartao-papel { width: 80mm; height: 80mm; aspect-ratio: auto; font-size: 26pt; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- ilustrações do episódio 1 ---------- */
.cena { display: block; width: 100%; height: auto; max-width: 100%; border-radius: 22px; background: var(--soft); }
.cena.redonda { width: min(60vw, 230px); aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 4px solid var(--b-lav); }
.boas .ilustra .cena { width: min(84vw, 340px); aspect-ratio: 1; object-fit: cover; border-radius: 28px; }
.heroi { position: relative; padding: 0; border: 0; border-radius: 24px; overflow: hidden; min-height: 0; background: var(--soft); }
.heroi .cena { aspect-ratio: 4 / 3; height: auto; object-fit: cover; object-position: 50% 55%; border-radius: 0; }
.heroi-txt { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: var(--paper); border-radius: 14px; padding: 8px 12px; font-size: 18px; font-weight: 800; text-align: left; }
.faixa { display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; background: var(--paper); border: 2px solid var(--line); }
.faixa .cena { height: 128px; object-fit: cover; object-position: 50% 25%; border-radius: 0; }
.faixa.alta .cena { height: 240px; object-position: 50% 40%; }
.faixa p { padding: 10px 14px; font-size: 16px; font-weight: 700; color: var(--quiet); }
.num-grande { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--t-lav); border: 2px solid var(--b-lav); font-size: 24px; vertical-align: middle; }

/* ---------- toque na Cacau ---------- */
.cacau-botao { background: transparent; border: 0; padding: 0; min-height: 0; width: 82%; position: relative; margin-top: 18%; border-radius: 30px; }
.cacau-botao .cacau, .palco .cacau-botao .cacau { width: 100%; margin: 0; }
.cacau-botao.canto { width: 60%; margin: 4px auto 0; display: block; }
.cacau-rabo { transform-box: fill-box; transform-origin: 100% 100%; }
.cacau-orelha { transform-box: fill-box; transform-origin: 50% 0%; }
@keyframes rabo { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(10deg); } }
@keyframes orelha { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-18deg); } }
.abana .cacau-rabo { animation: rabo .32s ease-in-out 4; }
.abana .cacau-orelha { animation: orelha 1.2s ease-in-out 1; }

/* ---------- toques mais vivos (sem exagero) ---------- */
@media (prefers-reduced-motion: no-preference) {
  body:not(.menos-movimento) .cartao, body:not(.menos-movimento) .bloco, body:not(.menos-movimento) .heroi { transition: transform .12s ease; }
  body:not(.menos-movimento) .cartao:active, body:not(.menos-movimento) .bloco:active, body:not(.menos-movimento) .heroi:active { transform: scale(.97); }
  body:not(.menos-movimento) .agora { transition: transform .25s ease, opacity .25s ease; }
  body:not(.menos-movimento) .agora.saindo { transform: translateX(-24px); opacity: 0; }
  body:not(.menos-movimento) .agora .figura { animation: chega .3s ease-out; }
  body:not(.menos-movimento) .cartao-cheio .picto { animation: chega .3s ease-out; }
}
@keyframes chega { from { transform: scale(.9); opacity: .4; } to { transform: scale(1); opacity: 1; } }
body.menos-movimento .abana .cacau-rabo, body.menos-movimento .abana .cacau-orelha { animation: none; }
@media (prefers-reduced-motion: reduce) { .abana .cacau-rabo, .abana .cacau-orelha { animation: none; } }

/* ---------- figuras da Luna ---------- */
img.luna { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; user-select: none; -webkit-user-drag: none; }
.figura.com-luna { overflow: hidden; padding: 0; }
.figura.com-luna img.luna { border-radius: calc(16px - 2px); }
.agora .figura.com-luna img.luna { border-radius: 26px; }
.bloco .figura { width: 76px; height: 76px; border-radius: 18px; }
.bloco.largo .figura { width: 68px; height: 68px; }
.cartao img.luna { width: 108px; height: 108px; border-radius: 50%; flex: none; }
.cartao { min-height: 176px; }
.cartao-cheio img.luna { width: min(72vw, 320px); height: min(72vw, 320px); border-radius: 50%; border: 4px solid rgba(74,58,48,.2); }
.cartao-papel img.luna { width: 70%; height: auto; aspect-ratio: 1; border-radius: 50%; }
.galeria button img.luna { width: 44px; height: 44px; border-radius: 50%; }
.tela-calma .circulo.com-luna { overflow: hidden; padding: 0; }
.tela-calma .circulo.com-luna img.luna { border-radius: 50%; }
:root[data-tema="noite"] img.luna, :root[data-tema="noite"] .cena { filter: brightness(.86) saturate(.9); }
@media (prefers-color-scheme: dark) { :root[data-tema="auto"] img.luna, :root[data-tema="auto"] .cena { filter: brightness(.86) saturate(.9); } }

/* ---------- quadrinhos ---------- */
.quadro { margin: 0; display: flex; flex-direction: column; background: var(--paper); border: 3px solid var(--ink); border-radius: 10px; overflow: hidden; }
.quadro img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-bottom: 3px solid var(--ink); }
.quadro figcaption { padding: 12px 14px; font-size: 20px; font-weight: 750; line-height: 1.3; background: #FFF6DC; color: #4A3A30; min-height: 3.2em; }
.quadro.grande { touch-action: pan-y; user-select: none; }
.quadro.grande img { max-height: 58vh; object-fit: cover; }
.pagina-hq { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pagina-hq .quadro figcaption { font-size: 14px; padding: 8px 10px; min-height: 0; }
.pagina-hq .quadro { border-width: 2px; }
.pagina-hq .quadro img { border-bottom-width: 2px; }
.num-q { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #4A3A30; color: #FFF6DC; font-size: 12px; margin-right: 6px; vertical-align: 1px; }
.historia-card img.capa-hq { height: 105px; border: 2px solid var(--ink); border-radius: 8px; }

/* ---------- jogo da memória ---------- */
.grade-memo { display: grid; grid-template-columns: repeat(var(--colunas, 3), 1fr); gap: 10px; }
.memo { position: relative; aspect-ratio: 1; min-height: 0; padding: 0; border: 0; background: transparent; perspective: 600px; }
.memo .verso, .memo .frente { position: absolute; inset: 0; border-radius: 18px; border: 2px solid var(--line); backface-visibility: hidden; display: grid; place-items: center; overflow: hidden; }
.memo .verso { background-image: radial-gradient(circle at 30% 30%, rgba(255,255,255,.5) 0 10%, transparent 11%), radial-gradient(circle at 70% 70%, rgba(255,255,255,.5) 0 10%, transparent 11%); }
.memo .frente { background: var(--paper); transform: rotateY(180deg); }
.memo .frente img.luna { border-radius: 16px; }
.memo .frente .picto { width: 80%; height: 80%; }
.memo .verso, .memo .frente { transition: transform .35s ease; }
.memo.virada .verso { transform: rotateY(180deg); }
.memo.virada .frente { transform: rotateY(0); }
.memo.achada .frente { border-color: var(--b-sage); border-width: 3px; }
.memo:disabled { opacity: 1; }
body.menos-movimento .memo .verso, body.menos-movimento .memo .frente { transition: none; }
@media (prefers-reduced-motion: reduce) { .memo .verso, .memo .frente { transition: none; } }

/* ---------- em ordem ---------- */
.trilha { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.trilha li { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 10px; border: 2px dashed var(--line); border-radius: 16px; font-size: 18px; font-weight: 700; }
.trilha li.cheia { border-style: solid; border-color: var(--b-sage); background: var(--paper); }
.trilha li.proxima { border-color: var(--accent); }
.trilha li .figura { width: 48px; height: 48px; }
.trilha .vaga { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--quiet); }
.monte { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.peca { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; font-size: 16px; }
.peca .figura { width: 84px; height: 84px; }
.peca.dica { border-color: var(--accent); border-width: 3px; }
@media (prefers-reduced-motion: no-preference) {
  body:not(.menos-movimento) .peca.espera { animation: espera .4s ease; }
}
@keyframes espera { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-4px); } 70% { transform: translateX(4px); } }

/* ---------- cantinho ---------- */
.cartao.escolha[aria-pressed="true"] { border-width: 3px; }
.cartao.escolha[aria-pressed="true"]::after { content: "✓"; position: absolute; top: 8px; right: 12px; font-size: 22px; font-weight: 900; color: var(--accent); }
.cartao.escolha { position: relative; }

/* nada mais largo que a tela: colunas que encolhem de verdade */
.grade-memo { grid-template-columns: repeat(var(--colunas, 3), minmax(0, 1fr)); }
.memo { min-width: 0; width: 100%; }
.memo img.luna { max-width: 100%; }
.pagina-hq, .grade-cartoes, .monte, .grade-inicio { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade-minutos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
