/* ============================================================
   Lê Pra Mim — visual acessível (alto contraste, letras grandes)
   Paleta: laranja #FF643C sobre fundo escuro
   ============================================================ */

:root {
  --laranja: #FF643C;
  --laranja-escuro: #d94e2b;
  --fundo: #14101c;
  --fundo-cartao: #201a2c;
  --fundo-cartao-2: #2a2238;
  --texto: #ffffff;
  --texto-suave: #b9b0c9;
  --verde: #2ecc71;
  --vermelho: #ff5c5c;
  --raio: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* garante que elementos com hidden sumam mesmo tendo display próprio */
[hidden] { display: none !important; }

html { font-size: 18px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.tela {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ============ TELA INICIAL ============ */

.topo { text-align: center; margin: 24px 0 32px; }

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.logo-icone { font-size: 2.6rem; }

.logo h1 {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--laranja);
  letter-spacing: -0.5px;
}

.slogan {
  margin-top: 10px;
  font-size: 1.15rem;
  color: var(--texto-suave);
}

.area-carregar { flex: 1; display: flex; flex-direction: column; gap: 20px; }

.zona-soltar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 44px 24px;
  background: var(--fundo-cartao);
  border: 3px dashed var(--laranja);
  border-radius: var(--raio);
  cursor: pointer;
  text-align: center;
  transition: background .15s, transform .1s;
}

.zona-soltar:hover, .zona-soltar.arrastando { background: var(--fundo-cartao-2); }
.zona-soltar:active { transform: scale(0.98); }

.zona-icone { font-size: 3rem; }

.zona-titulo { font-size: 1.35rem; font-weight: 700; }

.zona-sub { font-size: 1rem; color: var(--texto-suave); }

.ou-divisor {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--texto-suave);
  font-size: 1rem;
}
.ou-divisor::before, .ou-divisor::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #3a3050;
}

.area-colar { display: flex; flex-direction: column; gap: 12px; }

textarea {
  width: 100%;
  background: var(--fundo-cartao);
  border: 2px solid #3a3050;
  border-radius: var(--raio);
  color: var(--texto);
  font-size: 1.1rem;
  padding: 16px;
  resize: vertical;
  font-family: inherit;
}
textarea:focus { outline: 3px solid var(--laranja); border-color: transparent; }

/* ============ BOTÕES ============ */

.btn {
  border: none;
  border-radius: var(--raio);
  font-size: 1.15rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  padding: 16px 24px;
  transition: transform .1s, filter .15s;
  color: var(--texto);
}
.btn:active { transform: scale(0.97); }

.btn-grande { width: 100%; padding: 20px 24px; font-size: 1.25rem; }

