/* VozAltera - visual herdado do VozStudio, com tema escuro e claro. Sem fontes externas. */

:root,
[data-tema='escuro'] {
  color-scheme: dark;
  --fundo: #0c0f0e;
  --texto: #e8ecea;
  --suave: #9aa5a0;
  --mais-suave: #8b9691;
  --cartao: #151918;
  --borda: #242c29;
  --elev: #1a201e;
  --borda2: #28312e;
  --ghost: #1d2422;
  --ghost-borda: #2c3633;
  --acento: #2dd4a8;
  --acento-fundo: #14342c;
  --acento-borda: #1f4d40;
  --ativo-fundo: #123129;
  --ativo-texto: #7ee8c7;
  --gravar: #e63329;
  --primario: #159a76;
  --download-fundo: #e8ecea;
  --download-texto: #0c0f0e;
  --erro-texto: #fda4af;
  --erro-fundo: #2a1418;
  --erro-borda: #5b2330;
  --ok-texto: #7ee8c7;
  --ok-fundo: #10261f;
  --ok-borda: #1f4d40;
  --onda: #2dd4a8;
  --onda-vazia: #2a3230;
  --credito: #66706c;
  --icon-btn: #232b28;
  --icon-borda: #2e3834;
  --perigo: #c9302c;
  --sombra: 0 12px 40px rgba(0, 0, 0, 0.45);
}

