:root {
    --bg-color: #0f172a;
    --game-bg: #1e293b;
    --snake-color: #10b981;
    --food-color: #ef4444;
    --text-color: #f1f5f9;
    --accent-color: #3b82f6;
    --neon-glow: 0 0 10px rgba(16, 185, 129, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Vazirmatn', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.game-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 100vh;
    max-height: 700px;
    background: var(--game-bg);
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    text-align: center;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(5px);
    z-index: 10;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: flex;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--snake-color);
    text-shadow: var(--neon-glow);
}

p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: #94a3b8;
}

input {
    padding: 0.8rem 1.5rem;
    border-radius: 0.5rem;
    border: 2px solid #334155;
    background: #0f172a;
    color: white;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    text-align: center;
    width: 80%;
    max-width: 300px;
    transition: border-color 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--snake-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

button {
    background: var(--snake-color);
    color: #064e3b;
    border: none;
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: transform 0.1s, filter 0.2s;
}

button:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

#game-screen {
    background: transparent;
    justify-content: space-between;
    padding: 1rem;
    z-index: 1;
}

.score-board {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    background: rgba(15, 23, 42, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

canvas {
    background: #0f172a;
    border-radius: 0.5rem;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    border: 2px solid #334155;
    max-width: 100%;
}

.controls-hint {
    margin-top: 1rem;
    font-size: 0.9rem;
    opacity: 0.7;
}

.leaderboard {
    margin-top: 2rem;
    width: 100%;
    background: #0f172a;
    border-radius: 0.5rem;
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.leaderboard h2 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.5rem;
    text-align: center;
    border-bottom: 1px solid #1e293b;
}

th {
    color: #64748b;
    font-size: 0.9rem;
}

td {
    font-size: 0.95rem;
}

td:nth-child(2) {
    color: white;
}

td:nth-child(3) {
    color: var(--snake-color);
    font-weight: bold;
}
