/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans SC', sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #7fa7ec 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    overflow: hidden;
}

/* 屏幕切换 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
    transform: translateY(20px);
}

.screen.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 菜单容器 */
.menu-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    min-width: 400px;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 标题样式 */
.game-title {
    font-size: 3rem;
    font-weight: bold;
    background: linear-gradient(45deg, #667eea, #6d9ef3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 30px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.screen-title {
    font-size: 2rem;
    color: #333;
    margin-bottom: 30px;
    font-weight: 600;
}

/* 按钮样式 */
.menu-btn {
    display: block;
    width: 100%;
    padding: 15px 30px;
    margin: 10px 0;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.menu-btn.primary {
    background: linear-gradient(45deg, #667eea, #6f88ee);
    color: white;
}

.menu-btn.primary:hover {
    background: linear-gradient(45deg, #5a6fd8, #02085d);
}

/* 难度选择 */
.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.difficulty-btn {
    padding: 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.difficulty-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
}

.difficulty-btn h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 5px;
}

.difficulty-btn p {
    color: #666;
    font-size: 0.9rem;
}

/* 操作说明 */
.controls-info {
    text-align: left;
    margin-bottom: 30px;
}

.control-item {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.control-item h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.control-item p {
    color: #666;
    line-height: 1.5;
    margin: 5px 0;
}

/* 游戏界面 */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

/* 游戏信息栏 */
.game-info {
    display: flex;
    align-items: center;
    gap: 30px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-label {
    font-weight: 600;
    color: #333;
}

.info-item span:last-child {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1rem;
}

/* 控制按钮 */
.control-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: #667eea;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 5px;
}

.control-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

/* 画布容器 */
.canvas-container {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    background: #fff;
}

#game-canvas {
    display: block;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
}

/* 游戏覆盖层 */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.overlay-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.overlay-content h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.overlay-content p {
    color: #666;
    margin-bottom: 20px;
}

.overlay-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.overlay-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.overlay-btn:first-child {
    background: #667eea;
    color: white;
}

.overlay-btn:first-child:hover {
    background: #5a6fd8;
}

.overlay-btn:last-child {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e9ecef;
}

.overlay-btn:last-child:hover {
    background: #e9ecef;
}

/* 特殊效果指示器 */
.effect-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    transform: translateX(100%);
}

.effect-indicator:not(.hidden) {
    transform: translateX(0);
}

#effect-text {
    font-weight: bold;
    color: #333;
    display: block;
    margin-bottom: 8px;
}

.effect-timer {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.effect-timer::after {
    content: '';
    display: block;
    height: 100%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    width: 100%;
    animation: timerCountdown var(--duration, 3s) linear forwards;
}

@keyframes timerCountdown {
    from { width: 100%; }
    to { width: 0%; }
}



/* 响应式设计 */
@media (max-width: 768px) {
    .menu-container {
        min-width: 300px;
        padding: 30px 20px;
        margin: 20px;
    }
    
    .game-title {
        font-size: 2.5rem;
    }
    
    .game-info {
        flex-wrap: wrap;
        gap: 15px;
        padding: 15px 20px;
    }
    
    #game-canvas {
        width: 350px;
        height: 350px;
    }
    
    .difficulty-options {
        gap: 10px;
    }
    
    .overlay-buttons {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .menu-container {
        min-width: 280px;
        padding: 25px 15px;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    #game-canvas {
        width: 300px;
        height: 300px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .info-item {
        justify-content: center;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.bounce {
    animation: bounce 0.6s ease-out;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* 游戏元素样式 */
.snake-segment {
    border-radius: 2px;
}

.food-normal {
    border-radius: 50%;
}

.food-speed {
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.food-growth {
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 255, 127, 0.6);
}

.food-special {
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(255, 20, 147, 0.8);
}