/**
 * 掼蛋游戏样式 - 严格按照Cocos客户端移植
 * 移植自: ~/guandan_v5/client-cocos/assets/GuanDan/Room/
 */

/* ==================== 基础容器 ==================== */
#guandan-game-table {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    color: #fff;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 100;
    min-width: 100vw;
}

#guandan-game-table * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ==================== 牌桌背景 ==================== */
.table-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    z-index: 0;
}

/* ==================== 游戏头部 ==================== */
.game-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
}

.room-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.room-name {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.room-id {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.grade-point-widget {
    position: relative;
    width: 80px;
    height: 80px;
    margin-top: 50px;
}

.grade-point-widget img {
    width: 100%;
    height: 100%;
}

.grade-point-widget .current-level {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -40%);
    font-size: 28px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* V5记分牌样式 */
.grade-point-widget-v5 {
    display: flex;
    align-items: center;
    gap: 70px;
    margin-top: 110px;
}

#grade-point-red,
#grade-point-blue {
    position: absolute;
    top: 30px;
    font-size: 20px;
    font-weight: bold;
    z-index: 10;
}

#grade-point-red {
    color: #ff6b6b;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    top: 60px;
    left: 30px;
}

#grade-point-blue {
    color: #6b9fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    top: 60px;
    right: 30px;
}

.grade-point-current {
    position: relative;
    width: 144px;
    height: 115px;
}

.grade-point-current img {
    width: 100%;
    height: 100%;
}

.grade-point-current .current-level {
    position: absolute;
    top: 6px;
    right: 60px;
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.header-right {
    position: absolute;
    right: 30px;
    display: flex;
    align-items: center;
}

.up-right-buttons {
    display: flex;
    gap: 8px;
}

.btn-up-right {
    width: 50px;
    height: 50px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}

.btn-up-right:hover {
    transform: scale(1.1);
}

.btn-up-right img {
    width: 100%;
    height: 100%;
}

/* ==================== 玩家座位区域 ==================== */
.players-container {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 180px;
    pointer-events: none;
}

.player-seat {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
}

/* 对家（上方） */
.seat-opposite {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
}

/* 上家（左侧） */
.seat-left {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* 下家（右侧） */
.seat-right {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* 座位选择按钮 */
.btn-select-seat {
    position: absolute;
    padding: 8px 16px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    z-index: 20;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.btn-select-seat:hover {
    background: linear-gradient(135deg, #45a049, #4CAF50);
    transform: scale(1.05);
}

.btn-select-seat.hidden {
    display: none !important;
}

/* 对家（北）- 选择按钮定位 */
.seat-opposite .btn-select-seat {
    left: 10px;
    bottom: 40px;
    transform: none;
}

/* 上家（东）- 选择按钮定位 */
.seat-left .btn-select-seat {
    left: 10px;
    bottom: 40px;
    transform: none;
}

/* 下家（西）- 选择按钮定位 */
.seat-right .btn-select-seat {
    left: 10px;
    bottom: 40px;
    transform: none;
}

/* 自己（南）- 选择按钮定位 */
.seat-self .btn-select-seat {
    left: 10px;
    bottom: 40px;
    transform: none;
}

/* 方位指示图片 */
.seat-direction {
    position: absolute;
    width: 30px;
    height: 30px;
    z-index: 10;
}

/* 对家（北）- 方位图片在头像右侧 */
.seat-opposite .seat-direction {
    top: 10px;
    left: 75px;
    transform: none;
}

/* 上家（东）- 方位图片在头像右侧 */
.seat-left .seat-direction {
    top: 10px;
    left: 75px;
    transform: none;
}

/* 下家（西）- 方位图片在头像右侧 */
.seat-right .seat-direction {
    top: 10px;
    left: 75px;
    transform: none;
}

/* 自己（南）- 方位图片在头像右侧 */
.seat-self .seat-direction {
    top: 10px;
    left: 75px;
    transform: none;
}

/* 座位级牌标识 */
.seat-grade-point {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

/* 红方级牌位置调整 - 上移10px，左移5px */
.seat-grade-point.red-team {
    top: -5px;
    right: -5px;
}

/* 蓝方级牌位置调整 - 上移12px，右移50px */
.seat-grade-point.blue-team {
    top: -7px;
    right: -50px;
}

/* 座位框架 */
.seat-frame {
    position: relative;
    width: 90px;
    height: 110px;
}

.chair-bg {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
}

.player-avatar {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 70px;
}

.avatar-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    opacity: 0;
    /* 默认隐藏，轮到出牌时显示 */
    transition: opacity 0.3s ease;
}

.avatar-frame.active {
    opacity: 1;
    /* 轮到当前玩家出牌时显示 */
}

.avatar-img {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    z-index: 1;
}

.avatar-hair,
.avatar-hair-front,
.avatar-hair-back {
    position: absolute;
    z-index: 2;
}

.avatar-hair {
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 30px;
}

.avatar-hair-back {
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 55px;
    height: 35px;
}

.avatar-hair-front {
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    height: 25px;
}

.player-status-icons {
    position: absolute;
    top: -10px;
    right: -10px;
    z-index: 4;
}

.player-status-icons img {
    width: 30px;
    height: 30px;
}

.player-info {
    margin-top: 8px;
    text-align: center;
}

.player-name {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-cards-count {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 2px;
}

/* 已出牌区域 */
.played-cards-area {
    position: absolute;
    min-height: 60px;
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    max-width: 200px;
    z-index: 100;
}

.seat-opposite .played-cards-area {
    top: 150px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    max-width: 600px;
    min-height: 70px;
}

.seat-left .played-cards-area {
    left: 100px;
    top: 50%;
    transform: translateY(-50%);
}

.seat-right .played-cards-area {
    right: 100px;
    top: 50%;
    transform: translateY(-50%);
}

/* 回合指示器 - 高亮当前出牌玩家 */
.turn-indicator {
    position: absolute;
    display: none;
    /* 默认隐藏，轮到该玩家时显示 */
    align-items: center;
    justify-content: center;
    gap: 0;
    background: none;
    padding: 0;
    border-radius: 0;
    z-index: 20;
    box-shadow: none;
    border: none;
    animation: turnPulse 1.5s infinite;
    width: 60px;
    /* 改小一倍：120px / 2 = 60px */
    height: 60px;
}

.turn-indicator:not(.hidden) {
    display: flex !important;
}

@keyframes turnPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 4px 8px rgba(0, 0, 0, 0.3);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.9), 0 6px 12px rgba(0, 0, 0, 0.4);
        transform: scale(1.05);
    }
}

.seat-opposite .turn-indicator {
    top: 0;
    /* 与头像同一高度 */
    left: -70px;
    /* 在头像左边 */
    transform: translateY(0);
}

.seat-opposite .turn-indicator:not(.hidden) {
    display: flex !important;
    transform: translateX(-50%) scale(1);
    animation: turnPulseOpposite 1.5s infinite;
}

@keyframes turnPulseOpposite {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
    }

    50% {
        transform: translateX(-50%) scale(1.05);
    }
}

.seat-left .turn-indicator {
    left: 30px;
    /* 移动到内圈（从-70px改为30px） */
    top: calc(50% - 100px);
    /* 向上移动50px（从-50px改为-100px） */
    transform: translateY(-50%);
}

.seat-left .turn-indicator:not(.hidden) {
    display: flex !important;
    transform: translateY(-50%) scale(1);
    animation: turnPulseLeft 1.5s infinite;
}

@keyframes turnPulseLeft {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 4px 8px rgba(0, 0, 0, 0.3);
        transform: translateY(-50%) scale(1);
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.9), 0 6px 12px rgba(0, 0, 0, 0.4);
        transform: translateY(-50%) scale(1.05);
    }
}

