* { box-sizing: border-box; }
body {
  margin: 0;
  height: 100dvh;
  display: grid;
  grid-template-columns: clamp(135px, 20vw, 290px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: #050607;
  border-radius: 0;
  color: #eef0f2;
  font: 16px system-ui, sans-serif;
}
a, button { color: #9ac8e6; }
button {
  background: #101214;
  border: 1px solid #292d32;
  padding: 6px 10px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}
button:hover { background: #1b1f24; }
button:disabled { opacity: 0.6; cursor: default; }
.live-toolbar, .live-presence, .live-actions, .live-feedback {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.live-toolbar {
  justify-content: space-between;
  padding: 6px clamp(8px, 1.4vw, 20px);
}
.live-presence strong { font-size: 0.9rem; }
#status { margin: 2px 0 0; color: #a0a6af; font-size: 0.76rem; }
.live-actions button { font-size: 0.78rem; }
.live-feedback {
  padding: 2px clamp(8px, 1.4vw, 20px);
  gap: 6px 14px;
  color: #a0a6af;
  font-size: 0.75rem;
}
.live-feedback p { margin: 0; }
.live-feedback p:empty { display: none; }
#error, #voice-feedback { color: #ffb5bb; }

main {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  min-height: 0;
  padding: clamp(5px, 1vw, 16px) clamp(12px, 2vw, 28px) clamp(5px, 1vw, 16px) clamp(8px, 1.2vw, 18px);
}
#stage {
  display: none;
  grid-template-rows: auto minmax(0, 1fr);
  container-type: inline-size;
  min-width: 0;
  min-height: 0;
  padding: 0;
}
body.show #stage { display: grid; }
#stage h2 {
  font-size: clamp(1rem, 3.5cqi, 1.65rem);
  overflow-wrap: anywhere;
  margin: 0 0 7px;
}
#stage[data-kind="site"], #stage[data-kind="pdf"] { padding: 5px; }
#stage[data-kind="site"] h2, #stage[data-kind="pdf"] h2 {
  margin: 1px 4px 5px;
  font-size: clamp(0.88rem, 2.1cqi, 1.1rem);
}
#content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  font-size: clamp(16px, 2vw, 25px);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#stage[data-kind="image"] #content, #stage[data-kind="youtube"] #content {
  display: grid;
  place-items: center;
  container-type: size;
  overflow: hidden;
}
#stage[data-kind="image"] #content img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100cqw, 1060px);
  max-height: 100cqh;
  object-fit: contain;
}
.live-youtube {
  display: block;
  width: min(100cqw, 177.777cqh, 960px);
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
  background: #000;
}
.axob-media {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  white-space: normal;
}
.axob-media iframe, .axob-media model-viewer {
  display: block;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  border: 1px solid #292d32;
  border-radius: 8px;
  background: #0c0e10;
}
.axob-media p {
  margin: 0 4px;
  font-size: 0.78rem;
  color: #a0a6af;
}
.axob-media p:empty { display: none; }
.model-controls { display: flex; gap: 8px; }
.model-controls button { font-size: 0.8rem; }
#content table {
  border-collapse: collapse;
  width: 100%;
  font-size: clamp(0.875rem, 2.2cqi, 1.45rem);
  white-space: normal;
}
#content td, #content th {
  border-bottom: 1px solid #292d32;
  padding: clamp(0.35rem, 1.5cqi, 0.75rem);
  text-align: left;
}
.barrow {
  display: grid;
  grid-template-columns: minmax(70px, 1fr) 3fr minmax(42px, auto);
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}
.track { height: 20px; background: #1a1e22; border-radius: 4px; overflow: hidden; }
.bar { height: 100%; background: #9ac8e6; }

.live-character {
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  padding: clamp(8px, 1vw, 16px);

}
.live-viewer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.avatar {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  place-items: center;
}
#face {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  object-fit: contain;
  animation: avatar-drift 5s ease-in-out infinite alternate;
  transition: filter 180ms ease;
}
body[data-state="listening"] #face { filter: brightness(1.12); }
body[data-state="processing"] #face { filter: brightness(1.1) saturate(1.15); }
.avatar.is-speaking #face { filter: brightness(1.05); }

.avatar-mouth {
  opacity: 0;
  transition: opacity 85ms ease;
}
.avatar.is-speaking .avatar-mouth {
  opacity: 1;
}
.avatar-mouth-interior {
  fill: #170d24;
  transform-origin: 695px 225px;
}
.avatar-jaw {
  transform-origin: 695px 225px;
}
.avatar.is-speaking .avatar-jaw {
  animation: jaw-speech 290ms ease-in-out infinite;
}
.avatar.is-speaking .avatar-mouth-interior {
  animation: mouth-speech 290ms ease-in-out infinite;
}
@keyframes avatar-drift {
  from { transform: translateY(1px) rotate(-0.6deg) scale(0.94); }
  to { transform: translateY(-5px) rotate(0.7deg) scale(0.97); }
}
@keyframes jaw-speech {
  0%, 100% { transform: rotate(0deg); }
  45% { transform: rotate(calc(-7deg * var(--voice-peak, 1))); }
  76% { transform: rotate(-2deg); }
}
@keyframes mouth-speech {
  0%, 100% { transform: scaleY(0.12); opacity: 0; }
  45% { transform: scaleY(var(--voice-peak, 1)); opacity: 1; }
  76% { transform: scaleY(0.38); opacity: 0.75; }
}
@media (max-width: 600px) {
  body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: clamp(64px, 14dvh, 108px) minmax(0, 1fr);
  }
  .live-character {
    padding: 2px;
    border-right: 0;
    }
  .avatar { width: min(100%, 160px); }
}
@media (prefers-reduced-motion: reduce) {
  #face, .avatar-jaw, .avatar-mouth-interior { animation: none !important; }
  #face, .avatar-mouth { transition: none; }
  .avatar.is-speaking .avatar-mouth { opacity: 0; }
}

