﻿:root {
    /* Cores Neon */
    --bg-dark: #0a0e27;
    --bg-medium: #1a1f3a;
    --bg-light: #2a2f4a;
    --neon-pink: #ff3366;
    --neon-cyan: #00ffcc;
    --neon-purple: #9d4edd;
    --neon-blue: #00b4d8;
    --neon-green: #06ffa5;
    --neon-yellow: #ffea00;
    --neon-orange: #ff6b35;

    /* UI */
    --text-primary: #ffffff;
    --text-secondary: #b8c1ec;
    --border-color: rgba(0, 255, 204, 0.3);
    --shadow-glow: 0 0 20px rgba(0, 255, 204, 0.5);

    /* Fontes */
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* AnimaÃ§Ãµes */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes glow {

    0%,
    100% {
        filter: drop-shadow(0 0 5px currentColor);
    }

    50% {
        filter: drop-shadow(0 0 20px currentColor);
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Telas */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

/* ===== MENU PRINCIPAL ===== */
#menu-screen {
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
    position: relative;
    overflow-y: auto;
    /* Permitir scroll vertical */
    overflow-x: hidden;
}

#menu-screen::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, rgba(157, 78, 221, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(0, 255, 204, 0.1) 0%, transparent 50%);
    animation: float 10s ease-in-out infinite;
}

.menu-container {
    position: relative;
    z-index: 1;
    max-width: 500px;
    width: 90%;
    margin: 2rem auto;
    /* Centralizar com margem */
    padding: 1rem 0;
    /* Padding vertical */
    animation: slideIn 0.6s ease-out;
}

.logo-container {
    text-align: center;
    margin-bottom: 1.5rem;
    /* Reduzido de 3rem */
}

.game-logo {
    font-family: var(--font-display);
    font-size: 3rem;
    /* Reduzido de 4rem */
    font-weight: 900;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    /* Reduzido de 1rem */
    animation: glow 2s ease-in-out infinite;
    flex-wrap: wrap;
    /* Permitir quebra em telas pequenas */
}

.logo-snake {
    font-size: 3.5rem;
    /* Reduzido de 5rem */
    animation: float 3s ease-in-out infinite;
}

.logo-text {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-subtitle {
    font-size: 1rem;
    /* Reduzido de 1.2rem */
    color: var(--text-secondary);
    margin-top: 0.5rem;
    letter-spacing: 2px;
    /* Reduzido de 3px */
    text-transform: uppercase;
}

.menu-content {
    background: rgba(26, 31, 58, 0.6);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    /* Reduzido de 2rem */
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-glow);
}

.player-setup {
    margin-bottom: 1.5rem;
    /* Reduzido de 2rem */
}

.player-setup label,
.skin-selector label {
    display: block;
    font-size: 0.9rem;
    color: var(--neon-cyan);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

#player-name {
    width: 100%;
    padding: 0.8rem;
    /* Reduzido de 1rem */
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    /* Reduzido de 1.1rem */
    transition: all 0.3s ease;
}

#player-name:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.3);
}

.skin-selector {
    margin-bottom: 1.5rem;
    /* Reduzido de 2rem */
}

.skin-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.8rem;
}

.skin-option {
    aspect-ratio: 1;
    border-radius: 10px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.skin-option::before {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    opacity: 0.3;
}

.skin-option:hover {
    transform: scale(1.1);
    border-color: var(--neon-cyan);
}

.skin-option.selected {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.6);
    transform: scale(1.15);
}

/* BotÃµes */
.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 1rem 1.5rem;
    /* Reduzido de 1.2rem 2rem */
    font-family: var(--font-display);
    font-size: 1.1rem;
    /* Reduzido de 1.3rem */
    font-weight: 700;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
    color: var(--bg-dark);
    box-shadow: 0 5px 25px rgba(0, 255, 204, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 255, 204, 0.6);
    animation: pulse 1s ease-in-out infinite;
}

.btn-secondary {
    background: rgba(26, 31, 58, 0.8);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    margin-top: 1rem;
}

.btn-secondary:hover {
    border-color: var(--neon-cyan);
    background: rgba(26, 31, 58, 1);
}

.btn-icon {
    font-size: 1.3rem;
    /* Reduzido de 1.5rem */
}

.menu-stats {
    margin-top: 1.5rem;
    /* Reduzido de 2rem */
    padding-top: 1rem;
    /* Reduzido de 1.5rem */
    border-top: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    /* Reduzido de 2rem */
    font-weight: 700;
    color: var(--neon-cyan);
}

