:root {
    --primary-color: #3b82f6;
    --secondary-color: #60a5fa;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --bg-opacity: 0.8;
    --glass-blur: 12px;
    --glass-border: 1px solid rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    
    /* 字体系列 */
    --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-serif: 'Noto Serif SC', Georgia, Cambria, 'Times New Roman', Times, serif;
    --font-mono: 'JetBrains Mono', 'Source Code Pro', Consolas, Monaco, 'Courier New', monospace;
}

/* 添加响应式基础设置 */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

/* 修改容器响应式样式 */
.typing-box {
    min-height: 200px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    overflow-x: visible;  /* 允许水平方向内容显示 */
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(var(--glass-blur));
    position: relative;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    @media (min-width: 640px) {
        min-height: 250px;
        max-height: calc(100vh - 350px);
    }
    @media (min-width: 768px) {
        min-height: 300px;
        max-height: calc(100vh - 400px);
    }
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    font-family: var(--font-mono);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
    .typing-box {
        min-height: 200px;
        max-height: calc(100vh - 300px);
    }
}

#current-line {
    min-height: 6rem;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#text-display {
    color: #333;
    letter-spacing: 2px;
    user-select: none;
    font-size: 0.875rem;
    line-height: 2;
    @media (min-width: 640px) {
        font-size: 1rem;
    }
    @media (min-width: 768px) {
        font-size: 1.125rem;
    }
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
    font-family: var(--font-mono);
}

#input-display {
    letter-spacing: 2px;
    min-height: 100px;
    font-size: 0.875rem;
    line-height: 2;
    @media (min-width: 640px) {
        font-size: 1rem;
    }
    @media (min-width: 768px) {
        font-size: 1.125rem;
    }
}

.typing-cursor {
    position: absolute;
    width: 2px;
    height: 1.5rem;
    background-color: var(--primary-color);
    animation: blink 1s infinite;
    display: none;
}

.typing-active .typing-cursor {
    display: block;
}

#input-cursor {
    position: absolute;
    width: 2px;
    height: 1.5rem;
    background-color: var(--primary-color);
    animation: blink 1s infinite;
    bottom: 4px;
    left: 4px;
    transition: left 0.1s ease;
}

@keyframes blink {
    50% { opacity: 0; }
}

.char {
    display: inline-block;
    position: relative;
    width: 1.2em;
    text-align: center;
    transition: all 0.2s ease;
    letter-spacing: 0;
    font-family: var(--font-mono);
    font-feature-settings: "calt" 1, "ss01" 1, "ss02" 1;  /* 启用等宽字体特性 */
}

.char.correct {
    color: #22c55e;
}

.char.wrong {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
}

.char.current {
    background-color: rgba(59, 130, 246, 0.1);
    border-radius: 2px;
}

/* 键盘显示样式 */
.key {
    min-width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    color: #1f2937;
    cursor: default;
    user-select: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-transform: lowercase; /* 确保显示小写字母 */
}

.key:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.key.active {
    background: var(--primary-color);
    border-color: transparent;
    color: white;
    transform: translateY(1px);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

/* 统计信息样式 */
.stat-item {
    background: rgba(59, 130, 246, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
}

.typing-text {
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    line-height: 1.8;
    letter-spacing: 1px;
}

.keyboard-key {
    transition: all 0.2s ease;
}

.keyboard-key.active {
    background-color: var(--primary-color);
    color: white;
    transform: scale(0.95);
}

#text-preview {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    line-height: 1.6;
}

#typing-text span {
    transition: all 0.2s ease;
}

#typing-text span.correct {
    color: var(--success-color);
}

#typing-text span.wrong {
    color: var(--error-color);
    background-color: rgba(239, 68, 68, 0.1);
}

#typing-text span.current {
    background-color: var(--primary-color);
    color: white;
    border-radius: 2px;
}

/* 输入框样式 */
#typing-input {
    position: fixed;
    top: -100px;
    left: -100px;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 添加滚动条样式 */
#typing-text::-webkit-scrollbar {
    width: 8px;
}

#typing-text::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#typing-text::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#typing-text::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

.typing-line {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    position: relative;
}

.typing-line.current {
    background-color: rgba(59, 130, 246, 0.05);
}

.typing-line .line-number {
    color: #999;
    font-size: 0.875rem;
    width: 2rem;
    text-align: right;
    margin-right: 1rem;
}

.typing-line .line-content {
    flex: 1;
}

.typing-line input {
    font-family: 'Courier New', monospace;
}

.typing-line.completed {
    opacity: 0.7;
}

