:root {
    --bg-primary: #f0f0f0;
    --bg-secondary: #ffffff;
    --accent: #000000;
    --text-primary: #3c3c3c;
    --text-secondary: #787878;
    --border-light: #d2d2d2;
    --shadow: rgba(0, 0, 0, 0.1);
    --card-bg: #ffffff;
    --header-bg: #000000;
    --jogo-bg: #1a1a1a;
    --jogo-grid: #333;
}

body.modo-escuro {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --accent: #ffffff;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-light: #333333;
    --shadow: rgba(0, 0, 0, 0.3);
    --card-bg: #1e1e1e;
    --header-bg: #1a1a1a;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: entradaPagina 0.8s ease-out;
}

@keyframes entradaPagina {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fundo-animado {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; overflow: hidden; pointer-events: none; opacity: 0.6;
}
.blob { position: absolute; border-radius: 50%; }
.blob-1 { width: 200px; height: 200px; background: #C4B454; top: -50px; left: -50px; animation: flutuar 10s infinite alternate; }
.blob-2 { width: 250px; height: 250px; background: #D42426; bottom: -50px; right: -50px; animation: flutuar 12s infinite alternate-reverse; }
.blob-3 { width: 180px; height: 180px; background: #2E7D32; top: 40%; right: 20%; animation: flutuar 15s infinite alternate; }
.blob-4 { width: 150px; height: 150px; background: #A39770; bottom: 20%; left: 20%; animation: flutuar 18s infinite alternate-reverse; }

@keyframes flutuar { 0% { transform: translate(0,0); } 100% { transform: translate(30px, 50px); } }

header {
    background-color: var(--header-bg);
    color: #ffffff;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    flex-shrink: 0; 
}

.botao-voltar {
    position: absolute;
    left: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    text-decoration: none;
}

.icone-conquistas {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

h1 {
    font-size: 1.2rem;
    margin: 0;
}

.container-principal {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.grid-jogos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.cartao-jogo {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 10px var(--shadow);
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid transparent;
}

.cartao-jogo:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.icone-jogo {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

.nome-jogo {
    font-weight: 700;
    color: var(--text-primary);
}

.area-jogo {
    display: none;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; 
    position: relative;
    padding: 10px;
    overflow-y: auto; 
}

.jogo-dom {
    width: 100%;
    max-width: 400px;
    display: none;
    flex-direction: column;
    align-items: center;
}

#canvas-jogo {
    background-color: var(--jogo-bg);
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow);
    max-width: 100%;
    height: auto; 
    max-height: 55vh; 
    display: none;
    width: 100%;
    object-fit: contain;
}

.placar-container {
    width: 100%;
    max-width: 400px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.btn-fechar-jogo {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

.controles-mobile, .controles-horizontais {
    display: none;
    gap: 10px;
    margin-top: 20px;
    flex-shrink: 0;
}

@media (hover: none) and (pointer: coarse) {
    .controles-mobile, .controles-horizontais { display: grid; }
    .controles-mobile { 
        grid-template-areas: ". cima ." "esq dir ." ". baixo ."; 
    }
    .controles-horizontais {
        grid-template-columns: 1fr 1fr;
    }
}

.btn-controle {
    background-color: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation; 
}

.btn-controle.largo { width: 80px; border-radius: 12px; }

.cima { grid-area: cima; }
.baixo { grid-area: baixo; }
.esq { grid-area: esq; }
.dir { grid-area: dir; }

.mensagem-final {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    margin: 20px 0;
    text-align: center;
}

.btn-jogar-novamente {
    padding: 12px 24px;
    background-color: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    display: none;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.modal-conquistas {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-conteudo-conquistas {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.fechar-modal-conquistas {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
}

#lista-conquistas {
    margin-top: 20px;
}

.item-conquista {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--border-light);
    opacity: 0.5;
    filter: grayscale(100%);
    transition: 0.3s;
}

.item-conquista.desbloqueado {
    opacity: 1;
    filter: grayscale(0%);
}

.selo-conquista {
    font-size: 2rem;
    margin-right: 15px;
}

.info-conquista h4 { margin: 0; color: var(--text-primary); }
.info-conquista p { margin: 2px 0 0; font-size: 0.8rem; color: var(--text-secondary); }