.seat-right .turn-indicator {
    right: 30px;
    /* 移动到内圈（从-70px改为30px） */
    top: calc(50% - 100px);
    /* 向上移动50px（从-50px改为-100px） */
    transform: translateY(-50%);
}

.seat-right .turn-indicator:not(.hidden) {
    display: flex !important;
    transform: translateY(-50%) scale(1);
    animation: turnPulseRight 1.5s infinite;
}

@keyframes turnPulseRight {

    0%,
    100% {
        transform: translateY(-50%) scale(1);
    }

    50% {
        transform: translateY(-50%) scale(1.05);
    }
}

/* 自己（下方）玩家的回合指示器 */
.seat-self .turn-indicator {
    bottom: 130px;
    left: calc(50% + 0px);
    /* 向左移动5px（从+5px改为+0px） */
    transform: translateX(-50%);
    top: auto;
    /* 移除top定位 */
}

.seat-self .turn-indicator:not(.hidden) {
    display: flex !important;
    transform: translateX(-50%) scale(1);
    animation: turnPulseOpposite 1.5s infinite;
}

.clock-icon {
    width: 60px;
    /* 改小一倍：120px / 2 = 60px */
    height: 60px;
    animation: clockPulse 1s infinite;
    position: relative;
}

@keyframes clockPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

/* 时钟指针动画 */
.clock-icon::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 50%;
    width: 4px;
    height: 40%;
    background: #ff0000;
    transform-origin: bottom center;
    animation: clockHandRotate 30s linear infinite;
    border-radius: 2px;
}

@keyframes clockHandRotate {
    0% {
        transform: translateX(-50%) rotate(0deg);
    }

    100% {
        transform: translateX(-50%) rotate(360deg);
    }
}

.countdown {
    font-size: 24px;
    /* 稍微增大，在60px时钟上更清晰 */
    font-weight: bold;
    color: #ff0000;
    /* 改为红色更醒目 */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 21;
}

