/* ============================================
   JOGOS - CSS Padronizado
   Portal WebEngine
   ============================================ */

/* Variáveis de cores para jogos (complementares ao style.css) */
:root {
    --game-bg: #0f172a;
    --game-surface: #1e293b;
    --game-surface-light: #334155;
    --game-border: #475569;
    --game-text: #ffffff;
    --game-text-muted: #94a3b8;
    --game-accent: #10b981;
    --game-accent-hover: #059669;
    --game-danger: #ef4444;
    --game-warning: #f59e0b;
    --game-info: #3b82f6;
    --game-radius-sm: 8px;
    --game-radius-md: 12px;
    --game-radius-lg: 16px;
    --game-radius-xl: 24px;
    --game-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --game-transition: 0.3s ease;
}

[data-theme="dark"] {
    --game-bg: #020617;
    --game-surface: #0f172a;
    --game-surface-light: #1e293b;
}

/* ============================================
   LOBBY - Seleção de Jogos
   ============================================ */
.game-lobby {
    min-height: 100vh;
    background: var(--game-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5rem 1.5rem;
    overflow: hidden;
    position: relative;
}

.game-lobby::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: 
        radial-gradient(circle at 25% 25%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
}

.game-lobby-container {
    max-width: 72rem;
    width: 100%;
    position: relative;
    z-index: 10;
}

.game-lobby-header {
    text-align: center;
    margin-bottom: 4rem;
}

.game-lobby-title {
    font-family: 'Roboto', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    color: var(--game-text);
    text-transform: uppercase;
    font-style: italic;
    letter-spacing: -0.05em;
    line-height: 1;
    margin-bottom: 1rem;
}

.game-lobby-title span {
    color: var(--game-accent);
}

.game-lobby-subtitle {
    color: var(--game-text-muted);
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3em;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

.game-card {
    position: relative;
    cursor: pointer;
}

.game-card-glow {
    position: absolute;
    inset: -4px;
    background: linear-gradient(135deg, var(--game-accent), var(--game-info));
    border-radius: 3rem;
    filter: blur(16px);
    opacity: 0.25;
    transition: opacity var(--game-transition);
}

.game-card:hover .game-card-glow {
    opacity: 1;
}

.game-card-content {
    position: relative;
    background: var(--game-surface);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2.5rem;
    border-radius: 3rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform var(--game-transition);
}

.game-card:hover .game-card-content {
    transform: translateY(-8px);
}

.game-card-icon {
    width: 6rem;
    height: 6rem;
    background: var(--game-bg);
    border-radius: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin-bottom: 2rem;
    box-shadow: var(--game-shadow);
    transition: transform var(--game-transition);
}

.game-card:hover .game-card-icon {
    transform: scale(1.1);
}

.game-card-title {
    font-family: 'Roboto', sans-serif;
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--game-text);
    text-transform: uppercase;
    font-style: italic;
    margin-bottom: 1rem;
}

.game-card-desc {
    color: var(--game-text-muted);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.game-card-btn {
    margin-top: auto;
    padding: 1rem 2.5rem;
    border-radius: var(--game-radius-lg);
    font-weight: 900;
    text-transform: uppercase;
    font-style: italic;
    border: none;
    cursor: pointer;
    transition: all var(--game-transition);
    font-family: 'Roboto', sans-serif;
}

.game-card-btn-primary {
    background: var(--game-accent);
    color: var(--game-bg);
}

.game-card-btn-primary:hover {
    background: var(--game-text);
}

.game-card-btn-danger {
    background: var(--game-danger);
    color: var(--game-text);
}

.game-card-btn-danger:hover {
    background: var(--game-text);
    color: var(--game-danger);
}

.game-card-btn-info {
    background: var(--game-info);
    color: var(--game-text);
}

.game-card-btn-info:hover {
    background: var(--game-text);
    color: var(--game-info);
}

/* ============================================
   GAME - HUD (Heads-Up Display)
   ============================================ */
.game-hud {
    width: 100%;
    max-width: 42rem;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.game-hud-item {
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid var(--game-surface-light);
    padding: 0.5rem 1rem;
    border-radius: var(--game-radius-md);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    text-align: right;
}

.game-hud-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--game-text-muted);
    letter-spacing: 0.15em;
    font-weight: 700;
    display: block;
}

.game-hud-value {
    font-size: 1.5rem;
    font-weight: 900;
}

.game-hud-value-level {
    color: var(--game-warning);
}

.game-hud-value-score {
    color: var(--game-accent);
}

.game-hud-title {
    text-align: center;
}

.game-hud-title h1 {
    font-family: 'Roboto', sans-serif;
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    font-style: italic;
    color: #e2e8f0;
}

.game-audio-status {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    animation: pulse 2s infinite;
}

.game-audio-status.active {
    color: var(--game-accent);
    animation: none;
}

.game-audio-status.inactive {
    color: var(--game-danger);
}

/* ============================================
   GAME - Canvas / Área do Jogo
   ============================================ */
.game-area {
    position: relative;
    width: 100%;
    max-width: 48rem;
    padding: 0 0.5rem;
}

.game-canvas {
    width: 100%;
    height: auto;
    border-radius: var(--game-radius-lg);
    border: 4px solid var(--game-surface-light);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    background: var(--game-surface);
    touch-action: none;
}

/* ============================================
   GAME - Modal (Game Over / Vitória)
   ============================================ */
.game-modal {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--game-radius-lg);
    z-index: 50;
    padding: 1.5rem;
    text-align: center;
}

