:root {
  --cyan: #37e0ff;
  --cyan-dim: #1b8fb3;
  --bg: #03060c;
  --glow: 0 0 18px rgba(55, 224, 255, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: #cfefff;
  font-family: "Segoe UI", "SF Pro Display", system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Vinheta + leve grade de holograma sobre a cena */
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.7) 100%),
    repeating-linear-gradient(0deg, rgba(55,224,255,0.035) 0px, rgba(55,224,255,0.035) 1px, transparent 2px, transparent 4px);
}

/* Topbar */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  z-index: 5;
}
.brand {
  font-weight: 700;
  letter-spacing: 6px;
  font-size: 18px;
  color: var(--cyan);
  text-shadow: var(--glow);
}
.brand .dot {
  display: inline-block;
  width: 8px; height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: var(--glow);
  animation: pulse 2s infinite ease-in-out;
}
@keyframes pulse { 0%,100%{opacity:.4} 50%{opacity:1} }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.pill {
  font-size: 12px;
  padding: 5px 12px;
  border: 1px solid rgba(55,224,255,0.4);
  border-radius: 999px;
  color: var(--cyan);
  text-transform: lowercase;
}
.pill.error { border-color: #ff5b6e; color: #ff9aa6; }
.pill.ok { border-color: #46e39a; color: #9affce; }

.icon-btn {
  background: transparent;
  border: 1px solid rgba(55,224,255,0.4);
  color: var(--cyan);
  width: 38px; height: 38px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  transition: .2s;
}
.icon-btn:hover { background: rgba(55,224,255,0.12); box-shadow: var(--glow); }
.icon-btn.hidden { display: none; }

/* Janela de transcrição (à esquerda, abaixo da marca) */
.transcript {
  position: fixed;
  top: 66px;
  left: 22px;
  width: min(360px, 42vw);
  max-height: 42vh;
  display: flex;
  flex-direction: column;
  background: rgba(6, 20, 30, 0.6);
  border: 1px solid rgba(55, 224, 255, 0.28);
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(55, 224, 255, 0.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 6;
  overflow: hidden;
}
.transcript.hidden { display: none; }

.tr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid rgba(55, 224, 255, 0.16);
  flex: none;
}
.tr-title {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cyan);
}
.tr-actions { display: flex; gap: 4px; }
.tr-btn {
  background: transparent;
  border: none;
  color: #8fbfd6;
  font-size: 13px;
  width: 24px;
  height: 22px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}
.tr-btn:hover { background: rgba(55, 224, 255, 0.14); color: var(--cyan); }

.tr-body {
  overflow-y: auto;
  padding: 10px 12px 12px;
  text-align: left;
}
.transcript.min .tr-body { display: none; }

.cap { margin: 4px 0; line-height: 1.4; word-wrap: break-word; }
.cap.user { color: #8fbfd6; font-size: 13px; opacity: .8; }
.cap.jarvis { color: #d9f6ff; font-size: 16px; text-shadow: 0 0 12px rgba(55,224,255,0.35); }
.cap:empty { display: none; }

/* Controles */
.controls {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px;
  z-index: 5;
}

.ptt {
  position: relative;
  width: 84px; height: 84px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  background: radial-gradient(circle at center, rgba(55,224,255,0.25), rgba(55,224,255,0.05));
  color: var(--cyan);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: .15s;
  box-shadow: var(--glow);
}
.ptt .ptt-label {
  position: absolute;
  bottom: -22px;
  font-size: 11px;
  white-space: nowrap;
  color: #8fbfd6;
}
.ptt .mic-glyph { font-size: 30px; line-height: 1; filter: drop-shadow(0 0 6px var(--cyan)); }
.ptt .ptt-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(55,224,255,0.4);
  opacity: 0;
}
/* Ouvindo (mic ligado): anel pulsando continuamente */
.ptt.listening {
  background: radial-gradient(circle at center, rgba(70,227,154,0.4), rgba(70,227,154,0.1));
  border-color: #46e39a;
}
.ptt.listening .mic-glyph { filter: drop-shadow(0 0 6px #46e39a); }
.ptt.listening .ptt-ring { opacity: 1; border-color: rgba(70,227,154,0.5); animation: ring 1.6s infinite ease-out; }
/* Standby: ouvindo localmente (grátis), sem enviar à API */
.ptt.standby { border-color: rgba(55,224,255,0.6); background: radial-gradient(circle at center, rgba(55,224,255,0.15), rgba(55,224,255,0.03)); }
.ptt.standby .mic-glyph { filter: drop-shadow(0 0 5px var(--cyan)); opacity: .85; }
/* Mudo */
.ptt.muted { opacity: 0.55; border-color: rgba(255,91,110,0.6); }
.ptt.muted .mic-glyph { filter: grayscale(1) drop-shadow(0 0 4px #ff5b6e); }
@keyframes ring { 0%{transform:scale(1);opacity:.7} 100%{transform:scale(1.6);opacity:0} }

.text-form { display: flex; gap: 8px; width: min(560px, 90vw); }
.text-form input {
  flex: 1;
  background: rgba(6, 20, 30, 0.7);
  border: 1px solid rgba(55,224,255,0.3);
  border-radius: 10px;
  color: #d9f6ff;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
}
.text-form input:focus { border-color: var(--cyan); box-shadow: var(--glow); }
.send-btn {
  background: rgba(55,224,255,0.15);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  border-radius: 10px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 16px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: grid;
  place-items: center;
  z-index: 20;
}
.modal.hidden { display: none; }
.modal-card {
  width: min(440px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  background: #071722;
  border: 1px solid rgba(55,224,255,0.35);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 0 40px rgba(55,224,255,0.15);
}
.modal-card h2 { margin: 0 0 16px; color: var(--cyan); letter-spacing: 2px; }
.modal-card h3.sub { margin: 4px 0 2px; font-size: 13px; color: var(--cyan); font-weight: 600; }
.modal-card .sep { border: none; border-top: 1px solid rgba(55,224,255,0.18); margin: 20px 0 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 90px; gap: 10px; }
.grid2 > div { min-width: 0; }
.modal-card label { display: block; margin: 14px 0 6px; font-size: 13px; color: #9fd6ea; }
.modal-card input, .modal-card select {
  width: 100%;
  background: rgba(6,20,30,0.8);
  border: 1px solid rgba(55,224,255,0.3);
  border-radius: 8px;
  color: #d9f6ff;
  padding: 10px 12px;
  outline: none;
  font-size: 14px;
}
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.primary {
  flex: 1;
  background: var(--cyan);
  color: #04222b;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-weight: 700;
  cursor: pointer;
}
.ghost {
  background: transparent;
  border: 1px solid rgba(55,224,255,0.4);
  color: var(--cyan);
  border-radius: 8px;
  padding: 11px 16px;
  cursor: pointer;
}
.hint { font-size: 12px; color: #7fb0c6; margin: 8px 0 0; }
.hint.small { opacity: .7; }

/* ===== PWA mobile: menu inferior nativo + folhas ===== */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  height: 58px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(4, 12, 20, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(55, 224, 255, 0.22);
  z-index: 30;
}
.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: #7fb0c6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  letter-spacing: .3px;
  cursor: pointer;
}
.tab .tab-ico { font-size: 20px; line-height: 1; }
.tab.active { color: var(--cyan); text-shadow: 0 0 10px rgba(55,224,255,.5); }
.tab.active .tab-ico { filter: drop-shadow(0 0 6px var(--cyan)); }

/* Sobe os controles (mic + texto) para ficarem acima do menu */
.controls { bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
/* Respeita o notch no topo */
.topbar { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }

/* Folha inferior (Agenda / Notas) */
.sheet {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  max-height: 62vh;
  display: flex;
  flex-direction: column;
  background: rgba(7, 20, 30, 0.97);
  border-top: 1px solid rgba(55,224,255,0.3);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  z-index: 25;
  transform: translateY(0);
  transition: transform .25s ease;
}
.sheet.hidden { transform: translateY(110%); pointer-events: none; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid rgba(55,224,255,0.15);
}
.sheet-head span { color: var(--cyan); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }
.sheet-body { overflow-y: auto; padding: 8px 16px 18px; }
.sheet-item {
  padding: 12px 0; border-bottom: 1px solid rgba(55,224,255,0.1);
}
.sheet-item .si-title { color: #d9f6ff; font-size: 15px; }
.sheet-item .si-sub { color: #8fbfd6; font-size: 12px; margin-top: 3px; }
.sheet-empty { color: #7fb0c6; text-align: center; padding: 30px 0; font-size: 14px; }

/* Em telas maiores, o menu fica mais discreto/centralizado */
@media (min-width: 820px) {
  .tabbar { max-width: 520px; margin: 0 auto; border-radius: 16px 16px 0 0;
            border-left: 1px solid rgba(55,224,255,0.15); border-right: 1px solid rgba(55,224,255,0.15); }
}
