:root {
    /* Tema Dark (Default) */
    --bg: #050505;
    --surface: #0f0f0f;
    --accent: #00ff88;
    --accent-glow: rgba(0, 255, 136, 0.4);
    --text: #ffffff;
    --text-dim: #888888;
    --border: rgba(255, 255, 255, 0.08);
    --canvas-bg: #000000;
    --radius-lg: 28px;
    --radius-md: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg: #f4f7f6;
    --surface: #ffffff;
    --accent: #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.2);
    --text: #0f172a;
    --text-dim: #64748b;
    --border: rgba(0, 0, 0, 0.05);
    --canvas-bg: #f8fafc;
}

[data-theme="blue"] {
    --bg: #020617;
    --surface: #0f172a;
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.4);
    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --border: rgba(56, 189, 248, 0.1);
    --canvas-bg: #020617;
}

/* Reset e Setup */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Plus Jakarta Sans', sans-serif; }

body {
    background-color: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    transition: background 0.5s ease;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* HUD Superior - Layout de Dashboard */
.main-hud {
    padding: 1.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    z-index: 10;
}

.hud-group { display: flex; align-items: center; gap: 1.5rem; }

.main-brand { 
    font-weight: 800; 
    font-size: 1.1rem; 
    letter-spacing: -0.5px; 
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-separator { width: 1px; height: 24px; background: var(--border); }

.stats small { 
    display: block; 
    font-size: 0.6rem; 
    color: var(--text-dim); 
    font-weight: 800; 
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats strong { font-size: 1.2rem; font-weight: 700; }

.score-display {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--accent);
    text-shadow: 0 0 25px var(--accent-glow);
    font-variant-numeric: tabular-nums;
}

.action-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text);
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: grid;
    place-items: center;
}

.action-btn.primary { background: var(--accent); color: #000; border: none; }
.action-btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.08); }
.action-btn.primary:hover { box-shadow: 0 8px 20px var(--accent-glow); }

/* Arena e Canvas - Foco Total */
.game-arena {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 2rem;
}

.canvas-wrapper {
    position: relative;
    background: var(--canvas-bg);
    border-radius: var(--radius-lg);
    padding: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 30px 90px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-glow {
    position: absolute;
    inset: -1px;
    border-radius: var(--radius-lg);
    box-shadow: 0 0 40px var(--accent-glow);
    pointer-events: none;
    z-index: -1;
    opacity: 0.6;
}

#snakeCanvas {
    display: block;
    border-radius: calc(var(--radius-lg) - 8px);
    max-width: 100%;
    height: auto;
}

/* OVERLAY DE MENU - CENTRALIZAÇÃO TOTAL */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.glass-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 3.5rem;
    border-radius: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.glass-card h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -1px; }
.glass-card h1 span { color: var(--accent); }
.glass-card p { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 1rem; }

/* Botões Modernos */
.btn-glow-trigger {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 1.2rem 2.5rem;
    border-radius: 20px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: var(--transition);
}

.btn-glow-trigger:hover { 
    transform: scale(1.03); 
    box-shadow: 0 15px 35px var(--accent-glow);
}

/* Footer Profissional */
.footer-premium {
    background: var(--surface);
    padding: 1.5rem 3rem;
    border-top: 1px solid var(--border);
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dev-tag { font-weight: 700; color: var(--text-dim); font-size: 0.8rem; letter-spacing: 0.5px; }
.dev-tag span { color: var(--accent); }

.social-links { display: flex; gap: 1rem; }
.social-links a {
    color: var(--text-dim);
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    display: grid;
    place-items: center;
    transition: var(--transition);
    text-decoration: none;
}

.social-links a:hover { 
    color: var(--accent); 
    background: rgba(255,255,255,0.08);
    transform: translateY(-3px); 
}

/* Temas na Barra Inferior */
.theme-bar {
    position: absolute;
    bottom: 20px;
    display: flex;
    gap: 12px;
    background: rgba(0,0,0,0.3);
    padding: 8px 16px;
    border-radius: 100px;
    border: 1px solid var(--border);
}

.theme-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.theme-dot:hover { transform: scale(1.2); }
.theme-dot.active { border-color: #fff; transform: scale(1.1); }

.theme-dot.dark { background: #111; }
.theme-dot.light { background: #fff; }
.theme-dot.blue { background: #38bdf8; }


/* =========================================
   MODAL GAME OVER - MINIMALISTA E DARK (NOVO)
   ========================================= */
.gameover-root {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.96); /* Quase totalmente preto */
    backdrop-filter: blur(8px);
    display: none; /* Mude no JS para flex */
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.gameover-content {
    background: #020202; /* Preto absoluto */
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 24px;
    padding: 4rem 3rem;
    max-width: 420px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* Opções perfeitamente centralizadas no meio */
    justify-content: center;
    text-align: center;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 1);
}

.gameover-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -1px;
    margin-bottom: 2.5rem;
}

.gameover-score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-bottom: 3rem; /* Separação grande do botão */
}

.gameover-label {
    font-size: 0.75rem;
    color: #666666;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.gameover-points {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    text-shadow: 0 0 30px var(--accent-glow);
}

.btn-gameover {
    background: #ffffff;
    color: #000000;
    border: none;
    padding: 1.2rem 2.5rem;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
}

.btn-gameover:hover {
    background: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px var(--accent-glow);
}

/* =========================================
   MOBILE - MELHORIA DE RESPONSIVIDADE
   ========================================= */
@media (max-width: 768px) {
    /* Ajustando o HUD para nada ser cortado */
    .main-hud { 
        padding: 1rem; 
        gap: 0.5rem; 
    }
    
    .main-brand { font-size: 0.9rem; gap: 4px; }
    
    .hud-group { gap: 0.6rem; }
    
    /* Removemos divisores e textos pequenos para focar no score */
    .hud-separator, .stats { display: none; } 
    
    /* Diminuindo a fonte do score para caber */
    .score-display { font-size: 1.8rem; }
    
    /* Reduzindo os ícones de ação para não espremer a tela */
    .action-btn { 
        width: 36px; 
        height: 36px; 
        border-radius: 10px; 
    }
    .action-btn i { font-size: 0.9rem; }
    
    .game-arena { padding: 1rem; }
    .canvas-wrapper { padding: 4px; border-radius: 20px; }
    
    .footer-premium { padding: 1rem 1.5rem; }
    .footer-top { flex-direction: column; gap: 1rem; text-align: center; }
    
    .glass-card { padding: 2rem 1.5rem; }
    
    /* Mantendo o Game Over organizado na tela pequena */
    .gameover-content { 
        padding: 3rem 1.5rem; 
    }
    .gameover-title { font-size: 1.8rem; margin-bottom: 2rem; }
    .gameover-points { font-size: 2.8rem; }
    .gameover-score-box { margin-bottom: 2rem; }
}