.game-modal-gameover {
    border: 4px solid rgba(239, 68, 68, 0.5);
}

.game-modal-victory {
    border: 4px solid rgba(16, 185, 129, 0.5);
}

.game-modal-title {
    font-family: 'Roboto', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    text-transform: uppercase;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.game-modal-title-gameover {
    color: var(--game-danger);
}

.game-modal-title-victory {
    color: var(--game-accent);
}

.game-modal-msg {
    color: var(--game-text-muted);
    margin-bottom: 1.5rem;
}

.game-modal-btn {
    width: 100%;
    max-width: 20rem;
    padding: 1rem 2rem;
    font-weight: 900;
    border-radius: var(--game-radius-lg);
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    font-family: 'Roboto', sans-serif;
    transition: all var(--game-transition);
    margin-bottom: 1rem;
}

.game-modal-btn-retry {
    background: var(--game-accent);
    color: var(--game-text);
    box-shadow: 0 4px 0 var(--game-accent-hover);
}

.game-modal-btn-retry:active {
    transform: translateY(4px);
    box-shadow: none;
}

.game-modal-btn-next {
    background: var(--game-info);
    color: var(--game-text);
}

/* ============================================
   GAME - Controles Mobile
   ============================================ */
.game-controls {
    width: 100%;
    max-width: 28rem;
    margin-top: auto;
    margin-bottom: 2rem;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.game-controls-dpad {
    display: flex;
    gap: 1rem;
}

.game-btn {
    width: 5rem;
    height: 5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--game-radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
    transition: all var(--game-transition);
    outline: none;
    color: var(--game-text);
}

.game-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.2);
}

.game-btn svg {
    width: 50px;
    height: 50px;
}

.game-btn-action {
    width: 7rem;
    height: 7rem;
    background: rgba(16, 185, 129, 0.5);
    border-bottom: 4px solid var(--game-accent-hover);
    font-size: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.5rem;
}

.game-btn-action:active {
    background: var(--game-accent);
    transform: translateY(4px);
}

/* ============================================
   GAME - Instruções (Desktop)
   ============================================ */
.game-instructions {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--game-text-muted);
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-top: 2rem;
    opacity: 0.6;
}

@media (min-width: 1024px) {
    .game-instructions {
        display: flex;
    }
}

.game-instructions i {
    font-size: 1rem;
    animation: pulse 2s infinite;
}

.game-instructions span {
    color: var(--game-accent);
}

.game-instructions kbd {
    border: 1px solid var(--game-surface-light);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.2);
}

/* ============================================
   GAME - Botão Voltar
   ============================================ */
.game-back {
    margin-top: 3rem;
    text-align: center;
}

