/* fontes locais (sem Google Fonts) */
@font-face { font-family: 'Sora'; font-weight: 300; font-display: swap; src: url('/fonts/sora-300.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 400; font-display: swap; src: url('/fonts/sora-400.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 600; font-display: swap; src: url('/fonts/sora-600.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 300; font-display: swap; src: url('/fonts/jetbrains-mono-300.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap; src: url('/fonts/jetbrains-mono-400.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 600; font-display: swap; src: url('/fonts/jetbrains-mono-600.woff2') format('woff2'); }

:root {
  --fundo: #03060d;
  --ciano: #22d3ee;
  --ciano-claro: #a5f3fc;
  --violeta: #a78bfa;
  --ambar: #fbbf24;
  --vermelho: #f87171;
  --verde: #34d399;
  --texto: #d7f3fa;
  --texto-2: #8fb4c1;
  --texto-3: #557c8a;
  --linha: rgba(34, 211, 238, 0.2);
  --vidro: rgba(6, 18, 30, 0.72);
  --acento: var(--ciano);
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --sans: 'Sora', -apple-system, system-ui, sans-serif;
  --seg-topo: env(safe-area-inset-top, 0px);
  --seg-baixo: env(safe-area-inset-bottom, 0px);
}
body[data-estado='pensando'] { --acento: var(--violeta); }
body[data-estado='ouvindo'] { --acento: var(--ciano-claro); }

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--fundo); color: var(--texto); font-family: var(--sans); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
body { user-select: none; -webkit-user-select: none; touch-action: manipulation; }

#orb { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.vinheta { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 42%, transparent 40%, rgba(0, 0, 0, 0.75) 100%); }

/* topo */
.topo {
  position: fixed; left: 0; right: 0; top: 0; padding: calc(var(--seg-topo) + 12px) 18px 12px;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, rgba(3, 6, 13, 0.92), transparent);
}
.logo {
  font-family: var(--mono); font-weight: 600; letter-spacing: 0.4em; font-size: 13px;
  background: linear-gradient(90deg, var(--violeta), var(--ciano)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.conexao { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.18em; color: var(--texto-2); }
.conexao i { width: 7px; height: 7px; border-radius: 50%; background: var(--ambar); box-shadow: 0 0 8px var(--ambar); }
.conexao.ok i { background: var(--verde); box-shadow: 0 0 8px var(--verde); }
.conexao.erro i { background: var(--vermelho); box-shadow: 0 0 8px var(--vermelho); }

/* núcleos: etiqueta tocável sobre cada círculo vivo */
.nucleos { position: fixed; inset: 0; pointer-events: none; }
.nucleo { position: absolute; left: 0; top: 0; width: 0; height: 0; --cor: var(--ciano); }
.nucleo[data-id='whatsapp'] { --cor: #34d399; }
.nucleo[data-id='email'] { --cor: #a78bfa; }
.nucleo[data-id='agenda'] { --cor: #fbbf24; }
.nucleo[data-id='almode'] { --cor: #22d3ee; }
.nucleo[data-id='bancos'] { --cor: #f472b6; }
.nucleo[data-nivel='critico'] { --cor: #f87171; }
.nucleo .alvo { position: absolute; width: 64px; height: 64px; left: -32px; top: -32px; border-radius: 50%; pointer-events: auto; }
.nucleo .etq {
  position: absolute; left: 0; top: 30px; transform: translateX(-50%); white-space: nowrap; text-align: center;
  font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.16em; color: var(--cor); pointer-events: none;
}
.nucleo .etq b { display: block; font-size: 15px; font-weight: 300; color: var(--texto); letter-spacing: 0.04em; text-shadow: 0 0 10px var(--cor); }
.nucleo[data-id='bancos'] .etq { top: auto; bottom: 30px; }

/* resposta */
.resposta {
  position: fixed; left: 18px; right: 18px; bottom: calc(var(--seg-baixo) + 118px);
  text-align: center; pointer-events: none;
}
.estado { font-family: var(--mono); font-size: 10px; letter-spacing: 0.45em; color: var(--acento); text-shadow: 0 0 12px currentColor; transition: color 0.5s; }
.texto {
  margin-top: 10px; max-height: 6.6em; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
  font-size: 15px; line-height: 1.45; font-weight: 300; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9);
  mask-image: linear-gradient(180deg, transparent, #000 30%);
}

/* barra de comando */
.comando {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 28px calc(var(--seg-baixo) + 18px);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(0deg, rgba(3, 6, 13, 0.95) 40%, transparent);
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.secundario {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: var(--texto-2);
  background: var(--vidro); border: 1px solid var(--linha);
}
#mic {
  position: relative; width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; color: var(--ciano);
  background: radial-gradient(circle, rgba(34, 211, 238, 0.22), rgba(6, 18, 30, 0.9) 70%);
  border: 1px solid rgba(34, 211, 238, 0.5); box-shadow: 0 0 28px rgba(34, 211, 238, 0.25);
  transition: transform 0.2s, background 0.3s, color 0.3s;
}
#mic:active { transform: scale(0.94); }
#mic .anel { position: absolute; inset: -8px; border-radius: 50%; border: 1px dashed rgba(34, 211, 238, 0.45); animation: girar 12s linear infinite; }
body[data-estado='ouvindo'] #mic { background: var(--ciano); color: var(--fundo); box-shadow: 0 0 40px var(--ciano); }
body[data-estado='ouvindo'] #mic .anel { animation-duration: 2s; border-style: solid; }
body[data-estado='pensando'] #mic { color: var(--violeta); border-color: var(--violeta); }
body[data-estado='pensando'] #mic .anel { border-color: var(--violeta); animation-duration: 1.2s; }
@keyframes girar { to { transform: rotate(360deg); } }

/* digitar */
.digitar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--seg-baixo) + 112px); display: none; gap: 8px;
  padding: 6px; background: var(--vidro); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--linha); border-radius: 26px;
}
.digitar.aberto { display: flex; }
.digitar input { flex: 1; background: none; border: none; outline: none; color: var(--texto); font: 16px var(--sans); padding: 0 12px; user-select: text; -webkit-user-select: text; }
.digitar button { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--fundo); background: var(--ciano); border-radius: 20px; padding: 10px 14px; }

/* folha (núcleo aberto ou conversa) */
.veu { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.veu.visivel { opacity: 1; pointer-events: auto; }
.folha {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 78vh; overflow-y: auto; z-index: 3;
  padding: 10px 20px calc(var(--seg-baixo) + 24px);
  background: rgba(6, 16, 28, 0.96); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 2px solid var(--cor-folha, var(--ciano)); border-radius: 22px 22px 0 0;
  transform: translateY(105%); transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.2, 1);
  user-select: text; -webkit-user-select: text;
}
.folha.aberta { transform: translateY(0); }
.alca { width: 40px; height: 4px; border-radius: 2px; background: var(--texto-3); margin: 0 auto 14px; }
.folha h3 { font-family: var(--mono); font-weight: 400; font-size: 10.5px; letter-spacing: 0.22em; color: var(--cor-folha, var(--ciano)); margin-bottom: 4px; }
.folha .titulo { font-size: 17px; margin-bottom: 12px; }
.folha ul { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.folha li { font-size: 13.5px; line-height: 1.45; color: var(--texto-2); padding-left: 12px; border-left: 2px solid var(--cor-folha, var(--ciano)); }
.acoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acoes button {
  padding: 14px 12px; border-radius: 14px; text-align: left; font-size: 13px; line-height: 1.3;
  background: rgba(34, 211, 238, 0.06); border: 1px solid var(--linha);
}
.acoes button small { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; color: var(--cor-folha, var(--ciano)); margin-bottom: 4px; }
.acoes button:active { background: rgba(34, 211, 238, 0.18); }

.msgs { display: flex; flex-direction: column; gap: 12px; }
.msg { font-size: 14px; line-height: 1.55; white-space: pre-line; }
.msg.voce { align-self: flex-end; max-width: 86%; padding: 8px 12px; border-radius: 14px 14px 3px 14px; background: rgba(34, 211, 238, 0.1); border: 1px solid var(--linha); color: var(--ciano-claro); }
.msg.jarvis { padding-left: 12px; border-left: 2px solid var(--ciano); }
.msg.jarvis small { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.22em; color: var(--ciano); margin-bottom: 3px; }
.vazio { color: var(--texto-3); font-size: 13px; }

/* avisos proativos */
.avisos { position: fixed; top: calc(var(--seg-topo) + 52px); left: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 4; pointer-events: none; }
.aviso {
  padding: 12px 14px; border-radius: 14px; background: rgba(10, 22, 36, 0.94); border: 1px solid var(--linha); border-left: 3px solid var(--ciano);
  font-size: 13px; line-height: 1.4; animation: entrar 0.4s both, sair 0.5s ease 9s forwards; pointer-events: auto;
}
.aviso small { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em; color: var(--texto-3); margin-bottom: 3px; }
.aviso.email { border-left-color: var(--violeta); }
.aviso.whatsapp { border-left-color: var(--verde); }
.aviso.reuniao, .aviso.briefing { border-left-color: var(--ambar); }
.aviso.banco { border-left-color: #f472b6; }
@keyframes entrar { from { opacity: 0; transform: translateY(-12px); } }
@keyframes sair { to { opacity: 0; transform: translateY(-12px); } }

/* pareamento */
.parear {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 32px; text-align: center; background: rgba(3, 6, 13, 0.92);
}
.parear[hidden] { display: none; }
.parear p { font-size: 16px; }
.parear .sub { color: var(--texto-2); font-size: 14px; line-height: 1.5; }
.parear b { color: var(--ciano); font-family: var(--mono); font-weight: 400; letter-spacing: 0.1em; font-size: 12px; }
#form-pin { display: flex; flex-direction: column; gap: 12px; width: min(280px, 80vw); margin-top: 8px; }
#pin {
  text-align: center; font: 300 30px var(--mono); letter-spacing: 0.3em; color: var(--ciano-claro);
  background: rgba(34, 211, 238, 0.06); border: 1px solid var(--linha); border-radius: 14px; padding: 14px 8px; outline: none;
  user-select: text; -webkit-user-select: text;
}
#pin:focus { border-color: rgba(34, 211, 238, 0.6); box-shadow: 0 0 24px rgba(34, 211, 238, 0.15); }
#form-pin button { font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em; color: var(--fundo); background: var(--ciano); border-radius: 14px; padding: 14px; }
.erro-pin { min-height: 1.4em; color: var(--vermelho); font-size: 13px; }
.topo-dir { display: flex; align-items: center; gap: 12px; }
.sino {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 14px;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; color: var(--fundo); background: var(--ciano);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.45); animation: chamar 2.4s ease-in-out infinite;
}
.sino[hidden] { display: none; }
@keyframes chamar { 50% { box-shadow: 0 0 4px rgba(34, 211, 238, 0.2); } }
.aviso.aparelho { border-left-color: var(--vermelho); }
