/* ============================================================
   Isleocean 响应式增强 v2.0 — Mobile-First 深度优化
   策略：移动端原生体验 + 触摸优化 + 底部导航 + 卡片化布局
   覆盖：手机 (<480px) / 平板 (481-768px) / 小桌面 (769-1024px)
   ============================================================ */

/* ───────── 基础变量 & 安全区域 ───────── */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --tab-bar-height: 56px;
}

/* ───────── 全局触摸优化 ───────── */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

*, *::before, *::after {
  -webkit-tap-highlight-color: transparent;
}

/* 所有可交互元素至少 44px 触摸目标 (Apple HIG) */
@media (max-width: 768px) {
  button, a.btn, .action-btn, .page-btn, .menu-item, 
  .el-button, .el-tabs__item, .el-pager li {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  a, .clickable, [onclick], [@click] {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.12);
    touch-action: manipulation;
  }

  input, select, textarea {
    font-size: 16px !important; /* 防止 iOS 缩放 */
    touch-action: manipulation;
  }
}

/* ───────── 性能优化 ───────── */
.school-container, .forum-container, .tools-container, .visa-container {
  content-visibility: auto;
  contain-intrinsic-size: 500px;
}

.college-card, .thread-card, .tool-card {
  will-change: transform;
}

img {
  max-width: 100%;
  height: auto;
}

/* ───────── 通用触摸微交互 ───────── */
@media (hover: none) and (pointer: coarse) {
  /* 触摸设备专属样式 */
  .btn:active, .action-btn:active, .page-btn:active,
  .college-card:active, .thread-card:active, .price-card:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
  }

  .card:active, .stat-card:active {
    transform: scale(0.98);
  }
}

/* ============================================================
   底部导航栏 (Mobile Tab Bar)
   类似微信/淘宝的底部导航 —— 中文用户最熟悉
   ============================================================ */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-bar-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    z-index: 999;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    padding-bottom: var(--safe-bottom);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
  }

  body.dark-mode .mobile-bottom-nav {
    background: rgba(30, 41, 59, 0.95);
    border-top-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
  }

  .mobile-bottom-nav .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 0;
    color: #8a97a8;
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    min-width: 48px;
    transition: color 0.2s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-bottom-nav .tab-item.active {
    color: #4f6ef7;
    font-weight: 600;
  }

  .mobile-bottom-nav .tab-item.active::after {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: #4f6ef7;
    border-radius: 0 0 3px 3px;
  }

  .mobile-bottom-nav .tab-item .tab-icon {
    font-size: 22px;
    line-height: 1;
    transition: transform 0.2s;
  }

  .mobile-bottom-nav .tab-item:active .tab-icon {
    transform: scale(0.85);
  }

  .mobile-bottom-nav .tab-item .tab-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 22px);
    background: #f56c6c;
    color: #fff;
    font-size: 9px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
  }

  /* 底部导航存在时，给主内容留出间距 */
  body.has-bottom-nav main,
  body.has-bottom-nav > .content-area,
  body.has-bottom-nav > .school-container,
  body.has-bottom-nav > .forum-container,
  body.has-bottom-nav > .tools-container,
  body.has-bottom-nav > .visa-container,
  body.has-bottom-nav > .document-container {
    padding-bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 16px);
  }

  body.has-bottom-nav .cs-float {
    bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 12px);
  }

  body.has-bottom-nav .cs-chat {
    bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 68px);
  }

  /* 管理后台底部导航定位 */
  body.has-bottom-nav .admin-layout .main-area {
    padding-bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 16px);
  }
}

