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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.5;
    overflow-x: hidden;
}

/* 主容器 */
.app-container {
    max-width: 100%;
    min-height: 100vh;
    background-color: #fff;
    position: relative;
}

/* 头部样式 */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #4b6cb7, #182848);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.menu-btn:active {
    background-color: rgba(255, 255, 255, 0.2);
}

.app-title {
    font-size: 18px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
}

.mode-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.mode-switch:active {
    background-color: rgba(255, 255, 255, 0.25);
}

/* 模式下拉菜单 */
.mode-dropdown {
    position: absolute;
    top: 56px;
    right: 16px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 160px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.mode-dropdown.show {
    display: block;
    animation: slideDown 0.3s ease;
}

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

.mode-option {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.mode-option:active {
    background-color: #f5f7fa;
}

.mode-option.active {
    background-color: #e8edff;
    color: #4b6cb7;
}

.mode-option i {
    margin-right: 10px;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.wrong-count-badge {
    position: absolute;
    right: 16px;
    background-color: #ff3b30;
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* 主内容区域 */
.app-main {
    padding: 16px;
    padding-bottom: 80px;
}

/* 进度指示器 */
.progress-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background-color: #eaeaea;
    border-radius: 2px;
    margin-left: 12px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4b6cb7, #182848);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

/* 题目区域 */
.question-area {
    background-color: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #4b6cb7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.question-type {
    display: inline-block;
    background-color: #e8edff;
    color: #4b6cb7;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.question-text {
    font-size: 18px;
    line-height: 1.6;
    color: #2c3e50;
    margin-bottom: 15px;
}

.question-code {
    background-color: #f1f3f9;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 15px;
    line-height: 1.5;
    color: #d35400;
    overflow-x: auto;
}

/* 选项区域 */
.options-area {
    margin-bottom: 20px;
}

.option-item {
    background-color: white;
    border: 2px solid #eaeaea;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.option-item:active {
    transform: scale(0.98);
}

.option-item:hover {
    border-color: #4b6cb7;
}

.option-item.selected {
    background-color: #e8edff;
    border-color: #4b6cb7;
    box-shadow: 0 4px 12px rgba(75, 108, 183, 0.15);
}

.option-item.correct {
    background-color: #e7f7e9;
    border-color: #4cd964;
    color: #2e7d32;
}

.option-item.wrong {
    background-color: #ffeaea;
    border-color: #ff3b30;
    color: #c62828;
}

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background-color: #4b6cb7;
    color: white;
    border-radius: 50%;
    font-weight: 600;
    margin-right: 15px;
    flex-shrink: 0;
}

.option-item.correct .option-letter {
    background-color: #4cd964;
}

.option-item.wrong .option-letter {
    background-color: #ff3b30;
}

.option-text {
    flex: 1;
}

/* 填空题样式 */
.fill-input-container {
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #eaeaea;
}

.fill-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #eaeaea;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 15px;
    transition: border-color 0.2s;
}

.fill-input:focus {
    outline: none;
    border-color: #4b6cb7;
}

.submit-btn {
    background: linear-gradient(135deg, #4b6cb7, #182848);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    width: 100%;
}

.submit-btn:active {
    transform: scale(0.98);
}

/* 背题模式答案区域 */
.review-answer-area {
    background-color: #f0f7ff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #3498db;
    display: none;
}

.review-answer-area.show {
    display: block;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.answer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #2980b9;
    margin-bottom: 15px;
}

.answer-title i {
    font-size: 18px;
}

.answer-content {
    font-size: 16px;
    line-height: 1.6;
    color: #2c3e50;
}

.correct-answer {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #3498db;
}

/* 解析区域 */
.explanation-area {
    background-color: #f9fafc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #2ecc71;
    display: none;
}

.explanation-area.show {
    display: block;
    animation: fadeIn 0.5s;
}

.explanation-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #27ae60;
    margin-bottom: 15px;
}

.explanation-content {
    font-size: 16px;
    line-height: 1.6;
    color: #34495e;
}

/* 操作按钮区域 */
.action-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    min-width: 60px;
}

.action-btn:active {
    background-color: #f5f7fa;
}

.action-btn.collected {
    color: #ff9500;
}

.action-btn i {
    font-size: 20px;
    margin-bottom: 4px;
}

.question-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4b6cb7, #182848);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.nav-btn:active {
    transform: scale(0.95);
}

.nav-btn:disabled {
    background: #eaeaea;
    color: #999;
    cursor: not-allowed;
}

.question-counter {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    min-width: 60px;
    text-align: center;
}

/* 侧边菜单 */
.side-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background-color: white;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.side-menu.show {
    left: 0;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.menu-overlay.show {
    display: block;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #4b6cb7, #182848);
    color: white;
}

.menu-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.close-menu {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.menu-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background-color: #f8fafc;
    border-radius: 8px;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #4b6cb7;
}

.menu-section {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.menu-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.recent-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recent-question-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f7fa;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
}

.recent-question-item.answered {
    background-color: #e7f7e9;
    color: #2e7d32;
}

.recent-question-item.wrong {
    background-color: #ffeaea;
    color: #c62828;
}

.menu-btn-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 0;
    background: none;
    border: none;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

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

.menu-btn-item i {
    margin-right: 10px;
    width: 20px;
    color: #666;
}

.toggle-switch {
    width: 50px;
    height: 26px;
    background-color: #e0e0e0;
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
}

.toggle-switch.active {
    background-color: #4cd964;
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(24px);
}

/* 夜间模式 */
.night-mode {
    background-color: #1a1a2e;
    color: #e6e6e6;
}

.night-mode .app-header {
    background: linear-gradient(135deg, #2d4059, #1a1a2e);
}

.night-mode .app-main {
    background-color: #16213e;
}

.night-mode .question-area {
    background-color: #0f3460;
    border-left-color: #4b6cb7;
}

.night-mode .question-text,
.night-mode .explanation-content {
    color: #e6e6e6;
}

.night-mode .option-item {
    background-color: #0f3460;
    border-color: #2d4059;
    color: #e6e6e6;
}

.night-mode .fill-input-container {
    background-color: #0f3460;
}

.night-mode .fill-input {
    background-color: #1a1a2e;
    border-color: #2d4059;
    color: #e6e6e6;
}

.night-mode .action-buttons {
    background-color: #16213e;
    border-top: 1px solid #2d4059;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .app-main {
        padding: 12px;
        padding-bottom: 80px;
    }
    
    .question-text {
        font-size: 16px;
    }
    
    .option-item {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .action-btn {
        min-width: 50px;
        font-size: 11px;
    }
    
    .action-btn i {
        font-size: 18px;
    }
}

/* 触摸滑动效果 */
.swipe-left {
    animation: swipeLeft 0.3s ease;
}

.swipe-right {
    animation: swipeRight 0.3s ease;
}

@keyframes swipeLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes swipeRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}