.btn-primario { background: var(--laranja); color: #fff; }
.btn-primario:hover { filter: brightness(1.1); }

.btn-secundario { background: var(--fundo-cartao-2); border: 2px solid #4a3f63; }
.btn-secundario:hover { background: #342b46; }

.btn-fantasma {
  background: transparent;
  color: var(--texto-suave);
  font-size: 1.05rem;
  padding: 14px;
}
.btn-fantasma:hover { color: var(--texto); }

.btn-icone {
  background: var(--fundo-cartao-2);
  border: none;
  color: var(--texto);
  font-size: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icone:hover { background: #342b46; }

/* ============ CARREGANDO / ERRO ============ */

.carregando {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  font-size: 1.15rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid var(--fundo-cartao-2);
  border-top-color: var(--laranja);
  border-radius: 50%;
  animation: girar 0.9s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.erro {
  background: #3d1d24;
  border: 2px solid var(--vermelho);
  color: #ffd7d7;
  padding: 18px;
  border-radius: var(--raio);
  font-size: 1.1rem;
  line-height: 1.5;
}

.rodape-inicio {
  text-align: center;
  color: var(--texto-suave);
  font-size: 0.95rem;
  margin-top: 24px;
}

/* ============ TELA DO LEITOR ============ */

.leitor-topo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.leitor-titulo {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.leitor-titulo strong {
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leitor-titulo span { color: var(--texto-suave); font-size: 0.95rem; }

.barra-progresso {
  height: 10px;
  background: var(--fundo-cartao-2);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}

#barra-preenchida {
  height: 100%;
  width: 0%;
  background: var(--laranja);
  border-radius: 5px;
  transition: width .3s;
}

/* ============ LEGENDA ============ */

.palco {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: 20px 4px;
  overflow: hidden;
  text-align: center;
}

.frase { line-height: 1.5; transition: opacity .2s; }

.frase-vizinha {
  font-size: 1.05rem;
  color: var(--texto-suave);
  opacity: 0.55;
  max-height: 4.6em;
  overflow: hidden;
}

.frase-atual {
  font-size: var(--fonte-legenda, 1.9rem);
  font-weight: 700;
  color: var(--texto);
  cursor: default;
}

/* palavra sendo falada agora (quando o navegador avisa) */
.frase-atual .palavra-ativa {
  color: var(--laranja);
  text-decoration: underline;
  text-decoration-thickness: 4px;
  text-underline-offset: 6px;
}

.frase-vizinha:not(:empty) { cursor: pointer; }
.frase-vizinha:not(:empty):hover { opacity: 0.9; }

/* ============ CONTROLES ============ */

.controles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
}

.controles-linha {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.btn-controle {
  background: var(--fundo-cartao-2);
  border: none;
  color: var(--texto);
  font-size: 1.7rem;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .1s, filter .15s;
}
.btn-controle:active { transform: scale(0.94); }

.btn-play {
  background: var(--laranja);
  width: 96px;
  height: 96px;
  font-size: 2.4rem;
  box-shadow: 0 6px 24px rgba(255, 100, 60, 0.45);
}
.btn-play:hover { filter: brightness(1.1); }
.btn-play.tocando { background: var(--laranja-escuro); }

/* ============ PAINEL DE CONFIGURAÇÕES ============ */

.painel-config { position: fixed; inset: 0; z-index: 50; }

.painel-fundo {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.painel-caixa {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-width: 720px;
  margin: 0 auto;
  background: var(--fundo-cartao);
  border-radius: 28px 28px 0 0;
  padding: 24px 22px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-height: 85vh;
  overflow-y: auto;
}

.painel-cabecalho {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.painel-cabecalho h2 { font-size: 1.5rem; }

.config-grupo { display: flex; flex-direction: column; gap: 12px; }

.config-rotulo { font-size: 1.15rem; font-weight: 700; }
.config-rotulo strong { color: var(--laranja); }

.botoes-genero { display: flex; gap: 12px; }

.btn-genero {
  flex: 1;
  background: var(--fundo-cartao-2);
  border: 3px solid transparent;
  border-radius: var(--raio);
  color: var(--texto);
  font-size: 1.2rem;
  font-weight: 700;
  font-family: inherit;
  padding: 18px;
  cursor: pointer;
}
.btn-genero.ativo {
  border-color: var(--laranja);
  background: rgba(255, 100, 60, 0.15);
}

.config-aviso { color: #ffcf8a; font-size: 1rem; line-height: 1.45; }

.config-rotulo-menor { font-size: 1.02rem; color: var(--texto-suave); margin-top: 4px; }

.grade-estilos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-estilo {
  background: var(--fundo-cartao-2);
  border: 3px solid transparent;
  border-radius: 16px;
  color: var(--texto);
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  padding: 14px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.btn-estilo .estilo-emoji { font-size: 1.5rem; }
.btn-estilo .estilo-desc {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--texto-suave);
}
.btn-estilo.ativo {
  border-color: var(--laranja);
  background: rgba(255, 100, 60, 0.15);
}

.config-avancado summary {
  color: var(--texto-suave);
  cursor: pointer;
  font-size: 1rem;
  padding: 6px 0;
}

select {
  width: 100%;
  margin-top: 10px;
  background: var(--fundo-cartao-2);
  border: 2px solid #4a3f63;
  border-radius: 14px;
  color: var(--texto);
  font-size: 1.05rem;
  padding: 14px;
  font-family: inherit;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--laranja);
  height: 34px;
  cursor: pointer;
}

.escala-legendas {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--texto-suave);
  font-size: 0.95rem;
}

/* ============ TELAS PEQUENAS ============ */

@media (max-width: 420px) {
  html { font-size: 16px; }
  .btn-controle { width: 64px; height: 64px; }
  .btn-play { width: 88px; height: 88px; }
}

/* respeita quem prefere menos animação */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0.01s !important; }
}
