/* 移动端全屏问基石 */
.m-ai-chat-wrap {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--surface-1, #fff);
  touch-action: pan-y;
}

body.m-ai-chat-active {
  overflow: hidden;
  overscroll-behavior: none;
}

body.m-ai-chat-active .m-header,
body.m-ai-chat-active .m-bottom-nav {
  z-index: 60;
}

.m-ai-chat-wrap .ai-chat-modal {
  position: absolute;
  inset: 0;
  display: flex !important;
  align-items: stretch;
  justify-content: stretch;
  background: transparent;
  padding: 0;
  margin: 0;
}

.m-ai-chat-wrap .ai-chat-modal.hidden {
  display: none !important;
}

/* 覆盖桌面 #aiChatModal 的 max-width / border（宽屏下否则会居中留白 + 右侧竖线） */
.m-ai-chat-wrap #aiChatModal > .modal-content.ai-chat-modal__panel,
.m-ai-chat-wrap #aiChatModal > .modal-content.ai-chat-modal__panel.ai-chat-modal--sidebar-open,
.m-ai-chat-wrap .ai-chat-modal__panel {
  width: 100% !important;
  max-width: none !important;
  height: 100%;
  max-height: none;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  border: none;
}

body.m-ai-chat-active.m-app--with-nav .m-ai-chat-wrap {
  top: calc(var(--m-header-height, 48px) + env(safe-area-inset-top, 0));
  bottom: calc(var(--m-nav-height, 56px) + env(safe-area-inset-bottom, 0));
}

body.m-ai-chat-active #aiChatCloseBtn {
  display: none;
}

body.m-ai-chat-active #aiMemoryOpsBtn {
  display: none;
}

body.m-ai-chat-active .ai-chat-header__btn {
  min-height: 36px;
  padding: 6px 12px;
}

body.m-ai-chat-active .ai-chat-header {
  padding-top: max(8px, env(safe-area-inset-top, 0));
}

body.m-ai-chat-active .ai-chat-composer {
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0));
}

body.m-ai-chat-active .ai-chat-sidebar:not(.hidden) {
  width: min(90vw, 320px);
  min-width: min(90vw, 320px);
}

body.m-ai-chat-active .ai-chat-sidebar-backdrop:not(.hidden) {
  background: color-mix(in srgb, var(--ds-text) 38%, transparent);
}

.m-bottom-nav__btn[data-module="ai"] .m-bottom-nav__icon svg {
  width: 22px;
  height: 22px;
}