/* ============================================================
   平板 (481px - 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* ── 导航栏 ── */
  .navbar {
    padding: 10px 16px;
    height: 52px;
    position: fixed;
    top: 0;
    z-index: 199;
  }

  .nav-brand a {
    font-size: 16px;
    gap: 6px !important;
  }

  .nav-brand img {
    height: 26px !important;
  }

  /* ── 汉堡菜单 + 遮罩层 ── */
  .hamburger {
    display: flex;
  }

  .nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 148;
    animation: overlayIn 0.25s ease;
  }

  @keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .nav-overlay.visible {
    display: block;
  }

  .nav-links {
    display: none;
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    flex-direction: column;
    padding: 8px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    z-index: 150;
    gap: 0;
    max-height: calc(100vh - 52px - var(--tab-bar-height));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-links.mobile-open {
    display: flex;
    animation: slideDown 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .nav-links a {
    padding: 14px 24px;
    font-size: 16px;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .nav-links a::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #4f6ef7;
    opacity: 0;
    transition: opacity 0.2s;
  }

  .nav-links a.active::before {
    opacity: 1;
  }

  .nav-links a:active {
    background: rgba(102, 126, 234, 0.08);
  }

  .dark-toggle, .user-avatar, [onclick*="toggleNotifPanel"] {
    margin: 8px 24px;
    align-self: flex-start;
  }

  #navAvatar {
    margin: 12px 24px;
    width: 36px;
    height: 36px;
  }

  /* ── 通知面板全屏化 ── */
  #notifPanel {
    position: fixed !important;
    top: 0px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-height: none !important;
    border-radius: 0 !important;
    z-index: 200 !important;
  }

  /* ── 首页 Hero ── */
  .hero {
    padding: 48px 16px 36px;
    min-height: auto;
  }

  .hero h1 {
    font-size: 24px;
    line-height: 1.3;
    margin-bottom: 12px;
  }

  .hero p {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .hero .btn {
    padding: 12px 24px;
    font-size: 15px;
    min-height: 48px;
  }

  /* ── 搜索区域 ── */
  .search-section {
    padding: 1.25rem;
    border-radius: 10px;
  }

  .search-section h2 {
    font-size: 18px;
  }

  .search-box {
    flex-direction: column;
    gap: 8px;
  }

  .search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 12px;
  }

  .search-btn, .ai-recommend-btn {
    width: 100%;
    text-align: center;
    padding: 12px;
    font-size: 15px;
    min-height: 48px;
    border-radius: 12px;
  }

  /* ── 筛选器横向滚动 ── */
  .filters {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }

  .filters::-webkit-scrollbar { display: none; }

  .filter-select {
    min-width: 100px;
    padding: 10px 14px;
    font-size: 14px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  /* ── 院校网格 ── */
  .college-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
    padding: 0 8px;
  }

  .college-card {
    padding: 16px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .college-name {
    font-size: 1.1rem;
  }

  .college-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .action-btn {
    flex: 1;
    min-width: 80px;
    text-align: center;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 10px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }

  /* ── 价格/工具网格 ── */
  .price-grid, .tools-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
    padding: 12px 16px;
  }

  .price-card, .tool-card {
    padding: 20px;
    border-radius: 16px;
  }

  /* ── 分页 ── */
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 16px 8px;
  }

  .page-btn {
    min-width: 44px;
    height: 44px;
    font-size: 14px;
    padding: 0 12px;
    border-radius: 12px;
  }

  .page-btn.prev,
  .page-btn.next {
    background: rgba(79, 110, 247, 0.06);
    color: #4f6ef7;
    font-weight: 600;
  }

  /* ── 个人主页 ── */
  .profile-header {
    flex-direction: column;
    text-align: center;
    padding: 24px 16px;
    gap: 16px;
    border-radius: 16px;
  }

  .profile-avatar {
    width: 80px;
    height: 80px;
  }

  .profile-stats {
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
  }

  .profile-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* ── 论坛 ── */
  .forum-container {
    padding: 60px 8px 16px;
  }

  .thread-card {
    padding: 14px;
    border-radius: 14px;
  }

  .thread-header {
    gap: 10px;
  }

  .thread-avatar {
    width: 40px;
    height: 40px;
  }

  .thread-content {
    font-size: 14px;
    line-height: 1.6;
  }

  .thread-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .thread-actions button {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 20px;
  }

  /* ── 模态框全屏化 ── */
  .modal-content {
    width: 100%;
    max-height: 100vh;
    height: 100vh;
    padding: 24px 20px;
    margin: 0;
    border-radius: 0;
    max-width: none;
    overflow-y: auto;
  }

  .modal-content .close {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-secondary);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    float: right;
  }

  .modal-content input,
  .modal-content select,
  .modal-content textarea {
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 10px;
  }

  /* ── 管理后台侧栏 ── */
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .admin-content {
    margin-left: 0;
    padding: 12px;
  }

  .sidebar-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
  }

  .sidebar-menu li {
    padding: 8px 12px;
    font-size: 13px;
    flex: 1 1 auto;
    text-align: center;
  }

  /* ── 统计面板 ── */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-card {
    padding: 16px;
    border-radius: 14px;
  }

  .stat-value {
    font-size: 1.6rem;
  }

  .stat-label {
    font-size: 12px;
  }

  /* ── 余额区域 ── */
  .balance-amount {
    font-size: 26px;
  }

  .recharge-options {
    gap: 6px;
  }

  .recharge-btn {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 44px;
    border-radius: 12px;
  }

  /* ── 客服悬浮按钮 ── */
  .cs-float {
    width: 52px;
    height: 52px;
    font-size: 22px;
    bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 16px);
    right: 16px;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(79, 110, 247, 0.3);
  }

  .cs-chat {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 72px);
    max-height: calc(100vh - var(--tab-bar-height) - 140px);
    border-radius: 16px 16px 0 0;
  }

  .cs-messages {
    max-height: calc(60vh - 120px);
  }

  .cs-input-area {
    display: flex;
    gap: 8px;
    padding: 10px;
  }

  .cs-input-area input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    font-size: 15px;
  }

  .cs-input-area button {
    padding: 10px 18px;
    border-radius: 20px;
    background: #4f6ef7;
    color: #fff;
    border: none;
    font-size: 14px;
    min-width: 60px;
  }

  /* ── 页脚 ── */
  footer {
    padding: 24px 16px;
    padding-bottom: calc(24px + var(--tab-bar-height) + var(--safe-bottom));
    font-size: 13px;
  }

  /* ── 表情网格 ── */
  .emoji-grid, .comment-emoji-grid {
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
  }

  .emoji-cell, .comment-emoji-cell {
    font-size: 22px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ── 评论图片 ── */
  .comment-image {
    max-width: 150px;
    max-height: 150px;
  }

  /* ── 通知面板内联 ── */
  .user-menu {
    gap: 8px;
  }

  /* ── 选校页面专用 ── */
  .school-container { padding: 60px 8px 16px; }
  .school-header { padding: 12px 8px; }
  .school-header h1 { font-size: 20px; }
  .school-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 4px; padding: 0 8px; }
  .school-tabs button { white-space: nowrap; font-size: 14px; padding: 10px 16px; flex-shrink: 0; border-radius: 20px; }
  .compare-bar { flex-direction: column; padding: 14px; gap: 8px; position: fixed; bottom: calc(var(--tab-bar-height) + var(--safe-bottom)); left: 0; right: 0; z-index: 100; border-radius: 16px 16px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,.1); }
  .compare-list { flex-wrap: wrap; gap: 4px; }
  .compare-tag { font-size: 12px; padding: 6px 10px; }
  .school-main { flex-direction: column !important; }
  .school-filter-col { width: 100% !important; max-width: 100% !important; padding: 0 8px; }
  .school-list-col { width: 100% !important; padding: 12px 8px; }
  .college-detail-modal { width: 96vw !important; max-width: 96vw !important; }
  .college-detail-grid { grid-template-columns: 1fr; gap: 8px; }

  /* ── 工具页面专用 ── */
  .tools-container { padding: 60px 8px 16px; }
  .gpa-card { padding: 18px; min-width: auto; border-radius: 14px; }
  .gpa-value { font-size: 36px; }
  .gpa-stats { gap: 12px; }
  .data-table { font-size: 12px; }
  .data-table th,.data-table td { padding: 10px 8px; }
  .data-table input { font-size: 16px !important; padding: 8px 6px !important; }
  .scale-toggle { flex-wrap: wrap; gap: 6px; }
  .scale-btn { padding: 10px 16px; font-size: 13px; flex: 1 1 auto; text-align: center; border-radius: 10px; }
  .exchange-grid { grid-template-columns: repeat(2,1fr); gap: 8px; }
  .exchange-card { padding: 14px; }
  .form-row { flex-direction: column; gap: 10px; }
  .card-header h3 { font-size: 1rem; }
  .card-header .price { font-size: .85rem; }
  .info-text { font-size: 12px; padding: 10px; }
  .ocr-upload-preview { flex-direction: column; }
  .ocr-upload-area { min-height: 160px; border-radius: 12px; }
  #coursesEditableTable{font-size:11px}
  #coursesEditableTable th{padding:6px 4px}
  .preview-img{max-height:120px}

  /* ── 定价页面专用 ── */
  .pricing-container{max-width:100%;padding:60px 16px 16px}
  .pricing-hero{padding:32px 16px 24px}
  .pricing-cards{flex-direction:column;gap:16px}
  .price-card{width:100%!important;max-width:100%}
  .pricing-feature-table{font-size:12px}
  .pricing-feature-table td,.pricing-feature-table th{padding:10px 8px}

  /* ── 首页增强 ── */
  .feature-grid{grid-template-columns:1fr!important;gap:20px}
  .feature-card{padding:24px 20px;border-radius:16px}
  .stats-section .stat-number{font-size:clamp(1.8rem,7vw,2.4rem)}
  .cta-section{padding:48px 20px}
  .cta-section h2{font-size:1.6rem}
  .index-card-grid{grid-template-columns:1fr!important}

  /* ── 横向滚动容器 ── */
  .scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
  }

  .scroll-x::-webkit-scrollbar { display: none; }

  .scroll-x > * {
    scroll-snap-align: start;
  }

  /* ── 表单优化 ── */
  .form-group {
    margin-bottom: 16px;
  }

  .form-label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
  }

  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="search"], select, textarea {
    font-size: 16px !important;
    padding: 12px 16px !important;
    border-radius: 10px !important;
    width: 100%;
  }

  button[type="submit"], .submit-btn {
    width: 100%;
    min-height: 48px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
  }
}

