* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Comic Sans MS', '微软雅黑', sans-serif;
}

body {
    --theme-color: #ff69b4;
    background-color: #ffd1dc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    padding: 10px;
    background-image: 
        radial-gradient(#ff99cc 10%, transparent 11%),
        radial-gradient(#ff99cc 10%, transparent 11%);
    background-size: 60px 60px;
    background-position: 0 0, 30px 30px;
    transition: all 0.5s ease;
    box-sizing: border-box;
    overflow-x: hidden;
}

body.blue-theme {
    background-color: #e0f7fa;
    background-image: 
        radial-gradient(#80deea 10%, transparent 11%),
        radial-gradient(#80deea 10%, transparent 11%);
    --theme-color: #00bcd4;
}

.container {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2vw;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(255, 105, 180, 0.3);
    text-align: center;
    max-width: calc(100vw - 20px);
    width: 100%;
    max-width: 600px;
    margin: 10px auto;
    min-height: 80vh;
    height: auto;
    box-sizing: border-box;
    overflow: visible;
}

body.blue-theme .container {
    box-shadow: 0 8px 24px rgba(0, 188, 212, 0.3);
    background-color: rgba(255, 255, 255, 0.9);
}

.game-title {
    color: #ff69b4;
    font-size: clamp(1.8rem, 10vw, 3rem);
    margin: 0 auto 2vh;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2), 0 0 10px rgba(255, 105, 180, 0.5);
    text-align: center;
    transition: color 0.5s ease, text-shadow 0.5s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    width: 100%;
    display: block;
    font-weight: 700;
    letter-spacing: 1px;
}

body.blue-theme .game-title {
    color: #00bcd4;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2), 0 0 10px rgba(0, 188, 212, 0.5);
}

.settings-controls {
    display: flex;
    justify-content: space-between;
    gap: 2vw;
    margin-bottom: 2vh;
    flex-wrap: nowrap;
    align-items: center;
    padding: 0 2vw;
    width: 100%;
    box-sizing: border-box;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 1.5vw;
    margin: 0;
    flex: 0 0 auto;
}

.control-label {
    color: #ff69b4;
    font-size: clamp(0.8rem, 3.5vw, 1.1rem);
    font-weight: 700;
    transition: color 0.5s ease, text-shadow 0.5s ease;
    white-space: nowrap;
    flex: 0 0 auto;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    letter-spacing: 0.5px;
}

body.blue-theme .control-label {
    color: #00bcd4;
}

.toggle-switch {
    position: relative;
    width: clamp(40px, 10vw, 60px);
    height: clamp(20px, 5vw, 30px);
    flex: 0 0 auto;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 50px;
}

.toggle-label:before {
    position: absolute;
    content: "";
    height: 75%;
    width: 40%;
    left: 6%;
    bottom: 12.5%;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-input:checked + .toggle-label {
    background-color: #ff69b4;
}

.toggle-input:focus + .toggle-label {
    box-shadow: 0 0 1px #ff69b4;
}

.toggle-input:checked + .toggle-label:before {
    transform: translateX(calc(100% + 6%));
}

body.blue-theme .toggle-input:checked + .toggle-label {
    background-color: #00bcd4;
}

body.blue-theme .toggle-input:focus + .toggle-label {
    box-shadow: 0 0 1px #00bcd4;
}

@media (max-width: 1024px) {
    /* 平板设备（768px-1024px）专用样式 */
    #keyboard {
        gap: 0.1vw;
    }
    
    #keyboard > div {
        gap: 0.1vw;
    }
    
    .keyboard-key {
        width: 5.5vw;
        height: 5.5vw;
        max-width: 60px;
        max-height: 60px;
        font-size: 1.5rem;
        border-width: 3px;
    }
    
    .keyboard-key.special {
        width: 7vw;
        max-width: 80px;
        font-size: 1rem;
        border-width: 3px;
    }
}

@media (max-width: 768px) {
    .game-title {
        font-size: 6vw;
    }
    
    .control-label {
        font-size: 2.5vw;
    }
    
    #game-instruction {
        font-size: 2.5vw;
        padding: 0 3vw;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 8vw;
    }
    
    .control-label {
        font-size: 3.5vw;
    }
    
    #game-instruction {
        font-size: 3vw;
        padding: 0 4vw;
    }
    
    .question-card {
        padding: 4vw;
    }
    
    .question-text {
        font-size: 1.2em;
    }
    
    .option-btn {
        padding: 3vw;
        font-size: 1em;
        min-height: 80px;
    }
}

