/* ====================================================== */
/* 🎨 ARQUIVO GLOBAL: ICEGURT ARCADE (FINAL VERSION) */
/* ====================================================== */

/* 1. IMPORTANDO FONTES */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=Courier+Prime&display=swap');

/* 2. VARIÁVEIS E CORES */
:root {
    /* Cores da Marca */
    --icegurt-dark-blue: #004AAD; /* Azul Royal forte (Identidade) */
    --icegurt-light-blue: #E6F2FF; /* Azul bebê suave para fundos */
    --icegurt-red: #E60000; /* Vermelho vibrante para destaque */
    --icegurt-white: #FFFFFF; /* Branco puro */
    --icegurt-gray: #ECF0F1; /* Cinza neutro */
  
    /* Cores de Texto e Layout */
    --icegurt-text-dark: #002B5C; /* Azul marinho (Leitura fácil) */
    --icegurt-bg-color: #F4F9FF; /* Fundo geral (quase branco) */
}

/* ========================== */
/* ⚙️ BASE & GLOBAIS */
/* ========================== */
html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Poppins', sans-serif;
    background: var(--icegurt-bg-color);
    color: var(--icegurt-text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

p, a, span, h1, h2, h3, h4, .form-input {
    text-shadow: none; 
}

h1, h2, h3, h4 {
    font-weight: 700;
    color: var(--icegurt-dark-blue);
}

a {
    text-decoration: none;
    color: var(--icegurt-red);
    transition: color 0.2s;
}
a:hover {
    color: var(--icegurt-dark-blue);
}

/* ========================================= */
/* 👥 TEAM SECTION (Equipe Pro) */
/* ========================================= */
.team-list {
    list-style: none;
    margin: 30px 0 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.team-member {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--icegurt-white);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(0, 74, 173, 0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.team-member:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 74, 173, 0.15);
    border-color: var(--icegurt-dark-blue);
}

.team-member img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 50%;
    border: 5px solid var(--icegurt-red);
    margin-bottom: 20px;
    transition: transform 0.4s ease;
    box-shadow: 0 0 0 6px rgba(230, 0, 0, 0.1);
    background-color: #eee;
}

.team-member:hover img {
    transform: scale(1.1);
}

.team-member-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.team-member-info h5 {
    margin: 0 0 5px 0;
    font-size: 1.4rem;
    color: var(--icegurt-dark-blue);
    font-weight: 700;
}

.team-member-info a {
    font-size: 0.95rem;
    color: var(--icegurt-red);
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 15px;
}

.member-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-fullstack { background: #007bff; }
.badge-hardware  { background: #000000; color: #ffffff; }
.badge-support   { background: #6f42c1; }
.badge-video     { background: #dc3545; }
.badge-vm        { background: #28a745; }
.badge span { font-size: 1.1em; }

/* ========================== */
/* 🏗️ ESTRUTURA DE TELAS */
/* ========================== */
.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
}

#mainScreen.active {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-height: 100vh;
    justify-content: flex-start; 
    padding: 0;
    box-sizing: border-box;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

/* ========================== */
/* 🧊 PAINÉIS & CARDS */
/* ========================== */
.main-panel {
    background: var(--icegurt-white);
    border: 2px solid var(--icegurt-dark-blue);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 74, 173, 0.15);
    text-align: center;
    width: 100%;
}

.main-title {
    color: var(--icegurt-dark-blue);
    font-size: 2.5em;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.section-title {
    color: var(--icegurt-dark-blue);
    font-size: 2em;
    margin-bottom: 30px;
    text-align: center;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--icegurt-red);
    margin: 8px auto 0;
    border-radius: 2px;
}

/* ========================== */
/* 🔘 BOTÕES & INPUTS */
/* ========================== */
.form-input {
    width: 100%;
    padding: 14px;
    margin: 10px 0;
    background: var(--icegurt-light-blue);
    border: 2px solid #BDD7FF;
    color: var(--icegurt-text-dark);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--icegurt-dark-blue);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--icegurt-red);
    color: var(--icegurt-white);
    border: none;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    margin: 10px 0;
    box-shadow: 0 4px 0 #B30000;
    transition: transform 0.1s, box-shadow 0.1s;
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    background: #FF1A1A;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #B30000;
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #B30000;
}

.btn-primary:disabled {
    background: var(--icegurt-gray);
    cursor: not-allowed;
    box-shadow: none;
    color: #999;
}

.btn-small {
    background: rgba(255, 255, 255, 0.1);
    color: var(--icegurt-white);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9em;
}

.btn-small:hover {
    background: var(--icegurt-white);
    color: var(--icegurt-dark-blue);
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--icegurt-white);
    color: var(--icegurt-dark-blue);
    border: 2px solid var(--icegurt-dark-blue);
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--icegurt-light-blue);
    transform: translateY(-2px);
}

.btn-with-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-with-icon::first-letter {
    font-size: 1.3em;
}