[data-tema='claro'] {
  color-scheme: light;
  --fundo: #f4f7f6;
  --texto: #14201c;
  --suave: #55635e;
  --mais-suave: #66736e;
  --cartao: #ffffff;
  --borda: #dde5e2;
  --elev: #f3f7f5;
  --borda2: #d7e0dc;
  --ghost: #eef3f1;
  --ghost-borda: #d3ddd9;
  --acento: #0f8f6d;
  --acento-fundo: #dcf5ec;
  --acento-borda: #a6e3cf;
  --ativo-fundo: #e2f8f0;
  --ativo-texto: #0b6e53;
  --gravar: #d92b21;
  --primario: #128a69;
  --download-fundo: #14201c;
  --download-texto: #ffffff;
  --erro-texto: #9f1239;
  --erro-fundo: #fff1f2;
  --erro-borda: #fecdd3;
  --ok-texto: #0b6e53;
  --ok-fundo: #e7f8f1;
  --ok-borda: #a6e3cf;
  --onda: #14a983;
  --onda-vazia: #d5dfdb;
  --credito: #7a8681;
  --icon-btn: #eef3f1;
  --icon-borda: #d3ddd9;
  --perigo: #c9302c;
  --sombra: 0 12px 40px rgba(20, 32, 28, 0.18);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font-family: Manrope, 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.4;
  min-height: 100vh;
}
button, a, input { font: inherit; }
button { color: inherit; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ico { flex: 0 0 auto; }

.app { max-width: 880px; margin: 0 auto; padding: 20px 16px 24px; }

/* ---------- Topo ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.logo { display: flex; gap: 12px; align-items: center; }
.logo strong { display: block; font-size: 20px; }
.logo small { color: var(--suave); }
.logo-badge { background: var(--acento-fundo); color: var(--acento); border: 1px solid var(--acento-borda); padding: 10px; border-radius: 12px; display: grid; place-items: center; }
.abas { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.abas::-webkit-scrollbar { display: none; }
.abas a { display: inline-flex; align-items: center; gap: 6px; padding: 9px 13px; border-radius: 999px; color: var(--suave); text-decoration: none; font-weight: 700; font-size: 14px; white-space: nowrap; border: 1px solid transparent; min-height: 40px; }
.abas a:hover { color: var(--texto); background: var(--ghost); }
.abas a[aria-current='page'] { color: var(--ativo-texto); background: var(--ativo-fundo); border-color: var(--acento-borda); }

.aviso-senha { display: flex; gap: 8px; align-items: center; background: var(--acento-fundo); border: 1px solid var(--acento-borda); color: var(--texto); padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; }
.aviso-senha a { color: var(--acento); font-weight: 700; }

/* ---------- Cartões ---------- */
.card { background: var(--cartao); border: 1px solid var(--borda); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.card h2 { margin: 0 0 14px; font-size: 17px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.recorder { text-align: center; padding: 28px 20px 18px; transition: border-color 0.15s; }
.recorder.soltando { border-color: var(--acento); border-style: dashed; }
.wave { width: 100%; height: 72px; display: block; }
.timer { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 34px; font-weight: 600; margin-top: 8px; font-variant-numeric: tabular-nums; }
.origem { color: var(--acento); font-size: 13px; margin: 2px 0 0; overflow-wrap: anywhere; }
.hint { color: var(--suave); margin: 6px 0 16px; }
.hint.esquerda { margin: 0 0 12px; }
.miudo { color: var(--mais-suave); font-size: 12px; margin: 14px 0 0; }
.error { color: var(--erro-texto); background: var(--erro-fundo); border: 1px solid var(--erro-borda); padding: 10px; border-radius: 10px; margin: 0 0 12px; }
.sucesso { color: var(--ok-texto); background: var(--ok-fundo); border: 1px solid var(--ok-borda); padding: 10px; border-radius: 10px; margin: 0 0 12px; }

/* ---------- Botões ---------- */
.actions, .result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.result-actions.secundarias { margin-top: 12px; }
.btn-record, .btn-primary, .btn-perigo { background: var(--gravar); color: #fff; border: 0; padding: 14px 22px; border-radius: 999px; font-weight: 800; display: inline-flex; gap: 8px; align-items: center; justify-content: center; cursor: pointer; min-height: 52px; text-decoration: none; }
.btn-record.recording { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(230, 51, 41, 0.18); } }
@media (prefers-reduced-motion: reduce) { .btn-record.recording { animation: none; } }
.btn-primary { background: var(--primario); }
.btn-perigo { background: var(--perigo); }
.btn-primary.largo { width: 100%; }
.btn-download { background: var(--download-fundo); color: var(--download-texto); padding: 14px 20px; border-radius: 999px; font-weight: 800; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; min-height: 52px; }
.btn-ghost { background: var(--ghost); color: var(--texto); border: 1px solid var(--ghost-borda); padding: 12px 16px; border-radius: 999px; display: inline-flex; gap: 7px; align-items: center; cursor: pointer; text-decoration: none; min-height: 48px; }
.btn-ghost:hover:not(:disabled), .icon-btn:hover { border-color: var(--acento-borda); }
.btn-ghost.small { min-height: 40px; margin-top: 12px; }
.btn-ghost.small-btn { min-height: 40px; padding: 8px 14px; font-weight: 700; }
.btn-ghost.ativo { background: var(--ativo-fundo); border-color: var(--acento); color: var(--ativo-texto); font-weight: 700; }
.icon-btn { background: var(--icon-btn); border: 1px solid var(--icon-borda); color: var(--texto); width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; text-decoration: none; flex: 0 0 auto; }
.icon-btn.danger { color: var(--erro-texto); }
.icon-btn[aria-pressed='true'] { color: var(--acento); border-color: var(--acento); }
.preset:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }

/* ---------- Vozes ---------- */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.preset { background: var(--elev); border: 1px solid var(--borda2); color: var(--texto); border-radius: 12px; padding: 14px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; min-height: 88px; text-align: center; }
.preset strong { overflow-wrap: anywhere; }
.preset small { color: var(--mais-suave); }
.preset:hover { border-color: var(--acento-borda); }
.preset.minha .ico { color: #f5b942; }
.preset.active { border-color: var(--acento); background: var(--ativo-fundo); color: var(--ativo-texto); }

/* ---------- Ajustes ---------- */
.sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.sliders label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.rotulo-linha { display: flex; justify-content: space-between; gap: 8px; }
.sliders .valor { color: var(--acento); font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
input[type='range'] { accent-color: var(--acento); width: 100%; height: 28px; margin: 0; }
.tag { background: var(--acento-fundo); color: var(--acento); font-size: 12px; padding: 3px 8px; border-radius: 999px; }

/* ---------- Resultado ---------- */
.empty { color: var(--mais-suave); text-align: center; padding: 12px 0; margin: 0; }
.girando { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--borda2); border-top-color: var(--acento); border-radius: 50%; animation: gira 0.8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .girando { animation-duration: 2.4s; } }

/* ---------- Listas ---------- */
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.history li { display: flex; align-items: center; gap: 10px; background: var(--elev); border: 1px solid var(--borda2); border-radius: 10px; padding: 10px 12px; }
.history .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.history .info strong { overflow-wrap: anywhere; }
.history small { color: var(--mais-suave); }
.history .botoes { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.busca { display: flex; align-items: center; gap: 8px; background: var(--elev); border: 1px solid var(--borda2); border-radius: 12px; padding: 0 12px; margin-bottom: 12px; color: var(--suave); }
.busca input { flex: 1; background: transparent; border: 0; color: var(--texto); padding: 12px 0; min-width: 0; }
.busca input:focus { outline: none; }
.busca:focus-within { border-color: var(--acento); }

/* ---------- Formulários ---------- */
.formulario { display: flex; flex-direction: column; gap: 12px; }
.formulario label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.formulario input[type='text'], .formulario input[type='email'], .formulario input[type='password'] { background: var(--elev); border: 1px solid var(--borda2); color: var(--texto); border-radius: 10px; padding: 12px; font-weight: 400; min-height: 46px; width: 100%; }
.formulario input:focus { border-color: var(--acento); outline: none; }
.formulario .btn-primary { align-self: flex-start; }
.seletor-tema { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Login ---------- */
.pagina-login { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 16px; }
.login-caixa { width: 100%; max-width: 380px; padding: 28px 24px; margin: auto 0 16px; }
.logo-centro { justify-content: center; margin-bottom: 22px; }
.login-caixa .formulario .btn-primary { align-self: stretch; }
.nota-login { color: var(--mais-suave); font-size: 12px; text-align: center; margin: 16px 0 0; }

/* ---------- Diálogo e aviso ---------- */
.dialogo { background: var(--cartao); color: var(--texto); border: 1px solid var(--borda); border-radius: 16px; padding: 20px; width: min(92vw, 420px); box-shadow: var(--sombra); }
.dialogo::backdrop { background: rgba(0, 0, 0, 0.55); }
.dialogo h2 { margin: 0; font-size: 18px; }
.dialogo-botoes { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.dialogo-botoes .btn-primary, .dialogo-botoes .btn-perigo, .dialogo-botoes .btn-ghost { min-height: 46px; padding: 10px 18px; align-self: auto; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--download-fundo); color: var(--download-texto); padding: 12px 18px; border-radius: 999px; font-weight: 700; box-shadow: var(--sombra); z-index: 50; max-width: calc(100vw - 32px); text-align: center; }

/* ---------- Rodapé ---------- */
.rodape { text-align: center; padding: 10px; }
.credito-daniel-tok { color: var(--credito); font-size: 12px; text-decoration: none; }
.credito-daniel-tok:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .app { padding: 14px 12px 20px; }
  .sliders { grid-template-columns: 1fr; }
  .timer { font-size: 28px; }
  .card { padding: 16px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .abas a { padding: 8px 11px; font-size: 13px; }
  .history li { flex-wrap: wrap; }
  .history .botoes { width: 100%; justify-content: flex-start; }
  .actions > *, .result-actions > * { flex: 1 1 auto; justify-content: center; }
}