.stat-label {
    font-size: 0.85rem;
    /* Reduzido de 0.9rem */
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== TELA DE JOGO ===== */
#game-screen {
    background: var(--bg-dark);
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* HUD */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    padding: 1rem;
}

.hud-panel {
    background: rgba(10, 14, 39, 0.85);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 1rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Painel de EstatÃ­sticas */
.stats-panel {
    position: absolute;
    top: 1rem;
    left: 1rem;
    min-width: 250px;
}

.player-name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--neon-cyan);
    margin-bottom: 0.8rem;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}

.player-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    color: var(--text-secondary);
}

.stat-icon {
    font-size: 1.2rem;
}

.stat strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* Leaderboard */
.leaderboard-panel {
    position: absolute;
    top: 1rem;
    right: 1rem;
    min-width: 280px;
    max-height: 400px;
    overflow-y: auto;
}

.panel-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--neon-yellow);
    margin-bottom: 0.8rem;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 234, 0, 0.5);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem;
    background: rgba(26, 31, 58, 0.6);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.leaderboard-item.current-player {
    background: rgba(0, 255, 204, 0.2);
    border: 1px solid var(--neon-cyan);
}

.leaderboard-rank {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 30px;
    text-align: center;
}

.leaderboard-rank.top-1 {
    color: #FFD700;
}

.leaderboard-rank.top-2 {
    color: #C0C0C0;
}

.leaderboard-rank.top-3 {
    color: #CD7F32;
}

.leaderboard-name {
    flex: 1;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-score {
    font-weight: 700;
    color: var(--neon-cyan);
}

/* Painel de Boost */
.boost-panel {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    min-width: 250px;
}

.boost-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.boost-label {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--neon-green);
}

.boost-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.boost-bar-container {
    width: 100%;
    height: 20px;
    background: rgba(26, 31, 58, 0.8);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.boost-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-green), var(--neon-cyan));
    border-radius: 10px;
    transition: width 0.2s ease, background 0.3s ease;
    box-shadow: 0 0 10px rgba(6, 255, 165, 0.6);
}

.boost-bar.low {
    background: linear-gradient(90deg, var(--neon-orange), var(--neon-yellow));
}

.boost-bar.critical {
    background: linear-gradient(90deg, var(--neon-pink), var(--neon-orange));
    animation: pulse 0.5s ease-in-out infinite;
}

.boost-segments {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

.boost-segments strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* Minimapa */
.minimap-panel {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    padding: 0.5rem;
}

#minimap-canvas {
    display: block;
    border-radius: 10px;
}

/* Controles Mobile */
.mobile-controls {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.joystick-container {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    pointer-events: all;
}

.joystick-base {
    width: 120px;
    height: 120px;
    background: rgba(26, 31, 58, 0.6);
    border: 3px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    backdrop-filter: blur(10px);
}

.joystick-stick {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.6);
    transition: all 0.1s ease;
}

.boost-button {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--neon-green), var(--neon-cyan));
    border: 3px solid var(--neon-green);
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    pointer-events: all;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(6, 255, 165, 0.6);
    transition: all 0.2s ease;
}

.boost-button span {
    font-size: 2rem;
}

.boost-button:active {
    transform: scale(0.95);
    box-shadow: 0 0 40px rgba(6, 255, 165, 0.8);
}

/* ===== TELA DE GAME OVER ===== */
#gameover-screen {
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(10px);
}

.gameover-container {
    max-width: 600px;
    width: 90%;
    animation: slideIn 0.6s ease-out;
}

.gameover-title {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 900;
    text-align: center;
    color: var(--neon-pink);
    text-shadow: 0 0 30px rgba(255, 51, 102, 0.8);
    margin-bottom: 2rem;
    animation: glow 1.5s ease-in-out infinite;
}

.gameover-stats {
    background: rgba(26, 31, 58, 0.6);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.final-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.final-stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.final-stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--neon-cyan);
    text-shadow: 0 0 15px rgba(0, 255, 204, 0.5);
}

.gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Scrollbar customizado */
.leaderboard-panel::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-panel::-webkit-scrollbar-track {
    background: rgba(26, 31, 58, 0.5);
    border-radius: 10px;
}

.leaderboard-panel::-webkit-scrollbar-thumb {
    background: var(--neon-cyan);
    border-radius: 10px;
}

