/* ui_ux_patch_f — 聊天消息区优先：撤销 c/d 撑高输入框，日志区吃满办公室剩余高度 */

body.drama-premium .drama-agent-dock {
  display: flex !important;
  flex-direction: column !important;
  max-height: min(55vh, 440px) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

@media (min-width: 769px) {
  body.lg-site.drama-page.drama-premium:not(.drama-surface-phone) .drama-agent-dock,
  body.drama-premium.drama-surface-desktop .drama-agent-dock,
  body.drama-premium:not(.drama-surface-phone) .drama-agent-dock {
    flex: 1 1 0 !important;
    max-height: none !important;
  }
}

body.drama-premium .agent-dock-head {
  flex-shrink: 0 !important;
  padding-bottom: 2px !important;
  margin-bottom: 2px !important;
}

body.drama-premium .agent-dock-crew-chips {
  max-height: none !important;
  min-height: 28px !important;
  flex: 0 1 auto !important;
  width: auto !important;
  margin-left: auto !important;
  justify-content: flex-end !important;
}

body.drama-premium .agent-dock-identity {
  flex: 0 0 auto !important;
  max-width: none !important;
  margin-left: 0 !important;
}

body.drama-premium .agent-dock-log {
  flex: 1 1 0% !important;
  min-height: 130px !important;
  max-height: none !important;
  height: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 4px !important;
}

/* 覆盖 patch_c 的 72px 多行输入与 patch_d 移动端 84px 撑高 */
body.drama-premium .drama-agent-dock #agentChatInput.agent-dock-input,
body.drama-premium .drama-agent-dock #agentChatInput.agent-dock-input.form-control,
body.drama-premium .drama-agent-dock textarea#agentChatInput,
body.drama-premium .agent-dock-input,
body.drama-premium .agent-dock-input-col .agent-dock-input,
body.drama-premium .agent-dock-input.form-control {
  min-height: 32px !important;
  max-height: 32px !important;
  height: 32px !important;
  overflow-y: hidden !important;
  padding: 6px 10px !important;
  line-height: 1.25 !important;
  font-size: 0.75rem !important;
  resize: none !important;
}

body.drama-premium .agent-dock-input-col {
  min-height: 0 !important;
  max-height: 32px !important;
}

body.drama-premium .drama-agent-dock .chat-send-btn.btn-primary {
  width: 36px !important;
  min-width: 36px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  height: 32px !important;
  align-self: flex-end !important;
}

/* 表情/相册与输入同一行，少占一行纵向空间 */
body.drama-premium .agent-dock-composer {
  flex-shrink: 0 !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: flex-end !important;
  gap: 4px !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.drama-premium .agent-dock-composer-row {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  align-items: center !important;
}

body.drama-premium .agent-dock-tools {
  flex: 0 0 auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.drama-premium .agent-mention-popover {
  max-height: min(40vh, 240px) !important;
  overflow-y: auto !important;
  scroll-behavior: smooth;
}

@media (max-width: 640px) {
  body.drama-premium .drama-agent-dock {
    max-height: min(52vh, 400px) !important;
  }

  body.drama-premium .agent-dock-input-col {
    min-height: 0 !important;
    max-height: 32px !important;
  }

  body.drama-premium .drama-agent-dock .chat-send-btn.btn-primary {
    min-height: 32px !important;
    max-height: 32px !important;
    height: 32px !important;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  body.drama-premium .agent-dock-log {
    min-height: 80px !important;
    max-height: none !important;
  }

  body.drama-premium.drama-surface-phone .agent-dock-crew-chips {
    display: none !important;
  }
}

body.drama-premium .agent-tts-lab-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9790;
  background: transparent;
  pointer-events: auto;
}

body.drama-premium .agent-tts-lab-backdrop.hidden {
  display: none !important;
  pointer-events: none;
}

body.drama-premium .agent-tts-lab {
  position: fixed;
  right: auto;
  bottom: auto;
  left: auto;
  top: auto;
  z-index: 9800;
  width: min(320px, calc(100vw - 24px));
  max-height: min(52vh, 400px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.22);
  box-sizing: border-box;
  pointer-events: auto;
}

body.drama-premium .agent-tts-lab.hidden {
  display: none !important;
  pointer-events: none;
}

body.drama-premium .agent-tts-lab-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #475569;
  margin-bottom: 6px;
}

body.drama-premium .agent-tts-lab-title {
  flex: 1 1 auto;
  min-width: 0;
}

body.drama-premium .agent-tts-lab-close {
  flex: 0 0 auto;
  border: none;
  background: rgba(15, 23, 42, 0.08);
  color: #334155;
  font-size: 11px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
}

body.drama-premium .agent-tts-lab-close:active {
  transform: scale(0.98);
}

body.drama-premium .agent-tts-lab-toggle.is-open {
  background: rgba(59, 130, 246, 0.14);
  color: #1d4ed8;
}

body.drama-premium .agent-tts-lab-section {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  margin: 8px 0 4px;
}

body.drama-premium .agent-mic-lab-meter {
  height: 8px;
  margin: 6px 0 2px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
  overflow: hidden;
}

body.drama-premium .agent-mic-lab-meter span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  transition: width 80ms linear;
}

body.drama-premium .agent-tts-lab-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

body.drama-premium .agent-tts-lab-btn {
  font-size: 11px;
  line-height: 1.25;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: #fff;
  color: #0f172a;
  cursor: pointer;
}

body.drama-premium .agent-tts-lab-btn:active {
  transform: scale(0.98);
}

body.drama-premium .agent-tts-lab-status {
  margin-top: 8px;
  font-size: 12px;
  color: #15803d;
  word-break: break-word;
}

body.drama-premium .agent-tts-lab-status.is-err {
  color: #b91c1c;
}

body.drama-premium .agent-tts-lab-toggle {
  font-size: 12px;
  font-weight: 600;
}

@media (min-width: 520px) {
  body.drama-premium .agent-tts-lab-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

body.drama-premium .agent-dock-input::placeholder {
  color: rgba(148, 163, 184, 0.38) !important;
  opacity: 1 !important;
}
