/* Flashcards (js/flashcards.js): a entrada (hoje + baralhos), o baralho, a revisão em tela de foco, o fim da sessão e
   as caixas "Novo flashcard" e "Gerar flashcards". Só o que é desta tela: tokens e peças vêm do base.css
   (docs/design.md). Nenhuma cor escrita à mão. Entra na página pela tabela de rotas (js/rotas.js) e pelo app.html
   (a caixa "Gerar flashcards" também abre de dentro da aula).
   As notas (.fc-notas / .fc-nota) também servem ao revisar falando (js/voz.js). */

/* ===== entrada e baralho: o cartão "hoje" ===== */
.fc-hoje { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 18px; }
/* o contador de pendentes: a placa do sistema, um ponto maior (é o número da tela) */
.fc-hoje > .placa { min-width: 88px; min-height: 88px; border-radius: 20px; }
.fc-hoje > .placa b { font-size: 36px; }
.fc-hoje > .placa.fc-zerada { border-bottom-color: var(--linha-media); background: var(--superficie-3); color: var(--texto-2); }
.fc-hoje > .mascote { width: 88px; }
.fc-hoje-texto { display: grid; flex: 1 1 170px; gap: 4px; min-width: 0; }
.fc-hoje-texto h2 { font-size: 18px; letter-spacing: -.01em; line-height: 1.25; }
.fc-hoje-texto p { color: var(--texto-3); font-size: 14px; line-height: 1.45; text-wrap: pretty; }
.fc-hoje-texto small { color: var(--texto-3); font-size: 13px; line-height: 1.45; }
/* (os botões têm a borda de baixo por fora: 4px livres aqui, mais o respiro do cartão) */
.fc-hoje-acoes { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 4px; }
@media (max-width: 640px) {
  .fc-hoje-acoes { flex: 1 1 100%; }
  .fc-hoje-acoes .btn { flex: 1 1 auto; }
}

/* o baralho dos erros de simulado, em destaque: vinho suave, com o ícone num bloco vinho cheio */
.fc-erros {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 14px 16px;
  border: var(--bw) solid var(--acento-linha);
  border-radius: var(--raio-4);
  background: var(--acento-suave);
  color: inherit;
  text-decoration: none;
  transition: border-color .15s;
}
.fc-erros .caixa-ic { background: var(--vinho); color: var(--sobre-vinho); }
.fc-erros .lista-linha-texto small { color: var(--texto-2); }
.fc-erros .etiqueta { flex: none; background: var(--vinho); color: var(--sobre-vinho); }
.fc-erros > .ic:last-child { flex: none; width: 18px; height: 18px; color: var(--acento); stroke-width: 2.4; }
@media (hover: hover) { .fc-erros:hover { border-color: var(--acento); } }

.fc-baralhos .etiqueta { flex: none; }
/* no computador o "N pra revisar" fica no lugar da setinha */
@media (min-width: 641px) { .fc-baralhos .etiqueta + .ic { display: none; } }
/* no celular ele desce pro lado da conta dos cartões (do lado do nome quebrava "Direito / Civil") e a setinha volta */
@media (max-width: 640px) {
  .fc-baralhos .lista-linha:has(> .etiqueta) { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-content: center; column-gap: 14px; row-gap: 4px; }
  .fc-baralhos .lista-linha:has(> .etiqueta) > .caixa-ic { grid-area: 1 / 1 / 3 / 2; }
  .fc-baralhos .lista-linha:has(> .etiqueta) > .lista-linha-texto { display: contents; }
  .fc-baralhos .lista-linha:has(> .etiqueta) b { grid-area: 1 / 2 / 2 / 4; }
  .fc-baralhos .lista-linha:has(> .etiqueta) small { grid-area: 2 / 2 / 3 / 3; margin-top: 0; }
  .fc-baralhos .lista-linha > .etiqueta { grid-area: 2 / 3 / 3 / 4; justify-self: start; margin-left: -4px; }
  .fc-baralhos .lista-linha > .etiqueta + .ic { grid-area: 1 / 4 / 3 / 5; }
}
.fc-ver-todos { justify-self: start; }
.fc-dica-pe { max-width: 62ch; margin-inline: auto; color: var(--texto-3); font-size: 13.5px; line-height: 1.45; text-align: center; text-wrap: balance; }

