/* 全局样式 - 解决颜色问题 */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /*background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*/
    background: linear-gradient(135deg, #2380dd, #e3c60e, #8824e6);
    color: #333; /* 修改为深色字体 */
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #ff8a00, #da1b60);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #da1b60, #ff8a00);
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.generator-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin: 25px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.generator-title {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 25px;
    color: #4a5568; /* 修改为深灰色 */
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 15px;
}

.generator-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.control-group {
    background: #f7fafc;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.control-label {
    display: block;
    margin-bottom: 10px;
    color: #2d3748; /* 深灰色 */
    font-weight: bold;
    font-size: 1rem;
}

.control-input, .control-select {
    width: 100%;
    padding: 12px 15px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    color: #2d3748; /* 深灰色 */
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.control-input:focus, .control-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.control-select option {
    background: white;
    color: #2d3748;
}

.font-style-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 15px;
    margin-bottom: 15px;
}

.font-style-radio {
    display: none;
}

.font-style-label {
    padding: 10px 20px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.font-style-radio:checked + .font-style-label {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.generator-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.generator-btn {
    padding: 14px 30px;
    background: linear-gradient(to right, #667eea, #764ba2);
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.generator-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.generator-btn.secondary {
    background: linear-gradient(to right, #edf2f7, #e2e8f0);
    color: #4a5568;
}

.generator-btn.secondary:hover {
    background: linear-gradient(to right, #e2e8f0, #cbd5e0);
}

.characters-display {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.generated-character {
    background: white;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.generated-character:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.char-display {
    font-size: 4rem;
    margin-bottom: 15px;
    color: #2d3748; /* 深色 */
    font-weight: bold;
}

.char-pinyin {
    font-size: 1.2rem;
    color: #667eea; /* 蓝色 */
    margin-bottom: 10px;
    font-weight: 500;
}

.char-info {
    font-size: 0.9rem;
    color: #718096; /* 中灰色 */
    display: flex;
    justify-content: space-between;
}

.experiment-types {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.experiment-btn {
    padding: 12px 25px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
}

.experiment-btn:hover {
    background: #f7fafc;
    border-color: #667eea;
}

.experiment-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.experiment-stage {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-top: 25px;
    min-height: 300px;
    border: 1px solid #e2e8f0;
}

.experiment-question {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 30px;
    color: #2d3748;
    font-weight: 600;
}

.experiment-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.experiment-option {
    padding: 20px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    color: #2d3748;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.experiment-option:hover {
    background: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

.experiment-option.correct {
    background: #48bb78;
    border-color: #48bb78;
    color: white;
}

.experiment-option.incorrect {
    background: #f56565;
    border-color: #f56565;
    color: white;
}

.statistics-container {
    margin-top: 40px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.stat-value {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 10px;
    font-weight: bold;
}

.stat-label {
    font-size: 1rem;
    color: #718096;
    font-weight: 500;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #718096;
}

.modal-character-text {
    font-size: 4rem;
    text-align: center;
    margin-bottom: 20px;
    color: #2d3748;
}

.modal-pinyin {
    font-size: 1.5rem;
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
}

.modal-character-info {
    color: #4a5568;
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-meaning {
    color: #2d3748;
    line-height: 1.6;
    margin-bottom: 20px;
}

.modal-more {
    color: #718096;
    line-height: 1.6;
}

/* 特殊字体样式 */
.font-seal {
    font-family: "SimSun", serif;
    color: #2d3748;
}

.font-traditional {
    font-family: "Microsoft JhengHei", "SimHei", sans-serif;
    color: #2d3748;
}

.font-cursive {
    font-family: "STKaiti", "KaiTi", serif;
    font-style: italic;
    color: #2d3748;
}

.font-regular {
    font-family: "SimHei", "Microsoft YaHei", sans-serif;
    color: #2d3748;
}

.font-clerical {
    font-family: "FangSong", "SimSun", serif;
    color: #2d3748;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #068df6 0%, #f44621 50%, #25d54d 100%);
    background-size: 200% 200%;
    color: white;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6),
    0 0 40px rgba(102, 126, 234, 0.4),
    0 0 60px rgba(102, 126, 234, 0.2),
    0 10px 25px rgba(0, 0, 0, 0.3);
    display: flex;
    animation: gradientShift 3s ease infinite;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.8),
    0 0 60px rgba(102, 126, 234, 0.6),
    0 0 90px rgba(102, 126, 234, 0.4),
    0 15px 35px rgba(0, 0, 0, 0.4);
    animation: gradientShift 3s ease infinite,
    pulse 1.5s ease infinite,
    borderGlow 2s ease infinite;
}

.back-to-top:active {
    transform: translateY(-2px) scale(1.05);
    transition: transform 0.1s ease;
}

/* 背景渐变动画 */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 脉冲动画 */
@keyframes pulse {
    0% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.6),
        0 0 40px rgba(102, 126, 234, 0.4),
        0 0 60px rgba(102, 126, 234, 0.2),
        0 10px 25px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.8),
        0 0 60px rgba(102, 126, 234, 0.6),
        0 0 90px rgba(102, 126, 234, 0.4),
        0 15px 35px rgba(0, 0, 0, 0.4);
    }
    100% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.6),
        0 0 40px rgba(102, 126, 234, 0.4),
        0 0 60px rgba(102, 126, 234, 0.2),
        0 10px 25px rgba(0, 0, 0, 0.3);
    }
}

/* 边框发光动画 */
@keyframes borderGlow {
    0%, 100% {
        border: 2px solid rgba(102, 126, 234, 0.8);
    }
    25% {
        border: 2px solid rgba(118, 75, 162, 0.8);
    }
    50% {
        border: 2px solid rgba(243, 88, 56, 0.8);
    }
    75% {
        border: 2px solid rgba(99, 102, 241, 0.8);
    }
}

/* 图标动画 */
.back-to-top i {
    transition: transform 0.3s ease;
}

.back-to-top:hover i {
    transform: translateY(-2px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .generator-controls {
        grid-template-columns: 1fr;
    }

    .characters-display {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .char-display {
        font-size: 3rem;
    }

    .experiment-options {
        grid-template-columns: 1fr;
    }

    .experiment-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .generator-btn {
        padding: 12px 25px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .back-to-top {
        width: 35px;
        height: 35px;
        bottom: 14px;
        right: 16px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .generator-container {
        padding: 20px;
    }

    .generator-actions {
        flex-direction: column;
    }

    .experiment-types {
        flex-direction: column;
    }

    .experiment-btn {
        width: 100%;
    }
}

/* 消息提示样式 */
.quiz-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.quiz-message.success {
    background: #48bb78;
}

.quiz-message.error {
    background: #f56565;
}

.quiz-message.info {
    background: #4299e1;
}

/* 问题项样式 */
.question-item {
    margin-bottom: 30px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.question-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

/* 加载动画 */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}