/* TesseraX — modo "Frase a frase" do leitor. Prefixo fz-. Interface sempre LTR; só o texto árabe é RTL.
   Proporção (lote D1): texto e tradução ocupam a tela; cromo = uma linha fina em cima e uma barra fina embaixo. */
.fz { --fz-bh: 52px; display: flex; flex-direction: column; min-height: calc(100dvh - var(--rdr-hh, 46px) - var(--safe-t, 0px) - var(--fz-bh) - var(--safe-b, 0px)); }

/* linha de cima: alternador de vista (dois ícones) à esquerda, ações (olho, gramática, salvar, copiar) à direita */
.fz-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; direction: ltr; }
.fz-vs { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--rad-ctl, 8px); background: color-mix(in srgb, var(--tx) 7%, transparent); }
.fz-vs button { display: grid; place-items: center; width: 42px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--mu); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fz-vs button[aria-pressed="true"] { background: var(--bg); color: var(--tx); box-shadow: inset 0 0 0 1px var(--l2); }
.fz-acts { display: flex; align-items: center; gap: 0; }
.fz-a, .fz-trh { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--rad-ctl, 8px); background: transparent; color: var(--mu); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fz-a.on, .fz-trh[aria-pressed="true"] { color: var(--tx); }
.fz-a.on { color: var(--act); }
.fz-a:active, .fz-trh:active, .fz-vs button:active { background: color-mix(in srgb, var(--tx) 9%, transparent); }
.fz-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* corpo: frase em fluxo natural e a tradução logo abaixo, em itálico discreto */
.fz-main { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 4px 2px 18px; }
.fz-sent { display: flex; flex-direction: column; gap: 8px; }
.fz .rd.fz-rd[lang] { --rd-lh: 1.5; margin: 0; padding: 0; max-width: none; }
.fz .fz-rd p { margin: 0; }
.fz .fz-rd rt { display: none; }

/* palavras em fluxo (RTL no árabe), respiro pequeno e uniforme; a leitura fica presa a cada palavra */
.fz .rd.fz-cols { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: flex-start; gap: .3em .3em; }
.fz-col { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; margin: 0; padding: 2px 0 3px; border: 0; border-radius: var(--rad-ctl, 8px); background: transparent; color: inherit; font: inherit; text-align: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fz-col:active { background: color-mix(in srgb, var(--tx) 9%, transparent); }
.fz-col:focus-visible { outline: 2px solid color-mix(in srgb, var(--ac) 55%, transparent); outline-offset: 0; }
.fz-wl { display: block; white-space: nowrap; line-height: 1.4; }
.fz-col .tk { font-size: 1em; line-height: 1.4; white-space: nowrap; }
.fz-col .tk.cur { box-shadow: none; }
.fz-pu { color: color-mix(in srgb, var(--tx) 70%, var(--mu)); }
.fz-cr { display: block; max-width: 100%; font: 500 max(11.5px, .44em)/1.25 var(--f-ui); color: var(--mu); white-space: nowrap; letter-spacing: 0; }
.fz-cr.fz-ph { visibility: hidden; }
.fz-cr .s { padding: 0; }
.fz-cr .s::before, .fz-cr .s::after { display: none; }
.fz-cr .s.st { color: var(--tx); font-weight: 700; }
.fz-cr .s[data-t="1"] { color: var(--tone1); } .fz-cr .s[data-t="2"] { color: var(--tone2); } .fz-cr .s[data-t="3"] { color: var(--tone3); } .fz-cr .s[data-t="4"] { color: var(--tone4); } .fz-cr .s[data-t="5"] { color: var(--mu); }
.fz .rd.fz-cols[data-pos="above"] .fz-col .fz-cr { order: -1; }
.fz .rd.fz-cols[data-ann="none"] .fz-cr { display: none; }
/* glosa em português sob a palavra: quebra em até duas ou três linhas, no máximo 7em, sem alargar a coluna além disso */
.fz-gl { display: block; width: max-content; max-width: 7em; margin-top: 2px; font: 500 max(12px, .4em)/1.25 var(--f-ui); color: var(--tx); text-wrap: balance; overflow-wrap: anywhere; }
.fz-gl.sk { padding: 4px 0; width: auto; }
.fz-gl.sk i { display: block; width: 2.4rem; height: 9px; border-radius: 5px; background: var(--ln); animation: fzPulse 1.2s ease-in-out infinite; }
@keyframes fzPulse { 50% { opacity: .35; } }
.fz-note { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 4px; color: var(--mu); font: 400 13.5px/1.4 var(--f-ui); text-align: center; }

/* tradução */
.fz-tr { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0 2px; direction: ltr; }
.fz-tr:empty { display: none; }
.fz-tt { margin: 0; font: italic 400 var(--fs-3, 15px)/1.5 var(--f-ui); color: color-mix(in srgb, var(--tx) 76%, var(--mu)); }
.fz-tm { margin: 0; font: 400 13.5px/1.45 var(--f-ui); color: var(--mu); }
.fz-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; align-self: flex-start; min-height: 40px; margin-top: 4px; padding: 0 14px; border: 1px solid var(--l2); border-radius: var(--rad-ctl, 8px); background: transparent; color: var(--tx); font: 600 var(--fs-3, 15px)/1 var(--f-ui); cursor: pointer; }
.fz-note .fz-btn { align-self: center; margin-top: 0; }