/* 玩家标记 - 显示在头像旁边 */
.player-signs {
    position: absolute;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.seat-opposite .player-signs {
    top: 0;
    left: -70px;
    transform: translateY(0);
    margin-bottom: 0;
}

.seat-left .player-signs {
    left: 30px;
    top: calc(50% - 100px);
    transform: translateY(-50%);
    margin-left: 0;
}

.seat-right .player-signs {
    right: 30px;
    top: calc(50% - 100px);
    transform: translateY(-50%);
    margin-right: 0;
}

.seat-self .player-signs {
    bottom: 130px;
    left: calc(50% + 0px);
    transform: translateX(-50%);
    margin-bottom: 0;
}

.player-signs img {
    width: 70px;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* ==================== 中央牌桌区域 ==================== */
.table-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.table-desk {
    position: absolute;
    width: 150%;
    height: 150%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    display: none;
    /* 隐藏牌桌图片 */
}

.table-desk img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.center-played-area {
    position: relative;
    z-index: 1;
    width: 280px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.played-cards-center {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 10px;
}

/* 牌型提示 */
.card-type-hint {
    position: absolute;
    top: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 6px 16px;
    border-radius: 15px;
    z-index: 2;
}

.card-type-hint .hint-text {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
}

/* 进贡面板 */
.tribute-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.tribute-bg {
    position: relative;
    width: 280px;
    height: 100px;
}

.tribute-bg img {
    width: 100%;
    height: 100%;
}

.tribute-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.tribute-title {
    font-size: 20px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 5px;
}

.tribute-desc {
    font-size: 14px;
    color: #fff;
}

/* 准备按钮区域 */
.ready-button-area {
    position: absolute;
    z-index: 4;
}

.btn-ready {
    width: 120px;
    height: 50px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}

.btn-ready:hover {
    transform: scale(1.05);
}

.btn-ready img {
    width: 100%;
    height: 100%;
}

/* ==================== 自己玩家区域 ==================== */
.self-player-area {
    position: absolute;
    bottom: 200px;
    left: 30px;
    z-index: 10;
}

/* 观战模式下底部玩家居中 */
.self-player-area.spectator-mode {
    left: 50%;
    transform: translateX(-50%);
}

.seat-self {
    display: flex;
    flex-direction: column;
    align-items: center;
}



/* ==================== 手牌区域 ==================== */
.my-cards-container {
    position: absolute;
    bottom: 80px;
    /* 向下移动10px（从90px改为80px） */
    left: 50%;
    transform: translateX(-50%);
    width: 80vw;
    height: 430px;
    /* 加高100px（从330px改为430px） */
    z-index: 50;
    background: rgba(0, 0, 0, 0.3);
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: center;
}

.my-cards {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-end;
    height: 100%;
    padding: 10px 10px;
    /* 减少左右padding */
    gap: 8px;
    /* 减少列间距 */
    min-width: min-content;
    white-space: nowrap;
    width: auto;
}

/* 手牌列 - 参考Cocos CardLayout */
#my-cards .card-column,
.my-cards .card-column {
    display: flex !important;
    flex-direction: column-reverse !important;
    align-items: center !important;
    position: relative !important;
    height: 100% !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    width: 65px !important;
    /* 改为和牌宽度一致 */
    min-width: 65px !important;
    max-width: 65px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    top: auto !important;
    left: auto !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* 手牌样式 */
.my-card {
    width: 65px;
    height: 91px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    margin-top: -35px;
    /* 减少负margin，减少点击误差 */
}

.my-card:first-child {
    margin-top: 0;
}

.my-card:last-child {
    margin-bottom: 10px;
}

/* 确保牌的可点击区域准确 */
.my-card img {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    /* 让点击事件穿透到父元素 */
}

.my-card:hover {
    transform: translateY(-10px);
    z-index: 100;
}

.my-card.selected {
    transform: translateY(-25px);
    z-index: 100;
}

.my-card.selected img {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    border: 2px solid #ffd700;
}

/* 贡牌高亮 */
.my-card.contribute img {
    box-shadow: 0 0 15px rgba(255, 220, 80, 0.9);
}

/* ==================== 出牌操作栏 ==================== */
.play-action-bar {
    position: absolute;
    bottom: 380px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 60;
}

.btn-chupai {
    width: 100px;
    height: 50px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}

.btn-chupai:hover:not(:disabled) {
    transform: scale(1.05);
}

.btn-chupai:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-chupai img {
    width: 100%;
    height: 100%;
}

/* 进贡/还贡操作栏 */
.tribute-action-bar {
    position: absolute;
    bottom: 350px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 60;
}

.btn-tribute {
    width: 120px;
    height: 50px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}

.btn-tribute:hover {
    transform: scale(1.05);
}

.btn-tribute img {
    width: 100%;
    height: 100%;
}

/* ==================== 底部工具栏 ==================== */
.bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    z-index: 40;
}

.bottom-bg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bottom-buttons {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
}

.btn-bottom {
    width: 50px;
    height: 50px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}

.btn-bottom:hover {
    transform: scale(1.1);
}

.btn-bottom img {
    width: 100%;
    height: 100%;
}

/* ==================== 聊天面板 ==================== */
.chat-panel {
    position: absolute;
    right: 20px;
    bottom: 100px;
    width: 340px;
    height: 460px;
    z-index: 200;
    background: linear-gradient(160deg,
            rgba(15, 20, 40, 0.95) 0%,
            rgba(20, 30, 60, 0.92) 50%,
            rgba(10, 15, 35, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    overflow: hidden;
    animation: chatSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

@keyframes chatSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(20px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.chat-frame {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: relative;
}

.chat-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.15;
    border-radius: 20px;
}

.chat-header {
    position: relative;
    z-index: 1;
    display: flex;
    padding: 12px 16px 10px;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
}

.chat-toggle {
    flex: 1;
    padding: 8px 15px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.25s;
    font-size: 13px;
    font-weight: 500;
    position: relative;
}

.chat-toggle:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.04);
}

.chat-toggle.active {
    background: rgba(255, 215, 0, 0.08);
    color: #ffd700;
}

.chat-toggle.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
    border-radius: 2px;
}

.chat-content {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    min-height: 80px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.phrase-list,
.emoji-list {
    flex-shrink: 0;
    max-height: 160px;
    overflow-y: auto;
    display: none;
    gap: 6px;
    padding: 10px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.phrase-list:not(.hidden) {
    display: flex;
    flex-direction: column;
}

.emoji-list:not(.hidden) {
    display: flex;
    flex-wrap: wrap;
}

.chat-message {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    animation: msgFadeIn 0.3s ease;
    max-width: 90%;
    word-break: break-word;
}

@keyframes msgFadeIn {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.msg-other {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.msg-self {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.25) 0%, rgba(192, 57, 43, 0.2) 100%);
    color: rgba(255, 255, 255, 0.95);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.msg-system {
    background: rgba(52, 152, 219, 0.15);
    color: rgba(255, 255, 255, 0.7);
    align-self: center;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
}

.chat-message .msg-sender,
.chat-message .player-name {
    color: #ffd700;
    font-weight: bold;
    margin-right: 5px;
    font-size: 12px;
}

.chat-message.msg-self .msg-sender {
    color: #f39c12;
}

.chat-message .msg-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    margin-left: 8px;
    float: right;
    margin-top: 2px;
}

.chat-message .message-content {
    color: #fff;
    word-break: break-all;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.chat-message .message-time {
    color: #ccc;
    font-size: 11px;
    margin-left: 8px;
}

.chat-message .player-name {
    color: #ffd700;
    font-weight: bold;
    margin-right: 5px;
}

.no-messages {
    text-align: center;
    color: #ccc;
    padding: 20px;
    font-size: 13px;
}

.chat-message .message-time {
    color: #999;
    font-size: 11px;
    margin-left: 8px;
}

.no-messages {
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 13px;
}

/* 聊天气泡 */
.chat-bubble {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    max-width: 150px;
    word-break: break-all;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    animation: chatBubbleFade 0.3s ease;
}

.chat-bubble::after {
    content: '';
    position: absolute;
    border-width: 6px;
    border-style: solid;
}

.chat-bubble:not([style*="top"])::after {
    border-color: rgba(255, 255, 255, 0.95) transparent transparent transparent;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
}

@keyframes chatBubbleFade {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* 空聊天提示 */
.chat-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.25);
    font-size: 13px;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.chat-empty .empty-icon {
    font-size: 32px;
    opacity: 0.4;
}

.phrase-btn {
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    border-radius: 10px;
    text-align: left;
    transition: all 0.25s;
    font-size: 13px;
}

.phrase-btn:hover {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.5);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.15);
}

.phrase-btn:active {
    transform: translateY(0);
    background: rgba(231, 76, 60, 0.35);
}

.emoji-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    border-radius: 8px;
    font-size: 20px;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.emoji-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: scale(1.15);
}

.emoji-btn:active {
    transform: scale(0.95);
}

.chat-input-area {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    padding: 10px 14px 14px;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.15);
}

.chat-input-area input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.5) !important;
    color: #fff !important;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: all 0.25s;
}

