/**
 * 星雨童行 - 移动端优先增强样式
 * 遵循大厂移动端设计规范：
 * 1. 安全边距：左右16px（避免手指遮挡内容）
 * 2. 点击区域：最小44px（符合iOS人机指南）
 * 3. 字体大小：不小于16px（可访问性要求）
 * 4. Touch-action优化：禁用不必要的触摸行为
 */

/* ========== 移动端基础优化 ========== */
html {
    font-size: 16px; /* 移动端最小基础字号 */
    touch-action: manipulation; /* 禁用双击缩放，提升点击响应 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-size: 1rem; /* 16px */
    line-height: 1.65;
    -webkit-text-size-adjust: 100%; /* 禁用字体缩放 */
}

/* ========== 安全边距容器 ========== */
.safe-container {
    padding-left: 16px;
    padding-right: 16px;
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
}

/* ========== 大点击区域按钮 ========== */
.btn-touch {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* ========== 移动端表单优化 ========== */
input, textarea, select {
    font-size: 1rem;
    padding: 12px 14px;
    min-height: 44px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    width: 100%;
    box-sizing: border-box;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ========== 响应式图像 ========== */
img, video, iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========== 触摸友好的列表项 ========== */
.touch-list-item {
    padding: 14px 16px;
    min-height: 48px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s;
}

.touch-list-item:active {
    background: var(--primary-light);
}

/* ========== 滚动优化 ========== */
.scroll-smooth {
    -webkit-overflow-scrolling: touch; /* iOS弹性滚动 */
    overflow-scrolling: touch;
}

/* ========== 禁用文本选择（按钮等交互元素） ========== */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ========== 移动端隐藏元素 ========== */
.hide-mobile {
    display: none !important;
}

/* ========== 移动端表格适配 ========== */
.responsive-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.responsive-table table {
    width: 100%;
    min-width: 640px;
}

/* ========== 移动端间距优化 ========== */
.mb-xs { margin-bottom: 8px; }
.mb-sm { margin-bottom: 12px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.mb-xl { margin-bottom: 32px; }

.mt-xs { margin-top: 8px; }
.mt-sm { margin-top: 12px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mt-xl { margin-top: 32px; }

/* ========== 断点：平板 (≥640px) ========== */
@media (min-width: 640px) {
    html { font-size: 17px; }
    
    .hide-mobile {
        display: inherit !important;
    }
    
    .safe-container {
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* ========== 断点：平板/小桌面 (≥768px) ========== */
@media (min-width: 768px) {
    html { font-size: 18px; }
    
    .safe-container {
        padding-left: 24px;
        padding-right: 24px;
        max-width: 900px;
    }
}

/* ========== 断点：桌面 (≥1024px) ========== */
@media (min-width: 1024px) {
    html { font-size: 18px; } /* 保持18px不变，自闭症友好 */
    
    .safe-container {
        padding-left: 28px;
        padding-right: 28px;
        max-width: 1000px;
    }
}

/* ========== 断点：宽屏 (≥1200px) ========== */
@media (min-width: 1200px) {
    .safe-container {
        max-width: 1100px;
    }
}

/* ========== 横屏模式优化 ========== */
@media (orientation: landscape) {
    .hero {
        padding: 14px 16px;
    }
    
    .home-quick-nav .quick-links {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========== 超小屏幕优化 (≤320px) ========== */
@media (max-width: 320px) {
    .safe-container {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .hero h1 {
        font-size: 1.2rem;
    }
    
    .home-quick-nav .quick-links {
        grid-template-columns: 1fr;
    }
}

/* ========== 高对比度模式支持 ========== */
@media (prefers-contrast: high) {
    :root {
        --border: #000000;
        --text-muted: #000000;
    }
    
    .dark {
        --border: #ffffff;
        --text-muted: #ffffff;
    }
}

/* ========== 减少动画模式 ========== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
