/* 1. Import Stylish Fonts from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Lobster&family=Playfair+Display:wght@700&display=swap');

body {
    /* Background Image setup */
    background-image: url('assets/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;

    /* Base Typography and Layout */
    color: #ffffff; 
    font-family: sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* FIX: Use 100vh for desktop and 100% for mobile to prevent overflow */
    height: 100vh; 
    width: 100vw;
    margin: 0;
    flex-direction: column;

    /* 1. LOCK SCROLLING: Prevents the user from scrolling the page */
    overflow: hidden; 

    /* 2. FIX FOR MOBILE BOUNCE: Stops the "elastic" scroll on iOS/Android */
    position: fixed; 
    overscroll-behavior: none;

    /* 3. NO TEXT SELECTION: Prevents accidental highlighting while tapping fast */
    user-select: none;
    -webkit-user-select: none;
}

canvas, #grid, .game-container {
    /* Critical for mobile: prevents scrolling during gameplay */
    touch-action: none; 
}

/* 2. Main Game Container - Glassmorphism style */
.game-container {
    background-color: rgba(0, 0, 0, 0.7); 
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

/* 3. Game Grid - 20x20 */
#grid {
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    width: 300px;
    height: 300px;
    margin: 20px auto;
    background: rgba(255, 255, 255, 0.05);
    border: 4px solid rgba(34, 197, 94, 0.3);
}

#grid div {
    border: 0.1px solid rgba(241, 245, 249, 0.05);
}

/* 4. Game Elements - Fully opaque */
.snake {
    background-color: #22c55e;
    border-radius: 2px;
    box-shadow: 0 0 10px #22c55e;
}

.apple {
    background-color: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 10px #ef4444;
}

/* 5. ARROW CONTROLS (Commented out for student exercise) */
/*
.controls {
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.arrow-row {
    display: flex;
    gap: 10px;
}

.arrow {
    width: 60px;
    height: 60px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(134, 239, 172, 0.4);
    color: #ffffff;
    border-radius: 12px;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.arrow:active {
    background: rgba(34, 197, 94, 0.4);
    transform: scale(0.9);
}
*/

/* 6. GOLDEN TYPOGRAPHY (The "Beautiful Fonts") */
/* Applies the golden curly look to all main titles */
h1, h3, #leaderboard h3 {
    font-family: 'Lobster', cursive; /* The curly font you wanted */
    font-size: 2.2rem;
    margin: 15px 0;
    
    /* Golden Gradient API */
    background: linear-gradient(to bottom, #cf9d1d 0%, #ffdb6e 50%, #c9930b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 5px rgba(201, 147, 11, 0.4));
}

#scoreList {
    list-style: none;
    padding: 0;
    font-family: 'Playfair Display', serif; /* Sophisticated list font */
}

#scoreList li {
    font-size: 1.3rem;
    margin: 10px 0;
    color: #ffd700; /* Solid Gold fallback */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

#scoreList li b {
    color: #ffffff;
    text-shadow: 0 0 8px #ffd700;
}

/* 7. Game Over Modal Styling */
#scoreModal {
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(15px);
    border: 2px solid #cf9d1d !important;
    color: white;
}

#scoreModal input {
    padding: 8px;
    margin: 5px;
    border-radius: 5px;
    border: 1px solid #cf9d1d;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* 8. Main Buttons */
#start-btn, #end-btn, button[onclick="submitScore()"] {
    padding: 12px 30px;
    background: #16a34a;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#start-btn:hover, #end-btn:hover {
    background: #15803d;
    transform: scale(1.05);
}

