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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #091121, #101f3d);
    color: white;
    height: 100vh;
    overflow: hidden;
}

.screen {
    display: none;
    width: 100%;
    height: 100vh;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Login Screen */
.login-container {
    background: rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    text-align: center;
    min-width: 400px;
}

.login-container h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: #fff;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group input {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
}

.input-group button {
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #4CAF50;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.input-group button:hover {
    background: #45a049;
}

/* Lobby Screen */
.lobby-container {
    background: linear-gradient(135deg, #091121, #101f3d);
    padding: 2rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    min-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.player-status {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.players-list {
    margin: 1rem 0;
}

.player-item {
    padding: 1rem;
    margin: 0.5rem 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-item.host {
    background: rgba(255, 215, 0, 0.3);
    border: 2px solid gold;
}

.player-item.self {
    background: rgba(76, 175, 80, 0.3);
}

.select-player {
    padding: 0.5rem;
    margin: 0.25rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.select-player.selected {
    background: #4CAF50;
    transform: scale(1.05);
}

.select-player:hover:not(.selected) {
    background: rgba(255, 255, 255, 0.3);
}

.host-controls {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.host-controls.hidden {
    display: none;
}

/* Game Screen */
.game-container {
    width: 100%;
    height: 100vh;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 1rem;
}

.players-area {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

.player-box {
    position: absolute;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    min-width: 150px;
    text-align: center;
}

#playerTop { top: 0; left: 50%; transform: translateX(-50%); }
#playerRight { top: 50%; right: 0; transform: translateY(-50%); }
#playerLeft { top: 50%; left: 0; transform: translateY(-50%); }
#playerBottom { bottom: 0; left: 50%; transform: translateX(-50%); }

.player-box.active {
    background: rgba(76, 175, 80, 0.3);
    border: 2px solid #4CAF50;
}

.game-table {
    flex: 1;
    background: rgba(0, 100, 0, 0.3);
    border: 10px solid #8B4513;
    border-radius: 20px;
    position: relative;
    margin: 1rem;
}

.played-cards {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 10px;
}

.played-card {
    width: 80px;
    height: 120px;
    background-size: cover;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.bidding-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
}

.bid-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.bid-btn {
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.bid-btn:hover {
    background: #1976D2;
    transform: scale(1.1);
}

.player-hand {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    padding: 1rem;
}

.card {
    width: 112px;    /* Reduced for better fit */
    height: 156px;   /* Reduced for better fit */
    background-size: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* For played cards on table */
.played-card {
    width: 84px;     /* Even smaller for table */
    height: 117px;   /* Even smaller for table */
    background-size: cover;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.card:hover {
    transform: translateY(-20px);
}

.card.playable {
    border: 2px solid gold;
}

.card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Popup */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup.hidden {
    display: none;
}

.popup-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    min-width: 400px;
}

.popup-content h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: gold;
}

/* Utility Classes */
.hidden { display: none !important; }
.btn-small { 
    padding: 0.5rem 1rem; 
    background: #ff4757; 
    color: white; 
    border: none; 
    border-radius: 5px; 
    cursor: pointer; 
}

/* Animations */
@keyframes celebrate {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.celebrate {
    animation: celebrate 0.5s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .lobby-container, .login-container {
        min-width: 90%;
        margin: 1rem;
    }
    
    .card {
        width: 60px;
        height: 90px;
    }
    
    .player-box {
        min-width: 120px;
        padding: 0.5rem;
    }
}

.player-select-item {
    padding: 0.5rem;
    margin: 0.25rem 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.player-select-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
}

.player-select-item input[type="checkbox"] {
    margin-right: 0.5rem;
    transform: scale(1.2);
}

.player-select-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.player-select-item.selected {
    background: rgba(76, 175, 80, 0.3);
    border: 2px solid #4CAF50;
}