.chat-input-area input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.chat-input-area input:focus {
    border-color: rgba(231, 76, 60, 0.5);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.btn-send {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    cursor: pointer;
    padding: 0;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    font-size: 16px;
}

.btn-send:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 12px rgba(231, 76, 60, 0.4);
}

.btn-send img {
    width: 20px;
    height: 20px;
    filter: brightness(10);
}

.btn-close-chat {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    padding: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    line-height: 1;
}

.btn-close-chat:hover {
    background: rgba(231, 76, 60, 0.3);
    transform: rotate(90deg);
    color: #fff;
}

.btn-close-chat img {
    width: 16px;
    height: 16px;
    filter: brightness(2);
}

/* 玩家头上的聊天气泡 */
.player-chat-bubble {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 13px;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    z-index: 50;
    animation: bubbleIn 0.3s ease, bubbleOut 0.3s ease 3.5s forwards;
    pointer-events: none;
}

.player-chat-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(255, 255, 255, 0.95);
}

@keyframes bubbleIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(10px) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes bubbleOut {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

/* ==================== 弹窗样式 ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-frame {
    position: relative;
    width: 360px;
    min-height: 280px;
    z-index: 1;
}

.modal-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: fill;
}

.modal-content {
    position: relative;
    z-index: 1;
    padding: 20px;
}

.modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

.modal-header h3 {
    font-size: 20px;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.btn-close {
    width: 35px;
    height: 35px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
}

.btn-close img {
    width: 100%;
    height: 100%;
}

.modal-body {
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 200px;
}

.setting-item {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    gap: 15px;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    font-size: 18px;
    color: #ffd700;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    min-width: 50px;
    text-align: center;
}

.switch-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.2s;
}

.switch-container:hover {
    background: rgba(255, 255, 255, 0.1);
}

.switch-container img {
    width: 60px;
    height: 30px;
    transition: transform 0.2s;
}

.switch-container:hover img {
    transform: scale(1.05);
}

/* 关闭按钮样式 */
.btn-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
    transition: transform 0.2s;
}

