/* Teleprompter por voz — página de prova. Sem fonte nem arquivo de fora: tudo local. */
:root {
  --bg: #0b0d10;
  --painel: #151a21;
  --painel-2: #1d242d;
  --borda: #2b3542;
  --texto: #e8edf2;
  --suave: #9aa7b5;
  --acento: #ffd24a;
  --ok: #4ade80;
  --erro: #ff7b7b;
  --nota: #7dd3fc;
  --raio: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; background: var(--bg); color: var(--texto); }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

h1 { font-size: 1.5rem; margin: 0 0 .15rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .85rem; margin: 1rem 0 .35rem; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 .75rem; }
.suave { color: var(--suave); }
.pequeno { font-size: .85rem; }
.espaco { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font: 12.5px/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* ---------- editor ---------- */
.pagina {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.topo { padding: 8px 0 12px; }

.cartao {
  background: var(--painel);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 16px;
  margin: 0 0 16px;
}

.alerta {
  background: #2a2410;
  border: 1px solid #5c4d12;
  border-radius: var(--raio);
  padding: 12px 14px;
  margin: 0 0 16px;
}
.alerta h2 { margin-bottom: .4rem; }
.alerta p:last-child { margin-bottom: 0; }
.alerta-erro { background: #331618; border-color: #6e2a2f; }

textarea, select, input[type="text"] {
  width: 100%;
  background: var(--painel-2);
  color: var(--texto);
  border: 1px solid var(--borda);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
textarea { resize: vertical; min-height: 9rem; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--suave) 50%), linear-gradient(135deg, var(--suave) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }

.campo { display: block; margin: 0 0 14px; }
.campo .rot { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.campo output { color: var(--acento); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; height: 32px; accent-color: var(--acento); margin: 0; }

/* A caixa fica à esquerda e o texto (com o comentário em cinza) corre junto, sem virar uma coluna estreita. */
.check { position: relative; display: block; margin: 0 0 12px; padding-left: 34px; min-height: 28px; line-height: 1.35; }
.check input { position: absolute; left: 0; top: 0; width: 22px; height: 22px; margin: 0; accent-color: var(--acento); }

.linha-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }

.bt {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--borda);
  background: var(--painel-2);
  color: var(--texto);
  font: inherit; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bt:active { transform: translateY(1px); }
.bt.primario { background: var(--acento); border-color: var(--acento); color: #1a1500; }
.bt.sec { background: var(--painel-2); }
.bt.grande { min-height: 56px; font-size: 1.1rem; flex: 1; }

.comecar { display: flex; gap: 10px; margin: 0 0 8px; }

.atalhos { margin: 8px 0 0; }
.atalhos summary, #diagnostico summary { cursor: pointer; color: var(--suave); padding: 6px 0; }
.atalhos ul { padding-left: 1.2rem; margin: .5rem 0; }
.atalhos li { margin: .35rem 0; }
.atalhos .campo, .atalhos .check { margin-top: 12px; }
kbd {
  font: 12px ui-monospace, Menlo, monospace;
  background: var(--painel-2); border: 1px solid var(--borda); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px;
}

.caixa {
  background: #0e1217; border: 1px solid var(--borda); border-radius: 10px;
  padding: 10px 12px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 22rem; overflow: auto;
}
#diag-copia { margin-top: 10px; }
.rodape { text-align: center; padding: 8px 0; }

/* ---------- prompter ---------- */
#tela-prompter {
  position: fixed; inset: 0; z-index: 10;
  background: #000; color: #fff;
  overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}

/* Tudo que espelha mora aqui dentro: texto, linha de leitura e contagem. O espelho (scale) é aplicado
   por JS em #espelho; a barra, o painel de voz e os avisos ficam FORA e nunca espelham. */
#espelho { position: absolute; left: 0; right: 0; top: 0; bottom: 0; transform-origin: 50% 50%; }
#roteiro-viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
#roteiro { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
#coluna {
  margin: 0 auto;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: left;
}
#coluna .nota { color: var(--nota); font-size: .55em; font-style: italic; font-weight: 500; letter-spacing: .02em; }

/* O marcador da linha de leitura é só uma setinha leve em cada lateral, na altura da linha (a altura é a do
   `top` que o JS põe): o texto fica todo branco e igual, sem faixa nem risco por cima das palavras. */
#linha {
  position: absolute; left: 0; right: 0; height: 0;
  pointer-events: none;
}
#linha::before, #linha::after {
  content: ""; position: absolute; top: 0; margin-top: -9px; border: 9px solid transparent; opacity: .4;
}
#linha::before { left: 2px; border-left: 11px solid #fff; border-right-width: 0; }
#linha::after { right: 2px; border-right: 11px solid #fff; border-left-width: 0; }

#contagem {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: min(42vw, 42vh); font-weight: 800; color: var(--acento);
  background: rgba(0, 0, 0, .72); pointer-events: none;
}

#hud {
  position: absolute; top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; z-index: 3;
  font: 12px/1.35 ui-monospace, Menlo, monospace; color: #cfe3ff;
  background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .15); border-radius: 8px;
  padding: 6px 8px; pointer-events: none;
}
#hud-ouvido { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#aviso-voz {
  position: absolute; left: 12px; right: 12px; top: calc(76px + env(safe-area-inset-top)); z-index: 7;
  background: #331618; border: 1px solid #6e2a2f; border-radius: var(--raio); padding: 12px 14px;
}
#aviso-voz p { margin: 0 0 8px; }

#zona-barra { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; z-index: 5; }
#barra {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, .92), rgba(0, 0, 0, .55) 70%, transparent);
  transition: transform .25s, opacity .25s;
}
#barra .grupo { display: flex; gap: 8px; }
#barra.oculta { transform: translateY(110%); opacity: 0; pointer-events: none; }
#barra .bt { min-width: 52px; padding: 0 12px; }
#barra #bt-tocar { min-width: 104px; }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  z-index: 50; max-width: 90vw;
  background: #222b36; border: 1px solid var(--borda); color: var(--texto);
  padding: 10px 16px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.visivel { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  #barra, #toast { transition: none; }
}
