/* Painel da central — estilo geral.
   Ordem: cores e base · estrutura (menu, barra, paginas) · pecas (botoes, campos,
   paineis) · aparelhos · janelas (TV, PC, camera, assistente) · notificacoes ·
   ajustes · teclado e mini-player · celular (no fim, para valer sobre o resto).
   Pagina Inicio, Noticias e Midia: inicio.css. */

/* ---------- cores e base ---------- */
:root {
  --fundo: #0b0a12;
  --fundo-pagina:
    radial-gradient(900px 520px at 0% -10%, rgba(124, 92, 255, .16), transparent 60%),
    radial-gradient(800px 480px at 100% -5%, rgba(226, 85, 161, .10), transparent 60%),
    radial-gradient(700px 500px at 60% 110%, rgba(34, 211, 238, .06), transparent 60%),
    #0b0a12;
  --cartao: #15131f;
  --cartao-on: #1d1a2c;
  --painel: rgba(255, 255, 255, .035);
  --painel-forte: rgba(255, 255, 255, .06);
  --borda: rgba(255, 255, 255, .08);
  --borda-forte: rgba(255, 255, 255, .16);
  --texto: #ecebf5;
  --texto-2: #9b98ae;
  --roxo: #8b5cf6;
  --rosa: #e255a1;
  --ciano: #22d3ee;
  --destaque: #8b5cf6;
  --grad: linear-gradient(135deg, #7c5cff 0%, #b04fd6 55%, #e255a1 100%);
  --perigo: #ef4444;
  --ok: #4ade80;
  --luz: #fbbf24;
  --tv: #38bdf8;
  --pc: #4ade80;
  --tomada: #c084fc;
  --raio: 18px;
  --fonte-titulo: "Outfit", "Inter", system-ui, sans-serif;
  --fonte: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --barra: 52px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--fundo); color: var(--texto); font-family: var(--fonte); }
body { font-size: 15px; line-height: 1.4; }
button { font-family: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--fonte-titulo); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* tela do Pi: sem ponteiro do mouse */
body.pi, body.pi * { cursor: none !important; }

/* ---------- estrutura: barra fina + paginas; menu lateral escondido (abre pelo ☰) ---------- */
body.app { overflow: hidden; user-select: none; }

#lateral {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: 260px; display: flex; flex-direction: column; gap: 18px;
  padding: 20px 14px calc(20px + env(safe-area-inset-bottom)); background: #100e19; border-right: 1px solid var(--borda-forte);
  box-shadow: 20px 0 60px rgba(0, 0, 0, .5); transform: translateX(-105%); transition: transform .25s ease-out;
}
body.menu-aberto #lateral { transform: none; }
#lateral-fundo { position: fixed; inset: 0; z-index: 39; background: rgba(5, 4, 10, .5); opacity: 0; pointer-events: none; transition: opacity .2s; }
body.menu-aberto #lateral-fundo { opacity: 1; pointer-events: auto; }
.marca { display: flex; align-items: center; gap: 12px; padding: 4px 8px 14px; border-bottom: 1px solid var(--borda); }
.marca img { width: 38px; height: 38px; border-radius: 11px; }
.marca b { display: block; font-family: var(--fonte-titulo); font-size: 20px; letter-spacing: .02em; }
.marca span { display: block; font-size: 12px; color: var(--texto-2); text-transform: uppercase; letter-spacing: .12em; }

#pontos { display: flex; flex-direction: column; gap: 4px; }
#pontos button {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 0; border-radius: 12px;
  background: transparent; color: var(--texto-2); font-size: 15px; font-weight: 500; text-align: left;
}
#pontos button svg { width: 21px; height: 21px; fill: currentColor; flex: none; }
#pontos button:hover { background: var(--painel); color: var(--texto); }
#pontos button.ativo { background: linear-gradient(90deg, rgba(124, 92, 255, .22), rgba(226, 85, 161, .08)); color: #fff; }
#pontos button.ativo::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--grad); }

.lateral-rodape { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; background: var(--painel); font-size: 13px; color: var(--texto-2); }
.quem { display: flex; align-items: center; gap: 10px; }
.quem-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 15px; }
.quem-avatar img { width: 100%; height: 100%; object-fit: cover; }
.quem-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.quem-texto b { color: var(--texto); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quem-texto small { font-size: 12px; }
.conexao-linha { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid var(--borda); }
.conexao { width: 9px; height: 9px; border-radius: 50%; background: var(--perigo); flex: none; box-shadow: 0 0 0 3px rgba(239, 68, 68, .18); }
.conexao.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(74, 222, 128, .18); }

