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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #0d0d1a 0%, #1a1a3e 50%, #0f3460 100%);
    height: 100vh;
    overflow: hidden;
    color: #fff;
}

.screen {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* ==================== 加载动画 ==================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0d0d1a 0%, #1a1a3e 50%, #0f3460 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 215, 0, 0.2);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-screen p {
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.7);
}

/* ==================== 大厅样式 ==================== */
#lobby {
    position: relative;
}

.lobby-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 30%, rgba(255, 215, 0, 0.1) 0%, transparent 40%);
    animation: bgPulse 8s ease-in-out infinite;
}

@keyframes bgPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.lobby-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 20px;
}

.game-title {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.6);
}

.title-text {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

.game-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1em;
    margin-bottom: 40px;
    letter-spacing: 2px;
}

.lobby-form {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.08);
    padding: 35px;
    border-radius: 24px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lobby-form input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    font-size: 1em;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    margin-bottom: 15px;
}

.lobby-form input:focus {
    outline: none;
    border-color: #667eea;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1em;
}

.btn-block {
    width: 100%;
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn:active {
    transform: scale(0.97);
}

.form-group {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.form-group label {
    display: block;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.select-wrapper select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    font-size: 1em;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
}

/* ==================== 房间界面 - 顶部栏 ==================== */
.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.header-left {
    display: flex;
    gap: 10px;
}

.room-id-badge, .round-badge {
    display: flex;
    flex-direction: column;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-label {
    font-size: 0.65em;
    color: rgba(255, 255, 255, 0.5);
}

.badge-value {
    font-size: 1em;
    font-weight: bold;
    color: #ffd700;
}

.round-badge {
    flex-direction: row;
    gap: 6px;
    align-items: center;
}

.header-right {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-ghost {
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ==================== 弹窗样式 ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.qrcode-wrapper {
    background: white;
    padding: 15px;
    border-radius: 12px;
    display: inline-block;
    margin: 15px 0;
}

.qrcode-wrapper img {
    width: 200px;
    height: 200px;
}

.modal-content h3 {
    color: #ffd700;
}

.room-url {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85em;
    margin-bottom: 20px;
}

/* ==================== 游戏主区域 ==================== */
.game-area {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.players-column {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    overflow-y: auto;
    z-index: 10;
}

.left-column {
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.right-column {
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.center-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: radial-gradient(circle at center, rgba(102, 126, 234, 0.1) 0%, transparent 60%);
}

/* 牌桌标志 */
.table-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.table-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.logo-icon {
    font-size: 3.5em;
}

.logo-text {
    font-size: 1.8em;
    font-weight: bold;
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.game-status {
    font-size: 1em;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 20px;
    border-radius: 15px;
}

/* 游戏结果弹窗 - 置顶显示 */
.game-result {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

.result-content {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.98) 0%, rgba(22, 33, 62, 0.98) 100%);
    padding: 30px 45px;
    border-radius: 20px;
    text-align: center;
    border: 2px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 0 60px rgba(255, 215, 0, 0.3),
                0 20px 60px rgba(0, 0, 0, 0.6);
    min-width: 380px;
}

.result-content h3 {
    color: #ffd700;
    font-size: 1.6em;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.winners-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 25px;
}

.winner-item {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12) 0%, rgba(255, 140, 0, 0.12) 100%);
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.25);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.winner-result {
    color: #ffd700;
    font-weight: bold;
}

/* ==================== 玩家卡片样式 ==================== */
.player-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s;
    position: relative;
}

.player-card.ready {
    border-color: #38ef7d;
    box-shadow: 0 0 15px rgba(56, 239, 125, 0.3);
}

.player-card.winner {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

/* 玩家信息区域 */
.player-card-body {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: bold;
    border: 3px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.player-card.ready .player-avatar {
    border-color: #38ef7d;
}

.player-card.winner .player-avatar {
    border-color: #ffd700;
}

.player-info-main {
    flex: 1;
    min-width: 0;
}

.player-name {
    font-weight: 700;
    font-size: 0.95em;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-status {
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.6);
}

.player-score-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    flex-shrink: 0;
}

.score-label {
    font-size: 0.6em;
    color: rgba(255, 255, 255, 0.5);
}

.score-value {
    font-size: 1.1em;
    font-weight: bold;
    color: #ffd700;
}

/* 玩家手牌 - 显示在角色上方，带透明效果 */
.player-cards-overlay {
    position: relative;
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-cards-overlay.has-result {
    min-height: 70px;
}

.player-cards {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    padding: 5px 3px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) rgba(255,255,255,0.05);
}

/* 玩家牌容器 - 用于定位结果 overlay */
.player-cards-inner {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.player-cards-inner .player-cards {
    overflow-x: visible;
}

.player-cards::-webkit-scrollbar {
    height: 3px;
}

.player-cards::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.player-cards::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.card {
    width: 32px;
    height: 46px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2px;
    font-size: 0.6em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    opacity: 0.85;
    transition: opacity 0.3s;
}

.card:hover {
    opacity: 1;
}

.card.red {
    color: #e74c3c;
}

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

/* 精美的牌背设计 */
.card-back {
    background: linear-gradient(135deg, #2d1b4e 0%, #1a1a2e 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.card-back::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    background: repeating-linear-gradient(
        45deg,
        rgba(138, 43, 226, 0.3),
        rgba(138, 43, 226, 0.3) 2px,
        rgba(75, 0, 130, 0.3) 2px,
        rgba(75, 0, 130, 0.3) 4px
    );
    border-radius: 4px;
}

.card-back::after {
    content: '🎴';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5em;
}

.card .top, .card .bottom {
    font-size: 1em;
    font-weight: bold;
    line-height: 1;
}

.card .bottom {
    transform: rotate(180deg);
}

.card .middle {
    font-size: 1.5em;
    text-align: center;
    line-height: 1;
}

/* 扑克牌上方的牛几结果 overlay */
.card-result-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    pointer-events: none;
    width: 100%;
    text-align: center;
}

.card-result-text {
    font-size: 1.4em;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8),
                 0 0 20px rgba(255, 215, 0, 0.5);
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.5);
    white-space: nowrap;
    display: inline-block;
}

/* 结果徽章 */
.result-badges {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 3px;
}

.result-type {
    font-size: 0.85em;
    font-weight: bold;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.15);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.multiplier {
    font-size: 0.8em;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

/* ==================== 底部玩家区域 ==================== */
.bottom-bar {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.9) 100%);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 60;
}

.player-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.player-main-top {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

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

.avatar-wrapper {
    position: relative;
}

.avatar-wrapper .avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4em;
    font-weight: bold;
    color: #1a1a2e;
    border: 3px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.avatar-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}

.player-position {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: bold;
    border: 2px solid #fff;
}

.player-details {
    text-align: left;
}

.player-main .player-name {
    font-size: 1.1em;
    font-weight: bold;
}

.player-main .player-status {
    font-size: 0.85em;
    color: #ffd700;
}

.player-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.player-score .score-label {
    font-size: 0.65em;
    color: rgba(255, 255, 255, 0.5);
}

.player-score .score-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #ffd700;
}

/* 当前玩家的牌 */
.cards-wrapper {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 5px 0;
    width: 100%;
}

.cards-wrapper .card {
    width: 52px;
    height: 75px;
    font-size: 0.9em;
    padding: 4px;
}

.cards-wrapper .card .middle {
    font-size: 1.8em;
}

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

.action-buttons .btn {
    padding: 12px 35px;
    font-size: 1.05em;
}

/* 底部工具栏 */
.bottom-tools {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 10px;
    transition: all 0.3s;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.tool-icon {
    font-size: 1.3em;
}

.tool-label {
    font-size: 0.7em;
}

/* ==================== 滚动条 ==================== */
::-webkit-scrollbar {
    width: 6px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* ==================== 移动端适配 ==================== */
@media (max-width: 768px) {
    .game-title {
        font-size: 2em;
    }

    .lobby-form {
        padding: 25px 20px;
    }

    .game-area {
        flex-direction: column;
    }

    .players-column {
        width: 100%;
        height: auto;
        max-height: calc(50vh - 250px);
        flex-direction: row;
        overflow-x: auto;
        border: none;
        padding: 8px;
    }

    .player-card {
        min-width: 180px;
        padding: 8px;
    }

    .player-card-body {
        gap: 8px;
    }

    .player-avatar {
        width: 40px;
        height: 40px;
    }

    .player-name {
        font-size: 0.85em;
        max-width: 70px;
    }

    .player-status {
        font-size: 0.7em;
    }

    .player-cards-overlay {
        min-height: 50px;
    }

    .player-cards {
        gap: 2px;
    }

    .player-card .card {
        width: 28px;
        height: 42px;
        opacity: 0.8;
    }

    .player-score-badge {
        padding: 5px 8px;
        min-width: 45px;
    }

    .score-value {
        font-size: 1em;
    }

    .table-logo .logo-icon {
        font-size: 2.5em;
    }

    .table-logo .logo-text {
        font-size: 1.3em;
    }

    .result-vertical-text {
        font-size: 1.8em;
        letter-spacing: 6px;
    }

    .result-content {
        min-width: auto;
        width: 85%;
        max-width: 350px;
        padding: 25px 20px;
    }

    .result-content h3 {
        font-size: 1.4em;
    }

    .winner-item {
        padding: 10px 15px;
        font-size: 0.9em;
    }

    .bottom-bar {
        padding: 10px 12px;
    }

    .avatar-wrapper .avatar {
        width: 50px;
        height: 50px;
    }

    .player-main-info {
        gap: 10px;
    }

    .player-main .player-name {
        font-size: 1em;
    }

    .cards-wrapper .card {
        width: 45px;
        height: 65px;
    }

    .action-buttons .btn {
        padding: 10px 25px;
        font-size: 0.95em;
    }

    .bottom-tools {
        gap: 15px;
    }

    .tool-btn {
        padding: 5px 10px;
    }

    .tool-icon {
        font-size: 1.2em;
    }
}
