/* style.css */
body {
    margin: 0;
    overflow: hidden;
    background: #000;
    font-family: Arial, sans-serif;
    color: white;
}

#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#gameCanvas {
    background: black;
}

#ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px;
    pointer-events: none;
}

#statusBar {
    position: absolute;
    bottom: 20px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
}



/* 排行榜模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background-color: #222;
    margin: 5% auto;
    padding: 20px;
    border: 2px solid #444;
    width: 80%;
    max-width: 600px;
    color: white;
    border-radius: 10px;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: white;
}

/* 排行榜表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

th, td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #444;
}

th {
    background-color: #333;
}

tr:hover {
    background-color: #333;
}

.highlight {
    color: #FFD700;
    font-weight: bold;
}

/* 按钮样式 */
button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 5px;
}

button:hover {
    background-color: #45a049;
}

input[type="text"] {
    padding: 8px;
    margin: 5px 0;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #333;
    color: white;
}

/* 设置面板样式 */
.tabs {
    overflow: hidden;
    border: 1px solid #444;
    background-color: #333;
    margin-bottom: 10px;
}

.tablinks {
    background-color: inherit;
    float: left;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 10px 16px;
    transition: 0.3s;
    color: white;
}

.tablinks:hover {
    background-color: #555;
}

.tablinks.active {
    background-color: #4CAF50;
}

.tabcontent {
    display: none;
    padding: 6px 12px;
    border: 1px solid #444;
    border-top: none;
    min-height: 200px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.setting-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.setting-item label {
    width: 150px;
    color: #DDD;
}

.setting-input {
    padding: 5px;
    background-color: #333;
    color: white;
    border: 1px solid #555;
}

.setting-input[type="number"] {
    width: 60px;
}

.powerup-probabilities {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.settings-footer {
    text-align: right;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #444;
}

/* 关卡编辑器样式 */
.editor-tools {
    background-color: #333;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
}

.brush-types, .brush-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
    align-items: center;
}

.brush-types button, .brush-sizes button {
    padding: 5px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.brush-types button.active {
    transform: scale(1.1);
    box-shadow: 0 0 5px #fff;
}

.brush-types button[data-type="green"] {
    background-color: #00FF00;
}

.brush-types button[data-type="yellow"] {
    background-color: #FFFF00;
}

.brush-types button[data-type="red"] {
    background-color: #FF0000;
    color: white;
}

.brush-types button[data-type="gray"] {
    background-color: #808080;
}

.brush-types button[data-type="powerup"] {
    background-color: #FF00FF;
}

.brush-types button[data-type="erase"] {
    background-color: #333;
    color: white;
    border: 1px solid #666;
}

.editor-actions {
    display: flex;
    gap: 10px;
}

.level-props {
    background-color: #333;
    padding: 10px;
    margin-top: 10px;
    border-radius: 5px;
}

.level-props label {
    display: inline-block;
    margin-right: 15px;
    color: #ddd;
}

.level-props input[type="text"],
.level-props input[type="number"] {
    padding: 5px;
    background-color: #222;
    color: white;
    border: 1px solid #444;
    border-radius: 3px;
}

.level-props input[type="number"] {
    width: 50px;
}

/* 关卡列表样式 */
.level-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.level-item {
    background-color: #333;
    padding: 10px;
    border-radius: 5px;
}

.level-item h3 {
    margin-top: 0;
    color: #4CAF50;
}

.level-item p {
    color: #ddd;
    margin: 5px 0;
}

.level-item button {
    margin-right: 5px;
    padding: 3px 8px;
}
/* 基础样式 */
body {
    margin: 0;
    padding: 0;
    background-color: #000;
    color: #FFF;
    font-family: Arial, sans-serif;
    overflow: hidden;
    touch-action: manipulation;
}

#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 控制栏样式 */
.control-bar {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background-color: #222;
    z-index: 10;
}

.control-bar button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.control-bar button:hover {
    background-color: #45a049;
}

/* 游戏画布 */
#gameCanvas {
    flex: 1;
    width: 100%;
    background-color: #000;
    display: block;
}

/* 状态栏 */
.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background-color: #222;
    font-size: 16px;
    z-index: 10;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
}

.modal-content {
    background-color: #222;
    margin: 5% auto;
    padding: 20px;
    border: 2px solid #444;
    width: 80%;
    max-width: 600px;
    border-radius: 10px;
    position: relative;
}

