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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* 页头样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* 页尾样式 */
.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    margin-top: auto;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
}

.footer p {
    font-size: 14px;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex: 1;
}

/* 选择拼音区 */
.pinyin-selection {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

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

.selection-header h2 {
    color: #333;
    font-size: 24px;
}

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

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

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

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

.btn-final {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-collapse {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-reset {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

/* 拼音网格 */
.pinyin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    transition: all 0.3s ease;
}

.pinyin-grid.collapsed {
    grid-template-columns: 1fr;
}

.pinyin-section {
    transition: all 0.3s ease;
}

.pinyin-section.collapsed {
    display: none;
}

.pinyin-section h3 {
    color: #555;
    margin-bottom: 15px;
    font-size: 18px;
}

.pinyin-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pinyin-item {
    padding: 12px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.pinyin-item.final {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.pinyin-item.selected {
    background: #e0e0e0;
    color: #666;
    cursor: not-allowed;
    transform: scale(0.95);
}

.pinyin-item:hover:not(.selected) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 已选拼音区 */
.selected-pinyin {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

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

.selected-header h2 {
    color: #333;
    font-size: 24px;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat {
    font-size: 16px;
    font-weight: 600;
    color: #555;
    background: #f0f0f0;
    padding: 8px 16px;
    border-radius: 20px;
}

.selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.selected-item {
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #667eea 0%, #f093fb 100%);
    color: white;
}

.selected-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    scale: 1.05;
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 1000;
}

.overlay.active {
    display: block;
}

/* 测验弹窗 */
.quiz-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    display: none;
    transition: all 0.3s ease;
    min-width: 400px;
}

.quiz-modal.active {
    display: block;
    transform: translate(-50%, -50%) scale(1);
}

.modal-content {
    text-align: center;
}

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

.modal-header h3 {
    color: #333;
    font-size: 20px;
}

.countdown {
    font-size: 18px;
    font-weight: 600;
    color: #ff6b6b;
    background: #f8f9fa;
    padding: 8px 16px;
    border-radius: 20px;
}

.pinyin-display {
    font-size: 60px;
    font-weight: bold;
    margin: 40px 0;
    color: #333;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-buttons {
    display: flex;
    justify-content: space-around;
    margin-top: 30px;
}

.btn-correct {
    background: #4CAF50;
    color: white;
    padding: 15px 40px;
    font-size: 18px;
}

.btn-wrong {
    background: #f44336;
    color: white;
    padding: 15px 40px;
    font-size: 18px;
}

/* 重置验证弹窗 */
.reset-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    display: none;
    transition: all 0.3s ease;
    min-width: 300px;
}

.reset-modal.active {
    display: block;
    transform: translate(-50%, -50%) scale(1);
}

.math-question {
    font-size: 24px;
    font-weight: 600;
    margin: 20px 0;
    color: #333;
}

#math-answer {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 18px;
    margin: 20px 0;
    text-align: center;
}

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

.error-message {
    color: #f44336;
    margin-top: 10px;
    font-size: 14px;
}

.btn-confirm {
    background: #4CAF50;
    color: white;
}

.btn-cancel {
    background: #9e9e9e;
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .pinyin-grid {
        grid-template-columns: 1fr;
    }

    .selection-header,
    .selected-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .header-buttons,
    .header-stats {
        width: 100%;
        justify-content: space-between;
    }

    .quiz-modal {
        min-width: 90%;
        padding: 30px;
    }

    .pinyin-display {
        font-size: 40px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

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

.pinyin-selection,
.selected-pinyin {
    animation: slideIn 0.5s ease-out;
}

.quiz-modal.active,
.reset-modal.active {
    animation: fadeIn 0.3s ease-out;
}