/* Advercase: fonte principal do BRB (licença guardada fora do repositório, em fontes-originais/) */
@font-face { font-family: "Advercase"; src: url(fonts/advercase-regular.woff2) format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "Advercase"; src: url(fonts/advercase-bold.woff2) format("woff2"); font-weight: 700; font-display: block; }
@font-face { font-family: "Instrument Serif"; src: url(fonts/instrument-serif.woff2) format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "Inter"; src: url(fonts/inter-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fonts/inter-latin-800-normal.woff2) format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --fundo: #0c0b0a;
  --superficie: #171513;
  --superficie-2: #211e1b;
  --linha: #2f2b27;
  --texto: #f3efe8;
  --suave: #9b948a;
  --acento: #ffe14a;
  --acento-texto: #17140a;
  --erro: #ff7a6b;
  --raio: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fundo); color: var(--texto); }
body { font: 15px/1.45 "Inter", system-ui, sans-serif; min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
[hidden] { display: none !important; }

.marca { font-family: "Instrument Serif", serif; font-size: 22px; margin: 0; letter-spacing: 0.01em; }

/* Entrada */
.entrar { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.entrar-caixa { width: min(380px, 100%); }
.entrar h1 { font-family: "Instrument Serif", serif; font-weight: 400; font-size: 48px; line-height: 1.02; margin: 12px 0 32px; }
.entrar h1 em { color: var(--acento); font-style: normal; }
.entrar form { display: grid; gap: 10px; }
.entrar label { color: var(--suave); font-size: 13px; }
.entrar input { background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio); padding: 14px; font-size: 20px; letter-spacing: 0.12em; text-transform: uppercase; }

/* Topo */
.topo { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: rgba(12,11,10,0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--linha); }
.abas { display: flex; gap: 4px; margin: 0 auto; background: var(--superficie); padding: 3px; border-radius: 999px; }
.abas button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; color: var(--suave); }
.abas button[aria-selected="true"] { background: var(--texto); color: var(--fundo); font-weight: 600; }