.close {
    color: #aaa;
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: white;
}

/* 标签页样式 */
.tabs {
    overflow: hidden;
    border: 1px solid #444;
    background-color: #333;
    margin-bottom: 10px;
}

.tablinks {
    background-color: inherit;
    float: left;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 10px 16px;
    transition: 0.3s;
    color: white;
}

.tablinks:hover {
    background-color: #555;
}

.tablinks.active {
    background-color: #4CAF50;
}

.tabcontent {
    display: none;
    padding: 6px 12px;
    border: 1px solid #444;
    border-top: none;
    min-height: 200px;
}

/* 关卡列表 */
.level-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.level-item {
    background-color: #333;
    padding: 15px;
    border-radius: 5px;
}

.level-item h3 {
    margin-top: 0;
    color: #4CAF50;
}

.level-item p {
    color: #ddd;
    margin: 5px 0 10px;
}

.level-item button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
}

.level-item button:hover {
    background-color: #45a049;
}

/* 移动端适配 */
@media (max-width: 600px) {
    .modal-content {
        width: 90%;
        margin: 10% auto;
    }
    
    .level-list {
        grid-template-columns: 1fr;
    }
    
    .control-bar button {
        padding: 8px 10px;
        font-size: 14px;
    }
}
/* ===== 新增的样式部分 ===== */

/* 游戏元素基础样式 */
#gameCanvas {
    touch-action: none; /* 禁用触摸默认行为，防止页面滚动 */
    margin-bottom: 80px;  /* 移动端弹力板距离底部距离 */
}

