:root[data-theme="light"] {
    --bg-color: #f0f2f5;
    --bg-gradient: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    --text-color: #333;
    --card-bg: white;
    --card-text: black;
    --card-back: #1a237e;
    --name-bg: rgba(255, 255, 255, 0.9);
    --name-text: black;
    --button-bg: #000000;
    --button-text: white;
    --score-bg: rgba(0, 0, 0, 0.7);
    --score-text: white;
    --score-item-bg: rgba(255, 255, 255, 0.1);
    --score-item-text: white;
    --current-player: #4CAF50;
}

:root[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --bg-gradient: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    --text-color: #ffffff;
    --card-bg: #2d2d2d;
    --card-text: #ffffff;
    --card-back: #000051;
    --name-bg: rgba(45, 45, 45, 0.9);
    --name-text: #ffffff;
    --button-bg: #1565C0;
    --button-text: white;
    --score-bg: rgba(0, 0, 0, 0.7);
    --score-text: white;
    --score-item-bg: rgba(255, 255, 255, 0.1);
    --score-item-text: white;
    --current-player: #2E7D32;
}

/* Estilos Gerais */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-color);
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Placar */
.score-board {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--score-bg);
    border-radius: 10px;
    color: var(--score-text);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.player-score {
    padding: 10px 20px;
    border-radius: 8px;
    min-width: 180px;
    transition: all 0.3s ease;
    background: var(--score-item-bg);
    color: var(--score-item-text);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.player-name {
    font-size: 1.3em;
    font-weight: bold;
    color: #ffd700;
}

.score {
    font-size: 1.8em;
    font-weight: bold;
    color: white;
}

.player-turn {
    background: var(--score-item-bg);
    padding: 10px 20px;
    border-radius: 8px;
    text-align: center;
    color: var(--score-text);
    font-weight: 600;
    min-width: 200px;
}

.player-score.current {
    background-color: var(--current-player);
    color: white;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

/* Controles */
.game-controls {
    margin-bottom: 20px;
    text-align: center;
}

.control-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin: 0 10px;
    font-family: 'Poppins', sans-serif;
    transition: background-color 0.3s;
    background-color: var(--button-bg);
    color: var(--button-text);
}

.control-btn:hover {
    background: #45a049;
    opacity: 0.9;
}

/* Grid do Jogo */
.memory-game {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 20px auto;
    perspective: 1000px;
    max-width: 1400px;
}

/* Cartas */
.card {
    width: 130px;
    height: 180px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.5s;
}

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

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

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

.card-back {
    background-color: #1a237e;
    background-color: var(--card-back);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-front img,
.card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.card .player-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--name-bg);
    color: var(--name-text);
    padding: 8px;
    text-align: center;
    font-size: 0.9em;
    border-radius: 0 0 10px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 5px;
}

.card .rating {
    background: #ffd700;
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
}

.card.matched {
    transform: rotateY(180deg);
}

@keyframes neonPulse {
    0% {
        box-shadow: 0 0 5px #00ff00,
                   0 0 10px #00ff00,
                   0 0 15px #00ff00;
    }
    50% {
        box-shadow: 0 0 10px #00ff00,
                   0 0 20px #00ff00,
                   0 0 30px #00ff00;
    }
    100% {
        box-shadow: 0 0 5px #00ff00,
                   0 0 10px #00ff00,
                   0 0 15px #00ff00;
    }
}

.card.matched .card-front {
    animation: neonPulse 2s infinite;
}

.card.matched .player-name {
    background: rgba(0, 255, 0, 0.9);
    border-bottom: 2px solid #00ff00;
    color: black;
    text-shadow: none;
    font-weight: 600;
}

.card.matched .rating {
    background: #ffffff;
    color: black;
    box-shadow: 0 0 5px #00ff00;
}

/* Tela de Setup */
.player-setup {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 500px;
    margin: 50px auto;
}

.player-setup h2 {
    color: white;
    margin-bottom: 30px;
}

.player-inputs input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: none;
    border-radius: 5px;
    font-family: 'Poppins', sans-serif;
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--text-color);
}

.player-inputs button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    transition: background-color 0.3s;
    background-color: var(--button-bg);
    color: var(--button-text);
}

.player-inputs button:hover {
    background: #45a049;
    opacity: 0.9;
}

/* Switch de tema */
.theme-switch {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.theme-label {
    position: absolute;
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
}

/* Admin Link */
.admin-link {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.admin-button {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background-color: var(--card-back);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.admin-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    background-color: var(--current-player);
}

/* Estilos da tela de vitória */
.victory-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-in;
}

.winner-text {
    font-size: 5em;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    margin-bottom: 20px;
    animation: scaleIn 0.5s ease-out;
    text-align: center;
    font-weight: bold;
}

.score-text {
    font-size: 2em;
    color: white;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    animation: slideUp 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { 
        transform: scale(0.5);
        opacity: 0;
    }
    to { 
        transform: scale(1);
        opacity: 1;
    }
}

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

/* Media Queries */
@media (max-width: 1400px) {
    .memory-game {
        max-width: 1200px;
    }
    .card {
        width: 120px;
        height: 170px;
    }
}

@media (max-width: 1200px) {
    .memory-game {
        max-width: 1000px;
    }
    .card {
        width: 110px;
        height: 160px;
    }
}

@media (max-width: 1000px) {
    .memory-game {
        max-width: 800px;
        gap: 10px;
    }
    .card {
        width: 100px;
        height: 150px;
    }
}

@media (max-width: 768px) {
    .memory-game {
        gap: 8px;
    }
    .card {
        width: 90px;
        height: 130px;
    }
    .card .player-name {
        font-size: 0.8em;
        padding: 4px;
    }
    
    .card .rating {
        padding: 1px 4px;
        font-size: 0.8em;
        min-width: 20px;
    }
}

@media (max-width: 480px) {
    .memory-game {
        gap: 5px;
    }
    .card {
        width: 80px;
        height: 120px;
    }
    .card .player-name {
        font-size: 0.7em;
        padding: 3px;
    }
    
    .card .rating {
        padding: 1px 3px;
        font-size: 0.7em;
        min-width: 16px;
    }
}
