* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    overflow: hidden;
}

#game-container {
    width: 100vw;
    height: 100vh;
    background-image: url('image/bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none !important;
}

/* 开始屏幕样式 - 卡通风格 */
#start-screen {
    background: linear-gradient(180deg, rgba(135, 206, 235, 0.9) 0%, rgba(144, 238, 144, 0.9) 100%);
}

.screen-header {
    width: 100%;
    padding: 20px;
    position: absolute;
    top: 0;
    left: 0;
}

#start-screen h1 {
    font-size: 48px;
    margin: 20px 0;
    color: #fff;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', sans-serif;
    animation: bounce 2s ease infinite;
    text-align: center;
}

.instructions-link {
    font-size: 18px;
    color: #fff;
    text-decoration: underline;
    cursor: pointer;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    transition: color 0.3s ease;
    position: absolute;
    top: 20px;
    right: 20px;
}

.instructions-link:hover {
    color: #FFD700;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: 20px;
    padding: 20px;
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    border: 4px solid #FFD700;
}

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

.modal-header h2 {
    font-size: 24px;
    color: #333;
    margin: 0;
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', sans-serif;
}

.close-btn {
    font-size: 30px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #FF6B6B;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-body p {
    font-size: 16px;
    margin: 10px 0;
    color: #333;
    font-family: 'Comic Sans MS', sans-serif;
}

.modal-footer {
    display: flex;
    justify-content: center;
}

#close-instructions {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', sans-serif;
}

#close-instructions:hover {
    background: linear-gradient(135deg, #44A08D 0%, #4ECDC4 100%);
    transform: scale(1.05);
}

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

h2 {
    font-size: 24px;
    color: #333;
}

/* 选择器容器 - 卡通卡片风格 */
.selector-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 85%;
    max-width: 450px;
    padding: 35px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    border: 4px solid #FFD700;
}

.selector-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selector-group label {
    font-size: 20px;
    font-weight: bold;
    color: #FF6B6B;
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', sans-serif;
}

.selector-group select {
    padding: 15px;
    font-size: 18px;
    border: 3px solid #4ECDC4;
    border-radius: 15px;
    background-color: #F0F8FF;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Comic Sans MS', sans-serif;
}

.selector-group select:focus {
    outline: none;
    border-color: #FF6B6B;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

.selector-group select:disabled {
    background-color: #e0e0e0;
    cursor: not-allowed;
}

#start-game-btn {
    padding: 20px;
    font-size: 24px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', sans-serif;
    font-weight: bold;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

#start-game-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #FF8E53 0%, #FF6B6B 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
}

#start-game-btn:disabled {
    background: linear-gradient(135deg, #cccccc 0%, #999999 100%);
    cursor: not-allowed;
    box-shadow: none;
}

/* 游戏屏幕 */
#game-screen {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
}

#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid #ddd;
    min-height: 50px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

#current-unit {
    font-size: clamp(14px, 3vw, 24px);
    color: #333;
    flex: 0 0 50%;
    white-space: normal;
    margin: 0;
}

#score {
    font-size: clamp(14px, 3vw, 20px);
    font-weight: bold;
    color: #333;
    flex: 0 0 30%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#pause-btn {
    padding: 5px;
    font-size: clamp(12px, 2vw, 14px);
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FFD93D 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    flex: 0 0 20%;
    white-space: nowrap;
    margin: 0;
}

#pause-btn:hover {
    background: linear-gradient(135deg, #FFD93D 0%, #FF6B6B 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 107, 107, 0.4);
}

/* 泡泡区域 */
#bubble-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#bubble-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.bubble-row {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0;
    white-space: nowrap;
    width: 100%;
    padding: 0 5px;
}

.bubble {
    width: clamp(28px, 9vw, 36px);
    height: clamp(28px, 9vw, 36px);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(12px, 3.5vw, 16px);
    font-weight: bold;
    color: white;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    
    position: relative;
}

/* 不同泡泡使用不同的背景图片 */
.bubble[data-bg-index="1"] {
    background-image: url('image/p1.png');
}

.bubble[data-bg-index="2"] {
    background-image: url('image/p2.png');
}

.bubble[data-bg-index="3"] {
    background-image: url('image/p3.png');
}

.bubble[data-bg-index="4"] {
    background-image: url('image/p4.png');
}

.bubble.hidden-letter {
    color: transparent;
    text-shadow: none;
}

.fired-bubble {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    color: white;
    background: transparent;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    border: 2px solid #ffffff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    z-index: 1000;
    pointer-events: none;
}