/* ===== o baralho: a lista dos cartões ===== */
.fc-busca { max-width: 420px; }
.fc-lista { display: grid; gap: 22px; }
.fc-lista > * { min-width: 0; }
.fc-grupo { display: grid; gap: 8px; }
.fc-grupo-t { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 4px; font-size: 15.5px; font-weight: 600; line-height: 1.35; }
.fc-grupo-t a { min-width: 0; margin: -12px 0; padding: 12px 0; color: var(--texto); text-decoration: none; overflow-wrap: anywhere; }
@media (hover: hover) { .fc-grupo-t a:hover { text-decoration: underline; text-decoration-color: var(--acento-linha); text-underline-offset: 3px; } }
.fc-grupo-t small { flex: none; color: var(--texto-3); font-family: var(--fonte-texto); font-size: 13px; font-weight: 400; }
.fc-itens { display: grid; margin: 0; padding: 0; overflow: hidden; border: var(--bw) solid var(--linha); border-radius: var(--raio-4); background: var(--superficie); list-style: none; }
.fc-itens > li + li { border-top: var(--bw-fio) solid var(--linha); }
.fc-item { display: flex; align-items: flex-start; gap: 6px; padding: 14px 8px 14px 16px; }
.fc-item-txt { display: grid; flex: 1; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
/* na lista a pergunta serve pra achar o cartão: a comprida (enunciado de simulado) corta em 4 linhas */
.fc-item-frente { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; font-family: var(--fonte-titulo); font-size: 15.5px; font-weight: 600; line-height: 1.4; }
.fc-item-verso { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; color: var(--texto-2); font-size: 15px; line-height: 1.45; white-space: pre-line; }
.fc-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; color: var(--texto-3); font-size: 13px; }
.fc-nada { padding: 0 4px; color: var(--texto-3); }
/* no celular, um botão por linha (lado a lado os dois não cabem, e um embaixo do outro em larguras diferentes desalinha) */
@media (max-width: 640px) { .fc-ferramentas-baralho .btn { flex: 1 1 100%; } }
.fc-mostrar-mais { justify-self: center; margin-bottom: 8px; }