#content table {
  overflow-wrap: break-word;
  font-size: clamp(0.875rem, 1.65cqi, 1.18rem);
}
#content th:first-child, #content td:first-child {
  overflow-wrap: normal;
}

/* ∆XOB LIVE — fundo preto, um painel, controles foscos. */
:root { color-scheme: dark; }
body { background-image: radial-gradient(circle at 12% 15%, #d7e2eb 0 .7px, transparent 1.3px), radial-gradient(circle at 91% 79%, #a3b7c8 0 .7px, transparent 1.3px); }
button { color: #d5dae0; border-radius: 6px; min-height: 36px; box-shadow: none; transition: background-color .16s ease, border-color .16s ease; }
button:hover { border-color: #666f7a; }
button[aria-pressed="true"] { background: #e6edf2; color: #11161b; border-color: #e6edf2; }
a:focus-visible, button:focus-visible { outline: 2px solid #9ac8e6; outline-offset: 3px; }
.live-toolbar { padding: 14px clamp(12px, 2vw, 28px); border-bottom: 1px solid #23272b; gap: 12px; }
.live-presence { gap: 12px; }
.live-presence strong { font-size: .875rem; font-weight: 600; letter-spacing: .08em; }
.live-actions button { font-size: .875rem; padding: 7px 11px; }
#status { font-size: .875rem; }
.live-character { background: transparent; border-right: 1px solid #23272b; }
.live-viewer { background: #080a0c; border: 1px solid #23272b; border-radius: 10px; margin: 10px 10px 10px 0; }
main { padding: clamp(14px, 2.2vw, 32px); }
#stage h2 { font-weight: 500; letter-spacing: -.025em; margin-bottom: 22px; }
#stage[data-kind="site"], #stage[data-kind="pdf"] { padding: 0; }
.live-feedback { font-size: .8125rem; padding: 8px clamp(12px, 2vw, 28px); }
.axob-media p { font-size: .875rem; }
.axob-media iframe, .axob-media model-viewer { background: #0c0e10; border-color: #292d32; border-radius: 6px; }
.track { height: 12px; border-radius: 2px; }
.bar { border-radius: 2px; }
.barrow { margin: 22px 0; gap: 16px; }
#content table th { color: #a0a6af; font-weight: 500; }
@media (max-width: 600px) {
 .live-character { border-right: 0; }
 .live-viewer { margin: 0 8px 8px; }
 .live-toolbar { align-items: flex-start; padding: 12px; }
 .live-actions { gap: 6px; }
 .live-actions button { font-size: .8125rem; padding: 6px 9px; }
 .barrow { grid-template-columns: minmax(58px, 1fr) 2fr minmax(32px, auto); gap: 8px; }
}

.live-empty { align-self: center; justify-self: center; text-align: center; color: #a0a6af; }
.live-empty p { margin: 0 0 .8rem; font-size: .9375rem; }
.live-empty button { font-size: .875rem; }
body.show .live-empty { display: none; }