/* 横屏显示优化 */
@media (orientation: landscape) {
    .container {
        max-width: 90vw;
        min-height: 70vh;
        padding: 2vh;
    }
    
    .game-area {
        margin-top: 2vh;
        padding: 2vh;
    }
    
    .settings-controls {
        margin-bottom: 1vh;
    }
    
    .selection-section {
        margin-bottom: 2vh;
    }
    
    #keyboard {
        gap: 0.2vh;
        padding: 0.3vw;
    }
    
    #keyboard > div {
        gap: 0.2vh;
    }
    
    .keyboard-key {
        width: 5vh;
        height: 5vh;
        font-size: 1.5rem;
    }
    
    #level-buttons {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1vw;
    }
    
    #level-selection #level-cards .level-card {
        width: 80%;
        margin: 1vw;
        padding: 2vw;
    }
    
    .question-card {
        padding: 2vh;
        margin-bottom: 2vh;
    }
    
    .option-btn {
        padding: 1.5vh;
        min-height: 60px;
        margin-bottom: 0.5vh;
    }
    
    #mixed-cards-container {
        gap: 1vh;
    }
    
    .card {
        width: 15vw;
        max-width: 120px;
        padding: 1.5vh;
        min-height: 80px;
    }
}

/* 选择区域 */
.selection-section {
    margin-bottom: 3vw;
    padding: 2vw;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 1.5vw;
}

/* 单元和关卡选择区域特殊样式 */
#unit-selection,
#level-selection {
    display: none;
    position: relative;
}

/* 选择区域标题样式 */
.selection-section h2 {
    margin-bottom: 2vw;
}

/* 返回按钮样式 */
.selection-section .back-btn {
    position: absolute;
    top: 0;
    left: 0;
    width: auto;
    max-width: none;
    padding: 1vw 2vw;
    font-size: 1em;
    z-index: 10;
}

/* 游戏显示元素样式 */
#unit-display,
#game-instruction,
#operation-buttons,
#back-btn,
#next-unit-btn {
    display: none;
}

/* 游戏说明文本样式 */
#game-instruction {
    color: #666; /* 弱化的配色 */
    text-align: left;
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    margin-bottom: 2vh;
    padding: 0 2vw;
}

/* 单元显示文本样式 */
#unit-display {
    text-align: center;
    font-weight: bold;
    color: var(--theme-color); /* 跟随主题色变化 */
    font-size: clamp(1rem, 4vw, 1.3rem);
    margin-bottom: 2vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 游戏操作按钮区域样式 */
#operation-buttons {
    margin-top: 2vw;
    flex-direction: column;
    align-items: center;
}

/* 倒计时显示样式 */
#countdown {
    display: flex;
    margin-top: 0;
    font-size: 1.5em;
    font-weight: bold;
    color: #ff4791;
}

/* 游戏内容区域样式 */
#game-content {
    display: none;
}

/* 混合卡片容器样式 */
#mixed-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    padding: 0 10px;
}

/* 语法迷宫游戏样式 */
#question-progress {
    text-align: center;
    margin-bottom: 1vw;
    font-size: 1.2em;
}

#chinese-meaning {
    text-align: center;
    margin-bottom: 2vw;
    font-size: 1.5em;
    font-weight: bold;
    color: var(--theme-color);
}

#current-sentence {
    text-align: center;
    margin-bottom: 2vw;
    font-size: 1.5em;
    padding: 2vw;
    border: 2px dashed #ccc;
    border-radius: 10px;
    min-height: 50px;
}

#word-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1vw;
    justify-content: center;
    margin-bottom: 2vw;
}