/* ===== revisão (tela de foco, coluna de 560) ===== */
/* (o "voltar" do cabeçalho acompanha a coluna estreita pela regra geral do app.css) */
.fc-sessao { gap: 14px; }
.fc-cabeca { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.fc-conta .num { font-weight: 600; }
.fc-ferramentas { display: flex; gap: 2px; margin-right: -6px; }
.fc-barra { margin-top: -4px; }

/* a mesa guarda 12px embaixo pro monte: os cartões que faltam aparecem por baixo, em até duas beiradas, e o monte
   afina até sumir no último (data-resto = 0, 1 ou 2, posto pelo JS). Só borda, sem sombra. */
.fc-mesa { position: relative; padding-bottom: 12px; perspective: 1600px; }
.fc-mesa::before, .fc-mesa::after {
  content: "";
  position: absolute;
  border: var(--bw) solid var(--linha-media);
  border-radius: var(--raio-cartao);
  background: var(--superficie);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
/* cada beirada é um cartão inteiro, um pouco menor: quando o de cima sai, é o de baixo que fica à vista */
.fc-mesa::before { z-index: -1; inset: 12px 12px 6px; }
.fc-mesa::after { z-index: -2; inset: 24px 24px 0; }
.fc-mesa:is([data-resto="1"], [data-resto="2"])::before, .fc-mesa[data-resto="2"]::after { opacity: 1; }
.fc-cartao {
  display: grid;
  min-height: clamp(280px, 50vh, 420px);
  border-radius: var(--raio-cartao);
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform .5s var(--ease);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
/* o anel de foco vai por dentro do cartão (por fora ele encostava na barra de cima e passava por cima do monte)
   e fica na face à mostra: as faces são opacas e tampariam um anel desenhado no cartão. Só com o teclado em uso
   (.fc-teclado, posta pelo JS): o cartão recebe o foco sozinho, e sem isso o anel acendia ao abrir pelo endereço */
.fc-cartao:focus-visible { outline: none; }
.fc-teclado .fc-cartao:focus-visible .fc-face { outline: 3px solid var(--foco); outline-offset: -7px; }
.fc-cartao.virado { transform: rotateY(180deg); }
.fc-face {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 20px 22px;
  border: var(--bw) solid var(--linha-media);
  border-radius: var(--raio-cartao);
  background: var(--superficie);
  overflow-wrap: anywhere;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transition: border-color .15s;
}
@media (hover: hover) { .fc-cartao:hover .fc-face { border-color: var(--linha-forte); } }
@media (max-width: 640px) {
  .fc-face { padding: 18px 18px 16px; border-radius: var(--raio-4); }
  .fc-cartao, .fc-mesa::before, .fc-mesa::after { border-radius: var(--raio-4); }
}
.fc-verso { transform: rotateY(180deg); }
.fc-face-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; }
.fc-face-topo .etiqueta { flex: none; margin-left: auto; }
.fc-disc { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--texto-2); font-family: var(--fonte-titulo); font-size: 13.5px; font-weight: 500; line-height: 1.3; }
.fc-disc > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-disc .bolinha-cor { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--cor, var(--rubi)); }
.fc-miolo { display: grid; flex: 1; align-content: center; justify-items: center; gap: 10px; padding: 6px 0; text-align: center; }
.fc-miolo .sobretitulo { color: var(--texto-3); }
.fc-pergunta { font-family: var(--fonte-titulo); font-size: clamp(21px, 5.6vw, 27px); font-weight: 600; letter-spacing: -.01em; line-height: 1.3; text-wrap: balance; white-space: pre-line; }
.fc-resposta { font-family: var(--fonte-titulo); font-size: clamp(19px, 5vw, 23px); font-weight: 500; line-height: 1.42; text-wrap: pretty; white-space: pre-line; }
/* texto comprido (o cartão de erro de simulado traz a resposta com o fundamento): letra de ler, à esquerda */
.fc-pergunta.longa { font-size: clamp(17px, 4.6vw, 20px); line-height: 1.4; text-wrap: pretty; }
.fc-resposta.longa { justify-self: stretch; font-family: var(--fonte-texto); font-size: 17px; font-weight: 400; line-height: 1.55; text-align: left; }
.fc-toque { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--texto-3); font-size: 13.5px; }
.fc-toque .ic { width: 17px; height: 17px; }
.fc-so-tecla { display: none; }
@media (hover: hover) and (pointer: fine) { .fc-so-toque { display: none; } .fc-so-tecla { display: inline; } }

