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

:root {
    --bg-dark: #1a1a2e;
    --bg-medium: #16213e;
    --bg-light: #0f3460;
    --accent: #e94560;
    --accent-light: #ff6b6b;
    --gold: #ffd700;
    --green: #4ecca3;
    --text: #eee;
    --card-bg: #fff;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 50%, var(--bg-light) 100%);
    min-height: 100vh;
    color: var(--text);
    overflow-x: hidden;
}

#game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Screens */
.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* Main Menu */
#main-menu {
    text-align: center;
    padding-top: 15vh;
}

.title {
    font-family: 'Press Start 2P', cursive;
    font-size: 2.5rem;
    color: var(--gold);
    text-shadow: 0 0 20px var(--gold), 0 4px 0 #b8860b;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

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

.subtitle {
    font-size: 1.5rem;
    color: var(--accent-light);
    margin-bottom: 50px;
}

.menu-btn {
    display: block;
    width: 280px;
    margin: 15px auto;
    padding: 18px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text);
    background: linear-gradient(180deg, var(--accent) 0%, #c23a51 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 6px 0 #8b2a3a, 0 8px 20px rgba(0,0,0,0.3);
}

.menu-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #8b2a3a, 0 12px 25px rgba(0,0,0,0.4);
}

.menu-btn:active {
    transform: translateY(3px);
    box-shadow: 0 3px 0 #8b2a3a, 0 5px 15px rgba(0,0,0,0.3);
}

/* Rules Screen */
#rules-screen {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px;
}

#rules-screen h2 {
    text-align: center;
    color: var(--gold);
    margin-bottom: 30px;
    font-size: 2rem;
}

.rules-content {
    background: rgba(0,0,0,0.3);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    line-height: 1.8;
}

.rules-content ul {
    margin-left: 25px;
    margin-top: 10px;
    margin-bottom: 15px;
}

.rules-content li {
    margin: 8px 0;
}

/* Game Screen */
#game-screen {
    display: none;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
}

#game-screen.active {
    display: flex;
}

#score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.4);
    padding: 15px 25px;
    border-radius: 15px;
}

.player-score, .cpu-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.wins {
    font-family: 'Press Start 2P', cursive;
    font-size: 2rem;
    color: var(--gold);
}

.round-info {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    color: var(--accent-light);
}

/* Card Zones */
#cpu-zone, #player-zone {
    background: rgba(0,0,0,0.2);
    border-radius: 15px;
    padding: 15px;
}

.zone-label {
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--accent-light);
}

.hand {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 140px;
    align-items: center;
}

/* Cards */
.card {
    width: 80px;
    height: 112px;
    background: var(--card-bg);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    position: relative;
    user-select: none;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}

.card.selected {
    transform: translateY(-15px);
    box-shadow: 0 0 20px var(--gold), 0 12px 20px rgba(0,0,0,0.4);
    border: 3px solid var(--gold);
}

.card.face-down {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    cursor: default;
}

.card.face-down::before {
    content: '🎴';
    font-size: 2rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.card-corner {
    font-weight: bold;
    font-size: 1rem;
    line-height: 1;
}

.card-center {
    font-size: 2rem;
    text-align: center;
}

.card.red .card-corner,
.card.red .card-center {
    color: #e74c3c;
}

.card.black .card-corner,
.card.black .card-center {
    color: #2c3e50;
}

/* Play Zone */
#play-zone {
    background: linear-gradient(180deg, rgba(78, 204, 163, 0.2) 0%, rgba(78, 204, 163, 0.1) 100%);
    border: 2px dashed var(--green);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    min-height: 180px;
}

#player-selected {
    display: flex;
    justify-content: center;
    gap: 10px;
    min-height: 112px;
    align-items: center;
    margin-bottom: 15px;
}

#hand-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#hand-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    color: var(--gold);
}

#hand-score {
    font-size: 1.5rem;
    color: var(--green);
    font-weight: bold;
}

