/* Visual da ferramenta Desenhos Bíblicos para Colorir (classes começam com cb-)
   Sem animações contínuas: só efeitos curtos quando a criança toca. */

:root { --cb-fonte: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Arial Rounded MT Bold", var(--fonte); --cb-tinta: #3a2a22; --cb-papel: #fffaf0; }

/* ---------- Desenho (linhas e áreas) ---------- */
.cb-svg { display: block; width: 100%; height: 100%; background: #fff; }
.cb-svg .pt:not([stroke]) { stroke: var(--cb-tinta); stroke-width: 1.5; }
.cb-svg .pt, .cb-svg .pt-grupo, .cb-svg .pt-traco { transition: fill .12s, stroke .12s; }
.cb-nums { pointer-events: none; }
.cb-nums text { font-family: var(--cb-fonte); font-weight: 800; fill: #6f6257; text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: #fff; stroke-width: .9px; }
.cb-marca { fill: #fff0b8 !important; }
.cb-marca circle { fill: #fff0b8 !important; }
.pt-traco.cb-marca { fill: none !important; stroke: #fff0b8 !important; }
.cb-vendo { filter: saturate(1.05); }
.cb-efeito { pointer-events: none; }
.cb-onda { fill: none; stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: cb-onda .42s ease-out forwards; }
@keyframes cb-onda { from { opacity: .9; transform: scale(.3); } to { opacity: 0; transform: scale(2.2); } }
.cb-pop { animation: cb-pop .3s cubic-bezier(.3, 1.6, .5, 1); transform-box: fill-box; transform-origin: center; }
@keyframes cb-pop { from { opacity: 0; scale: .3; } }

/* ---------- Topo da página ---------- */
.cb-selo { display: inline-flex; align-items: center; gap: .35rem; margin: .6rem 0 0; padding: .28rem .8rem; border-radius: 999px; background: var(--dourado-suave); color: var(--dourado); font-size: .76rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.cb-ref-topo { display: inline-block; font-weight: 650; margin-left: .2rem; }
.cb-sec-cab { display: flex; align-items: center; justify-content: space-between; gap: .6rem 1rem; flex-wrap: wrap; margin: 2.2rem 0 .9rem; }
.cb-sec-cab h2 { margin: 0; }
.cb-sec-sub { font-size: .85rem; color: var(--texto-2); }
.cb-h2-p { font-size: 1.15rem; margin: 0 0 .6rem; }

/* Miniatura (desenho pequeno) */
.cb-mini { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 14px; background: #fff; box-shadow: 0 0 0 3px var(--cb-tinta); }
.cb-mini > img, .cb-mini > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cb-mini-emoji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 3rem; }

/* ---------- Desenho do dia ---------- */
.cb-dia {
  display: grid; gap: 1.1rem; align-items: center; margin: 1.4rem 0 .4rem; padding: 1.2rem; border-radius: 22px; color: #fff;
  background: linear-gradient(135deg, #f2994a 0%, #e0607a 55%, #8a4fc9 100%); box-shadow: var(--sombra);
}
.cb-dia h2 { margin: .1rem 0 .4rem; color: #fff; font-family: var(--cb-fonte); font-size: clamp(1.45rem, 5vw, 1.9rem); }
.cb-dia p { margin: 0 0 .8rem; font-size: 1rem; line-height: 1.5; }
.cb-dia-rot { font-size: .76rem !important; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .9; }
.cb-dia-bts { display: flex; flex-wrap: wrap; gap: .5rem; }
.cb-bt-pintar { background: #fff; color: #a3365a; font-weight: 800; }
.cb-dia .cb-bt-pintar:hover { filter: brightness(.97); }
.cb-sequencia { margin: .8rem 0 0 !important; font-weight: 800; }
.cb-dia-mini { position: relative; display: block; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 16px; }
.cb-dia-mini .cb-mini { box-shadow: 0 0 0 4px #fff, 0 12px 28px rgba(0, 0, 0, .25); }
.cb-dia-pincel { position: absolute; right: -6px; bottom: -8px; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: #fff; font-size: 1.6rem; box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
@media (min-width: 760px) { .cb-dia { grid-template-columns: 1fr 1.05fr; padding: 1.6rem 1.8rem; } }

/* ---------- Galeria ---------- */
.cb-galeria { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem; }
@media (min-width: 640px) { .cb-galeria { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .cb-galeria { grid-template-columns: repeat(4, 1fr); } }
.cb-cartao { display: flex; flex-direction: column; gap: .5rem; padding: .55rem; border-radius: 18px; background: var(--superficie); border: 1px solid var(--borda); color: var(--texto); text-decoration: none; box-shadow: var(--sombra); transition: transform .15s; }
.cb-cartao:hover { transform: translateY(-2px); }
.cb-cartao[hidden] { display: none; }
.cb-cartao[aria-current="page"] { outline: 3px solid var(--dourado); }
.cb-cartao-txt { display: flex; flex-direction: column; gap: .1rem; padding: 0 .2rem .1rem; }
.cb-cartao-txt strong { font-family: var(--cb-fonte); font-size: 1rem; line-height: 1.25; }
.cb-cartao-txt small { font-size: .74rem; color: var(--texto-2); }
.cb-estrelas { font-size: .85rem; letter-spacing: .05em; }
.cb-estrelas .apagada, .cb-fim-est .apagada { filter: grayscale(1); opacity: .3; }
.cb-ouro .cb-mini { box-shadow: 0 0 0 3px #d9a441, 0 0 0 6px #fff3c4; }

/* ---------- Ateliê ---------- */
.cb-numeros-at { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.cb-numeros-at div { display: flex; flex-direction: column; align-items: center; padding: .8rem .4rem; border-radius: 16px; background: var(--superficie); border: 1px solid var(--borda); text-align: center; }
.cb-numeros-at strong { font: 800 1.7rem/1.1 var(--cb-fonte); color: var(--primaria); }
.cb-numeros-at span { font-size: .78rem; color: var(--texto-2); }
.cb-barra { height: 12px; margin: .9rem 0; border-radius: 99px; background: var(--superficie-2); overflow: hidden; }
.cb-barra i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #f6d14a, #f28c38, #e0607a); transition: width .6s; }
.cb-medalhas { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; list-style: none; margin: 0; padding: 0; }
@media (min-width: 640px) { .cb-medalhas { grid-template-columns: repeat(4, 1fr); } }
.cb-medalhas li { display: grid; grid-template-columns: auto 1fr; column-gap: .55rem; align-items: center; padding: .65rem .7rem; border-radius: 14px; border: 1.5px dashed var(--borda); background: var(--superficie); opacity: .62; }
.cb-medalhas li.ganha { opacity: 1; border-style: solid; border-color: #d9a441; background: var(--dourado-suave); }
.cb-med-em { grid-row: span 2; font-size: 1.7rem; filter: grayscale(1); }
.ganha .cb-med-em { filter: none; }
.cb-medalhas strong { font-size: .86rem; line-height: 1.2; }
.cb-medalhas small { font-size: .74rem; color: var(--texto-2); line-height: 1.3; }
.cb-dica { margin: .9rem 0; font-size: .92rem; color: var(--texto-2); }
.cb-cert { margin-top: .6rem; }
.cb-cert p { margin: 0 0 .6rem; }
.cb-cert-linha { display: flex; flex-wrap: wrap; gap: .5rem; }
.cb-cert-linha .entrada { flex: 1 1 200px; }

/* ---------- Pais e professores ---------- */
.cb-pais-grade { display: grid; gap: .9rem; }
@media (min-width: 760px) { .cb-pais-grade { grid-template-columns: repeat(3, 1fr); } }
.cb-pais-grade h3 { margin-top: 0; }
.cb-pais-grade p:last-child { margin-bottom: 0; }
.cb-pais-em { font-size: 2rem; margin: 0 0 .2rem; }
.cb-pais-bts { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.cb-pais-2 { margin-top: .9rem; }

/* ---------- Página do desenho ---------- */
.cb-abrir { display: grid; gap: 1rem; align-items: center; margin: 1rem 0 .4rem; }
@media (min-width: 760px) { .cb-abrir { grid-template-columns: 1.25fr 1fr; } }
.cb-abrir-mini { display: block; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 16px; }
.cb-abrir-mini .cb-mini { box-shadow: 0 0 0 4px var(--cb-tinta), 0 14px 30px rgba(0, 0, 0, .15); }
.cb-desafio { margin: 0 0 .9rem; padding: .7rem .9rem; border-radius: 14px; background: var(--dourado-suave); font-size: .98rem; }
.cb-abrir-bts { display: flex; flex-direction: column; gap: .5rem; }
.cb-abrir .cb-bt-pintar { background: linear-gradient(135deg, #f2994a, #e0607a); color: #fff; font-size: 1.08rem; min-height: 52px; }
.cb-estrelas-pag { margin: .8rem 0 0; font-weight: 650; }
.cb-historia-txt { font-size: 1.08rem; }
.cb-historia-ref { font-size: .92rem; color: var(--texto-2); }
.cb-duas { display: grid; gap: .9rem; margin: 1.2rem 0; }
@media (min-width: 760px) { .cb-duas { grid-template-columns: 1fr 1fr; } }
.cb-vers { margin: 0; padding: 0 0 0 .9rem; border-left: 4px solid #d9a441; font: 700 1.08rem/1.5 var(--cb-fonte); }
.cb-vers cite { display: block; margin-top: .4rem; font: 600 .86rem var(--fonte); color: var(--texto-2); font-style: normal; }
.cb-perg-txt { font-weight: 700; margin-bottom: .6rem; }
.cb-perg-bts { display: flex; flex-direction: column; gap: .45rem; }
.cb-op { min-height: 48px; padding: .55rem .9rem; border-radius: 14px; border: 2px solid var(--borda); background: var(--superficie); color: var(--texto); font: 700 1rem var(--cb-fonte); text-align: left; cursor: pointer; }
.cb-op:hover:not(:disabled) { border-color: var(--primaria); }
.cb-op.certa { border-color: #2f9a5a; background: color-mix(in srgb, #2f9a5a 16%, var(--superficie)); }
.cb-op.errada { border-color: #c24b3a; opacity: .6; text-decoration: line-through; }
.cb-perg-resp { margin: .6rem 0 0; font-weight: 700; min-height: 1.4em; }
.cb-pais-curto p { margin-bottom: .6rem; }
.cb-vizinhos { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: 2rem 0 0; }
.cb-viz { display: flex; flex-direction: column; padding: .8rem 1rem; border-radius: 14px; border: 1px solid var(--borda); background: var(--superficie); color: var(--texto); text-decoration: none; }
.cb-viz small { color: var(--texto-2); font-size: .78rem; }
.cb-viz strong { font-size: .95rem; line-height: 1.3; }
.cb-viz-prox { text-align: right; grid-column: 2; }
.cb-mais { margin: 1rem 0 0; text-align: center; }

/* =====================================================================
   ESTÚDIO (tela cheia)
   ===================================================================== */
body.cb-travado { overflow: hidden; }
.cb-est {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--cb-papel); color: #2a1f1a; font-family: var(--cb-fonte); color-scheme: light;
}
.cb-est[open] { display: flex; flex-direction: column; }
.cb-est::backdrop { background: #000; }
.cb-ico { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; color: #2a1f1a; font-size: 1.2rem; box-shadow: 0 2px 6px rgba(58, 42, 34, .18); cursor: pointer; }
.cb-ico:disabled { opacity: .35; cursor: default; }
.cb-ico[aria-pressed="false"] { opacity: .6; }

.cb-est-topo { display: flex; align-items: center; gap: .5rem; padding: calc(8px + env(safe-area-inset-top)) 10px 6px; }
.cb-est-tit { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.cb-est-tit strong { font-size: 1rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-prog { display: block; height: 9px; border-radius: 99px; background: #f1e3cc; overflow: hidden; }
.cb-prog i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #5cb85c, #f6d14a, #f28c38); transition: width .3s; }
.cb-prog-txt { font-size: .74rem; font-weight: 700; color: #7a6656; }
.cb-modo-numeros [data-e="desfazer"] { visibility: hidden; }

.cb-est-area { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 4px 10px; container-type: size; }
.cb-tela-caixa { position: relative; width: min(100cqw, 133.3cqh); aspect-ratio: 4 / 3; }
.cb-tela { position: relative; width: 100%; height: 100%; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 0 0 3px var(--cb-tinta), 0 10px 26px rgba(58, 42, 34, .2); touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.cb-est[data-ferr="adesivo"] .cb-tela { cursor: copy; }
.cb-com-zoom .cb-tela { box-shadow: 0 0 0 3px #3f6fd8, 0 10px 26px rgba(58, 42, 34, .2); }
.cb-zoom { position: absolute; right: 8px; bottom: 8px; display: flex; flex-direction: column; gap: .4rem; }
.cb-zoom .cb-ico { width: 38px; height: 38px; font-size: 1.1rem; font-weight: 800; background: rgba(255,255,255,.92); }
.cb-zoom .cb-ico:disabled { display: none; }
.cb-dica-est { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); margin: 0; padding: .55rem .95rem; border-radius: 14px; background: #2a1f1a; color: #fff; font-size: .92rem; font-weight: 700; text-align: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); z-index: 2; pointer-events: none; animation: cb-desce .25s ease-out; }
.cb-dica-est[hidden] { display: none; }
@keyframes cb-desce { from { opacity: 0; transform: translate(-50%, -8px); } }

.cb-est-baixo { padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; }
.cb-ferr { display: flex; justify-content: center; gap: 4px; }
.cb-ferr button { flex: 1 1 0; max-width: 84px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 2px; border: 2px solid transparent; border-radius: 14px; background: #fff; color: #5a4636; font: 700 .68rem/1.15 var(--cb-fonte); cursor: pointer; box-shadow: 0 1px 3px rgba(58, 42, 34, .15); }
.cb-ferr button span { font-size: 1.35rem; line-height: 1.1; }
.cb-ferr button b { font-weight: 700; }
.cb-ferr [aria-pressed="true"] { border-color: #e0607a; background: #fff0f3; color: #a3365a; }
.cb-modo-numeros .cb-ferr [data-f], .cb-modo-numeros .cb-so-livre { display: none; }
.cb-instr { margin: 0; text-align: center; font-size: .85rem; font-weight: 700; color: #7a6656; }

.cb-paleta, .cb-bandeja { display: flex; justify-content: safe center; gap: 7px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.cb-paleta[hidden], .cb-bandeja[hidden] { display: none; }
.cb-cor { flex: none; position: relative; width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 0 0 1.5px rgba(58, 42, 34, .25); cursor: pointer; padding: 0; }
.cb-cor[aria-checked="true"] { box-shadow: 0 0 0 3px #2a1f1a; transform: scale(1.1); }
.cb-cor-arco { background: conic-gradient(#e8473f, #f28c38, #f6d14a, #5cb85c, #3f8fd8, #7a5cc9, #e8473f); }
.cb-cor-ouro { background: linear-gradient(135deg, #fff3a6, #f2c94c 45%, #c99a2e 70%, #ffe9a0); }
.cb-cor-num { width: 44px; height: 44px; }
.cb-cor-num b { position: absolute; inset: 0; display: grid; place-items: center; font: 800 1rem var(--cb-fonte); color: #fff; text-shadow: 0 0 3px #000, 0 0 2px #000; }
.cb-cor-num.cb-feito { opacity: .45; }
.cb-cor-num.cb-feito b::after { content: "✓"; font-size: .8rem; margin-left: 1px; }
.cb-bandeja button { flex: none; width: 54px; height: 54px; padding: 4px; border-radius: 14px; border: 2px solid transparent; background: #fff; box-shadow: 0 1px 3px rgba(58, 42, 34, .15); cursor: pointer; }
.cb-bandeja button[aria-checked="true"] { border-color: #e0607a; background: #fff0f3; }
.cb-bandeja svg { width: 100%; height: 100%; }
.cb-est-acoes { display: flex; justify-content: center; }
.cb-pronto { min-width: 200px; background: #2f9a5a; color: #fff; font-family: var(--cb-fonte); font-size: 1.02rem; font-weight: 800; }
.cb-pronto.cb-quase { animation: cb-chama 1s ease-in-out 2; }
@keyframes cb-chama { 50% { transform: scale(1.07); box-shadow: 0 0 0 6px rgba(47, 154, 90, .25); } }

/* Paisagem no celular: ferramentas ao lado do desenho */
@media (orientation: landscape) and (max-height: 520px) {
  .cb-est[open] { display: grid; grid-template-columns: 1fr minmax(250px, 34%); grid-template-rows: auto 1fr; }
  .cb-est-topo { grid-column: 1 / -1; padding-top: 4px; }
  .cb-est-baixo { overflow-y: auto; justify-content: center; }
  .cb-ferr { flex-wrap: wrap; }
  .cb-paleta { flex-wrap: wrap; overflow: visible; }
}

/* Tela de parabéns */
.cb-fim { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 14px; background: rgba(42, 31, 26, .55); }
.cb-fim[hidden] { display: none; }
.cb-fim-caixa { width: min(520px, 100%); max-height: 100%; overflow-y: auto; padding: 1.1rem 1.1rem 1.2rem; border-radius: 24px; background: #fff; text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); animation: cb-sobe .35s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes cb-sobe { from { opacity: 0; transform: translateY(30px) scale(.95); } }
.cb-fim-tit { margin: 0 0 .7rem; font-size: 1.5rem; font-weight: 800; }
.cb-fim-arte { aspect-ratio: 4 / 3; width: min(320px, 100%); margin: 0 auto; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 3px var(--cb-tinta); }
.cb-fim-arte svg { display: block; width: 100%; height: 100%; }
.cb-fim-est { margin: .6rem 0 .2rem; font-size: 2rem; letter-spacing: .1em; }
.cb-fim-ganhou { margin: 0 0 .4rem; font-weight: 800; color: #2f7a4f; }
.cb-fim-med { margin: .3rem auto; padding: .45rem .8rem; width: fit-content; border-radius: 99px; background: #fff3c4; font-weight: 700; }
.cb-fim-vers { margin: .7rem 0; font-size: .95rem; color: #5a4636; }
.cb-fim-vers small { display: block; color: #8a7666; }
.cb-fim-perg { margin: .4rem 0 .8rem; padding: .8rem; border-radius: 16px; background: #f4f0ff; text-align: left; }
.cb-fim-perg .cb-op { background: #fff; color: #2a1f1a; border-color: #ddd3f5; }
.cb-fim-perg .cb-perg-resp { color: #2a1f1a; }
.cb-fim-bts { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; }
.cb-fim-bts .btn { font-family: var(--cb-fonte); }
.cb-fim-bts .btn-sec { background: #fff; color: #2a1f1a; box-shadow: inset 0 0 0 1.5px #e5ded0; }
.cb-confete { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 9; pointer-events: none; }
.cb-confete[hidden] { display: none; }

/* =====================================================================
   IMPRESSÃO (um desenho por folha)
   ===================================================================== */
.cb-imp { display: none; }
@media print {
  body.cb-imprimindo > *:not(#cb-imp) { display: none !important; }
  body.cb-imprimindo { background: #fff; }
  body.cb-imprimindo .cb-imp { display: block; }
  .cb-folha { break-after: page; page-break-after: always; padding: 4mm 0; text-align: center; color: #000; font-family: var(--cb-fonte); }
  .cb-folha:last-child { break-after: auto; page-break-after: auto; }
  .cb-folha h2 { margin: 0 0 5mm; font-size: 22pt; }
  .cb-folha-arte { border: 1.5pt solid #3a2a22; border-radius: 4mm; overflow: hidden; }
  .cb-folha-arte svg { display: block; width: 100%; height: auto; }
  .cb-folha-vers { margin: 6mm 0 2mm; font-size: 14pt; font-weight: 700; }
  .cb-folha-site { font-size: 10pt; color: #555; }
  .cb-certificado { border: 3pt double #d9a441; border-radius: 6mm; padding: 16mm 10mm; font-size: 15pt; }
  .cb-cert-topo { font-size: 14pt; letter-spacing: .2em; text-transform: uppercase; color: #8f6318; }
  .cb-cert-titulo { font-size: 32pt; font-weight: 800; margin: 2mm 0 8mm; }
  .cb-cert-nome { font-size: 28pt; font-weight: 800; border-bottom: 1.5pt solid #000; display: inline-block; padding: 0 10mm 2mm; margin: 4mm 0 8mm; }
  .cb-cert-vers { font-style: italic; margin: 8mm 0; }
  .cb-svg { background: #fff; }
}