/* ========================== */
/* 🔐 TELA AUTH */
/* ========================== */
#authScreen.active {
    padding: 20px;
    background: linear-gradient(135deg, var(--icegurt-light-blue) 0%, #FFFFFF 100%);
}

.auth-container {
    perspective: 1000px;
    width: 100%;
    max-width: 450px;
}

.auth-card {
    width: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    min-height: 500px;
}

.auth-card.is-flipped {
    transform: rotateY(180deg);
}

.auth-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.auth-back {
    transform: rotateY(180deg);
}

.auth-face .main-panel {
    min-height: 500px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ========================== */
/* 🧢 HEADER */
/* ========================== */
header {
    background: var(--icegurt-dark-blue);
    border-bottom: 5px solid var(--icegurt-red);
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100% !important;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

header h1 {
    color: var(--icegurt-white);
    font-size: 1.6em;
    margin: 0;
}

.user-info {
    color: var(--icegurt-white);
    display: flex;
    gap: 15px;
    align-items: center;
    font-weight: 500;
}

/* ========================== */
/* 🎮 MAIN & GAMES GRID */
/* ========================== */
main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
    flex-grow: 1;
    box-sizing: border-box;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
}

.game-card {
    background: var(--icegurt-white);
    border: 1px solid #DDD;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.game-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 74, 173, 0.15);
    border-color: var(--icegurt-dark-blue);
}

.game-card h3 {
    margin-top: 10px;
    font-size: 1.2em;
}

.game-card p {
    color: #666;
    font-size: 0.9em;
    margin: 10px 0 20px 0;
    flex-grow: 1;
}

.game-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

/* ========================== */
/* 🏆 LEADERBOARD */
/* ========================== */
.leaderboard-container {
    background: var(--icegurt-white);
    border: 1px solid #DDD;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    align-self: start;
}

.leaderboard-container h2 {
    font-size: 1.5em;
    border-bottom: 2px solid var(--icegurt-light-blue);
    padding-bottom: 10px;
}

.info-display {
    background: var(--icegurt-bg-color);
    border-left: 4px solid var(--icegurt-dark-blue);
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.95em;
}

.leaderboard-item:nth-child(1) {
    background: #FFF9E6;
    border-left-color: #FFD700;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.2);
}

/* ========================== */
/* 🛍️ LOJA */
/* ========================== */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.shop-item {
    background: var(--icegurt-white);
    border: 2px solid var(--icegurt-light-blue);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    transition: transform 0.2s;
}

.shop-item:hover {
    transform: translateY(-5px);
    border-color: var(--icegurt-dark-blue);
}

.shop-item-icon {
    font-size: 4em;
    margin-bottom: 10px;
}

.shop-item-price {
    font-weight: 700;
    color: var(--icegurt-red);
    font-size: 1.2em;
    margin-bottom: 15px;
}

/* ================================================= */
/* 🕹️ TELA DE JOGO (CORREÇÕES AQUI) */
/* ================================================= */

body.game-is-active {
    overflow: hidden;
    background: #1a1a1a;
}

body.game-is-active #mainScreen {
    display: none !important;
}

body.game-is-active #gameScreen.active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* CORREÇÃO DO KRUNKER (IFRAME) */
#gameScreen iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    border: none;
    z-index: 1; /* Fica atrás do Game Over */
    display: block;
}


/* ================================================= */
/* 🗃️ MODAIS & POPUPS (CORREÇÃO DA MENSAGEM DE SUCESSO) */
/* ================================================= */

.modal {
    position: fixed; /* Essencial: fixa na janela do navegador */
    top: 0;
    left: 0;
    width: 100vw; /* Ocupa a largura total da tela */
    height: 100vh; /* Ocupa a altura total da tela */
    
    /* Centraliza o conteúdo (a caixa branca) */
    display: flex; 
    align-items: center; 
    justify-content: center;
    
    background-color: rgba(0, 0, 0, 0.6); /* Fundo escuro semi-transparente */
    z-index: 10000; /* Garante que fique acima de tudo (incluindo o header) */
}

.modal-content {
    background: var(--icegurt-white); /* Cor de fundo da caixa */
    padding: 30px 40px;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

    
/* CORREÇÃO DA SNAKE (CANVAS) */
canvas {
    border: 6px solid var(--icegurt-dark-blue);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 74, 173, 0.4), 
                0 0 10px rgba(255, 255, 255, 0.1) inset;
    background-color: #000;
    max-width: 100%;
    max-height: 90vh;
    image-rendering: pixelated;
    z-index: 10;
}

/* Container genérico para centralizar */
.game-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 10;
}

/* ================================================= */
/* 💀 GAME OVER & RESULTADOS (ESTILO NOVO) */
/* ================================================= */
.game-result-panel {
    /* Fundo e Borda */
    background: #FFFFFF;
    border: 4px solid var(--icegurt-dark-blue);
    border-radius: 25px;
    
    /* Layout: Agora ele fica "no fluxo" da página, não flutuando */
    position: relative; 
    margin: 20px auto; /* Centraliza horizontalmente e dá espaço em cima/baixo */
    width: 90%;
    max-width: 600px; /* Um pouco mais largo para caber as infos */
    padding: 20px;
    text-align: center;
    
    /* Sombra simples (sem cobrir o fundo todo) */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    
    /* Removemos z-index alto e animação de pop-up */
    z-index: 1; 
}