/* ============================================================
   手机 (<480px)
   ============================================================ */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 20px;
  }

  .hero p {
    font-size: 13px;
  }

  .section-title {
    font-size: 18px;
    margin: 24px 0 16px;
  }

  /* 极窄网格 */
  .college-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .college-card {
    padding: 14px;
  }

  .college-name {
    font-size: 1rem;
  }

  /* 单列统计 */
  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* 信息网格 2 列 */
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* 论坛 */
  .forum-container {
    padding: 56px 4px 12px;
  }

  .post-box {
    padding: 12px;
    border-radius: 12px;
  }

  .post-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* 签证表单 */
  .visa-form-grid {
    grid-template-columns: 1fr;
  }

  /* 文书表单 */
  .doc-form-grid {
    grid-template-columns: 1fr;
  }

  /* 模态更紧凑 */
  .modal-content {
    padding: 20px 16px;
  }

  /* 通知面板 */
  #notifPanel {
    max-height: none;
  }

  /* 表情更小 */
  .emoji-grid, .comment-emoji-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
  }

  .emoji-cell, .comment-emoji-cell {
    font-size: 18px;
    width: 32px;
    height: 32px;
  }

  .comment-image {
    max-width: 120px;
    max-height: 120px;
  }

  /* 余额 */
  .balance-amount {
    font-size: 22px;
  }

  .recharge-btn {
    padding: 10px 14px;
    font-size: 13px;
  }

  /* 客服更小 */
  .cs-float {
    width: 48px;
    height: 48px;
    font-size: 20px;
    bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 12px);
    right: 12px;
  }

  .cs-chat {
    bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 68px);
  }

  /* 页脚 */
  footer {
    padding: 16px 12px;
    padding-bottom: calc(16px + var(--tab-bar-height) + var(--safe-bottom));
    font-size: 12px;
  }

  footer a {
    margin: 0 4px;
  }

  /* 页签更紧凑 */
  .auth-tabs button {
    padding: 10px 8px;
    font-size: 13px;
  }

  /* 代码组 */
  .code-group {
    flex-direction: column;
    gap: 8px;
  }

  .code-group button {
    width: 100%;
  }

  .school-container { padding: 56px 4px 12px; }
  .school-header h1 { font-size: 18px; }
  .college-detail-modal { padding: 12px; }
  .compare-btn-text { display: none; }
  .compare-btn { padding: 4px 8px; font-size: 12px; }

  .tools-container { padding: 56px 4px 12px; }
  .gpa-value { font-size: 30px; }
  .gpa-card { padding: 14px; }
  .table-container { max-height: 180px; }
  #coursesEditableTable{font-size:10px}
  #coursesEditableTable th,#coursesEditableTable td{padding:4px 2px}
  #coursesEditableTable input{padding:6px 4px!important;font-size:14px!important}
  .exchange-grid { grid-template-columns: 1fr; }
  .ocr-upload-area { min-height: 140px; }
  .scale-btn { padding: 8px 10px; font-size: 12px; }

  /* ── 底部导航标签文字缩小 ── */
  .mobile-bottom-nav .tab-item {
    font-size: 9px;
    min-width: 44px;
  }

  .mobile-bottom-nav .tab-item .tab-icon {
    font-size: 20px;
  }

  /* ── 统计卡片小屏单列 ── */
  .admin-layout .stats-grid,
  .stat-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* ============================================================
   小桌面/小平板 (769px - 1024px)
   ============================================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  .college-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .price-grid, .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .profile-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* 导航切换为汉堡菜单模式 */
  .hamburger {
    display: flex !important;
  }
  .nav-links {
    gap: 16px;
    font-size: 13px;
    display: none !important;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    flex-direction: column;
    padding: 8px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    z-index: 150;
    overflow-y: auto;
    max-height: calc(100vh - 56px);
  }
  .nav-links.mobile-open {
    display: flex !important;
  }
  .nav-links a {
    padding: 14px 24px;
    font-size: 15px;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .nav-links a:hover,
  .nav-links a.active {
    background: rgba(102, 126, 234, 0.08);
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================================
   暗色模式触摸反馈
   ============================================================ */
body.dark-mode button:active,
body.dark-mode a:active,
body.dark-mode .college-card:active {
  -webkit-tap-highlight-color: rgba(96, 165, 250, 0.15);
}

/* ============================================================
   Admin 后台专用移动端优化
   ============================================================ */
@media (max-width: 768px) {
  /* Sidebar → 侧边抽屉 */
  .admin-layout .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 280px !important;
    height: 100vh !important;
  }

  .admin-layout .sidebar.mobile-open {
    transform: translateX(0);
  }

  .admin-layout .sidebar .sidebar-brand {
    padding: 12px 16px;
    min-height: 48px;
    cursor: pointer;
  }

  .admin-layout .main-area {
    margin-left: 0 !important;
  }

  /* Admin 汉堡菜单按钮 */
  .admin-hamburger {
    display: flex !important;
  }

  /* 统计卡片横向滚动 */
  .admin-layout .stats-container {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
  }

  .admin-layout .stats-container::-webkit-scrollbar { display: none; }

  .admin-layout .stats-container > * {
    min-width: 140px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  /* 欢迎条 */
  .admin-layout .welcome-bar {
    padding: 16px;
    border-radius: 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .admin-layout .welcome-bar .wb-right {
    text-align: left;
  }

  .admin-layout .welcome-bar .wb-time {
    font-size: 20px;
  }

  /* 表格 → 卡片视图 */
  .admin-layout .el-table {
    display: block;
    overflow-x: auto;
  }

  .admin-layout .el-table__header-wrapper,
  .admin-layout .el-table__body-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 弹窗全屏 */
  .admin-layout .el-dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    border-radius: 0 !important;
    height: 100vh;
    max-height: 100vh;
  }

  .admin-layout .el-dialog__body {
    padding: 16px !important;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
  }

  /* 快捷操作网格 */
  .admin-layout .quick-actions .qa-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .admin-layout .quick-actions .qa-btn {
    padding: 10px 12px;
    font-size: 13px;
    border-radius: 10px;
  }

  /* 顶部栏 */
  .admin-layout .top-bar {
    padding: 0 12px;
    height: 48px;
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .admin-layout .top-bar h2 {
    font-size: 15px;
  }

  /* 面包屑隐藏 */
  .admin-layout .breadcrumb-bar {
    display: none;
  }

  /* 内容区域 */
  .admin-layout .content-area {
    padding: 12px 8px;
    padding-bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 16px);
  }

  /* 图表全宽 */
  .admin-layout .chart-card {
    width: 100%;
    margin-bottom: 12px;
  }

  .admin-layout .el-row {
    flex-direction: column;
  }

  .admin-layout .el-row .el-col {
    max-width: 100% !important;
    flex: 0 0 100% !important;
    margin-bottom: 8px;
  }

  /* 统计标签栏 */
  .admin-layout .tab-stats {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .admin-layout .tab-stats::-webkit-scrollbar { display: none; }

  .admin-layout .tab-stats .ts-item {
    min-width: 90px;
    flex-shrink: 0;
  }

  /* 筛选栏 */
  .admin-layout .filter-bar {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .admin-layout .filter-bar::-webkit-scrollbar { display: none; }

  .admin-layout .filter-bar .el-select {
    min-width: 100px;
    flex-shrink: 0;
  }

  /* 页面头部 */
  .admin-layout .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
  }

  .admin-layout .page-header > div:last-child {
    width: 100%;
  }

  .admin-layout .page-header .el-input {
    flex: 1;
  }

  .admin-layout .page-header > div:last-child {
    display: flex;
    gap: 6px;
    width: 100%;
  }

  /* 订单流程 */
  .admin-layout .order-flow {
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
  }

  /* 订阅套餐卡片 */
  .admin-layout .plan-card {
    margin-bottom: 12px;
  }

  /* 权限角色卡片 */
  .admin-layout .role-card .rc-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* Toast 位置调整（避免被底部导航遮挡） */
  .error-toast, .success-toast {
    bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 16px);
    top: auto;
  }

  /* 通知面板 */
  .notification-panel {
    width: 100% !important;
    right: 0 !important;
    border-radius: 0 !important;
    max-height: 60vh !important;
  }
}

/* ============================================================
   Admin 480px 超小屏
   ============================================================ */
@media (max-width: 480px) {
  .admin-layout .stats-container > * {
    min-width: 120px;
  }

  .admin-layout .quick-actions .qa-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  .admin-layout .quick-actions .qa-btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  .admin-layout .top-bar h2 {
    font-size: 14px;
  }

  .admin-layout .content-area {
    padding: 10px 6px;
  }

  /* 用户详情弹窗网格单列 */
  .admin-layout .user-detail-dialog .info-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   触摸设备仅显示悬浮提示 (tooltip on touch)
   ============================================================ */
@media (hover: none) {
  [data-tooltip] {
    position: relative;
  }

  [data-tooltip]:active::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 999;
    pointer-events: none;
    animation: tooltipIn 0.15s ease;
  }

  @keyframes tooltipIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
  }
}

/* ============================================================
   Swipe-to-dismiss 动画 (通知/提示条)
   ============================================================ */
.swipe-dismiss {
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.swipe-dismiss.swiped {
  transform: translateX(100%);
  opacity: 0;
}

/* ============================================================
   Element Plus 移动端增强 (Admin)
   ============================================================ */
@media (max-width: 768px) {
  .el-message-box {
    width: 90vw !important;
    max-width: 380px !important;
  }

  .el-message {
    min-width: auto !important;
    max-width: 90vw !important;
  }

  .el-select-dropdown {
    max-width: 80vw !important;
  }

  .el-dropdown-menu {
    max-width: 80vw !important;
  }

  /* Tab 横向滚动 */
  .el-tabs__nav-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .el-tabs__nav-wrap::-webkit-scrollbar {
    display: none;
  }

  .el-tabs__nav {
    white-space: nowrap;
  }

  /* 分页器 */
  .el-pagination {
    flex-wrap: wrap;
    justify-content: center;
  }

  .el-pagination .el-pagination__sizes,
  .el-pagination .el-pagination__jump {
    display: none !important;
  }

  /* 开关 */
  .el-switch__label {
    display: none !important;
  }

  .el-switch.is-checked .el-switch__core {
    border-color: #4f6ef7;
    background-color: #4f6ef7;
  }
}

/* ============================================================
   手机端全局横溢修复
   ============================================================ */
@media (max-width: 768px) {
  /* 防止任何内容横溢 */
  body, main, .main-content, .container, .section, .content-wrapper,
  .forum-container, .visa-container, .tools-container, .document-container,
  .school-container, .gpa-container {
    overflow-x: hidden;
    max-width: 100vw;
    word-break: break-word;
  }

  /* 所有 flex/grid 容器限制宽度 */
  .grid-2, .grid-3, .grid-4, .features-grid, .stats-grid,
  .card-grid, .school-grid, .college-grid, .tool-grid,
  .price-grid, .plan-grid {
    max-width: 100%;
  }

  /* 内联代码和 pre 块换行 */
  pre, code, .code-block, .markdown-body pre {
    white-space: pre-wrap !important;
    word-break: break-all;
    max-width: 100%;
    overflow-x: auto;
  }

  /* 图片不超出 */
  img, video, iframe, canvas, svg {
    max-width: 100% !important;
    height: auto !important;
  }

  /* 固定宽度表格横滚 */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}

/* ============================================================
   论坛移动端深度优化 — 卡片化 + 滑动交互
   ============================================================ */
@media (max-width: 768px) {
  /* 帖子卡片触摸优化 */
  .thread-card {
    padding: 14px 16px;
    margin: 0 12px 8px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: transform 0.15s ease;
    position: relative;
  }

  .thread-card:active {
    transform: scale(0.98);
    background: rgba(0,0,0,0.02);
  }

  /* 帖子标题 */
  .thread-title {
    font-size: 15px;
    line-height: 1.5;
    font-weight: 600;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* 帖子元信息 */
  .thread-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .thread-meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
  }

  /* 帖子内容预览 */
  .thread-excerpt {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 6px 0;
  }

  /* 帖子图片网格 */
  .thread-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin: 8px 0;
  }

  .thread-images img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
  }

  /* 帖子操作栏 */
  .thread-actions {
    display: flex;
    justify-content: space-around;
    padding: 8px 0 0;
    border-top: 1px solid rgba(0,0,0,0.05);
    margin-top: 8px;
  }

  .thread-actions button,
  .thread-actions .action-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 40px;
    min-width: 40px;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-muted);
    background: none;
    border: none;
    border-radius: 20px;
    transition: background 0.15s;
  }

  .thread-actions button:active {
    background: rgba(0,0,0,0.05);
  }

  /* 评论输入框 */
  .comment-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-top: 1px solid rgba(0,0,0,0.06);
    position: sticky;
    bottom: var(--tab-bar-height);
    z-index: 10;
  }

  .comment-input input {
    flex: 1;
    height: 40px;
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.1);
    padding: 0 16px;
    font-size: 14px;
    background: rgba(0,0,0,0.03);
  }

  .comment-input button {
    height: 40px;
    min-width: 56px;
    border-radius: 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
  }
}

