/* [BRAND_NAME]前端手机端响应式覆盖 v9
 *
 * 背景：frontend/ 是从 [SITE_DOMAIN] 抓的冻结 minified bundle，
 *      上游基本没做移动端适配（grep @media 仅 1 处、mobile/phone 关键字 0 次），
 *      desktop 三栏布局硬塞进 390px viewport 时：
 *        - 侧栏被等比挤压成 146px（模型列表一指宽不可读）
 *        - 主区 .sora2-main-content 只剩 243px
 *        - .scroll-content / .right-section 仍按 desktop 宽度（500-600px）渲染溢出
 *
 * 修复路径：注入本 CSS + heizhu-mobile.js，在 ≤768px 时强制：
 *   1. 侧栏（含 .sidebar-logo / .model-list / .user-section-content 的父容器）→ fixed 抽屉
 *   2. 主区 .sora2-main-content → 全宽，给 hamburger 让顶部 56px
 *   3. .scroll-content / .right-section → 100% 宽，wrap
 *   4. body 加 .heizhu-sidebar-open 时抽屉滑出
 *
 * 侧栏父容器 class 用 JS 打（.heizhu-mobile-sidebar），避免依赖 :has() 兼容性。
 */

/* desktop 永远隐藏 hamburger 和 backdrop（mobile @media 块里 display 会被覆盖） */
.heizhu-mobile-hamburger,
.heizhu-sidebar-backdrop,
.heizhu-wode-profile-backdrop,
.heizhu-linggan-apply-tip,
.heizhu-linggan-modal {
  display: none;
}