.game-back-btn {
    color: var(--game-text-muted);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.7rem;
    transition: color var(--game-transition);
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
}

.game-back-btn:hover {
    color: var(--game-accent);
}

.game-back-btn i {
    margin-right: 0.5rem;
}

/* ============================================
   MEMORY GAME - Estilos específicos
   ============================================ */
.memory-game {
    display: grid;
    gap: 8px;
    perspective: 1000px;
    margin: 0 auto;
    width: 100%;
}

.card-memory {
    aspect-ratio: 1/1;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.card-memory.flip {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--game-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-back {
    background: linear-gradient(135deg, var(--game-accent) 0%, var(--game-accent-hover) 100%);
    color: var(--game-text);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.2);
}

.card-front {
    background: var(--game-text);
    transform: rotateY(180deg);
    border: 2px solid var(--game-accent);
    box-shadow: inset 0 0 10px rgba(16, 185, 129, 0.1);
    line-height: 1;
    user-select: none;
}

.card-memory.golden .card-back {
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%) !important;
    border: 3px solid var(--game-text);
    animation: special-pulse 1.5s infinite;
    z-index: 10;
}

.card-memory.neural .card-back {
    background: linear-gradient(135deg, #fbbf24 0%, #4338ca 100%) !important;
    border: 3px solid var(--game-text);
    animation: special-pulse 1.5s infinite;
    z-index: 10;
}

@keyframes special-pulse {
    0% { box-shadow: 0 0 0 0px rgba(255, 255, 255, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0px rgba(255, 255, 255, 0); }
}

#game-board-container {
    width: 100%;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

/* Ranking */
.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--game-surface-light);
}

.rank-pos {
    width: 28px;
    height: 28px;
    background: var(--game-surface);
    color: var(--game-text);
    border-radius: var(--game-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
}

/* ============================================
   MAZE GAME - Estilos específicos
   ============================================ */
.maze-wall {
    background: var(--game-surface-light);
    border: 1px solid var(--game-border);
    border-radius: 2px;
}

.maze-path {
    background: var(--game-surface);
}

.maze-entity {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    transition: transform 0.1s linear;
    will-change: transform;
}

.maze-predator {
    z-index: 40;
    filter: drop-shadow(0 0 12px var(--game-danger));
}

.maze-target {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 1; }
}

.maze-danger {
    animation: danger-pulse 1s infinite;
    border: 4px solid var(--game-danger);
    border-radius: 12px;
}

@keyframes danger-pulse {
    0%, 100% { box-shadow: inset 0 0 20px rgba(239, 68, 68, 0); }
    50% { box-shadow: inset 0 0 60px rgba(239, 68, 68, 0.6); }
}

.d-pad-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.5rem;
    color: var(--game-text-muted);
    transition: all 0.1s;
    cursor: pointer;
    user-select: none;
}

.d-pad-btn:active {
    background: var(--game-danger);
    color: var(--game-text);
    transform: scale(0.9);
}

/* ============================================
   UTILITÁRIOS
   ============================================ */
.game-hidden {
    display: none !important;
}

.game-flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes animate-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: animate-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ============================================
   RESPONSIVO
   ============================================ */
@media (max-width: 768px) {
    .game-lobby-title {
        font-size: 2rem;
    }
    
    .game-lobby-subtitle {
        font-size: 0.75rem;
        letter-spacing: 0.2em;
    }
    
    .game-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .game-card-content {
        padding: 1.5rem;
    }
    
    .game-hud {
        padding: 0.75rem;
    }
    
    .game-hud-item {
        padding: 0.375rem 0.75rem;
    }
    
    .game-hud-value {
        font-size: 1.25rem;
    }
    
    .game-btn {
        width: 4rem;
        height: 4rem;
    }
    
    .game-btn svg {
        width: 40px;
        height: 40px;
    }
    
    .game-btn-action {
        width: 6rem;
        height: 6rem;
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    .game-lobby {
        padding: 3rem 1rem;
    }
    
    .game-lobby-title {
        font-size: 1.5rem;
    }
    
    .game-controls {
        padding: 0 1rem;
    }
}