/* barra de baixo, única e fina: anterior, áudio e posição, próxima (--fz-b vem do JS quando há outra barra fixa) */
.fz-nav { position: fixed; z-index: 27; left: 0; right: 0; bottom: var(--fz-b, 0px); display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 6px; height: calc(var(--fz-bh) + var(--safe-b, 0px)); padding: 0 calc(10px + var(--safe-r, 0px)) var(--safe-b, 0px) calc(10px + var(--safe-l, 0px)); border-top: 1px solid var(--ln); background: color-mix(in srgb, var(--pg) 94%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); direction: ltr; }
.fz-nb { display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: var(--rad-ctl, 8px); background: transparent; color: var(--tx); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fz-nb:disabled { opacity: .3; cursor: default; }
.fz-nb:not(:disabled):active { background: color-mix(in srgb, var(--tx) 10%, transparent); }
.fz-next { background: var(--ac); color: var(--on-ac3, var(--on-ac, #fff)); }
.fz-next:not(:disabled):active { background: var(--ac); filter: brightness(.92); }
.fz-mid { display: flex; align-items: center; justify-content: center; gap: 2px; min-width: 0; }
.fz-pos { min-width: 3.2rem; text-align: center; font: 500 12.5px/1 var(--f-ui); color: var(--mu); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fz-au { display: flex; align-items: center; gap: 0; }
.fz-ab { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--rad-ctl, 8px); background: transparent; color: var(--mu); font: 600 var(--fs-2, 13.5px)/1 var(--f-ui); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fz-ab.fz-play { color: var(--tx); }
.fz-ab[aria-pressed="true"] { color: var(--act); background: color-mix(in srgb, var(--ac) 13%, transparent); }
.fz-ab.fz-spd { width: auto; min-width: 44px; padding: 0 6px; color: var(--tx); font-variant-numeric: tabular-nums; }
.fz-ab:active { background: color-mix(in srgb, var(--tx) 9%, transparent); }
.rdr:has(.fz[data-au="1"]) .pl-bar { display: none; }
.rdr:has(.fz) { padding-bottom: calc(var(--fz-bh, 52px) + var(--safe-b, 0px) + 4px); }

@media (min-width: 520px) {
  .fz .rd.fz-rd { font-size: calc(var(--rd-fs) * 1.12); }
  .fz-tt { font-size: var(--fs-4, 17px); }
}
@media (min-width: 900px) {
  .fz { min-height: calc(100dvh - 160px); }
  .fz-nav { left: 50%; right: auto; width: min(34rem, calc(100vw - 32px)); transform: translateX(-50%); bottom: calc(var(--fz-b, 0px) + 16px); height: var(--fz-bh); padding: 0 10px; border: 1px solid var(--ln); border-radius: var(--rad-card, 12px); background: var(--bg); }
  .rdr:has(.fz) { padding-bottom: 88px; }
}
@media (prefers-reduced-motion: reduce) { .fz-gl.sk i { animation: none; } }
.fz-cr .ps { padding: 0; }
.fz-cr .ps.st { color: var(--tx); font-weight: 700; }