.fc-pergunta-mini { padding-bottom: 12px; border-bottom: var(--bw-fio) dashed var(--linha-media); color: var(--texto-3); font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.fc-explicacao { display: grid; gap: 3px; padding: 12px 14px; border: var(--bw-fio) solid var(--linha); border-radius: var(--raio-2); background: var(--superficie-2); }
.fc-explicacao b { color: var(--texto-3); font-family: var(--fonte-titulo); font-size: 12px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.fc-explicacao p { color: var(--texto-2); font-size: 15px; line-height: 1.5; white-space: pre-line; }
.fc-origem { display: flex; align-items: flex-start; gap: 8px; color: var(--texto-3); font-size: 13px; line-height: 1.4; }
.fc-origem .ic { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.fc-origem q { display: block; margin-top: 2px; font-style: italic; }

/* entrada e saída de cada cartão (curtas: respondem ao toque) */
.fc-entra { animation: fc-entra .3s var(--ease) both; }
.fc-volta { animation: fc-volta .3s var(--ease) both; }
.fc-cartao.fc-sai { animation: fc-sai .24s var(--ease) both; }
.fc-cartao.fc-sai-errei { animation: fc-sai-errei .24s var(--ease) both; }
@keyframes fc-entra { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes fc-volta { from { opacity: 0; transform: translateX(-36px); } }
@keyframes fc-sai { to { opacity: 0; transform: rotateY(180deg) translateX(-56px); } }
@keyframes fc-sai-errei { to { opacity: 0; transform: rotateY(180deg) translateY(26px); } }

/* botões embaixo: no celular ficam presos no alcance do polegar (a barra de abas some na tela de foco) */
.fc-acoes { padding-bottom: 8px; }
@media (max-width: 899px) {
  .fc-acoes { position: sticky; bottom: 0; z-index: 2; padding: 10px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--fundo); }
}
.fc-ver { min-height: 58px; }
.fc-notas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; animation: aparece .26s var(--ease) both; }
.fc-nota {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  min-height: 66px;
  padding: 8px 4px;
  border: var(--bw) solid var(--linha-media);
  border-bottom-width: 3px;
  border-radius: var(--raio-3);
  background: var(--campo);
  color: var(--texto);
  transition: background-color .15s, border-color .15s, transform .09s ease-out;
  touch-action: manipulation;
}
.fc-nota b { display: inline-flex; align-items: center; gap: 6px; font-family: var(--fonte-titulo); font-size: 16px; font-weight: 600; line-height: 1.1; }
.fc-nota small { color: var(--texto-2); font-family: var(--fonte-titulo); font-size: 12.5px; font-variant-numeric: tabular-nums; font-weight: 500; line-height: 1.1; }
/* a cor de cada nota fica numa bolinha antes da palavra (nunca só cor: a palavra está ali); a escolhida ganha o suave */
.fc-nota b::before, .fc-dadas span::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--texto-3); }
.fc-nota.errei b::before, .fc-dadas .errei span::before { background: var(--erro); }
.fc-nota.dificil b::before, .fc-dadas .dificil span::before { background: var(--atencao); }
.fc-nota.bom b::before, .fc-dadas .bom span::before { background: var(--bom); }
.fc-nota.facil b::before, .fc-dadas .facil span::before { background: var(--info-texto); }
@media (hover: hover) { .fc-nota:not(:disabled, .escolhida):hover { background: var(--superficie-2); } }
.fc-nota:not(:disabled):active { transform: translateY(1px); }
.fc-nota:disabled { cursor: default; opacity: .55; }
.fc-nota.escolhida { opacity: 1; transform: translateY(1px); }
.fc-nota.errei.escolhida { border-color: var(--erro-linha); background: var(--erro-suave); }
.fc-nota.dificil.escolhida { border-color: var(--ouro-linha); background: var(--atencao-suave); }
.fc-nota.bom.escolhida { border-color: var(--bom); background: var(--bom-suave); }
.fc-nota.facil.escolhida { border-color: var(--info-texto); background: var(--info-suave); }
.fc-tecla { display: none; }
/* o número da tecla só com mouse e botão largo (em botão estreito ele tampava a primeira letra da nota) */
@media (hover: hover) and (pointer: fine) and (min-width: 560px) {
  .fc-tecla {
    position: absolute;
    top: 6px;
    left: 7px;
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border: var(--bw-fio) solid var(--linha-media);
    border-radius: 5px;
    background: var(--superficie-2);
    color: var(--texto-3);
    font: 600 11px/1 var(--fonte-titulo);
  }
  .fc-nota { min-height: 72px; }
}
@media (max-width: 360px) { .fc-notas { gap: 6px; } .fc-nota b { gap: 4px; font-size: 14.5px; } .fc-nota b::before { width: 8px; height: 8px; } }

.fc-dica { display: none; }
@media (hover: hover) and (pointer: fine) {
  .fc-dica { display: block; margin-top: -2px; color: var(--texto-3); font-size: 13px; text-align: center; }
}
.fc-dica kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0 .45em;
  border: var(--bw-fio) solid var(--linha-media);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--superficie-2);
  color: var(--texto-2);
  font: 600 .88em/1.55 var(--fonte-titulo);
  text-align: center;
}

/* nada pra hoje (dentro da tela de foco) */
.fc-sub { color: var(--texto-3); font-size: 15px; }

/* ===== fim da sessão ===== */
.fc-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 2px 0; line-height: 1; }
.fc-total .num { font-size: clamp(54px, 15vw, 76px); letter-spacing: -.03em; line-height: 1; }
.fc-total small { color: var(--texto-2); font-family: var(--fonte-titulo); font-size: 18px; font-weight: 600; }
.fc-frase { color: var(--texto-2); font-size: 15.5px; text-wrap: pretty; }
/* fichas e missões: embaixo do número e do Zero, na largura toda do cartão */
.fc-placar > :is(.fc-fichas, .fc-ganhos) { grid-column: 1 / -1; }
.fc-fichas { align-items: center; margin-top: 4px; }
.fc-ganhos { display: grid; gap: 6px; margin: 4px 0 0; padding: 0; color: var(--texto-2); font-size: 14.5px; list-style: none; }
.fc-ganhos li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.fc-ganhos .ic { flex: none; width: 18px; height: 18px; color: var(--ouro-texto); }
.fc-ganhos b { color: var(--texto); font-weight: 700; }
.fc-dadas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.fc-dadas li { display: grid; justify-items: center; gap: 4px; padding: 14px 4px 12px; border: var(--bw) solid var(--linha); border-radius: 18px; background: var(--superficie); }
.fc-dadas b { font-size: 24px; line-height: 1.1; }
.fc-dadas span { display: inline-flex; align-items: center; gap: 6px; color: var(--texto-2); font-family: var(--fonte-titulo); font-size: 13px; font-weight: 500; line-height: 1.2; }
@media (max-width: 360px) { .fc-dadas span { gap: 4px; font-size: 12px; } }
@media (max-width: 640px) { .fc-fim-acoes .btn { flex: 1 1 100%; } }

