:root { --cinza-apagado: #9aa0b8; }

.nivel-palco { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding-bottom: 8vh; }
.nivel-shell { width: min(900px, 92vw); transform: translateY(-4vh); transition: opacity .25s, transform .25s; }
.nivel-shell.troca { opacity: 0; transform: translateY(-2vh); }
.nivel-shell .level-shell-caption { padding: 26px 48px 22px; }
.nivel-corpo { padding: 22px 48px 36px; }
.nivel-cabeca { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 24px; }
.nivel-titulo { font-size: 44px; line-height: 1.1; }
.nivel-cabeca .level-line { margin: 12px 0 0; }
.nivel-resumo { text-align: right; }
.nivel-resumo .level-tags { justify-content: flex-end; margin: 8px 0 0; }
.nivel-instrucao { margin: 18px 0 12px; font: 600 12px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.casos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-height: 42vh; overflow-y: auto; padding: 4px 6px 8px 2px; }
.caso {
  display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 14px; text-align: left;
  padding: 12px 16px 12px 12px; border-radius: 18px; border: 1.5px solid var(--line); background: #fff;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.caso:hover, .caso:focus-visible { border-color: var(--blue); box-shadow: 0 10px 26px rgba(40, 0, 200, .14); transform: translateY(-1px); }
.caso img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; border: 2px solid var(--blue-soft); }
.caso-info { min-width: 0; }
.caso-nome { font: 600 15px/1.25 var(--font); color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caso-processo { font: 500 12px/1.3 var(--font); color: var(--blue); margin-top: 1px; }
.caso-perfil { font: 400 12px/1.35 var(--font); color: var(--muted); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.caso-lado { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.caso-chip { padding: 3px 10px; border-radius: 12px; background: var(--paper); font: 500 11px var(--font); color: var(--navy); white-space: nowrap; }
.caso-ir { width: 34px; height: 34px; border-radius: 50%; background: var(--yellow); color: var(--navy); display: flex; align-items: center; justify-content: center; }
.caso-ir .i { font-size: 15px; }

.palco {
  flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff;
  background: radial-gradient(circle at 50% 36%, #3b17e6 0%, #2800c8 36%, #0f0f72 100%); padding: 18px 32px 128px; overflow: clip;
}
.palco { transition: margin-right .45s cubic-bezier(.2, .8, .2, 1); }
.chat-area.ficha-aberta .palco { margin-right: min(420px, 100%); }
.palco-centro { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 820px; }
.palco-nome { font: 600 30px/1.2 var(--font); letter-spacing: .01em; text-align: center; }
.palco-assunto { margin-top: 4px; font: 500 13px var(--font); color: rgba(255, 255, 255, .62); text-align: center; }

.foto { --d: clamp(150px, 23vh, 232px); --tam: calc(var(--d) * 1.95); position: relative; width: var(--tam); height: var(--tam); display: grid; place-items: center; margin-top: 4px; }
.foto canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.anel {
  position: relative; z-index: 1; width: var(--d); height: var(--d); border-radius: 50%; overflow: hidden; background: #fff;
  border: 6px solid var(--cinza-apagado); opacity: .92; transition: border-color .3s, box-shadow .3s, opacity .3s;
}
.anel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto[data-fala="1"] .anel {
  border-color: var(--yellow); opacity: 1;
  box-shadow: 0 0 0 5px rgba(240, 250, 0, .16), 0 0 38px rgba(240, 250, 0, .5);
}

.palco-fala { min-height: 4.4em; max-width: 760px; margin-top: 2px; font: 500 24px/1.45 var(--font); text-align: center; text-wrap: balance; }
.palco-fala.interrompida::after { content: " —"; opacity: .6; }
.palco-estado { margin-top: 10px; display: flex; align-items: center; gap: 8px; font: 600 12px var(--font); letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .72); }
.palco-estado i { width: 8px; height: 8px; border-radius: 50%; background: var(--cinza-apagado); }
.palco-estado[data-e="falando"] i { background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }
.palco-estado[data-e="escutando"] i { background: var(--green); }
.palco-estado[data-e="erro"] i { background: var(--red); }

.palco-voce {
  position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); width: min(760px, calc(100% - 64px)); min-height: 58px;
  display: flex; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 10px 24px; border-radius: 30px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); backdrop-filter: blur(6px);
}
.mic-botao {
  margin-top: 14px; flex: none; width: 60px; height: 60px; border-radius: 50%; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--yellow); color: var(--navy); border: 2px solid transparent;
  box-shadow: 0 6px 22px rgba(240, 250, 0, .28);
  transition: transform .18s ease, background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.mic-botao svg { width: 28px; height: 28px; display: block; }
.mic-botao:hover { transform: scale(1.07); }
.mic-botao:active { transform: scale(.96); }
.mic-botao:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.mic-botao .mic-corte { display: none; }
.mic-botao.ouvindo { animation: pulso-mic 1.1s ease-in-out infinite; }
.mic-botao.mudo {
  background: rgba(255, 75, 110, .34); color: #ffd3dc; border-color: rgba(255, 110, 135, .65);
  box-shadow: 0 6px 22px rgba(255, 75, 110, .22); backdrop-filter: blur(4px);
}
.mic-botao.mudo .mic-corte { display: block; }
@keyframes pulso-mic { 0%, 100% { box-shadow: 0 0 0 0 rgba(240, 250, 0, .5); } 50% { box-shadow: 0 0 0 12px rgba(240, 250, 0, 0); } }
@media (max-height: 820px) {
  .palco { padding: 12px 32px 124px; }
  .foto { --d: clamp(96px, 16.5vh, 150px); }
  .palco-nome { font-size: 26px; }
  .palco-fala { font-size: 20px; }
  .mic-botao { width: 52px; height: 52px; margin-top: 10px; }
  .mic-botao svg { width: 24px; height: 24px; }
}
.palco-voce p { font: 500 16px/1.4 var(--font); }
.palco-voce-vazio { color: rgba(255, 255, 255, .55); }
.palco-voce-parcial { color: rgba(255, 255, 255, .78); }
.palco-credito { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; font: 400 11px var(--font); color: rgba(255, 255, 255, .5); }

.diag-botao { position: absolute; left: 16px; top: 12px; background: none; border: 0; color: rgba(255, 255, 255, .5); font: 500 11px var(--font); text-decoration: underline; padding: 4px; }
.diag { position: absolute; left: 12px; bottom: 44px; z-index: 5; width: min(520px, 46vw); max-height: 44vh; overflow: auto; background: rgba(15, 15, 114, .94); border: 1px solid rgba(255, 255, 255, .25); border-radius: 12px; padding: 10px 12px; font: 11px/1.4 var(--font); }
.diag table { width: 100%; border-collapse: collapse; }
.diag th, .diag td { border: 1px solid rgba(255, 255, 255, .2); padding: 3px 6px; text-align: right; }
.diag th:first-child, .diag td:first-child { text-align: left; }
.diag pre { margin: 8px 0 0; white-space: pre-wrap; color: rgba(255, 255, 255, .78); }

@media (max-width: 900px) {
  .casos { grid-template-columns: 1fr; max-height: 38vh; }
  .nivel-cabeca { grid-template-columns: 1fr; }
  .nivel-resumo { text-align: left; }
  .nivel-resumo .level-tags { justify-content: flex-start; }
  .palco-fala { font-size: 20px; }
}

#tela-niveis.entrando { animation: niveis-entra 1s ease both; }
@keyframes niveis-entra { from { opacity: 0; transform: scale(1.03); } to { opacity: 1; transform: none; } }

.nivel-aviso { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; padding: 10px 16px; border-radius: 12px; background: var(--warn-soft); color: var(--navy); font: 500 13px var(--font); }
.nivel-aviso[hidden] { display: none; }