#typing-container {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f1f1f1;
}

#typing-container::-webkit-scrollbar {
    width: 8px;
}

#typing-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#typing-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.input-error {
    animation: shake 0.2s ease-in-out 0s 2;
    border-color: var(--error-color) !important;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

.typing-active #cursor {
    display: block;
}

/* 添加输入框的遮罩层 */
.typing-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 1;
}

/* 添加打字动画效果 */
@keyframes typingPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.char.just-typed {
    animation: typingPulse 0.2s ease;
}

/* 打字行组样式 */
.typing-line-group {
    background: white;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    overflow: visible;    /* 移除溢出隐藏 */
}

@media (min-width: 768px) {
    .typing-line-group {
        padding: 1rem;
        margin-bottom: 1rem;
    }
}

/* 行样式 */
.typing-line {
    display: flex;
    align-items: center;
    position: relative;
    padding: 0.25rem 0;
}

.typing-line .line-number {
    color: #999;
    font-size: 0.75rem;
    width: 1.5rem;
    text-align: right;
    margin-right: 0.5rem;
}

@media (min-width: 768px) {
    .typing-line .line-number {
        font-size: 0.875rem;
        width: 2rem;
        margin-right: 1rem;
    }
}

/* 输入区域样式 */
.typing-line.input-line .line-content {
    position: relative;
    min-height: 2rem;
    padding: 0.25rem 0;
    letter-spacing: 0;
}

/* 输入字符容器 */
.typing-line.input-line .char-container {
    position: relative;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0;
}

/* 光标样式 */
.input-cursor {
    position: absolute;
    width: 2px;
    height: 1.5em;
    background-color: var(--primary-color);
    animation: blink 1s infinite;
    bottom: 0.25rem;
    left: calc(var(--cursor-position) * 1.2em);
}

/* 光标容器 */
.cursor-container {
    position: absolute;
    display: inline-block;
    width: 0;
    height: 100%;
}

/* 文章提示行样式 */
.typing-line .line-content {
    letter-spacing: 0;
}

/* 文章提示行字符样式 */
.typing-line .char {
    display: inline-block;
    position: relative;
    min-width: 1.1em;
    text-align: center;
    transition: color 0.2s ease;
}

/* 正确/错误指示样式 */
.typing-line .char.correct {
    color: #22c55e;
}

.typing-line .char.wrong {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
}

.typing-line .char.current {
    background-color: rgba(59, 130, 246, 0.1);
    border-radius: 2px;
}

/* 用户输入行字符样式 */
.typing-line.input-line .char {
    color: #666;
    min-width: 1.2em;
    text-align: center;
}

/* 输入提示线样式 */
.input-underline {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #e5e7eb;
}

/* 当前行组样式 */
.typing-line-group.current {
    background-color: #f8fafc;
    border-left: 4px solid var(--primary-color);
}

.typing-line-group.current .input-underline {
    background-color: var(--primary-color);
    height: 2px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .char {
        width: 1.1em;
    }
    
    .typing-line .line-number {
        width: 1.5rem;
    }
}

/* 文章行容器样式 */
.typing-line .line-content {
    white-space: nowrap;  /* 防止文本换行 */
    overflow: visible;    /* 移除溢出隐藏 */
    width: 100%;         /* 确保容器宽度 */
}

/* 输入行容器样式 */
.typing-line.input-line .line-content {
    position: relative;
    min-height: 2rem;
    padding: 0.25rem 0;
    white-space: nowrap;
    overflow: visible;    /* 移除溢出隐藏 */
}

/* 字符样式 */
.char {
    display: inline-block;
    width: 1.2em;
    text-align: center;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .char {
        width: 1.1em;
    }
    
    .typing-line .line-number {
        width: 1.5rem;
    }
}

/* 禁用状态的样式 */
.typing-line-group.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* 可访问行的样式 */
.typing-line-group:not(.disabled) {
    cursor: pointer;
}

/* 进度条样式 */
.progress-container {
    width: 100%;
    height: 8px;
    background: rgba(229, 231, 235, 0.5);
    border-radius: 9999px;
    overflow: hidden;
}

#progress-bar {
    background: linear-gradient(90deg, #1e40af 0%, #3b82f6 100%);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    height: 100%;
    width: 0;
    transition: width 0.3s ease;
}

/* 进度文本样式 */
#progress-text {
    min-width: 3rem;
    text-align: right;
}

/* 结果弹窗动画 */
#result-modal > div {
    transform: scale(0.95);
    transition: transform 0.2s ease-out;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

