/* —— 响应式 —— */
/* 桌面：装进「手机外框」，居中、圆角、细边（不用海拔，控制层级语言） */
@media (min-width: 600px) {
  .frame {
    height: min(870px, calc(100dvh - 30px));
    margin-block: 15px;
    border: 1px solid var(--md-outline-variant);
    border-radius: var(--md-shape-xl);
    box-shadow: none;
  }
  .snackbar, .toast { bottom: calc(168px + env(safe-area-inset-bottom)); }
  dialog { max-height: min(720px, calc(100dvh - 60px)); }
}

/* 横屏矮屏：登录页改为顶部对齐，装饰缩小，避免 CTA 被挤出视口 */
@media (max-height: 520px) {
  .login { justify-content: flex-start; padding-top: max(20px, env(safe-area-inset-top)); }
  .login-decoration { height: 86px; margin-bottom: 8px; }
  .login-decoration span { width: 100px; height: 56px; }
  .login-decoration img { width: 56px; }
  .intro { margin-bottom: 16px; }
  .private-note { margin-top: 12px; }
}

/* 窄屏（≤380px）收紧横向边距，保证 320px 不横向溢出 */
@media (max-width: 380px) {
  :root { --md-gutter: 12px; }
  .chat-head { padding-left: 12px; }
  .timeline { padding-left: 12px; padding-right: 12px; }
  .scroll-tab { padding-left: 12px; padding-right: 12px; }
  .composer { padding-left: 10px; padding-right: 10px; }
  .discover-label { max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .call-float { width: 152px; }
  /* 窄屏：勾保留（选中态必须可辨），只收字号与间距 */
  .segmented > button, .segmented [data-appearance] { padding: 0 4px; font-size: 13px; gap: 4px; }
}

/* 极窄（≤340px）再收一档，320px 仍不溢出 */
@media (max-width: 340px) {
  .avatar { width: 36px; height: 36px; }
  .avatar.large { width: 48px; height: 48px; }
  .nav-bar button span, .tabs button span { font-size: 11px; }
  .publish-row .file-button svg { display: none; }
  .message { max-width: 88%; }
  .swatches { gap: 8px; }
  .swatches [data-theme] { width: 40px; height: 40px; }
}

/* —— 动效偏好：关掉过渡，保留状态与内容 —— */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
