/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* 移除所有按钮和可点击元素的蓝色高亮 */
button, .btn, .tab-btn, .card, .switch {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    outline: none !important;
}

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;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* 统计信息样式 */
.stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 模式切换容器样式 */
.mode-switch-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

/* 模式切换开关样式 */
.mode-switch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.switch-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* 卡片容器 */
.card-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    perspective: 1000px;
}

/* 卡片样式 */
.card {
    width: 100%;
    max-width: 600px;
    height: 600px;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.card:hover {
    transform: translateY(-5px);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px;
}

.card-front {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid rgba(102, 126, 234, 0.2);
}

/* 已掌握题目的绿色渐变背景 */
.card-front.known {
    background: linear-gradient(135deg, #a8e6cf 0%, #88d8a3 100%);
    border: 2px solid rgba(76, 175, 80, 0.3);
    color: #2e7d32;
}

.card-front.known .question-text {
    color: #1b5e20;
}

.card-front.known .question-number {
    color: #2e7d32;
}

.card-front.known .option {
    color: #2e7d32;
}

/* 需复习题目的橙色渐变背景 */
.card-front.review {
    background: linear-gradient(135deg, #ffcc80 0%, #ffb74d 100%);
    border: 2px solid rgba(255, 152, 0, 0.3);
    color: #e65100;
}

.card-front.review .question-text {
    color: #bf360c;
}

.card-front.review .question-number {
    color: #e65100;
}

.card-front.review .option {
    color: #e65100;
}

.card-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
    margin-right: -5px;
}

/* 隐藏滚动条但保持滚动功能 */
.card-content::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.card-content::-webkit-scrollbar-thumb {
    background: transparent;
}

/* Firefox */
.card-content {
    scrollbar-width: none;
}

/* IE and Edge */
.card-content {
    -ms-overflow-style: none;
}

/* 移动端响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .card {
        height: 600px;
        max-width: 100%;
    }
    
    .card-front, .card-back {
        padding: 20px;
    }
    
    .question-number {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
    
    .question-text {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 15px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .option {
        font-size: 0.9rem;
        padding: 8px 12px;
        margin-bottom: 8px;
        line-height: 1.4;
    }
    
    .stats {
        gap: 15px;
        padding: 10px;
        margin-top: 15px;
        margin-bottom: 15px;
    }
    
    .stat-number {
        font-size: 1.3rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .controls {
        margin-bottom: 15px;
    }
    
    .btn {
        padding: 10px 18px;
        font-size: 0.85rem;
    }
    
    .filter-tabs {
        gap: 6px;
        margin-bottom: 12px;
    }
    
    .tab-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .header {
        margin-bottom: 20px;
    }
    
    .header h1 {
        font-size: 1.5rem;
        margin-bottom: 6px;
    }
    
    .subtitle {
        font-size: 0.8rem;
    }
    
    .card {
        height: 650px;
    }
    
    .card-front, .card-back {
        padding: 15px;
    }
    
    .question-number {
        font-size: 0.8rem;
        margin-bottom: 12px;
    }
    
    .question-text {
        font-size: 0.9rem;
        line-height: 1.4;
        margin-bottom: 12px;
    }
    
    .option {
        font-size: 0.8rem;
        padding: 6px 10px;
        margin-bottom: 6px;
        line-height: 1.3;
    }
    
    .card-hint {
        font-size: 0.7rem;
        margin-top: 10px;
    }
    
    .stats {
        gap: 10px;
        flex-wrap: wrap;
        padding: 8px;
    }
    
    .stat-item {
        min-width: 70px;
    }
    
    .stat-number {
        font-size: 1.1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 0.8rem;
    }
    
    .filter-tabs {
        flex-wrap: wrap;
        gap: 4px;
        margin-bottom: 10px;
    }
    
    .tab-btn {
        padding: 5px 8px;
        font-size: 0.7rem;
    }
    
    .mode-switch-container {
        margin-bottom: 15px;
    }
    
    .switch-label {
        font-size: 0.7rem;
    }
}

.card-back {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    transform: rotateY(180deg);
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.question-number {
    font-size: 1.1rem; /* 减小字体大小 */
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px; /* 减小底部边距 */
}

.question-text {
    font-size: 1.1rem; /* 减小字体大小 */
    font-weight: 500;
    margin-bottom: 15px; /* 减小底部边距 */
    line-height: 1.4; /* 减小行高 */
    color: #212529;
    word-wrap: break-word;
    overflow-y: auto;
    max-height: 100px; /* 适当增加最大高度 */
    padding: 5px; /* 添加内边距 */
    text-align: justify; /* 两端对齐 */
    text-align-last: left; /* 最后一行居左对齐 */
}

.options {
    width: 100%;
    text-align: left;
}

.option {
    margin: 8px 0; /* 减小上下边距 */
    padding: 8px 15px; /* 减小内边距 */
    background: #f8f9fa;
    border-radius: 8px; /* 减小圆角 */
    border-left: 3px solid #667eea; /* 减小左边框宽度 */
    font-size: 0.9rem; /* 减小字体大小 */
    line-height: 1.3; /* 减小行高 */
}

.answer-label {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    opacity: 0.9;
}

.answer-text {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.explanation {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.5;
}

.card-hint {
    font-size: 0.9rem;
    opacity: 0.7;
    font-style: italic;
}

/* 控制按钮 */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
    gap: 20px;
}

.control-center {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

/* 筛选标签 */
.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.3);
}

.tab-btn:hover {
    background: rgba(255,255,255,0.3);
}

.tab-btn.active {
    background: white;
    color: #667eea;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .card {
        height: 600px;
    }
    
    .card-front, .card-back {
        padding: 20px;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .control-center {
        order: -1;
        width: 100%;
        justify-content: center;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .filter-tabs {
        gap: 8px;
    }
    
    .tab-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .card {
        height: 600px;
    }
    
    .card-front, .card-back {
        padding: 15px;
    }
    
    .question-text {
        font-size: 1rem;
    }
    
    .option {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .stats {
        margin-bottom: 20px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease;
}

/* 加载状态 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: white;
    font-size: 1.2rem;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    margin-left: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}