.game-result-panel h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    text-shadow: none; /* Tirei a sombra para ficar mais limpo no branco */
    color: #000000; /* Preto para ler no fundo branco */
}

.game-result-panel p {
    color: #000000; /* Preto */
    font-size: 1.1rem;
    margin: 5px 0;
    font-weight: 500;
}

.game-result-panel .result-score {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--icegurt-red); /* Destaquei o score em Vermelho IceGurt (ou use #000) */
    margin: 10px 0 20px 0;
    line-height: 1;
}

/* Botões (caso apareçam aqui) */
.game-result-panel .result-buttons {
    display: flex;
    flex-direction: row; /* Botões lado a lado fica melhor no painel fixo */
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    width: 100%;
}

.game-result-panel button {
    width: auto !important; /* Deixa o botão do tamanho do texto */
    padding: 10px 20px !important;
    font-size: 1rem !important;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2) !important;
    cursor: pointer;
}

#btnPlayAgain {
    background: var(--icegurt-red) !important;
    color: white !important;
    border: none !important;
    text-transform: uppercase;
    border-radius: 8px;
}

#btnPlayAgain:hover {
    background: #cc0000 !important;
    transform: scale(1.05) !important;
}

#btnMenuFromResult {
    background: white !important;
    color: var(--icegurt-dark-blue) !important;
    border: 2px solid var(--icegurt-dark-blue) !important;
    border-radius: 8px;
}

#btnMenuFromResult:hover {
    background: var(--icegurt-light-blue) !important;
}

#btnPlayAgain {
    background: var(--icegurt-red) !important;
    color: white !important;
    border: none !important;
    text-transform: uppercase;
}

#btnPlayAgain:hover {
    background: #cc0000 !important;
    transform: scale(1.02) !important;
}

#btnMenuFromResult {
    background: white !important;
    color: var(--icegurt-dark-blue) !important;
    border: 2px solid var(--icegurt-dark-blue) !important;
}

#btnMenuFromResult:hover {
    background: var(--icegurt-light-blue) !important;
}

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#btnPlayAgain {
    background: var(--icegurt-red) !important;
    color: white !important;
    border: none !important;
    text-transform: uppercase;
}

#btnPlayAgain:hover {
    background: #cc0000 !important;
    transform: scale(1.02) !important;
}

#btnMenuFromResult {
    background: white !important;
    color: var(--icegurt-dark-blue) !important;
    border: 2px solid var(--icegurt-dark-blue) !important;
}

#btnMenuFromResult:hover {
    background: var(--icegurt-light-blue) !important;
}

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ================================================= */
/* ⬅️ BOTÃO VOLTAR AO MENU (FIXO) */
/* ================================================= */

.btn-back,
button[onclick*="Menu"],
button[onclick*="goBackMenu"],
button[onclick*="backToMenu"],
.back-button,
#backButton,
#btnBack,
#btnMenuFromGame {
    position: fixed !important;
    top: 20px !important;
    left: 20px !important;
    z-index: 99999 !important; /* Z-index altíssimo */
    
    background: var(--icegurt-red) !important;
    color: white !important;
    border: 3px solid white !important;
    border-radius: 50px !important;
    padding: 10px 25px !important;
    
    font-family: 'Poppins', sans-serif !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    text-transform: uppercase;
    
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
    cursor: pointer !important;
    transition: transform 0.2s ease, background 0.2s ease !important;
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.btn-back:hover,
#backButton:hover,
#btnBack:hover,
#btnMenuFromGame:hover {
    background: var(--icegurt-dark-blue) !important;
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(0, 74, 173, 0.4) !important;
}

/* ================================================= */
/* 📱 MOBILE LOCK & RESPONSIVIDADE */
/* ================================================= */

.game-card.mobile-disabled {
    opacity: 0.6;
    filter: grayscale(100%);
    pointer-events: none;
    position: relative;
}

.game-card.mobile-disabled::after {
    content: "🚫 Apenas Desktop";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-10deg);
    background: var(--icegurt-red);
    color: white;
    padding: 5px 15px;
    font-weight: bold;
    font-size: 1.2em;
    border: 2px solid white;
    border-radius: 5px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr !important;
        padding: 20px;
    }
    
    .leaderboard-container {
        order: -1;
        width: 100%;
        margin-bottom: 20px;
    }

    header {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
        text-align: center;
    }
    
    .user-info {
        flex-wrap: wrap;
        justify-content: center;
    }

    .game-result-panel {
        width: 95%;
        padding: 25px;
    }
    
    .game-result-panel h2 {
        font-size: 2rem;
    }

    .btn-back, #btnMenuFromGame {
        padding: 8px 16px !important;
        font-size: 0.8rem !important;
        top: 10px !important;
        left: 10px !important;
        opacity: 0.9;
    }
    
}