#area { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
#barra {
  flex: none; height: var(--barra); display: flex; align-items: center; gap: 10px;
  padding: 0 14px; border-bottom: 1px solid rgba(255, 255, 255, .05); background: rgba(11, 10, 18, .6); z-index: 5;
}
.barra-titulo { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
#titulo-pagina { margin: 0; font-size: 17px; font-weight: 600; line-height: 1; }
#sub-pagina { font-size: 12.5px; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-dir { display: flex; align-items: center; gap: 6px; flex: none; }
.hora-pequena { font-family: var(--fonte-titulo); font-size: 15px; font-weight: 600; color: var(--texto-2); margin-right: 6px; }

.icone-bt {
  position: relative; width: 34px; height: 34px; flex: none; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 10px; background: transparent;
}
.icone-bt svg { width: 20px; height: 20px; fill: var(--texto-2); }
.icone-bt:hover { background: var(--painel-forte); }
.icone-bt:hover svg { fill: var(--texto); }
#chat-bt { position: relative; }
#chat-contagem, #sino-contagem {
  position: absolute; top: -3px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--rosa); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
#sino-contagem[hidden], #chat-contagem[hidden] { display: none; }
.saude-mini {
  height: 30px; display: flex; align-items: center; gap: 3px; padding: 0 9px; border: 0; border-radius: 8px;
  background: rgba(255, 255, 255, .04); font-size: 12px; color: var(--texto-2);
}
.saude-mini svg { width: 16px; height: 16px; fill: #fbbf24; }
.saude-mini.alerta { background: rgba(239, 68, 68, .2); border-color: rgba(239, 68, 68, .5); color: #fff; }

/* paginas empilhadas (app.js): a atual por cima, as vizinhas ja desenhadas por baixo */
#trilho { position: relative; z-index: 0; flex: 1; min-height: 0; overflow: hidden; transition: transform .2s ease-out; }
.pagina {
  position: absolute; inset: 0; z-index: 1; background: var(--fundo-pagina); will-change: transform;
  overflow-y: auto; overflow-x: hidden; touch-action: pan-y; padding: 24px 28px 48px;
}
.pagina.fora { visibility: hidden; }
.pagina:not(.atual) .ondas i { animation-play-state: paused; }
.pagina-nota { font-size: 13px; color: var(--texto-2); margin: 0 0 12px; }

/* assistente: botao flutuante fora do Inicio */
.assistente {
  position: fixed; right: 24px; bottom: 24px; z-index: 6; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: var(--grad); box-shadow: 0 10px 30px rgba(124, 92, 255, .35);
}
.assistente svg { width: 26px; height: 26px; fill: #fff; }
body[data-pagina="pg-inicio"] .assistente, body[data-pagina="pg-ajustes"] .assistente { display: none; }

/* ---------- pecas ---------- */
.painel { background: var(--painel); border: 1px solid var(--borda); border-radius: 20px; padding: 18px 20px; }
.painel-rotulo {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 12px; font-weight: 600;
  color: var(--texto-2); text-transform: uppercase; letter-spacing: .12em;
}
.painel-rotulo svg { width: 16px; height: 16px; fill: currentColor; }
.ponto-vivo { width: 8px; height: 8px; border-radius: 50%; background: var(--ciano); box-shadow: 0 0 10px var(--ciano); animation: vivo 2s ease-in-out infinite; }
@keyframes vivo { 50% { opacity: .35; } }
.secao-titulo { font-size: 12px; font-weight: 600; color: var(--texto-2); text-transform: uppercase; letter-spacing: .12em; margin: 8px 0 2px; }

.bt {
  min-height: 46px; display: inline-grid; place-items: center; padding: 6px 14px; font-size: 15px; font-weight: 600; color: var(--texto);
  background: rgba(255, 255, 255, .05); border: 1px solid var(--borda); border-radius: 12px; transition: background .15s, transform .1s;
}
.bt:hover { background: rgba(255, 255, 255, .09); }
.bt:active { transform: scale(.97); }
.bt svg { width: 24px; height: 24px; fill: currentColor; }
.bt.destaque, .bt.atual { background: var(--grad); border-color: transparent; color: #fff; }
.bt.energia svg { fill: #f87171; }
.bt.redondo { width: 46px; flex: none; padding: 0; border-radius: 50%; }
.bt[data-confirmar] { background: var(--perigo); border-color: var(--perigo); color: #fff; }
.bt:disabled { opacity: .45; }
.bt.pequeno { min-height: 34px; font-size: 13px; padding: 2px 12px; border-radius: 10px; }

.campo {
  min-height: 46px; padding: 0 14px; font: inherit; font-size: 15px; color: var(--texto);
  background: rgba(255, 255, 255, .04); border: 1px solid var(--borda); border-radius: 12px; outline: none; min-width: 0;
}
.campo:focus { border-color: var(--roxo); box-shadow: 0 0 0 3px rgba(139, 92, 246, .2); }
.campo::placeholder { color: #6f6b84; }
select.campo { appearance: auto; }

.linha { display: flex; gap: 10px; margin-bottom: 10px; }
.linha > * { flex: 1; }
.coluna h3 { margin: 16px 0 8px; font-size: 12px; font-weight: 600; color: var(--texto-2); text-transform: uppercase; letter-spacing: .12em; font-family: var(--fonte); }
.coluna h3:first-child { margin-top: 0; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 14px; font-weight: 500; color: var(--texto-2);
  background: var(--painel); border: 1px solid var(--borda); border-radius: 999px;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cor-tema, var(--roxo)); }
.chip:hover { color: var(--texto); }
.chip.ativo { color: #fff; background: rgba(139, 92, 246, .18); border-color: var(--cor-tema, var(--roxo)); }

.vazio { color: var(--texto-2); font-size: 17px; grid-column: 1 / -1; text-align: center; padding: 60px 20px; }
.menu-estado { font-size: 14px; color: var(--texto-2); }
.dica { font-size: 13px; }

/* ---------- aparelhos (paginas Casa e Aparelhos, app.js) ---------- */
#casa, #aparelhos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 18px; align-items: start; }
.secao { background: var(--painel); border: 1px solid var(--borda); border-radius: 20px; padding: 16px 18px 18px; }
.secao-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.secao h2 { margin: 0; font-size: 20px; font-weight: 700; }
.secao-extra { display: flex; gap: 6px; font-size: 13px; color: var(--texto-2); }
.subsecao h3 { margin: 14px 0 8px; font-size: 11px; font-weight: 600; font-family: var(--fonte); color: var(--texto-2); text-transform: uppercase; letter-spacing: .14em; }
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }

/* cartao de aparelho: icone | nome e estado | chave; controles embaixo */
.cartao {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; column-gap: 10px;
  padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, .035); border: 1px solid var(--borda);
  transition: background .2s, border-color .2s, transform .1s; cursor: pointer;
}
.cartao:active { transform: scale(.98); }
.cartao.ligado { background: color-mix(in srgb, var(--cor) 10%, rgba(255, 255, 255, .03)); border-color: color-mix(in srgb, var(--cor) 40%, transparent); }
.cartao.offline { opacity: .45; }
.cartao .topo { display: contents; }
.cartao .icone { grid-row: 1 / 3; grid-column: 1; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .06); }
.cartao .icone svg { width: 21px; height: 21px; fill: var(--texto-2); }
.cartao.ligado .icone { background: color-mix(in srgb, var(--cor) 22%, transparent); }
.cartao.ligado .icone svg { fill: var(--cor); }
.cartao .nome { grid-column: 2; grid-row: 1; align-self: end; font-size: 15px; font-weight: 600; line-height: 1.2;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cartao .estado { grid-column: 2; grid-row: 2; align-self: start; font-size: 12.5px; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chave { grid-row: 1 / 3; grid-column: 3; position: relative; width: 44px; height: 26px; border-radius: 13px; background: #3a3650; transition: background .2s; }
.chave::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .2s; }
.cartao.ligado .chave { background: var(--cor); }
.cartao.ligado .chave::after { left: 21px; }
.cartao > input[type=range], .cartao > .botoes, .cartao > .miniatura { grid-column: 1 / -1; }
.cartao input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 6px 0 0; background: transparent; }
.cartao input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: #3a3650; }
.cartao input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--cor); }
.cartao .botoes { display: flex; gap: 6px; margin-top: 10px; }
.cartao .botoes button { flex: 1; height: 36px; font-size: 16px; font-weight: 600; background: rgba(255, 255, 255, .06); border: 0; border-radius: 10px; }
.cartao .botoes button:active { background: var(--cor); color: #111; }
.cartao .botoes.pc button { font-size: 12.5px; }
.aj-bloq-aparelho, .aj-bloq-site { width: 100%; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; gap: 10px; }
.aj-bloq-site span { word-break: break-all; }
.aj-bloq-site b { white-space: nowrap; font-weight: 500; color: var(--texto-2); }
.aj-bloq-site.bloqueado span { color: #f87171; }
.aj-bloq-horas { font-size: 12px; color: var(--texto-2); padding: 2px 0 8px 8px; }
.aj-bloq-sites { max-height: 60vh; overflow-y: auto; }
.cartao .volume-numero { flex: 1; display: grid; place-items: center; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cartao .botoes button[data-confirmar] { background: var(--perigo); color: #fff; }
.botoes.pc-desligado button { background: color-mix(in srgb, var(--pc) 85%, black); color: #0b0a12; font-size: 14px; }
.cartao-camera .chave { display: none; }
.cartao .miniatura { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; background: #000; margin-top: 10px; }

/* ---------- janelas (TV, PC, camera, assistente: menu.js) ---------- */
.menu-fundo { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(5, 4, 10, .7); backdrop-filter: blur(4px); }
.menu-janela {
  width: min(1100px, 100%); max-height: 92vh; overflow: auto; padding: 20px 22px;
  background: #13111d; border: 1px solid var(--borda-forte); border-radius: 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
.menu-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.menu-titulo { font-family: var(--fonte-titulo); font-size: 22px; font-weight: 700; }
.menu-corpo { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; }
.menu-corpo.pc { grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
.menu-janela.janela-pc { width: min(1500px, 100%); max-height: 96vh; padding: 14px 16px; }
.janela-pc .tela-remota { width: 100%; max-height: calc(96vh - 110px); object-fit: contain; }
.menu-janela.tela-cheia { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; padding: 0; border: 0; }
.tela-cheia .menu-topo, .tela-cheia .coluna.estreita { display: none; }
.tela-cheia .menu-corpo.pc { grid-template-columns: 1fr; }
.tela-cheia .tela-quadro { border-radius: 0; height: 100vh; }
.tela-cheia .tela-remota { max-height: 100vh; height: 100vh; }
.sair-cheia { display: none !important; position: absolute; top: 10px; right: 10px; opacity: .8; }
.tela-cheia .sair-cheia { display: grid !important; }
.pad-flutuante { display: none; }
.tela-cheia .pad-flutuante { display: block; position: absolute; right: 16px; bottom: 16px; width: 260px; padding: 12px; border-radius: 20px; background: rgba(11, 10, 18, .6); }
.pad-flutuante .bt { background: rgba(21, 19, 31, .75); min-height: 60px; }
.tela-quadro { position: relative; display: grid; place-items: center; background: #000; border-radius: 16px; min-height: 280px; overflow: hidden; }
.tela-remota { display: block; max-width: 100%; max-height: 70vh; cursor: crosshair; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.zoom-botoes { position: absolute; left: 6px; bottom: 6px; display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 999px; background: rgba(11, 10, 18, .55); }
.zoom-botoes .bt { width: 28px; height: 28px; min-height: 0; padding: 0; font-size: 15px; }
.tela-cheia .zoom-botoes { left: 16px; bottom: 16px; }
.tela-cheia .zoom-botoes .bt { width: 40px; height: 40px; font-size: 19px; }
.zoom-texto { min-width: 0; font-size: 12px; color: #ddd; padding: 0 2px; }
.zoom-texto:empty { display: none; }
.tela-toque { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 2px solid #22d3ee; background: rgba(34, 211, 238, .3); pointer-events: none; animation: toque-some .6s ease-out forwards; }
@keyframes toque-some { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.tela-aviso { position: absolute; color: var(--texto-2); font-size: 16px; padding: 20px; text-align: center; }

.dpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.dpad .bt { min-height: 64px; }
.dpad .ok { border-radius: 50%; }
.apps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; max-height: 420px; overflow-y: auto; }
.apps .bt { font-size: 14px; min-height: 46px; }
.apps .bt.remover { border-color: var(--perigo); color: #fca5a5; }
.apps + .dica { margin-top: 10px; }
.apps ~ .linha { margin-top: 12px; }

.slider { margin-bottom: 14px; }
.slider input[type=range] { width: 100%; height: 36px; accent-color: var(--roxo); }
.linha-rotulo { display: flex; justify-content: space-between; font-size: 15px; }
.valor-slider { color: var(--texto-2); }
.lista { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 50vh; overflow: auto; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; font-size: 15px;
  background: rgba(255, 255, 255, .035); border: 1px solid var(--borda); border-radius: 14px; }
.item.coluna-item { flex-direction: column; align-items: stretch; }
.item-nome { font-size: 15px; font-weight: 600; }
.item-info { color: var(--texto-2); font-size: 13px; }
.item-botoes { display: flex; gap: 6px; flex: none; }
.item .bt { min-height: 40px; font-size: 13px; }
.etiqueta { color: var(--ok); font-size: 13px; align-self: center; }
.saude-lista { display: flex; flex-direction: column; gap: 6px; }
.saude-linha { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 12px; background: rgba(255, 255, 255, .035); font-size: 14px; }
.saude-linha span { color: var(--texto-2); }
.saude-linha.alerta { background: rgba(239, 68, 68, .15); }
.saude-linha.alerta b { color: #fca5a5; }

/* assistente (janela e bolha) */
.bt.falar { min-height: 70px; font-size: 20px; }
.opcao { display: flex; align-items: center; gap: 10px; color: var(--texto-2); font-size: 14px; margin: 4px 0 14px; }
.opcao input { width: 20px; height: 20px; accent-color: var(--roxo); }
.conversa { display: flex; flex-direction: column; gap: 10px; max-height: 45vh; overflow: auto; }
.troca { padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .035); border: 1px solid var(--borda); }
.bolha-voce { color: var(--texto-2); font-size: 14px; margin-bottom: 4px; }
.bolha-resposta { font-size: 16px; }
.bolha-etapa { font-size: 14px; font-weight: 600; color: var(--ciano); margin-bottom: 4px; }
#bolha {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px); z-index: 25; width: min(640px, calc(100vw - 32px));
  padding: 14px 18px; border-radius: 18px; background: rgba(19, 17, 29, .97); border: 1px solid var(--borda-forte);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
#bolha.visivel { opacity: 1; transform: translate(-50%, 0); }
#bolha.ouvindo { border-color: var(--ciano); }
#bolha.erro .bolha-etapa { color: var(--perigo); }

/* modo noite da tela do Pi (so com tela ligada) */
#cortina { position: fixed; inset: 0; z-index: 50; background: #000; display: grid; place-content: center; text-align: center; }
.cortina-hora { font-size: 120px; font-weight: bold; color: #2a2f36; }
.cortina-dica { font-size: 18px; color: #1f2329; margin-top: 8px; }

/* ---------- notificacoes (avisos.js) ---------- */
.gaveta-fundo { position: fixed; inset: 0; z-index: 30; background: rgba(5, 4, 10, .55); opacity: 0; transition: opacity .2s; }
.gaveta-fundo.aberta { opacity: 1; }
.gaveta {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); display: flex; flex-direction: column; gap: 12px;
  padding: 18px; background: #12101b; border-left: 1px solid var(--borda-forte); transform: translateX(100%); transition: transform .25s ease-out;
}
.gaveta-fundo.aberta .gaveta { transform: none; }
.gaveta-topo { display: flex; align-items: center; justify-content: space-between; }
/* chat da casa (chat.js) */
.chat-corpo { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.chat-voltar[hidden] { display: none; }
.chat-lista { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.chat-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; text-align: left; width: 100%;
  background: rgba(255, 255, 255, .035); border: 1px solid var(--borda); color: inherit; font: inherit; cursor: pointer; }
.chat-item.nao-lida { border-color: rgba(139, 92, 246, .55); }
.chat-icone { font-size: 22px; flex: none; }
.chat-item-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-item-texto small { color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-nao-lidas { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--rosa); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.chat-mensagens { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.chat-msg { align-self: flex-start; max-width: 82%; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: rgba(255, 255, 255, .06); }
.chat-msg.minha { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: rgba(139, 92, 246, .32); }
.chat-de { font-size: 12px; font-weight: 700; color: var(--ciano); margin-bottom: 2px; }
.chat-texto { white-space: pre-wrap; word-break: break-word; }
.chat-hora { font-size: 11px; color: var(--texto-2); text-align: right; margin-top: 2px; }
.chat-msg { cursor: pointer; }
.chat-apagar { margin-top: 6px; padding: 4px 10px; font-size: 13px; }
.chat-dica { align-self: center; font-size: 11px; color: var(--texto-2); }
.chat-limpar { display: flex; justify-content: center; }
.chat-limpar:empty { display: none; }
.chat-limpar .bt.perigo { color: #f87171; }
.chat-envio { align-items: flex-end; }
.chat-campo { flex: 1; resize: none; min-height: 44px; max-height: 120px; }
.avisos-lista { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.aviso { display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .035); border: 1px solid var(--borda); }
.aviso.nao-lida { border-color: rgba(139, 92, 246, .55); }
.aviso-icone { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; background: rgba(255, 255, 255, .08); }
.nivel-ok .aviso-icone { background: rgba(74, 222, 128, .2); color: var(--ok); }
.nivel-alerta .aviso-icone { background: rgba(239, 68, 68, .25); color: #fca5a5; }
.aviso-texto { min-width: 0; }
.aviso-titulo { font-size: 15px; font-weight: 600; }
.aviso-desc { font-size: 13px; color: var(--texto-2); margin-top: 2px; }
.aviso-quando { font-size: 12px; color: var(--texto-2); margin-top: 4px; opacity: .8; }
#toasts { position: fixed; top: 84px; right: 18px; z-index: 35; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast { background: #17142a; box-shadow: 0 12px 34px rgba(0, 0, 0, .5); animation: toast-entrar .3s ease-out; cursor: pointer; }
.toast.saindo { opacity: 0; transform: translateX(30px); transition: all .35s; }
@keyframes toast-entrar { from { opacity: 0; transform: translateX(40px); } }

/* ---------- ajustes (ajustes.js) ---------- */
/* lista de categorias | pagina da categoria (no celular: uma de cada vez) */
.ajustes { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 22px; align-items: start; max-width: 1280px; }
.aj-menu { position: sticky; top: 0; display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 20px; background: var(--painel); border: 1px solid var(--borda); }
.aj-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 14px; background: transparent; text-align: left; }
.aj-item:hover { background: rgba(255, 255, 255, .04); }
.aj-item.ativo { background: rgba(139, 92, 246, .16); }
.aj-item-icone { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--cor-item) 18%, transparent); }
.aj-item-icone svg { width: 20px; height: 20px; fill: var(--cor-item); }
.aj-item-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.aj-item-texto b { font-size: 15px; font-weight: 600; }
.aj-item-texto small { font-size: 12.5px; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aj-item-seta { font-size: 22px; color: var(--texto-2); line-height: 1; }
.aj-detalhe { min-width: 0; }
.aj-detalhe-topo { margin-bottom: 14px; }
.aj-detalhe-topo h2 { margin: 0; font-size: 24px; font-weight: 700; }
.aj-voltar { display: none; min-height: 34px; padding: 0 12px; margin-bottom: 10px; font-size: 14px; }
.aj-detalhe .aj-cartao > h2, .aj-detalhe .aj-cartao > .aj-desc { display: none; }
.aj-detalhe .aj-cartao > .aj-corpo { margin-top: 0; }
.aj-cartao { background: var(--painel); border: 1px solid var(--borda); border-radius: 20px; padding: 18px 20px; }
.aj-cartao h2 { margin: 0; font-size: 20px; font-weight: 700; }
.aj-desc { margin: 4px 0 0; color: var(--texto-2); font-size: 14px; }
.aj-corpo { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.aj-corpo > h3 { margin: 6px 0 0; font-size: 12px; font-family: var(--fonte); color: var(--texto-2); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; }
.aj-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.aj-campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.aj-campo[hidden] { display: none; }
.aj-rotulo { font-size: 13px; color: var(--texto-2); }
.aj-dica { font-size: 12.5px; color: var(--texto-2); opacity: .85; }
.aj-cartao .campo { width: 100%; }
.aj-cartao .linha { flex-wrap: wrap; margin-bottom: 0; }
.aj-rodape { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--borda); }
.aj-salvar { min-width: 130px; }
.aj-status { flex: 1; font-size: 14px; color: var(--texto-2); }
.aj-status.ok { color: var(--ok); }
.aj-status.erro { color: #fca5a5; }
.aj-lista { display: flex; flex-direction: column; gap: 6px; }
.interruptor { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .035); border: 1px solid var(--borda); cursor: pointer; }
.interruptor input { display: none; }
.chave-aj { flex: none; position: relative; width: 44px; height: 26px; border-radius: 13px; background: #3a3650; transition: background .2s; }
.chave-aj::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .2s; }
.interruptor input:checked + .chave-aj { background: var(--roxo); }
.interruptor input:checked + .chave-aj::after { left: 21px; }
.aj-texto { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.aj-texto b { font-weight: 600; }
.aj-texto small { font-size: 12.5px; color: var(--texto-2); }
.aj-aparelhos { display: flex; flex-direction: column; gap: 8px; }
.aj-aparelho { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .035); border: 1px solid var(--borda); }
.aj-aparelho-campos { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.aj-aparelho .bt { min-height: 38px; font-size: 13px; }
.aj-ordem { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 12px; background: rgba(255, 255, 255, .035); font-size: 15px; }
.aj-ordem { flex-wrap: wrap; }
.aj-ordem .bt { min-width: 44px; min-height: 38px; padding: 0 12px; }
.aj-temas { display: flex; flex-direction: column; gap: 8px; }
.aj-tema { display: grid; grid-template-columns: 1fr 1.2fr 2fr 46px; gap: 6px; }
.aj-tirar { padding: 0; }
.aj-texto-longo { min-height: 84px; padding: 10px 14px; resize: vertical; line-height: 1.4; font-family: inherit; }
.aj-avatar { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.aj-avatar-grande { width: 96px; height: 96px; font-size: 40px; }
.aj-avatar-opcoes { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 10px; }
.aj-cores { display: flex; gap: 8px; flex-wrap: wrap; }
.aj-cor { width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); padding: 0; }
.aj-cor:focus-visible, .aj-cor:hover { border-color: #fff; }
.aj-usuario-nome { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.aj-usuario-nome .quem-avatar { width: 30px; height: 30px; font-size: 13px; }

/* ---------- teclado na tela (teclado.js, so na tela do Pi) ---------- */
#teclado {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; flex-direction: column; gap: 6px; padding: 8px 8px 10px;
  background: #0a0910; border-top: 1px solid var(--borda); transform: translateY(105%); transition: transform .22s ease-out;
}
#teclado.aberto { transform: none; }
.tec-linha { display: flex; gap: 6px; justify-content: center; }
.tec { flex: 1; max-width: 96px; height: 54px; font-size: 22px; background: #2a2640; border: 0; border-radius: 10px; padding: 0; }
.tec.apertada { background: var(--roxo); color: #fff; }
.tec-especial { background: #1d1a2c; font-size: 18px; color: var(--texto-2); max-width: 130px; flex: 1.4; }
.tec-espaco { flex: 5; max-width: 420px; font-size: 16px; color: var(--texto-2); }
.tec-ok { background: var(--grad); color: #fff; }
.tec-ativa { background: #3b3560; color: #fff; }
.tec-fechar { position: absolute; right: 10px; top: -44px; width: 64px; height: 40px; font-size: 22px; color: var(--texto-2); background: #0a0910;
  border: 1px solid var(--borda); border-bottom: 0; border-radius: 12px 12px 0 0; }
.com-teclado .menu-fundo { place-items: start center; padding-top: 6px; }
.com-teclado .menu-janela { max-height: calc(100vh - 310px); }
.com-teclado .pagina { padding-bottom: 320px; }
.com-teclado .assistente, .com-teclado #mini-player { display: none !important; }

/* ---------- aviso de versao nova do app (app.js) ---------- */
#novo-app {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 30; width: max-content; max-width: calc(100vw - 24px);
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 16px; border-radius: 16px; font-size: 14px;
  background: rgba(23, 20, 42, .97); border: 1px solid rgba(139, 92, 246, .55); box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

/* ---------- mini reprodutor (midia.js), fora da pagina Midia ---------- */
#mini-player {
  position: fixed; left: 20px; bottom: 20px; z-index: 6; max-width: 420px; display: flex; align-items: center; gap: 4px; cursor: pointer;
  padding: 5px 5px 5px 12px; border-radius: 999px; background: rgba(23, 20, 42, .95); border: 1px solid rgba(139, 92, 246, .45);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
body[data-pagina="pg-midia"] #mini-player { display: none; }
.mini-titulo { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: none; border: 0; font-size: 13px; padding: 0; }
.mini-titulo span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mini-player .bt.ico { min-height: 40px; width: 40px; padding: 0; border-radius: 50%; background: rgba(255, 255, 255, .06); border: 0; }
#mini-player .bt.ico svg { width: 20px; height: 20px; }
.ondas { display: flex; align-items: flex-end; gap: 3px; height: 18px; flex: none; }
.ondas i { width: 4px; height: 100%; border-radius: 2px; background: var(--ciano); transform-origin: bottom; animation: onda-som 1s ease-in-out infinite; }
.ondas i:nth-child(2) { animation-delay: -.4s; }
.ondas i:nth-child(3) { animation-delay: -.7s; }
.ondas i:nth-child(4) { animation-delay: -.2s; }
@keyframes onda-som { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
.pausado .ondas i { animation-play-state: paused; }

/* ---------- TV (app Central, tv.js): navegacao pelas setas do controle ---------- */
.tv :focus { outline: 3px solid #fff !important; outline-offset: 3px; border-radius: 14px; }
.tv .cartao:focus, .tv .resumo-bloco:focus, .tv .noticia:focus { transform: scale(1.03); }
.tv #nucleo:focus { outline: none !important; }
.tv .chat-msg:focus { outline-offset: -3px; } /* dentro da lista que rola: o contorno nao fica cortado */
.tv #nucleo:focus canvas { filter: drop-shadow(0 0 18px rgba(34, 211, 238, .8)); }
.tv .assistente, .tv #mini-player { display: none; }
.tv .pagina { scroll-behavior: smooth; }

/* ---------- telas menores (no fim, para valer sobre o resto) ---------- */
/* ajustes: uma tela de cada vez (lista -> categoria, com "‹ Ajustes" para voltar) */
@media (max-width: 899px) {
  .ajustes { grid-template-columns: minmax(0, 1fr); }
  .aj-menu { position: static; }
  .ajustes .aj-detalhe { display: none; }
  .ajustes.vendo-secao .aj-menu { display: none; }
  .ajustes.vendo-secao .aj-detalhe { display: block; }
  .aj-voltar { display: inline-grid; }
}

@media (max-width: 760px) {
  #sub-pagina { display: none; }
  .saude-mini { display: none; }
  .pagina { padding: 14px 12px calc(40px + env(safe-area-inset-bottom)); }
  .assistente { right: 14px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 52px; height: 52px; }
  #mini-player { left: 10px; right: 76px; bottom: calc(18px + env(safe-area-inset-bottom)); max-width: none; }
  #toasts { top: 62px; right: 12px; }
  .menu-fundo { padding: 0; place-items: end center; }
  .menu-janela { max-height: 92vh; border-radius: 22px 22px 0 0; padding: 16px; }
  .menu-corpo.pc { grid-template-columns: minmax(0, 1fr); }
  .dpad .bt { min-height: 58px; }
  .painel, .secao, .aj-cartao { padding: 14px; border-radius: 18px; }
  .aj-tema { grid-template-columns: 1fr 1fr; }
  .aj-aparelho-campos { grid-template-columns: 1fr; }
  .grade { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- rotinas (pagina Casa) e editor de comodos/grupos/rotinas (Ajustes) ---------- */
.rotinas-faixa { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 14px; scrollbar-width: none; }
.rotinas-faixa[hidden] { display: none; }
.rotina-bt { flex: none; display: flex; align-items: center; gap: 8px; padding: 11px 16px; border-radius: 999px; border: 1px solid var(--borda-forte);
  background: var(--cartao); color: var(--texto); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.rotina-bt svg { width: 18px; height: 18px; fill: #fbbf24; }
.rotina-bt:hover, .rotina-bt:focus-visible { border-color: var(--destaque); }
.rotina-bt.rodando { background: var(--cartao-on); border-color: #fbbf24; }
.rotina-bt.rodando svg { animation: pisca .8s infinite alternate; }
@keyframes pisca { to { opacity: .3; } }
.aj-ordem .campo { flex: 1; min-width: 0; }
.aj-ordem small { color: var(--texto-2); white-space: nowrap; }
.aj-marcar { display: flex; flex-wrap: wrap; gap: 8px; }
.aj-marcar label { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, .05);
  border: 1px solid var(--borda); font-size: 14px; cursor: pointer; }
.aj-marcar label:has(input:checked) { border-color: var(--destaque); background: rgba(139, 92, 246, .18); }
.aj-marcar input { accent-color: var(--destaque); }
.aj-bloco { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: rgba(255, 255, 255, .03); border: 1px solid var(--borda); }
.aj-bloco h4 { margin: 0; font-size: 16px; }
.aj-passo { display: grid; grid-template-columns: 130px 1fr auto; gap: 8px; align-items: center; }
.aj-passo-campos { display: flex; gap: 8px; flex-wrap: wrap; }
.aj-passo-campos > * { flex: 1 1 140px; min-width: 0; }
@media (max-width: 600px) { .aj-passo { grid-template-columns: 1fr auto; } .aj-passo > select:first-child { grid-column: 1 / -1; } }

/* ---------- bonecos (boneco.js) e vozes ---------- */
.quem-avatar img.boneco { width: 100%; height: 100%; object-fit: cover; }
.aj-boneco-galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; }
.aj-boneco-opcao { aspect-ratio: 1; padding: 0; border-radius: 18px; border: 2px solid transparent; overflow: hidden; cursor: pointer; }
.aj-boneco-opcao img { width: 100%; height: 100%; display: block; }
.aj-boneco-opcao:hover, .aj-boneco-opcao:focus-visible { border-color: #fff; transform: scale(1.04); }
.aj-boneco-partes { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.aj-boneco-partes[hidden] { display: none; }
.aj-boneco-parte { display: grid; grid-template-columns: 1fr 40px 110px 40px; align-items: center; gap: 6px; padding: 5px 6px 5px 12px;
  border-radius: 12px; background: rgba(255, 255, 255, .035); font-size: 14px; }
.aj-boneco-parte span { color: var(--texto-2); }
.aj-boneco-parte b { text-align: center; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aj-boneco-parte .bt { min-height: 36px; padding: 0; }
.aj-voz { flex-wrap: nowrap; }
.aj-voz select { flex: 1; min-width: 0; }
.aj-voz .bt { flex: none; }

/* ---------- tela da TV (scrcpy) ---------- */
.tela-tv-coluna { grid-column: 1 / -1; width: 100%; }
.tela-tv-coluna > .linha .bt { flex: 0 0 auto; }
.tela-tv-coluna .tela-quadro { max-width: 900px; margin: 0 auto; }
.tela-quadro[hidden] { display: none; }
.tela-tv video { width: 100%; max-height: 62vh; background: #000; border-radius: 14px; }

/* escolha do comodo (campoArea em menu.js) */
.campo-area { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.campo-area .campo { flex: 1 1 140px; min-width: 0; }
.campo-area [hidden] { display: none; }
/* rotinas: lista fechada, so o nome; toca para editar */
.aj-rotina { border-radius: 14px; background: rgba(255, 255, 255, .03); border: 1px solid var(--borda); }
.aj-rotina-topo { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 0; }
.aj-rotina-cabeca { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px 14px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.aj-rotina-nome { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aj-rotina-nome b { font-size: 16px; }
.aj-rotina-nome small { color: var(--texto-2); font-size: 12.5px; }
.aj-rotina-seta { font-size: 22px; color: var(--texto-2); transition: transform .2s; }
.aj-rotina-seta.aberta { transform: rotate(90deg); }
.aj-rotina-corpo { padding: 0 10px 10px; }
.aj-rotina-corpo .aj-bloco { background: none; border: 0; padding: 4px; }

/* convidado: so o chat, em tela cheia */
body.convidado > *:not(.gaveta-fundo):not(#toasts) { display: none !important; }
body.convidado .gaveta-fundo { background: var(--fundo, #0b0a12); }
body.convidado .gaveta.chat { width: 100%; max-width: 720px; margin: 0 auto; }