@media (max-width: 768px) {
  :root {
    --heizhu-mobile-bottom-panel: 10.75rem;
    --heizhu-mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  *,
  *::before,
  *::after {
    box-sizing: border-box !important;
  }

  #app,
  .dianshang-container,
  .tongyong-container,
  .qishiye-container,
  .zhineng-duozhen,
  .manju-s2-container,
  .manju-container,
  .gongzuoliu-container {
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
  }

  .dianshang-container,
  .tongyong-container,
  .qishiye-container,
  .zhineng-duozhen,
  .manju-s2-container,
  .manju-container {
    height: 100dvh !important;
  }

  .dianshang-container .content-wrapper,
  .tongyong-container .content-wrapper,
  .qishiye-container .content-wrapper,
  .manju-container .content-wrapper {
    height: auto !important;
    min-height: 100dvh !important;
    justify-content: flex-start !important;
    gap: 1rem !important;
    padding: 4.75rem 1rem 16.5rem !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .hero-section,
  .features-section,
  .capabilities-section {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .hero-section {
    gap: 0.75rem !important;
  }

  .hero-top,
  .qishiye-container .hero-section,
  .manju-container .hero-section {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.75rem !important;
    text-align: center !important;
  }

  .logo-container {
    width: 4rem !important;
    height: 4rem !important;
  }

  .hero-title,
  .main-title {
    max-width: 100% !important;
    font-size: clamp(1.75rem, 9vw, 2.35rem) !important;
    line-height: 1.12 !important;
    letter-spacing: 0 !important;
    overflow-wrap: anywhere !important;
  }

  .hero-subtitle,
  .sub-title {
    max-width: 100% !important;
    font-size: 0.95rem !important;
    line-height: 1.45 !important;
  }

  .hero-tagline {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    gap: 0.5rem !important;
    margin-top: 0.25rem !important;
  }

  .tag-item {
    min-height: 2.5rem !important;
    justify-content: center !important;
    padding: 0.45rem 0.75rem !important;
    white-space: normal !important;
  }

  .capabilities-section,
  .features-section {
    flex: 0 0 auto !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    min-height: 0 !important;
  }

  .capabilities-inner {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 1rem !important;
  }

  .ability-grid,
  .features-grid,
  .features-zone {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 0.6rem !important;
  }

  .ability-card,
  .feature-item {
    min-width: 0 !important;
    padding: 0.75rem 0.85rem !important;
    transform: none !important;
  }

  .ability-card.active-card {
    transform: none !important;
  }

  .ability-brief,
  .feature-desc {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  .showcase-area {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex-shrink: 1 !important;
    gap: 0.75rem !important;
    perspective: none !important;
  }

  .showcase-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 1rem !important;
    border-radius: 0.875rem !important;
    transform: none !important;
  }

  .showcase-inner {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.85rem !important;
  }

  .feature-icon-area {
    width: 3rem !important;
    height: 3rem !important;
  }

  .feature-info {
    width: 100% !important;
    min-width: 0 !important;
  }

  .feature-info h3 {
    font-size: 1.25rem !important;
    line-height: 1.3 !important;
  }

  .feature-desc {
    min-height: 0 !important;
    max-height: none !important;
    font-size: 0.9rem !important;
    line-height: 1.55 !important;
  }

  .feature-tags,
  .progress-dots,
  .cta-inner,
  .quick-list {
    flex-wrap: wrap !important;
    justify-content: center !important;
  }

  .corner-decor,
  .logo-orbit,
  .logo-rings {
    display: none !important;
  }

  .content-area,
  .content-area.task-area {
    width: 100% !important;
    max-width: 100% !important;
    padding: 4.25rem 0.75rem 16.5rem !important;
    overflow-x: hidden !important;
  }

  .task-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 1rem !important;
    padding: 0 !important;
  }

  .bottom-spacer {
    height: 15.5rem !important;
  }

  .renwu-panel,
  .history-panel {
    position: fixed !important;
    top: 3.9rem !important;
    left: 0.75rem !important;
    right: 0.75rem !important;
    z-index: 210 !important;
    width: auto !important;
    max-width: calc(100vw - 1.5rem) !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  .dropdown-panel,
  .history-dropdown {
    width: min(22rem, calc(100vw - 1.5rem)) !important;
    max-width: calc(100vw - 1.5rem) !important;
  }

  .config-btn-wrapper {
    position: fixed !important;
    left: 0.75rem !important;
    bottom: calc(var(--heizhu-mobile-safe-bottom) + 13.75rem) !important;
    z-index: 160 !important;
  }

  .bottom-input-wrapper {
    pointer-events: none !important;
    padding: 0 0.75rem calc(var(--heizhu-mobile-safe-bottom) + 0.75rem) !important;
    background: transparent !important;
    z-index: 140 !important;
  }

  .bottom-input-wrapper > * {
    pointer-events: auto !important;
  }

  .bottom-container,
  .input-wrapper .bottom-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 9.25rem !important;
    max-height: calc(100dvh - 6rem) !important;
    overflow: hidden !important;
    border-radius: 1rem !important;
  }

  .top-section {
    min-height: 6rem !important;
    overflow: visible !important;
  }

  .left-section {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: 5.75rem !important;
    min-width: 0 !important;
    padding: 0.75rem 0.5rem 0.4rem 0.75rem !important;
  }

  .right-section,
  .input-section {
    min-width: 0 !important;
    padding: 0.75rem 0.75rem 0.4rem 0 !important;
    overflow: hidden !important;
  }

  .shurukuang-container,
  .shurukuang-wrapper,
  .rich-input-wrapper,
  .input-section .shurukuang-container {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
  }

  .shurukuang-textarea,
  .rich-input,
  textarea,
  input {
    max-width: 100% !important;
    font-size: 16px !important;
  }

  .input-section .shurukuang-textarea,
  .shurukuang-textarea,
  .rich-input {
    min-height: 4.25rem !important;
    max-height: 7rem !important;
  }

  .cankaotu-container,
  .file-list-container,
  .file-list-area {
    max-width: 5.5rem !important;
    min-width: 0 !important;
  }

  .bottom-section {
    height: auto !important;
    min-height: 3.25rem !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.5rem 0.75rem 0.75rem !important;
  }

  .selectors-area,
  .selectors-scroll-container {
    flex: 1 1 calc(100% - 3rem) !important;
    min-width: 0 !important;
    overflow-x: auto !important;
  }

  .send-button {
    width: 2.5rem !important;
    height: 2.5rem !important;
    margin-left: 0 !important;
    flex: 0 0 2.5rem !important;
  }

  .mode-switch-wrapper {
    position: fixed !important;
    left: 0.75rem !important;
    right: 0.75rem !important;
    bottom: calc(var(--heizhu-mobile-safe-bottom) + 0.75rem) !important;
    z-index: 155 !important;
    display: flex !important;
    justify-content: center !important;
    width: auto !important;
  }

  body.heizhu-has-bottom-input .mode-switch-wrapper {
    bottom: calc(var(--heizhu-mobile-safe-bottom) + var(--heizhu-mobile-bottom-panel) + 0.75rem) !important;
    left: 50% !important;
    right: auto !important;
    width: min(14.5rem, calc(100vw - 1.5rem)) !important;
    transform: translateX(-50%) !important;
  }

  .mode-switch {
    width: 100% !important;
    max-width: 22rem !important;
    justify-content: space-between !important;
  }

  body.heizhu-has-bottom-input .mode-switch {
    max-width: 14.5rem !important;
  }

  .mode-switch-option {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    min-height: 2.75rem !important;
    justify-content: center !important;
    padding: 0.5rem 0.65rem !important;
    white-space: nowrap !important;
  }

  .guide-btn,
  .bug-feedback-btn {
    position: fixed !important;
    min-height: 2.5rem !important;
    max-width: calc(50vw - 1rem) !important;
    padding: 0.5rem 0.75rem !important;
    z-index: 156 !important;
    white-space: nowrap !important;
  }

  .guide-btn {
    left: 0.75rem !important;
    bottom: calc(var(--heizhu-mobile-safe-bottom) + 0.75rem) !important;
  }

  .bug-feedback-btn {
    right: 0.75rem !important;
    bottom: calc(var(--heizhu-mobile-safe-bottom) + 3.95rem) !important;
  }

  body.heizhu-has-bottom-input .guide-btn {
    bottom: calc(var(--heizhu-mobile-safe-bottom) + var(--heizhu-mobile-bottom-panel) + 4.25rem) !important;
  }

  body.heizhu-has-bottom-input .bug-feedback-btn {
    bottom: calc(var(--heizhu-mobile-safe-bottom) + var(--heizhu-mobile-bottom-panel) + 4.25rem) !important;
  }

  .guide-btn span,
  .bug-feedback-btn span,
  .guide-btn .btn-text,
  .bug-feedback-btn .btn-text {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .guide-overlay,
  .tuoguan-modal-overlay,
  .pref-overlay,
  .zcxzq-mask,
  .shurukuang-save-mask {
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0.75rem !important;
  }

  .guide-container,
  .tuoguan-modal-container,
  .pref-panel,
  .zcxzq-modal,
  .shurukuang-save-modal,
  .engine-modal-container,
  .modal-container {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 1.5rem) !important;
    border-radius: 1rem !important;
  }

  .guide-scroll,
  .pref-content,
  .tuoguan-modal-body {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .groups-grid,
  .retry-cards,
  .adv-grid,
  .image-grid,
  .images-grid {
    grid-template-columns: 1fr !important;
  }

  .main-layout {
    flex-direction: column !important;
    overflow-y: auto !important;
  }

  .gongzuoliu-container .left-panel,
  .gongzuoliu-container .right-panel {
    width: 100% !important;
    min-height: auto !important;
    border-right: 0 !important;
  }

  .input-wrapper {
    width: 100% !important;
    padding: 0.75rem !important;
  }

  .manju-s2-container .main-content {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: 0 !important;
  }

  .manju-s2-container .left-panel.heizhu-mobile-sidebar {
    width: min(86vw, 22rem) !important;
    max-width: min(86vw, 22rem) !important;
  }

  .wode-container {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    padding: 4.25rem 0.75rem 1rem !important;
    overflow: hidden !important;
  }

  .wode-layout {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
  }

  .works-section-wrapper {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
  }

  .section-header-fixed {
    align-items: flex-start !important;
    flex-wrap: wrap !important;
    gap: 0.75rem !important;
    padding: 0 0 0.75rem !important;
  }

  .title-left {
    flex: 1 1 100% !important;
    min-width: 0 !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }

  .section-title {
    font-size: 1.35rem !important;
    line-height: 1.2 !important;
    writing-mode: horizontal-tb !important;
    word-break: keep-all !important;
  }

  .work-type-filter {
    order: 3 !important;
    width: 100% !important;
    margin-left: 0 !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }

  .work-type-filter::-webkit-scrollbar {
    display: none !important;
  }

  .works-tip {
    order: 4 !important;
    width: 100% !important;
    margin-left: 0 !important;
    align-items: flex-start !important;
  }

  .header-actions {
    width: 100% !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
  }

  .works-section {
    padding: 1rem 0 0 !important;
  }

  .works-grid {
    grid-template-columns: 1fr !important;
    gap: 0.875rem !important;
  }

  .profile-container {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: min(88vw, 25rem) !important;
    max-width: min(88vw, 25rem) !important;
    height: 100dvh !important;
    z-index: 1220 !important;
    overflow: hidden !important;
    transform: translateX(105%) !important;
    transition: transform 0.24s ease !important;
    background: var(--bg-page, #0d0f14) !important;
    border-left: 1px solid var(--w-8, rgba(255, 255, 255, 0.08)) !important;
    box-shadow: -1.25rem 0 3rem rgba(0, 0, 0, 0.45) !important;
  }

  body.heizhu-wode-profile-open .profile-container {
    transform: translateX(0) !important;
  }

  .profile-scroll {
    height: 100% !important;
    padding-top: calc(env(safe-area-inset-top, 0px) + 3rem) !important;
  }

  .profile-content {
    padding: 1rem !important;
    gap: 1rem !important;
  }

  .heizhu-wode-profile-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1210 !important;
    background: rgba(0, 0, 0, 0.52) !important;
    backdrop-filter: blur(0.25rem) !important;
    -webkit-backdrop-filter: blur(0.25rem) !important;
  }

  body.heizhu-wode-profile-open .heizhu-wode-profile-backdrop {
    display: block !important;
  }

  .heizhu-wode-profile-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
    min-height: 2.5rem !important;
    padding: 0 0.85rem !important;
    border: 1px solid rgba(0, 202, 224, 0.32) !important;
    border-radius: 999px !important;
    background: rgba(0, 202, 224, 0.12) !important;
    color: rgba(180, 246, 255, 0.95) !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    white-space: nowrap !important;
  }

  .heizhu-wode-profile-close {
    position: absolute !important;
    top: calc(env(safe-area-inset-top, 0px) + 0.75rem) !important;
    right: 0.75rem !important;
    z-index: 2 !important;
    width: 2.25rem !important;
    height: 2.25rem !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 0.75rem !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.82) !important;
    font-size: 1.5rem !important;
    line-height: 1 !important;
    cursor: pointer !important;
  }

  .heizhu-linggan-modal {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.75rem !important;
  }

  .heizhu-linggan-modal .modal-container {
    width: min(22.5rem, calc(100vw - 1.5rem)) !important;
    max-width: calc(100vw - 1.5rem) !important;
    max-height: calc(100dvh - 1.5rem) !important;
    border-radius: 1rem !important;
    overflow: hidden !important;
  }

  .heizhu-linggan-modal .modal-content {
    flex-direction: column !important;
    width: 100% !important;
    max-height: calc(100dvh - 1.5rem) !important;
  }

  .heizhu-linggan-modal .media-area {
    width: 100% !important;
    flex: 0 0 auto !important;
    min-height: 0 !important;
    max-height: 45dvh !important;
    aspect-ratio: 4 / 3 !important;
  }

  .heizhu-linggan-modal .media-image,
  .heizhu-linggan-modal .media-player {
    width: 100% !important;
    height: 100% !important;
    max-height: 45dvh !important;
    object-fit: contain !important;
  }

  .heizhu-linggan-modal .info-area {
    width: 100% !important;
    max-height: calc(55dvh - 1.5rem) !important;
    padding: 1rem !important;
    gap: 0.75rem !important;
    border-left: 0 !important;
    border-top: 1px solid var(--w-8) !important;
  }

  .heizhu-linggan-modal .title {
    font-size: 1rem !important;
    line-height: 1.35 !important;
  }

  .heizhu-linggan-modal .stats-row {
    flex-wrap: wrap !important;
    gap: 0.75rem !important;
  }

  .heizhu-linggan-modal .action-buttons {
    margin-top: 0 !important;
    padding-top: 0.25rem !important;
  }

  .heizhu-linggan-modal .use-btn {
    min-height: 2.75rem !important;
  }

  .heizhu-linggan-modal .close-btn {
    top: 0.75rem !important;
    right: 0.75rem !important;
    width: 2.25rem !important;
    height: 2.25rem !important;
  }
}

/* 当前上线主线只保留邮箱验证码和密码登录，隐藏未启用的第三方登录入口。 */
.login-container .divider,
.login-container .social-login {
  display: none !important;
}

.profile-card .card-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
}