/* ============================================================
   服务页面表单移动端优化
   ============================================================ */
@media (max-width: 768px) {
  /* 表单组间距 */
  .form-group, .el-form-item {
    margin-bottom: 16px;
  }

  /* 输入框 */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="search"], input[type="number"], input[type="tel"],
  textarea, select, .el-input__inner, .el-textarea__inner {
    font-size: 16px !important;
    padding: 12px 16px !important;
    height: auto !important;
    min-height: 48px;
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  textarea, .el-textarea__inner {
    min-height: 100px;
    resize: vertical;
  }

  /* 选择器 */
  select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px !important;
  }

  /* 按钮 */
  button[type="submit"], .submit-btn, .primary-btn,
  .el-button--primary {
    width: 100% !important;
    height: 48px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    margin-top: 8px;
  }

  /* 标签切换 */
  .tab-nav, .el-tabs__nav {
    gap: 0;
  }

  .tab-item, .el-tabs__item {
    font-size: 14px;
    padding: 10px 16px;
    min-height: 44px;
  }
}

/* ============================================================
   模态框/弹窗移动端修复
   ============================================================ */
@media (max-width: 768px) {
  .modal-overlay, .el-overlay {
    align-items: flex-end !important;
  }

  .modal, .dialog, .modal-content, .el-dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 85vh;
    overflow-y: auto;
  }

  .modal-header, .el-dialog__header {
    padding: 16px 20px 12px;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
    border-bottom: 1px solid rgba(0,0,0,0.06);
  }

  .modal-body, .el-dialog__body {
    padding: 16px 20px;
  }

  .modal-footer, .el-dialog__footer {
    padding: 12px 20px 20px;
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
  }

  /* 关闭按钮 */
  .modal-close, .el-dialog__close {
    top: 12px;
    right: 16px;
    font-size: 24px;
  }
}

