/* ============================================================================
   오대리 (Platform Manager) — panel.css  v1.5
   트랙 34 Phase 0 (2026-09-23). ai_agent panel.css 의 .ozo-agent-* 는 전역으로 이미 로드되므로 재사용하고,
   여기에는 오대리 추가분만 둔다: 얼굴 무대 · 두뇌 칩 · 인사 카드 · TTS 버튼 · 보류 카드 · 스트리밍 진행(v1.2 s88).
   v1.3 (s90): 오대리가 열렸을 때만 패널 폭 380 → 460px · 얼굴 무대 높이 188px → 화면 높이 따라 220~340px.
   v1.4 (s90): 사진 얼굴 무대(Phase F-2) 표기 「AI 아바타 (합성 영상)」 — 홍보·영업용 책임 표기 (얼굴 설계 §4).
   v1.5 (s92 A안): 사진 얼굴 무대 오른쪽 아래 「첫 문장부터 말하기」 켜고 끄기 (켜짐 = 노란 글자 · 꺼짐 = 흐린 글자·취소선).
   v1.6 (s93): 모바일에서 아래 입력창이 안 보이던 것 — 패널 높이를 실제 보이는 높이(100dvh)로 · 폰 폭에서는 얼굴 무대를 낮춘다.
               (100vh 는 폰 주소창·도구막대가 보일 때 화면보다 커서 패널 아래가 가려진다) · 오대리가 열렸을 때만 (다른 위젯 그대로)
   글자는 11px 이상 (협업 디자인 토대 규칙).
   ============================================================================ */

.dash-widget-slot[data-widget="platform-manager"] {
  height: 100%;
}

/* 오대리가 열렸을 때만 패널을 넓힌다 (s90 실장님 "조금만 더 컸으면") — 다른 위젯은 index.html 의 380px 그대로.
   :has() 를 모르는 옛 브라우저는 380px 로 남는다 (깨지지 않는다). */
.dash-widget-panel:has(.dash-widget-slot[data-widget="platform-manager"]:not([hidden])) {
  width: 460px;
  max-width: calc(100vw - 96px);
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);   /* v1.6 (s93) — 폰에서 입력창이 도구막대 뒤로 숨지 않게 (dvh 를 모르는 브라우저는 위 줄) */
}
/* v1.6 (s93) — 폰 폭: 얼굴 무대를 낮춰 대화 칸·입력창 자리를 남긴다 (데스크톱은 그대로) */
@media (max-width: 600px) {
  .odaeri-stage { height: clamp(150px, 26dvh, 240px); }
}

/* ── 얼굴 무대 (임시 얼굴 = VRM · Phase F 사진급 영상으로 교체) ───────────── */
/* 높이 = 화면 높이의 34% (최소 220 · 최대 340px). 카메라는 세로 시야가 고정이라 무대가 높아지면 캐릭터가 그만큼 커진다 */
.odaeri-stage {
  position: relative;
  flex-shrink: 0;
  height: clamp(220px, 34vh, 340px);
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 105%, rgba(46, 196, 154, 0.28) 0%, rgba(46, 196, 154, 0) 60%),
    linear-gradient(180deg, #13306b 0%, #0e1f52 100%);
  border-bottom: 1px solid #14295e;
  transition: height 0.25s ease;
}
.odaeri-stage.off {
  height: 46px;
}
.odaeri-stage-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.odaeri-stage.ready .odaeri-stage-frame {
  opacity: 1;
}
.odaeri-stage.off .odaeri-stage-frame {
  display: none;
}

/* 얼굴이 없을 때(끔·불러오는 중·실패) 보이는 표식 */
.odaeri-stage-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.odaeri-stage.ready .odaeri-stage-fallback {
  opacity: 0;
}
.odaeri-stage-mark {
  font-family: 'Inter', 'Pretendard', sans-serif;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #fde047;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.odaeri-stage-name {
  font-size: 15px;
  font-weight: 800;
  color: #e0e7ff;
}
.odaeri-stage.off .odaeri-stage-mark { font-size: 15px; }
.odaeri-stage.off .odaeri-stage-name { font-size: 13px; }
.odaeri-stage.loading .odaeri-stage-mark {
  animation: odaeri-breathe 1.4s ease-in-out infinite;
}
@keyframes odaeri-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* 두뇌 칩 — 어느 두뇌가 답했는지 (조용한 강등 금지) */
.odaeri-brain-chip {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  pointer-events: auto;
}
.odaeri-stage.off .odaeri-brain-chip {
  top: 12px;
}

/* 얼굴 켜기/끄기 */
.odaeri-stage-toggle {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.45);
  color: #e0e7ff;
  cursor: pointer;
  transition: background 0.15s;
}
.odaeri-stage-toggle:hover {
  background: rgba(255, 255, 255, 0.16);
}
.odaeri-stage.off .odaeri-stage-toggle {
  top: 9px;
}

/* 사진 얼굴 무대 표기 (s90 Phase F-2) — 무대 왼쪽 아래 · 글자 11px */
.odaeri-face-badge {
  position: absolute;
  left: 10px;
  bottom: 8px;
  z-index: 2;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd5f5;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}
