/* responsive.css — Estilos adaptativos */
@import url('../core/variables.css');

.hidden-desktop {
    display: none !important;
}

/* TABLET Y MÓVIL ≤ 780px — UI TIPO APP (Zero Scroll) */
@media (max-width: 780px) {

    body {
        overflow: hidden !important; 
        height: 100dvh;
        width: 100vw;
    }

    .hidden-desktop {
        display: flex !important;
    }

    /* Optimizaciones de Rendimiento GPU */
    .menu-card, .card, .dice-card, #winner-modal, .special-toast, .heroes-card, .log-card {
        backdrop-filter: none !important;
    }
    
    .menu-card { background: rgba(5, 12, 8, 0.98); }
    .card { background: rgba(3, 10, 6, 0.95); box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
    #winner-modal { background: rgba(0,0,0,0.98) !important; }
    .winner-box { box-shadow: 0 0 20px rgba(0,255,136,0.1) !important; }
    .board-frame { box-shadow: 0 0 0 1px rgba(0,255,136,0.1), inset 0 0 15px rgba(0,0,0,0.5) !important; }
    .special-toast { box-shadow: 0 4px 12px rgba(0,0,0,0.6) !important; }

    /* Estructura Zero-Scroll */
    #game-screen {
        padding: 6px 4px 60px 4px; /* Espacio reservado para Bottom Bar */
        height: 100dvh;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
    }

    h1 {
        font-size: clamp(0.7rem, 4.5vw, 1.2rem);
        letter-spacing: 0px;
        margin-bottom: 2px;
    }

    .subtitle { display: none; }
    .header-ornament { margin-bottom: 4px; }
    
    .header-wrap {
        margin-bottom: 4px;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Indicador de turno móvil fijo superior */
    .mobile-turn-indicator {
        background: rgba(0, 255, 136, 0.05);
        border: 1px solid rgba(0, 255, 136, 0.3);
        border-radius: 4px;
        padding: 4px 10px;
        margin-top: 4px;
        font-family: 'Cinzel', serif;
        font-size: 0.70rem;
        color: var(--gold-dim);
        justify-content: center;
        align-items: center;
        gap: 6px;
    }
    
    .turn-player {
        color: var(--green);
        font-weight: 700;
        font-size: 0.75rem;
    }

    .game-wrapper {
        display: flex;
        flex: 1;
        overflow: hidden;
        position: relative;
    }

    /* Área central = Sólo Tablero */
    .board-container {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        width: 100%;
    }

    .board-frame {
        padding: 6px;
        width: 100%;
        max-width: 480px; /* Expandido para tablet */
        margin: 0 auto;
    }

    #board {
        gap: 2px;
        padding: 4px;
    }

    .cell .cell-label { display: none; }
    .cell .num { font-size: 0.5rem; }
    .cell .cell-icon { font-size: 0.75rem; }

    /* Modales Inferiores App-Like (Drawers) */
    .heroes-card, .log-card, #game-legend {
        position: fixed !important;
        bottom: 56px; /* Justo arriba de la navbar inferior */
        left: 0;
        right: 0;
        margin: 0;
        z-index: 90;
        background: rgba(6, 12, 9, 0.98);
        border-top: 1px solid var(--green-dim);
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 25px rgba(0,0,0,0.9);
        transform: translateY(150%);
        transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
        max-height: 55vh;
        overflow-y: auto;
        padding: 16px;
    }

    /* Clase que abre el panel via JS */
    .heroes-card.open, .log-card.open, #game-legend.open {
        transform: translateY(0);
    }
    
    .close-mobile-btn {
        background: none;
        border: none;
        color: var(--text-dim);
        font-size: 0.9rem;
        cursor: pointer;
        padding: 4px;
        margin-left: auto;
    }
    
    .card-title {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Botón Flotante Central del Dado (FAB) */
    .card.dice-card {
        position: fixed !important;
        bottom: 70px; /* Flotando poco más arriba de la barra inferior */
        left: 50%;
        transform: translateX(-50%);
        width: max-content;
        min-width: 140px;
        padding: 12px 20px;
        z-index: 80;
        background: rgba(5, 14, 8, 0.98);
        border-radius: 12px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.8);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        border: 1px solid var(--gold-dim);
    }

    .card.dice-card .card-title,
    .card.dice-card p {
        display: none !important;
    }

    .dice-container {
        display: flex;
        gap: 8px !important;
        margin: 0 !important;
    }

    .dice {
        width: 46px;
        height: 46px;
        padding: 6px;
        margin: 0;
    }

    #roll-btn {
        font-size: 0.75rem;
        padding: 10px 20px;
        letter-spacing: 1px;
        margin: 0;
        width: 100%;
        white-space: nowrap;
    }

    /* BARRA DE BOTONES NAVEGACIÓN INFERIOR */
    .mobile-bottom-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: rgba(3, 8, 5, 0.98);
        border-top: 1px solid rgba(0, 255, 136, 0.15);
        justify-content: space-around;
        align-items: flex-start;
        z-index: 100;
        padding: 0 10px;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-nav-btn {
        background: none;
        border: none;
        color: var(--parchment);
        font-family: 'Cinzel', serif;
        font-size: 0.70rem;
        padding: 12px 10px;
        transition: color 0.2s, text-shadow 0.2s;
        cursor: pointer;
        flex: 1;
        opacity: 0.8;
    }

    .mobile-nav-btn.active {
        color: var(--green);
        text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
        opacity: 1;
    }

    /* Ajustes menores de los paneles internos */
    .player-row { padding: 6px 8px; margin-bottom: 4px; }
    .player-name { font-size: 0.7rem; }
    .player-pos { font-size: 0.65rem; }
    #log { max-height: 200px; }
    .log-entry { font-size: 0.75rem; }
    .legend { flex-direction: column; align-items: flex-start; gap: 8px; font-size: 0.7rem; }
    
    /* Toast y Modales */
    .special-toast {
        top: 10px;
        min-width: 180px;
        max-width: calc(100vw - 24px);
        padding: 10px 14px;
        gap: 8px;
    }
    .toast-emoji { font-size: 1.5rem; }
    .toast-title { font-size: 0.75rem; }
    .toast-desc { font-size: 0.75rem; }
    .winner-box { padding: 30px 20px; margin: 16px; }
}

/* MENÚ START PRINCIPAL responsivo ≤ 520px */
@media (max-width: 520px) {
    #menu-screen { padding: 14px 12px; }
    .menu-title { font-size: clamp(1rem, 6vw, 1.7rem); line-height: 1.2; }
    .menu-subtitle { font-size: 0.82rem; margin-bottom: 20px; }
    .menu-card { padding: 18px 14px; }
    .menu-card h2 { font-size: 0.78rem; letter-spacing: 1.5px; margin-bottom: 14px; }
    .ornament-line { width: 70px; }
    .player-label { font-size: 0.72rem; letter-spacing: 1px; }
    .select-wrapper select { font-size: 0.8rem; padding: 8px 12px 8px 14px; }
    .btn-start { font-size: 0.82rem; padding: 11px; }
}