/* 斗地主游戏 - 样式文件 */

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

:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --secondary: #FF9800;
    --danger: #f44336;
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --text-light: #eee;
    --text-muted: #888;
    --card-red: #e53935;
    --card-black: #212121;
    --card-joker: #9C27B0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: var(--text-light);
    overflow-x: hidden;
}

#app {
    max-width: 100%;
    min-height: 100vh;
    position: relative;
}

/* 通用屏幕 */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* 登录界面 */
.login-container {
    max-width: 400px;
    margin: auto;
    padding: 40px 20px;
}

.game-title {
    text-align: center;
    font-size: 48px;
    margin-bottom: 40px;
    text-shadow: 0 0 20px rgba(255, 152, 0, 0.5);
}

.login-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--text-light);
    font-size: 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--primary);
}

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

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

.form-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #333;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: var(--text-light);
    font-size: 16px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-logout {
    background: transparent;
    border: 2px solid var(--danger);
    color: var(--danger);
    margin-top: auto;
}

/* 大厅界面 */
.lobby-header {
    background: rgba(0,0,0,0.3);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.user-info, .user-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.username {
    font-size: 20px;
    font-weight: bold;
    color: var(--secondary);
}

.level {
    background: linear-gradient(45deg, #ff6b6b, #ffd93d);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
}

.coins {
    font-size: 18px;
}

.record {
    color: var(--text-muted);
}

.lobby-content {
    flex: 1;
}

.btn-signin {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 30px;
}

.streak {
    font-size: 12px;
    opacity: 0.8;
}

.section-title {
    margin-bottom: 15px;
    color: var(--text-muted);
}

.room-list {
    display: grid;
    gap: 15px;
    margin-bottom: 30px;
}

.room-card {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.room-card:hover {
    transform: translateX(10px);
    border-color: var(--primary);
}

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

.room-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
}

.room-ante {
    color: var(--secondary);
    font-size: 14px;
}

.room-desc {
    color: var(--text-muted);
    font-size: 12px;
}

.room-min {
    color: var(--danger);
    font-size: 12px;
}

/* 游戏界面 */
#game-screen {
    padding: 10px;
    height: 100vh;
    display: none;
    flex-direction: column;
}

#game-screen.active {
    display: flex;
}

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

.btn-back {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 16px;
    cursor: pointer;
}

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

.ante {
    color: var(--secondary);
}

.game-area {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.opponent-area {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.top-left {
    top: 10px;
    left: 10px;
}

.top-right {
    top: 10px;
    right: 10px;
}

.opponent-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0,0,0,0.5);
    padding: 8px 15px;
    border-radius: 20px;
}

.opponent-name {
    font-size: 14px;
    color: var(--secondary);
}

.card-count {
    font-size: 12px;
    color: var(--text-muted);
}

.opponent-cards {
    display: flex;
    gap: 3px;
}

.opponent-cards .card {
    width: 30px;
    height: 45px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.landlord-cards {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.landlord-label {
    font-size: 14px;
    color: var(--text-muted);
}

#landlord-cards-display {
    display: flex;
    gap: 5px;
}

.phase-panel {
    background: rgba(0,0,0,0.8);
    padding: 20px 40px;
    border-radius: 15px;
    text-align: center;
}

.phase-title {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--secondary);
}

.call-buttons, .play-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-call {
    background: var(--danger);
    color: white;
}

.btn-pass {
    background: #666;
    color: white;
}

.btn-play {
    background: var(--primary);
    color: white;
}

.btn-pass-play {
    background: #666;
    color: white;
}

.last-play, .player-last-play {
    min-height: 60px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    max-width: 200px;
    justify-content: center;
}

.play-hint {
    position: absolute;
    bottom: 10px;
    color: var(--text-muted);
    font-size: 14px;
}

.player-area {
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 12px 12px 0 0;
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.player-name {
    font-weight: bold;
    color: var(--secondary);
}

.is-landlord {
    background: var(--danger);
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
}

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

/* 扑克牌样式 */
.card {
    width: 50px;
    height: 75px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    user-select: none;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.card.red {
    background: linear-gradient(180deg, #fff 0%, #ffebee 100%);
    color: var(--card-red);
}

.card.black {
    background: linear-gradient(180deg, #fff 0%, #f5f5f5 100%);
    color: var(--card-black);
}

.card.joker {
    background: linear-gradient(180deg, #9C27B0 0%, #7B1FA2 100%);
    color: #FFD700;
    font-size: 20px;
}

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

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

.card .card-value {
    font-size: 18px;
    line-height: 1;
}

.card .card-suit {
    font-size: 14px;
    margin-top: 2px;
}

.opponent-cards .card {
    width: 35px;
    height: 50px;
}

/* 战绩界面 */
.stats-container {
    max-width: 500px;
    margin: 0 auto;
}

.stats-container h2 {
    text-align: center;
    margin-bottom: 30px;
}

.stats-container h3 {
    margin: 20px 0 15px;
    color: var(--text-muted);
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-item {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: var(--secondary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.recent-games {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-record {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-result {
    font-weight: bold;
}

.game-result.win {
    color: var(--primary);
}

.game-result.lose {
    color: var(--danger);
}

.game-coins {
    color: var(--secondary);
}

.game-time {
    font-size: 12px;
    color: var(--text-muted);
}

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

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    font-size: 28px;
    margin-bottom: 20px;
}

.result-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.result-buttons .btn {
    flex: 1;
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 15px 30px;
    border-radius: 25px;
    z-index: 1001;
    animation: fadeIn 0.3s;
}

.toast.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .game-title {
        font-size: 36px;
    }
    
    .card {
        width: 40px;
        height: 60px;
        font-size: 14px;
    }
    
    .card .card-value {
        font-size: 14px;
    }
    
    .card .card-suit {
        font-size: 12px;
    }
    
    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .phase-panel {
        padding: 15px 20px;
    }
    
    .call-buttons, .play-buttons {
        flex-direction: column;
    }
}