#result-modal > div.scale-100 {
    transform: scale(1);
}

/* 弹窗背景模糊效果 */
#result-modal {
    backdrop-filter: blur(4px);
}

/* 添加速度警告样式 */
.speed-warning {
    color: var(--error-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* 添加不及格提示样式 */
.result-warning {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* 结果消息样式 */
.result-message {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    text-align: center;
    padding: 0.75rem;
    border-radius: 0.5rem;
}

/* 成功消息样式 */
.result-message.success {
    color: #047857;
    background-color: #ecfdf5;
    border: 1px solid #10b981;
    animation: fadeInScale 0.5s ease-out;
}

/* 警告消息样式 */
.result-message.warning {
    color: var(--error-color);
    background-color: #fef2f2;
    border: 1px solid #ef4444;
}

/* 添加动画效果 */
@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 添加闪光效果 */
.result-message.success::after {
    content: '🎉';
    margin-left: 0.5rem;
    animation: bounce 1s infinite;
}

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

/* 修改主内容区域的背景色和模糊效果 */
main.bg-white {
    background: rgba(255, 255, 255, var(--bg-opacity));
    backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 1.5rem;
}

/* 修改页脚文字颜色，使其在深色背景上更清晰 */
footer {
    color: rgba(255, 255, 255, 0.9) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-family: var(--font-sans);
    font-weight: 400;
}

footer a {
    color: rgba(255, 255, 255, 0.9) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

footer a:hover {
    color: #3b82f6 !important;
}

/* 修改状态栏文字样式 */
.font-mono {
    font-size: 1.25rem;
}

/* 修改按钮样式 */
button, label {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    font-weight: 500;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    
    @media (min-width: 640px) {
        width: auto;
        min-width: 120px;
    }
    font-family: var(--font-sans);
}

button:hover, label:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* 添加按钮图标样式 */
button svg, label svg {
    flex-shrink: 0;
}

/* 添加按钮文本样式 */
button span, label span {
    flex-shrink: 0;
    white-space: nowrap;
}

/* 添加按钮容器样式 */
.button-container {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    
    @media (min-width: 640px) {
        flex-direction: row;
        width: auto;
        gap: 1rem;
    }
}

/* 添加新的毛玻璃卡片样式 */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: 1rem;
    box-shadow: var(--glass-shadow);
    padding: 1.5rem;
    @media (min-width: 768px) {
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    }
}

/* 修改键盘显示区域样式 */
#keyboard-display {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
    @media (max-width: 640px) {
        .grid {
            transform: scale(0.8);
            transform-origin: left top;
        }
    }
}

/* 修改键盘按键样式 */
.key {
    min-width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    color: #1f2937;
    cursor: default;
    user-select: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-transform: lowercase; /* 确保显示小写字母 */
}

.key:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.key.active {
    background: var(--primary-color);
    border-color: transparent;
    color: white;
    transform: translateY(1px);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

/* 修改状态栏样式 */
.flex-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: 1rem;
}

.flex-container div {
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(var(--glass-blur));
    border-radius: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.flex-container div:first-child {
    padding-left: 0;
}

.flex-container div:last-child {
    padding-right: 0;
}

/* 优化滚动条样式 */
.hide-scrollbar {
    scrollbar-width: none;
    -ms-overflow-style: none;
    &::-webkit-scrollbar {
        display: none;
    }
}

/* 添加平滑过渡效果 */
* {
    transition: all 0.3s ease;
}

#text-display::-webkit-scrollbar {
    width: 6px;
}

#text-display::-webkit-scrollbar-track {
    background: transparent;
}

#text-display::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

.current-line {
    background-color: rgba(59, 130, 246, 0.1);
    border-radius: 4px;
}

/* 添加警告动画 */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.animate-fade-in {
    animation: fade-in 0.3s ease-out forwards;
}

.animate-fade-out {
    animation: fade-out 0.3s ease-out forwards;
}

/* 禁用文本选择 */
.typing-box {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 允许输入框文本选择 */
#typing-input {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 添加页面加载动画 */
#loading-screen {
    animation: fadeOut 0.5s ease-out 2s forwards;
}

.typing-animation {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    font-family: var(--font-serif);
    letter-spacing: 0.1em;
}

.typing-animation span {
    display: inline-block;
    opacity: 0;
    transform: translateY(1rem);
    animation: typeIn 0.3s ease-out forwards;
}

.typing-animation span:nth-child(1) { animation-delay: 0.2s; }
.typing-animation span:nth-child(2) { animation-delay: 0.4s; }
.typing-animation span:nth-child(3) { animation-delay: 0.6s; }
.typing-animation span:nth-child(4) { animation-delay: 0.8s; }
.typing-animation span:nth-child(5) { animation-delay: 1.0s; }

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.loading-dots span {
    width: 0.5rem;
    height: 0.5rem;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: bounce 0.5s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.1s; }
.loading-dots span:nth-child(3) { animation-delay: 0.2s; }

/* 添加页面元素入场动画 */
.fade-in-up {
    opacity: 0;
    transform: translateY(2rem);
    animation: fadeInUp 0.5s ease-out forwards;
}

header.fade-in-up { animation-delay: 2.2s; }
main.fade-in-up { animation-delay: 2.4s; }
footer.fade-in-up { animation-delay: 2.6s; }

/* 添加按钮悬浮效果 */
button, label {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover, label:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

button:active, label:active {
    transform: translateY(0);
}

/* 添加输入框聚焦效果 */
#typing-input:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* 添加动画关键帧 */
@keyframes fadeOut {
    from {
        opacity: 1;
        visibility: visible;
    }
    to {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes typeIn {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(2rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 添加打字光标动画 */
.char.current::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 10%;
    height: 80%;
    width: 2px;
    background-color: var(--primary-color);
    animation: blink 1s step-end infinite;
}

/* 添加按键反馈动画 */
.key.pressed {
    transform: scale(0.95);
    background-color: var(--primary-color);
    color: white;
}

/* 添加进度条动画 */
#progress-bar {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 添加统计数字变化动画 */
.stat-number {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 添加模态框动画 */
.modal-enter {
    opacity: 0;
    transform: scale(0.9);
}

.modal-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 添加波纹效果 */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, white 10%, transparent 10.01%);
    transform: scale(10);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

.ripple:active::after {
    transform: scale(0);
    opacity: 0.3;
    transition: 0s;
}

/* 基础字体设置 */
body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 标题字体 */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    font-weight: 700;
    letter-spacing: -0.025em;
}

/* 优化标题样式 */
h1.text-3xl {
    color: white;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.1em;
}

/* 优化描述文字样式 */
header p {
    font-family: var(--font-sans);
    font-weight: 400;
    letter-spacing: 0.025em;
}

/* 优化打字区域字体大小和行高 */
#text-display {
    font-size: 1.125rem;
    line-height: 2;
    letter-spacing: 0.025em;
    
    @media (max-width: 640px) {
        font-size: 1rem;
        line-height: 1.8;
    }
}

/* 优化警告提示文字 */
.typing-warning {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.9);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    z-index: 10;
    animation: slideDown 0.3s ease-out;
}

.typing-warning.fade-out {
    animation: slideUp 0.3s ease-out forwards;
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 0);
        opacity: 1;
    }
    to {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
}

/* 优化统计面板文字 */
#statistics-panel {
    font-family: var(--font-sans);
}

