* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    /* 移除移动端点击高亮蓝框 */
    -webkit-tap-highlight-color: transparent; 
}

body {
    background-color: #1a1a1a;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
    overflow-y: auto; /* 允许在小屏幕上垂直滚动查看参数 */
    padding: 10px;
}

/* 🚀 核心响应式容器优化 */
.game-wrapper {
    display: flex;
    flex-direction: row; /* 默认横向排列 */
    background: #2c2c2c;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    border: 4px solid #3d3d3d;
    gap: 20px;
    max-width: 100%;
    align-items: flex-start;
}

.canvas-container {
    position: relative;
    border: 4px solid #000;
    border-radius: 4px;
    overflow: hidden;
    background: #4ec0ca;
    /* 优化移动端：阻止双击缩放页面的原生怪癖 */
    touch-action: manipulation; 
}

canvas {
    display: block;
    image-rendering: pixelated; /* 强制像素锯齿锐化，防止模糊 */
    max-width: 100%;
    height: auto;
}

/* UI 叠加层 */
.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.nickname-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0,0,0,0.6);
    border: 2px solid #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    cursor: pointer;
}

.nickname-badge input {
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 10px;
    width: 120px;
    outline: none;
}

.mute-btn {
    position: absolute;
    top: 55px;
    left: 15px;
    background: rgba(0,0,0,0.6);
    border: 2px solid #fff;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    pointer-events: auto;
    font-size: 16px;
}

/* 右侧控制面板 */
.control-panel {
    width: 320px;
    background: #222;
    border: 3px solid #000;
    border-radius: 8px;
    padding: 20px;
    flex-shrink: 0;
}

.panel-title {
    font-size: 14px;
    text-align: center;
    margin-bottom: 20px;
    color: #f4c430;
    border-bottom: 2px dashed #444;
    padding-bottom: 10px;
}

.control-group {
    margin-bottom: 18px;
}

.control-label {
    font-size: 9px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: #aaa;
}

.control-label span {
    color: #fff;
}

.slider-input {
    width: 100%;
    height: 8px;
    background: #444;
    outline: none;
    border: 1px solid #000;
    cursor: pointer;
    -webkit-appearance: none;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #5c3;
    border: 2px solid #000;
}

.btn {
    width: 100%;
    padding: 12px;
    font-family: inherit;
    font-size: 11px;
    border: 3px solid #000;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: bold;
    transition: transform 0.1s;
    text-align: center;
}

.btn-ai { background: #444; color: #fff; border-color: #555; }
.btn-ai.active {
    background: #0bc;
    color: #000;
    border-color: #000;
    box-shadow: inset 0 -4px rgba(0,0,0,0.2);
}
.btn-apply { background: #5c3; color: #000; }
.btn-reset { background: #e23; color: #fff; }
.btn:active { transform: scale(0.98); }

/* AI 仪表盘面板 */
.ai-hud-panel {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 3px dashed #444;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.hud-title {
    font-size: 11px;
    color: #0ff;
    text-align: center;
    margin-bottom: 4px;
    letter-spacing: 1px;
}
.hud-row {
    font-size: 9px;
    color: #aaa;
    display: flex;
    justify-content: space-between;
}
.hud-row span {
    color: #fff;
    font-weight: bold;
}

/* 📱 跨端发布核心：当 Itch.io 窗口宽度低于 820px 时，自动切换为垂直精美排版 */
@media (max-width: 820px) {
    body {
        align-items: flex-start;
        overflow-y: auto;
    }
    .game-wrapper {
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding: 12px;
    }
    .control-panel {
        width: 100%; /* 面板拉满适应屏幕 */
        max-width: 450px;
    }
}