/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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;
    color: #333;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    background: #fff;
}

/* 页面切换 */
.page {
    display: none;
    padding: 20px;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* 头部 */
.header {
    text-align: center;
    padding: 20px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin: -20px -20px 20px -20px;
    padding: 30px 20px 20px;
    border-radius: 0 0 20px 20px;
    position: relative;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.subtitle {
    opacity: 0.9;
    font-size: 14px;
}

.back-btn {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}

.progress-info {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 15px;
    font-size: 14px;
    opacity: 0.9;
}

/* 年级选择 */
.grade-selector, .semester-selector {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.grade-selector h2, .semester-selector h2 {
    text-align: center;
    margin-bottom: 15px;
    color: #667eea;
    font-size: 18px;
}

.grade-buttons, .semester-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.grade-btn, .semester-btn {
    flex: 1;
    padding: 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.grade-btn:hover, .semester-btn:hover,
.grade-btn.selected, .semester-btn.selected {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* 统计预览 */
.stats-preview {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stats-preview h3 {
    text-align: center;
    margin-bottom: 15px;
    color: #667eea;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* 题目容器 */
.question-container {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.subject-tag {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 15px;
}

.question-text {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 20px;
    color: #333;
}

/* 选项 */
.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    background: white;
}

.option:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.option.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.option.correct {
    border-color: #4CAF50;
    background: #4CAF50;
    color: white;
}

.option.wrong {
    border-color: #f44336;
    background: #f44336;
    color: white;
}

/* 提交按钮 */
.submit-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s;
}

.submit-btn:hover {
    transform: translateY(-2px);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 反馈区域 */
.feedback {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
}

.feedback-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.feedback-text {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 15px;
}

.feedback-text.correct {
    color: #4CAF50;
}

.feedback-text.wrong {
    color: #f44336;
}

.explanation {
    background: #f8f9ff;
    padding: 15px;
    border-radius: 10px;
    text-align: left;
    margin-bottom: 20px;
    line-height: 1.6;
    border-left: 4px solid #667eea;
}

.next-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

/* 完成页面 */
.result-summary {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
    margin-bottom: 20px;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
}

.score-value {
    font-size: 36px;
    font-weight: bold;
}

.score-label {
    font-size: 12px;
    opacity: 0.9;
}

.result-details {
    margin-top: 20px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    font-size: 16px;
}

.result-row:last-child {
    border-bottom: none;
}

/* 各科表现 */
.subject-breakdown {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.subject-breakdown h3 {
    margin-bottom: 15px;
    color: #667eea;
}

.subject-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.subject-name {
    font-weight: bold;
}

.subject-score {
    color: #667eea;
    font-weight: bold;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-btn {
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s;
}

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

.action-btn {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.action-btn:hover {
    transform: translateY(-2px);
}

/* 错题本 */
.wrong-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 15px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn.active {
    background: #667eea;
    color: white;
}

.wrong-list {
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.wrong-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.wrong-item:last-child {
    border-bottom: none;
}

.wrong-subject {
    font-size: 12px;
    color: #667eea;
    font-weight: bold;
    margin-bottom: 8px;
}

.wrong-question {
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.5;
}

.wrong-answer {
    font-size: 13px;
    color: #666;
}

.wrong-answer span {
    font-weight: bold;
    color: #f44336;
}

.clear-btn {
    width: 100%;
    padding: 15px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
}

/* 历史记录 */
.history-list {
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.history-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:last-child {
    border-bottom: none;
}

.history-date {
    font-size: 14px;
    color: #666;
}

.history-score {
    font-weight: bold;
    color: #667eea;
    font-size: 18px;
}

/* 导航菜单 */
.nav-menu {
    display: flex;
    justify-content: space-around;
    background: white;
    padding: 10px 0;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    border-top: 1px solid #eee;
}

.nav-item {
    text-align: center;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    padding: 5px 15px;
}

.nav-item.active {
    color: #667eea;
}

.nav-icon {
    font-size: 20px;
    display: block;
    margin-bottom: 3px;
}

/* 快捷入口 */
.quick-access {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.quick-access h2 {
    text-align: center;
    margin-bottom: 15px;
    color: #667eea;
    font-size: 18px;
}

.quick-buttons {
    display: flex;
    gap: 15px;
}

.quick-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 15px;
    border: 2px solid #667eea;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.quick-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    transform: translateY(-3px);
}

.quick-btn:hover .quick-text {
    color: white;
}

.quick-btn:hover .quick-count {
    background: white;
    color: #667eea;
}

.quick-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.quick-text {
    font-size: 14px;
    color: #667eea;
    font-weight: bold;
    transition: color 0.3s;
}

.quick-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #f44336;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 20px;
    min-width: 24px;
    text-align: center;
}

.quick-count:empty,
.quick-count[data-count="0"] {
    display: none;
}

/* 响应式 */
@media (max-width: 480px) {
    .grade-btn, .semester-btn {
        padding: 15px 10px;
        font-size: 14px;
    }

    .question-text {
        font-size: 16px;
    }

    .header h1 {
        font-size: 20px;
    }
}

/* 预览选择器页面 */
.preview-selector {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.preview-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-form label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.preview-grade-btn, .preview-semester-btn, .preview-days-btn {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.preview-grade-btn.selected, .preview-semester-btn.selected, .preview-days-btn.active {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.preview-days-buttons {
    display: flex;
    gap: 10px;
}

/* 预览按钮 - 渐变漂亮样式 */
.preview-generate-btn {
    margin-top: 20px;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.preview-generate-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.preview-generate-btn .btn-icon {
    font-size: 20px;
}

.preview-generate-btn .btn-text {
    letter-spacing: 1px;
}

/* 预览结果页面 */
.preview-info {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.preview-days-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 20px;
}

.preview-day-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.preview-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.day-number {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
}

.day-date {
    font-size: 14px;
    color: #999;
}

.preview-subjects {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.preview-subject-tag {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.preview-subject-tag.语文 { background: #E8F4FD; color: #1976d2; }
.preview-subject-tag.数学 { background: #F3E5F5; color: #7b1fa2; }
.preview-subject-tag.英语 { background: #FCE4EC; color: #c2185b; }
.preview-subject-tag.科学 { background: #E8F5E9; color: #388e3c; }
.preview-subject-tag.社会 { background: #FFF3E0; color: #f57c00; }

.preview-questions-mini {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-question-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f8f9ff;
    border-radius: 8px;
    font-size: 13px;
}

.preview-question-mini .q-subject {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.preview-question-mini.语文 .q-subject { background: #E8F4FD; color: #1976d2; }
.preview-question-mini.数学 .q-subject { background: #F3E5F5; color: #7b1fa2; }
.preview-question-mini.英语 .q-subject { background: #FCE4EC; color: #c2185b; }
.preview-question-mini.科学 .q-subject { background: #E8F5E9; color: #388e3c; }
.preview-question-mini.社会 .q-subject { background: #FFF3E0; color: #f57c00; }

.preview-question-mini .q-text {
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.more-questions {
    text-align: center;
    padding: 10px;
    color: #999;
    font-size: 13px;
    background: #f8f9ff;
    border-radius: 8px;
    margin-top: 5px;
}