/* 2026-11-11：群聊右上角设置入口与站长设置面板的移动端布局 */
@media (max-width: 640px) {
  /* 入口：保留文字，增加齿轮和更明确的点击面积；仍然只占一个按钮位。 */
  .agh-set-btn {
    min-width: 56px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 10px !important;
    border-radius: 12px !important;
    font-size: 13px !important;
    gap: 2px;
  }
  .agh-set-btn::before {
    content: "⚙";
    font-size: 14px;
    line-height: 1;
    margin-right: 3px;
  }

  /* 面板改成底部抽屉，避免压住聊天头部。 */
  .agh-setpanel {
    position: fixed !important;
    top: auto !important;
    right: 0 !important;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    left: 0 !important;
    width: 100% !important;
    max-height: calc(100dvh - 150px - env(safe-area-inset-bottom, 0px)) !important;
    border-radius: 20px 20px 0 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    box-shadow: 0 -16px 40px rgba(23, 34, 63, .18) !important;
    z-index: 90 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow: hidden !important;
  }
  .agh-setpanel::before {
    content: "";
    display: block;
    width: 42px;
    height: 4px;
    flex: none;
    margin: 8px auto 0;
    border-radius: 999px;
    background: rgba(23, 34, 63, .18);
  }

  .agh-setpanel .agh-set-t {
    min-height: 48px !important;
    display: flex;
    align-items: center;
    font-size: 16px !important;
    padding: 0 16px !important;
  }
  .agh-set-x {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border-radius: 12px !important;
    font-size: 18px !important;
  }

  /* 四个 tab 在窄屏可以横向滚动，不再挤成一条缝。 */
  .agh-set-tabs {
    display: flex !important;
    gap: 8px !important;
    padding: 10px 16px 8px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .agh-set-tabs::-webkit-scrollbar { display: none; }
  .agh-set-tab {
    flex: 0 0 auto !important;
    min-width: 72px !important;
    min-height: 40px !important;
    padding: 0 14px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
  }

  .agh-set-b {
    padding: 10px 16px 12px !important;
    -webkit-overflow-scrolling: touch;
  }
  .agh-set-h2 { font-size: 13px !important; }
  .agh-set-state,
  .agh-set-count,
  .agh-set-note { font-size: 13px !important; line-height: 1.65 !important; }

  /* 底部操作始终留在可视区，避免在长内容里找不到按钮。 */
  .agh-set-acts {
    position: sticky !important;
    bottom: 0 !important;
    margin-top: 10px !important;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    background: #fff;
    border-top: 1px solid rgba(23, 34, 63, .08);
    z-index: 1;
  }
  html[data-theme="dark"] .agh-set-acts {
    background: #232b3d;
    border-top-color: rgba(255, 255, 255, .1);
  }
  .agh-set-acts .agh-set-open,
  .agh-set-acts button,
  .agh-set-acts .agh-notice-btn,
  .agh-set-acts .agh-send {
    min-height: 42px !important;
    font-size: 13px !important;
    padding: 0 14px !important;
  }
}
