/* ========================================
   SNAKE GAME STYLES
   Created by Shivanya
   ======================================== */

/* CSS Variables - Easy to change colors! */
:root {
    --bg-color: #1a1a2e;           /* Dark blue background */
    --game-bg: #16213e;            /* Game area background */
    --snake-color: #4ade80;        /* Green snake */
    --snake-head: #22c55e;         /* Darker green for head */
    --apple-color: #ef4444;        /* Red apple */
    --text-color: #ffffff;         /* White text */
    --accent-color: #f472b6;       /* Pink accent */
    --button-color: #8b5cf6;       /* Purple buttons */
    --grid-color: #1e3a5f;         /* Grid lines */
}

/* Reset default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Make icons filled instead of outlined */
.material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Body styling */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Main container for everything */
.game-container {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

/* Header styles */
header {
    margin-bottom: 20px;
}

/* Back button to return to main portal */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 15px;
    transition: transform 0.2s;
}

.back-button:hover {
    transform: translateX(-5px);
}

/* Main title */
header h1 {
    font-size: 2rem;
    color: var(--snake-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 5px;
}

/* Subtitle under the title */
.subtitle {
    color: #94a3b8;
    font-size: 1rem;
}

/* Score board showing current and best score */
.score-board {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.score, .high-score {
    display: flex;
    align-items: center;
    gap: 5px;
}

.score {
    color: var(--snake-color);
}

.high-score {
    color: #fbbf24;  /* Gold color */
}

/* Main game area */
main {
    position: relative;
    display: inline-block;
}

/* The canvas where the snake moves */
#game-canvas {
    background: var(--game-bg);
    border: 4px solid var(--snake-color);
    border-radius: 10px;
    display: block;
    max-width: 100%;
    height: auto;
}

/* Overlay screens (start and game over) */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    gap: 15px;
}

/* Hide overlay when not needed */
.overlay.hidden {
    display: none;
}

.overlay h2 {
    font-size: 2rem;
    color: var(--accent-color);
}

.overlay p {
    color: #94a3b8;
    font-size: 1.1rem;
}

/* Play and restart buttons */
.play-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    font-size: 1.2rem;
    background: var(--button-color);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    margin-top: 10px;
}

.play-button:hover {
    transform: scale(1.05);
    background: #7c3aed;
}

/* Difficulty selection */
.difficulty-label {
    margin-top: 15px;
    font-weight: bold;
    color: white;
}

.difficulty-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.difficulty-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 15px 20px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.difficulty-btn .material-symbols-rounded {
    font-size: 32px;
}

.difficulty-btn:hover {
    transform: scale(1.1);
}

/* Easy button - Green */
.difficulty-btn.easy {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.4);
}

.difficulty-btn.easy:hover {
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.6);
}

/* Medium button - Orange */
.difficulty-btn.medium {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

.difficulty-btn.medium:hover {
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.6);
}

/* Hard button - Red */
.difficulty-btn.hard {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 4px 15px rgba(248, 113, 113, 0.4);
}

.difficulty-btn.hard:hover {
    box-shadow: 0 6px 20px rgba(248, 113, 113, 0.6);
}

/* Current difficulty display */
.current-difficulty {
    font-size: 0.9rem;
    padding: 4px 12px;
    border-radius: 20px;
    margin-left: 10px;
}

.current-difficulty.easy {
    background: #22c55e;
}

.current-difficulty.medium {
    background: #f59e0b;
}

.current-difficulty.hard {
    background: #ef4444;
}

/* Mobile controls for phones/tablets */
.mobile-controls {
    display: none;  /* Hidden on desktop */
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-top: 20px;
}

.horizontal-controls {
    display: flex;
    gap: 5px;
}

.control-btn {
    width: 60px;
    height: 60px;
    font-size: 24px;
    background: var(--button-color);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

.control-btn:active {
    transform: scale(0.95);
    background: #7c3aed;
}

/* Footer with credits */
footer {
    margin-top: 20px;
}

.created-by {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, var(--accent-color), #ec4899);
    color: white;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Show mobile controls on small screens */
@media (max-width: 500px) {
    .mobile-controls {
        display: flex;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .score-board {
        font-size: 1rem;
        gap: 20px;
    }
}