/* Responsividade */
@media (max-width: 768px) {
    .game-logo {
        font-size: 2.5rem;
    }

    .logo-snake {
        font-size: 3rem;
    }

    .skin-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .stats-panel,
    .boost-panel {
        min-width: 200px;
        font-size: 0.9rem;
    }

    .leaderboard-panel {
        min-width: 220px;
    }

    .mobile-controls {
        display: block;
    }

    .gameover-title {
        font-size: 2.5rem;
    }

    .gameover-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hud {
        padding: 0.5rem;
    }

    .stats-panel,
    .leaderboard-panel,
    .boost-panel,
    .minimap-panel {
        padding: 0.7rem;
    }
}

/* Ajustes adicionais de responsividade */
@media (max-width: 360px) {
    .game-logo {
        font-size: 1.5rem;
    }
    
    .logo-snake {
        font-size: 2rem;
    }
    
    .skin-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}


/* Autenticação - Foto do Usuário */
.user-info-container {
    text-align: center;
    margin-bottom: 1rem;
}

.user-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.5);
    object-fit: cover;
}

#auth-button {
    margin-top: 0.5rem;
}

/* CorreÃ§Ãµes Mobile - Grid de Skins */
.skin-grid {
    max-height: 180px;
    overflow-y: auto;
    padding: 0.5rem;
}

.skin-grid::-webkit-scrollbar {
    width: 6px;
}

.skin-grid::-webkit-scrollbar-track {
    background: rgba(26, 31, 58, 0.5);
    border-radius: 10px;
}

.skin-grid::-webkit-scrollbar-thumb {
    background: var(--neon-cyan);
    border-radius: 10px;
}

/* Melhorias Mobile Adicionais */
@media (max-width: 768px) {
    .skin-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.6rem;
        max-height: 150px;
    }
    
    .menu-container {
        width: 95%;
        margin: 1rem auto;
        padding: 0.5rem 0;
    }
    
    .menu-content {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .skin-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        max-height: 120px;
    }
    
    .skin-option {
        min-height: 50px;
    }
}


/* ========================================
   OTIMIZAÃ‡Ã•ES MOBILE ULTRA âš¡
   Adicione este CSS no final do styles.css
   ======================================== */

@media (max-width: 768px) {

    /* ===== REDUZIR TAMANHOS HUD ===== */
    .game-hud {
        font-size: 9px !important;
        transform: scale(0.8);
        transform-origin: top left;
    }

    .game-hud>div {
        padding: 4px 8px !important;
        margin: 4px !important;
    }

    .game-hud h3 {
        font-size: 11px !important;
        margin-bottom: 3px !important;
    }

    .game-hud p,
    .game-hud span {
        font-size: 9px !important;
        margin: 1px 0 !important;
        line-height: 1.2 !important;
    }

    /* ===== REDUZIR LEADERBOARD ===== */
    #leaderboard {
        max-height: 140px !important;
        transform: scale(0.85);
        transform-origin: top right;
    }

    #leaderboard h3 {
        font-size: 11px !important;
        padding: 5px !important;
    }

    .leaderboard-item {
        padding: 3px 6px !important;
        font-size: 9px !important;
        min-height: auto !important;
    }

    .leaderboard-rank {
        font-size: 10px !important;
        min-width: 18px !important;
        padding: 2px 4px !important;
    }

    .leaderboard-name {
        font-size: 9px !important;
    }

    .leaderboard-score {
        font-size: 9px !important;
    }

    /* ===== ESCONDER BARRA DE BOOST ===== */
    #boost-bar-container,
    .boost-bar,
    [class*="boost"] {
        display: none !important;
    }

    /* ===== MINIMAPA MENOR ===== */
    #minimap-canvas {
        width: 70px !important;
        height: 70px !important;
    }

    /* ===== CONTROLES MOBILE MAIORES ===== */
    #mobile-controls {
        bottom: 10px !important;
    }

    #joystick-container {
        width: 100px !important;
        height: 100px !important;
    }

    #boost-button {
        width: 100px !important;
        height: 100px !important;
        font-size: 14px !important;
    }
}

/* ===== MOBILE PEQUENO (< 480px) ===== */
@media (max-width: 480px) {
    .game-hud {
        transform: scale(0.7);
    }

    #leaderboard {
        transform: scale(0.75);
        max-height: 120px !important;
    }

    #minimap-canvas {
        width: 60px !important;
        height: 60px !important;
    }
}