#action-buttons {
    display: flex;
    justify-content: center;
    gap: 2vw;
}

.selection-section h2 {
    color: #ff4791;
    margin-bottom: 1.5vw;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-family: 'Comic Neue', 'Comic Sans MS', 'Bubblegum Sans', '微软雅黑', sans-serif;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
    transition: color 0.5s ease, text-shadow 0.5s ease;
}

body.blue-theme .selection-section h2 {
    color: #0097a7;
}

/* 按钮网格布局 */
.btn-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5vw;
    justify-content: center;
}

/* 功能按钮样式 */
.function-btn {
    width: 30vw;
    height: 30vw;
    max-width: 200px;
    max-height: 200px;
    padding: 2vw;
    font-size: initial;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, 
        rgba(255, 0, 128, 0.5), 
        rgba(255, 105, 180, 0.5), 
        rgba(0, 206, 209, 0.5), 
        rgba(0, 191, 255, 0.5)
    );
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-sizing: border-box;
    white-space: normal;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
    min-height: 100px;
    min-width: 100px;
}

.function-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent
    );
    transform: rotate(45deg);
    animation: shine 3s infinite linear;
}

body.blue-theme .function-btn {
    background: linear-gradient(135deg, 
        rgba(0, 191, 255, 0.5), 
        rgba(0, 206, 209, 0.5), 
        rgba(255, 105, 180, 0.5), 
        rgba(255, 0, 128, 0.5)
    );
    box-shadow: 
        0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
}

.unit-name {
    font-size: 1.5em;
    font-weight: 700;
    white-space: normal;
    word-wrap: break-word;
    margin-bottom: 5px;
    position: relative;
    z-index: 1;
}

.unit-title {
    font-size: initial;
    font-weight: 400;
    opacity: 0.9;
    text-align: center;
    line-height: 1.2;
    white-space: normal;
    word-wrap: break-word;
    position: relative;
    z-index: 1;
}

.function-btn:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
}

.function-btn:active {
    transform: translateY(2px) scale(0.98);
    box-shadow: 
        0 0.4vw 1.6vw rgba(0, 0, 0, 0.1);
    transition: all 0.1s ease;
}

body.blue-theme .function-btn:hover {
    box-shadow: 
        0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
}

/* 教材按钮样式 */
.textbook-btn {
    width: 80%;
    min-height: 80px;
    padding: 2vw;
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, 
        rgba(255, 0, 128, 0.5), 
        rgba(255, 105, 180, 0.5), 
        rgba(0, 206, 209, 0.5), 
        rgba(0, 191, 255, 0.5)
    );
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-sizing: border-box;
    white-space: normal;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
}

.textbook-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent
    );
    transform: rotate(45deg);
    animation: shine 3s infinite linear;
}

body.blue-theme .textbook-btn {
    background: linear-gradient(135deg, 
        rgba(0, 191, 255, 0.5), 
        rgba(0, 206, 209, 0.5), 
        rgba(255, 105, 180, 0.5), 
        rgba(255, 0, 128, 0.5)
    );
    box-shadow: 
        0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
}

.textbook-btn:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
}

.textbook-btn:active {
    transform: translateY(2px) scale(0.98);
    box-shadow: 
        0 0.4vw 1.6vw rgba(0, 0, 0, 0.1);
    transition: all 0.1s ease;
}

body.blue-theme .textbook-btn:hover {
    box-shadow: 
        0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

/* 加载动画样式 */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    width: 100%;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid var(--theme-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 问题卡片样式 */
.question-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 2vw;
    border-radius: 15px;
    margin-bottom: 2vw;
    text-align: center;
    border: 3px solid var(--theme-color);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.question-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.question-card .question-text {
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    font-weight: 700;
    color: #333;
    margin-bottom: 1vw;
    line-height: 1.5;
    letter-spacing: 0.5px;
}

/* 选项按钮样式 */
.option-btn {
    width: 100%;
    max-width: 600px;
    padding: 1.5vw;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 248, 255, 0.9));
    border: 3px solid var(--theme-color);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: clamp(0.9rem, 4vw, 1.2rem);
    line-height: 1.5;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 1vw;
    display: block;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    overflow: hidden;
}