.btn-close:hover {
    transform: scale(1.1);
}

.btn-close img {
    width: 100%;
    height: 100%;
}

/* 设置弹窗样式 - 类似记牌器 */
.settings-frame {
    width: 280px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 15px;
}

.settings-frame .modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

.settings-frame .modal-header h3 {
    font-size: 18px;
    color: #ffd700;
}

.settings-frame .modal-body {
    padding: 0;
}

.settings-frame .setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.settings-frame .setting-item:last-child {
    border-bottom: none;
}

.settings-frame .btn-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.modal-footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding-top: 15px;
}

.btn-common {
    position: relative;
    width: 120px;
    height: 45px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
}

.btn-common img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.btn-common span {
    position: relative;
    z-index: 1;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}

/* 游戏结果弹窗 */
.result-frame {
    width: 500px;
    min-height: 400px;
}

.result-content {
    text-align: center;
}

.result-title {
    margin-bottom: 20px;
}

.result-title img {
    height: 50px;
}

.result-players {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0 20px 40px;
    max-height: 280px;
    overflow-y: auto;
}

/* 【修复】使用ID选择器确保样式生效 */
#result-players-list {
    margin-left: 40px !important;
}

.result-player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.btn-result {
    width: 130px;
    height: 50px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}

.btn-result:hover {
    transform: scale(1.05);
}

.btn-result img {
    width: 100%;
    height: 100%;
}

/* ==================== 小卡片（已出牌） ==================== */
.mini-card {
    width: 45px;
    height: 63px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.mini-card img {
    width: 100%;
    height: 100%;
}

/* ==================== 倒计时覆盖层 ==================== */
.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.countdown-number {
    font-size: 120px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    animation: countdownPulse 1s ease-out;
}

@keyframes countdownPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==================== 加载动画 ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 20px;
    font-size: 16px;
    color: #fff;
}

/* ==================== Toast提示 ==================== */
.toast-container {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 16px 32px;
    border-radius: 25px;
    font-size: 24px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 隐藏类 ==================== */
.hidden {
    display: none !important;
}

/* ==================== 响应式适配 ==================== */
@media (max-width: 1200px) {
    .my-cards-container {
        max-width: 900px;
        height: 180px;
    }

    .my-card {
        width: 55px;
        height: 77px;
        margin-top: -35px;
    }
}

@media (max-width: 900px) {
    .table-center {
        width: 300px;
        height: 200px;
    }

    .center-played-area {
        width: 220px;
        height: 80px;
    }

    .mini-card {
        width: 35px;
        height: 49px;
    }
}

@media (max-width: 768px) {
    .player-seat {
        transform: scale(0.85);
    }

    .seat-opposite {
        top: 5px;
    }

    .seat-left {
        left: 10px;
    }

    .seat-right {
        right: 10px;
    }
}

/* ==================== 游戏结算弹窗 ==================== */
#round-result-modal .result-frame {
    width: 550px;
    max-width: 90%;
}

#round-result-modal .result-content {
    padding: 25px;
}

.result-title {
    text-align: center;
    margin-bottom: 15px;
}

.result-title img {
    height: 50px;
}

.upgrade-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 10px;
    font-size: 16px;
}

.upgrade-info .current-level,
.upgrade-info .next-level {
    color: #fff;
    margin: 0 10px;
}

.upgrade-info strong {
    color: #ffd700;
    font-size: 24px;
}

.upgrade-arrow {
    color: #ffd700;
    font-size: 24px;
    margin: 0 15px;
}

.upgrade-count {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: #fff;
    padding: 5px 15px;
    border-radius: 20px;
    margin-left: 15px;
    font-weight: bold;
}

.result-player-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 3px solid transparent;
}

.result-player-item.winner {
    background: rgba(255, 215, 0, 0.15);
    border-left-color: #ffd700;
}

.result-player-item.loser {
    background: rgba(255, 107, 107, 0.1);
    border-left-color: #ff6b6b;
}

.result-player-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    margin-right: 10px;
    flex-shrink: 0;
}

.result-player-rank.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #8b4513;
}