/* ============================================================
   下拉菜单 & 弹出层
   ============================================================ */
@media (max-width: 768px) {
  .dropdown-menu, .el-dropdown-menu, .el-select-dropdown {
    max-width: 90vw !important;
    border-radius: 12px !important;
  }

  .dropdown-item, .el-dropdown-menu__item {
    font-size: 15px;
    padding: 12px 20px;
    min-height: 48px;
  }

  /* Tooltip / Popover 移动端改为底部弹出 */
  .el-popover, .el-tooltip__popper {
    max-width: 90vw !important;
  }
}

/* ============================================================
   空状态 & 加载状态
   ============================================================ */
@media (max-width: 768px) {
  .empty-state, .el-empty {
    padding: 40px 20px;
  }

  .empty-state img, .el-empty__image {
    width: 120px;
    height: 120px;
  }

  .empty-state p, .el-empty__description {
    font-size: 14px;
    margin-top: 12px;
  }

  /* 骨架屏 */
  .skeleton-card {
    padding: 16px;
    margin: 0 12px 8px;
    border-radius: 12px;
    background: var(--bg-card);
  }

  .skeleton-line {
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.06) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 8px;
  }

  @keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }
}

/* ============================================================
   选校/工具卡片布局
   ============================================================ */
@media (max-width: 480px) {
  /* 双列转单列 */
  .grid-2, .tool-grid, .card-grid-2, .features-2col {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .grid-3, .features-grid, .price-grid, .plan-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* 学校卡片 */
  .school-card, .college-card {
    padding: 16px;
    border-radius: 12px;
  }

  .school-card .school-name, .college-card .college-name {
    font-size: 16px;
  }

  /* 工具卡片 */
  .tool-card, .feature-card {
    padding: 20px 16px;
    border-radius: 12px;
  }

  .tool-card .tool-icon {
    width: 48px;
    height: 48px;
  }
}

/* ============================================================
   用户主页/个人中心
   ============================================================ */
@media (max-width: 768px) {
  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px;
    gap: 12px;
  }

  .profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
  }

  .profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px 16px;
    text-align: center;
  }

  .profile-stat-value {
    font-size: 20px;
    font-weight: 700;
  }

  .profile-stat-label {
    font-size: 11px;
    color: var(--text-muted);
  }

  /* 设置页 */
  .settings-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px;
  }

  .settings-item-right {
    align-self: flex-end;
  }
}