.heizhu-profile-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.heizhu-profile-edit-btn:hover {
  border-color: rgba(0, 202, 224, 0.55);
  background: rgba(0, 202, 224, 0.14);
  color: #fff;
}

.heizhu-profile-edit-btn:active {
  background: rgba(0, 202, 224, 0.22);
}

.heizhu-profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

.heizhu-profile-overlay * {
  box-sizing: border-box;
}

.heizhu-profile-modal {
  position: relative;
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: #15161a;
  color: #fff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

.heizhu-profile-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.heizhu-profile-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.heizhu-profile-header {
  padding-right: 36px;
}

.heizhu-profile-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.3;
}

.heizhu-profile-header p {
  margin: 6px 0 18px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  line-height: 1.5;
}

.heizhu-profile-avatar-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(0, 202, 224, 0.2), rgba(255, 255, 255, 0.08));
}

.heizhu-profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-preview-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
}

.heizhu-profile-field {
  display: block;
  margin-bottom: 14px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
}

.heizhu-profile-field input {
  display: block;
  width: 100%;
  height: 40px;
  margin-top: 7px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 14px;
  outline: none;
}

.heizhu-profile-field input:focus {
  border-color: rgba(0, 202, 224, 0.68);
  box-shadow: 0 0 0 3px rgba(0, 202, 224, 0.12);
}

