/* Futuristic Snake Game Styling */

:root {
    --primary-bg: #1a1a2e;
    --container-bg: rgba(26, 26, 46, 0.8);
    --border-color: #00c2ff;
    --shadow-color: rgba(0, 194, 255, 0.5);
    --text-color: #e0e0e0;
    --header-text: #00c2ff;
    --button-bg: #00c2ff;
    --button-text: #1a1a2e;
    --button-hover-bg: #ff00ff;
    --button-hover-text: #fff;
    --game-over-header: #ff00ff;
    --canvas-bg: #1d1f33;
    --grid-color: #2a2c49;
    --snake-head-color: #00c2ff;
    --snake-body-color: #00aaff;
    --food-color: #ff00ff;
}

body.light-mode {
    --primary-bg: #f4f7fc;
    --container-bg: #ffffff;
    --border-color: #dbe2f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --text-color: #333;
    --header-text: #007bff;
    --button-bg: #007bff;
    --button-text: #fff;
    --button-hover-bg: #0056b3;
    --button-hover-text: #fff;
    --game-over-header: #dc3545;
    --canvas-bg: #ffffff;
    --grid-color: #ced4da;
    --snake-head-color: #007bff;
    --snake-body-color: #0056b3;
    --food-color: #dc3545;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    background: var(--primary-bg);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    transition: background 0.3s, color 0.3s;
}

.navbar {
    width: 100%;
    max-width: 360px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 0 25px var(--shadow-color);
    backdrop-filter: blur(10px);
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.navbar-brand {
    font-size: 20px;
    font-weight: bold;
    color: var(--header-text);
    text-shadow: 0 0 8px var(--header-text);
    transition: color 0.3s, text-shadow 0.3s;
}

.theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
}

.moon-icon { display: none; }
body.light-mode .sun-icon { display: none; }
body.light-mode .moon-icon { display: block; }


.container {
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 0 25px var(--shadow-color);
    max-width: 360px;
    width: 100%;
    backdrop-filter: blur(10px);
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* Light mode overrides for a simpler look */
body.light-mode .container,
body.light-mode .navbar,
body.light-mode .modal-content {
    backdrop-filter: none;
    box-shadow: 0 4px 12px var(--shadow-color);
    border-width: 1px;
}

body.light-mode .navbar-brand,
body.light-mode .game-title,
body.light-mode .modal-content h2,
body.light-mode .signal-bars span,
body.light-mode .battery-fill {
    text-shadow: none;
    box-shadow: none;
}

/* Header */
.phone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.signal-bars {
    display: flex;
    gap: 3px;
    align-items: flex-end;
}

.signal-bars span {
    width: 4px;
    background: var(--header-text);
    border-radius: 1px;
    box-shadow: 0 0 5px var(--header-text);
}

.signal-bars span:nth-child(1) { height: 4px; }
.signal-bars span:nth-child(2) { height: 8px; }
.signal-bars span:nth-child(3) { height: 12px; }
.signal-bars span:nth-child(4) { height: 16px; }

.time {
    flex: 1;
    text-align: center;
    letter-spacing: 1px;
}

.battery {
    width: 22px;
    height: 11px;
    border: 2px solid var(--header-text);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.battery::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 6px;
    background: var(--header-text);
    border-radius: 0 1px 1px 0;
}

.battery-fill {
    width: 100%;
    height: 100%;
    background: var(--header-text);
    box-shadow: 0 0 8px var(--header-text);
}

/* Game title */
.game-title {
    text-align: center;
    font-size: 36px;
    font-weight: 700;
    margin: 15px 0;
    letter-spacing: 4px;
    color: var(--text-color);
    text-shadow: 0 0 8px var(--header-text), 0 0 12px var(--header-text);
    text-transform: uppercase;
    transition: color 0.3s, text-shadow 0.3s;
}

/* Info panel (score display) */
.info-panel {
    display: flex;
    justify-content: space-around;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

body.light-mode .info-panel {
    background: #f8f9fa;
}

.score-section, .high-score-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.label {
    font-size: 12px;
    font-weight: bold;
    color: var(--header-text);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.score, .high-score {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-color);
    margin-top: 5px;
}

/* Canvas styling */
#gameCanvas {
    display: block;
    background: var(--canvas-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin: 0 auto 15px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
    image-rendering: pixelated;
}

body.dark-mode #gameCanvas {
     box-shadow: inset 0 0 10px rgba(0, 194, 255, 0.3);
     border: 2px solid var(--border-color);
}

/* Game Over Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--container-bg);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.show { display: flex; }

.modal-content {
    background: var(--primary-bg);
    border: 2px solid var(--border-color);
    padding: 40px;
    text-align: center;
    border-radius: 15px;
    box-shadow: 0 0 25px var(--shadow-color);
    max-width: 300px;
}

.modal-content h2 {
    font-size: 32px;
    margin-bottom: 20px;
    color: var(--game-over-header);
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--game-over-header);
    text-transform: uppercase;
    transition: color 0.3s, text-shadow 0.3s;
}

.modal-content p {
    font-size: 18px;
    margin-bottom: 25px;
    color: var(--text-color);
}

#restartBtn {
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    padding: 12px 35px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    box-shadow: 0 0 15px var(--shadow-color);
}

#restartBtn:hover {
    background: var(--button-hover-bg);
    color: var(--button-hover-text);
    box-shadow: 0 0 25px var(--shadow-color);
    transform: translateY(-2px);
}

#restartBtn:active {
    transform: translateY(0);
}

/* Controls information */
.controls-info {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    font-size: 14px;
    color: #888;
}

body.light-mode .controls-info {
    background: #f8f9fa;
}


.controls-info p {
    margin: 5px 0;
    letter-spacing: 0.5px;
}

#gameStatus {
    font-weight: bold;
    color: var(--header-text);
}

/* Responsive design */
@media (max-width: 480px) {
    .container, .navbar {
        padding: 15px;
    }
    .game-title {
        font-size: 30px;
    }
    #gameCanvas {
        width: 100%;
        height: auto;
    }
}