.result-player-rank.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #e0e0e0);
    color: #555;
}

.result-player-rank.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #daa520);
    color: #fff;
}

.result-player-rank.rank-4 {
    background: linear-gradient(135deg, #666, #888);
    color: #fff;
}

.result-player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    object-fit: cover;
}

.result-player-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.result-player-name {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-player-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.result-tag {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 8px;
}

.result-tag.friend {
    background: rgba(255, 215, 0, 0.3);
    color: #ffd700;
}

.result-tag.enemy {
    background: rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
}

.result-tag.title {
    background: rgba(100, 200, 255, 0.3);
    color: #64c8ff;
}

/* ========== 奖励显示样式 ========== */
.result-player-rewards {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
    padding-left: 10px;
}

.reward-gold {
    font-size: 14px;
    font-weight: bold;
}

.reward-gold.reward-positive {
    color: #4ecf73;
}

.reward-gold.reward-negative {
    color: #ff6b6b;
}

.reward-diamond {
    font-size: 12px;
    color: #64d8ff;
    font-weight: bold;
}

.reward-diamond::before {
    content: '💎';
    margin-right: 2px;
    font-size: 11px;
}

.reward-gold.reward-positive::before {
    content: '🪙';
    margin-right: 2px;
    font-size: 11px;
}

.reward-gold.reward-negative::before {
    content: '🪙';
    margin-right: 2px;
    font-size: 11px;
}

.reward-score {
    font-size: 11px;
    color: #bbb;
}

.reward-score::before {
    content: '⭐';
    margin-right: 2px;
    font-size: 10px;
}

.reward-details-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #aaa;
    font-size: 10px;
    cursor: help;
}

.result-countdown {
    text-align: center;
    margin-bottom: 20px;
    color: #aaa;
    font-size: 14px;
}

.result-countdown span {
    color: #ffd700;
    font-weight: bold;
    font-size: 18px;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.btn-result {
    position: relative;
    width: 180px;
    height: 55px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-result:hover {
    transform: scale(1.05);
}

.btn-result img {
    width: 100%;
    height: 100%;
}

.btn-result span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

/* 继续按钮上的下局级牌指示器 */
.next-level-indicator {
    position: absolute;
    top: 0px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 8px;
    border: 2px solid #ffd700;
    min-width: 40px;
    min-height: 40px;
}

.next-level-value {
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    margin-top: 9px;
}

/* ==================== 记牌器 ==================== */
.card-counter-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #ffd700;
    border-radius: 10px;
    z-index: 200;
    padding: 15px;
    user-select: none;
}

.card-counter-panel.dragging {
    opacity: 0.9;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
}

.card-counter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    cursor: move;
}

.card-counter-header span {
    color: #ffd700;
    font-size: 18px;
    font-weight: bold;
}

.btn-close-counter {
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(255, 107, 107, 0.8);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    border-radius: 5px;
}

.card-counter-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.counter-row {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.counter-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 5px;
    min-width: 50px;
}

.counter-item.level-card {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid #ffd700;
}

.counter-point {
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 3px;
}

.counter-count {
    color: #ffd700;
    font-size: 16px;
    font-weight: bold;
}

/* ==================== 出牌记录面板 ==================== */
.play-record-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 380px;
    max-height: 500px;
    background: rgba(0, 0, 0, 0.92);
    border: 2px solid #ffd700;
    border-radius: 10px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    user-select: none;
}

.play-record-panel.hidden {
    display: none !important;
}

.play-record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
    border-bottom: 2px solid #ffd700;
    border-radius: 8px 8px 0 0;
    cursor: move;
}

.play-record-header span {
    color: #ffd700;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.btn-close-record {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 107, 107, 0.9);
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    line-height: 1;
    transition: background 0.2s;
}

.btn-close-record:hover {
    background: rgba(255, 82, 82, 1);
}

.play-record-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    max-height: 440px;
}

.record-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.record-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.record-table th {
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
    padding: 10px 8px;
    text-align: center;
    font-weight: bold;
    border-bottom: 2px solid rgba(255, 215, 0, 0.5);
}

.record-table td {
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    vertical-align: middle;
}

.record-table tbody tr:hover {
    background: rgba(255, 215, 0, 0.05);
}

.record-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

.col-round {
    width: 60px;
    color: #fff;
    font-weight: bold;
}

.col-player {
    width: 100px;
    color: #4fc3f7;
    font-weight: 500;
}

.col-level {
    width: 50px;
    color: #fff;
    font-weight: bold;
}

.col-time {
    width: 70px;
    color: #9e9e9e;
    font-size: 12px;
}

.level-red {
    color: #f44336;
    font-weight: bold;
}

.level-blue {
    color: #2196f3;
    font-weight: bold;
}

.player-cell {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
}

.player-avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.col-cards {
    text-align: left;
    padding-left: 10px;
}

.record-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: flex-start;
}

.record-card {
    width: 28px;
    height: 40px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
}

.record-card.heart,
.record-card.diamond {
    color: #d32f2f;
}