/* ============================================================
   价格/套餐卡片
   ============================================================ */
@media (max-width: 768px) {
  .price-card, .plan-card {
    padding: 20px 16px;
    border-radius: 14px;
    margin: 0 8px;
  }

  .price-card .price-amount {
    font-size: 32px;
  }

  .price-card .price-period {
    font-size: 13px;
  }

  .price-card .feature-list li {
    font-size: 14px;
    padding: 6px 0;
  }

  /* 推荐标签 */
  .price-card.popular::before {
    content: "推荐";
    position: absolute;
    top: 10px;
    right: -8px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    padding: 3px 12px;
    border-radius: 0 4px 4px 0;
  }
}

/* ============================================================
   通知/Toast
   ============================================================ */
@media (max-width: 768px) {
  .el-message, .el-notification {
    min-width: auto !important;
    max-width: 90vw !important;
    margin: 0 auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
  }

  .toast, .snackbar {
    bottom: calc(var(--tab-bar-height) + 16px);
  }
}

/* ============================================================
   安全区域适配（刘海屏/底部指示条）
   ============================================================ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    body.has-bottom-nav {
      padding-bottom: calc(var(--tab-bar-height) + var(--safe-bottom));
    }

    .mobile-bottom-nav {
      padding-bottom: var(--safe-bottom);
    }

    .fixed-bottom-bar, .comment-input {
      bottom: calc(var(--tab-bar-height) + var(--safe-bottom));
    }
  }
}

/* ============================================================
   AI智能推荐结果 — 手机端卡片优化
   ============================================================ */
