body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--mono);
    padding-top: 60px;
}

.games-shell {
    position: relative;
    z-index: 1;
}

.games-page-header {
    padding-top: 120px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
}

.games-page-header h1 {
    font-size: clamp(36px, 6vw, 64px);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    font-family: var(--sans);
}

.games-page-header p {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.8;
    max-width: 620px;
}

.games-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.summary-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
    color: var(--muted2);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.summary-item span {
    color: var(--accent);
    font-weight: 700;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.04) 2px,
        rgba(0,0,0,0.04) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

#main-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: calc(100vh - 220px);
    text-align: center;
    padding: 20px 20px 40px;
    position: relative;
    z-index: 1;
}

.menu-title {
    font-family: var(--sans);
    font-size: clamp(2rem, 4vw, 3.2rem);
    color: var(--text);
    margin-bottom: 36px;
    letter-spacing: -0.03em;
    font-weight: 700;
}

.menu-title::after {
    content: '.';
    color: var(--accent);
}

.menu-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.menu-card {
    background: rgba(17,17,20,0.82);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 220px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    padding: 22px 18px;
    text-align: left;
}

.menu-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,255,136,0.04), transparent 60%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.menu-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0,255,136,0.22);
    background: rgba(21,21,24,0.96);
}

.menu-card:hover::before {
    opacity: 1;
}

.menu-meta {
    position: relative;
    z-index: 1;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    font-family: var(--mono);
}

.menu-icon {
    position: relative;
    z-index: 1;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.04em;
    font-family: var(--sans);
}

.menu-label {
    position: relative;
    z-index: 1;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted2);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* --- LAYOUT DOS JOGOS --- */
.game-container {
    display: none;
    width: 100%;
    max-width: 1000px;
    padding: 20px 20px 90px;
    margin: 0 auto;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 680px;
    margin-bottom: 20px;
    background: rgba(17,17,20,0.8);
    border: 1px solid var(--border);
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.12);
}

.level-badge {
    background: rgba(0,255,136,0.04);
    border: 1px solid rgba(0,255,136,0.18);
    color: var(--accent);
    padding: 5px 12px;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.btn-back {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-back:active { transform: translateY(2px); }

.btn-control {
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-weight: 600;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-left: 10px;
    transition: all 0.2s ease;
    background: rgba(255,255,255,0.02);
    color: var(--muted2);
}

.btn-hint {
    color: var(--muted2);
}

.btn-reset {
    color: var(--accent);
    border-color: rgba(0,255,136,0.2);
}

/* --- ESTILOS DO QUEBRA-CABEÇA --- */
#puzzle-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#puzzle-board-wrap {
    position: relative;
    display: inline-block;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}

#puzzle-reference {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    border-radius: 10px;
    z-index: 0;
}

#puzzle-board {
    position: relative;
    display: grid;
    gap: 2px;
    background-color: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    background-size: cover;
    border-radius: 10px;
    z-index: 1;
}

.slot {
    background-color: rgba(255,255,255,0.04);
    overflow: hidden;
    position: relative;
}

.puzzle-piece {
    background-size: cover;
    cursor: grab;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    position: relative;
    touch-action: none;
    z-index: 2;
    transition: transform 0.1s;
}

.puzzle-piece.correct {
    border: none;
    box-shadow: none;
    z-index: 1;
    animation: popIn 0.3s;
}

#pieces-tray {
    width: 100%;
    max-width: 500px;
    min-height: 100px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.15);
}

/* --- ESTILOS DO JOGO DA MEMÓRIA --- */
#memory-grid {
    display: grid;
    gap: 15px;
    perspective: 1000px;
}

.memory-card {
    background-color: transparent;
    width: 80px;
    height: 80px;
    cursor: pointer;
}

@media (min-width: 600px) {
    .memory-card {
        width: 100px;
        height: 100px;
    }
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border-radius: 10px;
}

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

.memory-card.matched .card-inner {
    animation: pulse 0.5s;
    box-shadow: 0 0 15px rgba(0,255,136,0.5);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    border: 1px solid rgba(255,255,255,0.08);
}

.card-front {
    background-color: var(--bg3);
    color: var(--text);
    transform: rotateY(180deg);
}

.card-back {
    background: linear-gradient(135deg, var(--blue), #6c5ce7);
    color: white;
    font-size: 2rem;
}

/* --- MODAL --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-content {
    background: rgba(17,17,20,0.96);
    border: 1px solid var(--border);
    padding: 30px 26px;
    border-radius: 14px;
    text-align: center;
    max-width: 90%;
    width: 360px;
    transform: scale(0.8);
    transition: transform 0.3s;
    box-shadow: 0 16px 42px rgba(0,0,0,0.32);
}

.modal-overlay.active .modal-content { transform: scale(1); }

.modal-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
    color: var(--accent);
    font-weight: 700;
}

.modal-title {
    font-family: var(--sans);
    color: var(--text);
    margin-bottom: 8px;
    font-size: 1.9rem;
}

.modal-content p {
    margin-bottom: 10px;
    color: var(--muted2);
}

.modal-btn {
    background: rgba(0,255,136,0.04);
    border: 1px solid rgba(0,255,136,0.2);
    color: var(--accent);
    padding: 13px 20px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 15px;
    width: 100%;
    font-family: var(--mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* --- ANIMAÇÕES --- */
@keyframes popIn {
    0% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0% { transform: scale(1) rotateY(180deg); }
    50% { transform: scale(1.1) rotateY(180deg); }
    100% { transform: scale(1) rotateY(180deg); }
}

@media (max-width: 640px) {
    .game-header {
        padding: 12px 14px;
        gap: 10px;
        border-radius: 18px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .menu-buttons {
        flex-direction: column;
    }

    .menu-card {
        width: min(80vw, 260px);
    }
}
