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

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

#app {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
}

.screen {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.hidden {
    display: none;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 300px;
    margin: 0 auto;
}

input[type="text"] {
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

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

button {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

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

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

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

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
}

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

.lobby-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.room-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.join-room {
    display: flex;
    gap: 10px;
}

.join-room input {
    width: 200px;
}

#room-list {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
}

#room-list h3 {
    margin-bottom: 15px;
    color: #333;
}

#rooms {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

#rooms li {
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
}

#rooms li:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

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

#game-status {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
}

.game-table {
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    grid-template-rows: 150px 1fr 200px;
    gap: 20px;
    min-height: 600px;
}

.player-area {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.top-player {
    grid-column: 2;
    grid-row: 1;
}

.left-player {
    grid-column: 1;
    grid-row: 2;
}

.right-player {
    grid-column: 3;
    grid-row: 2;
}

.bottom-player {
    grid-column: 2;
    grid-row: 3;
}

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

.card-count {
    background: #667eea;
    color: white;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 12px;
}

.cards-area {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    justify-content: center;
}

.play-area {
    grid-column: 2;
    grid-row: 2;
    background: #2d5016;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 3px solid #1a3009;
}

.played-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    min-height: 100px;
}

.game-message {
    margin-top: 20px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    font-weight: bold;
    color: #333;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.card {
    width: 60px;
    height: 90px;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.card.selected {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.5);
    border-color: #667eea;
}

.card.red {
    color: #e74c3c;
}

.card.black {
    color: #2c3e50;
}

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

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

.opponent-card {
    width: 40px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid #333;
    border-radius: 5px;
}

@media (max-width: 768px) {
    .game-table {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto;
        gap: 10px;
    }

    .top-player {
        grid-column: 1;
        grid-row: 1;
    }

    .left-player {
        grid-column: 1;
        grid-row: 2;
    }

    .right-player {
        grid-column: 1;
        grid-row: 3;
    }

    .play-area {
        grid-column: 1;
        grid-row: 4;
    }

    .bottom-player {
        grid-column: 1;
        grid-row: 5;
    }

    .card {
        width: 50px;
        height: 75px;
        font-size: 14px;
    }
}