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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    padding: 20px;
}

.hidden {
    display: none !important;
}

.container {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 100%;
}

h1 {
    color: #667eea;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
}

h2 {
    color: #555;
    text-align: center;
    margin-bottom: 20px;
}

h3 {
    color: #667eea;
    margin: 20px 0 10px 0;
}

input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 15px;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

button {
    width: 100%;
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #5568d3;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.room-actions {
    margin-bottom: 20px;
}

.rooms-list {
    margin-top: 30px;
}

#rooms-container {
    max-height: 300px;
    overflow-y: auto;
}

.room-item {
    background: #f5f5f5;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-item button {
    width: auto;
    padding: 8px 16px;
}

.room-info h4 {
    color: #333;
    margin-bottom: 5px;
}

.room-info p {
    color: #666;
    font-size: 14px;
}

.players-waiting {
    margin: 20px 0;
}

#players-list {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    min-height: 100px;
}

.player-item {
    padding: 8px;
    background: white;
    margin-bottom: 5px;
    border-radius: 5px;
}

/* Game Screen */
.game-container {
    display: grid;
    grid-template-columns: 1fr 3fr 1fr;
    gap: 20px;
    width: 100%;
    max-width: 1400px;
    height: 100vh;
    padding: 20px;
}

.game-info {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.game-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-board {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.deck-area {
    display: flex;
    gap: 40px;
    align-items: center;
}

.deck-pile, .discard-pile {
    position: relative;
    width: 120px;
    height: 180px;
}

.card {
    width: 120px;
    height: 180px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 3px solid #333;
    position: relative;
}

.card:hover {
    transform: translateY(-15px) scale(1.05);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

/* Card throw animation */
@keyframes cardThrow {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateY(-100px) translateX(-50px) rotate(-15deg) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translateY(-150px) translateX(0) rotate(5deg) scale(0.8);
        opacity: 0.3;
    }
}

.card.throwing {
    animation: cardThrow 0.6s ease-out forwards;
}

/* Card appear animation */
@keyframes cardAppear {
    0% {
        transform: translateY(-50px) scale(0.5);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.discard-pile .card {
    animation: cardAppear 0.5s ease-out;
}

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

.card-back::after {
    content: 'UNO';
    font-size: 24px;
}

.card.red {
    background: #ff4444;
    color: white;
}

.card.yellow {
    background: #ffdd44;
    color: #333;
}

.card.green {
    background: #44ff44;
    color: #333;
}

.card.blue {
    background: #4444ff;
    color: white;
}

.card.wild {
    background: linear-gradient(45deg, #ff4444 0%, #ffdd44 25%, #44ff44 50%, #4444ff 75%);
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.card-value {
    font-size: 48px;
}

.player-hand {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 10px;
    overflow-x: auto;
    min-height: 220px;
}

.player-hand .card {
    flex-shrink: 0;
}

.chat-container {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    min-height: 300px;
    max-height: 500px;
}

.chat-message {
    margin-bottom: 10px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 5px;
}

.chat-message .username {
    font-weight: bold;
    color: #667eea;
}

.chat-message .text {
    color: #333;
    margin-top: 2px;
}

.chat-input {
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    margin-bottom: 0;
}

.chat-input button {
    width: auto;
    padding: 12px 24px;
}

#players-info {
    margin-top: 20px;
}

.player-info-item {
    padding: 10px;
    background: #f5f5f5;
    margin-bottom: 5px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-info-item.active {
    background: #667eea;
    color: white;
}

.player-info-item.has-uno::after {
    content: '🎯 UNO';
    font-size: 12px;
    background: #ff4444;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 5px;
}

.catch-uno-btn {
    padding: 4px 8px;
    font-size: 12px;
    width: auto;
    margin-left: 10px;
    background: #ff4444;
}

.catch-uno-btn:hover {
    background: #cc0000;
}

.uno-button {
    padding: 20px 40px;
    font-size: 32px;
    font-weight: bold;
    background: linear-gradient(135deg, #ff4444 0%, #ff0000 100%);
    color: white;
    border: 4px solid white;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 68, 68, 0.5);
    transition: all 0.3s;
    margin-top: 20px;
    width: auto;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.uno-button:hover {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    transform: scale(1.1);
    box-shadow: 0 12px 30px rgba(255, 68, 68, 0.7);
}

.uno-button:active {
    transform: scale(0.95);
}

@keyframes unoPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 20px rgba(255, 68, 68, 0.5);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 12px 30px rgba(255, 68, 68, 0.8);
    }
}

.uno-button.pulse {
    animation: unoPulse 1s infinite;
}

.color-chooser {
    margin-top: 20px;
    text-align: center;
}

.color-chooser p {
    margin-bottom: 10px;
    font-weight: bold;
}

.color-chooser button {
    width: auto;
    padding: 15px 20px;
    margin: 0 5px;
    font-size: 24px;
}

.discard-pile .card {
    position: absolute;
    top: 0;
    left: 0;
}

#current-turn {
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 10px;
    text-align: center;
}

#waiting-message {
    text-align: center;
    color: #666;
    margin-top: 20px;
}

@media (max-width: 1200px) {
    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .chat-container {
        max-height: 300px;
    }
}
