/* AI Hub no celular: mesmo tema quente do PC, pensado para o polegar (iPhone). */
:root {
  --bg: #262624; --side: #1f1e1d; --surface: #30302e; --surface-2: #3a3936;
  --text: #f5f4ef; --text-2: #d6d3c9; --muted: #a6a39a; --faint: #7d7a72;
  --border: rgba(222, 220, 209, 0.14); --accent: #d97757; --accent-h: #e08566;
  --ok: #7fd18b; --bad: #f08a7e; --warn: #e9c46a; --info: #8ab4f8;
  --serif: Georgia, 'Times New Roman', serif;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.primario { border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; padding: 12px 16px; }
.secundario { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 8px 12px; font-weight: 600; font-size: 14px; }
.icone { border: 0; background: transparent; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: var(--text-2); }
.link { border: 0; background: none; color: var(--accent-h); text-decoration: underline; padding: 0; font-size: 14px; }

/* pareamento */
.parear { min-height: 100%; display: flex; flex-direction: column; gap: 14px; justify-content: center; padding: max(24px, env(safe-area-inset-top)) 24px 24px; text-align: center; }
.parear .logo { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto; background: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 22px; color: #fff; }
.parear h1 { font-family: var(--serif); font-weight: 400; font-size: 32px; margin: 0; }
.parear p { color: var(--muted); margin: 0; line-height: 1.45; }
.parear input { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 14px; text-align: center; }
#codigo { font-size: 30px; letter-spacing: 10px; font-family: var(--mono); }
.instalar { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; color: var(--text-2); font-size: 14px; line-height: 1.45; }
.erro { color: var(--bad); min-height: 1.2em; }

/* app */
.app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.topo { display: flex; align-items: center; gap: 6px; padding: calc(env(safe-area-inset-top) + 6px) 8px 6px; background: var(--side); border-bottom: 1px solid var(--border); }
.titulo { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.titulo b { font-size: 15px; }
.titulo span { font-size: 12px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.equipe { display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto; background: var(--side); border-bottom: 1px solid var(--border); }
.tm { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12px; color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; background: rgba(255, 255, 255, 0.03); }
.tm b { color: var(--text); }
.tm .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.tm.is-working .dot { background: var(--accent); animation: pulso 1.1s infinite; }
.tm.is-judging .dot { background: var(--info); animation: pulso 1.1s infinite; }
.tm.is-watching .dot { background: var(--ok); }
.tm.is-off .dot { background: var(--bad); }
@keyframes pulso { 50% { opacity: 0.3; } }

.barra-app { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.barra-app select { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 8px; font-size: 14px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; padding: 2px; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 9px; border-radius: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.seg button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.12); color: var(--text); }

.conversa { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 10px; }
.boas-vindas { margin: auto 0; text-align: center; color: var(--muted); padding: 20px; }
.boas-vindas h2 { font-family: var(--serif); font-weight: 400; color: var(--text); font-size: 26px; margin: 0 0 8px; }
.msg-user { align-self: flex-end; max-width: 86%; background: var(--surface-2); border-radius: 16px; padding: 10px 13px; white-space: pre-wrap; word-break: break-word; }
.etapa { border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; background: rgba(255, 255, 255, 0.02); }
.etapa.ao-vivo { border-color: rgba(217, 119, 87, 0.45); }
.etapa-topo { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.papel { background: rgba(217, 119, 87, 0.16); color: #f0b39a; border-radius: 6px; padding: 2px 7px; font-weight: 700; }
.ia-claude { color: #e08a6a; font-weight: 700; }
.ia-gpt { color: #5fcf9f; font-weight: 700; }
.etapa-texto { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.55; color: var(--text-2); }
.etapa-texto .arq { display: block; font-family: var(--mono); font-size: 13px; color: var(--accent-h); }
.juiz-linha { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 2px 0; color: var(--muted); font-size: 13px; font-style: italic; }
.etapa:not(.ao-vivo) .juiz-linha { font-style: normal; }
.etapa.juiz-ok { padding: 8px 12px; }
.etapa.juiz-ok .juiz-linha { color: var(--ok); }
.etapa.juiz-ok .etapa-topo { margin-bottom: 2px; }
.veredito { margin-top: 6px; font-size: 13px; font-weight: 700; }
.veredito.ok { color: var(--ok); }
.veredito.bad { color: var(--bad); }
.nota { font-size: 13px; color: var(--text-2); border: 1px solid var(--border); border-radius: 12px; padding: 9px 11px; background: rgba(255, 255, 255, 0.03); }
.nota.ok { border-color: rgba(127, 209, 139, 0.4); }
.nota.bad { border-color: rgba(240, 138, 126, 0.45); color: #f8d0c9; }
.faixa { border: 1px solid rgba(233, 196, 106, 0.45); background: rgba(233, 196, 106, 0.1); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.faixa b { color: #f3e2b0; }
.faixa .botoes { display: flex; flex-wrap: wrap; gap: 8px; }
.faixa.feita { opacity: 0.6; }
.fim { font-size: 13px; color: var(--muted); border: 1px dashed var(--border); border-radius: 12px; padding: 9px 11px; }
.fim .t { font-weight: 700; }
.fim.ok .t { color: var(--ok); }
.fim.bad .t { color: var(--bad); }

.caixa { display: flex; gap: 8px; align-items: flex-end; padding: 8px 10px; border-top: 1px solid var(--border); background: var(--bg); }
.caixa textarea { flex: 1; resize: none; max-height: 140px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); padding: 10px 14px; line-height: 1.4; outline: none; }
.enviar { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.enviar:disabled { opacity: 0.4; }
.parar { border: 1px solid rgba(240, 138, 126, 0.5); background: rgba(220, 80, 70, 0.15); color: #f8d0c9; border-radius: 18px; padding: 10px 14px; font-weight: 600; }

.abas { display: flex; border-top: 1px solid var(--border); background: var(--side); padding-bottom: env(safe-area-inset-bottom); }
.abas button { flex: 1; border: 0; background: transparent; padding: 8px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--faint); font-size: 11px; font-weight: 600; }
.abas button[aria-selected="true"] { color: var(--accent); }

/* gaveta */
.gaveta { position: fixed; inset: 0; z-index: 10; background: var(--side); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.gaveta-topo { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.gaveta ul { list-style: none; margin: 0; padding: 6px; flex: 1; overflow-y: auto; }
.gaveta li button { width: 100%; text-align: left; border: 0; background: transparent; padding: 11px 10px; border-radius: 10px; display: flex; flex-direction: column; gap: 2px; }
.gaveta li button.ativa { background: rgba(255, 255, 255, 0.08); }
.gaveta li .t { font-size: 15px; color: var(--text); }
.gaveta li .d { font-size: 12px; color: var(--faint); }
.gaveta .vazio { color: var(--faint); padding: 16px; font-size: 14px; }
.gaveta-pe { padding: 12px 14px calc(env(safe-area-inset-bottom) + 12px); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }

/* prévia */
.previa { position: fixed; inset: 0; z-index: 20; background: #1b1b1a; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.previa-topo { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; }
.previa-topo span { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.previa-aviso { margin: 0 10px 8px; color: var(--muted); font-size: 14px; }
.previa iframe { flex: 1; border: 0; background: #fff; }

/* contas e ajustes */
.gaveta-botoes { display: flex; gap: 8px; margin-bottom: 4px; }
.gaveta-botoes button { flex: 1; padding: 10px; }
.painel { position: fixed; inset: 0; z-index: 25; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.painel-espaco { width: 64px; }
.painel-corpo { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 12px calc(env(safe-area-inset-bottom) + 24px); display: flex; flex-direction: column; gap: 12px; }
.grupo { border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: rgba(255, 255, 255, 0.02); display: flex; flex-direction: column; gap: 10px; }
.grupo > h3 { margin: 0; font-size: 15px; }
.grupo .dica { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.linha { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.linha > span { color: var(--text-2); }
.linha select, .campo { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 8px; font-size: 14px; max-width: 60%; }
.campo { max-width: none; width: 100%; }
.conta { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.conta:first-of-type { border-top: 0; padding-top: 0; }
.conta-topo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conta-topo b { font-size: 15px; }
.conta-topo .esp { flex: 1; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.selo { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 6px; background: rgba(255, 255, 255, 0.08); color: var(--text-2); }
.selo.ok { color: var(--ok); }
.selo.bad { color: var(--bad); }
.selo.principal { background: rgba(217, 119, 87, 0.2); color: #f0b39a; }
.botoes { display: flex; flex-wrap: wrap; gap: 8px; }
.login { border: 1px solid rgba(138, 180, 248, 0.4); background: rgba(138, 180, 248, 0.08); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.login a.primario { text-align: center; text-decoration: none; }
.codigo-curto { font-family: var(--mono); font-size: 26px; letter-spacing: 3px; text-align: center; user-select: all; -webkit-user-select: all; }
.chave { position: relative; width: 46px; height: 28px; flex: none; appearance: none; -webkit-appearance: none; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); margin: 0; }
.chave::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: var(--text-2); transition: left 0.15s; }
.chave:checked { background: var(--accent); }
.chave:checked::after { left: 20px; background: #fff; }

.aviso { position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 76px); z-index: 30; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
