* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, #f0f4ff 0%, #ffffff 100%);
    color: #333;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

.top-right {
    position: fixed;
    top: 50px;
    right: 40px;
    text-align: right;
    z-index: 100;
}

.hint-area {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 5px;
}

.hint-text {
    font-size: 18px;
    font-weight: bold;
    color: #ccc;
    min-width: 30px;
    text-align: center;
}

.hint-btn, .next-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.hint-btn:hover, .next-btn:hover {
    color: #4a90e2;
    background-color: #f0f4ff;
}

.hint-btn:active, .next-btn:active {
    transform: scale(0.95);
}

.hint-meaning {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* 进度恢复提示 */
.progress-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background-color: rgba(76, 175, 80, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.progress-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.progress-toast svg {
    color: white;
}

.header {
    background-color: transparent;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.menu-btn:hover {
    color: #4a90e2;
    transform: scale(1.1);
}

.menu-btn:active {
    transform: scale(0.95);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.play-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.play-btn:hover {
    color: #4a90e2;
    background-color: #f0f4ff;
}

.play-btn:active {
    transform: scale(0.95);
}

.nav-item {
    font-size: 14px;
    color: #666;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background-color: #f0f0f0;
}

.nav-item.active {
    color: #4a90e2;
}

.chapter-dropdown {
    position: relative;
    display: inline-block;
}

.chapter-dropdown-toggle {
    font-size: 13px;
    color: #666;
    padding: 4px 20px 4px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
    position: relative;
    white-space: nowrap;
}

.chapter-dropdown-toggle::after {
    content: '';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 3px solid #666;
}

.chapter-dropdown-toggle:hover {
    border-color: #4a90e2;
}

.chapter-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 80px;
    max-height: 200px;
    overflow-y: auto;
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
}

.chapter-dropdown-menu.show {
    display: block;
}

.chapter-dropdown-item {
    padding: 6px 10px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.chapter-dropdown-item:hover {
    background-color: #f5f5f5;
}

.chapter-dropdown-item.active {
    background-color: #4a90e2;
    color: white;
}

.btn {
    background-color: #4a90e2;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: #357abd;
}

.main-container {
    max-width: 800px;
    margin: 80px auto 0;
    padding: 40px 20px;
    text-align: center;
}

.word-display {
    margin-bottom: 40px;
    padding: 40px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.word {
    font-size: 48px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.letter-container {
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.letter-slot {
    width: 35px;
    height: 45px;
    border-bottom: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    transition: all 0.2s ease;
    outline: none;
    cursor: text;
}

.letter-slot:focus {
    border-bottom-color: #4a90e2;
    box-shadow: 0 2px 0 0 #4a90e2;
}

.letter-slot.correct {
    border-bottom-color: #4caf50;
    color: #4caf50;
}

.letter-slot.incorrect {
    border-bottom-color: #f44336;
    color: #f44336;
}

.letter-slot.hint {
    border-bottom-color: #ff9800;
    color: #ff9800;
}

.letter-slot.shake {
    animation: shake 0.5s ease-in-out;
    border-bottom-color: #f44336 !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.letter-slot.error {
    border-bottom-color: #f44336 !important;
    color: #f44336;
    animation: pulseError 0.3s ease-in-out;
}

@keyframes pulseError {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.play-btn.active {
    background-color: #4a90e2;
    color: white;
}

.play-btn.active:hover {
    background-color: #357abd;
}

.phonetic {
    font-size: 14px;
    color: #999;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
}

.meaning {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: #e8e8e8;
    border-radius: 3px;
    margin: 30px 0;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #4a90e2, #67b8e3);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.stats {
    display: flex;
    justify-content: space-around;
    background-color: #ffffff;
    padding: 25px 20px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-top: 30px;
}

.stat-item {
    text-align: center;
    min-width: 80px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 13px;
    color: #999;
}

/* 无纸化默写区域 */
.writing-area {
    display: none;
    margin-top: 20px;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 20px;
    border: 2px solid #e0e0e0;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.writing-area.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: slideInUp 0.4s ease;
}

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

/* 画布错误提示动画 */
.writing-canvas.error-shake {
    animation: canvasShake 0.5s ease;
    border-color: #f85149 !important;
}

@keyframes canvasShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

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

.writing-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.writing-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.writing-close:hover {
    color: #666;
}

.writing-hint {
    font-size: 13px;
    color: #999;
    margin-bottom: 15px;
    text-align: center;
}

.writing-canvas {
    width: 100%;
    height: 150px;
    border: 2px dashed #ccc;
    border-radius: 12px;
    background-color: #fafafa;
    cursor: crosshair;
    touch-action: none;
}

.writing-canvas.drawing {
    border-color: #4a90e2;
    background-color: #f0f4ff;
}

.writing-toolbar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.writing-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.writing-clear {
    background-color: #f5f5f5;
    color: #666;
}

.writing-clear:hover {
    background-color: #e0e0e0;
}

.writing-undo {
    background-color: #f5f5f5;
    color: #666;
}

.writing-undo:hover {
    background-color: #e0e0e0;
}

.writing-confirm {
    background-color: #4a90e2;
    color: white;
}

.writing-confirm:hover {
    background-color: #357abd;
}

/* 手写输入切换按钮 */
.writing-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #4a90e2;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
    cursor: pointer;
    z-index: 100;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.writing-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(74, 144, 226, 0.5);
}

.writing-toggle:active {
    transform: scale(0.95);
}

.input-area {
    margin-top: 30px;
    display: none;
}

.input-box {
    width: 100%;
    max-width: 400px;
    padding: 15px 20px;
    font-size: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
    letter-spacing: 5px;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.input-box:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.sidebar {
    position: fixed;
    left: -250px;
    top: 0;
    width: 250px;
    height: 100vh;
    background-color: #ffffff;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-title {
    font-size: 16px;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

.word-list {
    list-style: none;
}

.word-item {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.word-item:hover {
    background-color: #f5f7fa;
}

.word-item.active {
    background-color: #e3f2fd;
    color: #1976d2;
}

.word-item .word-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.word-item .word-meaning {
    font-size: 12px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.overlay.show {
    display: block;
}

/* 选项弹窗样式 */
.option-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1001;
    display: none;
    justify-content: center;
    align-items: center;
}

.option-modal.show {
    display: flex;
}

.option-modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    overflow: hidden;
}

.option-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.option-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.option-modal-body {
    padding: 20px;
}

.option-item {
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-item:hover {
    border-color: #4a90e2;
    background-color: #f5f7fa;
}

.option-item:last-child {
    margin-bottom: 0;
}

.option-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.option-desc {
    font-size: 14px;
    color: #666;
}

/* 夜间模式样式 */
body.dark-mode {
    background: linear-gradient(180deg, #0d1117 0%, #161b22 100%);
    color: #e6edf3;
}

body.dark-mode .header {
    background-color: rgba(22, 27, 34, 0.95);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    border-bottom: 1px solid #30363d;
}

body.dark-mode .nav-item {
    color: #8b949e;
}

body.dark-mode .nav-item:hover {
    background-color: #21262d;
    color: #e6edf3;
}

body.dark-mode .chapter-dropdown-toggle {
    background-color: #21262d;
    border-color: #30363d;
    color: #c9d1d9;
}

body.dark-mode .chapter-dropdown-menu {
    background-color: #161b22;
    border-color: #30363d;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

body.dark-mode .chapter-dropdown-item {
    color: #c9d1d9;
}

body.dark-mode .chapter-dropdown-item:hover {
    background-color: #21262d;
}

body.dark-mode .main-container {
    background: transparent;
}

body.dark-mode .word-display {
    background-color: #161b22;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    border: 1px solid #30363d;
}

body.dark-mode .word {
    color: #f0f6fc;
}

body.dark-mode .phonetic {
    color: #8b949e;
}

body.dark-mode .meaning {
    color: #c9d1d9;
}

body.dark-mode .letter-slot {
    border-bottom-color: #8b949e;
    color: #f0f6fc;
}

body.dark-mode .letter-slot.hint {
    color: #58a6ff;
}

body.dark-mode .letter-slot.correct {
    color: #3fb950;
    border-bottom-color: #3fb950;
}

body.dark-mode .letter-slot.error {
    color: #f85149;
    border-bottom-color: #f85149;
}

body.dark-mode .stats {
    background-color: #161b22;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    border: 1px solid #30363d;
}

body.dark-mode .stat-value {
    color: #f0f6fc;
}

body.dark-mode .stat-label {
    color: #8b949e;
}

body.dark-mode .sidebar {
    background-color: #161b22;
    box-shadow: 2px 0 12px rgba(0,0,0,0.5);
    border-right: 1px solid #30363d;
}

body.dark-mode .sidebar-header {
    border-bottom-color: #30363d;
}

body.dark-mode .sidebar-title {
    color: #f0f6fc;
}

body.dark-mode .word-item {
    border-bottom-color: #21262d;
}

body.dark-mode .word-item:hover {
    background-color: #21262d;
}

body.dark-mode .word-item.active {
    background-color: #0f3460;
    border-left-color: #58a6ff;
}

body.dark-mode .word-name {
    color: #f0f6fc;
}

body.dark-mode .word-meaning {
    color: #8b949e;
}

body.dark-mode .option-modal-content {
    background-color: #161b22;
    border: 1px solid #30363d;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

body.dark-mode .option-modal-header {
    border-bottom-color: #30363d;
}

body.dark-mode .option-modal-header h3 {
    color: #f0f6fc;
}

body.dark-mode .option-item {
    border-color: #30363d;
    background-color: #21262d;
}

body.dark-mode .option-item:hover {
    background-color: #30363d;
    border-color: #58a6ff;
}

body.dark-mode .option-name {
    color: #f0f6fc;
}

body.dark-mode .option-desc {
    color: #8b949e;
}

body.dark-mode .input-box {
    background-color: #0d1117;
    border-color: #30363d;
    color: #f0f6fc;
}

body.dark-mode .input-box:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

body.dark-mode .menu-btn {
    color: #8b949e;
}

body.dark-mode .menu-btn:hover {
    color: #58a6ff;
    background-color: #21262d;
}

body.dark-mode .play-btn {
    color: #8b949e;
}

body.dark-mode .play-btn:hover {
    color: #58a6ff;
    background-color: #21262d;
}

body.dark-mode .play-btn.active {
    background-color: #1f6feb;
    color: #fff;
}

body.dark-mode .hint-btn,
body.dark-mode .next-btn {
    color: #8b949e;
}

body.dark-mode .hint-btn:hover,
body.dark-mode .next-btn:hover {
    color: #58a6ff;
    background-color: #21262d;
}

body.dark-mode .hint-text {
    color: #8b949e;
}

body.dark-mode .hint-meaning {
    color: #6e7681;
}

body.dark-mode .progress-bar {
    background-color: #21262d;
}

body.dark-mode .progress {
    background: linear-gradient(90deg, #238636 0%, #2ea043 100%);
}

body.dark-mode .close-btn {
    color: #8b949e;
}

body.dark-mode .close-btn:hover {
    color: #f85149;
}

/* 响应式布局 - 平板端 */
@media screen and (max-width: 1024px) {
    .main-container {
        max-width: 90%;
        margin: 70px auto 0;
    }
    
    .word-display {
        padding: 30px 20px;
    }
    
    .letter-slot {
        width: 30px;
        height: 40px;
        font-size: 24px;
    }
    
    .top-right {
        right: 20px;
        top: 50px;
    }
    
    .stats {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .stat-item {
        min-width: 60px;
        flex: 1 1 calc(20% - 15px);
    }
}

/* 响应式布局 - 移动端 */
@media screen and (max-width: 768px) {
    .header {
        padding: 10px 15px;
    }
    
    .nav-left {
        gap: 10px;
    }
    
    .nav-right {
        gap: 5px;
    }
    
    .nav-item {
        font-size: 13px;
    }
    
    .chapter-dropdown-toggle {
        font-size: 12px;
        padding: 3px 15px 3px 6px;
    }
    
    .play-btn, .hint-btn, .next-btn, .menu-btn {
        padding: 6px;
    }
    
    .top-right {
        position: relative;
        top: 60px;
        left: 280px;
        text-align: center;
        margin-bottom: 15px;
    }
    
    .hint-area {
        justify-content: center;
        gap: 15px;
    }
    
    .hint-text {
        font-size: 16px;
    }
    
    .hint-meaning {
        font-size: 11px;
        max-width: 280px;
        margin: 5px auto 0;
    }
    
    .main-container {
        max-width: 95%;
        margin: 0;
        padding: 15px;
    }
    
    .word-display {
        padding: 20px 15px;
        margin-bottom: 20px;
        border-radius: 12px;
    }
    
    .word {
        gap: 10px;
    }
    
    .letter-container {
        gap: 3px;
    }
    
    .letter-slot {
        width: 25px;
        height: 35px;
        font-size: 20px;
        border-bottom-width: 2px;
    }
    
    .phonetic {
        font-size: 12px;
        margin-bottom: 10px;
    }
    
    .meaning {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .progress-bar {
        height: 5px;
        margin: 20px 0;
    }
    
    .input-box {
        width: 100%;
        max-width: none;
        padding: 12px 15px;
        font-size: 18px;
        letter-spacing: 3px;
    }
    
    .stats {
        padding: 15px 10px;
        gap: 10px;
    }
    
    .stat-value {
        font-size: 22px;
    }
    
    .stat-label {
        font-size: 11px;
    }
    
    .sidebar {
        /* width: 280px; */
    }
    
    /* 弹窗适配 */
    .option-modal-content {
        width: 95%;
        max-width: 350px;
    }
    
    .option-item {
        padding: 12px;
    }
}

/* 响应式布局 - 小屏手机 */
@media screen and (max-width: 480px) {
    .header {
        padding: 8px 10px;
    }
    
    .nav-item {
        font-size: 12px;
    }
    
    .chapter-dropdown-toggle {
        font-size: 11px;
        padding: 2px 12px 2px 5px;
    }
    
    .btn.pause {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .top-right {
        margin-bottom: 10px;
    }
    
    .hint-area {
        gap: 10px;
    }
    
    .hint-text {
        font-size: 14px;
        min-width: 25px;
    }
    
    .hint-btn, .next-btn {
        padding: 5px;
    }
    
    .hint-meaning {
        font-size: 10px;
        max-width: 260px;
    }
    
    .main-container {
        padding: 10px;
    }
    
    .word-display {
        padding: 15px 10px;
        border-radius: 10px;
    }
    
    .letter-slot {
        width: 22px;
        height: 30px;
        font-size: 18px;
        gap: 2px;
    }
    
    .phonetic {
        font-size: 11px;
    }
    
    .meaning {
        font-size: 13px;
    }
    
    .input-box {
        padding: 10px 12px;
        font-size: 16px;
        letter-spacing: 2px;
    }
    
    .stats {
        flex-wrap: wrap;
        padding: 12px 5px;
        gap: 8px;
        border-radius: 12px;
    }
    
    .stat-item {
        min-width: 50px;
        flex: 1 1 calc(33.333% - 8px);
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 10px;
    }
}

/* 横屏模式适配 */
@media screen and (max-width: 896px) and (orientation: landscape) {
    .main-container {
        margin: 60px auto 0;
    }
    
    .word-display {
        padding: 20px;
    }
    
    .stats {
        margin-top: 20px;
    }
}

/* 平板手机端显示手写输入区域 */
@media screen and (max-width: 1024px) {
    .writing-canvas {
        height: 180px;
    }
}

@media screen and (max-width: 768px) {
    .writing-area {
        display: block;
        padding: 15px;
        margin-top: 15px;
    }
    
    .writing-canvas {
        height: 150px;
    }
    
    .writing-toolbar {
        gap: 10px;
    }
    
    .writing-btn {
        padding: 8px 15px;
        font-size: 13px;
    }
    
    .writing-title {
        font-size: 14px;
    }
    
    .writing-hint {
        font-size: 12px;
    }
}

@media screen and (max-width: 480px) {
    .writing-area {
        padding: 12px;
        border-radius: 12px;
    }
    
    .writing-canvas {
        height: 120px;
    }
    
    .writing-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .writing-btn svg {
        width: 1em;
        height: 1em;
    }
}

/* 夜间模式 - 手写区域 */
body.dark-mode .writing-area {
    background-color: #161b22;
    border-color: #30363d;
}

body.dark-mode .writing-title {
    color: #f0f6fc;
}

body.dark-mode .writing-close {
    color: #8b949e;
}

body.dark-mode .writing-close:hover {
    color: #f85149;
}

body.dark-mode .writing-hint {
    color: #8b949e;
}

body.dark-mode .writing-canvas {
    background-color: #0d1117;
    border-color: #30363d;
}

body.dark-mode .writing-canvas.drawing {
    border-color: #58a6ff;
    background-color: rgba(88, 166, 255, 0.05);
}

body.dark-mode .writing-clear,
body.dark-mode .writing-undo {
    background-color: #21262d;
    color: #c9d1d9;
}

body.dark-mode .writing-clear:hover,
body.dark-mode .writing-undo:hover {
    background-color: #30363d;
}

body.dark-mode .writing-confirm {
    background-color: #1f6feb;
}

body.dark-mode .writing-confirm:hover {
    background-color: #388bfd;
}

/* 夜间模式响应式适配 */
@media screen and (max-width: 768px) {
    body.dark-mode .header {
        background-color: transparent;
    }
    
    body.dark-mode .top-right {
        background-color: transparent;
    }
    
    body.dark-mode .word-display {
        background-color: #161b22;
    }
    
    body.dark-mode .stats {
        background-color: #161b22;
    }
}

/* 手写结果弹窗 */
.writing-result {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

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

.writing-result-content {
    background-color: white;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    min-width: 280px;
    max-width: 90%;
    animation: slideUp 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

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

.writing-result-word {
    font-size: 32px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    letter-spacing: 3px;
}

/* 手写预览区域 */
.writing-preview-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #e0e0e0;
}

.writing-preview-title {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.writing-preview-image {
    max-width: 100%;
    max-height: 120px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fafafa;
}

.writing-answer-section {
    margin-bottom: 20px;
}

.writing-result-text {
    font-size: 14px;
    color: #999;
    margin-bottom: 25px;
}

.writing-result-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.writing-result-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-appearance: none;
}

.writing-result-wrong {
    background-color: #ffebee;
    color: #c62828;
}

.writing-result-wrong:hover {
    background-color: #ffcdd2;
}

.writing-result-correct {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.writing-result-correct:hover {
    background-color: #c8e6c9;
}

/* 手写提示Toast */
.writing-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2001;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.writing-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* 夜间模式 - 手写结果 */
body.dark-mode .writing-result-content {
    background-color: #161b22;
    border: 1px solid #30363d;
}

body.dark-mode .writing-result-word {
    color: #f0f6fc;
}

body.dark-mode .writing-result-text {
    color: #8b949e;
}

body.dark-mode .writing-result-wrong {
    background-color: rgba(248, 81, 73, 0.2);
    color: #f85149;
}

body.dark-mode .writing-result-wrong:hover {
    background-color: rgba(248, 81, 73, 0.3);
}

body.dark-mode .writing-result-correct {
    background-color: rgba(63, 185, 80, 0.2);
    color: #3fb950;
}

body.dark-mode .writing-result-correct:hover {
    background-color: rgba(63, 185, 80, 0.3);
}

body.dark-mode .writing-preview-section {
    border-bottom-color: #30363d;
}

body.dark-mode .writing-preview-title {
    color: #8b949e;
}

body.dark-mode .writing-preview-image {
    border-color: #30363d;
    background-color: #0d1117;
}

/* 按钮激活状态 */
.play-btn.active {
    background-color: #4a90e2;
    color: white;
}