/* ═══════════════════════════════════════════════════════
   ESCOLA DOS BRUXOS — style.css
   Paleta: pergaminho + bordô + dourado (modelo Grimório).
   Letras alojadas no próprio site (sem Google Fonts — mais rápido e RGPD).
   ═══════════════════════════════════════════════════════ */

@font-face { font-family: 'EB Garamond'; font-weight: 600; font-style: normal; font-display: swap; src: url('/assets/fontes/eb-garamond-600.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-weight: 700; font-style: normal; font-display: swap; src: url('/assets/fontes/eb-garamond-700.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-weight: 400; font-style: normal; font-display: swap; src: url('/assets/fontes/lora-400.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-weight: 400; font-style: italic; font-display: swap; src: url('/assets/fontes/lora-400-italico.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-weight: 600 700; font-style: normal; font-display: swap; src: url('/assets/fontes/lora-600.woff2') format('woff2'); }

:root {
  /* Fundos */
  --fundo: #fbf3dc;
  --papel: #fffaee;
  --papel-2: #f6ead0;
  /* Texto */
  --texto: #1a1a1a;
  --texto-2: #463a33;
  /* Cor principal e destaque */
  --bordo: #7a1010;
  --bordo-esc: #5c0b0b;
  --bordo-claro: #9b2020;
  --dourado: #b8912f;
  --dourado-esc: #7d6118;
  --linha: #e4d3a6;
  --sombra: 0 1px 2px rgba(60, 30, 10, .08), 0 6px 18px rgba(60, 30, 10, .07);
  --raio: 12px;
  --letra-base: 18px;
  --f-titulo: 'EB Garamond', Garamond, 'Times New Roman', serif;
  --f-texto: 'Lora', Georgia, 'Times New Roman', serif;
  --largura: 72rem;
  --largura-texto: 46rem;
  --barra-app: 66px;

  /* Nomes antigos (usados em estilos dentro das páginas) */
  --vermelho: var(--bordo);
  --vermelho-escuro: var(--bordo-esc);
  --creme: var(--fundo);
  --cartao: var(--papel);
  --texto-suave: var(--texto-2);
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--letra-base); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font-family: var(--f-texto);
  font-size: 1rem;
  line-height: 1.65;
  padding-bottom: calc(var(--barra-app) + env(safe-area-inset-bottom));
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--dourado); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: absolute; left: -9999px; top: 0; background: var(--bordo); color: #fff; padding: .6rem 1rem; z-index: 300; }
.saltar:focus { left: 0; }

h1, h2, h3, h4 { font-family: var(--f-titulo); color: var(--bordo); line-height: 1.2; font-weight: 700; }

/* ── Topo ───────────────────────────────────────── */
.topo {
  position: sticky; top: 0; z-index: 100;
  background: var(--bordo);
  border-bottom: 3px solid var(--dourado);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
}
.topo-in {
  max-width: var(--largura); margin: 0 auto;
  display: flex; align-items: center; gap: 1rem;
  padding: .5rem 1rem;
}
.logo { display: flex; align-items: center; gap: .6rem; color: #fff7e2; flex-shrink: 0; }
.logo img {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--fundo); border: 2px solid var(--dourado); padding: 3px;
}
.logo-txt { display: flex; flex-direction: column; line-height: 1.05; }
.logo-nome { font-family: var(--f-titulo); font-size: 1.45rem; font-weight: 700; letter-spacing: .02em; }
.logo-sub { font-family: var(--f-titulo); font-size: .8rem; color: #f0d98f; font-variant: small-caps; letter-spacing: .08em; }

.menu { display: none; flex: 1; justify-content: center; gap: .2rem; }
.menu a {
  color: #fff7e2;
  font-family: var(--f-titulo); font-weight: 600; font-size: 1.1rem;
  font-variant: small-caps; letter-spacing: .06em;
  padding: .45rem .7rem; border-radius: 6px;
}
.menu a:hover, .menu a[aria-current="page"] { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: inset 0 -2px 0 var(--dourado); }

.topo-acoes { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.btn-icone { color: #fff7e2; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; }
.btn-icone:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.btn-entrar {
  display: none;
  font-family: var(--f-titulo); font-weight: 700; font-size: 1.05rem;
  color: var(--bordo); background: #f0d98f; border-radius: 8px; padding: .45rem .9rem;
}
.btn-entrar:hover { background: #fff7e2; }

.btn-menu {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 54px; height: 50px; padding: 0; cursor: pointer;
  background: transparent; border: 2px solid rgba(240, 217, 143, .6); border-radius: 10px;
}
.btn-menu span { display: block; width: 22px; height: 2.5px; background: #fff7e2; border-radius: 2px; }
.btn-menu em { font-style: normal; font-family: var(--f-titulo); font-size: .7rem; font-weight: 700; color: #f0d98f; line-height: 1; margin-top: 1px; letter-spacing: .04em; }
.btn-menu:hover { background: rgba(255, 255, 255, .1); }

/* ── Gaveta do menu ─────────────────────────────── */
.gaveta-fundo { position: fixed; inset: 0; background: rgba(20, 8, 8, .55); z-index: 200; }
.gaveta {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 201;
  width: 86%; max-width: 360px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--fundo); border-left: 3px solid var(--dourado);
  box-shadow: -8px 0 24px rgba(0, 0, 0, .3);
  transform: translateX(105%); transition: transform .25s ease; visibility: hidden;
}
body.menu-aberto { overflow: hidden; }
body.menu-aberto .gaveta { transform: none; visibility: visible; }
.gaveta-cab {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bordo); color: #fff; padding: .7rem 1rem; border-bottom: 3px solid var(--dourado);
}
.gaveta-tit { font-family: var(--f-titulo); font-size: 1.5rem; font-weight: 700; }
.gaveta-fechar { background: none; border: 2px solid rgba(240, 217, 143, .6); color: #fff; font-size: 1.3rem; width: 46px; height: 46px; border-radius: 10px; cursor: pointer; }
.gaveta-pesq { padding: .9rem 1rem .3rem; }
.gaveta-pesq input { width: 100%; font: inherit; font-size: 1rem; color: var(--texto); padding: .7rem .9rem; border: 2px solid var(--linha); border-radius: 10px; background: #fff; }
.gaveta-pesq input:focus { border-color: var(--bordo); outline: none; }
.gaveta nav { padding: .3rem 0 1.5rem; }
.gaveta nav a { display: block; padding: .62rem 1.2rem; color: var(--texto); font-size: 1.02rem; border-bottom: 1px solid rgba(228, 211, 166, .6); }
.gaveta nav a:hover { background: var(--papel-2); }
.gaveta nav a.g-princ { font-family: var(--f-titulo); font-weight: 700; font-size: 1.2rem; color: var(--bordo); }
.g-grupo { margin: 1rem 1.2rem .3rem; font-family: var(--f-titulo); font-variant: small-caps; letter-spacing: .12em; font-weight: 700; color: var(--dourado-esc); font-size: 1.05rem; }
.gaveta nav a.g-japassa { display: flex; align-items: center; gap: .6rem; font-weight: 600; color: var(--bordo); }
.gaveta nav a.g-japassa img { width: 28px; height: 28px; }

/* ── Estrutura geral ────────────────────────────── */
main { display: block; }
.container { max-width: 46rem; margin: 0 auto; padding: 1.2rem 1rem; }

.hero {
  text-align: center; padding: 2.4rem 1rem 2rem;
  background: radial-gradient(ellipse at top, rgba(184, 145, 47, .18), transparent 60%), var(--fundo);
  border-bottom: 1px solid var(--linha);
}
.hero h1 { font-size: clamp(1.9rem, 6vw, 2.8rem); max-width: 22ch; margin: .3rem auto .8rem; }
.hero p { max-width: 38rem; margin: 0 auto; color: var(--texto-2); font-size: 1.05rem; }

.cartao {
  background: var(--papel);
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--sombra);
  margin-bottom: 1.1rem;
}

.titulo-seccao {
  font-family: var(--f-titulo);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--bordo);
  margin: 0 0 .9rem;
  display: flex; align-items: center; gap: .6rem;
}
.titulo-seccao::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--dourado), transparent); }
.titulo-seccao[style*="center"]::after { display: none; }

/* ── Como funciona ──────────────────────────────── */
.como-funciona { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.passo {
  background: var(--papel-2); border: 1px solid var(--linha);
  border-radius: 10px; padding: .9rem .8rem; text-align: center;
}
.passo .num {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bordo); color: #fff; border: 2px solid var(--dourado);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-titulo); font-weight: 700; font-size: 1.1rem;
  margin: 0 auto .5rem;
}
.passo p { font-size: .92rem; margin: 0; color: var(--texto-2); line-height: 1.45; }

/* ── Mapa dos níveis ────────────────────────────── */
.niveis-lista { display: flex; flex-direction: column; gap: .7rem; }
.nivel-card {
  display: flex; align-items: center; gap: .9rem;
  background: var(--papel); border: 1px solid var(--linha);
  border-left: 5px solid var(--bordo);
  border-radius: 10px; padding: .85rem 1rem;
}
.nivel-card.bloqueado { border-left-color: #cdbf9c; background: #fbf5e6; }
.nivel-card .nivel-num {
  width: 42px; height: 42px; min-width: 42px; border-radius: 50%;
  background: var(--bordo); color: #fff; border: 2px solid var(--dourado);
  font-family: var(--f-titulo); font-weight: 700; font-size: 1.25rem;
  display: flex; align-items: center; justify-content: center;
}
.nivel-card.bloqueado .nivel-num { background: #b3a687; border-color: #d8ccab; }
.nivel-card .nivel-info { flex: 1; min-width: 0; }
.nivel-card .nivel-info h3 { margin: 0 0 .15rem; font-size: 1.22rem; color: var(--bordo); }
.nivel-card.bloqueado .nivel-info h3 { color: #5e4f3f; }
.nivel-card .nivel-info p { margin: 0; font-size: .88rem; color: var(--texto-2); line-height: 1.45; }
.nivel-card .cadeado { margin-left: auto; font-size: 1.1rem; opacity: .55; }
a:hover > .nivel-card { border-color: var(--bordo); }

/* ── Nível 7 destaque ───────────────────────────── */
.destaque-nivel7 {
  background: linear-gradient(135deg, var(--bordo), var(--bordo-esc));
  color: #fff7e2;
  border: 2px solid var(--dourado);
  border-radius: var(--raio);
  padding: 1.3rem 1.2rem;
  text-align: center;
  margin-bottom: 1.1rem;
  box-shadow: var(--sombra);
}
.destaque-nivel7 h3 { margin: 0 0 .5rem; font-size: 1.45rem; color: #f0d98f; }
.destaque-nivel7 p { margin: 0; font-size: .98rem; line-height: 1.55; }

/* ── Botões ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font-family: var(--f-titulo); font-weight: 700; font-size: 1.15rem; line-height: 1.2;
  padding: .75rem 1.25rem; min-height: 50px; border-radius: 10px; cursor: pointer;
  border: 2px solid transparent; text-align: center;
}
.btn-vermelho, .btn-pri { background: var(--bordo); color: #fff; }
.btn-vermelho:hover, .btn-pri:hover { background: var(--bordo-esc); color: #fff; }
.btn-dourado { background: var(--dourado); color: #1a1a1a; }
.btn-dourado:hover { background: #a37f22; }
.btn-sec { background: transparent; color: var(--bordo); border-color: var(--bordo); }
.btn-sec:hover { background: var(--bordo); color: #fff; }
.btn-primario { background: #fff7e2; color: var(--bordo); }
.btn-bloco { display: flex; width: 100%; }

/* ── Preço / subscrição ─────────────────────────── */
.preco-box { text-align: center; border: 2px solid var(--dourado); }
.preco-box .valor {
  font-family: var(--f-titulo); font-size: 2.6rem; font-weight: 700;
  color: var(--bordo); margin: .2rem 0;
}
.preco-box .valor span { font-family: var(--f-texto); font-size: 1rem; font-weight: 400; color: var(--texto-2); }
.preco-box ul { text-align: left; margin: 1rem auto; padding-left: 1.3rem; font-size: .98rem; color: var(--texto-2); max-width: 26rem; }
.preco-box ul li { margin-bottom: .35rem; }
.preco-box ul li::marker { color: var(--dourado); }

/* ── Formulários ────────────────────────────────── */
.form-grupo { margin-bottom: 1rem; }
.form-grupo label { display: block; font-size: .95rem; font-weight: 600; margin-bottom: .35rem; color: var(--texto); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], textarea, select {
  width: 100%;
  padding: .75rem .9rem;
  border: 2px solid var(--linha);
  border-radius: 10px;
  font: inherit; font-size: 1rem;
  background: #fff;
  color: var(--texto);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--bordo); box-shadow: 0 0 0 3px rgba(122, 16, 16, .15); }
input[type="radio"], input[type="checkbox"] { accent-color: var(--bordo); width: 1.1rem; height: 1.1rem; }

.alerta-erro, .alerta-sucesso {
  padding: .75rem 1rem; border-radius: 10px; font-size: .95rem; margin-bottom: 1rem; line-height: 1.5;
}
.alerta-erro { background: #fbeaea; color: #8f1d1d; border: 1px solid #ecc3c3; border-left: 4px solid #8f1d1d; }
.alerta-sucesso { background: #eef6ea; color: #24572a; border: 1px solid #cfe3c7; border-left: 4px solid #3d7a3f; }

.link-secundario { display: block; text-align: center; margin-top: 1rem; font-size: .95rem; color: var(--texto-2); }
.link-secundario a, a.link-secundario:hover { color: var(--bordo); }
.link-secundario a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ── Painel do aluno ────────────────────────────── */
.painel-boasvindas { margin: .4rem 0 .1rem; font-size: 1.9rem; color: var(--bordo); }
.painel-sub { color: var(--texto-2); font-size: .98rem; margin: 0 0 1.1rem; }
.barra-progresso-wrap { background: var(--papel-2); border: 1px solid var(--linha); border-radius: 20px; height: 12px; overflow: hidden; margin: .6rem 0 .3rem; }
.barra-progresso-fill { background: linear-gradient(90deg, var(--bordo), var(--bordo-claro)); height: 100%; border-radius: 20px; }
.progresso-texto { font-size: .9rem; color: var(--texto-2); margin: 0 0 1rem; }

.estado-tag {
  flex-shrink: 0;
  font-family: var(--f-texto); font-size: .75rem; font-weight: 600;
  padding: .2rem .7rem; border-radius: 20px; margin-left: auto; white-space: nowrap;
}
.estado-concluido { background: #e6f1e1; color: #24572a; }
.estado-em_curso { background: #f8ecc9; color: #6b4f0e; }
.estado-bloqueado { background: #efe7d3; color: #5e4f3f; }

.vazio { text-align: center; color: var(--texto-2); font-size: 1rem; padding: 1.6rem .6rem; }

/* ── Pesquisa e listas ──────────────────────────── */
.pesquisa-form { display: flex; gap: .5rem; margin-bottom: 1.1rem; }
.pesquisa-form input { flex: 1; min-width: 0; }
.resultado-item { display: block; padding: .8rem 0; border-bottom: 1px solid var(--linha); }
.resultado-item:last-child { border-bottom: none; }
.resultado-item h4 { margin: 0 0 .2rem; font-size: 1.2rem; color: var(--bordo); }
.resultado-item p { margin: 0; font-size: .92rem; color: var(--texto-2); }
.resultado-tipo {
  display: inline-block; font-family: var(--f-titulo); font-variant: small-caps;
  font-size: .9rem; font-weight: 700; letter-spacing: .08em;
  color: var(--dourado-esc); margin-bottom: .2rem;
}

.fav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 0; border-bottom: 1px solid var(--linha); gap: .7rem;
}
.fav-item:last-child { border-bottom: none; }
.fav-item h4 { margin: 0 0 .1rem; font-size: 1.15rem; color: var(--bordo); }
.fav-item .nivel-tag { margin: 0; font-size: .88rem; color: var(--texto-2); }
.fav-item .remover { background: none; border: none; color: #8f1d1d; font: inherit; font-size: .9rem; cursor: pointer; white-space: nowrap; text-decoration: underline; }

/* ── Blocos do Mestre Cruz (tarot, contacto) ────── */
.bloco-mc { background: var(--papel-2); border: 1px solid var(--linha); border-left: 4px solid var(--dourado); border-radius: 10px; padding: 1rem 1.15rem; margin: 1.4rem 0; font-size: .98rem; }
.bloco-mc p { margin: 0 0 .5rem; }
.bloco-mc-tit { font-family: var(--f-titulo); font-size: 1.35rem; font-weight: 700; color: var(--bordo); }
.bloco-mc-botoes { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }
.bloco-mc-botoes .btn { flex: 1 1 14rem; font-size: 1.05rem; }

/* ── Rodapé ─────────────────────────────────────── */
.rodape { background: #2b1b1b; color: #eadcb8; margin-top: 2.5rem; border-top: 3px solid var(--dourado); }
.rodape-in { max-width: var(--largura); margin: 0 auto; padding: 2rem 1rem 1rem; display: grid; grid-template-columns: 1fr; gap: 1.4rem; }
.rodape a { color: #f4e6bf; display: block; padding: .28rem 0; }
.rodape a:hover { color: #fff; text-decoration: underline; }
.rodape p { margin: 0 0 .6rem; font-size: .95rem; }
.rodape-logo { font-family: var(--f-titulo); font-size: 1.6rem !important; font-weight: 700; color: #fff; }
.rodape-tit { font-family: var(--f-titulo); font-variant: small-caps; letter-spacing: .1em; font-weight: 700; color: var(--dourado) !important; font-size: 1.1rem !important; }
.aviso-legal { font-size: .86rem !important; color: #cdbb90; }
.rodape a.rodape-japassa { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; }
.rodape a.rodape-japassa img { width: 30px; height: 30px; }
.rodape-sites { text-align: center; margin: 0; padding: .8rem 1rem 0; font-size: .95rem; }
.rodape-sites a { display: inline; }
.rodape-fim { text-align: center; padding: 1rem 1rem 1.2rem; border-top: 1px solid rgba(255, 255, 255, .1); margin: .8rem 0 0; font-size: .88rem; }
.rodape-fim a { display: inline; }

/* ── Barra de navegação da app (telemóvel) ──────── */
.barra-app {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  background: var(--papel); border-top: 2px solid var(--linha);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 14px rgba(60, 30, 10, .08);
}
.barra-app a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--barra-app); color: var(--texto-2); font-size: .72rem; font-weight: 600;
}
.barra-app svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.barra-app a[aria-current="page"] { color: var(--bordo); }
.barra-app a[aria-current="page"] svg { fill: rgba(122, 16, 16, .12); }
.barra-app a.central { justify-content: flex-end; padding-bottom: 8px; color: var(--bordo); }
.barra-app .bola {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--bordo); color: #f0d98f; border: 3px solid var(--dourado);
  display: grid; place-items: center; margin-top: -26px; margin-bottom: 2px;
  font-family: var(--f-titulo); font-size: 1.6rem; font-weight: 700; line-height: 1;
  box-shadow: 0 3px 10px rgba(60, 30, 10, .25);
}

/* ── Tamanho de letra escolhido pelo leitor ─────── */
/* Só muda o texto das lições (o menu e a barra da app ficam iguais) */
html.letra-1 { --escala-leitura: 1.15; }
html.letra-2 { --escala-leitura: 1.3; }
html.letra--1 { --escala-leitura: .9; }

/* ── Ecrãs maiores ──────────────────────────────── */
@media (min-width: 900px) {
  :root { --letra-base: 19px; }
  body { padding-bottom: 0; }
  .barra-app { display: none; }
  .menu { display: flex; }
  .btn-entrar { display: inline-block; }
  .hero { padding: 3.4rem 1rem 3rem; }
  .container { padding-top: 1.8rem; }
  .como-funciona { grid-template-columns: repeat(4, 1fr); }
  .rodape-in { grid-template-columns: 2fr 1fr 1fr 1.2fr; }
}
@media (max-width: 600px) {
  .nivel-card { flex-wrap: wrap; row-gap: .4rem; }
  .nivel-card .nivel-info { flex: 1 1 calc(100% - 42px - .9rem); }
  .nivel-card .estado-tag, .nivel-card .cadeado { order: 3; margin-left: calc(42px + .9rem); }
  .nivel-card .cadeado { position: absolute; right: .9rem; top: .8rem; margin: 0; }
  .nivel-card { position: relative; }
  .nivel-card.bloqueado .nivel-info { padding-right: 1.4rem; }
}
@media (max-width: 420px) {
  .logo-sub { display: none; }
  .logo-nome { font-size: 1.3rem; }
  .logo img { width: 40px; height: 40px; }
}

/* ── Leitura das lições (nivel.php) ─────────────── */
.barra-leitura { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 150; pointer-events: none; }
.barra-leitura span { display: block; height: 100%; width: 0; background: #f0d98f; box-shadow: 0 0 6px rgba(240, 217, 143, .8); }
.titulo-nivel { font-size: clamp(1.9rem, 6vw, 2.5rem); margin: .2rem 0 .5rem; }
.nivel-resumo { color: var(--texto-2); font-size: calc(1rem * var(--escala-leitura, 1)); margin: 0; }
.nivel-meta { margin: .7rem 0 0; padding-top: .7rem; border-top: 1px solid var(--linha); font-size: .9rem; color: var(--dourado-esc); font-weight: 600; }

.ferramentas {
  position: sticky; top: 66px; z-index: 50;
  display: flex; gap: .4rem; justify-content: center; flex-wrap: wrap;
  background: rgba(251, 243, 220, .96); backdrop-filter: blur(4px);
  padding: .5rem 0; margin: 0 0 1rem;
  border-bottom: 1px solid var(--linha);
}
.ferr {
  font: inherit; font-family: var(--f-titulo); font-weight: 700; font-size: 1.05rem;
  display: inline-flex; align-items: center; gap: .35rem;
  min-height: 44px; min-width: 48px; justify-content: center;
  padding: .3rem .8rem; border-radius: 8px; cursor: pointer;
  background: var(--papel); color: var(--bordo); border: 1.5px solid var(--linha);
}
.ferr:hover { border-color: var(--bordo); }
.ferr:disabled { opacity: .4; cursor: default; }

.indice-nivel .indice-tit { font-family: var(--f-titulo); font-variant: small-caps; letter-spacing: .12em; font-weight: 700; color: var(--dourado-esc); margin: 0 0 .4rem; font-size: 1.1rem; }
.indice-nivel ol { margin: 0; padding-left: 1.4rem; }
.indice-nivel li { padding: .3rem 0; border-bottom: 1px dashed var(--linha); }
.indice-nivel li:last-child { border-bottom: 0; }
.indice-nivel li::marker { color: var(--dourado-esc); font-family: var(--f-titulo); font-weight: 700; }
.indice-nivel a { color: var(--bordo); text-decoration: underline; text-decoration-color: var(--linha); text-underline-offset: 3px; }
.indice-nivel a:hover { text-decoration-color: var(--bordo); }

.licao { scroll-margin-top: 130px; }
.licao-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; margin-bottom: .6rem; }
.licao-num { font-family: var(--f-titulo); font-variant: small-caps; letter-spacing: .1em; font-weight: 700; color: var(--dourado-esc); font-size: .95rem; }
.licao-tit { font-size: calc(1.55rem * var(--escala-leitura, 1)); margin: .1rem 0 0; }
.licao-texto { font-size: calc(1.05rem * var(--escala-leitura, 1)); line-height: 1.75; }
.btn-fav { background: none; border: 1.5px solid var(--linha); border-radius: 50%; width: 46px; height: 46px; font-size: 1.4rem; line-height: 1; cursor: pointer; color: #9c8d6a; flex-shrink: 0; }
.btn-fav.ativo { color: var(--bordo); border-color: var(--bordo); background: #fbeaea; }
.voltar-indice { display: inline-block; margin-top: 1rem; font-size: .9rem; color: var(--texto-2); text-decoration: underline; text-underline-offset: 3px; }
.indice-nivel { scroll-margin-top: 130px; }

.fim-nivel { text-align: center; border: 2px solid var(--dourado); }
.fim-nivel .fim-tit { font-family: var(--f-titulo); font-size: 1.5rem; font-weight: 700; color: var(--bordo); margin: 0 0 .3rem; }
.fim-nivel p { margin: 0 0 1rem; color: var(--texto-2); }

@media (max-width: 420px) {
  .ferr span { display: none; }
}
@media (min-width: 900px) {
  .ferramentas { top: 68px; }
}
@media print {
  .barra-leitura, .ferramentas, .indice-nivel, .voltar-indice, .licao-fav, .fim-nivel, .saltar { display: none !important; }
  .licao { break-inside: auto; border: 0; padding: 0; margin-bottom: 1.5rem; }
  .licao-texto { font-size: 12pt; }
  h1, h2 { color: #000; }
}

/* ── Impressão ──────────────────────────────────── */
@media print {
  .topo, .barra-app, .rodape, .gaveta, .gaveta-fundo, .bloco-mc { display: none !important; }
  body { background: #fff; padding: 0; font-size: 12pt; }
  .cartao { box-shadow: none; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ── Texto das lições (formatação) ──────────────── */
.licao-texto p { margin: 0 0 1rem; }
.licao-texto h3 { font-family: var(--f-titulo); font-size: calc(1.3rem * var(--escala-leitura, 1)); color: var(--bordo); margin: 1.6rem 0 .5rem; }
.licao-texto ul, .licao-texto ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.licao-texto li { margin: 0 0 .35rem; }
.licao-texto a { color: var(--bordo); text-decoration: underline; text-underline-offset: 3px; }
.palavra-mestre { background: var(--papel-2); border: 1px solid var(--linha); border-left: 4px solid var(--dourado); border-radius: var(--raio); padding: 1rem 1.1rem; margin: 1.4rem 0; font-style: italic; }
.palavra-mestre p { margin: 0 0 .7rem; }
.palavra-mestre p:last-child { margin-bottom: 0; }
.palavra-mestre strong { font-style: normal; color: var(--bordo); }
.palavra-mestre .assinatura { text-align: right; font-family: var(--f-titulo); font-weight: 700; font-style: normal; color: var(--bordo); font-size: 1.1rem; }
.intro-nivel .licao-texto > p:first-child { font-size: 1.08em; }

/* ── Perfil do aluno ────────────────────────────── */
.estado-perfil { border-radius: var(--raio); padding: .9rem 1rem; margin: 0 0 1rem; line-height: 1.55; border: 1px solid var(--linha); border-left: 4px solid var(--dourado); background: var(--papel); }
.estado-perfil.aprovado { border-left-color: #3d7a3f; background: #eef6ea; }
.estado-perfil.pendente { border-left-color: var(--dourado); background: #fbf2d8; }
.estado-perfil.recusado { border-left-color: #8f1d1d; background: #fbeaea; }
.estado-perfil a { color: var(--bordo); font-weight: 600; }
.aviso-perfil { text-align: center; border: 2px solid var(--dourado); }
.aviso-perfil .fim-tit { font-family: var(--f-titulo); font-size: 1.4rem; font-weight: 700; color: var(--bordo); margin: 0 0 .4rem; }
.aviso-perfil p { color: var(--texto-2); margin: 0 0 1rem; }
.ajuda { font-size: .88rem; color: var(--texto-2); margin: .35rem 0 0; line-height: 1.5; }
.valor-fixo { margin: 0; font-size: 1.05rem; }
.foto-campo { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem 0; border-bottom: 1px solid var(--linha); }
.foto-campo:last-of-type { border-bottom: 0; }
.foto-previa { width: 96px; height: 96px; flex-shrink: 0; border-radius: 10px; overflow: hidden; background: var(--papel-2); border: 1px solid var(--linha); display: grid; place-items: center; }
.foto-previa img { width: 100%; height: 100%; object-fit: cover; }
.foto-previa.vazia span { font-size: .8rem; color: var(--texto-2); }
.foto-info { flex: 1; min-width: 0; }
.foto-info label { display: block; font-weight: 600; margin: 0; }
.foto-info .ok { color: #3d7a3f; }
.foto-info input[type=file] { margin-top: .5rem; width: 100%; font-size: .9rem; }
.galeria-form { display: grid; gap: .6rem; margin: 0 0 1rem; }
.galeria-form input[type=file] { font-size: .9rem; }
.galeria-grelha { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .8rem; }
.galeria-grelha figure { margin: 0; }
.galeria-grelha img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--linha); display: block; }
.galeria-grelha figcaption { font-size: .82rem; color: var(--texto-2); margin-top: .25rem; line-height: 1.35; }
.galeria-grelha form { margin: .2rem 0 0; }
.galeria-grelha .remover { background: none; border: none; color: #8f1d1d; font: inherit; font-size: .82rem; cursor: pointer; text-decoration: underline; padding: 0; }
.btn-japassa-perfil { display: flex; align-items: center; justify-content: center; gap: .6rem; background: #fff; border: 1.5px solid var(--linha); border-radius: 999px; padding: .55rem 1rem; margin: 0 0 1rem; font-weight: 600; color: var(--bordo); text-decoration: none; }
.btn-japassa-perfil img { border-radius: 50%; }
.btn-japassa-perfil:hover { border-color: var(--dourado); }
.perfil-resumo { display: flex; align-items: center; gap: .9rem; }
.perfil-resumo .avatar { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; border: 2px solid var(--dourado); }
.perfil-resumo .fim-tit { font-family: var(--f-titulo); font-weight: 700; font-size: 1.2rem; color: var(--bordo); }
.perfil-resumo a { color: var(--bordo); font-weight: 600; }

/* ── Teste com aprovação do Mestre Cruz ─────────── */
.pergunta-teste { border: 0; border-bottom: 1px solid var(--linha); padding: 0 0 1rem; margin: 0 0 1.1rem; }
.pergunta-teste legend { font-weight: 600; font-size: 1.02rem; padding: 0; margin-bottom: .5rem; line-height: 1.45; }
.opcao-teste { display: flex; align-items: flex-start; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--linha); border-radius: 10px; margin: 0 0 .45rem; cursor: pointer; background: #fff; line-height: 1.45; }
.opcao-teste input { width: auto; margin-top: .25rem; flex-shrink: 0; accent-color: var(--bordo); }
.opcao-teste:has(input:checked) { border-color: var(--bordo); background: #fbf2e8; }
.subtitulo { font-family: var(--f-titulo); font-size: 1.25rem; color: var(--bordo); margin: 1.2rem 0 .6rem; }
.revisao-teste { padding-left: 1.3rem; margin: 0 0 1.2rem; }
.revisao-teste li { margin: 0 0 1rem; padding: .2rem 0 0 .2rem; }
.revisao-teste .rev-perg { font-weight: 600; margin: 0 0 .25rem; }
.revisao-teste .rev-resp { margin: 0 0 .15rem; font-size: .95rem; }
.revisao-teste li.certa .rev-resp:first-of-type { color: #24572a; }
.revisao-teste li.errada .rev-resp:first-of-type { color: #8f1d1d; }
.revisao-teste .rev-expl { margin: .25rem 0 0; font-size: .9rem; color: var(--texto-2); font-style: italic; }

/* ── Admin: perfis e testes ─────────────────────── */
.filtros { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .9rem; }
.filtro { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--linha); background: #fff; font-size: .88rem; color: var(--texto-2); text-decoration: none; }
.filtro.ativo { background: var(--bordo); border-color: var(--bordo); color: #fff; }
.admin-fotos { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin: 0 0 1.2rem; max-width: 30rem; }
.admin-fotos figure { margin: 0; text-align: center; }
.admin-fotos img, .admin-fotos .foto-previa { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--linha); display: block; }
.admin-fotos figcaption { font-size: .85rem; margin-top: .3rem; color: var(--texto-2); }
.admin-decisao textarea { width: 100%; }
.botoes-lado { display: flex; gap: .6rem; flex-wrap: wrap; }
.botoes-lado .btn { flex: 1; min-width: 140px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
@media print { .palavra-mestre { background: none; } }

/* ── O meu Diário ───────────────────────────────── */
.diario-consentimento ul { margin: 0 0 1rem; padding-left: 1.3rem; line-height: 1.6; }
.caixa-aceito { display: flex; gap: .6rem; align-items: flex-start; margin: 0 0 1rem; line-height: 1.5; cursor: pointer; }
.caixa-aceito input { width: auto; margin-top: .3rem; accent-color: var(--bordo); flex-shrink: 0; }
.diario-linha { display: grid; gap: 0 1rem; }
@media (min-width: 640px) { .diario-linha { grid-template-columns: 11rem 1fr; } }
.opcional { font-weight: 400; color: var(--texto-2); font-size: .88rem; }
.link-botao { background: none; border: 0; padding: 0; margin-top: .4rem; color: var(--bordo); font: inherit; font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.diario-resumo p { margin: 0 0 .6rem; }
.diario-resumo p:last-child { margin-bottom: 0; }
.entrada-diario { scroll-margin-top: 90px; }
.entrada-data { font-family: var(--f-titulo); font-variant: small-caps; letter-spacing: .06em; color: var(--dourado-esc); font-weight: 700; margin: 0 0 .2rem; }
.entrada-tit { font-family: var(--f-titulo); color: var(--bordo); font-size: 1.25rem; margin: 0 0 .5rem; }
.entrada-texto { line-height: 1.7; white-space: normal; overflow-wrap: anywhere; }
.entrada-acoes { display: flex; gap: 1rem; align-items: center; margin-top: .8rem; padding-top: .6rem; border-top: 1px solid var(--linha); font-size: .9rem; }
.entrada-acoes a { color: var(--bordo); text-decoration: underline; text-underline-offset: 3px; }
.entrada-acoes form { margin: 0; }
.entrada-acoes .remover { background: none; border: none; color: #8f1d1d; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.diario-atalho { display: flex; align-items: center; gap: .9rem; text-decoration: none; color: inherit; }
.diario-atalho:hover { border-color: var(--dourado); }
.diario-icone { width: 48px; height: 48px; border-radius: 50%; background: var(--bordo); color: #f0d98f; display: grid; place-items: center; font-size: 1.4rem; flex-shrink: 0; }
.diario-atalho strong { font-family: var(--f-titulo); font-size: 1.2rem; color: var(--bordo); }
.diario-atalho small { color: var(--texto-2); font-size: .9rem; }

/* ── Perfil: "Porque queres aprender?" (admin) ── */
.resposta-aluno { margin: 0 0 1.2rem; padding: .9rem 1rem; background: var(--papel-2); border-left: 4px solid var(--dourado); border-radius: 0 var(--raio) var(--raio) 0; line-height: 1.6; white-space: normal; }

/* ── Fim do curso: diário encadernado e diploma ── */
.btn-pequeno { padding: .45rem .9rem; font-size: .9rem; margin-left: .3rem; vertical-align: middle; }
.passos-fim { margin: 0 0 1rem; padding-left: 1.3rem; line-height: 1.6; }
.passos-fim li { margin-bottom: .7rem; }
.foto-diploma { margin: 0 0 1rem; }
.foto-diploma img { display: block; width: 100%; max-width: 22rem; height: auto; border-radius: 10px; border: 1px solid var(--linha); }
.form-diploma label { display: block; font-weight: 600; margin-bottom: .4rem; }
.form-diploma input[type=file] { display: block; width: 100%; margin-bottom: .3rem; }

/* ── Verificar diploma ── */
.form-verificar label { display: block; font-weight: 600; margin-bottom: .5rem; }
.linha-verificar { display: flex; gap: .5rem; flex-wrap: wrap; }
.linha-verificar input { flex: 1 1 14rem; text-transform: uppercase; letter-spacing: .06em; font-family: ui-monospace, Consolas, monospace; }
.resultado-verificar { line-height: 1.7; }
