
/* ===== Core chat layout (must not collapse) ===== */
.chat-app{height:100vh;min-height:100vh}
.chat-main{
  display:flex!important;
  flex-direction:column!important;
  flex:1 1 auto!important;
  min-width:0!important;
  min-height:0!important;
  height:100%!important;
  position:relative!important;
  overflow:hidden!important;
}
.conversation-shell{
  position:relative!important;
  display:flex!important;
  flex-direction:column!important;
  flex:1 1 auto!important;
  min-height:0!important;
  width:100%!important;
  overflow:hidden!important;
}
.message-list{
  flex:1 1 auto!important;
  min-height:0!important;
  overflow:auto!important;
}
.composer-wrap{flex:0 0 auto!important}

/* MCP is an overlay, never steals flex space */
#mcp-panel,
.mcp-panel{
  position:absolute!important;
  inset:0!important;
  z-index:25!important;
  width:auto!important;
  height:auto!important;
}
#mcp-panel[hidden],
.mcp-panel[hidden],
body:not(.mcp-open) #mcp-panel{
  display:none!important;
}
body.mcp-open #mcp-panel{
  display:flex!important;
  flex-direction:column!important;
}
body.mcp-open .conversation-shell{visibility:hidden!important;pointer-events:none!important}

/* ========== Live Voice — centered circular stage ========== */

.live-voice-screen[hidden]{display:none!important}
.live-voice-screen:not([hidden]){
  position:absolute;inset:0;z-index:40;
  display:flex!important;flex-direction:column;align-items:center;justify-content:center;
  gap:18px;
  padding:28px 20px 20px;
  overflow:hidden;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, #2d2740 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, #1a1528 0%, #121018 55%, #0e0c14 100%);
  color:#f3f0fa;
}

/* Hide underlying chat completely while voice is open */
body.live-voice-active .message-list,
body.live-voice-active .composer-wrap{visibility:hidden;pointer-events:none}
body.live-voice-active .chat-topbar{opacity:.25;pointer-events:none}