.odaeri-stage.off .odaeri-face-badge,
.odaeri-face-badge[hidden] {
  display: none;
}

/* s92 A안 — 「첫 문장부터 말하기」 켜고 끄기 (사진 얼굴 무대만 · 오른쪽 아래 · 글자 11px) */
.odaeri-early-toggle {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 2;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  text-decoration: line-through;
  transition: background 0.15s;
}
.odaeri-early-toggle.on {
  color: #fde68a;
  border-color: rgba(253, 230, 138, 0.45);
  text-decoration: none;
}
.odaeri-early-toggle:hover {
  background: rgba(255, 255, 255, 0.16);
}
.odaeri-stage.off .odaeri-early-toggle,
.odaeri-early-toggle[hidden] {
  display: none;
}

/* ── 인사 카드 (토큰 0) ─────────────────────────────────────────────── */
.odaeri-greet {
  margin: 4px 2px 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #c7d2fe;
  border-left: 4px solid #1e3a8a;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.odaeri-greet-line {
  font-size: 13px;
  line-height: 1.6;
  color: #1e293b;
  font-weight: 600;
}
.odaeri-greet-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 10px 0 8px;
}
.odaeri-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border-radius: 8px;
  background: #eef2ff;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
}
.odaeri-stat b {
  font-size: 16px;
  font-weight: 800;
  color: #1e3a8a;
}

/* ── 입: TTS 토글 (마이크 버튼과 같은 규격) ─────────────────────────────── */
.odaeri-tts {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  transition: all 0.15s;
}
.odaeri-tts:hover {
  background: #e2e8f0;
  color: #1e3a8a;
}
.odaeri-tts.on {
  background: #ecfdf5;
  border-color: #2ec49a;
  color: #047857;
}

/* ── 승낙 카드 (Phase 1 P1-2) — "…합니다. 허용할까요?" [허용] [취소] + 카운트다운 ───────── */
.odaeri-consent {
  margin: 8px 0 4px;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
}
.odaeri-consent-say {
  font-size: 13px;
  line-height: 1.55;
  color: #78350f;
  font-weight: 600;
}
.odaeri-consent-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.odaeri-consent-btn {
  min-width: 64px;
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.odaeri-consent-btn.allow {
  background: #047857;
  color: #fff;
  border-color: #047857;
}
.odaeri-consent-btn.allow:hover {
  background: #065f46;
}
.odaeri-consent-btn.deny {
  background: #fff;
  color: #475569;
  border-color: #cbd5e1;
}
.odaeri-consent-btn.deny:hover {
  background: #f1f5f9;
}
.odaeri-consent-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.odaeri-consent-timer {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: #b45309;
}
.odaeri-consent.decided.allow {
  background: #ecfdf5;
  border-color: #6ee7b7;
  border-left-color: #047857;
}
.odaeri-consent.decided.allow .odaeri-consent-say {
  color: #064e3b;
}
.odaeri-consent.decided.deny,
.odaeri-consent.expired {
  background: #f8fafc;
  border-color: #e2e8f0;
  border-left-color: #94a3b8;
}
.odaeri-consent.decided.deny .odaeri-consent-say,
.odaeri-consent.expired .odaeri-consent-say {
  color: #64748b;
}
.odaeri-consent.expired .odaeri-consent-timer {
  color: #64748b;
}

/* trace 카드 — 물음(asked) · 허용(approved) · 취소/만료(denied) */
.ozo-agent-trace.asked {
  background: #fffbeb;
  border-color: #fcd34d;
}
.ozo-agent-trace.asked .ozo-agent-trace-turn {
  background: #f59e0b;
}
.ozo-agent-trace.approved {
  background: #ecfdf5;
  border-color: #6ee7b7;
}
.ozo-agent-trace.approved .ozo-agent-trace-turn {
  background: #047857;
}
.ozo-agent-trace.denied {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.ozo-agent-trace.denied .ozo-agent-trace-turn {
  background: #94a3b8;
}

/* ── 보류·안내 trace 카드 (실행하지 않은 도구) ─────────────────────────── */
.ozo-agent-trace.blocked {
  background: #fffbeb;
  border-color: #fcd34d;
}
.ozo-agent-trace.blocked .ozo-agent-trace-turn {
  background: #f59e0b;
}

.odaeri-error-bubble {
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
  color: #991b1b !important;
}

/* ── 스트리밍 (P3-3 · v1.2 s88) — 답 초안 · 결과 카드 · 진행 한 줄 ───────────────
   .ozo-agent-traces 가 display:flex 라 hidden 속성이 먹지 않는다 → 명시적으로 숨긴다 */
.odaeri-draft[hidden],
.odaeri-live-traces[hidden],
.odaeri-live-sec[hidden] {
  display: none !important;
}
.odaeri-draft::after {
  content: '\258D';
  margin-left: 1px;
  color: #6366f1;
  animation: odaeri-caret 1s steps(1) infinite;
}
@keyframes odaeri-caret {
  50% { opacity: 0; }
}
.odaeri-live-traces {
  margin-top: 0;
}
.odaeri-live-sec {
  display: inline-flex;
  gap: 1px;
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
}
.odaeri-live-sec::before {
  content: '\00B7';
  margin-right: 4px;
}