/* 弹力板样式 */
.paddle {
    position: absolute;
    background-color: #FFFFFF;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* 弹力球样式 */
.ball {
    position: absolute;
    background-color: #FFFFFF;
    border-radius: 50%;
}

/* 重型弹力球闪烁动画 */
@keyframes heavyBallFlash {
    0% { background-color: #FFFFFF; }
    50% { background-color: #FF0000; }
    100% { background-color: #FFFFFF; }
}

.ball-heavy {
    animation: heavyBallFlash 0.4s infinite;
}

/* 道具样式 */
.powerup {
    position: absolute;
    border-radius: 50%;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
}

/* 砖块颜色定义 */
.brick-gray { background-color: #808080; }
.brick-green { background-color: #00FF00; }
.brick-yellow { background-color: #FFFF00; }
.brick-red { background-color: #FF0000; }
.brick-powerup {
     background-color: #FF00FF; 
     position: relative;
     overflow: hidden;
 }
 
 .brick-powerup::after {
     content: '';
     position: absolute;
     left: -50%;
     top: -50%;
     width: 200%;
     height: 200%;
     background: linear-gradient(
         to top right,
         rgba(255,255,255,0) 45%,
         rgba(255,255,255,0.8) 50%,
         rgba(255,255,255,0) 55%
     );
     transform: rotate(45deg);
     animation: powerupGlow 2s infinite;
 }
 
 @keyframes powerupGlow {
     0% { transform: translate(-50%, -50%) rotate(45deg); }
     100% { transform: translate(50%, 50%) rotate(45deg); }
 }

/* 游戏状态提示 */
.game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    z-index: 100;
}

/* 道具激活提示 */
.powerup-active {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 14px;
    z-index: 90;
}

/* 分数特效 */
.score-effect {
    position: absolute;
    color: #FFD700;
    font-size: 18px;
    font-weight: bold;
    animation: scoreFloat 1s ease-out forwards;
    z-index: 80;
}

@keyframes scoreFloat {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-50px); }
}

/* 移动端专用样式 */
@media (max-width: 768px) {
    /* 调整控制按钮大小 */
    .control-bar button {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    /* 缩小状态栏字体 */
    .status-bar {
        font-size: 14px;
        padding: 8px;
    }
    
    /* 调整模态框大小 */
    .modal-content {
        width: 95%;
        margin: 20% auto;
        padding: 15px;
    }
    
    /* 关卡列表单列显示 */
    .level-list {
        grid-template-columns: 1fr;
    }
    
    /* 编辑器工具按钮调整 */
    .editor-tools button {
        padding: 6px 8px;
        font-size: 14px;
    }
}

/* 横屏优化 */
@media (max-height: 500px) {
    .control-bar {
        padding: 5px;
    }
    
    .status-bar {
        padding: 5px;
        font-size: 12px;
    }
    
    .modal-content {
        max-height: 80vh;
        overflow-y: auto;
    }
}

/* 高分特效 */
.high-score {
    color: #FFD700;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.7);
}

/* 弹力板吸附状态指示 */
.paddle-sticky {
    box-shadow: 0 0 10px #FF00FF;
}

/* 大球状态 */
.ball-large {
    transform: scale(2);
    transition: transform 0.3s ease;
}

/* 道具颜色定义 */
.powerup-type1 { background-color: #FF0000; } /* 增加球 */
.powerup-type2 { background-color: #00FF00; } /* 加速 */
.powerup-type3 { background-color: #0000FF; } /* 减速 */
.powerup-type4 { background-color: #FFFFFF; } /* 重型球 */
.powerup-type5 { background-color: #FFFF00; } /* 加长板 */
.powerup-type6 { background-color: #FFA500; } /* 缩短板 */
.powerup-type7 { background-color: #FF00FF; } /* 吸附 */
.powerup-type8 { background-color: #00FFFF; } /* 球变大 */
.powerup-type9 { background-color: #FFFFFF; } /* 备用球 */
.powerup-type10 { background-color: #FFD700; } /* 发光方块 */

/* 加载动画 */
.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #FFFFFF;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 触摸控制区域（移动端专用） */
.touch-controls {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 50;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.touch-controls:hover {
    opacity: 1;
}

.touch-btn {
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    user-select: none;
}

/* 关卡编辑器网格线 */
.grid-line {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.1);
}

/* 砖块生命值显示 */
.brick-health {
    position: absolute;
    color: white;
    font-weight: bold;
    text-align: center;
    font-size: 12px;
}

/* 重型球剩余次数显示 */
.heavy-ball-count {
    position: absolute;
    color: black;
    font-weight: bold;
    text-align: center;
    font-size: 10px;
}

/* 弹力板长度变化动画 */
@keyframes paddleResize {
    0% { width: var(--original-width); }
    100% { width: var(--target-width); }
}

.paddle-resizing {
    animation: paddleResize 0.5s forwards;
}
/* 计时器样式 */
#timerDisplay {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 18px;
    color: #00FF00;
    z-index: 90;
}

/* 点赞按钮样式 */
/* 点赞按钮样式 */
.like-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.like-btn.liked {
    background-color: #f44336;
}

.like-btn:disabled {
    background-color: #9E9E9E;
    cursor: not-allowed;
}

.like-count {
    display: inline-block;
    min-width: 20px;
    text-align: center;
    margin-right: 5px;
}


.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    z-index: 100;
}

/* 移动端调整 */
@media (max-width: 768px) {
    .status-bar {
        font-size: 14px;
        padding: 0 10px;
    }
    
    #timerDisplay {
        font-size: 16px;
        top: 5px;
    }
}


/* 道具提示样式 */
.powerup-notification {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #FFD700;
    padding: 5px 15px;
    border-radius: 20px;
    z-index: 200;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* 计时器样式 */
#timerDisplay {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #FFFFFF;
    padding: 5px 15px;
    border-radius: 20px;
    font-family: monospace;
    z-index: 100;
}

/* 排行榜标签样式 */
.leaderboard-tabs {
    display: flex;
    justify-content: center;
    margin: 10px 0;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
}

.tab-btn {
    background-color: transparent;
    color: white;
    border: none;
    padding: 5px 15px;
    margin: 16 5px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.tab-btn.active {
    background-color: #4CAF50;
    font-weight: bold;
}

/* 速通榜时间显示 */
.time-record {
    font-family: monospace;
}

/* 弹力板位置调整 */
#gameCanvas {
    margin-bottom: 80px;
}

.paddle {
    position: absolute;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
}
/* 主菜单样式 */
#mainMenu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    border: 2px solid #4CAF50;
    border-radius: 10px;
    z-index: 1000;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

#mainMenu .modal-content {
    padding: 20px;
    color: white;
}

#mainMenu button {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

#mainMenu button:hover {
    background-color: #45a049;
}

.admin-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #444;
}

/* 编辑器样式 */
#editorCanvas {
    background-color: #111;
    display: block;
    margin: 0 auto;
    cursor: crosshair;
}

.editor-controls {
    padding: 10px;
    background-color: #222;
    color: white;
}

.editor-controls label {
    display: block;
    margin: 5px 0;
}

.editor-controls select, 
.editor-controls input {
    padding: 5px;
    margin-bottom: 10px;
    width: 100%;
}

.editor-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.editor-buttons button {
    padding: 8px 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    flex: 1;
}

.editor-buttons button:hover {
    background-color: #45a049;
}

/* 设置页面样式 */
.settings-form {
    padding: 20px;
    color: white;
}

.settings-form label {
    display: block;
    margin: 10px 0 5px;
}

.settings-form input {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    box-sizing: border-box;
}

.powerup-type {
    margin: 15px 0;
    padding: 10px;
    background-color: #333;
    border-radius: 5px;
}

.powerup-type label {
    display: inline-block;
    margin-right: 10px;
}

.powerup-slider {
    width: 100%;
}

.settings-buttons {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.settings-buttons button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    flex: 1;
}

#saveBtn {
    background-color: #4CAF50;
    color: white;
}

#backBtn {
    background-color: #f44336;
    color: white;
}
#menuBtn, #leaderboardBtn {
    position: fixed;
    z-index: 1000;
    background: rgba(0,0,0,0.7);
    color: white;
    border: 1px solid #4CAF50;
    padding: 5px 10px;
}
#menuBtn {
    top: 10px;
    left: 10px;
}
#leaderboardBtn {
    top: 10px;
    right: 10px;
}
/* 确保模态框和按钮可见 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    display: none;
}

.modal-content {
    background: #222;
    margin: 50px auto;
    padding: 20px;
    width: 80%;
    max-width: 600px;
    border-radius: 10px;
}

.level-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    background: #333;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.level-btn:hover {
    background: #444;
}
/* 响应式弹力板设置 */
.paddle {
    height: var(--paddle-height); /* 通过JS动态设置 */
}

/* 游戏结束样式 */
.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-over-content {
    background: #333;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

/* 排行榜标签切换 */
.tab-btn.active {
    background: #4CAF50;
}
/* 确保按钮可见 */
#menuBtn, #leaderboardBtn {
    position: fixed;
    z-index: 1000;
    padding: 10px 15px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: 1px solid #4CAF50;
    cursor: pointer;
}

#menuBtn {
    top: 10px;
    left: 10px;
}

#leaderboardBtn {
    top: 10px;
    right: 10px;
}

/* 游戏结束模态框 */
.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-over-content {
    background: #333;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.game-over-content button {
    margin: 10px;
    padding: 8px 15px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
/* 确保按钮可见 */
#menuBtn, #leaderboardBtn {
    position: fixed;
    z-index: 1000;
    padding: 10px 15px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: 1px solid #4CAF50;
    cursor: pointer;
    font-size: 16px;
}

#menuBtn {
    top: 10px;
    left: 10px;
}

#leaderboardBtn {
    top: 10px;
    right: 10px;
}

