/* 2026-11-10 移动端聊天身份切换修复。
   目标：① 触发按钮悬浮，不占聊天卡片一行；② 展开名单自适应高度，不再挤成一条缝。 */
@media (max-width: 720px), (hover: none) and (pointer: coarse) {
  .chv .agh-idbar {
    position: absolute !important;
    /* 顶栏“设置/通知”按钮底边约在 95px；从 62px 起算后按钮落在 104px，
       避开顶栏图标，同时仍保持悬浮、不占聊天卡片的一行。 */
    top: calc(62px + env(safe-area-inset-top, 0px)) !important;
    right: 8px !important;
    left: auto !important;
    width: auto !important;
    max-width: calc(100% - 16px) !important;
    height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    z-index: 45 !important;
  }

  /* 悬浮按钮自身给一点实体阴影，避免和背后的聊天卡片/图标视觉黏在一起。 */
  .chv .agh-idbar .agh-idrow > button {
    box-shadow: 0 6px 16px rgba(23, 34, 63, .18) !important;
  }

  .chv .agh-idbar .agh-idrow {
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
    gap: 6px !important;
    overflow: visible !important;
  }

  .chv .agh-idbar .agh-aspanel {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
    width: min(340px, calc(100vw - 20px)) !important;
    max-height: min(56dvh, 380px) !important;
    min-height: 200px !important;
    padding: 10px !important;
    overflow: hidden !important;
    border: 1px solid var(--rk-line) !important;
    border-radius: 14px !important;
    /* 面板必须完全不透明：半透明会把聊天列表的字透到身份面板里，
       看起来像“图标/背景功能重叠”。 */
    background: #fff !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: 0 12px 36px rgba(23, 34, 63, .20) !important;
    z-index: 46 !important;
  }

  .chv .agh-idbar .agh-aslist {
    min-height: min(24dvh, 160px) !important;
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .chv .agh-idbar .agh-as-search {
    min-height: 40px !important;
  }
}

@media (max-width: 420px) {
  .chv .agh-idbar .agh-aspanel {
    width: min(340px, calc(100vw - 20px)) !important;
    right: 0 !important;
    max-height: 60dvh !important;
  }
}