/* Actions */
#actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 10px;
}

.action-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#btn-discard {
    background: linear-gradient(180deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 4px 0 #1a5276;
}

#btn-play-hand {
    background: linear-gradient(180deg, var(--green) 0%, #3daa8a 100%);
    color: white;
    box-shadow: 0 4px 0 #2d7d6a;
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

.action-btn:active:not(:disabled) {
    transform: translateY(2px);
}

/* Jokers Display */
#jokers-display {
    background: rgba(0,0,0,0.3);
    border-radius: 15px;
    padding: 15px;
}

.jokers-label {
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--gold);
}

.jokers-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 60px;
}

.joker-card {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    box-shadow: 0 3px 0 #6c3483;
}

.joker-card .joker-name {
    font-weight: bold;
    color: var(--gold);
}

.joker-card .joker-effect {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Round Result */
#round-result {
    text-align: center;
    padding-top: 10vh;
}

#round-result h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 2rem;
    margin-bottom: 40px;
}

#round-comparison {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin-bottom: 40px;
}

.result-side {
    background: rgba(0,0,0,0.3);
    padding: 30px;
    border-radius: 15px;
    min-width: 200px;
}

.result-label {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.result-hand {
    display: block;
    font-size: 1.1rem;
    color: var(--gold);
    margin-bottom: 10px;
}

.result-score {
    display: block;
    font-family: 'Press Start 2P', cursive;
    font-size: 1.5rem;
    color: var(--green);
}

.vs {
    font-family: 'Press Start 2P', cursive;
    font-size: 2rem;
    color: var(--accent);
}

#round-winner {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.5rem;
    margin-bottom: 30px;
    padding: 20px;
    border-radius: 10px;
}

#round-winner.player-won {
    color: var(--green);
    background: rgba(78, 204, 163, 0.2);
}

#round-winner.cpu-won {
    color: var(--accent);
    background: rgba(233, 69, 96, 0.2);
}

/* Joker Select */
#joker-select {
    text-align: center;
    padding-top: 10vh;
}

#joker-select h2 {
    font-family: 'Press Start 2P', cursive;
    color: var(--gold);
    margin-bottom: 40px;
}

.joker-grid {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.joker-choice {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    padding: 25px;
    border-radius: 15px;
    width: 220px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 6px 0 #6c3483, 0 8px 20px rgba(0,0,0,0.3);
}

.joker-choice:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 0 #6c3483, 0 15px 30px rgba(0,0,0,0.4);
}

.joker-choice .joker-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.joker-choice .joker-name {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--gold);
    margin-bottom: 10px;
}

.joker-choice .joker-desc {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Game Over */
#game-over {
    text-align: center;
    padding-top: 15vh;
}

#game-over-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 2.5rem;
    margin-bottom: 30px;
}

#game-over-title.victory {
    color: var(--gold);
    animation: victoryPulse 1s infinite;
}

#game-over-title.defeat {
    color: var(--accent);
}

@keyframes victoryPulse {
    0%, 100% { text-shadow: 0 0 20px var(--gold); }
    50% { text-shadow: 0 0 40px var(--gold), 0 0 60px var(--gold); }
}

#game-over-message {
    font-size: 1.5rem;
    margin-bottom: 40px;
}

#final-score {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2rem;
    margin-bottom: 40px;
}

/* Music Button */
.music-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 100;
}

.music-btn:hover {
    background: rgba(0,0,0,0.7);
    transform: scale(1.1);
}

.music-btn.muted {
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
    .title {
        font-size: 1.5rem;
    }
    
    .card {
        width: 60px;
        height: 84px;
    }
    
    .card-center {
        font-size: 1.5rem;
    }
    
    #round-comparison {
        flex-direction: column;
        gap: 20px;
    }
    
    .vs {
        font-size: 1.5rem;
    }
    
    .joker-choice {
        width: 160px;
        padding: 15px;
    }
}