@media (max-width: 768px) {
  .recommend-results {
    padding: 0;
  }

  .recommend-card {
    padding: 16px 14px !important;
    border-radius: 14px !important;
    margin-bottom: 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    background: var(--bg-card);
    position: relative;
    overflow: hidden;
  }

  .recommend-card .name {
    font-size: 17px !important;
    line-height: 1.3;
    margin-bottom: 8px;
  }

  /* 排名标签行 — 横滚 */
  .recommend-card [style*="display:flex;flex-wrap:wrap;gap:4px"] {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    gap: 6px !important;
  }
  .recommend-card [style*="display:flex;flex-wrap:wrap;gap:4px"]::-webkit-scrollbar { display: none; }
  .recommend-card [style*="display:flex;flex-wrap:wrap;gap:4px"] > span {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 4px 10px !important;
    font-size: 12px !important;
  }

  /* 匹配度 & 录取率 */
  .recommend-card .match-score {
    font-size: 13px !important;
    padding: 4px 12px !important;
    margin: 8px 4px 8px 0;
    display: inline-block;
  }

  .recommend-card span[style*="margin-left:10px"] {
    margin-left: 6px !important;
    font-size: 13px !important;
  }

  /* 推荐理由 */
  .recommend-card .reason {
    font-size: 14px !important;
    line-height: 1.7 !important;
    margin-top: 10px !important;
    color: var(--text-primary);
  }

  /* 详情卡片（专业排名/研究/就业/策略/风险） */
  .recommend-card > div[style*="border-radius:6px"] {
    padding: 10px 12px !important;
    margin: 8px 0 !important;
    font-size: 13px !important;
    line-height: 1.7 !important;
    border-radius: 10px !important;
  }

  .recommend-card > div[style*="border-radius:6px"] strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
  }

  /* 操作按钮 */
  .recommend-card a[target="_blank"] {
    flex: 1;
    text-align: center;
    padding: 10px 16px !important;
    font-size: 14px !important;
    border-radius: 10px !important;
    min-height: 44px;
  }

  /* 顾问总结 */
  .recommend-results > div[style*="background:linear-gradient"] {
    padding: 18px 16px !important;
    border-radius: 14px !important;
    font-size: 14px !important;
    line-height: 1.8 !important;
  }

  .recommend-results > div[style*="background:linear-gradient"] strong {
    font-size: 16px !important;
  }

  /* 分类标题 */
  .recommend-category h4 {
    font-size: 16px !important;
    padding: 12px 0 8px;
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 1;
  }

  /* 扣费提示 */
  .recommend-results > div[style*="background:#d4edda"] {
    padding: 14px !important;
    border-radius: 12px !important;
    font-size: 14px !important;
  }
}