.heizhu-profile-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 10px;
}

.heizhu-profile-file {
  display: none;
}

.heizhu-profile-upload-row button,
.heizhu-profile-actions button {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.heizhu-profile-upload,
.heizhu-profile-clear,
.heizhu-profile-cancel {
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
}

.heizhu-profile-upload:hover,
.heizhu-profile-clear:hover,
.heizhu-profile-cancel:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.heizhu-profile-message {
  min-height: 20px;
  margin: 10px 0 12px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  line-height: 1.4;
}

.heizhu-profile-message.success {
  color: #42d392;
}

.heizhu-profile-message.error {
  color: #ff6b6b;
}

.heizhu-profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.heizhu-profile-save {
  border: 1px solid rgba(0, 202, 224, 0.65);
  background: #00cae0;
  color: #071113;
  font-weight: 650;
}

.heizhu-profile-save:hover {
  background: #2be4f4;
}

.heizhu-profile-save:disabled,
.heizhu-profile-upload:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

@media (max-width: 768px) {
  /* 全局横向溢出兜底：任何子元素都不能撑开 body */
  html,
  body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  /* 侧栏抽屉化（class 由 JS 打到 sidebar-logo 的父元素上） */
  .heizhu-mobile-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 85vw !important;
    max-width: 320px !important;
    z-index: 1000 !important;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    background: var(--c-bg-1, #0f0f0f) !important;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.6);
    overflow-y: auto;
  }
  /* 侧栏内部所有直接子元素强制全宽（覆盖原 desktop 写死的 9rem 等值） */
  .heizhu-mobile-sidebar > *,
  .heizhu-mobile-sidebar .sidebar-logo,
  .heizhu-mobile-sidebar .model-list,
  .heizhu-mobile-sidebar .user-section-content {
    width: 100% !important;
    max-width: 100% !important;
  }
  body.heizhu-sidebar-open .heizhu-mobile-sidebar {
    transform: translateX(0);
  }

  /* 主内容区全宽 + 顶部 56px 给浮动 hamburger 让位 + 左右 4px 紧凑边距 */
  .sora2-main-content {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: 0 !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    padding-top: 56px !important;
    box-sizing: border-box !important;
  }

  /* 主区内部容器解除横向溢出 + 收窄 padding */
  .scroll-content,
  .scroll-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    box-sizing: border-box !important;
  }
  .right-section {
    width: 100% !important;
    max-width: 100% !important;
    flex-wrap: wrap !important;
  }
  .right-action-buttons-group {
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: flex-start !important;
  }

  /* 底部输入框区（聊天/图片生成页）。
   *
   * 两个 desktop 设计在 mobile 都需要覆盖：
   *   a) 原本是 `position: absolute; left: 50%; transform: translateX(-50%); width: 530px`
   *      做经典居中。mobile 改 100% 宽后 translateX(-50%) 会把整块推到 x=-195。
   *   b) wrapper 是 absolute 相对 .sora2-main-content（高 100vh）定位。iOS Safari 键盘
   *      弹出时会自动 scroll 整页让 focused input 可见，wrapper 跟着主区一起被向上推
   *      到屏幕中央——用户感知就是「输入框被顶走了」。
   *
   * 修复策略：
   *   - 改 position: fixed 脱离主区滚动上下文，bottom: 0 贴 viewport 底
   *   - 用 visualViewport API 算键盘高度写入 --heizhu-kb-inset CSS 变量，
   *     translateY(-inset) 让 wrapper 始终贴键盘顶（详见 heizhu-mobile.js）
   *   - 键盘没弹时 inset=0，translateY(0) 等价于 transform: none（也顺便清掉
   *     上游 inline 的 translateX(-50%)）
   *   - padding-bottom 用 safe-area-inset 兜底 iPhone 底部安全区
   */
  .bottom-input-wrapper {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: translateY(calc(-1 * var(--heizhu-kb-inset, 0px))) !important;
    transition: transform 0.18s ease !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 4px) !important;
    box-sizing: border-box !important;
    z-index: 100 !important;
    background: var(--c-bg-1, #0f0f0f) !important;
  }
  .rich-input {
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
    box-sizing: border-box !important;
  }

  /* 顶部 nav 紧凑化（如果存在） */
  header,
  .top-nav,
  .header-nav {
    padding-left: 56px !important;
  }

  /* 浮动 hamburger 按钮 —— 替换 display:none */
  .heizhu-mobile-hamburger {
    display: flex !important;
    position: fixed !important;
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    background: rgba(20, 20, 20, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    z-index: 1001 !important;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    padding: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .heizhu-mobile-hamburger:active {
    background: rgba(60, 60, 60, 0.95);
  }

  /* 侧栏抽屉打开时的遮罩 */
  .heizhu-sidebar-backdrop {
    display: none;
    position: fixed !important;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999 !important;
  }
  body.heizhu-sidebar-open .heizhu-sidebar-backdrop {
    display: block !important;
  }

  .heizhu-profile-overlay {
    align-items: flex-end;
    padding: 12px;
  }

  .heizhu-profile-modal {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    padding: 20px;
  }

  .heizhu-profile-upload-row {
    flex-wrap: wrap;
  }

  .heizhu-profile-upload-row button,
  .heizhu-profile-actions button {
    flex: 1;
  }

  .heizhu-profile-actions {
    justify-content: stretch;
  }
}

@media (max-width: 768px) {
  .linggan-guangchang {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    padding: 4.25rem 0.75rem 1rem !important;
    overflow: hidden !important;
  }

  .linggan-guangchang .filter-bar {
    position: sticky !important;
    top: 0 !important;
    z-index: 80 !important;
    width: 100% !important;
    padding: 0 0 0.75rem !important;
    border-bottom: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
  }

  .linggan-guangchang .filter-bar::-webkit-scrollbar {
    display: none !important;
  }

  .linggan-guangchang .filter-tabs {
    display: flex !important;
    width: max-content !important;
    min-width: 100% !important;
    gap: 0.5rem !important;
  }

  .linggan-guangchang .filter-tab {
    flex: 0 0 auto !important;
    min-height: 2.5rem !important;
    padding: 0 0.85rem !important;
    white-space: nowrap !important;
  }

  .linggan-guangchang .masonry-container {
    width: 100% !important;
    height: calc(100dvh - 8.5rem) !important;
    padding: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .linggan-guangchang .masonry-content {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.75rem !important;
    overflow: visible !important;
    padding-bottom: 1rem !important;
  }

  .linggan-guangchang .masonry-item {
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    height: auto !important;
    transform: none !important;
  }

  .linggan-guangchang .item-card {
    width: 100% !important;
    height: auto !important;
    min-width: 0 !important;
    border-radius: 0.75rem !important;
    overflow: hidden !important;
  }

  .linggan-guangchang .item-cover {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 3 / 4 !important;
    flex: 0 0 auto !important;
  }

  .linggan-guangchang .cover-img,
  .linggan-guangchang .cover-placeholder,
  .linggan-guangchang .cover-skeleton {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  .linggan-guangchang .hover-overlay {
    display: none !important;
  }

  .linggan-guangchang .item-info {
    min-height: 5.25rem !important;
    padding: 0.55rem !important;
    gap: 0.4rem !important;
  }

  .linggan-guangchang .item-title {
    font-size: 0.78rem !important;
    line-height: 1.35 !important;
    max-height: 2.1rem !important;
    overflow: hidden !important;
  }

  .linggan-guangchang .item-tags {
    gap: 0.25rem !important;
    flex-wrap: wrap !important;
  }

  .linggan-guangchang .tag {
    max-width: 100% !important;
    padding: 0.15rem 0.35rem !important;
    font-size: 0.65rem !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .linggan-guangchang .loading-indicator,
  .linggan-guangchang .no-more,
  .linggan-guangchang .empty-state {
    grid-column: 1 / -1 !important;
    padding: 1.5rem 0 !important;
  }
}

.heizhu-linggan-apply-tip {
  display: flex !important;
  position: fixed !important;
  left: 50% !important;
  bottom: 10rem !important;
  transform: translateX(-50%) !important;
  z-index: 180 !important;
  max-width: min(33rem, calc(100vw - 2rem)) !important;
  align-items: center !important;
  gap: 0.5rem !important;
  padding: 0.55rem 0.65rem 0.55rem 0.8rem !important;
  border: 1px solid rgba(0, 202, 224, 0.28) !important;
  border-radius: 999px !important;
  background: rgba(20, 26, 34, 0.94) !important;
  color: rgba(255, 255, 255, 0.92) !important;
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.28) !important;
  backdrop-filter: blur(12px) !important;
  font-size: 0.8125rem !important;
  line-height: 1.2 !important;
}

.heizhu-linggan-apply-tip strong,
.heizhu-linggan-apply-tip em {
  min-width: 0 !important;
  max-width: 9rem !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-style: normal !important;
  font-weight: 600 !important;
  color: rgba(180, 246, 255, 0.96) !important;
}

.heizhu-linggan-apply-tip button {
  display: inline-flex !important;
  width: 1.5rem !important;
  height: 1.5rem !important;
  flex: 0 0 auto !important;
  align-items: center !important;
  justify-content: center !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  color: rgba(255, 255, 255, 0.82) !important;
  cursor: pointer !important;
}

@media (max-width: 360px) {
  .linggan-guangchang .masonry-content {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  .heizhu-linggan-apply-tip {
    left: 0.75rem !important;
    right: 0.75rem !important;
    bottom: calc(9.25rem + var(--heizhu-kb-inset, 0px) + env(safe-area-inset-bottom, 0px)) !important;
    transform: none !important;
    max-width: none !important;
  }
}
