/**
 * 化学贪吃蛇 - 样式表
 */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: #0a0a12;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    font-family: "Microsoft YaHei", "SimHei", "Noto Sans CJK SC", sans-serif;
    -webkit-font-smoothing: antialiased;
}

#gameCanvas {
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.2);
    background-color: #141928;
    user-select: none;
    max-width: 100vw;
    max-height: 100vh;
}

/* 虚拟摇杆 */
#joystick-zone {
    position: fixed;
    bottom: 50px;
    left: 50px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: none;
    z-index: 100;
    touch-action: none;
}

.joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 255, 255, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    pointer-events: none;
}

#mobile-hint {
    position: fixed;
    bottom: 180px;
    left: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    display: none;
}

/* 设置面板 */
#settings-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
}

#settings-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
    outline: none;
}

#settings-btn:hover,
#settings-btn:focus {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

#settings-btn:focus-visible {
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.5);
}

#settings-panel {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    width: 220px;
    background: rgba(20, 25, 40, 0.95);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    color: white;
}

.setting-item {
    margin-bottom: 12px;
}

.setting-item label {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
    color: #ccc;
}

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

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: #555;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.3s;
    float: right;
    margin-top: -22px;
}

.toggle-switch.active {
    background-color: #00ffcc;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: 0.3s;
}

.toggle-switch.active::after {
    left: 22px;
}

/* 模态框动画 */
.modal-overlay {
    backdrop-filter: blur(4px);
}

/* 响应式 */
@media (max-width: 820px) {
    #gameCanvas {
        width: 100vw;
        height: 100vw;
    }
}

@media (max-height: 820px) {
    #gameCanvas {
        width: 100vh;
        height: 100vh;
    }
}