/* ============================================================
   AI智能推荐表单 — 手机端布局
   ============================================================ */
@media (max-width: 768px) {
  .smart-recommend-form {
    padding: 16px !important;
    margin-top: 8px !important;
    border-radius: 14px !important;
  }

  .smart-recommend-form h3 {
    font-size: 18px !important;
    margin-bottom: 4px;
  }

  .smart-recommend-form > p {
    font-size: 13px !important;
    margin-bottom: 0 !important;
    line-height: 1.5;
  }

  .form-section {
    margin-bottom: 14px !important;
    padding-bottom: 4px !important;
  }
  .form-section + .form-section {
    padding-top: 14px !important;
  }
  .form-section-title {
    font-size: 14px !important;
    margin-bottom: 12px !important;
  }

  .form-group label {
    font-size: 13px !important;
    margin-bottom: 6px !important;
    color: var(--text-secondary);
  }

  .form-group input,
  .form-group select {
    padding: 12px 14px !important;
    font-size: 16px !important;
    border-radius: 10px !important;
    border-color: #e0e0e0 !important;
    height: 48px;
    box-sizing: border-box;
  }

  .price-tag {
    font-size: 13px !important;
    padding: 3px 10px !important;
    border-radius: 6px !important;
  }
  
  /* GPA行 */
  .gpa-input-row {
    gap: 6px !important;
  }
  .gpa-input-row select:first-child {
    width: 70px !important;
    font-size: 14px !important;
    padding: 10px 8px !important;
  }
  .gpa-input-row input[type="number"] {
    min-width: 0;
    flex: 1;
    font-size: 16px !important;
  }

  /* 按钮 */
  .smart-recommend-form .search-btn {
    height: 50px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    margin-top: 4px;
  }

  /* 历史按钮 */
  .history-toggle {
    font-size: 14px !important;
    padding: 14px !important;
    border-radius: 12px !important;
  }

  /* 历史记录面板 */
  #recommendHistoryPanel {
    padding: 0 !important;
    margin-top: 12px !important;
  }
  #recommendHistoryPanel > div:first-child {
    padding: 8px 0 12px;
  }
  #recommendHistoryList > div {
    padding: 14px !important;
    margin-bottom: 8px !important;
    border-radius: 12px !important;
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }
  #recommendHistoryDetail {
    padding: 16px !important;
    margin-top: 12px !important;
    border-radius: 14px !important;
    background: var(--bg-card);
  }
  #recommendHistoryDetailContent {
    font-size: 13px !important;
    line-height: 1.7 !important;
  }
}

/* form-row 小屏竖排 */
@media (max-width: 600px) {
  .form-row {
    flex-direction: column !important;
    gap: 10px !important;
  }
  .form-row > * {
    width: 100% !important;
    max-width: 100% !important;
  }
  .smart-recommend-form .form-group {
    width: 100% !important;
  }
}

/* ============================================================
   私信页面 — 防误缩放
   ============================================================ */
@media (max-width: 768px) {
  /* 全局防双击缩放 + 禁止双指缩放 */
  #chatArea, #chatContent, #chatBody,
  .chat-input-wrap, .msg-bubble, .msg-row {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
  }

  /* 可滚动区域：允许垂直滚动，禁止双指缩放 */
  .chat-messages, .conv-list {
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
  }

  /* 输入框允许选择文字 */
  .chat-input, .chat-input-wrap input,
  #msgInput, textarea.chat-input {
    -webkit-user-select: text;
    user-select: text;
    touch-action: manipulation;
    font-size: 16px !important;
  }

  /* 会话列表 */
  .conv-item, .conv-item * {
    touch-action: manipulation;
  }

  /* 阻止 iOS 双击放大 — 通过私信页面容器检测 */
  #chatArea, #convList, .message-container {
    touch-action: manipulation;
  }

  /* 锁定私信页面为固定视口（不缩放、不回弹） */
  body.message-locked {
    position: fixed !important;
    top: 0; left: 0;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
  }

  /* 内部聊天区域自己滚动 */
  body.message-locked .conv-list,
  body.message-locked .chat-messages {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}
@media (max-width: 768px) {
  .msg-ctx-menu {
    min-width: 180px !important;
    max-width: 260px !important;
    width: auto !important;
    border-radius: 14px !important;
    padding: 6px 0 !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2) !important;
    font-size: 14px !important;
    overflow: hidden;
  }

  @keyframes ctxFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .msg-ctx-item {
    padding: 13px 18px !important;
    font-size: 14px !important;
    min-height: 48px;
    gap: 10px !important;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.1);
  }

  .msg-ctx-item:active {
    background: rgba(102, 126, 234, 0.06) !important;
    color: inherit !important;
  }

  .msg-ctx-sep {
    margin: 4px 16px !important;
  }

  /* 红色删除项 */
  .msg-ctx-item[style*="color:#e74c3c"] {
    color: #e74c3c !important;
  }
  .msg-ctx-item[style*="color:#e74c3c"]:active {
    background: rgba(231, 76, 60, 0.06) !important;
  }
}