/* 游戏结束模态框 */
.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-over-content {
    background: #333;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    width: 80%;
    max-width: 400px;
}

.game-over-content h2 {
    color: #FF5252;
    margin-bottom: 20px;
}

.game-over-content button {
    margin: 10px;
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.game-over-content button:hover {
    background: #45a049;
}
/* 确保按钮始终可见且可点击 */
#menuBtn, #leaderboardBtn {
    position: fixed;
    z-index: 1000;
    padding: 10px 15px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: 1px solid #4CAF50;
    cursor: pointer;
    font-size: 16px;
    border-radius: 4px;
}

#menuBtn {
    top: 10px;
    left: 10px;
}

#leaderboardBtn {
    top: 10px;
    right: 10px;
}

/* 防止按钮被画布覆盖 */
#gameCanvas {
    z-index: 1;
}
/* 排行榜样式修复 */
.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin: 4px 0;
    background: rgba(0,0,0,0.7);
    border-radius: 4px;
}

.leaderboard-item > * {
    margin: 0 5px;
}

.rank {
    width: 30px;
    font-weight: bold;
    color: gold;
}

.name {
    width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.country select {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 2px;
}

.likes {
    display: flex;
    align-items: center;
}

.like-btn {
    background: none;
    border: 1px solid #4CAF50;
    color: white;
    margin-left: 5px;
    cursor: pointer;
}

/* 道具下落动画 */
.powerup {
    transition: transform 0.3s ease-out;
}
/* 游戏结束模态框样式 */
.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-over-content {
    background: #333;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.game-over-content h2 {
    color: #FF5252;
    margin-bottom: 20px;
}

.input-group {
    margin: 20px 0;
}

.input-group input {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background: #222;
    color: white;
    border: 1px solid #444;
    border-radius: 4px;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.button-group button {
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

#submitScore {
    background: #4CAF50;
    color: white;
}

#restartGame {
    background: #2196F3;
    color: white;
}

#backToMenu {
    background: #f44336;
    color: white;
}
/* 点赞按钮样式 */
.like-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.like-btn.liked {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* 随机关卡生成按钮 */
.generate-btn {
    display: block;
    width: 80%;
    margin: 20px auto;
    padding: 10px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.no-levels {
    text-align: center;
    padding: 20px;
    color: #666;
}
/* 关卡按钮样式 */
.level-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 5px 0;
    background: #444;
    color: white;
    border: none;
    border-radius: 4px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.level-btn:hover {
    background: #555;
    transform: translateX(5px);
}

.level-btn small {
    display: block;
    color: #aaa;
    font-size: 0.8em;
    margin-top: 3px;
}

.random-btn {
    background: #4a6fa5 !important;
    text-align: center !important;
    font-weight: bold;
}

.random-btn:hover {
    background: #5b7bb5 !important;
}
/* 添加在style.css中 */
.generate-random-btn {
    position: absolute;
    left: 20px;
    bottom: 20px;
    padding: 10px 15px;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.generate-random-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}

.generate-random-btn span {
    margin-right: 8px;
    font-size: 18px;
}
/* 关卡选择模态框 */
#levelSelectModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: none;
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #333;
    border-radius: 10px;
    width: 80%;
    max-width: 600px;
    padding: 20px;
    color: white;
    position: relative;
}

.tab-buttons {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #555;
}

.tab-btn {
    background: none;
    border: none;
    color: #aaa;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 16px;
}

.tab-btn.active {
    color: #fff;
    border-bottom: 2px solid #4CAF50;
}

.tab-content {
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

.level-list {
    margin-bottom: 15px;
}

.level-item {
    padding: 10px;
    margin: 5px 0;
    background: #444;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.level-item:hover {
    background: #555;
    transform: translateX(5px);
}

.no-levels {
    color: #888;
    text-align: center;
    padding: 20px;
}

.generate-btn {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
    transition: all 0.3s;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.generate-btn span {
    margin-right: 8px;
    font-size: 18px;
}

/* 新增确保按钮可见的样式 */
#menuBtn, #leaderboardBtn, #soundToggle {
    position: fixed;
    z-index: 1000;
    padding: 10px 15px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: 1px solid #4CAF50;
    cursor: pointer;
    font-size: 16px;
    border-radius: 4px;
}
#menuBtn {
    top: 10px;
    left: 10px;
}
#leaderboardBtn {
    top: 10px;
    right: 10px;
}
#soundToggle {
    top: 10px;
    left: 120px;
    font-size: 20px;
}
#gameCanvas {
    z-index: 1;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1001;
}

