/**
 * 可用性CSS修复
 * 修复界面布局和响应式问题
 */

/* 关卡选择界面修复 */
#level-select {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    z-index: 1500;
    padding: 20px;
    overflow-y: auto;
}

#level-select .level-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

#level-select h2 {
    color: #ff6b35;
    font-size: 28px;
    margin: 20px 0;
    text-align: center;
}

/* 设置面板修复 */
#settings-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(42, 42, 42, 0.98);
    padding: 30px;
    border: 3px solid #ff6b35;
    border-radius: 8px;
    z-index: 1600;
    min-width: 300px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

#settings-menu h2 {
    color: #ffffff;
    margin-bottom: 20px;
    text-align: center;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin: 15px 0;
    color: #ffffff;
}

.setting-row label {
    font-size: 14px;
    min-width: 80px;
}

.setting-row input[type="range"] {
    width: 150px;
    accent-color: #ff6b35;
    cursor: pointer;
}

/* 暂停菜单修复 */
#pause-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(42, 42, 42, 0.98);
    padding: 30px;
    border: 3px solid #ff6b35;
    border-radius: 8px;
    z-index: 500;
    min-width: 250px;
    display: none;
}

#pause-menu h2 {
    color: #ffffff;
    margin-bottom: 20px;
    text-align: center;
}

#pause-menu button {
    width: 100%;
    min-width: 150px;
    min-height: 44px;
    padding: 12px 20px;
    margin: 8px 0;
    background-color: #3a3a3a;
    color: #ffffff;
    border: 2px solid #666666;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#pause-menu button:hover {
    background-color: #ff6b35;
    border-color: #ff6b35;
    color: #1a1a1a;
}

/* 关卡完成界面修复 */
#level-complete {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(42, 42, 42, 0.98);
    padding: 40px;
    border: 3px solid #ffd700;
    border-radius: 8px;
    z-index: 700;
    min-width: 350px;
    max-width: 90%;
    display: none;
}

#level-complete h2 {
    color: #ffd700;
    font-size: 28px;
    margin-bottom: 20px;
    text-align: center;
}

#level-complete .stats {
    color: #ffffff;
    font-size: 14px;
    margin: 10px 0;
    text-align: left;
    width: 100%;
}

#level-complete .stats div {
    padding: 5px 0;
    border-bottom: 1px solid #444;
}

#level-complete .rating {
    font-size: 48px;
    color: #ffd700;
    margin: 20px 0;
    text-align: center;
}

#level-complete button {
    width: 100%;
    min-width: 150px;
    min-height: 44px;
    padding: 12px 24px;
    margin: 10px 0;
    background-color: #3a3a3a;
    color: #ffffff;
    border: 2px solid #ffd700;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#level-complete button:hover {
    background-color: #ffd700;
    color: #1a1a1a;
}

/* 游戏结束界面修复 */
#game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(42, 42, 42, 0.98);
    padding: 40px;
    border: 3px solid #ff0000;
    border-radius: 8px;
    z-index: 800;
    min-width: 300px;
    max-width: 90%;
    display: none;
}

#game-over h2 {
    color: #ff0000;
    font-size: 32px;
    margin-bottom: 20px;
    text-align: center;
}

#game-over p {
    color: #ffffff;
    font-size: 14px;
    margin: 10px 0;
    text-align: center;
}

#game-over button {
    width: 100%;
    min-width: 150px;
    min-height: 44px;
    padding: 12px 24px;
    margin: 10px 0;
    background-color: #3a3a3a;
    color: #ffffff;
    border: 2px solid #ff0000;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#game-over button:hover {
    background-color: #ff0000;
    color: #ffffff;
}

/* 移动端适配 */
@media (max-width: 768px) {
    #main-menu h1 {
        font-size: 24px;
        margin-bottom: 30px;
    }

    #main-menu button {
        width: 80%;
        max-width: 280px;
        font-size: 16px;
        padding: 14px 24px;
    }

    #pause-menu,
    #settings-menu,
    #level-complete,
    #game-over {
        width: 90%;
        max-width: 350px;
        padding: 20px;
    }

    #settings-menu h2,
    #pause-menu h2,
    #level-complete h2,
    #game-over h2 {
        font-size: 20px;
    }

    .setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .setting-row input[type="range"] {
        width: 100%;
    }

    #level-complete .rating {
        font-size: 36px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 360px) {
    #main-menu h1 {
        font-size: 20px;
    }

    #main-menu button {
        font-size: 14px;
        padding: 12px 20px;
    }

    #pause-menu,
    #settings-menu,
    #level-complete,
    #game-over {
        width: 95%;
        padding: 15px;
    }
}

/* PC端优化 */
@media (min-width: 769px) {
    .touch-hint {
        display: none;
    }

    #pause-menu,
    #settings-menu,
    #level-complete,
    #game-over {
        min-width: 400px;
    }
}

/* 确保所有菜单都在正确的z-index层级 */
#loading-screen { z-index: 9999; }
#main-menu { z-index: 1000; }
#level-select { z-index: 1500; }
#settings-menu { z-index: 1600; }
#pause-menu { z-index: 500; }
#level-complete { z-index: 700; }
#game-over { z-index: 800; }
#toast-container { z-index: 400; }
.touch-hint { z-index: 100; }

/* 修复按钮在所有设备上的触控区域 */
button,
a {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 防止文本选择和默认行为 */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 隐藏滚动条但保持功能 */
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