.record-card.spade,
.record-card.club {
    color: #212121;
}

.record-card.joker {
    background: linear-gradient(135deg, #ffeb3b, #ffc107);
    color: #d32f2f;
    font-size: 10px;
}

.record-card.empty {
    background: transparent;
    box-shadow: none;
    color: #9e9e9e;
    font-size: 12px;
}

.record-card-img {
    width: 32px;
    height: 44px;
    object-fit: contain;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* 滚动条样式 */
.play-record-content::-webkit-scrollbar {
    width: 8px;
}

.play-record-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.play-record-content::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 4px;
}

.play-record-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.5);
}

/* 拖动时的样式 */
.play-record-panel.dragging {
    opacity: 0.9;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
}

/* 进贡记录面板 */
.tribute-record-panel {
    position: fixed;
    top: 80px;
    right: 420px;
    width: 360px;
    max-height: 400px;
    background: rgba(0, 0, 0, 0.92);
    border: 2px solid #ff6b6b;
    border-radius: 10px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    user-select: none;
}

.tribute-record-panel.hidden {
    display: none !important;
}

.tribute-record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(255, 107, 107, 0.1));
    border-bottom: 2px solid #ff6b6b;
    border-radius: 8px 8px 0 0;
    cursor: move;
}

.tribute-record-header span {
    color: #ff6b6b;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.tribute-record-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    max-height: 340px;
}

.tribute-record-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tribute-record-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.tribute-record-table th {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
    padding: 10px 8px;
    text-align: center;
    font-weight: bold;
}

.tribute-record-table td {
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 107, 107, 0.2);
    color: #fff;
}

.tribute-record-table tr:hover {
    background: rgba(255, 107, 107, 0.1);
}

.tribute-record-table .col-type {
    width: 60px;
}

.tribute-record-table .col-player {
    width: 100px;
}

.tribute-record-table .col-card {
    width: 60px;
}

.tribute-record-table .col-arrow {
    width: 30px;
}

.tribute-record-table .col-target {
    width: 100px;
}

/* 进贡记录中的玩家头像 */
.record-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 5px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* 进贡记录中的玩家名称 */
.player-name {
    vertical-align: middle;
    font-size: 12px;
}

/* 进贡记录中的卡牌图片 */
.record-card-img {
    width: 36px;
    height: 50px;
    vertical-align: middle;
    border-radius: 3px;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.tribute-type-present {
    color: #ff6b6b;
    font-weight: bold;
}

.tribute-type-refund {
    color: #4ecdc4;
    font-weight: bold;
}

.tribute-type-resist {
    color: #ffd700;
    font-weight: bold;
}

.tribute-card {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 12px;
}

.tribute-card.red {
    color: #ff4d4d;
}

.tribute-card.black {
    color: #fff;
}

.tribute-record-panel.dragging {
    opacity: 0.9;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
}

/* ==================== 游客显示 ==================== */
.spectator-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    position: absolute;
    top: 10px;
    left: 150px;
    z-index: 100;
}

.spectator-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: transform 0.2s;
}

.spectator-avatar:hover {
    transform: scale(1.1);
    border-color: #ffd700;
}

/* ==================== 手机模式 ==================== */
.mobile-mode {
    overflow: hidden;
}

.mobile-mode .game-container {
    transform-origin: top left;
}

.landscape-prompt {
    display: none;
}

/* 隐藏空座位头像 */
.seat-empty .player-avatar {
    opacity: 0;
    display: none;
}

.seat-empty .player-name {
    color: #888;
}

/* ==================== 奖励记录面板 ==================== */
.reward-record-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 380px;
    max-height: 500px;
    background: rgba(0, 0, 0, 0.92);
    border: 2px solid #00ff88;
    border-radius: 10px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    user-select: none;
}

.reward-record-panel.hidden {
    display: none !important;
}

.reward-record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 255, 136, 0.1));
    border-bottom: 2px solid #00ff88;
    border-radius: 8px 8px 0 0;
    cursor: move;
}

.reward-record-header span {
    color: #00ff88;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.reward-record-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    max-height: 420px;
}

.reward-summary {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

.reward-total {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.reward-players {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 255, 136, 0.2);
}

.player-reward-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    min-width: 80px;
}

.player-reward-item.team-red {
    border: 1px solid rgba(255, 100, 100, 0.4);
}

.player-reward-item.team-blue {
    border: 1px solid rgba(100, 100, 255, 0.4);
}

.player-reward-item .player-name {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 2px;
}

.player-reward-item .player-totals {
    font-size: 13px;
    font-weight: bold;
}

.player-reward-item .player-gold {
    color: #ffd700;
}

.player-reward-item .player-diamond {
    color: #00bfff;
}

.player-reward-item .no-reward {
    color: #666;
    font-size: 12px;
}

.reward-label {
    color: #aaa;
    font-size: 14px;
}

.reward-gold {
    color: #ffd700;
    font-size: 16px;
    font-weight: bold;
}