.option-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.option-btn:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 248, 255, 0.95));
}

.option-btn:hover::before {
    left: 100%;
}

.option-btn:active {
    transform: translateX(5px) scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.option-btn.correct {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.9), rgba(129, 199, 132, 0.9));
    border-color: #4caf50;
    color: white;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
    animation: correctAnswer 0.5s ease;
}

.option-btn.wrong {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.9), rgba(229, 115, 115, 0.9));
    border-color: #f44336;
    color: white;
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.6);
    animation: wrongAnswer 0.5s ease;
}

.option-btn.show-correct {
    background: linear-gradient(135deg, rgba(255, 235, 59, 0.9), rgba(255, 215, 0, 0.9));
    border-color: #ffeb3b;
    color: #333;
    box-shadow: 0 0 20px rgba(255, 235, 59, 0.8);
    transform: scale(1.05);
}

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

@keyframes wrongAnswer {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}

/* 单词配对游戏卡片样式 */
.card {
    width: fit-content;
    min-width: 80px;
    max-width: 90vw;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(255, 105, 180, 0.4), rgba(0, 188, 212, 0.4));
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    font-weight: bold;
    color: #333;
    font-size: clamp(1rem, 2.5vw, 1.8rem);
    line-height: 1.4;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 0 20px rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    user-select: none;
    white-space: normal;
}

.card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15), inset 0 0 20px rgba(255, 255, 255, 0.4);
}

.card:active {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1), inset 0 0 20px rgba(255, 255, 255, 0.3);
}

.card.selected {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.5), rgba(255, 236, 139, 0.5)) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 0 20px rgba(255, 215, 0, 0.3) !important;
}

.card.matched {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.5), rgba(129, 199, 132, 0.5)) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 0 20px rgba(76, 175, 80, 0.3) !important;
    animation: matchedCard 0.5s ease;
}

.card.wrong {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.5), rgba(229, 115, 115, 0.5)) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 0 20px rgba(244, 67, 54, 0.3);
    animation: wrongAnswer 0.5s ease;
}

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

/* 彩虹玻璃按钮样式 */
.rainbow-glass-btn {
    width: 25vw;
    max-width: 150px;
    padding: 1.5vw 3vw;
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, 
        rgba(255, 0, 128, 0.6), 
        rgba(255, 105, 180, 0.6), 
        rgba(0, 206, 209, 0.6), 
        rgba(0, 191, 255, 0.6)
    );
    border: 3px solid rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 0.8vw 3.2vw rgba(0, 0, 0, 0.15),
        0 0 20px rgba(255, 105, 180, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.rainbow-glass-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent
    );
    transform: rotate(45deg);
    animation: shine 3s infinite linear;
}

.rainbow-glass-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
       0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, 
        rgba(255, 0, 128, 0.6), 
        rgba(255, 105, 180, 0.6), 
        rgba(0, 206, 209, 0.6), 
        rgba(0, 191, 255, 0.6)
    );
}

/* 蓝色主题下的彩虹玻璃按钮 */
body.blue-theme .rainbow-glass-btn {
    background: linear-gradient(135deg, 
        rgba(0, 191, 255, 0.5), 
        rgba(0, 206, 209, 0.5), 
        rgba(255, 105, 180, 0.5), 
        rgba(255, 0, 128, 0.5)
    );
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 
       0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
}

body.blue-theme .rainbow-glass-btn:hover {
    background: linear-gradient(135deg, 
        rgba(0, 191, 255, 0.6), 
        rgba(0, 206, 209, 0.6), 
        rgba(255, 105, 180, 0.6), 
        rgba(255, 0, 128, 0.6)
    );
    box-shadow: 
       0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
}