/* ===== caixas ===== */
/* as duas têm formulário comprido: um pouco mais altas que a caixa padrão, pra os botões caberem sem rolar */
dialog.fc-caixa-cartao, dialog.fc-caixa-gerar { max-height: min(94dvh, 800px); }
/* novo / editar: o formulário usa a linha toda, com o texto à esquerda (a caixa é a centrada, com o ícone em cima) */
.fc-campos { justify-self: stretch; min-width: 0; margin: 0; padding: 0; border: 0; text-align: left; }
textarea.fc-campo { min-height: 0; line-height: 1.45; resize: vertical; }
.fc-apagar { display: inline-flex; align-items: center; justify-self: center; gap: 6px; margin: -6px 0 -10px; color: var(--erro-texto); text-decoration-color: var(--erro-linha); }
.fc-apagar .ic { width: 17px; height: 17px; }
/* no celular a caixa é uma folha: sem o ícone de cima, pra os campos e os botões caberem com menos rolagem */
@media (max-width: 560px) {
  .fc-caixa-cartao form .caixa-icone { display: none; }
  .fc-caixa-cartao form.caixa-corpo { gap: 12px; padding-top: 22px; }
}

.fc-caixa-gerar .caixa-corpo { gap: 16px; }
.fc-erro-texto { display: grid; gap: 4px; min-width: 0; }
/* a IA montando: o Zero pensa aqui dentro, e o da página atrás sai de cena (um mascote por tela) */
.fc-espera { display: grid; justify-items: center; gap: 6px; padding: 10px 0 12px; text-align: center; }
.fc-espera > .mascote { width: 96px; margin-bottom: 4px; }
.fc-espera-frase { min-height: 1.5em; }
.fc-espera small { color: var(--texto-3); font-size: 13.5px; }
body:has(dialog.fc-caixa-gerar[open] .zero) #tela .zero { visibility: hidden; }
.fc-pronto { display: grid; justify-items: start; gap: 6px; }
.fc-pronto h2 { font-size: 24px; }
.fc-pronto p { font-size: 15.5px; }
.fc-previa { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.fc-previa li { display: grid; gap: 3px; padding: 10px 12px; border: var(--bw-fio) solid var(--linha); border-radius: var(--raio-2); background: var(--superficie-2); font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.fc-previa b { font-family: var(--fonte-titulo); font-weight: 600; }
.fc-previa span { color: var(--texto-2); }
.caixa-corpo .fc-mais-n { margin-top: -6px; color: var(--texto-3); font-size: 14.5px; }
.caixa-corpo .fc-aviso-ia { color: var(--texto-3); font-size: 13.5px; line-height: 1.45; }
.fc-alertas { font-size: 14.5px; }
.fc-alertas-miolo { display: grid; gap: 8px; min-width: 0; }
.fc-alertas-lista { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; overflow-wrap: anywhere; }
.fc-alertas-lista q { display: block; font-style: italic; }

@media (prefers-reduced-motion: reduce) {
  .fc-cartao { transition: none; }
  .fc-cartao.virado { transform: none; }
  .fc-cartao .fc-face { transition: opacity .15s; }
  .fc-cartao.virado .fc-frente, .fc-cartao:not(.virado) .fc-verso { opacity: 0; visibility: hidden; }
  .fc-verso { transform: none; }
  .fc-entra, .fc-volta, .fc-notas { animation: none !important; }
}

@media print { .fc-acoes, .fc-dica, .fc-ferramentas { display: none; } }
