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

:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --accent-color: #fd79a8;
    --success-color: #00b894;
    --error-color: #e74c3c;
    --bg-color: #0f0f23;
    --bg-secondary: #1a1a2e;
    --text-color: #ffffff;
    --text-muted: #9ca3af;
    --card-bg: rgba(255, 255, 255, 0.05);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    max-width: 900px;
    width: 100%;
    text-align: center;
}

/* ==================== 开屏动画 ==================== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: splashFadeOut 0.5s ease-in-out 3.5s forwards;
}

@keyframes splashFadeOut {
    to {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}

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

/* 键盘动画 */
.keyboard-animation {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.key {
    width: 60px;
    height: 60px;
    background: linear-gradient(145deg, #2d2d44, #1a1a2e);
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
    animation: keyPress 0.6s ease-in-out infinite;
}

.key.k1 { animation-delay: 0s; }
.key.k2 { animation-delay: 0.15s; }
.key.k3 { animation-delay: 0.3s; }
.key.k4 { animation-delay: 0.45s; }

@keyframes keyPress {
    0%, 100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
    }
    50% {
        transform: translateY(-10px) scale(1.1);
        box-shadow: 0 15px 30px rgba(108, 92, 231, 0.5);
        background: linear-gradient(145deg, var(--primary-color), var(--secondary-color));
        color: white;
    }
}

/* 标题动画 */
.splash-title {
    font-size: 4rem;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.splash-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(50px) rotateX(90deg);
    animation: letterReveal 0.5s ease-out forwards;
    animation-delay: var(--delay);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes letterReveal {
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

.splash-subtitle {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 40px;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 1.2s forwards;
}

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

/* 加载条 */
.loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
    animation: loadProgress 3s ease-in-out forwards;
}

@keyframes loadProgress {
    0% { width: 0; }
    100% { width: 100%; }
}

/* ==================== 语言选择页面 ==================== */
#language-select h2 {
    font-size: 2.5rem;
    margin-bottom: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.language-buttons {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.lang-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 40px 60px;
    background: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-color);
    font-size: 1.2rem;
}

.lang-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(108, 92, 231, 0.3);
}

.lang-btn .flag {
    font-size: 4rem;
}

/* ==================== 设置页面 ==================== */
#setup-page h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.setup-intro {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.time-options {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.time-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 35px;
    background: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-color);
}

.time-btn:hover {
    border-color: var(--secondary-color);
    transform: translateY(-3px);
}

.time-btn.selected {
    border-color: var(--primary-color);
    background: rgba(108, 92, 231, 0.2);
    box-shadow: 0 5px 20px rgba(108, 92, 231, 0.3);
}

.time-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.time-unit {
    font-size: 1rem;
    color: var(--text-muted);
}

.start-btn {
    padding: 18px 60px;
    font-size: 1.3rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border: none;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(108, 92, 231, 0.4);
}

/* ==================== 打字测试页面 ==================== */
.typing-container {
    max-width: 1000px;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 50px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 15px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.text-display {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    font-size: 1.4rem;
    line-height: 2;
    text-align: left;
    margin-bottom: 20px;
    min-height: 200px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.text-display .char {
    transition: all 0.1s ease;
}

.text-display .char.correct {
    color: var(--success-color);
}

.text-display .char.incorrect {
    color: var(--error-color);
    text-decoration: underline;
}

.text-display .char.current {
    background: var(--primary-color);
    color: white;
    padding: 2px 0;
    border-radius: 3px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.input-area {
    width: 100%;
    padding: 20px;
    font-size: 1.2rem;
    background: var(--bg-secondary);
    border: 2px solid var(--primary-color);
    border-radius: 15px;
    color: var(--text-color);
    resize: none;
    height: 100px;
    outline: none;
    transition: all 0.3s ease;
}

.input-area:focus {
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.3);
}

.keyboard-hint {
    margin-top: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==================== 结果页面 ==================== */
.result-container {
    max-width: 700px;
}

.result-header {
    margin-bottom: 40px;
}

.trophy-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.result-header h2 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.result-stat {
    background: var(--card-bg);
    padding: 25px 15px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.result-stat.main-stat {
    grid-column: span 4;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(253, 121, 168, 0.2));
    border-color: var(--primary-color);
}

.result-stat.main-stat .result-value {
    font-size: 4rem;
}

.result-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.result-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* 称号区域 */
.rank-section {
    margin-bottom: 40px;
    padding: 30px;
    background: var(--card-bg);
    border-radius: 20px;
    border: 2px solid var(--primary-color);
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    padding: 15px 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 50px;
    margin-bottom: 20px;
}

.rank-icon {
    font-size: 2rem;
}

.rank-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.rank-description {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* 改进建议 */
.improvement-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 40px;
    text-align: left;
}

.improvement-section h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.improvement-content {
    color: var(--text-muted);
    line-height: 1.8;
}

.improvement-content ul {
    list-style: none;
}

.improvement-content li {
    padding: 10px 0;
    padding-left: 30px;
    position: relative;
}

.improvement-content li::before {
    content: "💡";
    position: absolute;
    left: 0;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 15px 40px;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
}

.action-btn.primary:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(108, 92, 231, 0.4);
}

.action-btn.secondary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.action-btn.secondary:hover {
    background: rgba(108, 92, 231, 0.1);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .splash-title {
        font-size: 2.5rem;
    }
    
    .key {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .language-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .lang-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .time-options {
        flex-direction: column;
        align-items: center;
    }
    
    .time-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .result-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .result-stat.main-stat {
        grid-column: span 2;
    }
    
    .stats-bar {
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .text-display {
        font-size: 1.1rem;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .splash-title {
        font-size: 2rem;
    }
    
    .result-stat.main-stat .result-value {
        font-size: 3rem;
    }
}
