/* ===== CET-6 学习平台 主样式 ===== */
/* 响应式自适应布局 · 简约学习风 */

:root {
    --primary: #4A90D9;
    --primary-dark: #357ABD;
    --primary-light: #EBF3FC;
    --success: #52C41A;
    --warning: #FAAD14;
    --danger: #FF4D4F;
    --text: #2C3E50;
    --text-secondary: #7F8C8D;
    --text-light: #95A5A6;
    --bg: #F8F9FA;
    --bg-white: #FFFFFF;
    --border: #E8ECF1;
    --border-light: #F0F2F5;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --max-width: 1200px;
    --header-height: 3.5rem;
    --font-xl: clamp(1.5rem, 3vw, 2rem);
    --font-lg: clamp(1.1rem, 2vw, 1.25rem);
    --font-md: clamp(0.9rem, 1.5vw, 1rem);
    --font-sm: clamp(0.8rem, 1.2vw, 0.875rem);
    --font-xs: clamp(0.7rem, 1vw, 0.75rem);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: var(--font-md); }

/* ===== Header ===== */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.logo {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    padding: 0.25rem 0.5rem;
}

.nav {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.nav-link {
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-xs);
    font-size: var(--font-md);
    color: var(--text-secondary);
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link:hover { background: var(--primary-light); color: var(--primary); }
.nav-link.active { background: var(--primary); color: #fff; }

/* ===== Main Container ===== */
.main-container {
    flex: 1;
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

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

.page-title {
    font-size: var(--font-xl);
    margin-bottom: 1.5rem;
    color: var(--text);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-light);
}

/* ===== Hero (首页) ===== */
.hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
}

.hero h1 {
    font-size: var(--font-xl);
    color: var(--text);
    margin-bottom: 0.75rem;
}

.hero-sub {
    font-size: var(--font-lg);
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.hero-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
}

/* ===== Module Grid ===== */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.module-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.25s;
    border: 1px solid var(--border-light);
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.module-icon { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }

.module-card h3 {
    font-size: var(--font-lg);
    margin-bottom: 0.5rem;
    color: var(--text);
}

.module-card p {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== Stats Bar ===== */
.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.stat-item {
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    padding: 1rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    font-size: var(--font-sm);
    color: var(--text-secondary);
    flex: 1 1 10rem;
    max-width: 14rem;
}

.stat-val {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-xs);
    border: 1px solid transparent;
    font-size: var(--font-md);
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: var(--font-sm); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ===== Vocabulary Module ===== */
.vocab-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.vtab-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--bg-white);
    border-radius: var(--radius-xs);
    font-size: var(--font-sm);
    color: var(--text-secondary);
    transition: all 0.2s;
    flex: 0 1 auto;
}

.vtab-btn:hover { border-color: var(--primary); color: var(--primary); }
.vtab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.vtab-panel { display: none; }
.vtab-panel.active { display: block; animation: fadeIn 0.3s ease; }

/* Flashcard */
.flashcard-container {
    max-width: 32rem;
    margin: 0 auto;
    text-align: center;
}

.flashcard {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 3rem 2rem;
    margin-bottom: 1.5rem;
    min-height: 14rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.4s;
    border: 1px solid var(--border-light);
    position: relative;
}

.flashcard:hover { transform: scale(1.02); }
.flashcard.flipped { transform: rotateY(0); }