/* 操作按钮样式 */
.action-btn {
    width: 8vw;
    max-width: 90px;
    height: 6vw;
    max-height: 70px;
    min-width: 60px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, 
        rgba(244, 67, 54, 0.5), 
        rgba(233, 30, 99, 0.5)
    );
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5vw 1vw rgba(0, 0, 0, 0.15);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn.used {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn.enter {
    background: linear-gradient(135deg, 
        rgba(76, 175, 80, 0.5), 
        rgba(67, 160, 71, 0.5)
    );
    color: white;
}

/* 操作按钮区域特殊样式 - 左右布局 */
#operation-buttons {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 2vw;
    flex-wrap: nowrap;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
    align-items: center;
}

/* 确保操作按钮区域内的按钮不会换行 */
#operation-buttons .rainbow-glass-btn {
    flex: 0 0 auto;
}

/* 倒计时显示样式 */
.countdown-display {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5vw 3vw;
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, 
        rgba(255, 165, 0, 0.8), 
        rgba(255, 69, 0, 0.8)
    );
    border: 3px solid rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 
        0 0.8vw 3.2vw rgba(0, 0, 0, 0.15),
        0 0 20px rgba(255, 165, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    white-space: nowrap;
    min-width: 100px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.function-btn:active {
    transform: translateY(-2px);
}

.function-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.game-area {
    margin-top: 3vw;
    background: rgba(255, 255, 255, 0.95);
    padding: 3vw;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.level-selection {
    display: flex;
    flex-direction: column;
    gap: 2vw;
    align-items: center;
    width: 100%;
}

#level-selection #level-cards .level-card {
    /* 完全复制教材按钮样式，不设置背景色以保留JavaScript动态设置的颜色 */
    width: 80%;
    min-height: 80px;
    padding: 2vw;
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    font-weight: bold;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-sizing: border-box;
    white-space: normal;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
}

.level-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent
    );
    transform: rotate(45deg);
    animation: shine 3s infinite linear;
}



.level-card:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
}

.level-card:active {
    transform: translateY(2px) scale(0.98);
    box-shadow: 
        0 0.4vw 1.6vw rgba(0, 0, 0, 0.1);
    transition: all 0.1s ease;
}

body.blue-theme .level-card:hover {
    box-shadow: 
        0 0.8vw 3.2vw rgba(0, 0, 0, 0.1);
}

.level-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(70%);
    border: 2px dashed rgba(128, 128, 128, 0.5);
}

.level-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3em;
    opacity: 0.3;
}

/* 关卡卡片背景渐变类 */
.level-card.gradient-1 {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
}

