/* =========================================================
   m.php - 应用题训练首页
   时间: 2026-07-19
   设计: 响应式卡片 + 渐变 hero, 移动端优先
   ========================================================= */

/* === 全局重置 === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
                 "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(180deg, #f0f4ff 0%, #ffffff 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

/* === 页面容器 === */
.m-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px 40px;
}

/* === Hero 顶部 === */
.m-hero {
    text-align: center;
    padding: 48px 16px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 0 32px 32px;
    color: #fff;
    margin: 0 -16px 32px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.25);
}

.m-hero-icon {
    font-size: 56px;
    margin-bottom: 12px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

.m-hero-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.m-hero-subtitle {
    font-size: 15px;
    opacity: 0.95;
    margin-bottom: 16px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.m-hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

.m-tag {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* === 年级网格 === */
.m-section-title {
    font-size: 22px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
}

.m-section-title::before,
.m-section-title::after {
    content: "";
    display: inline-block;
    width: 32px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
    vertical-align: middle;
    margin: 0 12px;
}

.m-grade-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 32px;
}

/* === 卡片 === */
.m-grade-card {
    position: relative;
    border-radius: 18px;
    padding: 22px 16px 18px;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    overflow: hidden;
    cursor: pointer;
    min-height: 180px;
    text-decoration: none;
}

.m-grade-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.m-grade-card:hover,
.m-grade-card:focus {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
    outline: none;
}

.m-grade-card:hover::before,
.m-grade-card:focus::before {
    opacity: 1;
}

.m-grade-card:active {
    transform: translateY(-1px);
}

.m-grade-emoji {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    position: relative;
    z-index: 1;
}

.m-grade-name {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 6px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1;
}

.m-grade-desc {
    font-size: 13px;
    opacity: 0.95;
    line-height: 1.4;
    margin-bottom: 12px;
    min-height: 36px;
    position: relative;
    z-index: 1;
}

.m-grade-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s ease;
    position: relative;
    z-index: 1;
    white-space: nowrap;  /* 防止文字换行 (避免"开始练习"拆成两行) */
}

.m-arrow {
    transition: transform 0.2s ease;
    display: inline-block;
}

.m-grade-card:hover .m-arrow {
    transform: translateX(3px);
}

/* === 底部信息 === */
.m-info {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 8px;
    padding: 0 4px;
}

.m-info-item {
    background: #fff;
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.m-info-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.m-info-text {
    display: flex;
    flex-direction: column;
}

.m-info-text strong {
    font-size: 15px;
    color: #2c3e50;
    margin-bottom: 2px;
}

.m-info-text span {
    font-size: 13px;
    color: #7f8c8d;
}

/* ============================================
   响应式断点
   ============================================ */

/* 平板及以上: 3 列 */
@media (min-width: 600px) {
    .m-grade-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
    .m-hero {
        padding: 64px 24px 40px;
        margin: 0 -16px 40px;
    }
    .m-hero-title {
        font-size: 40px;
    }
    .m-hero-icon {
        font-size: 72px;
    }
    .m-info {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 桌面: 6 列 (一行展示) */
@media (min-width: 900px) {
    .m-grade-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 16px;
    }
    .m-grade-card {
        min-height: 200px;
        padding: 18px 12px 16px;
    }
    .m-grade-emoji {
        font-size: 42px;
    }
    .m-grade-name {
        font-size: 17px;
    }
    .m-grade-desc {
        font-size: 12px;
        min-height: 32px;
    }
    .m-hero {
        padding: 80px 24px 48px;
    }
    .m-hero-title {
        font-size: 48px;
    }
    .m-hero-subtitle {
        font-size: 17px;
    }
    /* 桌面 6 列时缩小按钮, 避免"开始练习"换行 */
    .m-grade-action {
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* 大屏: 内容更宽 */
@media (min-width: 1200px) {
    .m-page {
        max-width: 1200px;
    }
}

/* === 暗色模式适配 === */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(180deg, #1a1d2e 0%, #0f1117 100%);
        color: #e4e6eb;
    }
    .m-section-title {
        color: #e4e6eb;
    }
    .m-info-item {
        background: #1f2233;
        border-color: rgba(255, 255, 255, 0.06);
    }
    .m-info-text strong {
        color: #e4e6eb;
    }
    .m-info-text span {
        color: #95a0b3;
    }
}

/* === 减小动效 (可访问性) === */
@media (prefers-reduced-motion: reduce) {
    .m-hero-icon,
    .m-grade-card,
    .m-arrow {
        animation: none !important;
        transition: none !important;
    }
}
