/* 全局样式 */
* {
    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;
    color: #333;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

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

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

/* 登录界面 */
h1 {
    text-align: center;
    color: #667eea;
    font-size: 3em;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
}

/* 选项卡样式 */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* 认证表单样式 */
.auth-form {
    display: none;
    flex-direction: column;
    gap: 15px;
}

.auth-form.active {
    display: flex;
}

.form-hint {
    text-align: center;
    color: #999;
    font-size: 14px;
    margin-top: 5px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

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

.btn-primary {
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    padding: 15px 30px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

/* 大厅界面 */
.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.btn-logout {
    padding: 8px 16px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #ff5252;
}

.lobby-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.or-divider {
    text-align: center;
    color: #999;
    font-size: 0.9em;
}

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

.rooms-list h3 {
    margin-bottom: 15px;
    color: #667eea;
}

#roomsContainer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.room-item {
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.room-item:hover {
    background: #e8e8e8;
}

/* 等待室 */
.room-info {
    text-align: center;
    margin-bottom: 30px;
}

.room-code {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
    letter-spacing: 3px;
}

.btn-copy {
    padding: 8px 15px;
    background: #f0f0f0;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-left: 10px;
    transition: background 0.2s;
}

.btn-copy:hover {
    background: #e0e0e0;
}

.players-waiting {
    margin-bottom: 30px;
}

.players-waiting h3 {
    margin-bottom: 15px;
    color: #667eea;
}

#playersContainer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.player-item.empty-slot {
    background: #fafafa;
    border: 2px dashed #ddd;
}

.player-ready {
    color: #4caf50;
    font-weight: bold;
}

/* 游戏界面 */
#gameScreen.active {
    display: block;
    padding: 0;
}

.game-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    position: relative;
}

.game-header {
    padding: 15px 30px;
    background: rgba(0,0,0,0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.round-info {
    font-size: 1.3em;
    font-weight: bold;
}

.room-code-small {
    font-size: 0.9em;
    opacity: 0.8;
}

/* 对手区域 */
.opponents-area {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    gap: 20px;
}

.opponent {
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 15px;
    color: white;
    min-width: 200px;
}

.opponent .player-name {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.opponent .player-score {
    margin-bottom: 10px;
    opacity: 0.9;
}

.opponent .player-cards {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    justify-content: center;
}

.opponent .selected-cards {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    min-height: 80px;
    justify-content: center;
}

/* 桌面区域 */
.table-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.table-cards {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.table-card {
    text-align: center;
}

.card-label {
    color: white;
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.table-card.active .card-label {
    color: #ffd700;
    font-size: 1.3em;
}

/* 扑克牌样式 */
.card {
    width: 70px;
    height: 100px;
    background: white;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

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

.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: 2em;
}

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

/* 游戏消息 */
.game-message {
    color: white;
    font-size: 1.3em;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
    min-height: 40px;
    padding: 15px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
}

.round-result {
    background: rgba(255,255,255,0.95);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    max-width: 600px;
    width: 100%;
}

.round-result h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.result-item {
    padding: 10px;
    margin: 5px 0;
    background: #f5f5f5;
    border-radius: 8px;
}

.result-rank-1 {
    background: #ffd700;
    font-weight: bold;
}

.result-rank-2 {
    background: #ffa07a;
}

.result-rank-3 {
    background: #e0e0e0;
}

/* 玩家手牌区域 */
.player-area {
    background: rgba(0,0,0,0.3);
    padding: 20px;
    border-top: 2px solid rgba(255,255,255,0.2);
}

.player-info-bar {
    color: white;
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: bold;
}

.hand-cards {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    min-height: 120px;
}

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

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 20px;
}

#finalScores {
    margin: 20px 0;
}

.score-item {
    padding: 15px;
    margin: 10px 0;
    background: #f5f5f5;
    border-radius: 10px;
    font-size: 1.1em;
}

.score-item.winner {
    background: #ffd700;
    font-weight: bold;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .opponents-area {
        flex-direction: column;
    }
    
    .table-cards {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .card {
        width: 60px;
        height: 85px;
        font-size: 1em;
    }
    
    .hand-cards {
        flex-wrap: wrap;
    }
}

/* 特殊效果 */
@keyframes cardDeal {
    from {
        transform: translateY(-100px) rotate(0deg);
        opacity: 0;
    }
    to {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
}

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

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

.pulse {
    animation: pulse 1s infinite;
}