.fc-word {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.fc-phonetic {
    font-size: var(--font-md);
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.fc-speak {
    background: var(--primary-light);
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.5rem;
}

.fc-meaning {
    font-size: var(--font-lg);
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
}

.fc-example {
    font-size: var(--font-md);
    color: var(--text-secondary);
    font-style: italic;
}

.fc-controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.fc-progress {
    margin-top: 1rem;
    font-size: var(--font-sm);
    color: var(--text-light);
}

/* Dictation */
.dictation-area {
    max-width: 32rem;
    margin: 0 auto;
}

.dict-prompt {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
    text-align: center;
}

.dict-label { font-size: var(--font-sm); color: var(--text-secondary); display: block; margin-bottom: 0.5rem; }
.dict-chinese { font-size: 1.5rem; font-weight: 600; color: var(--text); display: block; margin-bottom: 0.25rem; }
.dict-phonetic { font-size: var(--font-sm); color: var(--text-light); }

.dict-input-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.dict-input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: var(--font-lg);
    outline: none;
    transition: border-color 0.2s;
}

.dict-input:focus { border-color: var(--primary); }

.dict-feedback {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-xs);
    margin-bottom: 1rem;
    font-size: var(--font-md);
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dict-feedback.correct { background: #F6FFED; color: var(--success); }
.dict-feedback.wrong { background: #FFF2F0; color: var(--danger); }

.dict-score {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    font-size: var(--font-md);
    color: var(--text-secondary);
}

.dict-score strong { color: var(--text); }

/* Review */
.review-info {
    max-width: 32rem;
    margin: 0 auto;
    text-align: center;
}

.review-stats {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin: 1.25rem 0;
    flex-wrap: wrap;
}

.rstat {
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow);
    font-size: var(--font-md);
}

.review-card {
    max-width: 32rem;
    margin: 1.5rem auto;
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.review-word {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.review-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.review-option {
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--bg-white);
    font-size: var(--font-md);
    cursor: pointer;
    transition: all 0.2s;
}

.review-option:hover { border-color: var(--primary); }
.review-option.correct { border-color: var(--success); background: #F6FFED; }
.review-option.wrong { border-color: var(--danger); background: #FFF2F0; }

/* Wordbook */
.wordbook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.wordbook-list {
    display: grid;
    gap: 0.75rem;
}

.wordbook-item {
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.wordbook-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* ===== Grammar Module ===== */
.grammar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    gap: 1.25rem;
}

.grammar-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-light);
}

.grammar-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.grammar-card h3 {
    font-size: var(--font-lg);
    margin-bottom: 0.5rem;
    color: var(--text);
}

.grammar-card .meta {
    font-size: var(--font-xs);
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.grammar-card p {
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

/* ===== Reading / Listening / Writing / Translation Lists ===== */
.content-list {
    display: grid;
    gap: 1rem;
}

.content-item {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-light);
}

.content-item:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.content-item h3 {
    font-size: var(--font-lg);
    margin-bottom: 0.35rem;
}

.content-item .meta {
    font-size: var(--font-xs);
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.content-item .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 1rem;
    font-size: var(--font-xs);
}

/* ===== Detail Page ===== */
.detail-back { margin-bottom: 1.5rem; }

.detail-content {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.detail-content h2 {
    font-size: var(--font-xl);
    margin-bottom: 0.75rem;
}

.detail-content .meta {
    font-size: var(--font-sm);
    color: var(--text-light);
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.detail-content .body {
    font-size: var(--font-md);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.passage-text {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    line-height: 2;
    margin-bottom: 1.5rem;
    font-size: var(--font-md);
}

.question-block {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.question-block .q-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.question-block .q-option {
    display: block;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.35rem;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background 0.2s;
}

.question-block .q-option:hover { background: var(--primary-light); }
.question-block .q-option.selected { background: var(--primary-light); border: 1px solid var(--primary); }

.timer-bar {
    background: var(--border-light);
    border-radius: 1rem;
    height: 0.5rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 1rem;
    transition: width 0.3s;
}

.timer-display {
    text-align: center;
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.answer-section {
    background: #F6FFED;
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin-top: 1rem;
}

.answer-section.wrong { background: #FFF2F0; }

.answer-section h4 { margin-bottom: 0.5rem; }

/* Writing & Translation */
.writing-content {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    line-height: 2;
    margin-bottom: 1.5rem;
    white-space: pre-wrap;
    font-size: var(--font-md);
}

.translation-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.translation-cn, .translation-en {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    line-height: 1.8;
}

@media (max-width: 767px) {
    .translation-pair { grid-template-columns: 1fr; }
}

.vocab-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.vocab-table th, .vocab-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: var(--font-sm);
}

.vocab-table th {
    background: var(--bg);
    font-weight: 600;
}

/* ===== Answer Buttons ===== */
.answer-btns {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* ===== Hidden ===== */
.hidden { display: none !important; }

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text-light);
    font-size: var(--font-xs);
    border-top: 1px solid var(--border-light);
    background: var(--bg-white);
}

/* ===== Responsive ===== */
@media (max-width: 767px) {
    :root { --header-height: 3rem; }

    .menu-toggle { display: block; }

    .nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-white);
        flex-direction: column;
        padding: 0.5rem 1rem;
        border-bottom: 2px solid var(--border);
        box-shadow: var(--shadow);
    }

    .nav.open { display: flex; }

    .nav-link { padding: 0.6rem 1rem; width: 100%; border-radius: var(--radius-xs); }

    .hero { padding: 2rem 0.75rem 1.25rem; }

    .module-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .module-card { padding: 1.25rem 1rem; }
    .module-icon { font-size: 2rem; }

    .flashcard { padding: 2rem 1.25rem; min-height: 12rem; }
    .fc-word { font-size: 1.5rem; }

    .vocab-tabs { justify-content: center; }

    .review-options { grid-template-columns: 1fr; }

    .grammar-grid { grid-template-columns: 1fr; }

    .main-container { padding: 1rem 0.75rem 2rem; }

    .stats-bar { flex-direction: column; align-items: center; }
    .stat-item { max-width: 100%; width: 100%; }
}

@media (min-width: 768px) {
    .module-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .module-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
