/* Grava Som. Mobile first: tudo nasce para 390px e só abre no computador. */

:root {
  --fundo: #14121f;
  --cartao: #1e1b2e;
  --cartao-2: #272339;
  --linha: #3a3452;
  --texto: #f3f0ff;
  --suave: #a9a2c6;
  --acento: #9b7bff;
  --acento-2: #e06ba0;
  --ok: #3ecf8e;
  --perigo: #ff6b6b;
  --raio: 16px;
  --abas: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--abas) + env(safe-area-inset-bottom) + 16px);
}
h1, h2 { margin: 0 0 8px; line-height: 1.2; }
h2 { font-size: 18px; }
b { color: var(--texto); }

.carregando { text-align: center; padding: 40vh 16px 0; color: var(--suave); }

/* topo e marca */
.topo {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--fundo) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--linha);
}
.marca { display: flex; align-items: center; gap: 10px; }
.marca strong { font-size: 18px; }
.logo {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: url("icone.svg") center / cover no-repeat;
}
.marca.grande { justify-content: center; }
.marca.grande .logo { width: 48px; height: 48px; border-radius: 14px; }

main { padding: 16px; max-width: 640px; margin: 0 auto; }

/* login */
.login { padding-top: 18vh; text-align: center; }
.login .cartao { text-align: left; margin-top: 24px; }
.erro-texto { color: var(--perigo); min-height: 1.4em; margin: 8px 0 0; }

/* cartões */
.cartao {
  background: var(--cartao);
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  padding: 16px;
  margin-bottom: 14px;
}
.cartao.destaque {
  background: linear-gradient(160deg, color-mix(in srgb, var(--acento) 22%, var(--cartao)), var(--cartao) 70%);
}
.sub { color: var(--suave); margin: 0 0 12px; }
.nota { color: var(--suave); font-size: 14px; margin: 8px 0 0; }
.centro { text-align: center; display: block; }

/* botões */
.botao {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 10px 16px; width: 100%;
  border: 1px solid var(--linha); border-radius: 12px;
  background: var(--cartao-2); color: var(--texto);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  margin-top: 8px;
}
.botao:active { transform: scale(0.98); }
.botao[disabled] { opacity: 0.45; cursor: default; }
.botao.primario {
  border: 0; color: #fff;
  background: linear-gradient(135deg, var(--acento), var(--acento-2));
}
.botao.grande { min-height: 54px; font-size: 17px; }
.botao.perigo { background: var(--perigo); border: 0; color: #fff; width: auto; margin: 0 0 0 auto; }
.botao.mini { min-height: 38px; width: auto; padding: 6px 12px; font-size: 14px; margin: 0; }
.perigo-texto { color: var(--perigo); }
.link {
  background: none; border: 0; color: var(--suave); font: inherit; padding: 8px;
  cursor: pointer; text-decoration: underline; margin: 6px auto 0;
}
.dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dupla .botao { margin-top: 8px; }

/* formulários */
label { display: block; font-weight: 600; margin: 12px 0 6px; }
input[type="password"], select {
  width: 100%; font-size: 16px; min-height: 46px;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--linha); background: var(--fundo); color: var(--texto);
}
select { margin-bottom: 10px; }
audio, video { width: 100%; margin-top: 10px; border-radius: 12px; display: block; }
video { background: #000; max-height: 60vh; }

/* segmento (abas internas) */
.segmento {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 14px;
  background: var(--fundo); border: 1px solid var(--linha); border-radius: 12px;
  overflow-x: auto;
}
.segmento button {
  flex: 1 0 auto; min-height: 40px; padding: 6px 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--suave);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.segmento button.ativo { background: var(--cartao-2); color: var(--texto); }
.segmento small { opacity: 0.7; font-weight: 400; }

.passos { padding-left: 22px; margin: 0 0 6px; color: var(--suave); }
.passos li { margin-bottom: 8px; }

/* gravando */
.gravando { display: flex; align-items: center; gap: 12px; font-size: 22px; font-variant-numeric: tabular-nums; }
.ponto { width: 14px; height: 14px; border-radius: 50%; background: var(--perigo); animation: pulsar 1s infinite; }
@keyframes pulsar { 50% { opacity: 0.3; } }

/* biblioteca */
.item {
  background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio);
  padding: 14px; margin-bottom: 12px;
}
.item-topo { display: flex; flex-direction: column; gap: 2px; }
.item-nome {
  background: none; border: 0; padding: 0; text-align: left; cursor: pointer;
  color: var(--texto); font: inherit; font-weight: 700; overflow-wrap: anywhere;
}
.meta { color: var(--suave); font-size: 14px; }
.acoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.vazio { text-align: center; color: var(--suave); padding: 40px 16px; }

