
    * { box-sizing: border-box; user-select: none; }
    body {
        margin: 0;
        background: linear-gradient(135deg, #0f0f0f, #1a1a1a);
        font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        min-height: 100vh;
        color: white;
    }
    #container {
        display: flex;
        gap: 20px;
        margin-top: 20px;
        flex-wrap: wrap;
        justify-content: center;
    }
    canvas {
        background: #111;
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
        display: block;
        width: 400px;
        height: 400px;
        flex-shrink: 0;
    }
    #foodLegend {
        min-width: 300px;
        display: none;
        background: rgba(20, 20, 20, 0.7);
        backdrop-filter: blur(4px);
        padding: 16px 20px;
        border-radius: 20px;
        box-shadow: 0 8px 20px rgba(0,0,0,0.5);
        height: fit-content;
    }
    .foodItem {
        display: flex;
        align-items: center;
        margin: 10px 0;
        font-size: 14px;
    }
    .foodColor {
        width: 22px;
        height: 22px;
        border-radius: 8px;
        margin-right: 12px;
        box-shadow: 0 2px 6px rgba(255,255,255,0.1);
    }
    .menu, .gameover, .settings {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(5px);
        z-index: 20;
    }
    button {
        padding: 10px 24px;
        margin: 8px;
        border: none;
        border-radius: 40px;
        background: #2a2a2a;
        color: white;
        cursor: pointer;
        font-size: 18px;
        font-weight: 500;
        min-width: 140px;
        transition: 0.2s;
        border: 1px solid #3f3f3f;
    }
    button:hover {
        background: #3d3d3d;
        transform: scale(1.02);
        border-color: #777;
    }
    button.small {
        font-size: 14px;
        min-width: 80px;
        padding: 5px 10px;
    }
    .settingsCard {
        background: #1e1e1e;
        padding: 30px 35px;
        border-radius: 30px;
        box-shadow: 0 20px 40px rgba(0,0,0,0.8);
        min-width: 300px;
        border: 1px solid #333;
    }
    .settingsCard h2 { margin-top: 0; text-align: center; color: #ddd; }
    .settingRow {
        margin: 18px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 20px;
    }
    select, input[type=color] {
        border-radius: 30px;
        border: 1px solid #444;
        padding: 6px 12px;
        background: #2c2c2c;
        color: white;
        font-size: 15px;
    }
    input[type=color] { width: 60px; height: 40px; padding: 2px; }
    #menuSnakeCanvas {
        background: #0a0a0a;
        border-radius: 30px;
        margin: 10px 0 20px;
        opacity: 0.9;
    }
    #goScore { font-size: 28px; font-weight: bold; color: #ffaa00; }
    #title {
        font-size: 56px;
        margin: 0 0 10px;
        letter-spacing: 4px;
        background: linear-gradient(45deg, #b3ff9b, #a0d8ff);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    /* 成就弹窗 */
    .achievement-popup {
        position: fixed;
        top: 20px;
        right: 20px;
        background: rgba(0,0,0,0.85);
        border-left: 5px solid gold;
        border-radius: 12px;
        padding: 16px 24px;
        color: white;
        font-size: 20px;
        font-weight: bold;
        box-shadow: 0 5px 20px rgba(255,215,0,0.3);
        z-index: 100;
        animation: slideIn 0.5s ease-out;
        pointer-events: none;
    }
    @keyframes slideIn {
        from { transform: translateX(100%); opacity: 0; }
        to { transform: translateX(0); opacity: 1; }
    }

    /* AI模式开关 */
    .ai-toggle-container {
        margin-top: 20px;
        padding: 10px;
        background: #2a2a2a;
        border-radius: 30px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .ai-toggle-label {
        font-size: 14px;
        color: #ddd;
        margin-right: 10px;
    }
    .toggle-switch {
        position: relative;
        display: inline-block;
        width: 50px;
        height: 24px;
    }
    .toggle-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }
    .slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: #555;
        transition: 0.4s;
        border-radius: 24px;
    }
    .slider:before {
        position: absolute;
        content: "";
        height: 18px;
        width: 18px;
        left: 3px;
        bottom: 3px;
        background-color: white;
        transition: 0.4s;
        border-radius: 50%;
    }
    input:checked + .slider {
        background-color: #4caf50;
    }
    input:checked + .slider:before {
        transform: translateX(26px);
    }
    .high-score {
        font-size: 14px;
        color: gold;
        margin-top: 10px;
    }

    /* 作弊面板 */
    #cheatPanel {
        margin-top: 20px;
        border-top: 1px solid #444;
        padding-top: 15px;
        display: none;
    }
    #cheatPanel h4 {
        margin: 0 0 10px;
        color: #ffaa00;
        text-align: center;
    }
    .cheat-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: 8px 0;
        gap: 10px;
    }
    .cheat-row label {
        font-size: 14px;
    }
    .cheat-row input[type="checkbox"] {
        transform: scale(1.2);
    }
    .cheat-row select {
        width: 100px;
        padding: 4px;
    }
    .cheat-buttons {
        display: flex;
        gap: 5px;
        flex-wrap: wrap;
        justify-content: center;
    }