.level-card.gradient-2 {
    background: linear-gradient(135deg, #feca57, #ff9f43);
}

.level-card.gradient-3 {
    background: linear-gradient(135deg, #48dbfb, #0abde3);
}

.level-card.gradient-4 {
    background: linear-gradient(135deg, #ff9ff3, #f368e0);
}

.level-card.gradient-5 {
    background: linear-gradient(135deg, #1dd1a1, #10ac84);
}

.level-card.completed {
    border: 3px solid #4caf50;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.4);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(255, 255, 255, 0.95));
}

.level-card.completed::after {
    content: '✓';
    position: absolute;
    top: 1vw;
    right: 1vw;
    font-size: 2em;
    color: #4caf50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.6);
}

.level-info {
    flex: 1;
    padding-right: 2vw;
}

.level-number {
    font-size: 1.5em;
    font-weight: bold;
    color: #ff4791;
    margin-bottom: 0.5em;
}

body.blue-theme .level-number {
    color: #0097a7;
}

.level-name {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
}

.level-stars {
    display: flex;
    gap: 0.5vw;
    font-size: 2em;
}

.level-stars .star {
    color: #808080 !important;
    text-shadow: none !important;
    -webkit-text-fill-color: #808080 !important;
    opacity: 1;
    transition: all 0.5s ease;
}

.level-stars .star.earned {
    color: #ffd700 !important;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8) !important;
    -webkit-text-fill-color: #ffd700 !important;
    animation: starEarned 0.8s ease forwards;
}

@keyframes starEarned {
    0% {
        transform: scale(0.5) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.3) rotate(180deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

.level-status {
    font-size: 0.9em;
    color: #666;
    margin-top: 0.5em;
}

.result-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

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

.result-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 3vw;
    border-radius: 20px;
    max-width: 80vw;
    max-height: 80vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.result-content h2 {
    color: #ff4791;
    margin-bottom: 2vw;
    font-size: 2em;
    font-family: 'Comic Neue', 'Comic Sans MS', 'Bubblegum Sans', '微软雅黑', sans-serif;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
}

body.blue-theme .result-content h2 {
    color: #0097a7;
}

.result-content p {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 1.5vw;
}

.stars-display {
    font-size: 3em;
    margin: 2vw 0;
}

.stars-display .star {
    margin: 0 0.5vw;
    color: #808080 !important;
    text-shadow: none !important;
    -webkit-text-fill-color: #808080 !important;
    opacity: 1;
    transition: all 0.5s ease;
}

.stars-display .star.earned {
    color: #ffd700 !important;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8) !important;
    -webkit-text-fill-color: #ffd700 !important;
    animation: starEarned 0.8s ease forwards;
    animation-delay: calc(var(--star-index) * 0.2s);
}

.result-buttons {
    display: flex;
    gap: 2vw;
    justify-content: center;
    margin-top: 2vw;
    position: relative;
}

#result-buttons .next-level-container {
    position: absolute;
    right: 10vw;
    top: 0;
}

.result-btn {
    padding: 1.5vw 3vw;
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, 
        rgba(255, 0, 128, 0.6), 
        rgba(255, 105, 180, 0.6)
    );
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

body.blue-theme .result-btn {
    background: linear-gradient(135deg, 
        rgba(0, 191, 255, 0.6), 
        rgba(0, 206, 209, 0.6)
    );
}

.result-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.result-btn:active {
    transform: translateY(0);
}

.countdown-controls {
    display: flex;
    white-space: nowrap;
    gap: 1vw;
    align-items: center;
}

#restart-btn, #end-game-btn {
    padding: 1.5vw 3vw;
    background: linear-gradient(135deg, rgba(255, 0, 128, 0.3), rgba(255, 105, 180, 0.3), rgba(0, 206, 209, 0.3), rgba(0, 191, 255, 0.3));
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 0 20px rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    flex-shrink: 0;
}

#restart-btn:hover, #end-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(255, 255, 255, 0.4);
}

#restart-btn:active, #end-game-btn:active {
    transform: translateY(0);
}

body.blue-theme #restart-btn, body.blue-theme #end-game-btn {
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.3), rgba(0, 206, 209, 0.3), rgba(255, 105, 180, 0.3), rgba(255, 0, 128, 0.3));
}

.total-stars {
    font-size: 2em;
    font-weight: bold;
    color: #ffd700;
    margin: 2vw 0;
}

#keyboard {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.2vw;
    align-items: center;
    white-space: nowrap;
    padding: 0.5vw 0.5vw 0.5vw 1vw;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#keyboard > div {
    display: flex;
    gap: 0.1vw;
    justify-content: center;
    width: auto;
    flex-wrap: nowrap !important;
    white-space: nowrap;
}

.keyboard-key {
    width: 6vw;
    height: 6vw;
    max-width: 70px;
    max-height: 70px;
    min-width: 12px;
    min-height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.8rem, 3vw, 2rem);
    font-weight: bold;
    border: 3px solid #000;
    border-radius: 12px;
    background: #ffffff;
    color: #000;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: lowercase;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.keyboard-key:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5vw 1vw rgba(0, 0, 0, 0.15);
}

.keyboard-key:active {
    transform: translateY(0);
}

.keyboard-key.used {
    opacity: 0.4;
    cursor: not-allowed;
}

.keyboard-key.special {
    width: 8vw;
    max-width: 90px;
    font-size: 1rem;
}

.keyboard-key.delete {
    background: #ffffff;
    color: #000000;
    border: 3px solid #000000;
}

.keyboard-key.enter {
    background: #4CAF50;
    color: white;
    border: 3px solid #000000;
}

