body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(
        to right,
        violet,
        indigo,
        blue,
        green,
        yellow,
        orange,
        red
    );
    background-size: 200% 200%;
    animation: rainbow 10s ease infinite;
    color: #f0f0f0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

@keyframes rainbow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(66, 134, 244, 0.05) 0%, rgba(0, 0, 0, 0) 70%);
    pointer-events: none;
    z-index: 1;
}

.game-container {
    background: rgba(43, 43, 43, 0.95);
    padding: 40px;
    border-radius: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4),
                inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    max-width: 800px;
    width: 100%;
    position: relative;
    z-index: 2;
    animation: container-appear 0.6s ease-out;
}

@keyframes container-appear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#game-board {
    display: grid;
    grid-template-columns: repeat(20, 25px);
    grid-template-rows: repeat(20, 25px);
    gap: 3px;
    background: linear-gradient(145deg, #2b2b2b 0%, #1f1f1f 100%);
    padding: 15px;
    border-radius: 20px;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.05);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.cell {
    width: 25px;
    height: 25px;
    background: linear-gradient(145deg, #3c3c3c 0%, #323232 100%);
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.snake {
    background: linear-gradient(145deg, #76c7c0 0%, #5aa9a3 100%);
    position: relative;
    box-shadow: 0 0 15px rgba(118, 199, 192, 0.4),
                inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
    animation: snake-appear 0.3s ease-out;
}

@keyframes snake-appear {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(0.95);
        opacity: 1;
    }
}

.snake-head {
    background: linear-gradient(145deg, #5aa9a3 0%, #458f89 100%);
    position: relative;
    box-shadow: 0 2px 12px rgba(90, 169, 163, 0.4);
    transform: scale(1);
}

/* 优化后的蛇眼睛样式 */
.snake-head::before,
.snake-head::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle at center, #000 30%, #fff 40%);
    border-radius: 50%;
    top: 4px;
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

.snake-head::before {
    left: 3px;
    transform: rotate(-5deg);
}

.snake-head::after {
    right: 3px;
    transform: rotate(5deg);
}

.snake-head .mouth {
    position: absolute;
    width: 8px;
    height: 4px;
    background-color: #ff4444;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 4px 4px;
}

/* 优化后的蛇眼睛样式 */
.snake-head::before,
.snake-head::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle at center, #000 30%, #fff 40%);
    border-radius: 50%;
    top: 4px;
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

.snake-head::before {
    left: 3px;
    transform: rotate(-5deg);
}

.snake-head::after {
    right: 3px;
    transform: rotate(5deg);
}

.snake-head .mouth {
    position: absolute;
    width: 8px;
    height: 4px;
    background-color: #ff4444;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 4px 4px;
}

.info-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 20px;
    gap: 20px;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 15px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

#score {
    font-size: 24px;
    font-weight: bold;
    color: #76c7c0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 20px;
    border-radius: 10px;
    min-width: 150px;
    text-align: center;
}

.history-container {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
    flex-grow: 1;
    max-width: 300px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.history-container h3 {
    margin: 0 0 10px 0;
    color: #76c7c0;
    font-size: 18px;
}

#history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 150px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(118, 199, 192, 0.5) rgba(0, 0, 0, 0.2);
}

#history-list::-webkit-scrollbar {
    width: 6px;
}

#history-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

#history-list::-webkit-scrollbar-thumb {
    background: rgba(118, 199, 192, 0.5);
    border-radius: 3px;
}

#history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(118, 199, 192, 0.7);
}

#history-list li {
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
}

.button-container {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

button {
    background: linear-gradient(145deg, #76c7c0 0%, #5aa9a3 100%);
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(90, 169, 163, 0.3);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(90, 169, 163, 0.4);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(90, 169, 163, 0.2);
}

.food {
    background: radial-gradient(circle at 50% 40%, #ff3b30 60%, #e02d23 100%);
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.4);
    animation: pulse 1.5s infinite;
    border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: inset -2px -2px 6px rgba(0,0,0,0.2);
}

.food::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 12px;
    background: linear-gradient(45deg, #2d9c3f, #43c45c);
    top: -5px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    border-radius: 2px 6px 2px 0;
    box-shadow: -1px 1px 2px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.food::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(255,255,255,0.6);
    border-radius: 50%;
    top: 25%;
    left: 25%;
    filter: blur(1px);
}

.food:hover {
    transform: scale(0.9) rotate(2deg);
}

.food:hover::before {
    transform: translateX(-50%) rotate(55deg);
}

@keyframes pulse {
    0% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
    100% { transform: scale(0.95); }
}
    border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: inset -2px -2px 6px rgba(0,0,0,0.2);
}

.food::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 12px;
    background: linear-gradient(45deg, #2d9c3f, #43c45c);
    top: -5px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    border-radius: 2px 6px 2px 0;
    box-shadow: -1px 1px 2px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.food::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(255,255,255,0.6);
    border-radius: 50%;
    top: 25%;
    left: 25%;
    filter: blur(1px);
}

.food:hover {
    transform: scale(0.9) rotate(2deg);
}

.food:hover::before {
    transform: translateX(-50%) rotate(55deg);
}

#score {
    margin-top: 20px;
    font-size: 28px;
    font-weight: bold;
}

button {
    margin: 0 10px;
    padding: 10px 25px;
    background-color: #76c7c0;
    color: #1a1a1a;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    width: 100%;
}

button:hover {
    background-color: #5aa9a3;
}