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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.game-header h1 {
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.header-controls {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-action {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    flex: 1;
}

.btn-action:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
}

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

/* Score Panel */
.game-info {
    margin-bottom: 1rem;
}

.score-panel {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: 10px;
}

.team-score {
    text-align: center;
}

.team-score h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.score {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.canastas {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    opacity: 0.9;
}

.round-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.current-round, .min-points {
    font-size: 1rem;
    opacity: 0.9;
}

.turn-indicator {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Game Board */
.game-board {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 1rem;
    min-height: 600px;
}

/* Opponent Area */
.opponent-area {
    background: rgba(139, 0, 0, 0.2);
    border-radius: 10px;
    padding: 1rem;
}

.opponent-hand {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-back-stack {
    display: flex;
    gap: -40px;
}

.hand-count {
    font-size: 1.1rem;
    opacity: 0.9;
}

.opponent-melds {
    min-height: 100px;
}

.melds-label {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

.melds-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Center Area */
.center-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.deck-area {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 2rem;
}

.stock-pile, .discard-pile {
    position: relative;
    text-align: center;
}

.pile-count {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Cards */
.card {
    width: 80px;
    height: 112px;
    background: white;
    border-radius: 8px;
    border: 2px solid #333;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

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

.card.selected {
    transform: translateY(-15px);
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

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

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

.card.hearts, .card.diamonds {
    color: #dc3545;
}

.card.clubs, .card.spades {
    color: #000;
}

.card.joker {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-color: #ff6b6b;
    color: #000;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
}

.card-back {
    width: 80px;
    height: 112px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    border: 2px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.card-back-design {
    width: 60px;
    height: 92px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.1) 10px,
        rgba(255, 255, 255, 0.1) 20px
    );
}

.empty-pile {
    width: 80px;
    height: 112px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    opacity: 0.5;
    text-align: center;
    padding: 0.5rem;
}

/* Player Area */
.player-area {
    background: rgba(0, 100, 0, 0.2);
    border-radius: 10px;
    padding: 1rem;
}

.player-melds {
    margin-bottom: 1rem;
    min-height: 100px;
}

.player-hand {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    min-height: 120px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Melds */
.meld {
    display: inline-flex;
    gap: 0.3rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    border-radius: 8px;
    align-items: center;
    position: relative;
}

.meld.canasta {
    border: 2px solid #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.meld.canasta::after {
    content: '⭐ CANASTA';
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ffd700;
    color: #000;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: bold;
}

.meld .card {
    width: 60px;
    height: 84px;
    font-size: 0.9rem;
}

.meld .card-suit {
    font-size: 1.5rem;
}

/* Messages */
.game-messages {
    padding: 1rem;
    min-height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.message-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1.1rem;
    text-align: center;
    min-width: 300px;
}

.message-box.error {
    background: rgba(220, 53, 69, 0.3);
    border: 2px solid #dc3545;
}

.message-box.success {
    background: rgba(40, 167, 69, 0.3);
    border: 2px solid #28a745;
}

.message-box.info {
    background: rgba(0, 123, 255, 0.3);
    border: 2px solid #007bff;
}

/* Red Threes */
.red-threes {
    display: flex;
    justify-content: space-around;
    background: rgba(220, 53, 69, 0.2);
    padding: 0.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.red-threes-player, .red-threes-opponent {
    font-size: 0.9rem;
}

/* Modals */
.modal {
    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;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.modal-content h2 {
    margin-bottom: 1rem;
    font-size: 2rem;
}

#roundScoreDetails, #finalScoreDetails {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 10px;
    margin: 1.5rem 0;
    text-align: left;
}

.score-line {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.score-line:last-child {
    border-bottom: none;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .score-panel {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .deck-area {
        gap: 1rem;
    }

    .action-buttons {
        flex-wrap: wrap;
    }

    .btn-action {
        flex: 1 1 45%;
    }

    .card, .card-back {
        width: 60px;
        height: 84px;
    }

    .card-rank {
        font-size: 1rem;
    }

    .card-suit {
        font-size: 1.5rem;
    }

    .player-hand {
        gap: 0.3rem;
    }
}

/* Animations */
@keyframes cardDeal {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: cardDeal 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message-box {
    animation: slideIn 0.3s ease-out;
}