.stat-label {
    font-weight: 500;
    color: #4b5563;
}

.stat-value {
    font-family: var(--font-mono);
    font-weight: 700;
    color: #1f2937;
}

/* 添加打字特效相关样式 */
/* 字符输入特效 */
.char.just-typed {
    animation: popIn 0.2s ease-out;
}

.char.correct.just-typed {
    animation: correctPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.char.wrong.just-typed {
    animation: wrongShake 0.3s ease-in-out;
}

/* 连续正确输入特效 */
.combo-effect {
    position: absolute;
    font-size: 1.2rem;
    color: var(--primary-color);
    pointer-events: none;
    white-space: nowrap;
    animation: comboFloat 0.8s ease-out forwards;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* 速度提升特效 */
.speed-boost {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.875rem;
    color: #10B981;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    animation: speedBoostFloat 1s ease-out forwards;
}

/* 打字区域光效 */
.typing-box.typing-active {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
    transition: box-shadow 0.3s ease;
}

/* 键盘按键特效 */
.key.active {
    transform: scale(0.95);
    background: var(--primary-color);
    color: white;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
    animation: keyPress 0.1s ease-out;
}

/* 进度条发光效果 */
#progress-bar {
    position: relative;
    overflow: hidden;
}

#progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progressShine 2s linear infinite;
    transform: translateX(-100%);
}

/* 添加动画关键帧 */
@keyframes popIn {
    0% { transform: scale(1.2); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes correctPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

@keyframes comboFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-20px) scale(1.2);
        opacity: 0;
    }
}

