/* ===== 全局移动优先重置 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --primary-light: #a8d5ff;
    --secondary-color: #2ecc71;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --background: #f8f9fa;
    --card-background: #ffffff;
    --border-color: #e9ecef;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* 为底部导航留出空间 */
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
    color: var(--text-primary);
}

/* ===== 顶部 Header ===== */
.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.app-header .logo {
    display: flex;
    align-items: center;
    gap: 8px;
}
.app-header .logo i { color: white; font-size: 20px; }
.app-header .logo h1 { font-size: 17px; font-weight: 600; }
.app-header .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.streak-badge {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== 底部导航栏 ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-background);
    border-top: 1px solid var(--border-color);
    display: flex;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}
.nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 10px;
    gap: 3px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    border: none;
    background: none;
}
.nav-tab i { font-size: 18px; }
.nav-tab.active { color: var(--primary-color); }
.nav-tab.active i { color: var(--primary-color); }

/* ===== 主内容区 ===== */
main {
    flex: 1;
    padding: 12px;
    width: 100%;
    max-width: 100%;
}

/* ===== 内容页切换 ===== */
.page {
    display: none;
    animation: fadeUp 0.25s ease;
}
.page.active { display: block; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== 页面标题 ===== */
.page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideInLeft 0.3s ease;
}
.page-title i { 
    color: var(--primary-color); 
    animation: pulse 2s infinite;
}

