/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.5;
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* 头部样式 */
.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    font-weight: 700;
}

.header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 面板样式 */
.menu-panel, .quiz-panel, .result-panel, .review-panel, .wrongbook-panel, .stats-panel, .favorites-panel {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    padding: 30px;
    overflow: hidden;
}

.hidden {
    display: none;
}

/* 区块样式 */
.section {
    margin-bottom: 25px;
}

.section h2 {
    color: #333;
    font-size: 1.3rem;
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 4px solid #667eea;
    font-weight: 600;
}

/* 复选框组 */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 14px 16px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    min-height: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.checkbox-group label:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.checkbox-group label:active {
    transform: scale(0.98);
}

.checkbox-group input[type="checkbox"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    accent-color: #667eea;
    cursor: pointer;
}

/* 表单行 */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.form-group label {
    font-weight: 600;
    color: #495057;
    min-width: 80px;
}

.form-group select {
    flex: 1;
    min-width: 180px;
    min-height: 48px;
    padding: 14px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 按钮样式 */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 2px solid #e9ecef;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(17, 153, 142, 0.4);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.3);
}

.btn-mini {
    padding: 10px 20px;
    font-size: 0.875rem;
    min-height: 40px;
}

/* 进度条 */
.progress-bar {
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 测验头部 */
.quiz-header {
    margin-bottom: 25px;
}

.quiz-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.question-number {
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
    background: #f8f9fa;
    padding: 8px 16px;
    border-radius: 20px;
}

.timer {
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
    background: #f8f9fa;
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timer.warning {
    color: #dc3545;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* 问题卡片 */
.question-card {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.grammar-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.favorite-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 12px;
    border-radius: 50%;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.favorite-btn:hover {
    transform: scale(1.2);
    background: rgba(0,0,0,0.05);
}

.favorite-btn.active {
    color: #ffc107;
    animation: bounce 0.5s;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.question-content {
    font-size: 1.25rem;
    line-height: 1.7;
    color: #212529;
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

/* 选项 */
.options {
    display: grid;
    gap: 14px;
}

.option {
    display: flex;
    align-items: flex-start;
    padding: 18px 20px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 60px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.option:hover:not(.disabled) {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateX(4px);
}

.option:active:not(.disabled) {
    transform: scale(0.99);
}

.option.selected {
    border-color: #667eea;
    background: #e8eaf6;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.option.correct {
    border-color: #28a745;
    background: #d4edda;
}

.option.wrong {
    border-color: #dc3545;
    background: #f8d7da;
}

.option.disabled {
    pointer-events: none;
    opacity: 0.8;
}

.option-letter {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    margin-right: 16px;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.option.selected .option-letter {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.option.correct .option-letter {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.option.wrong .option-letter {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
}

.option-text {
    flex: 1;
    font-size: 1.05rem;
    color: #343a40;
    line-height: 1.5;
    padding-top: 5px;
}

/* 反馈区域 */
.feedback {
    margin-top: 20px;
    padding: 20px;
    border-radius: 12px;
    display: none;
    animation: fadeIn 0.3s ease;
}

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

.feedback.show {
    display: block;
}

.feedback.correct {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-left: 5px solid #28a745;
}

.feedback.wrong {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-left: 5px solid #dc3545;
}

.feedback-title {
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feedback-correct {
    margin-bottom: 12px;
    font-weight: 600;
    color: #155724;
}

.feedback-explanation {
    color: #495057;
    font-size: 1rem;
    line-height: 1.7;
}

/* 测验底部 */
.quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.quiz-footer .btn {
    min-width: 120px;
}

.quiz-footer .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.quiz-footer .btn:disabled:hover {
    box-shadow: none;
}

/* 结果面板 */
.result-header {
    text-align: center;
    margin-bottom: 30px;
}

.result-header h2 {
    font-size: 2rem;
    color: #212529;
    font-weight: 700;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    text-align: center;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 16px;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
}

.stat-value {
    display: block;
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-value.correct {
    color: #28a745;
}

.stat-value.wrong {
    color: #dc3545;
}

.stat-value.score {
    color: #667eea;
}

.stat-value.time {
    color: #ffc107;
}

.stat-label {
    color: #6c757d;
    font-size: 0.95rem;
    font-weight: 500;
}

.result-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* 复习面板 */
.review-header, .wrongbook-header, .stats-header, .favorites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.review-header h2, .wrongbook-header h2, .stats-header h2, .favorites-header h2 {
    color: #212529;
    font-weight: 700;
}

.review-list, .wrongbook-list, .favorites-list {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 10px;
}

.review-list::-webkit-scrollbar, 
.wrongbook-list::-webkit-scrollbar, 
.favorites-list::-webkit-scrollbar {
    width: 6px;
}

.review-list::-webkit-scrollbar-track,
.wrongbook-list::-webkit-scrollbar-track,
.favorites-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.review-list::-webkit-scrollbar-thumb,
.wrongbook-list::-webkit-scrollbar-thumb,
.favorites-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.review-item, .wrongbook-item, .favorites-item {
    background: #f8f9fa;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.review-item:hover, .wrongbook-item:hover, .favorites-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.review-item:last-child, .wrongbook-item:last-child, .favorites-item:last-child {
    margin-bottom: 0;
}

.review-item-header, .wrongbook-item-header, .favorites-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.review-item-question, .wrongbook-item-question, .favorites-item-question {
    font-size: 1.1rem;
    color: #212529;
    margin-bottom: 15px;
    line-height: 1.6;
}

.review-item-options {
    margin-bottom: 15px;
}

.review-item-option {
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 0.95rem;
}

.review-item-option:last-child {
    margin-bottom: 0;
}

.review-item-option.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.review-item-option.wrong {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.review-item-option.your-answer {
    border: 2px dashed #667eea;
}

.review-item-explanation {
    background: #e9ecef;
    padding: 16px;
    border-radius: 10px;
    color: #495057;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* 错题本统计 */
.wrongbook-stats, .favorites-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 18px;
    background: #f8f9fa;
    border-radius: 12px;
    flex-wrap: wrap;
    gap: 15px;
}

/* 统计面板 */
.stats-content {
    display: grid;
    gap: 25px;
}

.stats-overview h3, .stats-by-grammar h3 {
    color: #212529;
    margin-bottom: 15px;
    font-weight: 600;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.stat-box {
    text-align: center;
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    color: white;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.stat-num {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-desc {
    font-size: 0.95rem;
    opacity: 0.9;
}

.grammar-bars {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.grammar-bar-item {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.grammar-bar-label {
    width: 100px;
    font-weight: 600;
    color: #495057;
    flex-shrink: 0;
}

.grammar-bar-container {
    flex: 1;
    min-width: 150px;
    height: 28px;
    background: #e9ecef;
    border-radius: 14px;
    overflow: hidden;
}

.grammar-bar-fill {
    height: 100%;
    border-radius: 14px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    padding-left: 12px;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.grammar-bar-fill.high {
    background: linear-gradient(90deg, #11998e 0%, #38ef7d 100%);
}

.grammar-bar-fill.medium {
    background: linear-gradient(90deg, #ffc107 0%, #ff8f00 100%);
}

.grammar-bar-fill.low {
    background: linear-gradient(90deg, #dc3545 0%, #fd7e14 100%);
}

/* Toast提示 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    max-width: 90%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.toast.error {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
}

/* ============ 响应式设计 ============ */

/* 桌面端优化 (1024px以上) */
@media (min-width: 1024px) {
    .container {
        max-width: 950px;
    }
    
    .question-content {
        font-size: 1.3rem;
    }
}

/* 平板端 (768px - 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
    html {
        font-size: 15px;
    }
    
    body {
        padding: 15px;
    }
    
    .container {
        max-width: 720px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .menu-panel, .quiz-panel, .result-panel, .review-panel, .wrongbook-panel, .stats-panel, .favorites-panel {
        padding: 25px;
    }
    
    .btn {
        padding: 14px 28px;
        min-height: 46px;
    }
    
    .question-content {
        font-size: 1.15rem;
        padding: 18px;
    }
    
    .option {
        padding: 16px 18px;
        min-height: 56px;
    }
    
    .stat-item {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 2rem;
    }
}

/* 手机端 (最大767px) */
@media (max-width: 767px) {
    html {
        font-size: 14px;
    }
    
    body {
        padding: 8px;
        min-height: 100vh;
    }
    
    .container {
        max-width: 100%;
    }
    
    .header {
        margin-bottom: 20px;
    }
    
    .header h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .header .subtitle {
        font-size: 0.95rem;
    }
    
    .menu-panel, .quiz-panel, .result-panel, .review-panel, .wrongbook-panel, .stats-panel, .favorites-panel {
        padding: 16px;
        border-radius: 14px;
    }
    
    .section {
        margin-bottom: 20px;
    }
    
    .section h2 {
        font-size: 1.15rem;
        margin-bottom: 12px;
    }
    
    .checkbox-group {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .checkbox-group label {
        padding: 14px 16px;
        border-radius: 10px;
    }
    
    .checkbox-group input[type="checkbox"] {
        width: 22px;
        height: 22px;
        margin-right: 12px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-group label {
        font-size: 0.95rem;
        margin-bottom: 8px;
        min-width: auto;
    }
    
    .form-group select {
        min-width: 100%;
        padding: 14px 16px;
        font-size: 1rem;
    }
    
    .button-group {
        flex-direction: column;
        gap: 12px;
        margin-top: 20px;
    }
    
    .btn {
        width: 100%;
        padding: 16px 24px;
        font-size: 1rem;
        min-height: 50px;
        border-radius: 12px;
    }
    
    .btn-mini {
        padding: 12px 20px;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    .progress-bar {
        height: 8px;
        margin-bottom: 15px;
    }
    
    .quiz-info {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .question-number {
        font-size: 0.95rem;
        padding: 6px 12px;
        border-radius: 15px;
    }
    
    .timer {
        font-size: 0.95rem;
        padding: 6px 12px;
        border-radius: 15px;
    }
    
    .question-card {
        padding: 18px;
        margin-bottom: 20px;
        border-radius: 12px;
    }
    
    .question-header {
        margin-bottom: 15px;
    }
    
    .grammar-tag {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .favorite-btn {
        font-size: 1.5rem;
    }
    
    .question-content {
        font-size: 1.1rem;
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 10px;
        line-height: 1.6;
    }
    
    .options {
        gap: 10px;
    }
    
    .option {
        padding: 14px 16px;
        min-height: 52px;
        border-radius: 10px;
    }
    
    .option:hover:not(.disabled) {
        transform: none;
    }
    
    .option-letter {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        margin-right: 12px;
    }
    
    .option-text {
        font-size: 1rem;
        padding-top: 4px;
    }
    
    .feedback {
        padding: 15px;
        margin-top: 15px;
    }
    
    .feedback-title {
        font-size: 1rem;
    }
    
    .feedback-explanation {
        font-size: 0.95rem;
    }
    
    .quiz-footer {
        flex-direction: row;
        gap: 10px;
    }
    
    .quiz-footer .btn {
        flex: 1;
        min-width: auto;
        padding: 14px 20px;
    }
    
    .result-header h2 {
        font-size: 1.6rem;
    }
    
    .result-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .stat-item {
        padding: 18px 12px;
        border-radius: 12px;
    }
    
    .stat-value {
        font-size: 1.8rem;
    }
    
    .stat-label {
        font-size: 0.85rem;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .review-list, .wrongbook-list, .favorites-list {
        max-height: 45vh;
    }
    
    .review-item, .wrongbook-item, .favorites-item {
        padding: 16px;
        border-radius: 10px;
    }
    
    .review-item-question, .wrongbook-item-question, .favorites-item-question {
        font-size: 1rem;
    }
    
    .review-item-option {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .review-item-explanation {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .wrongbook-stats, .favorites-stats {
        padding: 14px;
        flex-direction: row;
    }
    
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-box {
        padding: 20px 12px;
        border-radius: 12px;
    }
    
    .stat-num {
        font-size: 2rem;
    }
    
    .grammar-bar-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .grammar-bar-label {
        width: auto;
        font-size: 0.9rem;
    }
    
    .grammar-bar-container {
        min-width: 100%;
    }
    
    .toast {
        padding: 14px 24px;
        font-size: 0.95rem;
        border-radius: 10px;
        bottom: 20px;
    }
}

/* 小屏手机优化 (最大480px) */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }
    
    body {
        padding: 6px;
    }
    
    .header h1 {
        font-size: 1.35rem;
    }
    
    .menu-panel, .quiz-panel, .result-panel, .review-panel, .wrongbook-panel, .stats-panel, .favorites-panel {
        padding: 12px;
    }
    
    .option {
        padding: 12px 14px;
        min-height: 48px;
    }
    
    .option-letter {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
        margin-right: 10px;
    }
    
    .question-content {
        font-size: 1rem;
        padding: 12px;
    }
    
    .result-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-item {
        padding: 14px 8px;
    }
    
    .stat-value {
        font-size: 1.6rem;
    }
    
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-box {
        padding: 16px 8px;
    }
    
    .stat-num {
        font-size: 1.8rem;
    }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
    body {
        padding: 6px;
    }
    
    .menu-panel, .quiz-panel, .result-panel, .review-panel, .wrongbook-panel, .stats-panel, .favorites-panel {
        padding: 12px;
    }
    
    .header {
        margin-bottom: 10px;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .question-card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .question-content {
        font-size: 1rem;
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .options {
        gap: 8px;
    }
    
    .option {
        padding: 12px 14px;
        min-height: 44px;
    }
    
    .result-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
}

/* 大屏幕平板优化 (1024px - 1366px) */
@media (min-width: 1024px) and (max-width: 1366px) {
    .container {
        max-width: 900px;
    }
    
    .question-content {
        font-size: 1.25rem;
    }
    
    .option {
        min-height: 64px;
    }
    
    .result-stats {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 超大屏幕优化 (1367px以上) */
@media (min-width: 1367px) {
    .container {
        max-width: 1000px;
    }
    
    html {
        font-size: 17px;
    }
    
    .question-content {
        font-size: 1.4rem;
        padding: 25px;
    }
    
    .option {
        min-height: 70px;
        padding: 20px 24px;
    }
    
    .option-text {
        font-size: 1.15rem;
    }
}

/* 折叠屏/宽屏手机优化 */
@media (min-width: 600px) and (max-width: 767px) and (orientation: landscape) {
    .container {
        max-width: 650px;
    }
    
    .options {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .option {
        min-height: 56px;
    }
    
    .result-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .option-letter {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
    }
    
    .btn-primary {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    }
}

/* 安全区域适配 (iPhone X及以上) */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
        padding-top: calc(env(safe-area-inset-top) + 20px);
        padding-bottom: calc(env(safe-area-inset-bottom) + 20px);
    }
    
    .toast {
        bottom: calc(env(safe-area-inset-bottom) + 20px);
    }
}