.modal-content {
    background: #333;
    margin: 10% auto;
    padding: 20px;
    width: 80%;
    max-width: 500px;
    border-radius: 5px;
    color: white;
    position: relative;
}

/* 模态框关闭按钮 */
.modal .close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: white;
}

/* 选项卡样式 */
.tabs {
    display: flex;
    margin-bottom: 15px;
}

.tab-btn {
    padding: 8px 15px;
    background: #555;
    color: white;
    border: none;
    cursor: pointer;
}

.tab-btn.active {
    background: #4CAF50;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 彩色方块特效 */
@keyframes powerupGlow {
    0% { box-shadow: 0 0 5px #FF00FF; }
    50% { box-shadow: 0 0 20px #FF00FF; }
    100% { box-shadow: 0 0 5px #FF00FF; }
}

@keyframes powerupShine {
    0% { background-position: -100% -100%; }
    100% { background-position: 100% 100%; }
}

/* 道具消息样式 */
.powerup-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 5px;
    z-index: 1002;
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* 状态栏样式 */
#statusBar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px;
    display: flex;
    justify-content: space-around;
    z-index: 1000;
}
.level-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.tab-btn {
    padding: 8px 15px;
    background: #555;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.tab-btn.active {
    background: #4CAF50;
}

.generate-btn {
    padding: 8px 15px;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}
/* 选项卡样式 */
.level-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 15px;
    background: #555;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #4CAF50;
}

.generate-btn {
    padding: 8px 15px;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* 关卡列表样式 */
.level-list {
    display: grid;
    gap: 10px;
}

.level-item {
    padding: 12px;
    background: #444;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.level-item:hover {
    background: #555;
    transform: translateX(3px);
}

.level-item h3 {
    margin: 0 0 5px;
    color: #4CAF50;
}

.level-item p {
    margin: 0;
    color: #aaa;
    font-size: 0.9em;
}

.delete-btn {
    margin-top: 8px;
    padding: 4px 8px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

/* 加载动画 */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 移动端优化 */
@media (max-width: 768px) {
    .level-tabs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .generate-btn {
        margin-top: 10px;
    }
}
.level-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 15px;
    background: #555;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.tab-btn.active {
    background: #4CAF50;
}

.generate-btn {
    padding: 8px 15px;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.level-item {
    padding: 12px;
    background: #444;
    border-radius: 5px;
    margin-bottom: 10px;
    cursor: pointer;
}

.level-item h3 {
    margin: 0 0 5px;
    color: #4CAF50;
}

.level-item p {
    margin: 0;
    color: #aaa;
    font-size: 0.9em;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

#emergencyBall {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    display: none;
    z-index: 100;
}

.powerup-messages {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 10px;
}

.powerup-message {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    animation: messageFadeIn 0.3s;
    max-width: 80vw;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

@keyframes messageFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.game-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    z-index: 1001;
    animation: alertFadeIn 0.3s;
    max-width: 80%;
    text-align: center;
}

.fade-out {
    animation: alertFadeOut 0.3s forwards;
}

@keyframes alertFadeIn {
    from { opacity: 0; transform: translate(-50%, -40px); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

@keyframes alertFadeOut {
    to { opacity: 0; transform: translate(-50%, -60px); }
}
.game-message {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    margin-bottom: 10px;
    text-align: center;
    transition: opacity 0.5s;
    animation: messageIn 0.3s;
}

@keyframes messageIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
#messageContainer {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    z-index: 100;
}

#messageContainer .level-complete {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
/* 按钮组样式 */
.button-group {
    margin: 15px 0;
    text-align: center;
}

.generate-btn {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* 选项卡样式 */
.tabs {
    display: flex;
    margin-bottom: 10px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: #646464;
    color: rgb(255, 255, 255);
    cursor: pointer;
}

.tab-btn.active {
    background: #00b7ff;
}

/* 关卡列表样式 */
.tab-content {
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

.level-item {
    padding: 10px;
    margin: 5px 0;
    background: #444;
    border-radius: 5px;
    cursor: pointer;
}

.level-item:hover {
    background: #555;
}

.no-levels {
    text-align: center;
    color: #999;
    padding: 20px;
}
/* 防止菜单重叠 */
.modal {
    z-index: 1000;
}

/* 游戏结束菜单样式 */
#gameOverModal {
    background: rgba(0, 0, 0, 0.8);
}

#gameOverModal input {
    display: block;
    margin: 10px auto;
    padding: 8px;
    width: 80%;
}
/* 防止菜单闪烁 */
#mainMenu, #leaderboardModal, #gameOverModal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

/* 按钮响应优化 */
button {
    min-width: 120px;
    padding: 10px;
    margin: 5px;
    transition: all 0.2s;
}

button:active {
    transform: scale(0.95);
}

/* 输入框样式 */
input[type="text"] {
    padding: 8px;
    margin: 5px 0;
    width: 80%;
}
/* 防止按钮多次点击 */
button {
    transition: transform 0.2s;
}

button:active {
    transform: scale(0.95);
}

/* 游戏结束菜单层级 */
#gameOverModal {
    z-index: 1001;
}

/* 输入框样式 */
input {
    padding: 8px;
    margin: 5px 0;
    width: 80%;
    display: block;
    margin-left: auto;
    margin-right: auto;
}
/* 游戏结束菜单样式 */
#gameOverModal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 400px;
    z-index: 1001;
}

#gameOverModal input {
    display: block;
    width: 90%;
    margin: 10px auto;
    padding: 8px;
    border: none;
    border-radius: 4px;
}

#gameOverModal button {
    margin: 5px;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    background: #4CAF50;
    color: white;
    cursor: pointer;
}

/* 关卡选择样式 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.level-item {
    padding: 10px;
    margin: 5px;
    background: #333;
    border-radius: 5px;
    cursor: pointer;
}

.level-item:hover {
    background: #444;
}