/* 全局样式 */
body {
    font-family: Arial, sans-serif;
    background-color: #111;
    color: #f0f0f0;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-header {
    background-color: #000;
    text-align: center;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.page-header h1 {
    margin: 0;
    font-size: 32px;
    color: #00ffff;
}

.main-container {
    display: flex;
    flex: 1;
    padding: 20px;
}

.sidebar {
    width: 20%;
    background-color: #1a1a1a;
    padding: 10px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    border-radius: 5px;
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #222;
    transition: background-color 0.3s ease;
}

.sidebar li:hover {
    background-color: #222;
}

.main-content {
    width: 60%;
    padding: 10px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    background-color: #1a1a1a;
}

.code-section {
    margin-bottom: 20px;
}

.CodeMirror {
    height: auto;
    border: 1px solid #333;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;
}

.keyboard-section {
    border: 1px solid #333;
    padding: 10px;
    background-color: #222;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    position: relative;
}

.keyboard-row {
    display: flex;
    margin-bottom: 5px;
    justify-content: center;
}

.key {
    padding: 10px 20px;
    margin: 2px;
    border: none;
    background-color: #333;
    color: #f0f0f0;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.key:hover {
    background-color: #444;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.backspace,
.tab,
.capslock,
.enter,
.shift,
.up-arrow,
.down-arrow,
.left-arrow,
.right-arrow {
    background-color: #444;
}

.result-section {
    width: 20%;
    padding: 10px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    background-color: #1a1a1a;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.result-section h2 {
    margin-top: 0;
    color: #00ffff;
}

.key.highlight {
    animation: keyHighlight 0.3s ease;
}

@keyframes keyHighlight {
    from {
        background-color: #333;
    }
    to {
        background-color: #00ffff;
    }
}

.key.error-highlight {
    background-color: #ff0000;
    color: #fff;
    box-shadow: 0 4px 8px rgba(255, 0, 0, 0.5);
}

.page-footer {
    background-color: #000;
    text-align: center;
    padding: 10px;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.5);
}

.dictation-mode-button {
    padding: 10px 20px;
    border: none;
    background-color: #333;
    color: #f0f0f0;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin-top: 10px;
    display: block;
    margin: 10px auto 0;
}

.dictation-mode-button:hover {
    background-color: #444;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.prompt-message {
    background-color: rgba(0, 255, 255, 0.7);
    color: #000;
    padding: 10px;
    text-align: center;
    margin-top: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    display: none;
}

.prompt-message.hidden {
    display: none;
}

.fireworks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none;
    z-index: 999;
}

.fireworks.hidden {
    display: none;
}

.firework {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #fff;
    animation: fireworkAnimation 1s ease-out forwards;
}

@keyframes fireworkAnimation {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px);
        opacity: 0;
    }
}

/* 响应式设计 */
@media (max-width: 800px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar,
    .main-content,
    .result-section {
        width: 100%;
        margin-bottom: 20px;
    }
}

/* 科技感的发光效果 */
.sidebar,
.main-content,
.result-section {
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    transition: box-shadow 0.3s ease;
}

.sidebar:hover,
.main-content:hover,
.result-section:hover {
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.6);
}

.key {
    position: relative;
    overflow: hidden;
}

.key::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0, 255, 255, 0.2) 0%, rgba(0, 255, 255, 0) 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.key:hover {
    background-color: #444444;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.key:hover::before {
    opacity: 1;
}

/* 优化提示信息样式 */
.prompt-message {
    background-color: rgba(0, 255, 255, 0.7);
    color: #000;
    padding: 10px;
    text-align: center;
    margin-top: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    display: none;
}

.prompt-message.hidden {
    display: none;
}

/* 默写模式下 CodeMirror 样式 */
.dictation-mode .CodeMirror {
    background-color: #000;
    color: #0f0;
}

/* 错误高亮样式 */
.CodeMirror .error {
    background-color: #ff0000;
    color: #fff;
}

/* 输入提示联想样式，这里只是简单示例，可根据需求完善 */
.CodeMirror-hints {
    position: absolute;
    z-index: 10;
    overflow: hidden;
    list-style: none;
    margin: 0;
    padding: 2px;
    -webkit-box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2);
    -moz-box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2);
    box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    border: 1px solid silver;
    background: white;
    font-size: 90%;
    font-family: monospace;
    max-height: 20em;
    overflow-y: auto;
}

.CodeMirror-hint {
    margin: 0;
    padding: 0 4px;
    border-radius: 2px;
    white-space: pre;
    color: black;
    cursor: pointer;
}

.CodeMirror-hint-active {
    background: #08f;
    color: white;
}

/* 修改光标高亮样式，使其为橙色且不闪烁 */
.current-highlight {
    background-color: orange;
    border-radius: 2px;
    box-shadow: 0 0 10px orange;
}

/* 激励性语言样式 */
#motivational-message {
    background-color: #222222;
    color: #00ffcc; /* 科技感颜色 */
    padding: 10px;
    margin-top: 20px;
    border-radius: 5px;
    text-align: left;
    box-shadow: 0 0 5px rgba(0, 255, 255, 0.3); /* 科技感发光效果 */
    animation: fadeIn 1s ease-out; /* 淡入动画 */
    font-family: 'Courier New', Courier, monospace; /* 科技感字体 */
    letter-spacing: 1px;
}

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