/* editor */
#onda { width: 100%; height: 84px; display: block; cursor: pointer; touch-action: manipulation; margin-top: 4px; }
.corte { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.corte > div {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  background: var(--fundo); border-radius: 12px; padding: 10px;
}
.rotulo { color: var(--suave); font-size: 13px; }
.corte output { font-size: 20px; font-variant-numeric: tabular-nums; font-weight: 700; }

.fichas { display: flex; flex-wrap: wrap; gap: 8px; }
.fichas.pequenas { margin: 4px 0 6px; }
.ficha {
  border: 1px solid var(--linha); background: var(--fundo); color: var(--texto);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 15px; cursor: pointer; min-height: 38px;
}
.ficha:active { background: var(--cartao-2); }

.controle { margin-top: 12px; }
.controle-topo { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.controle-topo label { margin: 0; }
.controle-topo output { color: var(--acento); font-variant-numeric: tabular-nums; font-size: 15px; text-align: right; }
input[type="range"] { width: 100%; height: 36px; accent-color: var(--acento); margin: 2px 0 0; }
.marca-opcao { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 12px 0 0; }
.marca-opcao input { width: 22px; height: 22px; accent-color: var(--acento); flex: none; }

.fixo-baixo { position: sticky; bottom: calc(var(--abas) + env(safe-area-inset-bottom) + 8px); z-index: 3; box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35); }
.resultado { margin-top: 16px; }

/* barra de progresso e aviso, acima das abas */
.progresso, .aviso {
  position: fixed; left: 12px; right: 12px; z-index: 20;
  bottom: calc(var(--abas) + env(safe-area-inset-bottom) + 10px);
  max-width: 616px; margin: 0 auto;
  border-radius: 14px; padding: 12px 14px;
  transform: translateY(20px); opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.progresso { background: var(--cartao-2); border: 1px solid var(--linha); }
.progresso.visivel, .aviso.visivel { opacity: 1; transform: none; pointer-events: auto; }
.progresso-texto { display: block; font-weight: 600; margin-bottom: 8px; }
.progresso-barra { display: block; height: 6px; border-radius: 3px; background: var(--fundo); overflow: hidden; }
.progresso-barra i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--acento), var(--acento-2)); transition: width 0.3s; }
.progresso-barra i.indeterminada { animation: vai-e-vem 1.2s ease-in-out infinite; width: 40% !important; }
@keyframes vai-e-vem { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.aviso { background: #2d2842; border: 1px solid var(--linha); font-weight: 600; z-index: 21; }
.aviso.ok { border-color: var(--ok); }
.aviso.erro { border-color: var(--perigo); }

/* abas de baixo */
.abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--abas) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--cartao); border-top: 1px solid var(--linha);
}
.abas button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: none; border: 0; color: var(--suave); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.abas button.ativa { color: var(--texto); }
.abas button.ativa .ic { background: var(--acento); }
.ic {
  width: 24px; height: 24px; background: var(--suave);
  -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat;
}
.ic-gravar { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 15a4 4 0 0 0 4-4V6a4 4 0 1 0-8 0v5a4 4 0 0 0 4 4zm7-4a1 1 0 1 0-2 0 5 5 0 0 1-10 0 1 1 0 1 0-2 0 7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11z'/%3E%3C/svg%3E"); }
.ic-biblioteca { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h4v16H4zm6 0h4v16h-4zm6.5 1.2 3.9-1 3.6 15.5-3.9 1z'/%3E%3C/svg%3E"); }
.ic-editar { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 7h10v2H3zm14 0h4v2h-4zm-2-2h2v6h-2zM3 15h4v2H3zm8 0h10v2H11zm-2-2h2v6H9z'/%3E%3C/svg%3E"); }
.ic-video { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v3l4-3v12l-4-3v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3C/svg%3E"); }

/* computador: só abre respiro */
@media (min-width: 720px) {
  main { padding: 24px; }
  .acoes .botao.mini { padding: 6px 14px; }
}
.topo .link { margin: 0; }

/* vídeo animado */
input[type="text"], textarea {
  width: 100%; font: inherit; font-size: 16px; min-height: 46px;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--linha); background: var(--fundo); color: var(--texto);
}
textarea { resize: vertical; line-height: 1.35; }
.marcas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.marca-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 10px; border-radius: 12px; border: 1px solid var(--linha);
  background: var(--fundo); color: var(--texto); font: inherit; cursor: pointer; min-width: 0;
}
.marca-card.ativa { border-color: var(--acento); box-shadow: 0 0 0 2px var(--acento) inset; }
.marca-card small { color: var(--suave); font-size: 12px; overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap; }
.marca-nome { font-weight: 700; font-size: 14px; line-height: 1.2; }
.amostra { width: 28px; height: 28px; border-radius: 8px; margin-bottom: 4px; border: 1px solid rgba(255, 255, 255, 0.15); }
.cena { background: var(--fundo); border-radius: 12px; padding: 10px; margin-bottom: 10px; display: grid; gap: 8px; }
.cena textarea, .cena input { background: var(--cartao); }
.cena-topo { display: flex; justify-content: space-between; align-items: center; }
.mini-link { margin: 0; padding: 4px 6px; font-size: 14px; }

/* transcrição */
details.texto { margin-top: 10px; background: var(--fundo); border-radius: 12px; padding: 10px 12px; }
details.texto summary { cursor: pointer; font-weight: 700; min-height: 32px; display: flex; align-items: center; }
.transcricao { max-height: 50vh; overflow-y: auto; margin-top: 6px; color: var(--texto); overflow-wrap: anywhere; }
.transcricao p { margin: 0 0 10px; }
details.texto summary { list-style: none; gap: 8px; }
details.texto summary::-webkit-details-marker { display: none; }
details.texto summary::before { content: "▸"; color: var(--acento); transition: transform 0.15s; }
details.texto[open] summary::before { transform: rotate(90deg); }

/* suporte */
.topo-acoes { display: flex; gap: 4px; }
.prints { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.print { position: relative; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; background: var(--fundo); }
.print img { width: 100%; height: 100%; object-fit: cover; display: block; }
.print .tirar {
  position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, 0.65); color: #fff; font: inherit; font-size: 14px; cursor: pointer;
}
.chamado { background: var(--fundo); border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.chamado-topo { display: flex; flex-direction: column; gap: 2px; }
.chamado p { margin: 6px 0; overflow-wrap: anywhere; }
.resposta { border-left: 3px solid var(--acento); padding-left: 8px; }

/* criação */
.ic-criacao { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h10v2H4zm0 4h16v12H4zm2 2v8h12v-8zM16 4h4v2h-4z'/%3E%3C/svg%3E"); }
.artes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0; }
.artes img { width: 100%; border-radius: 10px; display: block; background: #fff; }
.carrossel-item { display: flex; gap: 12px; align-items: center; }
.carrossel-item img { width: 64px; height: 80px; object-fit: cover; border-radius: 8px; flex: none; background: #fff; }
.carrossel-item div { display: flex; flex-direction: column; min-width: 0; }

/* publicar */
.capa-previa { display: flex; gap: 12px; align-items: flex-start; margin-top: 8px; }
.capa-previa img { width: 96px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 10px; flex: none; background: var(--fundo); }
.capa-previa p { margin: 4px 0 0; }
.botao.mini.primario { color: #fff; }

/* estilos do vídeo animado */
.estilos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.estilo-card {
  display: flex; flex-direction: column; gap: 4px; padding: 6px; text-align: left; min-width: 0;
  border: 1px solid var(--linha); border-radius: 12px; background: var(--fundo); color: var(--texto); font: inherit; cursor: pointer;
}
.estilo-card img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; display: block; }
.estilo-card strong { font-size: 13px; line-height: 1.2; }
.estilo-card small { color: var(--suave); font-size: 11px; line-height: 1.25; }
.estilo-card.ativo { border-color: var(--acento); box-shadow: 0 0 0 2px var(--acento) inset; }