/* Botões */
.primario { background: var(--acento); color: var(--acento-texto); border: 0; border-radius: var(--raio); padding: 11px 18px; font-weight: 700; }
.primario:disabled { opacity: 0.4; cursor: not-allowed; }
.primario:not(:disabled):active { transform: scale(0.98); }
.largo { width: 100%; padding: 15px; font-size: 16px; }
.botao { display: inline-flex; align-items: center; justify-content: center; background: var(--superficie-2); border: 1px solid var(--linha); border-radius: var(--raio); padding: 10px 14px; font-weight: 600; cursor: pointer; }
.discreto { background: none; border: 0; color: var(--suave); padding: 6px; text-decoration: underline; text-underline-offset: 3px; }
.linha { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.erro { color: var(--erro); min-height: 20px; margin: 0; font-size: 14px; }

/* Criar */
.criar { display: grid; grid-template-columns: minmax(260px, 400px) minmax(0, 460px); gap: 28px; justify-content: center; padding: 20px 16px 40px; }
.palco { position: sticky; top: 72px; align-self: start; }
.moldura { position: relative; aspect-ratio: 9 / 16; border-radius: 18px; overflow: hidden; background: #000; border: 1px solid var(--linha); }
.moldura canvas { width: 100%; height: 100%; display: block; }
.palco-vazio { position: absolute; inset: 0; display: grid; place-items: center; color: var(--suave); text-align: center; padding: 20px; background: repeating-linear-gradient(135deg, #111 0 14px, #141210 14px 28px); }
/* Zona segura do Reels: topo 285/1920, base 1470/1920, direita 990/1080 */
.guias span { position: absolute; pointer-events: none; border: 0 dashed rgba(255,225,74,0.4); }
.guia-topo { left: 0; right: 0; top: 14.84%; border-top-width: 1px; }
.guia-base { left: 0; right: 0; top: 76.56%; border-top-width: 1px; }
.guia-direita { top: 0; bottom: 0; left: 91.67%; border-left-width: 1px; }

.controles { display: grid; gap: 14px; align-content: start; }
.bloco { background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio); padding: 14px; display: grid; gap: 10px; }
.bloco h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--suave); margin: 0; }
.botoes-take { display: flex; gap: 8px; }
.botoes-take > * { flex: 1; }
textarea, .bloco input:not([type="range"]), .frases input, .equipe input {
  width: 100%; background: var(--fundo); border: 1px solid var(--linha); border-radius: 10px; padding: 10px 12px; resize: vertical;
}
#frase { font-family: "Instrument Serif", serif; font-size: 22px; line-height: 1.15; }

.takes { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; overflow-x: auto; }
.takes li { flex: 0 0 64px; }
.takes button { position: relative; width: 64px; height: 112px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: #000; }
.takes button[aria-pressed="true"] { border-color: var(--acento); }
.takes video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.takes .dur { position: absolute; bottom: 3px; right: 4px; font-size: 11px; background: rgba(0,0,0,0.7); padding: 0 4px; border-radius: 4px; }
.takes .carregando { display: grid; place-items: center; height: 112px; font-size: 11px; color: var(--suave); text-align: center; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { background: var(--superficie-2); border: 1px solid var(--linha); border-radius: 999px; padding: 7px 13px; }
.chips button[aria-checked="true"] { background: var(--texto); color: var(--fundo); border-color: var(--texto); font-weight: 600; }
.chips .advercase { font-family: "Advercase", sans-serif; font-weight: 700; }
.chips .serifa { font-family: "Instrument Serif", serif; font-size: 17px; }
.chips .amarela { font-family: "Instrument Serif", serif; font-size: 17px; color: var(--acento); }
.chips button[aria-checked="true"].amarela { color: #8a6f00; }
.chips .caixa { font-weight: 800; text-transform: uppercase; font-size: 12px; }

.faixa { display: grid; gap: 6px; color: var(--suave); font-size: 13px; }
.faixa input { accent-color: var(--acento); width: 100%; }
.faixa output { color: var(--texto); }

.progresso { height: 6px; background: var(--superficie-2); border-radius: 999px; overflow: hidden; }
.progresso span { display: block; height: 100%; width: 0; background: var(--acento); transition: width 0.2s linear; }
.status { color: var(--suave); min-height: 20px; margin: 0; }
.resultados { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.resultado { display: grid; gap: 6px; }
.resultado video { width: 100%; aspect-ratio: 9/16; object-fit: cover; border-radius: 10px; background: #000; }
.resultado .linha > * { flex: 1; font-size: 13px; padding: 8px; text-align: center; text-decoration: none; }
.dica { color: var(--suave); font-size: 13px; margin: 0; }
.selo { font-size: 11px; padding: 3px 6px; border-radius: 6px; text-align: center; }
.selo.ok { background: rgba(120, 200, 140, 0.15); color: #9fdcb0; }
.selo.aviso { background: rgba(255, 122, 107, 0.15); color: var(--erro); }
.takes .baixa { position: absolute; top: 3px; left: 3px; font-size: 10px; background: var(--erro); color: #000; padding: 0 4px; border-radius: 4px; font-weight: 700; }
#lote-texto { font-size: 15px; }
.lista-frases .acoes button.perigo { background: var(--erro); color: #000; border-color: var(--erro); font-weight: 700; }
.lista-frases .edicao { display: grid; gap: 6px; }
.lista-frases .edicao textarea, .lista-frases .edicao input { width: 100%; background: var(--fundo); border: 1px solid var(--linha); border-radius: 8px; padding: 8px 10px; }
.lista-frases .edicao textarea { font-family: "Instrument Serif", serif; font-size: 19px; }
.marca-dagua { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--suave); }
.marca-opcoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.marca-opcoes input:not([type="file"]) { flex: 1 1 160px; }
.opcoes-lote { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; font-size: 13px; color: var(--suave); }
.takes li { position: relative; }
.takes .remover { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--linha); background: var(--superficie-2); color: var(--texto); font-size: 13px; line-height: 1; padding: 0; z-index: 1; }
.resultado .apagar-video { background: none; border: 0; color: var(--suave); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; padding: 2px; }
.adicionar { background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio); padding: 12px; }
.adicionar summary { cursor: pointer; font-weight: 600; }
.adicionar[open] { display: grid; gap: 10px; }
.sugestao .punch { display: block; margin-top: 2px; }

/* Frases */
.frases, .equipe { max-width: 720px; margin: 0 auto; padding: 18px 16px 40px; display: grid; gap: 12px; }
.frases-topo { display: flex; gap: 8px; }
.sugestoes { background: var(--superficie); border: 1px solid var(--acento); border-radius: var(--raio); padding: 12px; display: grid; gap: 8px; }
.sugestoes h3 { margin: 0; font-size: 14px; }
.sugestao { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.sugestao input { margin-top: 5px; accent-color: var(--acento); width: 18px; height: 18px; }
.lote-barra { justify-content: space-between; color: var(--suave); font-size: 14px; }
.lista-frases { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lista-frases li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; background: var(--superficie); border: 1px solid var(--linha); border-radius: 10px; padding: 10px 12px; }
.lista-frases .texto { font-family: "Instrument Serif", serif; font-size: 19px; line-height: 1.2; }
.lista-frases .punch { display: block; font-family: "Inter", sans-serif; font-size: 13px; color: var(--acento); }
.lista-frases .meta { display: block; font-size: 12px; color: var(--suave); font-family: "Inter", sans-serif; }
.lista-frases input[type="checkbox"] { accent-color: var(--acento); width: 18px; height: 18px; }
.lista-frases .acoes { display: flex; gap: 4px; }
.lista-frases .acoes button { background: var(--superficie-2); border: 1px solid var(--linha); border-radius: 8px; padding: 6px 10px; font-size: 13px; }

/* Equipe */
.novo-codigo { background: var(--superficie); border: 1px solid var(--acento); border-radius: var(--raio); padding: 14px; }
.novo-codigo strong { font-size: 24px; letter-spacing: 0.12em; color: var(--acento); }
.lista-pessoas, .lista-historico { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lista-pessoas li, .lista-historico li { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--superficie); border: 1px solid var(--linha); border-radius: 10px; padding: 10px 12px; }
.lista-pessoas small, .lista-historico small { color: var(--suave); }
.equipe h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--suave); margin: 18px 0 0; }

/* Folha */
.folha { width: min(560px, 100vw); max-height: 85dvh; margin: auto auto 0; border: 1px solid var(--linha); border-radius: 18px 18px 0 0; background: var(--fundo); color: var(--texto); padding: 14px; }
.folha::backdrop { background: rgba(0,0,0,0.6); }
.folha-topo { display: flex; gap: 8px; margin-bottom: 10px; }
.folha-topo input { flex: 1; background: var(--superficie); border: 1px solid var(--linha); border-radius: 10px; padding: 10px; }
.folha .lista-frases li { grid-template-columns: 1fr; cursor: pointer; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--texto); color: var(--fundo); padding: 10px 16px; border-radius: 10px; max-width: calc(100vw - 32px); z-index: 20; font-weight: 600; }
.toast.ruim { background: var(--erro); }

@media (max-width: 760px) {
  .criar { grid-template-columns: 1fr; gap: 16px; padding-top: 12px; }
  .palco { position: static; width: min(240px, 62vw); margin: 0 auto; }
  .criar.sem-take .palco { display: none; }
  .topo .marca { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.botao.desligado { opacity: 0.55; }