@keyframes slideInLeft {
    from { 
        opacity: 0; 
        transform: translateX(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ===== 卡片 ===== */
.card {
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    overflow: hidden;
    transition: var(--transition);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.card:active {
    transform: translateY(-2px);
}
.card-header {
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.card-header h3 i { color: var(--primary-color); font-size: 14px; }
.card-body { padding: 14px 16px; }

/* ===== 统计网格 ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.stat-card {
    background: var(--card-background);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.stat-card i { font-size: 22px; margin-bottom: 6px; display: block; color: var(--primary-color); }
.stat-card .val { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-card .lbl { font-size: 11px; color: var(--text-secondary); margin-top: 3px; }

/* ===== 进度圆环 ===== */
.progress-ring-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 0;
}
.progress-ring-wrap svg { flex-shrink: 0; }
.ring-info .big { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.ring-info .sub { font-size: 13px; color: var(--text-secondary); }
.ring-detail { margin-top: 8px; }
.ring-detail p { font-size: 13px; color: var(--text-secondary); margin: 4px 0; }
.ring-detail p i { width: 16px; color: var(--primary-color); }

/* ===== 今日任务 ===== */
.task-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.task-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.task-meta span { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.task-meta i { color: var(--primary-color); }

/* ===== 进度条 ===== */
.progress-bar-wrap { margin: 10px 0; }
.progress-bar-bg { background: var(--border-color); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary-color), var(--secondary-color)); border-radius: 4px; transition: width 0.4s ease; }
.progress-bar-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
    min-height: 46px;
    position: relative;
    overflow: hidden;
}
.btn:active { 
    transform: scale(0.97); 
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.btn:hover {
    opacity: 0.95;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: var(--transition);
}
.btn:active::before {
    width: 200px;
    height: 200px;
}
.btn-primary   { background: var(--primary-color); color: white; }
.btn-success   { background: var(--secondary-color); color: white; }
.btn-warning   { background: #f39c12; color: white; }
.btn-secondary { background: var(--text-secondary); color: white; }
.btn-danger    { background: #e74c3c; color: white; }
.btn-outline   { background: transparent; color: var(--primary-color); border: 2px solid var(--primary-color); }
.btn-full { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row .btn { flex: 1; }

/* ===== 学习进度页 ===== */
.stage-block { margin-bottom: 14px; }
.stage-title {
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
    background: #eef2f7;
    padding: 10px 14px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.stage-title span { font-size: 12px; color: #3498db; font-weight: 500; }
.lecture-row {
    background: white;
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid #f5f5f5;
    gap: 10px;
}
.lecture-row:last-child { border-bottom: none; border-radius: 0 0 10px 10px; }
.lec-icon { width: 32px; height: 32px; border-radius: 50%; background: #f0f0f0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lec-icon.done { background: #e8f5e9; color: #27ae60; }
.lec-icon.ongoing { background: #fff3e0; color: #f39c12; }
.lec-icon.pending { color: #bbb; }
.lec-info { flex: 1; min-width: 0; }
.lec-title { font-size: 14px; font-weight: 500; color: #2c3e50; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lec-meta { font-size: 11px; color: #aaa; margin-top: 2px; }
.lec-actions { display: flex; gap: 6px; flex-shrink: 0; }
.lec-btn {
    width: 34px; height: 34px; border-radius: 8px; border: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.lec-btn-start { background: #e8f0fe; color: #2c3e50; }
.lec-btn-review { background: #fff3e0; color: #f39c12; }

/* ===== 今日学习页 ===== */
.timer-display {
    text-align: center;
    padding: 20px;
}
.timer-time { font-size: 42px; font-weight: 200; color: #2c3e50; letter-spacing: 2px; font-variant-numeric: tabular-nums; }
.timer-label { font-size: 12px; color: #aaa; margin-top: 4px; }
.study-section { margin-bottom: 14px; }
.study-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.objective-list { list-style: none; }
.objective-list li {
    padding: 8px 12px;
    background: #f8faff;
    border-left: 3px solid #3498db;
    border-radius: 0 6px 6px 0;
    margin-bottom: 6px;
    font-size: 14px;
    color: #333;
}
.teaching-box {
    background: #f8faff;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    color: #444;
    line-height: 1.7;
}
.notes-input {
    width: 100%;
    border: 2px solid #e8ecf0;
    border-radius: 10px;
    padding: 12px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    outline: none;
    transition: border-color 0.2s;
}
.notes-input:focus { border-color: #3498db; }

/* ===== 提问检验页 ===== */
.quiz-select-wrap {
    margin-bottom: 14px;
}
.quiz-select-wrap label {
    display: block;
    font-size: 13px;
    color: #888;
    margin-bottom: 6px;
    font-weight: 600;
}
select#lecture-selector, input[type="number"], input[type="text"], input[type="date"], input[type="time"] {
    width: 100%;
    padding: 13px 14px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: var(--card-background);
    color: var(--text-primary);
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

select#lecture-selector {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

select#lecture-selector:focus, input[type="number"]:focus, input[type="text"]:focus, input[type="date"]:focus, input[type="time"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-1px);
}

input[type="number"] {
    width: 60px;
    text-align: center;
}

.quiz-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #bbb;
}
.quiz-placeholder i { font-size: 48px; margin-bottom: 14px; display: block; }
.quiz-placeholder h3 { font-size: 17px; color: #888; margin-bottom: 8px; }
.quiz-placeholder p { font-size: 14px; }

.question-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.question-card.correct { border-left: 4px solid #27ae60; }
.question-card.incorrect { border-left: 4px solid #e74c3c; }

.q-meta { display: flex; justify-content: space-between; margin-bottom: 10px; }
.q-num { font-size: 12px; font-weight: 700; color: #3498db; }
.q-type { font-size: 11px; background: #f0f0f0; color: #666; padding: 2px 8px; border-radius: 10px; }

.q-text { font-size: 15px; font-weight: 600; color: #2c3e50; line-height: 1.5; margin-bottom: 12px; }

.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border: 2px solid #eee;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.option-item:active { background: #f8f9fa; }
.option-item input[type="radio"] { width: 18px; height: 18px; accent-color: #2c3e50; flex-shrink: 0; }
.option-item label { font-size: 14px; color: #333; cursor: pointer; flex: 1; }

.short-answer-input {
    width: 100%;
    border: 2px solid #e8ecf0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    outline: none;
}
.short-answer-input:focus { border-color: #3498db; }

.question-feedback {
    margin-top: 12px;
    background: #f8fff8;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    color: #444;
    border: 1px solid #e0f5e0;
}
.question-feedback .correct-answer { margin-bottom: 6px; color: #27ae60; }
.question-feedback .explanation { color: #555; }

.quiz-header {
    background: white;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.quiz-header h3 { font-size: 16px; font-weight: 700; color: #2c3e50; }
.quiz-info { font-size: 13px; color: #888; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

.quiz-score-banner {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    margin-top: 14px;
}
.quiz-score-banner .score-num { font-size: 42px; font-weight: 700; }
.quiz-score-banner .score-msg { font-size: 15px; margin-top: 4px; opacity: 0.9; }

/* ===== 设置页 ===== */
.settings-group {
    background: var(--card-background);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}
.settings-group-title {
    padding: 12px 16px 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    gap: 10px;
}
.setting-row:last-child { border-bottom: none; }
.setting-row label { font-size: 15px; color: var(--text-primary); font-weight: 500; white-space: nowrap; }
.setting-input {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    text-align: right;
    background: var(--background);
    outline: none;
    min-width: 0;
    flex: 1;
    max-width: 200px;
}
.setting-input:focus { border-color: var(--primary-color); background: var(--card-background); }
.toggle-wrap { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary-color); }

/* ===== Toast 提示 ===== */
.toast {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(52,152,219,0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
    max-width: 85vw;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== 徽章 ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.badge-pending { background: rgba(243,156,18,0.1); color: #f39c12; }
.badge-ongoing { background: rgba(52,152,219,0.1); color: var(--primary-color); }
.badge-done { background: rgba(46,204,113,0.1); color: var(--secondary-color); }

/* ===== 背诵记忆模块 ===== */

/* 主题项样式 */
.topic-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.topic-item h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
}

.topic-item p {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #666;
}

.topic-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.empty-state p {
    margin: 8px 0;
}

.empty-state .text-sm {
    font-size: 14px;
}

.empty-state .text-gray {
    color: #ccc;
}

/* 片段项样式 */
.segment-item {
    background: white;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.segment-item h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #333;
}

.segment-item p {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* ===== 每日功课模块 ===== */
.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px 15px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 24px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.date-display {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 5px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
    color: var(--text-secondary);
    display: block;
    text-align: right;
}

.task-list {
    margin-bottom: 30px;
}

.task-item {
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.task-item:active {
    transform: scale(0.98);
}

.task-info {
    flex: 1;
}

.task-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.task-meta {
    font-size: 14px;
    color: var(--text-secondary);
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    transition: all 0.2s ease;
}

.task-checkbox.checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

footer {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 10px;
}

footer button {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-import {
    background-color: var(--primary-color);
    color: white;
}

.btn-edit {
    background-color: #f39c12;
    color: white;
}

.btn-reset {
    background-color: var(--text-secondary);
    color: white;
}

footer button:hover {
    opacity: 0.9;
}

footer button:active {
    transform: scale(0.95);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-background);
    border-radius: 15px;
    padding: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--text-primary);
    text-align: center;
}

.modal-content p {
    margin-bottom: 20px;
    color: var(--text-secondary);
    text-align: center;
}

#importPreview {
    margin: 20px 0;
    padding: 15px;
    background-color: var(--background);
    border-radius: 8px;
    min-height: 100px;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    gap: 10px;
}

.btn-cancel, .btn-confirm {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel {
    background-color: var(--text-secondary);
    color: white;
}

.btn-confirm {
    background-color: var(--primary-color);
    color: white;
}

.btn-cancel:hover, .btn-confirm:hover {
    opacity: 0.9;
}

.btn-cancel:active, .btn-confirm:active {
    transform: scale(0.95);
}

/* 编辑模态框 */
.edit-modal {
    max-height: 90vh;
}

.edit-tasks {
    margin-bottom: 20px;
}

.edit-task-item {
    background-color: var(--background);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

/* 统计卡片样式 */
.stats-card {
    display: flex;
    justify-content: space-around;
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* ===== 背诵记忆模块样式 ===== */

/* 屏幕切换 */
.screen {
    display: none;
    height: 100%;
}

.screen.active {
    display: block;
}

/* 顶部栏 */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #1c1c1e;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    font-size: 17px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.topbar-back {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}

.topbar-action {
    background: none;
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
}

/* 内容区 */
.content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

/* FAB按钮 */
.fab {
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #007aff;
    color: #fff;
    border: none;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,122,255,0.3);
    cursor: pointer;
    z-index: 99;
}

/* 主题卡片 */
.topic-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
}

.topic-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.topic-info {
    flex: 1;
}

.topic-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.topic-meta {
    font-size: 13px;
    color: #8a8a8e;
    margin-bottom: 6px;
}

.topic-progress-bar {
    height: 4px;
    background: #e5e5ea;
    border-radius: 2px;
    overflow: hidden;
}

.topic-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.due-badge {
    font-size: 13px;
    font-weight: 600;
    color: #007aff;
}

/* 模式卡片 */
.mode-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.mode-card:active {
    transform: scale(0.98);
}

.mode-icon {
    font-size: 24px;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #f2f2f7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-info {
    flex: 1;
}

.mode-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.mode-desc {
    font-size: 13px;
    color: #8a8a8e;
}

.mode-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 8px;
}

/* 学习区域 */
.progress-wrap {
    padding: 12px 16px;
    background: #1c1c1e;
    color: #fff;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 8px;
}

.progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #007aff;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* 阅读模式 */
.read-content {
    padding: 20px;
    background: #fff;
    border-radius: 16px;
    margin-bottom: 20px;
}

.read-text {
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 20px;
}

/* 填空模式 */
.fill-content {
    padding: 20px;
    background: #fff;
    border-radius: 16px;
    margin-bottom: 20px;
}

.fill-text {
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 20px;
}

.fill-blank {
    width: 120px;
    padding: 4px 8px;
    border: 1px solid #007aff;
    border-radius: 4px;
    font-size: 16px;
    margin: 0 4px;
}

/* 默写模式 */
.hint-card {
    background: #f0f8ff;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.7;
    border-left: 3px solid #007aff;
}

.hint-label {
    font-size: 11px;
    font-weight: 600;
    color: #007aff;
    margin-bottom: 4px;
    letter-spacing: 0.04em;
}

.dictation-area {
    width: 100%;
    min-height: 130px;
    border: 1.5px solid #e0e0e5;
    border-radius: 14px;
    padding: 13px;
    font-size: 16px;
    line-height: 1.8;
    resize: none;
    background: #fff;
    margin-bottom: 10px;
    color: #1c1c1e;
}

.dictation-area:focus {
    border-color: #007aff;
}

.char-count {
    font-size: 12px;
    color: #8a8a8e;
    text-align: right;
    margin-top: -8px;
    margin-bottom: 10px;
}

/* 完成屏幕 */
.finish-hero {
    text-align: center;
    padding: 36px 20px 20px;
}

.finish-emoji {
    font-size: 68px;
    margin-bottom: 10px;
    display: block;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.4); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.finish-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.finish-sub {
    font-size: 14px;
    color: #8a8a8e;
}

.stat-row {
    display: flex;
    gap: 10px;
    margin: 16px 0;
}

.stat-item {
    flex: 1;
    background: #fff;
    border-radius: 16px;
    padding: 16px 8px;
    text-align: center;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #007aff;
}

.stat-label {
    font-size: 11px;
    color: #8a8a8e;
    margin-top: 2px;
}

/* 模态框 */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
    animation: overlayIn 0.2s ease;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-sheet {
    background: #fff;
    border-radius: 22px 22px 0 0;
    padding: 20px 16px 36px;
    width: 100%;
    max-width: 480px;
    animation: sheetUp 0.26s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes sheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 18px;
    text-align: center;
}

.modal-input {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid #e0e0e5;
    border-radius: 12px;
    font-size: 16px;
    margin-bottom: 14px;
    background: #fff;
    color: #1c1c1e;
}

.modal-input:focus {
    border-color: #007aff;
}

/* 底部安全区域 */
.bottom-safe {
    height: 80px;
    flex-shrink: 0;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #8a8a8e;
}

.empty-state .emoji {
    font-size: 48px;
    margin-bottom: 12px;
}

/* 导入区域 */
.import-textarea {
    width: 100%;
    min-height: 200px;
    border: 1.5px solid #e0e0e5;
    border-radius: 14px;
    padding: 14px;
    font-size: 15px;
    line-height: 1.7;
    resize: vertical;
    background: #fff;
    color: #1c1c1e;
}

.import-textarea:focus {
    border-color: #007aff;
}

/* 搜索栏 */
.search-bar-wrap {
    position: relative;
    margin-bottom: 12px;
}

.search-bar {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border-radius: 12px;
    border: 1.5px solid #e0e0e5;
    background: #fff;
    font-size: 14px;
    color: #1c1c1e;
}

.search-bar:focus {
    border-color: #007aff;
}

.search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #8a8a8e;
    font-size: 14px;
    pointer-events: none;
}

/* 入门提示 */
.onboard-tip {
    background: linear-gradient(135deg, #e8f4ff 0%, #f0f0ff 100%);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.onboard-tip .icon {
    font-size: 28px;
    flex-shrink: 0;
}

.onboard-tip-text {
    font-size: 14px;
    line-height: 1.6;
    color: #3a3a3c;
}

.onboard-tip-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 3px;
}

/* 今日概览 */
.today-overview {
    background: #007aff;
    color: #fff;
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 14px;
}

.today-overview-title {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.8;
    margin-bottom: 6px;
}

.today-overview-nums {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.today-overview-unit {
    font-size: 14px;
    opacity: 0.8;
}

.today-overview-sub {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 8px;
}

.today-overview-bar {
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    overflow: hidden;
}

.today-overview-fill {
    height: 100%;
    background: #fff;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* 按钮样式 */
.btn {
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: #007aff;
    color: #fff;
}

.btn-secondary {
    background: #f2f2f7;
    color: #007aff;
}

.btn-gray {
    background: #f2f2f7;
    color: #3a3a3c;
}

.btn-danger {
    background: #ff3b30;
    color: #fff;
}

.btn:active {
    transform: scale(0.96);
}

/* 背诵页面容器 */
#app-memory {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 片段列表容器 */
#segment-list-container {
    flex: 1;
    overflow-y: auto;
}

/* 学习内容区域 */
#study-content-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* 完成内容区域 */
#finish-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* 任务项动画效果 */
.task-item {
    transition: all 0.3s ease;
}

.task-item.completed {
    background: rgba(46, 204, 113, 0.1);
    border-left: 4px solid #2ecc71;
}

.task-checkbox {
    transition: all 0.3s ease;
}

.task-checkbox.checked {
    background: #2ecc71;
    color: white;
    transform: scale(1.1);
}

/* 图片预览样式 */
.image-preview-item {
    position: relative;
    display: inline-block;
    margin: 5px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.image-preview-item img {
    width: 100px;
    height: 100px;
    object-fit: cover;
}

.edit-task-item input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--card-background);
}

.edit-task-item input[type="number"] {
    width: 80px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--card-background);
}

.edit-task-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    gap: 5px;
}

.btn-up, .btn-down, .btn-delete {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-up, .btn-down {
    background-color: var(--primary-color);
    color: white;
}

.btn-delete {
    background-color: #e74c3c;
    color: white;
}

.btn-up:hover, .btn-down:hover, .btn-delete:hover {
    opacity: 0.9;
}

#addTaskBtn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s ease;
}

#addTaskBtn:hover {
    opacity: 0.9;
}

/* 功课详情模态框 */
.detail-modal {
    text-align: center;
}

.detail-content {
    margin: 20px 0;
    padding: 15px;
    background-color: var(--background);
    border-radius: 8px;
    min-height: 100px;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* 详情输入区域 */
.detail-input-section {
    margin: 20px 0;
    text-align: left;
}

.detail-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.detail-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--card-background);
    resize: vertical;
    font-family: inherit;
}

.detail-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

/* 图片上传区域 */
.image-upload-area {
    margin-top: 8px;
}

.image-upload-area input[type="file"] {
    display: none;
}

.image-upload-area .btn-sm {
    margin-bottom: 12px;
}

.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.image-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.image-preview-item:hover {
    transform: scale(1.05);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    color: #e74c3c;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-remove:hover {
    background: rgba(231, 76, 60, 0.9);
    color: white;
}

/* 完成次数输入 */
.detail-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-count-input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
    background: var(--card-background);
}

.detail-count-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.detail-count-label {
    font-size: 16px;
    color: var(--text-secondary);
}

/* 图片放大查看模态框 */
.image-modal {
    max-width: 90vw;
    max-height: 90vh;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.btn-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.btn-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.image-viewer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.image-viewer img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.no-images {
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
}

/* ===== 夜间模式 ===== */
@media (prefers-color-scheme: dark) {
    /* 色彩令牌 */
    :root {
        --bg-base:    #0d0d0f;   /* 最深背景 */
        --bg-card:    #1a1a1e;   /* 卡片背景 */
        --bg-raised:  #242428;   /* 稍亮卡片/输入框 */
        --bg-surface: #2c2c32;   /* 按钮/选中背景 */
        --sep:        rgba(255,255,255,.08); /* 分割线 */
        --text-pri:   #f0f0f5;   /* 主文字 */
        --text-sec:   #8e8e9a;   /* 次要文字 */
        --text-ter:   #56565e;   /* 第三级 */
        --accent:     #3d8eff;   /* 主色蓝（比 #007aff 稍亮，深背下更清晰） */
        --accent-dim: rgba(61,142,255,.15);
        --green:      #30d158;
        --red:        #ff453a;
        --orange:     #ff9f0a;
    }

    body { background: var(--bg-base); color: var(--text-pri); }
    .screen { background: var(--bg-base); }

    /* 顶栏 */
    .app-header {
        background: rgba(13,13,15,.92);
        border-color: var(--sep);
    }
    .app-header .logo h1 { color: var(--text-pri); }
    .topbar {
        background: rgba(13,13,15,.92);
        border-color: var(--sep);
    }
    .topbar-title { color: var(--text-pri); }
    .topbar-back { background: var(--bg-surface); color: var(--accent); }
    .topbar-action { background: var(--bg-surface); color: var(--text-pri); }
    .topbar-action.primary { background: var(--accent); color: #fff; }
    .topbar-action.danger  { background: var(--red);    color: #fff; }

    /* 卡片类 */
    .card, .topic-card, .segment-item, .mode-card,
    .study-segment-box, .read-segment-box,
    .rating-area, .stat-item, .stats-box, .similarity-card,
    .modal-sheet, .as-card, .as-cancel,
    .preview-item, .task-item, .edit-task-item, .detail-content, #importPreview {
        background: var(--bg-card); color: var(--text-pri);
    }

    /* 主题卡片进度条底色 */
    .topic-progress-bar { background: var(--bg-surface); }

    /* 提示卡 */
    .hint-card {
        background: rgba(61,142,255,.1);
        border-color: var(--accent);
    }
    .hint-label { color: var(--accent); }

    /* 按钮 */
    .btn-primary  { background: var(--accent); color: #fff; }
    .btn-secondary{ background: var(--bg-card); color: var(--accent); border-color: var(--accent); }
    .btn-gray     { background: var(--bg-surface); color: var(--text-pri); }
    .btn-danger   { background: rgba(255,69,58,.12); color: var(--red); }
    .btn-green    { background: var(--green); color: #fff; }
    .btn-outline  { background: transparent; color: var(--accent); border-color: var(--accent); }

    /* FAB */
    .fab { background: var(--accent); box-shadow: 0 6px 20px rgba(61,142,255,.35); }

    /* 评分按钮 */
    .rating-btn        { background: var(--bg-raised); color: var(--text-pri); }
    .rating-btn.bad    { background: rgba(255,69,58,.15);  color: var(--red); }
    .rating-btn.ok     { background: rgba(255,159,10,.12); color: var(--orange); }
    .rating-btn.good   { background: rgba(48,209,88,.12);  color: var(--green); }

    /* 输入区 */
    .dictation-area    { background: var(--bg-raised); border-color: var(--bg-surface); color: var(--text-pri); }
    .dictation-area:focus { border-color: var(--accent); }
    .import-textarea   { background: var(--bg-raised); border-color: var(--bg-surface); color: var(--text-pri); }
    .import-textarea:focus { border-color: var(--accent); }
    .modal-input       { background: var(--bg-raised); border-color: var(--bg-surface); color: var(--text-pri); }
    .modal-input:focus { border-color: var(--accent); }
    .search-bar        { background: var(--bg-raised); border-color: var(--bg-surface); color: var(--text-pri); }
    .search-bar:focus  { border-color: var(--accent); }
    .setting-input     { background: var(--bg-raised); border-color: var(--bg-surface); color: var(--text-pri); }
    .setting-input:focus { border-color: var(--accent); background: var(--bg-card); }
    .notes-input       { background: var(--bg-raised); border-color: var(--bg-surface); color: var(--text-pri); }
    .notes-input:focus { border-color: var(--accent); }
    .short-answer-input { background: var(--bg-raised); border-color: var(--bg-surface); color: var(--text-pri); }
    .short-answer-input:focus { border-color: var(--accent); }

    /* 填空弹层 */
    .fill-input-popup  { background: var(--bg-card); }
    .fill-input-field  { background: var(--bg-raised); color: var(--text-pri); }
    .fill-nav-btn      { background: var(--bg-surface); color: var(--accent); }

    /* Action Sheet */
    .as-btn        { background: var(--bg-card); color: var(--accent); border-color: var(--sep); }
    .as-btn.danger { color: var(--red); }
    .as-title      { color: var(--text-sec); border-color: var(--sep); }
    .as-cancel     { background: var(--bg-card); color: var(--accent); }

    /* 片段选择 */
    .seg-select-item          { background: var(--bg-raised); color: var(--text-pri); }
    .seg-select-item.checked  { background: rgba(61,142,255,.18); }
    .seg-select-item .check-box { background: var(--bg-card); border-color: var(--bg-surface); }
    .seg-select-item.checked .check-box { background: var(--accent); border-color: var(--accent); }

    /* 填空高亮 */
    .blank-word           { background: var(--accent-dim); border-color: var(--accent); }
    .blank-word.filled    { color: var(--accent); }
    .blank-word.correct   { background: rgba(48,209,88,.12); border-color: var(--green); color: var(--green); }
    .blank-word.wrong     { background: rgba(255,69,58,.12); border-color: var(--red); color: var(--red); }
    .blank-word.revealed  { background: rgba(255,255,255,.06); border-color: var(--text-ter); color: var(--text-sec); }

    /* 进度 / 相似度条 */
    .progress-bar, .similarity-bar, .level-bar-outer, .progress-bar-bg { background: var(--bg-surface); }
    .progress-fill { background: var(--accent); }

    /* 文字颜色 */
    .seg-preview, .seg-sel-text, .task-name, .lec-title, .q-text, .setting-row label, .page-title, .card-header h3, h1 {
        color: var(--text-pri);
    }
    .seg-date, .topic-meta, .seg-index, .mode-desc,
    .history-date, .history-mode, .char-count,
    .progress-label, .rating-title, .sim-label, .task-meta, .lec-meta, .progress-text, .date-display {
        color: var(--text-sec);
    }
    .section-header, .settings-group-title, .study-section-title, .quiz-select-wrap label {
        color: var(--text-ter);
    }
    .divider, .history-item, .result-row, .card-header, .setting-row, .lecture-row {
        border-color: var(--sep);
    }

    /* Badge */
    .badge-new    { background: rgba(61,142,255,.18); color: var(--accent); }
    .badge-review { background: rgba(255,159,10,.15); color: var(--orange); }
    .badge-master { background: rgba(48,209,88,.15);  color: var(--green); }
    .due-badge.done { background: var(--bg-surface); color: var(--text-sec); }

    /* 相似度 diff */
    .diff-correct { background: rgba(48,209,88,.2);  color: #86efac; }
    .diff-wrong   { background: rgba(255,69,58,.2);  color: #fca5a5; }
    .diff-missing { background: rgba(255,159,10,.18); color: #fcd34d; }

    /* 统计数字 */
    .stats-box .val, .stat-value, .sim-pct, .ring-info .big, .timer-time {
        color: var(--accent);
    }

    /* Streak 热力图 */
    .streak-dot.inactive { background: var(--bg-surface); color: var(--text-ter); }
    .streak-dot.active   { background: var(--accent); color: #fff; }
    .streak-dot.today    { background: var(--orange); color: #fff; }

    /* 滑动删除 */
    .seg-swipe-del { background: var(--red); }

    /* 入门提示 */
    .onboard-tip      { background: linear-gradient(135deg, rgba(61,142,255,.15) 0%, rgba(61,80,180,.15) 100%); }
    .onboard-tip-text { color: var(--text-pri); }

    /* 今日概览 */
    .today-overview { background: linear-gradient(135deg, #1e2d4a 0%, #16213a 100%); }
    .today-overview-bar { background: rgba(255,255,255,.15); }
    .today-overview-fill { background: var(--accent); }

    /* 今日计划卡片（夜间深蓝替换亮蓝） */
    .today-plan-card {
        background: linear-gradient(135deg, #1e2d4a 0%, #16213a 100%) !important;
        border: 1px solid rgba(61,142,255,.25) !important;
    }

    /* 模式推荐角标 */
    .mode-badge     { background: rgba(255,159,10,.18); color: var(--orange); }
    .mode-badge.rec { background: rgba(61,142,255,.18); color: var(--accent); }
    
    /* 底部导航 */
    .bottom-nav {
        background: var(--bg-card);
        border-top-color: var(--sep);
    }
    .nav-tab { color: var(--text-sec); }
    .nav-tab.active { color: var(--text-pri); }
    .nav-tab.active i { color: var(--accent); }
}

/* iPhone 16 Pro Max 适配 */
@media (min-width: 428px) and (max-width: 430px) {
    /* 针对iPhone 16 Pro Max的特殊样式 */
    body {
        font-size: 17px;
    }
    
    .app-header {
        padding: calc(16px + env(safe-area-inset-top)) 20px 16px;
    }
    
    .app-header .logo h1 {
        font-size: 19px;
    }
    
    main {
        padding: 16px;
    }
    
    .page-title {
        font-size: 20px;
        margin-bottom: 16px;
    }
    
    .card {
        margin-bottom: 16px;
        padding: 18px;
    }
    
    .card-header {
        padding: 16px 18px 14px;
    }
    
    .card-header h3 {
        font-size: 16px;
    }
    
    .card-body {
        padding: 16px 18px;
    }
    
    .stats-row {
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-card .val {
        font-size: 24px;
    }
    
    .task-name {
        font-size: 17px;
    }
    
    .task-meta {
        font-size: 15px;
    }
    
    .btn {
        padding: 14px 24px;
        font-size: 16px;
    }
    
    .bottom-nav {
        height: 70px;
    }
    
    .nav-tab {
        padding: 10px 4px;
    }
    
    .nav-tab i {
        font-size: 20px;
    }
    
    .nav-tab span {
        font-size: 13px;
    }
    
    /* 功课模块适配 */
    .container {
        padding: 24px 20px;
    }
    
    h1 {
        font-size: 26px;
    }
    
    .task-item {
        padding: 18px;
    }
    
    .detail-textarea {
        min-height: 140px;
        font-size: 16px;
    }
    
    /* 背诵模块适配 */
    .content {
        padding: 20px;
    }
    
    .mode-card {
        padding: 20px 18px;
    }
    
    .segment-item {
        padding: 16px;
    }
    
    /* 模态框适配 */
    .modal-content {
        padding: 24px;
        width: 92%;
    }
    
    .modal-input {
        padding: 14px 16px;
        font-size: 16px;
    }
    
    /* 确保触摸目标足够大 */
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    input {
        min-height: 44px;
    }
    
    /* 进度圆环适配 */
    .progress-ring-wrap {
        gap: 24px;
    }
    
    .ring-info .big {
        font-size: 32px;
    }
    
    /* 学习区域适配 */
    .study-segment-box {
        padding: 24px;
        font-size: 18px;
    }
    
    .read-segment-box {
        padding: 26px 24px;
        font-size: 19px;
    }
    
    /* 统计数据适配 */
    .stat-value {
        font-size: 28px;
    }
    
    /* 提示信息适配 */
    .toast {
        padding: 14px 28px;
        font-size: 15px;
    }
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .container {
        padding: 15px 10px;
    }
    
    h1 {
        font-size: 22px;
    }
    
    .task-item {
        padding: 12px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .task-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    footer {
        flex-direction: column;
        gap: 10px;
    }
    
    footer button {
        width: 100%;
    }
}

/* ===== 补充缺失样式 ===== */

/* 小按钮 */
.btn-sm {
    padding: 7px 12px;
    font-size: 13px;
    min-height: 34px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.btn-sm:active { transform: scale(0.95); }

/* badge 补充变体 */
.badge-completed  { background: rgba(46,204,113,0.12);  color: #27ae60; }
.badge-in-progress { background: rgba(52,152,219,0.12); color: #3498db; }
.badge-pending    { background: rgba(243,156,18,0.12);  color: #f39c12; }

/* 学习要点列表 */
.points-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}
.points-list li {
    padding: 8px 12px 8px 16px;
    margin-bottom: 6px;
    background: #f8faff;
    border-left: 3px solid #3498db;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    color: #444;
    line-height: 1.5;
}

/* progress-section / progress-item 补充 */
.progress-section { }
.progress-item { margin-bottom: 14px; }
.progress-item > span { font-size: 14px; color: #555; display: block; margin-bottom: 6px; }

/* 背诵练习弹窗过渡动画 */
.memory-modal { animation: none; }
.memory-modal .modal-content {
    animation: slideUp 0.25s cubic-bezier(0.16,1,0.3,1);
}
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* 功课页 task.completed 增强 */
.task-item.completed .task-name { color: #27ae60; }
.task-item.completed .task-meta { color: #a8d5b5; }

/* 编辑弹窗操作行 */
.edit-task-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.edit-task-actions button {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 14px;
    color: #555;
}
.edit-task-actions .btn-delete {
    background: #fff0f0;
    border-color: #f5c6c6;
    color: #e74c3c;
}
.edit-task-actions button:active { transform: scale(0.95); }
