/* === SNAKE GAME STYLES === */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* === HEADER === */
.game-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(-5px);
}

.game-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 12px;
}

.game-header h1 i {
    color: #10b981;
}

.game-stats {
    display: flex;
    gap: 20px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(99, 102, 241, 0.1);
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    color: #374151;
}

.stat i {
    color: #6366f1;
}

/* === MAIN CONTENT === */
.game-main {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.game-controls {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(100, 116, 139, 0.3);
}

.mode-select,
.difficulty-select {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-select:focus,
.difficulty-select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* === SNAKE BOARD === */
.snake-board-container {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#snakeCanvas {
    border: 3px solid #1f2937;
    border-radius: 15px;
    background: #111827;
    box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    height: auto;
}

/* === GAME OVERLAY === */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.game-overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    color: white;
    padding: 40px;
    max-width: 400px;
}

.overlay-content h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #10b981;
}

.overlay-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.overlay-stats {
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.stat-label {
    opacity: 0.8;
}

.stat-value {
    font-weight: 600;
    color: #10b981;
}

/* === POWER-UPS PANEL === */
.power-ups-panel {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid #10b981;
    border-radius: 15px;
    padding: 15px;
    min-width: 250px;
    display: none;
}

.power-ups-panel.visible {
    display: block;
}

.power-ups-panel h4 {
    margin-bottom: 10px;
    color: #065f46;
    display: flex;
    align-items: center;
    gap: 8px;
}

.active-powerups {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.powerup-active {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    font-size: 0.9rem;
}

.powerup-timer {
    font-weight: 600;
    color: #10b981;
}

/* === GAME INFO SIDEBAR === */
.game-info {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.game-info h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: #1f2937;
    font-size: 1.2rem;
}

.game-info h3 i {
    color: #10b981;
}

/* === CONTROLS INFO === */
.control-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    background: rgba(16, 185, 129, 0.05);
    border-radius: 8px;
    text-align: center;
}

.key-icon {
    background: #10b981;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.control-item span {
    font-size: 0.8rem;
    color: #374151;
    font-weight: 500;
}

/* === GAME MODES INFO === */
.mode-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mode-item {
    padding: 12px;
    background: rgba(16, 185, 129, 0.05);
    border-radius: 8px;
    border-left: 3px solid #10b981;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* === POWER-UPS INFO === */
.powerup-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.powerup-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(16, 185, 129, 0.05);
    border-radius: 8px;
    border-left: 3px solid #10b981;
}

.powerup-icon {
    font-size: 1.5rem;
    width: 30px;
    text-align: center;
}

.powerup-item span {
    font-size: 0.9rem;
    line-height: 1.4;
}

/* === ANIMATIONS === */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes powerupCollect {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.btn:active {
    transform: scale(0.95);
}

.game-over .overlay-content {
    animation: pulse 1s ease-in-out;
}

.powerup-collected {
    animation: powerupCollect 0.3s ease-in-out;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 1024px) {
    .game-main {
        grid-template-columns: 1fr;
    }
    
    .game-info {
        order: -1;
        flex-direction: row;
        overflow-x: auto;
    }
    
    .game-info > div {
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .game-stats {
        justify-content: center;
    }
    
    .game-controls {
        justify-content: center;
        flex-direction: column;
        gap: 10px;
    }
    
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    #snakeCanvas {
        width: 100%;
        max-width: 400px;
        height: 300px;
    }
    
    .game-info {
        flex-direction: column;
    }
    
    .control-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === GAME STATES === */
.game-paused #snakeCanvas {
    filter: blur(3px);
}

.game-over .overlay-content h2 {
    color: #ef4444;
}

.game-complete .overlay-content h2 {
    color: #10b981;
}

/* === LOADING ANIMATION === */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* === SNAKE EFFECTS === */
.snake-glow {
    filter: drop-shadow(0 0 10px #10b981);
}

.apple-glow {
    filter: drop-shadow(0 0 8px #ef4444);
}

.powerup-glow {
    filter: drop-shadow(0 0 12px #f59e0b);
}