.live-voice-close{
  position:absolute;top:18px;inset-inline-end:18px;z-index:5;
  display:grid;place-items:center;width:40px;height:40px;
  border:1px solid rgba(255,255,255,.12);border-radius:50%;
  background:rgba(255,255,255,.06);color:#e8e2f6;font-size:16px;cursor:pointer;
  backdrop-filter:blur(10px);
}
.live-voice-close:hover{background:rgba(255,255,255,.12);color:#fff}

/* Circular stage */
.live-voice-stage{
  position:relative;
  width:min(72vw,340px);height:min(72vw,340px);
  display:grid;place-items:center;
  flex:0 0 auto;
}
.live-voice-ring,
.live-voice-ring-2{
  position:absolute;inset:0;border-radius:50%;
  border:1px solid rgba(180,150,255,.18);
  box-shadow:0 0 40px rgba(140,110,255,.12), inset 0 0 30px rgba(140,110,255,.06);
  animation:ring-pulse 4.5s ease-in-out infinite;
  pointer-events:none;
}
.live-voice-ring-2{
  inset:-18px;
  border-color:rgba(140,180,255,.1);
  animation-delay:1.2s;
  opacity:.7;
}

.live-orb{
  position:absolute;
  width:58%;height:58%;
  border-radius:50%;
  isolation:isolate;
  filter:drop-shadow(0 18px 36px rgba(120,90,220,.45));
  animation:orb-breathe 5.5s ease-in-out infinite;
}
.live-orb::before,.live-orb::after,.live-orb span,.live-orb i{
  position:absolute;content:"";inset:0;border-radius:inherit;
}
.live-orb::before{
  background:conic-gradient(from 20deg,#7be5df,#83a5ff 19%,#c181f4 39%,#f39bcf 58%,#ffc78b 75%,#77d9d3);
  filter:blur(1px);animation:orb-rotate 12s linear infinite;
}
.live-orb::after{
  inset:8%;
  background:
    radial-gradient(circle at 30% 28%,#ffffffd0 0 6%,transparent 24%),
    radial-gradient(ellipse at 72% 32%,#ffd8f5c0,transparent 34%),
    radial-gradient(ellipse at 32% 73%,#8af0e9d0,transparent 42%),
    radial-gradient(ellipse at 70% 74%,#9277ffd0,transparent 44%),
    radial-gradient(circle at 52% 47%,#f9c6fa,#8fa5ff 72%);
  box-shadow:inset -14px -18px 36px rgba(88,65,175,.35), inset 12px 10px 28px rgba(255,255,255,.55);
  animation:orb-fluid 7s ease-in-out infinite alternate;
}
.live-orb span{
  inset:-10%;border:1px solid rgba(184,163,239,.25);
  box-shadow:0 0 30px rgba(177,138,255,.25);
  animation:orb-halo 3.8s ease-in-out infinite;
}
.live-orb i{
  inset:20%;border:1px solid rgba(255,255,255,.4);
  transform:rotate(-24deg) scaleX(1.12);filter:blur(.4px);
}

.live-voice-screen[data-state="listening"] .live-orb{animation:orb-listen 2.2s ease-in-out infinite}
.live-voice-screen[data-state="thinking"] .live-orb{animation:orb-think 1.3s ease-in-out infinite}
.live-voice-screen[data-state="speaking"] .live-orb{animation:orb-speak .75s ease-in-out infinite alternate}
.live-voice-screen[data-state="listening"] .live-voice-ring{border-color:rgba(160,130,255,.35)}
.live-voice-screen[data-state="speaking"] .live-voice-ring{border-color:rgba(255,160,210,.35)}

/* Text/status inside the circle area (below orb visually stacked via grid) */
.live-voice-core{
  position:relative;z-index:2;
  display:flex;flex-direction:column;align-items:center;text-align:center;
  gap:6px;
  margin-top:min(52vw,250px);
  max-width:min(90vw,360px);
}
.live-voice-stage{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;height:auto;width:min(90vw,380px)}
.live-voice-stage .live-orb{position:relative;width:min(48vw,220px);height:min(48vw,220px);margin:0 auto}
.live-voice-ring,.live-voice-ring-2{
  position:absolute;left:50%;top:0;
  width:min(48vw,220px);height:min(48vw,220px);
  transform:translateX(-50%);
  margin:0;
}
.live-voice-ring-2{width:min(56vw,260px);height:min(56vw,260px);top:-20px}

.live-voice-eyebrow{
  display:block;color:#c4b2ff;font-size:9px;font-weight:800;letter-spacing:.2em;
}
.live-voice-core h2{
  margin:0;font-size:clamp(18px,3.5vw,24px);font-weight:700;letter-spacing:-.03em;color:#f6f2ff;
}
.live-voice-status{margin:2px 0 0;color:#b9b1cc;font-size:13px;font-weight:550}
.live-voice-screen[data-state="listening"] .live-voice-status{color:#d4c6ff}
.live-voice-screen[data-state="speaking"] .live-voice-status{color:#ffc6e2}

.live-voice-controls{
  display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:8px;
  margin-top:10px;
}
.live-voice-language-label{
  display:flex;align-items:center;gap:6px;color:#b9b1cc;font-size:11px;
}
.live-voice-language-label select,
.live-voice-language-label .ps-btn{
  min-width:96px;min-height:34px;padding:7px 26px 7px 10px;
  border:1px solid rgba(255,255,255,.12);border-radius:999px;
  background:rgba(255,255,255,.06);color:#efeafc;
  font:600 11px Inter,"Segoe UI",Arial,sans-serif;
  backdrop-filter:blur(8px);
}

/* Captions under the circle — user + AI only */
.live-captions{
  display:grid;grid-template-columns:1fr 1fr;gap:12px;
  width:min(92vw,560px);
  flex:0 0 auto;
}
.live-caption-card{
  min-width:0;min-height:84px;max-height:130px;
  padding:12px 14px;
  border:1px solid rgba(255,255,255,.1);border-radius:18px;
  background:rgba(255,255,255,.05);
  backdrop-filter:blur(14px);
  overflow:hidden;
}
.live-caption-label{
  display:block;margin-bottom:6px;
  color:#c4b2ff;font-size:9px;font-weight:800;letter-spacing:.14em;text-transform:uppercase;
}
.live-caption-card p{
  max-height:4.2em;margin:0;overflow:auto;
  color:#e9e3f6;font-size:13px;line-height:1.55;overflow-wrap:anywhere;
}
.live-caption-card p.is-interim{color:#a59fb5;font-style:italic}
.live-caption-card.assistant-caption{
  border-color:rgba(160,130,255,.2);
  background:rgba(120,90,200,.12);
}

.live-voice-footer{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  width:min(92vw,560px);
  flex:0 0 auto;
  margin-top:4px;
}
.live-voice-tools{display:flex;align-items:center;gap:12px;min-width:0}
.live-attach-button{
  display:flex;align-items:center;gap:8px;padding:9px 14px;
  border:1px solid rgba(255,255,255,.12);border-radius:999px;
  background:rgba(255,255,255,.06);color:#ddd6ef;
  font:600 11px Inter,"Segoe UI",Arial,sans-serif;cursor:pointer;
}
.live-attach-button:hover{background:rgba(255,255,255,.12);color:#fff}
.live-attachment-status{max-width:140px;overflow:hidden;color:#c4b2ff;font-size:10px;text-overflow:ellipsis;white-space:nowrap}
.live-voice-mic-indicator{display:flex;align-items:center;gap:8px;color:#c5bed6;font-size:11px}
.live-voice-mic-indicator i{
  width:8px;height:8px;border-radius:50%;background:#5bcf9d;
  box-shadow:0 0 0 4px rgba(91,207,157,.2);animation:mic-pulse 2s ease-out infinite;
}
.live-end-button{
  display:inline-flex;align-items:center;gap:8px;padding:10px 16px;
  border:1px solid rgba(255,100,130,.25);border-radius:999px;
  background:rgba(180,60,90,.2);color:#ffd0da;
  font:650 12px Inter,"Segoe UI",Arial,sans-serif;cursor:pointer;
}
.live-end-button:hover{background:rgba(180,60,90,.32)}

@keyframes orb-breathe{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}
@keyframes orb-rotate{to{transform:rotate(360deg)}}
@keyframes orb-fluid{0%{transform:scale(1) rotate(0deg)}100%{transform:scale(1.03) rotate(8deg)}}
@keyframes orb-halo{0%,100%{opacity:.55;transform:scale(1)}50%{opacity:1;transform:scale(1.03)}}
@keyframes orb-listen{0%,100%{transform:scale(1)}50%{transform:scale(1.07)}}
@keyframes orb-think{0%,100%{transform:scale(1) rotate(0deg)}50%{transform:scale(.97) rotate(3deg)}}
@keyframes orb-speak{0%{transform:scale(1)}100%{transform:scale(1.09)}}
@keyframes ring-pulse{0%,100%{opacity:.55;transform:translateX(-50%) scale(1)}50%{opacity:1;transform:translateX(-50%) scale(1.03)}}
@keyframes mic-pulse{0%{box-shadow:0 0 0 0 rgba(91,207,157,.35)}70%{box-shadow:0 0 0 10px rgba(91,207,157,0)}100%{box-shadow:0 0 0 0 rgba(91,207,157,0)}}

@media(max-width:650px){
  .live-voice-screen{padding:16px 14px 14px;gap:14px}
  .live-voice-language-label>span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
  .live-captions{grid-template-columns:1fr;width:100%}
  .live-voice-footer{width:100%}
  .live-attach-button span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
  .live-voice-mic-indicator{font-size:0}
  .live-voice-mic-indicator i{flex:0 0 8px}
  .live-voice-core{margin-top:12px}
}

/* ===== Safety: never blank the normal chat ===== */
body:not(.live-voice-active) .message-list,
body:not(.live-voice-active) .composer-wrap{
  visibility:visible!important;
  pointer-events:auto!important;
  opacity:1!important;
}
/* Do NOT force .welcome-screen visible — it must respect the [hidden] attribute
   so the empty-state suggestions only show when there are no messages. */
.message-list{width:min(100%,900px)!important}
.live-voice-screen[hidden]{display:none!important;visibility:hidden!important;pointer-events:none!important}
