* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #121214;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1100px;
}

h1 {
    margin-bottom: 20px;
    color: #00ffcc;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.3);
    text-align: center;
}

/* Painel Superior de Controles */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
    background-color: #1a1a1e;
    padding: 15px 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid #2e2e38;
    width: 100%;
}

label {
    font-weight: bold;
    margin-right: 8px;
    color: #a8a8b3;
}

select, button {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

select {
    background-color: #29292e;
    color: #ffffff;
    border: 1px solid #41414c;
    outline: none;
}

select:disabled, button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#btn-shuffle { background-color: #ff9000; color: #121214; }
#btn-shuffle:hover:not(:disabled) { background-color: #e68200; }
#btn-restart { background-color: #04d361; color: #121214; }
#btn-restart:hover { background-color: #04b854; }

/* Organização Lado a Lado */
.main-layout {
    display: flex;
    gap: 25px;
    width: 100%;
    align-items: flex-start;
}

/* Tabuleiro 6x5 */
.grid {
    flex: 3;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 12px;
    aspect-ratio: 6 / 5;
    perspective: 1000px;
    user-select: none;
    -webkit-user-select: none;
}

/* Estilo do Placar Lateral */
.scoreboard-lateral {
    flex: 1;
    background-color: #1a1a1e;
    border: 1px solid #2e2e38;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 220px;
}

.scoreboard-lateral h2 {
    font-size: 20px;
    color: #a8a8b3;
    border-bottom: 2px solid #2e2e38;
    padding-bottom: 8px;
    text-align: center;
}

.score-tile {
    background-color: #29292e;
    border: 1px solid #41414c;
    padding: 12px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    font-size: 13px;
    color: #a8a8b3;
    margin-bottom: 5px;
    font-weight: bold;
    text-transform: uppercase;
}

.score-value {
    font-size: 28px;
    font-weight: bold;
}

.score-pairs .score-value { color: #00ffcc; }
.score-total { font-size: 12px; color: #666; margin-top: -2px; }
.score-hits .score-value { color: #04d361; }
.score-misses .score-value { color: #f5222d; }

/* Estrutura das Cartas */
.card {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}

.card.flipped, .card.matched { transform: rotateY(180px); }
.card.matched { cursor: default; }

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.card-back {
    background-color: #29292e;
    border: 2px solid #41414c;
    color: #41414c;
    font-size: 24px;
}

.card:hover .card-back { border-color: #00ffcc; color: #00ffcc; }

.card-front {
    background-color: #ffffff;
    color: #121214;
    transform: rotateY(180px);
    font-size: 16px;
    font-weight: bold;
    border: 3px solid #00ffcc;
    cursor: pointer;
}

.card-front ruby { font-size: 20px; }
.card-front rt { font-size: 10px; color: #555555; padding-bottom: 2px; }

/* Dinâmica de Cores Interativas */
.card.flipped .card-front { background-color: #e6f7ff; border-color: #1890ff; }
.card.matched .card-front { background-color: #e6fff2; border-color: #04d361; color: #015221; opacity: 0.9; }
.card.wrong .card-front { background-color: #fff1f0; border-color: #f5222d; color: #a8071a; }

/* Responsividade Básica para Celulares */
@media (max-width: 768px) {
    .main-layout { flex-direction: column; }
    .scoreboard-lateral { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .score-tile { flex: 1; min-width: 120px; }
}