@keyframes speedBoostFloat {
    0% {
        transform: translate(-50%, 0) scale(0.8);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -10px) scale(1);
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -30px) scale(0.9);
        opacity: 0;
    }
}

@keyframes keyPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

@keyframes progressShine {
    100% { transform: translateX(100%); }
}

/* 添加连击数显示 */
.combo-counter {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(59, 130, 246, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: bold;
    transform: scale(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.combo-counter.active {
    transform: scale(1);
}

.combo-counter.milestone {
    animation: milestoneAchieved 0.5s ease-out;
}

@keyframes milestoneAchieved {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* 键盘布局样式 */
.keyboard-layout {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: 1rem;
    box-shadow: var(--glass-shadow);
}

.keyboard-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.key {
    min-width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    color: #1f2937;
    cursor: default;
    user-select: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-transform: lowercase; /* 确保显示小写字母 */
}

.key:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.key.active {
    transform: translateY(1px);
    background: var(--primary-color);
    border-color: transparent;
    color: white;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

/* 特殊键样式 */
.key.special-key {
    min-width: 4rem;
    font-size: 0.75rem;
    background: rgba(243, 244, 246, 0.8);
}

.key.space-key {
    min-width: 12rem;
}

/* 键盘动画效果 */
@keyframes keyPressAnimation {
    0% { transform: translateY(0); }
    50% { transform: translateY(2px); }
    100% { transform: translateY(0); }
}

.key.active {
    animation: keyPressAnimation 0.1s ease-out;
}

/* 键盘发光效果 */
.keyboard-layout {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.key:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 添加键盘响应式布局 */
@media (max-width: 768px) {
    .key {
        min-width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }
    
    .key.special-key {
        min-width: 3rem;
    }
    
    .key.space-key {
        min-width: 8rem;
    }
}

/* 输入法状态下的键盘样式 */
.typing-box.composing .key.active {
    background: #9333ea; /* 使用不同的颜色表示输入法状态 */
    box-shadow: 0 0 8px rgba(147, 51, 234, 0.4);
}

/* 修改键盘按键动画 */
@keyframes keyPressAnimation {
    0% { transform: translateY(0); }
    50% { transform: translateY(2px); }
    100% { transform: translateY(0); }
}

.key-press-animation {
    animation: keyPressAnimation 0.1s ease-out;
}

/* 优化键盘按键样式 */
.key {
    min-width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    color: #1f2937;
    cursor: default;
    user-select: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-transform: lowercase; /* 确保显示小写字母 */
}

.key.active {
    transform: translateY(1px);
    background: var(--primary-color);
    border-color: transparent;
    color: white;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

/* 输入法状态下的键盘样式 */
.typing-box.composing .key.active {
    background: #9333ea; /* 使用不同的颜色表示输入法状态 */
    box-shadow: 0 0 8px rgba(147, 51, 234, 0.4);
}

/* 打字特效样式 */
.speed-effect {
    position: absolute;
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
    text-shadow: 0 0 16px currentColor;
}

.perfect-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

.perfect-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #f59e0b;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
    animation: popScale 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.perfect-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.particle {
    position: absolute;
    border-radius: 50%;
    animation: particleExplode 1s ease-out forwards;
}

.mistake-effect {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(239, 68, 68, 0.1);
    animation: flashError 0.5s ease-out;
}

/* 动画关键帧 */
@keyframes floatUp {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% {
        transform: translateY(-50px);
        opacity: 0;
    }
}

@keyframes popScale {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes particleExplode {
    0% {
        transform: translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y));
        opacity: 0;
    }
}

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

/* 优化打字区域的过渡效果 */
.typing-box:focus-within {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.2);
}

.key.active::after {
    content: '';
    position: absolute;
    inset: -5px;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.2), transparent 70%);
    border-radius: inherit;
    z-index: -1;
}

/* 标题打字效果 */
.title-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(1em);
    animation: titleDrop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.title-char:nth-child(1) { animation-delay: 2.8s; }
.title-char:nth-child(2) { animation-delay: 3.0s; }
.title-char:nth-child(3) { animation-delay: 3.2s; }
.title-char:nth-child(4) { animation-delay: 3.4s; }
.title-char:nth-child(5) { animation-delay: 3.6s; }

@keyframes titleDrop {
    0% {
        opacity: 0;
        transform: translateY(-1em) scale(1.2);
        text-shadow: 0 0 0 rgba(255, 255, 255, 0);
    }
    20% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    }
}

/* 副标题打字效果 */
.subtitle-text {
    position: relative;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 4.0s forwards;
}

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