/* Visual da ficha estilo RPG — usado na edição (app) e na impressão (PDF). */

@font-face { font-family: 'Cinzel'; font-weight: 400; src: url('/fonts/cinzel/cinzel-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-weight: 600; src: url('/fonts/cinzel/cinzel-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-weight: 700; src: url('/fonts/cinzel/cinzel-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-weight: 800; src: url('/fonts/cinzel/cinzel-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-weight: 400; src: url('/fonts/garamond/eb-garamond-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-weight: 400; font-style: italic; src: url('/fonts/garamond/eb-garamond-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-weight: 600; src: url('/fonts/garamond/eb-garamond-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-weight: 700; src: url('/fonts/garamond/eb-garamond-latin-700-normal.woff2') format('woff2'); }

:root {
  --papel: #f3ebdf;
  --caixa: #f6f1e8;
  --tinta: #2b2622;
  --tinta-2: #6f665c;
  --verde: #2f5d46;
  --verde-claro: #dce8df;
  --vermelho: #8e3b2c;
  --ouro: #b0802f;
  --ouro-claro: #f3e2bf;
  --linha: #cdb68f;
  --borda: #3a332c;
  --serif: 'EB Garamond', Garamond, Georgia, serif;
  --caps: 'Cinzel', 'Trajan Pro', Georgia, serif;
}

.ficha {
  position: relative;
  background: var(--papel);
  color: var(--tinta);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.3;
  border: 1.5px solid var(--borda);
  outline: 1px solid var(--borda);
  outline-offset: 4px;
  padding: 22px 22px 14px;
  margin: 10px 6px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ficha::before, .ficha::after,
.ficha > .f-head::before, .ficha > .f-head::after {
  content: '';
  position: absolute;
  width: 11px; height: 11px;
  background: var(--papel);
  border: 1.3px solid var(--borda);
  transform: rotate(45deg);
}
.ficha::before { top: -11px; left: -11px; }
.ficha::after { top: -11px; right: -11px; }
.ficha > .f-head::before { bottom: -11px; left: -11px; }
.ficha > .f-head::after { bottom: -11px; right: -11px; }
/* os losangos de baixo usam o rodapé como âncora */
.ficha > .f-head { position: static; }
.ficha > .f-head::before, .ficha > .f-head::after { top: auto; bottom: -11px; }

/* ---------- Topo ---------- */
.f-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--borda);
}
.f-seal {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: var(--verde-claro);
  border: 1.2px solid var(--verde);
  color: var(--verde);
  display: grid; place-items: center;
}
.f-seal svg { width: 30px; height: 30px; }
.f-kicker {
  font-family: var(--caps);
  color: var(--verde);
  font-size: 10.5px;
  letter-spacing: .32em;
  font-weight: 600;
  text-transform: uppercase;
}
.f-name {
  font-family: var(--caps);
  font-weight: 800;
  font-size: 34px;
  line-height: 1.05;
  margin: 2px 0 3px;
  font-variant: small-caps;
}
.f-sub { font-style: italic; color: var(--tinta-2); font-size: 14.5px; letter-spacing: .02em; }
.f-brand { text-align: right; }
.f-brand-name { font-family: var(--caps); font-weight: 700; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.f-brand-city { font-style: italic; color: var(--tinta-2); font-size: 13px; }

/* ---------- Linha de informações ---------- */
.f-info {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 1.2px solid var(--borda);
  background: var(--caixa);
}
.f-info > div { padding: 6px 9px 8px; border-left: 1px solid var(--linha); min-width: 0; }
.f-info > div:first-child { border-left: 0; }
.f-info label, .f-attr label { display: block; }
.f-info label, .f-attr label, .f-skills th, .f-diario th {
  font-family: var(--caps);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tinta-2);
  font-weight: 600;
}
.f-info b { display: block; font-weight: 700; font-size: 15px; margin-top: 2px; overflow-wrap: anywhere; }

.f-fase { display: flex; gap: 5px; margin-top: 4px; }
.fase {
  width: 21px; height: 21px;
  border-radius: 50%;
  border: 1.2px solid var(--tinta);
  display: inline-grid; place-items: center;
  font-family: var(--caps); font-size: 10px; font-weight: 700;
  background: transparent; color: var(--tinta); padding: 0;
}
.fase.on { background: var(--verde); border-color: var(--verde); color: #fff; }

/* ---------- Caixas ---------- */
.f-box {
  position: relative;
  border: 1.2px solid var(--borda);
  padding: 16px 13px 10px;
  margin-top: 7px;
  min-width: 0;
}
.f-box > h3 {
  position: absolute;
  top: -9px; left: 10px;
  margin: 0;
  padding: 0 6px;
  background: var(--papel);
  font-family: var(--caps);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  line-height: 16px;
}
.f-box > .f-hint {
  position: absolute;
  top: -8px; right: 10px;
  padding: 0 6px;
  background: var(--papel);
  font-style: italic;
  font-size: 11px;
  line-height: 14px;
  color: var(--tinta-2);
}

.f-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.f-cols-attr { grid-template-columns: 5fr 8fr; }
.f-grow { flex: 1; }

/* ---------- Listas com losango ---------- */
.dia {
  display: inline-block;
  width: 9px; height: 9px;
  transform: rotate(45deg);
  flex: none;
}
.dia.verde { background: var(--verde); }
.dia.vermelho { background: var(--vermelho); }

.f-list { list-style: none; margin: 0; padding: 0; }
.f-list li {
  display: flex; align-items: center; gap: 10px;
  min-height: 25px;
  border-bottom: 1px dashed var(--linha);
  padding: 2px 0;
}
.f-list li > span { flex: 1; }

/* ---------- Texto livre com linhas ---------- */
.f-area {
  --lh: 27px;
  display: block;
  width: 100%;
  min-height: calc(var(--lh) * var(--linhas, 3));
  line-height: var(--lh);
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--lh) - 1px), var(--linha) calc(var(--lh) - 1px) var(--lh));
  background-attachment: local;
  white-space: pre-wrap;
}
.f-blank { display: none; }
.f-grow .f-area { min-height: calc(var(--lh) * var(--linhas, 3)); }

/* ---------- Atributos ---------- */
.f-attr { padding: 3px 0 4px; border-bottom: 1px dashed var(--linha); }
.f-attr label { font-size: 10.5px; color: var(--tinta); margin-bottom: 2px; }
.f-diamonds { display: flex; gap: 6px; padding: 3px 0 2px 3px; }
.f-diamonds .dia { width: 10px; height: 10px; border: 1.2px solid var(--verde); background: transparent; }
.f-diamonds .dia.on { background: var(--verde); }
.f-note { font-style: italic; font-size: 11.5px; color: var(--tinta-2); margin: 6px 0 0; }

/* ---------- Habilidades ---------- */
.f-skills { width: 100%; border-collapse: collapse; }
.f-skills th { text-align: left; padding: 0 0 5px; font-size: 9px; }
.f-skills th:not(:first-child) { text-align: center; width: 17%; }
.f-skills td { border-bottom: 1px dashed var(--linha); padding: 2px 0; height: 22px; }
.f-skills td.c { text-align: center; }
.f-skills th .sm { display: none; }
.dot {
  display: inline-block;
  width: 14px; height: 14px;
  border: 1.2px solid var(--tinta);
  border-radius: 50%;
  background: transparent;
  padding: 0;
  vertical-align: middle;
}
.dot.on { border-color: var(--verde); background: radial-gradient(circle, var(--verde) 0 3.5px, transparent 4px); }

/* ---------- Missões ---------- */
.f-missoes { list-style: none; margin: 0; padding: 0; }
.f-missoes li {
  display: flex; align-items: flex-start; gap: 10px;
  border-bottom: 1px dashed var(--linha);
  padding: 4px 0;
  min-height: 27px;
}
.f-missoes .num { font-family: var(--caps); font-weight: 700; color: var(--ouro); width: 22px; flex: none; font-size: 14px; }
.check {
  width: 14px; height: 14px; flex: none;
  border: 1.2px solid var(--tinta);
  margin-top: 3px;
  background: transparent; padding: 0;
  display: inline-grid; place-items: center;
}
.check.on { background: var(--verde); border-color: var(--verde); }
.check.on::after { content: ''; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.m-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.m-txt .obs { font-style: italic; font-size: 12.5px; color: var(--tinta-2); }

/* ---------- Conquistas ---------- */
.f-conquistas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  min-width: 0; min-height: 30px;
  padding: 3px 12px 3px 5px;
  border: 1.2px dashed var(--ouro);
  border-radius: 999px;
}
.pill.on { border-style: solid; background: var(--ouro-claro); }
.pill > span { font-family: var(--caps); font-weight: 700; font-size: 11px; letter-spacing: .06em; }
.medal { width: 18px; height: 18px; border-radius: 50%; border: 1.2px solid var(--ouro); flex: none; }
.pill.on .medal { background: radial-gradient(circle, var(--ouro) 0 5px, transparent 5.5px); }

/* ---------- Diário ---------- */
.f-diario { width: 100%; border-collapse: collapse; }
.f-diario th { text-align: left; font-size: 9px; padding: 0 8px 5px 0; border-bottom: 1.2px solid var(--linha); }
.f-diario th:first-child { width: 14%; }
.f-diario th:nth-child(2) { width: 34%; }
.f-diario td { border-bottom: 1.2px solid var(--linha); padding: 3px 8px 3px 0; height: 26px; vertical-align: top; }

/* ---------- Rodapé ---------- */
.f-foot {
  display: flex; justify-content: space-between;
  border-top: 1.2px solid var(--linha);
  padding-top: 6px;
  font-style: italic; font-size: 12px; color: var(--tinta-2);
  margin-top: auto;
}

/* ---------- Integrantes ---------- */
.f-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.f-card {
  border: 1.2px solid var(--borda);
  background: var(--caixa);
  padding: 9px 12px;
  min-height: 60px;
  display: flex; flex-direction: column; justify-content: center;
  color: inherit; text-decoration: none;
}
.f-card strong { font-family: var(--caps); font-weight: 800; font-size: 19px; font-variant: small-caps; }
.f-card em { color: var(--tinta-2); font-size: 13px; }

/* ================= Impressão (PDF) ================= */
@page { size: A4; margin: 0; }
body.print { margin: 0; background: var(--papel); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
body.print .ficha {
  width: 210mm;
  min-height: 297mm;
  box-sizing: border-box;
  margin: 0;
  padding: 16mm 12mm 9mm;
  border: 0;
  outline: 0;
  break-after: page;
  background:
    linear-gradient(var(--borda), var(--borda)) 6mm 6mm / calc(100% - 12mm) 1.5px no-repeat,
    linear-gradient(var(--borda), var(--borda)) 6mm calc(100% - 6mm) / calc(100% - 12mm) 1.5px no-repeat,
    linear-gradient(var(--borda), var(--borda)) 6mm 6mm / 1.5px calc(100% - 12mm) no-repeat,
    linear-gradient(var(--borda), var(--borda)) calc(100% - 6mm) 6mm / 1.5px calc(100% - 12mm) no-repeat,
    linear-gradient(var(--borda), var(--borda)) 7.6mm 7.6mm / calc(100% - 15.2mm) .8px no-repeat,
    linear-gradient(var(--borda), var(--borda)) 7.6mm calc(100% - 7.6mm) / calc(100% - 15.2mm) .8px no-repeat,
    linear-gradient(var(--borda), var(--borda)) 7.6mm 7.6mm / .8px calc(100% - 15.2mm) no-repeat,
    linear-gradient(var(--borda), var(--borda)) calc(100% - 7.6mm) 7.6mm / .8px calc(100% - 15.2mm) no-repeat,
    var(--papel);
}
body.print .f-grow { display: flex; flex-direction: column; }
body.print .f-grow > .f-area { flex: 1; }
body.print .ficha:last-child { break-after: auto; }
body.print .ficha::before { top: calc(6mm - 5px); left: calc(6mm - 5px); }
body.print .ficha::after { top: calc(6mm - 5px); right: calc(6mm - 5px); }
body.print .ficha > .f-head::before { bottom: calc(6mm - 5px); left: calc(6mm - 5px); }
body.print .ficha > .f-head::after { bottom: calc(6mm - 5px); right: calc(6mm - 5px); }
body.print .f-box, body.print .f-info, body.print tr, body.print li { break-inside: avoid; }

/* Escala de impressão: mesma densidade do modelo original em A4 */
body.print .ficha { font-size: 12.5px; gap: 7px; }
body.print .f-head { padding-bottom: 9px; }
body.print .f-name { font-size: 29px; }
body.print .f-seal { width: 54px; height: 54px; }
body.print .f-info b { font-size: 13px; }
body.print .f-box { padding: 12px 11px 7px; margin-top: 6px; }
body.print .f-box > h3 { font-size: 10.5px; }
body.print .f-list li { min-height: 21px; padding: 1px 0; }
body.print .f-area { --lh: 22px; }
body.print .f-attr { padding: 2px 0 3px; }
body.print .f-attr label { font-size: 9.5px; }
body.print .f-skills td { height: 19px; padding: 1px 0; }
body.print .dot { width: 12px; height: 12px; }
body.print .dot.on { background: radial-gradient(circle, var(--verde) 0 3px, transparent 3.5px); }
body.print .f-missoes li { min-height: 22px; padding: 2px 0; }
body.print .f-missoes .num { font-size: 12.5px; }
body.print .m-txt .obs { font-size: 10.5px; }
body.print .pill { min-height: 25px; }
body.print .f-diario td { height: 21px; padding: 2px 8px 2px 0; }
body.print .f-card { min-height: 50px; padding: 7px 11px; }
body.print .f-card strong { font-size: 16px; }
body.print .f-card em { font-size: 11.5px; }
body.print .f-foot { font-size: 10.5px; }

/* ================= Plano de aula ================= */
.pl-orientacao p { margin: 0; line-height: 1.4; }
.pl-estrutura { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.pl-passo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pl-passo b { font-family: var(--caps); font-size: 10.5px; font-weight: 700; color: var(--verde); letter-spacing: .04em; }
.pl-passo span { font-size: 13px; line-height: 1.25; }

.pl-sessao { padding-top: 18px; }
.pl-head {
  position: absolute; top: -10px; left: 10px; right: 10px;
  display: flex; align-items: center; gap: 0;
  pointer-events: none;
}
.pl-head > * { background: var(--papel); pointer-events: auto; }
.pl-head .check { margin: 0 0 0 5px; box-shadow: 0 0 0 5px var(--papel); }
.pl-num { font-family: var(--caps); font-weight: 700; color: var(--ouro); font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; padding: 0 5px 0 10px; }
.pl-titulo { font-family: var(--caps); font-weight: 700; font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; padding-right: 6px; }
.pl-data { margin-left: auto; font-style: italic; font-size: 11px; color: var(--tinta-2); padding: 0 6px; }
.pl-item {
  display: grid; grid-template-columns: 105px 1fr; gap: 10px; align-items: baseline;
  border-bottom: 1px dashed var(--linha);
  padding: 3px 0;
}
.pl-item:last-child { border-bottom: 0; }
.pl-quem { font-family: var(--caps); font-weight: 700; font-size: 10px; letter-spacing: .06em; color: var(--verde); text-transform: uppercase; }
.pl-tarefa .pl-quem { color: var(--ouro); }
.pl-sessao.feita .pl-num { color: var(--verde); }

.f-head-cont { grid-template-columns: 1fr auto; padding-bottom: 6px; }
.f-head-cont .f-name { font-size: 22px; }

body.print .pl-pagina { height: 297mm; min-height: 0; overflow: hidden; }
body.print .pl-corpo { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 9px; padding-top: 2px; }
body.print .pl-corpo > .pl-obs { flex: 1; display: flex; flex-direction: column; min-height: 130px; }
body.print .pl-corpo > .pl-obs .f-area { flex: 1; }
body.print .pl-item { padding: 2px 0; }
body.print .pl-orientacao p { font-size: 13px; }