.reward-diamond {
    color: #00bfff;
    font-size: 16px;
    font-weight: bold;
}

.reward-record-table {
    width: 100%;
    border-collapse: collapse;
}

.reward-record-table th {
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
    padding: 8px 5px;
    text-align: center;
    font-size: 13px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.3);
}

.reward-record-table td {
    padding: 8px 5px;
    text-align: center;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #ddd;
}

.reward-record-table .col-time {
    width: 65px;
    color: #888;
}

.reward-record-table .col-player {
    width: 80px;
}

.reward-record-table .col-type {
    width: 80px;
}

.reward-record-table .col-reward {
    width: 80px;
    font-weight: bold;
}

.reward-gold-text {
    color: #ffd700;
}

.reward-diamond-text {
    color: #00bfff;
}

/* 奖励弹出动画 */
.reward-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid #ffd700;
    border-radius: 15px;
    padding: 30px 50px;
    z-index: 1000;
    text-align: center;
    animation: rewardPopIn 0.5s ease-out;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
}

@keyframes rewardPopIn {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.reward-popup .player-name {
    color: #fff;
    font-size: 20px;
    margin-bottom: 10px;
}

.reward-popup .bomb-type {
    color: #ff6b6b;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.8);
}

.reward-popup .reward-amount {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 10px;
}

.reward-popup .reward-amount.gold {
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
}

.reward-popup .reward-amount.diamond {
    color: #00bfff;
    text-shadow: 0 0 15px rgba(0, 191, 255, 0.8);
}

.reward-popup .total-reward {
    color: #aaa;
    font-size: 14px;
    margin-top: 10px;
}

.reward-popup .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 107, 107, 0.8);
    border: none;
    color: #fff;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.reward-popup .close-btn:hover {
    background: rgba(255, 82, 82, 1);
}

/* 奖励面板拖拽样式 */
.reward-record-panel.dragging {
    opacity: 0.9;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
}

/* 玩家资产显示 - 按组队显示 */
.team-assets {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-right: 15px;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.team-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.team-label {
    font-size: 12px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 30px;
    text-align: center;
}

.team-red .team-label {
    background: rgba(220, 53, 69, 0.8);
    color: #fff;
}

.team-blue .team-label {
    background: rgba(0, 123, 255, 0.8);
    color: #fff;
}

.team-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 90px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.team-player .player-name {
    font-size: 11px;
    color: #ddd;
    max-width: 85px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}

.team-player .player-assets {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: bold;
}

.team-player .player-gold {
    color: #ffd700;
}

.team-player .player-diamond {
    color: #00bfff;
}

/* ==================== 广告弹窗样式 ==================== */
.ad-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.ad-container {
    position: relative;
    width: 90%;
    max-width: 600px;
    background: #1a1a2e;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.ad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.ad-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
}

.ad-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}

.ad-close:hover {
    opacity: 1;
}

.ad-content {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.ad-content iframe {
    width: 100%;
    height: 100%;
}

.ad-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #16213e;
}

.ad-timer {
    color: #aaa;
    font-size: 14px;
}

.ad-timer-seconds {
    color: #ffd700;
    font-size: 24px;
    font-weight: bold;
}

.ad-skip {
    padding: 10px 30px;
    background: #4a4a6a;
    border: none;
    border-radius: 25px;
    color: #888;
    font-size: 14px;
    cursor: not-allowed;
    transition: all 0.3s;
}

.ad-skip:not(.disabled) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
}

.ad-skip:not(.disabled):hover {
    transform: scale(1.05);
}

.ad-reward {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-reward-content {
    text-align: center;
    padding: 30px;
}

.ad-reward-title {
    color: #ffd700;
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.ad-reward-amount {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.ad-reward-amount .reward-gold {
    color: #ffd700;
    font-size: 24px;
    font-weight: bold;
}

.ad-reward-amount .reward-diamond {
    color: #00bfff;
    font-size: 24px;
    font-weight: bold;
}

.ad-reward-btn {
    padding: 12px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 25px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

.ad-reward-btn:hover {
    transform: scale(1.05);
}

/* ==================== 金币不足提示弹窗 ==================== */
.gold-insufficient-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gold-insufficient-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.gold-insufficient-container {
    position: relative;
    width: 90%;
    max-width: 400px;
}

.gold-insufficient-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.gold-insufficient-title {
    color: #ff6b6b;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
}

.gold-insufficient-text {
    color: #aaa;
    font-size: 14px;
    margin-bottom: 25px;
}

.gold-insufficient-ad-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 25px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.gold-insufficient-ad-btn:hover {
    transform: scale(1.02);
}

.gold-insufficient-ad-btn .ad-reward-text {
    font-size: 12px;
    opacity: 0.8;
}

.gold-insufficient-close {
    background: none;
    border: 1px solid #4a4a6a;
    border-radius: 20px;
    color: #888;
    padding: 10px 30px;
    cursor: pointer;
    font-size: 14px;
}

.gold-insufficient-close:hover {
    background: rgba(255, 255, 255, 0.1);
}