/* 大炮区域 */
#cannon-area {
    max-height: 160px;
    background-color: transparent;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding: 5px 10px 10px;
    flex-shrink: 0;
    overflow: visible;
}

/* 单词释义显示区域 */
#word-meaning-display {
    position: absolute;
    bottom: 200px;
    left: 0;
    width: 100%;
    background-color: transparent;
    padding: 10px 20px;
    text-align: center;
    z-index: 50;
    backdrop-filter: blur(5px);
    opacity: 0.5;
    overflow: hidden;
    white-space: nowrap;
}

#word-meaning-display .word {
    display: none;
}

#word-meaning-display .meaning {
    font-size: clamp(40px, 10vw, 80px);
    color: white;
    font-weight: bold;
    white-space: nowrap;
    text-align: center;
    width: 100%;
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', '微软雅黑', '黑体', sans-serif;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateX(0px);
        opacity: 0.3;
    }
    50% {
        transform: translateX(20px);
        opacity: 0.5;
    }
    100% {
        transform: translateX(0px);
        opacity: 0.3;
    }
}

#letter-selector-left,
#letter-selector-right {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
    padding: 0 5px;
    box-sizing: border-box;
    overflow: visible;
}

#cannon {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 35px;
    cursor: pointer;
    position: relative;
    background-image: url('image/pt.png');
    background-size: contain;
    background-position: center bottom;
    background-repeat: no-repeat;
    background-color: transparent;
    z-index: 100;
}

.cannon-letter {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    position: relative;
    z-index: 101;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}

.letter-btn {
    width: 26px;
    height: 26px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    background: transparent;
    background-color: transparent;
    color: white;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    padding: 0;
    margin: 0;
    font-family: Arial, sans-serif;
    min-width: unset;
}

.letter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 1);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
}

.letter-btn.selected {
    background: rgba(255, 255, 255, 0.4);
    background-color: rgba(255, 255, 255, 0.4);
    color: #333;
    border-color: rgba(255, 255, 255, 1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 1);
}

/* 暂停屏幕 - 卡通风格 */
#pause-screen {
    background: linear-gradient(180deg, rgba(255, 200, 100, 0.95) 0%, rgba(255, 150, 100, 0.95) 100%);
}

#pause-screen h1 {
    font-size: 48px;
    color: #fff;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', sans-serif;
    margin-bottom: 50px;
}

/* 游戏结束屏幕 - 卡通风格 */
#game-over-screen {
    background: linear-gradient(180deg, rgba(100, 200, 255, 0.95) 0%, rgba(150, 100, 255, 0.95) 100%);
}

#game-over-screen h1 {
    font-size: 52px;
    color: #fff;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', sans-serif;
    margin-bottom: 30px;
    animation: pulse 2s ease infinite;
}

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

#final-score {
    font-size: 32px;
    margin-bottom: 20px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    font-family: 'Comic Sans MS', sans-serif;
    background: rgba(255,255,255,0.9);
    padding: 20px 40px;
    border-radius: 20px;
    border: 4px solid #FFD700;
}

#mastered-words {
    font-size: 28px;
    margin-bottom: 40px;
    font-weight: bold;
    color: #4ECDC4;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    font-family: 'Comic Sans MS', sans-serif;
    background: rgba(255,255,255,0.9);
    padding: 15px 30px;
    border-radius: 15px;
    border: 3px solid #4ECDC4;
}

/* 通用按钮样式 - 卡通风格 */
button {
    padding: 15px 30px;
    font-size: 20px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px;
    font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', sans-serif;
    font-weight: bold;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

button:hover {
    background: linear-gradient(135deg, #44A08D 0%, #4ECDC4 100%);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

/* 红色按钮 - 返回/退出 */
#back-to-textbook, #quit-btn, #back-to-menu {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
}

#back-to-textbook:hover, #quit-btn:hover, #back-to-menu:hover {
    background: linear-gradient(135deg, #FF8E53 0%, #FF6B6B 100%);
}

/* 继续/重新开始按钮 */
#resume-btn, #restart-btn {
    background: linear-gradient(135deg, #56CCF2 0%, #2F80ED 100%);
}

#resume-btn:hover, #restart-btn:hover {
    background: linear-gradient(135deg, #2F80ED 0%, #56CCF2 100%);
}

/* 单词显示样式 */
.word-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.8);
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-in;
}

.word-display .word {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.word-display .meaning {
    font-size: 16px;
    color: #666;
}

.word-display.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.2);
    }
}
