/* public/modules/caca-palavras/style.css */

/* === GERAL === */
body {
    overflow: hidden; 
    user-select: none;
    display: flex; 
    flex-direction: column; 
    height: 100vh;
    background: radial-gradient(circle at center, #0a1525 0%, #000000 100%); /* Azul escuro */
    margin: 0; 
    font-family: var(--font-main);
}

.hub-container { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    width: 100%; 
    position: relative; 
    overflow: hidden; 
    align-items: center; 
}

.app-header { z-index: 100; }
.btn-config-header { 
    color: white; 
    text-decoration: none; 
    display: flex; 
    align-items: center; 
    margin-left: 20px; 
}

/* === TELAS === */
.screen { 
    display: none; 
    width: 100%; 
    height: 100%; 
    flex-direction: column; 
    align-items: center; 
    opacity: 0; 
    transition: opacity 0.3s; 
}
.screen.active { display: flex; opacity: 1; }

/* === SETUP & MENU === */
.menu-content { 
    display: flex; 
    width: 90%; 
    max-width: 1200px; 
    height: 90%; 
    gap: 30px; 
    padding-bottom: 20px; 
}

.menu-info { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    padding: 20px; 
    background: rgba(255,255,255,0.03); 
    border-radius: 20px; 
    border: 1px solid rgba(255,255,255,0.05); 
    overflow-y: auto; 
}

.side-panel-container { 
    flex: 0.8; 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
    overflow-y: auto; 
}

.section-title { 
    color: var(--neon-blue); 
    font-family: var(--font-gamer); 
    font-size: 1.5rem; 
    margin-bottom: 15px; 
    border-bottom: 1px solid rgba(255,255,255,0.1); 
    padding-bottom: 10px; 
}

.game-logo-large h1 { 
    font-family: var(--font-gamer); 
    font-size: 3.5rem; 
    line-height: 0.9; 
    margin: 0; 
    background: linear-gradient(to right, #fff, var(--neon-blue)); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
    text-shadow: 0 0 30px rgba(0, 100, 255, 0.5); 
}

.icon-float { 
    font-size: 5rem; 
    color: var(--neon-blue); 
    margin-bottom: 10px; 
    animation: floatIcon 3s ease-in-out infinite; 
}

/* === INPUTS === */
.checklist-area { 
    max-height: 200px; 
    overflow-y: auto; 
    background: rgba(0,0,0,0.3); 
    border: 1px solid rgba(255,255,255,0.1); 
    border-radius: 8px; 
    padding: 10px; 
    display: grid; 
    gap: 5px; 
    margin-bottom: 15px; 
}
.checklist-area label { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    cursor: pointer; 
    padding: 5px; 
    border-radius: 4px; 
    transition: 0.2s; 
    font-size: 0.9rem; 
    color: #ddd; 
}
.checklist-area label:hover { background: rgba(255,255,255,0.05); }
.checklist-area input[type="checkbox"] { accent-color: var(--neon-blue); width: 16px; height: 16px; }

.btn-neon { 
    background: linear-gradient(90deg, var(--neon-blue), #0055ff); 
    border: none; 
    color: white; 
    padding: 15px; 
    border-radius: 8px; 
    font-weight: bold; 
    cursor: pointer; 
    text-transform: uppercase; 
    box-shadow: 0 0 15px rgba(0, 100, 255, 0.3); 
    transition: 0.3s; 
}
.btn-neon:hover { 
    transform: scale(1.02); 
    box-shadow: 0 0 25px rgba(0, 100, 255, 0.5); 
}

.btn-secondary { 
    background: transparent; 
    border: 1px solid rgba(255,255,255,0.2); 
    color: white; 
    padding: 12px; 
    border-radius: 8px; 
    cursor: pointer; 
    transition: 0.3s; 
}
.btn-secondary:hover { 
    background: rgba(255,255,255,0.1); 
    border-color: white; 
}

/* === GAMEPLAY === */
.game-area { 
    display: flex; 
    flex-direction: column; 
    width: 100%; 
    height: 100%; 
    align-items: center; 
    justify-content: center; 
}

.hud-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    width: 90%; 
    max-width: 900px; 
    margin-bottom: 10px; 
    background: rgba(0, 10, 20, 0.8); 
    padding: 10px 20px; 
    border-radius: 30px; 
    border: 1px solid var(--neon-blue); 
}
.player-turn-badge { 
    color: var(--neon-yellow); 
    font-weight: bold; 
    font-family: var(--font-gamer); 
    text-transform: uppercase; 
}

.main-stage { 
    display: flex; 
    flex-direction: column; 
    width: 95%; 
    max-width: 600px; 
    height: 80%; 
    gap: 10px; 
    align-items: center; 
}

/* === GRADE (GRID) RESPONSIVA === */
.word-grid {
    display: grid;
    /* grid-template-columns é definido no JS via style inline */
    gap: 2px;
    background: rgba(255,255,255,0.05);
    padding: 5px;
    border-radius: 10px;
    border: 1px solid var(--neon-blue);
    user-select: none;
    touch-action: none; /* Importante para mobile não rolar a tela ao arrastar */
    
    /* Configuração fluida */
    width: 100%;
    max-width: 500px; /* Limite em telas grandes */
    aspect-ratio: 1 / 1; /* Mantém sempre quadrado */
    margin: 0 auto;
}

.grid-cell {
    width: auto; 
    height: auto;
    aspect-ratio: 1 / 1; /* Células quadradas */
    display: flex; 
    justify-content: center; 
    align-items: center;
    
    font-family: var(--font-gamer); 
    /* Fonte escala com a tela, mínimo 0.8rem, ideal 3% da largura, max 1.4rem */
    font-size: clamp(0.8rem, 3vw, 1.4rem); 
    font-weight: bold;
    
    color: #aaa;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: 0.1s;
}

.grid-cell:hover { background: rgba(255,255,255,0.1); }

/* ESTADOS DA CÉLULA */
.grid-cell.selecting { 
    background: var(--neon-yellow); 
    color: black; 
    box-shadow: 0 0 10px var(--neon-yellow); 
    transform: scale(1.1); 
    z-index: 10; 
}
.grid-cell.found { 
    background: var(--neon-green); 
    color: black; 
    box-shadow: 0 0 5px var(--neon-green); 
    animation: popIn 0.3s; 
}

/* LISTA DE PALAVRAS */
.words-panel { width: 100%; text-align: center; }
.words-panel h3 { color: var(--neon-blue); font-size: 1rem; margin-bottom: 5px; }
.words-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.word-item { padding: 5px 10px; background: rgba(255,255,255,0.1); border-radius: 5px; font-size: 0.9rem; color: #ddd; }
.word-item.found { text-decoration: line-through; color: #555; background: rgba(0, 255, 136, 0.1); }

/* === MODAIS === */
.modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.95); display: none; justify-content: center; align-items: center; 
    z-index: 5000; 
}
.modal-content { 
    background: #0a1525; border: 2px solid var(--neon-blue); 
    padding: 30px; border-radius: 20px; text-align: center; 
    box-shadow: 0 0 50px rgba(0, 100, 255, 0.2); 
    width: 85%; max-width: 400px; 
}
.room-code-big { 
    font-size: 4rem; color: var(--neon-yellow); margin: 10px 0; 
    letter-spacing: 5px; font-family: var(--font-gamer); 
}

/* Placar flutuante/fixo (agora integrado na HUD via JS, mas mantemos estilo caso usado) */
#top-score-display { 
    /* Em telas grandes pode ficar oculto se já estiver na HUD, 
       mas o JS atual controla a visibilidade. 
       Estilos mantidos para fallback */
    font-family:'Rajdhani'; color:var(--neon-green); font-size:1.5rem; text-shadow:0 0 10px black; 
}

/* LOBBY & RANKING */
.rank-item { padding:10px; border-bottom:1px solid #333; display:flex; justify-content:space-between; }
.rank-item.online { border-left: 3px solid var(--neon-green); background: rgba(0, 255, 136, 0.05); }
.rank-item.offline { border-left: 3px solid var(--neon-red); background: rgba(255, 0, 0, 0.05); opacity: 0.7; }

.rank-1 span:first-child::before { content: '🥇 '; }
.rank-2 span:first-child::before { content: '🥈 '; }
.rank-3 span:first-child::before { content: '🥉 '; }
.rank-1 { color: #ffd700 !important; font-weight:bold; border-color: #ffd700 !important; }
.rank-2 { color: #c0c0c0 !important; font-weight:bold; border-color: #c0c0c0 !important; }
.rank-3 { color: #cd7f32 !important; font-weight:bold; border-color: #cd7f32 !important; }

.simple-list li { padding: 10px; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; }
.simple-list li:last-child { border-bottom: none; }

.icon-btn:hover { transform: scale(1.2); filter: drop-shadow(0 0 5px white); }

/* === ANIMAÇÕES === */
@keyframes popIn { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes floatIcon { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* === RESPONSIVIDADE (MEDIA QUERIES) === */

/* Tablets e Mobile (Menu Vertical) */
@media (max-width: 768px) {
    .menu-content {
        flex-direction: column;
        width: 95%;
        height: 100%;
        overflow-y: auto;
        padding-bottom: 80px;
    }

    .menu-info, .side-panel-container {
        width: 100%;
        flex: none;
        height: auto;
        overflow: visible;
    }
    
    .game-logo-large h1 { font-size: 2.5rem; }
    .icon-float { font-size: 3rem; }
    
    .btn-neon, .btn-secondary { padding: 15px; font-size: 1rem; }
}

/* Celulares (Gameplay Ajustado) */
@media (max-width: 600px) {
    .game-area {
        justify-content: flex-start; /* Começa do topo para dar espaço */
        padding-top: 10px;
    }

    .main-stage {
        width: 98%;
        height: auto;
        gap: 15px;
    }

    /* HUD mais compacta */
    .hud-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 8px;
        border-radius: 15px;
    }
    .player-turn-badge { font-size: 0.9rem; width: 100%; text-align: center; order: -1; }
    
    /* Grade ocupa largura total */
    .word-grid {
        max-width: 100%;
        gap: 1px;
    }
    
    /* Lista de palavras menor */
    .words-panel h3 { font-size: 0.9rem; }
    .word-item {
        padding: 4px 8px;
        font-size: 0.8rem;
        background: rgba(255,255,255,0.08);
    }
}