@media (max-width: 768px) {
    .game-title {
        font-size: 6vw;
    }
    
    .control-label {
        font-size: 2.5vw;
    }
    
    #game-instruction {
        font-size: 2.5vw;
        padding: 0 3vw;
        
    }
    
    .selection-section h2 {
        font-size: initial;
    }
    
    .function-btn {
        font-size: 2.5vw;
        min-width: 25vw;
        padding: 2vw;
    }
    
    .unit-name {
        font-size: 1.5em;
    }
    
    .unit-title {
        font-size: 2vw;
    }
    
    .textbook-btn {
        width: 90%;
        font-size: 2.5vw;
        padding: 2.5vw;
    }
    
    #level-selection #level-cards .level-card {
        width: 90%;
        font-size: 2.5vw;
        padding: 2.5vw;
    }
    
    .level-number {
        font-size: 1.2em;
    }
    
    .level-name {
        font-size: 1em;
    }
    
    .level-stars {
        font-size: 1.5em;
    }
    
    .result-content {
        padding: 5vw;
    }
    
    .result-content h2 {
        font-size: 1.5em;
    }
    
    .result-content p {
        font-size: 1em;
    }
    
    .result-btn {
        padding: 2vw 4vw;
        font-size: 1em;
    }
    
    #operation-buttons {
        gap: 3vw;
        max-width: 100%;
    }
    
    #keyboard {
        gap: 0.05vw;
    }
    
    #keyboard > div {
        gap: 0.05vw;
    }
    
    .keyboard-key {
        width: 6.5vw;
        height: 6.5vw;
        max-width: 45px;
        max-height: 45px;
        min-width: 20px;
        min-height: 20px;
        font-size: 1.2rem;
        border-width: 3px;
    }
    
    .keyboard-key.special {
        width: 7.5vw;
        max-width: 55px;
        font-size: 0.7rem;
        border-width: 3px;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 8vw;
    }
    
    .control-label {
        font-size: 3.5vw;
    }
    
    #game-instruction {
        font-size: 3vw;
        padding: 0 4vw;
        text-align: left;
    }
    
    #keyboard {
        gap: 0.05vw;
        padding: 0.5vw 1vw;
        align-items: center;
        overflow-x: auto;
        width: 100%;
    }
    
    #keyboard > div {
        gap: 0.05vw;
        justify-content: center;
        width: 100%;
    }
    
    .keyboard-key {
        width: 7.5vw;
        height: 7.5vw;
        max-width: 40px;
        max-height: 40px;
        min-width: 12px;
        min-height: 12px;
        font-size: 0.8rem;
        border-width: 2px;
    }
    
    .keyboard-key.special {
        width: 8.5vw;
        max-width: 45px;
        font-size: 0.6rem;
        min-width: 15px;
        min-height: 12px;
        border-width: 2px;
    }
    
    .keyboard-key.delete {
        font-size: 0.6rem;
    }
    
    .keyboard-key.enter {
        font-size: 0.6rem;
    }
    
    .selection-section h2 {
        font-size: initial;
    }
    
    .function-btn {
        font-size: 3.5vw;
        min-width: 35vw;
        padding: 2.5vw;
    }
    
    .unit-name {
        font-size: 1.5em;
    }
    
    .unit-title {
        font-size: 2.5vw;
    }
    
    .textbook-btn {
        width: 95%;
        font-size: 3.5vw;
        padding: 3vw;
    }
    
    #level-selection #level-cards .level-card {
        width: 95%;
        font-size: 3.5vw;
        padding: 3vw;
    }
    
    .level-number {
        font-size: 1em;
    }
    
    .level-name {
        font-size: 0.9em;
    }
    
    .level-stars {
        font-size: 1.2em;
    }
    
    .result-content {
        padding: 6vw;
    }
    
    .result-content h2 {
        font-size: 1.2em;
    }
    
    .result-content p {
        font-size: 0.9em;
    }

    .result-btn {
        padding: 3vw 5vw;
        font-size: 0.9em;
    }
    
    #operation-buttons {
        gap: 4vw;
        max-width: 100%;
        flex-wrap: wrap;
    }
}

/* 单词雨容器样式 */
#word-rain-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 182, 193, 0.3));
    transition: background 0.5s ease;
}

body.blue-theme #word-rain-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(173, 216, 230, 0.3));
}