/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    height: 100vh;
}

.tela {
    width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.oculto {
    display: none !important;
}

/* Tela Inicial */
.container-inicial {
    text-align: center;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    animation: fadeIn 1s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.titulo-jogo {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    letter-spacing: 5px;
    animation: pulse 2s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.subtitulo {
    color: #888;
    margin-bottom: 2rem;
    font-size: 1rem;
}

.form-jogo {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

#nickname {
    padding: 1rem;
    font-size: 1.1rem;
    background: #111;
    border: 2px solid #333;
    color: #fff;
    border-radius: 5px;
    text-align: center;
    transition: all 0.3s;
}

#nickname:focus {
    outline: none;
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.btn-jogar {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 2px;
}

.btn-jogar:hover {
    background: #ddd;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.btn-jogar:active {
    transform: scale(0.95);
}

/* Ranking Preview */
.ranking-preview {
    background: #111;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.ranking-preview h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.lista-ranking {
    max-height: 300px;
    overflow-y: auto;
}

.item-ranking {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #1a1a1a;
    border-radius: 5px;
    border-left: 3px solid #333;
    transition: all 0.3s;
}

.item-ranking:hover {
    background: #222;
    border-left-color: #fff;
    transform: translateX(5px);
}

.item-ranking.top1 {
    border-left-color: #ffd700;
    background: linear-gradient(90deg, #1a1a1a 0%, #2a2a1a 100%);
}

.item-ranking.top2 {
    border-left-color: #c0c0c0;
    background: linear-gradient(90deg, #1a1a1a 0%, #2a2a2a 100%);
}

.item-ranking.top3 {
    border-left-color: #cd7f32;
    background: linear-gradient(90deg, #1a1a1a 0%, #2a1a1a 100%);
}

.ranking-pos {
    font-weight: bold;
    min-width: 40px;
    font-size: 1.1rem;
}

.ranking-pos.top1::before {
    content: "🥇 ";
}

.ranking-pos.top2::before {
    content: "🥈 ";
}

.ranking-pos.top3::before {
    content: "🥉 ";
}

.ranking-nome {
    flex: 1;
    text-align: left;
    margin-left: 1rem;
}

.ranking-pontos {
    font-weight: bold;
    color: #888;
}

.carregando {
    text-align: center;
    color: #666;
    padding: 2rem;
}

/* Tela de Jogo */
#telaJogo {
    background: #000;
}

.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hud-item {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 5px;
    border: 1px solid #333;
}

.hud-label {
    color: #888;
    font-size: 0.9rem;
    margin-right: 10px;
}

.hud-valor {
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
}

#canvasJogo {
    display: block;
    width: 100%;
    height: 100%;
    background: #000;
}

/* Game Over Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: #111;
    border: 2px solid #fff;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    min-width: 300px;
    animation: slideUp 0.5s;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    letter-spacing: 3px;
}

.pontuacao-final {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: #888;
}

.pontuacao-final span {
    color: #fff;
    font-weight: bold;
}

.btn-reiniciar,
.btn-menu {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    border: 2px solid #fff;
    background: transparent;
    color: #fff;
    border-radius: 5px;
    cursor: pointer;
    margin: 0.5rem;
    transition: all 0.3s;
    letter-spacing: 1px;
}

.btn-reiniciar:hover,
.btn-menu:hover {
    background: #fff;
    color: #000;
    transform: scale(1.05);
}

.btn-reiniciar:active,
.btn-menu:active {
    transform: scale(0.95);
}

/* Créditos */
.creditos {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    pointer-events: none;
}

.creditos p {
    margin: 0;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
}

.creditos strong {
    color: #888;
    font-weight: bold;
}

/* Responsivo */
@media (max-width: 768px) {
    .titulo-jogo {
        font-size: 2rem;
    }
    
    .container-inicial {
        padding: 1rem;
    }
    
    .ranking-preview {
        padding: 1rem;
    }
    
    .hud {
        top: 10px;
        left: 10px;
    }
    
    .hud-item {
        padding: 8px 12px;
    }
    
    .hud-label,
    .hud-valor {
        font-size: 0.9rem;
    }
}

/* Scrollbar personalizada */
.lista-ranking::-webkit-scrollbar {
    width: 6px;
}

.lista-ranking::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.lista-ranking::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.lista-ranking::-webkit-scrollbar-thumb:hover {
    background: #444;
}
