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

/* === GERAL === */
html, body {
    height: 100%;
    /* Garante que o fundo cubra tudo e ajusta para barras móveis */
    min-height: 100vh;
    min-height: 100dvh; 
    margin: 0;
    overflow: hidden;
    background: radial-gradient(circle at center, #1a0525 0%, #000000 100%);
    font-family: 'Rajdhani', sans-serif;
    color: white;
}

.hub-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.app-header {
    flex-shrink: 0;
    z-index: 100;
}

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

/* === TELAS (SCREENS) === */
.screen {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Desktop: sem scroll na tela principal */
    align-items: center;
}

.screen.active { display: flex; }

/* ==================================================
   MENU PRINCIPAL (SETUP)
   ================================================== */
.menu-content {
    display: flex;
    flex-direction: row; /* Desktop: Lado a lado */
    width: 90%;
    max-width: 1200px;
    height: 90%;
    gap: 30px;
    padding-bottom: 20px;
}

/* Painel Esquerdo */
.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.1);
    overflow-y: auto;
}

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

/* ==================================================
   CORREÇÃO MOBILE: ESPAÇAMENTO EXTRA
   ================================================== */
@media (max-width: 850px) {
    .screen {
        /* Permite rolar a tela inteira */
        overflow-y: auto !important; 
        overflow-x: hidden;
        height: 100% !important;
        display: none;
    }
    
    .screen.active {
        display: block !important; /* Block facilita o scroll */
    }

    .menu-content {
        display: flex;
        flex-direction: column; /* Coluna */
        height: auto !important;
        min-height: 100%;
        width: 95%;
        margin: 0 auto;
        gap: 15px;
        /* AQUI ESTÁ A CORREÇÃO: Espaço grande no final */
        padding-bottom: 150px; 
    }

    .menu-info, .side-panel-container {
        flex: none;
        height: auto !important;
        overflow: visible !important;
        max-height: none !important;
    }
    
    /* Ajustes visuais */
    .game-logo-large h1 { font-size: 2.5rem; text-align: center; }
    .icon-float { font-size: 3rem; display: block; margin: 0 auto; text-align: center; }
    .card-panel { padding: 15px; }
}

/* ==================================================
   GAMEPLAY E GRID
   ================================================== */
.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: flex-start;
    padding: 10px;
    box-sizing: border-box;
    overflow: hidden;
}

.hud-bar {
    flex-shrink: 0;
    width: 100%; max-width: 800px; height: 50px;
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(0,0,0,0.6);
    border: 1px solid var(--neon-purple);
    border-radius: 25px; padding: 0 20px; margin-bottom: 10px;
    box-sizing: border-box;
}

.crossword-container {
    flex: 1;
    display: flex;
    width: 100%;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
    min-height: 0;
}

/* Tabuleiro */
.cw-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols, 13), 1fr);
    grid-template-rows: repeat(var(--grid-rows, 13), 1fr);
    gap: 1px;
    width: min(90vw, 60vh);
    height: min(90vw, 60vh);
    background: rgba(20, 20, 30, 0.9);
    border: 2px solid var(--neon-purple);
    padding: 4px; border-radius: 8px;
    margin: 0 auto; flex-shrink: 0;
}

/* Células */
.cw-cell {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
}
.cw-cell.active { background: rgba(255, 255, 255, 0.1); border: 1px solid #777; border-radius: 2px; }
.cw-cell input {
    width: 100%; height: 100%; background: transparent; border: none;
    color: white; text-align: center; font-weight: bold; text-transform: uppercase;
    padding: 0; margin: 0; font-family: 'Rajdhani', sans-serif;
    font-size: clamp(8px, 2.5vh, 24px);
}
.cw-cell .cell-number {
    position: absolute; top: 0px; left: 1px;
    font-size: clamp(6px, 1vh, 10px); color: var(--neon-yellow);
    pointer-events: none; line-height: 1;
}
.cw-cell.highlight { background: rgba(255, 255, 0, 0.2) !important; border-color: var(--neon-yellow) !important; }
.cw-cell.focused { background: rgba(255, 255, 0, 0.4) !important; box-shadow: 0 0 5px white; z-index: 2; }
.cw-cell.correct input { color: var(--neon-green); text-shadow: 0 0 5px var(--neon-green); }
.cw-cell.wrong input { color: var(--neon-red); }

/* Dicas e Banner */
.clues-panel {
    width: 300px; display: flex; flex-direction: column;
    background: rgba(20, 20, 20, 0.9); border: 1px solid #444; border-radius: 10px;
    padding: 15px; height: 100%; max-height: 60vh;
}
.clues-scroll { flex: 1; overflow-y: auto; }
.clues-panel h4 { margin: 0 0 10px 0; color: var(--neon-purple); border-bottom: 1px solid #444; }
.clue-group h5 { margin: 10px 0 5px 0; color: #aaa; }
.clue-list { list-style: none; padding: 0; margin: 0; }
.clue-list li { padding: 6px; font-size: 0.9rem; color: #ccc; border-bottom: 1px solid rgba(255,255,255,0.05); cursor: pointer; }
.clue-list li:hover, .clue-list li.active-clue-item { background: rgba(255,255,255,0.1); color: white; border-left: 3px solid var(--neon-yellow); }

.active-clue-box {
    display: none; flex-shrink: 0; width: 95%;
    background: rgba(30, 30, 40, 0.95); border: 1px solid var(--neon-yellow);
    border-radius: 8px; padding: 8px; text-align: center;
    font-weight: bold; margin-bottom: 10px; min-height: 40px;
    justify-content: center; align-items: center; font-size: 0.9rem;
}
.mobile-check-btn { display: none; margin-top: 10px; width: 90%; flex-shrink: 0; margin-bottom: 20px; }

/* Mobile Gameplay */
@media (max-width: 850px) {
    .game-area { 
        overflow-y: auto; /* Permite scroll no jogo */
        display: block; 
        padding-bottom: 100px; /* Espaço extra no final do jogo também */
    }
    .crossword-container { flex-direction: column; align-items: center; overflow: visible; height: auto; }
    .clues-panel { display: none; }
    .active-clue-box { display: flex; margin: 0 auto 10px auto; }
    .mobile-check-btn { display: block; margin: 10px auto; }
    .cw-grid { width: 95vw; height: 95vw; max-height: 55vh; }
}

/* === OUTROS === */
.section-title { color: var(--neon-purple); 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; }
.checklist-area { max-height: 200px; overflow-y: auto; background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; padding: 10px; display: grid; gap: 5px; }
.checklist-area label { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 8px; color: #fff; background: rgba(255,255,255,0.05); border-radius: 4px; }
.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: #0b0515; border: 2px solid var(--neon-purple); padding: 30px; border-radius: 20px; text-align: center; 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); }
.icon-float { font-size: 5rem; animation: floatIcon 3s infinite; }
@keyframes floatIcon { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }