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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: linear-gradient(135deg, #0a4d2e 0%, #1a6d3e 100%);
    min-height: 100vh;
    color: #fff;
}

.hidden { display: none !important; }
#confirm-modal { z-index: 20000; }
#dice-modal { z-index: 19999; }

/* ===== Global Topbar ===== */
.global-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 44px;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    z-index: 10000;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.global-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.global-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255,215,0,0.4);
    object-fit: cover;
}
.global-user-initial {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3296FA, #52c41a);
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255,215,0,0.4);
}
.global-user-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.global-user-name {
    font-size: 13px;
    font-weight: bold;
    color: #fff;
}
.global-user-stats {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
}
.global-logout-btn {
    padding: 5px 14px;
    font-size: 12px;
    background: rgba(244,67,54,0.2);
    color: #ff8a80;
    border: 1px solid rgba(244,67,54,0.3);
    border-radius: 6px;
    cursor: pointer;
    width: auto;
    flex-shrink: 0;
}
.global-logout-btn:hover {
    background: rgba(244,67,54,0.35);
}

.global-marquee {
    flex: 1;
    overflow: hidden;
    margin: 0 16px;
    height: 28px;
    position: relative;
}
.marquee-content {
    display: inline-block;
    white-space: nowrap;
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    position: absolute;
    left: 0;
    top: 0;
    will-change: transform;
}

/* 大厅标题居中 */

/* ===== 掷骰子动画 ===== */
.dice-modal-content {
    max-width: 420px;
    background: rgba(10,77,46,0.95);
    border: 1px solid rgba(255,215,0,0.3);
}
.dice-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    min-height: 80px;
    align-items: center;
}
.dice {
    width: 60px;
    height: 60px;
    background: #fff;
    border-radius: 12px;
    border: 2px solid #bbb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    color: #333;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    position: relative;
    transition: all 0.2s;
}
.dice-label {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
}
.dice.rolling {
    animation: dice-shake 0.5s ease-in-out infinite;
}
.dice.winner {
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255,215,0,0.5);
    background: #fffde7;
}
.dice-result {
    text-align: center;
    font-size: 16px;
    color: #ffd700;
    margin-top: 10px;
    min-height: 24px;
}
@keyframes dice-shake {
    0%, 100% { transform: rotate(0deg) translateY(0); }
    25% { transform: rotate(-10deg) translateY(-5px); }
    50% { transform: rotate(5deg) translateY(3px); }
    75% { transform: rotate(-3deg) translateY(-3px); }
}
.lobby-title {
    font-size: 28px;
    text-align: center;
    flex: 1;
    margin: 0;
}

.screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-box h1 { font-size: 3em; margin-bottom: 5px; }
.subtitle { color: rgba(255,255,255,0.7); margin-bottom: 25px; }

#btn-dingtalk-login {
    background: #3296FA;
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    margin-bottom: 10px;
}

#btn-dingtalk-login:disabled {
    background: #52c41a;
    cursor: default;
}

#dingtalk-status {
    margin-top: 10px;
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    line-height: 1.6;
}

#dingtalk-status.hidden {
    display: none;
}

.login-hint {
    margin-top: 16px;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    line-height: 1.6;
}

#logged-in-info {
    margin-bottom: 15px;
    text-align: center;
}

#logged-in-info img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
}

#logged-in-info #user-name-display {
    font-size: 16px;
    margin-top: 5px;
}

input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 16px;
    margin-bottom: 15px;
    outline: none;
}
input::placeholder { color: rgba(255,255,255,0.5); }
input:focus { border-color: #ffd700; }

button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #ffd700;
    color: #1a1a2e;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}
button:hover { background: #ffed4a; transform: translateY(-1px); }
button:disabled { background: #666; cursor: not-allowed; transform: none; }
.btn-primary { background: #ffd700; }

.or { color: rgba(255,255,255,0.5); margin: 15px 0; }

#room-list h3 { font-size: 14px; color: rgba(255,255,255,0.7); margin-bottom: 10px; }
#rooms { text-align: left; }
.room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.room-item:hover { background: rgba(255,255,255,0.15); }
.room-item .room-info { font-size: 14px; }
.room-item .room-players { font-size: 12px; color: rgba(255,255,255,0.6); }
.room-item .join-btn {
    width: auto;
    padding: 6px 16px;
    font-size: 13px;
}

.lobby {
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    width: 100%;
    max-width: 500px;
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.level-badge {
    background: #ffd700;
    color: #1a1a2e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}

.seats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.seat {
    background: rgba(255,255,255,0.06);
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    min-height: 100px;
}
.seat.occupied { border-style: solid; border-color: rgba(255,215,0,0.5); }
.seat .seat-icon { font-size: 2em; margin-bottom: 8px; }
.seat .seat-name { font-size: 14px; font-weight: bold; }
.seat .seat-status { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 4px; }
.seat .seat-ready { font-size: 12px; margin-top: 4px; min-height: 18px; }

.lobby-actions { display: flex; gap: 10px; }
.lobby-actions button { flex: 1; }
.lobby-actions button:last-child { background: #ffd700; }

/* ===== Game Table Layout (16:9) ===== */
#game-screen {
    flex-direction: row !important;
    align-items: stretch !important;
    padding: 52px 8px 8px !important;
    gap: 10px !important;
}

.game-table {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.game-levels {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-level {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    padding: 3px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
}

.current-level.level-badge {
    background: #ffd700;
    color: #1a1a2e;
    padding: 5px 14px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: bold;
    box-shadow: 0 0 12px rgba(255,215,0,0.3);
}

.game-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
}
/* 对局提示消息（状态栏中部，替代原生弹窗） */
.game-status-msg {
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-weight: bold;
    color: #ffd700;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
}
.game-status-msg.show { opacity: 1; }

/* 结算弹窗得分明细 */
.settlement-list {
    margin: 10px auto 14px;
    min-width: 220px;
    max-width: 300px;
}
.settle-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 14px;
    font-size: 14px;
    border-radius: 6px;
}
.settle-row.settle-win { color: #52c41a; }
.settle-row.settle-lose { color: #ff4d4f; }
.game-user-avatar-img {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,215,0,0.4);
    object-fit: cover;
}
.game-user-name { font-size: 13px; font-weight: bold; }
.game-user-stats { font-size: 11px; color: rgba(255,255,255,0.5); }

.game-top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.turn-indicator {
    font-size: 13px;
    font-weight: bold;
    padding: 4px 14px;
    border-radius: 14px;
    background: rgba(255,215,0,0.25);
    color: #fff;
    border: 1px solid rgba(255,215,0,0.6);
    white-space: nowrap;
}
.turn-indicator.active { background: rgba(255,215,0,0.85); color: #1a1a2e; animation: pulse 1s infinite; }

.tribute-bar {
    /* 内联在对局信息栏中，不再悬浮顶部（避免被系统栏遮挡按钮） */
    font-size: 13px;
    padding: 5px 14px;
    border-radius: 14px;
    background: rgba(82,196,26,0.92);
    color: #fff;
    border: 1px solid rgba(130,220,90,1);
    white-space: nowrap;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.player-area {
    background: rgba(0,0,0,0.12);
    border-radius: 8px;
    padding: 6px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 2px 6px;
}
.player-name { font-weight: bold; }
.card-count { color: rgba(255,255,255,0.7); font-size: 13px; margin-left: auto; }

.player-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255,215,0,0.4);
    object-fit: cover;
    flex-shrink: 0;
}

.opponent-area { text-align: center; transition: box-shadow 0.3s; }
.opponent-area.active-turn { box-shadow: 0 0 20px rgba(255,215,0,0.5), inset 0 0 20px rgba(255,215,0,0.1); }
.my-area.active-turn { box-shadow: 0 0 20px rgba(255,215,0,0.5), inset 0 0 20px rgba(255,215,0,0.1); }

.opponent-top-area {
    flex-shrink: 0;
    max-width: 540px;
    margin: 0 auto;
    width: 100%;
}

.middle-area {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 8px;
    min-height: 0;
}

.middle-area .opponent-area.side {
    width: 200px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 4px;
}

.table-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.last-play-cards {
    display: flex;
    gap: 4px;
    justify-content: center;
    min-height: 60px;
    align-items: center;
    padding: 4px;
}

.last-play-cards .card-tiny {
    width: 40px;
    height: 56px;
    font-size: 14px;
    border-radius: 5px;
}

.played-cards {
    display: flex;
    gap: 0;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 56px;
    align-items: center;
    padding: 2px 4px;
}
.played-cards .card-mini {
    margin-left: -28px;
}
.played-cards .card-mini:first-child {
    margin-left: 0;
}

.game-messages {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    text-align: center;
    max-height: 50px;
    overflow-y: auto;
    width: 100%;
}

.my-area {
    flex: 1.5 1 0;
    min-height: 0;
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

/* ===== Card Hand Layout (bigger + flex-fill) ===== */
.hand-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 8px 12px 46px 12px;
    flex: 1 1 0;
    overflow-x: hidden;
    overflow-y: visible;
    min-height: 0;
}

/* ===== Card Group ===== */
.card-group {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.card-group-inner {
    position: relative;
    width: 82px;
}

.card-group .group-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    background: rgba(0,0,0,0.4);
    padding: 1px 6px;
    border-radius: 8px;
    white-space: nowrap;
    margin-bottom: 2px;
    pointer-events: none;
}

/* 炸弹/张数标注 */
.group-badge {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: bold;
    color: #ffd700;
    background: rgba(0,0,0,0.65);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 15;
    border: 1px solid rgba(255,215,0,0.3);
}

/* Card Selected */
.card-selected {
    transform: translateY(-18px) !important;
    box-shadow: 0 0 0 2px #ffd700, 0 4px 16px rgba(255,215,0,0.4) !important;
}

/* ===== Card Face ===== */
.card-face {
    position: absolute;
    width: 82px;
    height: 118px;
    background: #fff;
    border: 1.5px solid #bbb;
    border-radius: 6px;
    transition: all 0.15s ease;
    user-select: none;
    flex-shrink: 0;
    overflow: visible;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.card-face.red { color: #c62828; border-color: #c62828; }
.card-face.black { color: #1a1a2e; border-color: #888; }
.card-face.joker {
    color: #b71c1c;
    border-color: #b71c1c;
    background: linear-gradient(135deg, #fff 85%, #ffcdd2 100%);
}

/* ---- 新牌面角标：水平排列 + 2x 字体 ---- */
.card-corner-top {
    position: absolute;
    top: 4px; left: 6px;
    display: flex; align-items: baseline; gap: 2px; line-height: 1;
}
.card-corner-bottom {
    position: absolute;
    bottom: 4px; right: 6px;
    display: flex; align-items: baseline; gap: 2px; line-height: 1;
    transform: rotate(180deg);
}
.corner-rank {
    font-size: 27px; font-weight: bold; line-height: 1;
}
.corner-suit {
    font-size: 19px; line-height: 1;
}
.card-corner-top.rank-level .corner-rank,
.card-corner-bottom.rank-level .corner-rank {
    color: #ffd700;
}
.card-center {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 45px; opacity: 0.12; pointer-events: none;
}

/* mini 牌面角标 */
.card-mini .card-corner-top { top: 2px; left: 3px; gap: 1px; }
.card-mini .card-corner-bottom { bottom: 2px; right: 3px; gap: 1px; }
.card-mini .corner-rank { font-size: 22px; }
.card-mini .corner-suit { font-size: 16px; }
.card-mini .card-center { font-size: 36px; opacity: 0.12; }

.card-wild-badge {
    position: absolute; top: -6px; right: -6px; width: 24px; height: 24px;
    background: #ff5722; color: #fff; font-size: 13px; font-weight: bold;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3); z-index: 20;
}

/* Stacking offsets */
.card-face.stack-0 { position: absolute; top: 0; left: 0; z-index: 10; }
.card-face.stack-1 { position: absolute; top: -40px; left: 0; z-index: 9; }
.card-face.stack-2 { position: absolute; top: -80px; left: 0; z-index: 8; }
.card-face.stack-3 { position: absolute; top: -120px; left: 0; z-index: 7; }
.card-face.stack-4 { position: absolute; top: -160px; left: 0; z-index: 6; }
.card-face.stack-5 { position: absolute; top: -200px; left: 0; z-index: 5; }
.card-face.stack-6 { position: absolute; top: -240px; left: 0; z-index: 4; }
.card-face.stack-7 { position: absolute; top: -280px; left: 0; z-index: 3; }

/* ===== Card back (opponent) ===== */
.card-back {
    display: inline-flex;
    width: 40px;
    height: 58px;
    background: linear-gradient(135deg, #1a237e, #283593);
    border: 2px solid #3949ab;
    border-radius: 5px;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.3);
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
    margin-left: -26px;
}
.card-back:first-child { margin-left: 0; }

/* ===== Card tiny (table center last-play) ===== */
.card-tiny {
    display: inline-flex;
    width: 36px;
    height: 50px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
    font-weight: bold;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.card-tiny.red { color: #c62828; border-color: #c62828; }
.card-tiny.black { color: #1a1a2e; }
.card-tiny.joker { color: #b71c1c; background: linear-gradient(135deg, #fff, #ffcdd2); }

/* ===== Card Mini (player played-cards) ===== */
.card-mini {
    display: inline-flex;
    position: relative;
    width: 58px;
    height: 84px;
    background: #fff;
    border: 1.5px solid #bbb;
    border-radius: 6px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    overflow: hidden;
}
.card-mini.red { color: #c62828; border-color: #c62828; }
.card-mini.black { color: #1a1a2e; border-color: #888; }
.card-mini.joker { color: #b71c1c; border-color: #b71c1c; background: linear-gradient(135deg, #fff 85%, #ffcdd2 100%); }
.card-mini .center-suit { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 26px; opacity: 0.12; pointer-events: none; }
.card-mini .center-joker { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 16px; font-weight: bold; letter-spacing: 1px; opacity: 0.7; text-align: center; }

/* joker center */
.card-center-joker {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 22px; font-weight: bold; letter-spacing: 2px; opacity: 0.65;
    text-align: center; line-height: 1.2;
}
.card-mini .wild-badge { position: absolute; top: -3px; right: -3px; width: 16px; height: 16px; background: #ff5722; color: #fff; font-size: 9px; font-weight: bold; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* ===== Game Actions (bigger for touch) ===== */
.game-actions {
    position: absolute;
    top: -56px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 24px;
    z-index: 10;
    white-space: nowrap;
}
.game-actions button {
    width: 60px !important;
    max-width: 60px;
    min-width: 60px;
    flex: 0 0 60px;
    padding: 8px 0;
    font-size: 16px;
    font-weight: bold;
    border-radius: 14px;
    border: 2px solid transparent;
    transition: all 0.25s ease;
    box-sizing: border-box;
}
.game-actions button:disabled {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.3);
    cursor: not-allowed;
    box-shadow: none;
}
/* 出牌按钮：选中合法牌型 → 橙色玻璃 */
#btn-play-cards:not(:disabled) {
    background: linear-gradient(135deg, rgba(255,152,0,0.85), rgba(255,87,34,0.9));
    color: #fff;
    border-color: rgba(255,200,100,0.5);
    box-shadow: 0 0 18px rgba(255,152,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
#btn-play-cards:not(:disabled):hover {
    box-shadow: 0 0 28px rgba(255,152,0,0.6), inset 0 1px 0 rgba(255,255,255,0.3);
    transform: translateY(-2px);
}
/* 不出按钮 */
#btn-pass:not(:disabled) {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}
/* ===== Bottom Toolbar ===== */
.bottom-toolbar {
    position: fixed !important;
    bottom: 28px !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%);
    width: 33vw;
    min-width: 240px;
    max-width: 400px;
    height: 46px;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    z-index: 9999 !important;
    border: none;
    border-radius: 23px;
    /* 全透明栏不拦截点击，只有按钮可点，避免挡住下方手牌 */
    pointer-events: none;
}
.bottom-toolbar button {
    pointer-events: auto;
}
/* 对局中居中于牌区（扣除右侧出牌记录栏 220px） */
body:has(#game-screen:not(.hidden)) .bottom-toolbar {
    left: calc((100% - 220px) / 2) !important;
}
/* 高透玻璃拟态按钮：边缘高光模拟玻璃折射 */
.bottom-toolbar button {
    width: 60px !important;
    padding: 8px 0;
    font-size: 13px;
    font-weight: bold;
    border-radius: 12px;
    color: #1a1a2e;
    background: linear-gradient(135deg,
        rgba(255,255,255,0.32) 0%,
        rgba(255,255,255,0.12) 45%,
        rgba(255,255,255,0.04) 100%);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.45);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.55),
        inset 0 -1px 1px rgba(255,255,255,0.12),
        0 4px 14px rgba(0,0,0,0.25);
    text-shadow: 0 1px 1px rgba(255,255,255,0.4);
    transition: all 0.2s ease;
}
.bottom-toolbar button:disabled {
    opacity: 0.4;
}
#btn-group:not(:disabled) {
    background: linear-gradient(135deg,
        rgba(130,230,150,0.42) 0%,
        rgba(70,180,100,0.22) 45%,
        rgba(50,150,80,0.10) 100%);
    border-color: rgba(190,255,205,0.6);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.55),
        inset 0 -1px 1px rgba(255,255,255,0.12),
        0 4px 14px rgba(0,0,0,0.25),
        0 0 12px rgba(90,220,120,0.25);
}
#btn-ungroup:not(:disabled) {
    background: linear-gradient(135deg,
        rgba(255,205,130,0.42) 0%,
        rgba(235,155,60,0.22) 45%,
        rgba(210,130,40,0.10) 100%);
    border-color: rgba(255,225,175,0.6);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.55),
        inset 0 -1px 1px rgba(255,255,255,0.12),
        0 4px 14px rgba(0,0,0,0.25),
        0 0 12px rgba(255,180,80,0.25);
}

/* ===== Opponent Card ===== */
.opp-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    background: rgba(0,0,0,0.15);
    border-radius: 10px;
}
.opponent-top-area .opp-card {
    justify-content: center;
}
.side .opp-card {
    flex-direction: column;
    text-align: center;
    gap: 6px;
}
.opp-card .player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255,215,0,0.4);
    object-fit: cover;
    flex-shrink: 0;
}
.opp-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 60px;
}
.opp-info .player-name {
    font-weight: bold;
    font-size: 14px;
}
.opp-stats {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}
.opp-card-backs {
    display: flex;
    flex-shrink: 0;
    position: relative;
    height: 52px;
    align-items: center;
}
.opp-card-back {
    display: inline-flex;
    width: 24px;
    height: 36px;
    background: linear-gradient(135deg, #1a237e, #283593);
    border: 1px solid #3949ab;
    border-radius: 3px;
    flex-shrink: 0;
    margin-left: -18px;
}
.opp-card-back:first-child { margin-left: 0; }
.opp-card-count {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
}

/* ===== Battle Log (出牌记录) ===== */
.battle-log {
    width: 220px;
    max-height: 98vh;
    background: rgba(0,0,0,0.25);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}
.battle-log-header {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: bold;
    background: rgba(255,215,0,0.15);
    color: #ffd700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.battle-log-entries {
    flex: 1;
    overflow-y: auto;
    padding: 4px 6px;
    font-size: 13px;
}
.battle-log-entry {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    line-height: 1.5;
}
.battle-log-entry .bl-seat { font-weight: bold; margin-right: 6px; font-size: 14px; }
.battle-log-entry .bl-action { color: rgba(255,255,255,0.7); font-size: 13px; }
.battle-log-entry .bl-cards { font-size: 13px; letter-spacing: 1px; }
.battle-log-entry .bl-note { font-size: 11px; padding: 1px 6px; border-radius: 8px; background: rgba(82,196,26,0.3); color: #b7eb6f; margin: 0 3px; }
.battle-log-entry.bl-self .bl-seat { color: #ffd700; }
.battle-log-entry.bl-pass .bl-action { color: rgba(255,255,255,0.35); }
.battle-log-entry.bl-finished { background: rgba(255,215,0,0.08); }

.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.modal-content {
    background: #1a4d2e;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    min-width: 300px;
}
.modal-content h2 { margin-bottom: 10px; color: #ffd700; }
.modal-content p { margin-bottom: 20px; color: rgba(255,255,255,0.8); }
.modal-content button { max-width: 200px; }

.tribute-modal-content {
    min-width: 400px;
    max-width: 500px;
}

.tribute-card-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 15px 0;
    min-height: 60px;
}

.tribute-card {
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.tribute-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(255,215,0,0.3);
}

.tribute-selected {
    border-color: #ffd700 !important;
    transform: translateY(-8px);
    box-shadow: 0 6px 20px rgba(255,215,0,0.5);
}

.tribute-card-wild {
    position: relative;
}

.tribute-card-wild::after {
    content: '配';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    background: #ff5722;
    color: #fff;
    font-size: 9px;
    font-weight: bold;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tribute-status {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    padding: 8px 0;
}

.tribute-actions {
    padding: 10px 0 0;
}
.tribute-actions button {
    width: auto;
    padding: 8px 24px;
}

/* ===== Animations ===== */
@keyframes cardDeal {
    from { opacity: 0; transform: translateY(30px) scale(0.8); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cardPlay {
    from { opacity: 0; transform: translateY(40px) scale(0.6); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cardFlyToCenter {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.8) translateY(-20px); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes opponentPass {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 0.6; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 5px rgba(255,215,0,0.3); }
    50% { box-shadow: 0 0 15px rgba(255,215,0,0.6); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.card-face:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.card-face.stack-0 { animation: cardDeal 0.3s ease-out backwards; }
.card-face.stack-1 { animation: cardDeal 0.35s ease-out backwards; }
.card-face.stack-2 { animation: cardDeal 0.4s ease-out backwards; }
.card-face.stack-3 { animation: cardDeal 0.45s ease-out backwards; }
.card-face.stack-4 { animation: cardDeal 0.5s ease-out backwards; }
.card-face.stack-5 { animation: cardDeal 0.55s ease-out backwards; }
.card-face.stack-6 { animation: cardDeal 0.6s ease-out backwards; }
.card-face.stack-7 { animation: cardDeal 0.65s ease-out backwards; }

.last-play-cards .card-tiny {
    animation: cardPlay 0.3s ease-out both;
}

.last-play-cards .card-tiny:nth-child(1) { animation-delay: 0s; }
.last-play-cards .card-tiny:nth-child(2) { animation-delay: 0.05s; }
.last-play-cards .card-tiny:nth-child(3) { animation-delay: 0.1s; }
.last-play-cards .card-tiny:nth-child(4) { animation-delay: 0.15s; }
.last-play-cards .card-tiny:nth-child(5) { animation-delay: 0.2s; }
.last-play-cards .card-tiny:nth-child(6) { animation-delay: 0.25s; }
.last-play-cards .card-tiny:nth-child(7) { animation-delay: 0.3s; }
.last-play-cards .card-tiny:nth-child(8) { animation-delay: 0.35s; }

.played-cards .card-tiny {
    animation: cardFlyToCenter 0.4s ease-out both;
}

.played-cards .card-tiny:nth-child(1) { animation-delay: 0s; }
.played-cards .card-tiny:nth-child(2) { animation-delay: 0.08s; }
.played-cards .card-tiny:nth-child(3) { animation-delay: 0.16s; }
.played-cards .card-tiny:nth-child(4) { animation-delay: 0.24s; }
.played-cards .card-tiny:nth-child(5) { animation-delay: 0.32s; }

.opponent-area.active-turn {
    animation: glowPulse 1.5s ease-in-out infinite;
}

.my-area.active-turn {
    animation: glowPulse 1.5s ease-in-out infinite;
}

.battle-log-entry {
    animation: slideIn 0.2s ease-out;
}

.game-actions button {
    transition: all 0.2s ease;
}

.game-actions button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(255,215,0,0.4);
}

.game-actions button:not(:disabled):active {
    transform: translateY(0);
    transition: all 0.05s;
}

.modal-content {
    animation: fadeInScale 0.3s ease-out;
}

.tribute-card-container .card-mini {
    animation: cardDeal 0.3s ease-out both;
}

.tribute-card-container .card-mini:nth-child(1) { animation-delay: 0s; }
.tribute-card-container .card-mini:nth-child(2) { animation-delay: 0.05s; }
.tribute-card-container .card-mini:nth-child(3) { animation-delay: 0.1s; }
.tribute-card-container .card-mini:nth-child(4) { animation-delay: 0.15s; }
.tribute-card-container .card-mini:nth-child(5) { animation-delay: 0.2s; }
.tribute-card-container .card-mini:nth-child(6) { animation-delay: 0.25s; }
.tribute-card-container .card-mini:nth-child(7) { animation-delay: 0.3s; }
.tribute-card-container .card-mini:nth-child(8) { animation-delay: 0.35s; }
.tribute-card-container .card-mini:nth-child(9) { animation-delay: 0.4s; }
.tribute-card-container .card-mini:nth-child(10) { animation-delay: 0.45s; }

.player-area {
    transition: box-shadow 0.3s ease, background 0.3s ease;
}

.seat {
    transition: all 0.3s ease;
}

.seat.occupied {
    animation: fadeInScale 0.3s ease-out;
}

/* ===== Lobby Room Cards ===== */
.lobby-actions-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.lobby-actions-bar .topbar-btn {
    min-width: auto;
    padding: 10px 20px;
    font-size: 14px;
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.room-card {
    background: rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 14px;
    transition: background 0.2s;
    border: 1px solid rgba(255,255,255,0.06);
}
.room-card.playing {
    border-color: rgba(255,215,0,0.2);
    background: rgba(255,215,0,0.04);
}
.room-card:hover {
    background: rgba(255,255,255,0.1);
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.room-mode {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
}
.room-mode.单把 { color: #64b5f6; }
.room-mode.整局 { color: #ffb74d; }

.room-status {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 6px;
}
.room-status.waiting { background: rgba(82,196,26,0.2); color: #52c41a; }
.room-status.playing { background: rgba(255,215,0,0.2); color: #ffd700; }

.room-seats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}
.room-seat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(0,0,0,0.15);
    cursor: default;
}
.room-seat.occupied:hover {
    background: rgba(255,215,0,0.1);
    cursor: pointer;
}
.room-seat.free {
    opacity: 0.4;
}
.room-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.room-avatar-initial {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(100,181,246,0.3);
    color: #fff;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.rs-name {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.room-spectators {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}
.room-action {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    width: auto;
}
.room-action.join { background: #52c41a; color: #fff; }
.room-action.spectate { background: rgba(255,255,255,0.12); color: #fff; }
.room-action.join:hover { background: #73d13d; }
.room-action.spectate:hover { background: rgba(255,255,255,0.2); }

/* ===== Lobby Container ===== */
.lobby-container {
    width: 100%;
    max-width: 1100px;
    padding: 8px 20px 20px;
}

/* ===== 全局顶栏高度 = 44px，所有页面 padding-top 至少 48px 避免遮挡 ===== */

#lobby-screen {
    align-items: flex-start;
    padding-top: 48px;
}

.lobby-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: rgba(255,255,255,0.08);
    border-radius: 14px;
    gap: 12px;
}

.lobby-topbar h2 {
    font-size: 22px;
    margin-bottom: 2px;
}

/* ---- 用户卡片 ---- */
.user-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 180px;
}

.user-avatar {
    position: relative;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
}

.user-avatar img,
#lobby-user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid rgba(255,215,0,0.5);
    object-fit: cover;
}

.user-initial {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3296FA, #52c41a);
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255,215,0,0.5);
}

.user-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}

.user-greeting {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}

/* ---- 统计区 ---- */
.user-stats {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    justify-content: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 56px;
    padding: 0 12px;
}

.stat-divider {
    width: 1px;
    height: 28px;
    background: rgba(255,255,255,0.12);
}

.stat-label {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
}

/* ---- 按钮 ---- */
.topbar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-btn {
    width: auto;
    padding: 8px 18px;
    font-size: 13px;
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-radius: 8px;
}

.topbar-btn:hover {
    background: rgba(255,255,255,0.2);
}

.logout-btn {
    background: rgba(244,67,54,0.25) !important;
    color: #ff8a80 !important;
}

.logout-btn:hover {
    background: rgba(244,67,54,0.4) !important;
}

.tables-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.table-card {
    background: rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 16px;
    transition: all 0.25s ease;
    border: 1px solid rgba(255,255,255,0.06);
}

.table-card:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.table-card.playing {
    border-color: rgba(255,215,0,0.3);
    background: rgba(255,215,0,0.06);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.table-number {
    font-size: 16px;
    font-weight: bold;
}

.table-status {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
}

.table-status.waiting {
    background: rgba(76,175,80,0.2);
    color: #81c784;
}

.table-status.playing {
    background: rgba(255,215,0,0.2);
    color: #ffd700;
}

.table-seats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    min-height: 100px;
}

.table-seat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
    background: rgba(0,0,0,0.15);
}

.table-seat .ts-icon {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.table-seat.occupied .ts-icon {
    background: #4caf50;
    box-shadow: 0 0 6px rgba(76,175,80,0.5);
}

.table-seat.free .ts-icon {
    background: rgba(255,255,255,0.2);
}

.table-seat .ts-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-seat.free .ts-name {
    color: rgba(255,255,255,0.35);
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-spectators {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

.table-action {
    width: auto;
    padding: 5px 16px;
    font-size: 12px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    font-weight: bold;
    transition: all 0.2s;
}

.table-action.join {
    background: #ffd700;
    color: #1a1a2e;
}

.table-action.join:hover {
    background: #ffed4a;
}

.table-action.spectate {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.table-action.spectate:hover {
    background: rgba(255,255,255,0.25);
}

.table-action.disabled {
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.3);
    cursor: not-allowed;
}

/* ===== Table Screen ===== */
/* ===== 全局顶栏高度 = 44px，所有页面 padding-top 至少 48px 避免遮挡 ===== */

#table-screen {
    align-items: flex-start;
    padding-top: 48px;
}

#table-screen .lobby {
    max-width: 500px;
}

#table-screen .lobby-header > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#table-screen .lobby-actions button {
    flex: 1;
}

#btn-add-ai {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

#btn-add-ai:hover {
    background: rgba(255,255,255,0.2);
}

#btn-leave-table {
    background: rgba(244,67,54,0.2);
    color: #ef9a9a;
}

#btn-leave-table:hover {
    background: rgba(244,67,54,0.35);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .tables-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .tables-grid {
        grid-template-columns: 1fr;
    }

    .lobby-topbar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* ===== Mobile Game Screen ===== */
@media (max-width: 768px) {
    #game-screen {
        flex-direction: column !important;
        padding: 4px !important;
        gap: 4px !important;
    }

    .battle-log {
        width: 100%;
        max-height: 25vh;
    }

    .middle-area .opponent-area.side {
        width: 100px;
    }

    .card-face {
        width: 68px;
        height: 98px;
    }
    .card-group-inner { width: 68px; }
    .corner-rank { font-size: 24px; }
    .corner-suit { font-size: 17px; }
    .card-center { font-size: 40px; }

.last-play-cards .card-mini {
    width: 102px;
    height: 147px;
    border-radius: 8px;
}
.last-play-cards .card-mini .card-center { font-size: 56px !important; opacity: 0.12; }
.last-play-cards .card-mini .corner-rank { font-size: 34px !important; }
.last-play-cards .card-mini .corner-suit { font-size: 24px !important; }
.last-play-cards .card-mini .card-corner-top { top: 4px; left: 6px; gap: 2px; }
.last-play-cards .card-mini .card-corner-bottom { bottom: 4px; right: 6px; gap: 2px; }
        gap: 60px;
    }
    .game-actions button {
        width: 54px;
        padding: 8px 0;
        font-size: 14px;
    }
}

/* ===== 顶栏显示时为内容留出空间 ===== */
body.topbar-visible { padding-top: 44px; }

/* ===== 排行榜无缝滚动 ===== */
.marquee-content {
    animation: marquee-scroll 30s linear infinite;
}
@keyframes marquee-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ===== 个人资料弹窗 ===== */
.global-user { cursor: pointer; }
.profile-stat {
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 10px 6px;
    text-align: center;
}
.profile-stat .ps-num {
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
}
.profile-stat .ps-label {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-top: 4px;
}

/* ===== 互动掷骰（3D 骰子） ===== */
.dice-area {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    padding: 4px;
}
.dice3d-scene {
    width: 52px;
    height: 52px;
    perspective: 320px;
}
.dice3d {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 2.6s cubic-bezier(0.15, 0.6, 0.25, 1);
}
.dice3d .face {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    border-radius: 10px;
    border: 1px solid #bbb;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.12);
    display: grid;
    grid-template: repeat(3, 1fr) / repeat(3, 1fr);
    padding: 9px;
    /* 隐藏背面，避免转动时白色贴面闪影 */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.dice3d .face .pip {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1a1a2e;
    place-self: center;
}
.dice3d .face.front  { transform: translateZ(26px); }
.dice3d .face.back   { transform: rotateY(180deg) translateZ(26px); }
.dice3d .face.right  { transform: rotateY(90deg) translateZ(26px); }
.dice3d .face.left   { transform: rotateY(-90deg) translateZ(26px); }
.dice3d .face.top    { transform: rotateX(90deg) translateZ(26px); }
.dice3d .face.bottom { transform: rotateX(-90deg) translateZ(26px); }

.dice-total {
    font-size: 15px;
    font-weight: bold;
    color: #ffd700;
    margin-left: 4px;
    min-width: 40px;
}
.dice-winner-glow .dice3d-scene {
    filter: drop-shadow(0 0 10px #ffd700);
}
#btn-roll-dice {
    padding: 10px 28px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 22px;
    border: none;
    cursor: pointer;
    color: #1a1a2e;
    background: linear-gradient(135deg, #ffd700, #ff9800);
    box-shadow: 0 4px 16px rgba(255,180,0,0.45), inset 0 1px 0 rgba(255,255,255,0.5);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#btn-roll-dice:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,180,0,0.6), inset 0 1px 0 rgba(255,255,255,0.5);
}

/* ===== 全局浮动提示条 ===== */
#global-toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    z-index: 99999;
    background: rgba(20, 30, 25, 0.92);
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    padding: 10px 22px;
    border-radius: 18px;
    border: 1px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    white-space: nowrap;
}
#global-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== 炸弹爆炸动效 ===== */
.played-cards { position: relative; }
.bomb-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 90px;
    line-height: 1;
    pointer-events: none;
    z-index: 60;
    animation: bombBoom 1.1s ease-out forwards;
}
@keyframes bombBoom {
    0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
    25%  { transform: translate(-50%, -50%) scale(1.6); opacity: 1; }
    60%  { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}

/* ===== 结算余牌展示 ===== */
.leftover-list {
    margin: 10px auto 0;
    max-width: 420px;
    max-height: 32vh;
    overflow-y: auto;
    text-align: left;
}
.leftover-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 4px 6px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 13px;
}
.leftover-row:last-child { border-bottom: none; }
.leftover-name {
    flex-shrink: 0;
    width: 64px;
    font-weight: bold;
    color: rgba(255,255,255,0.85);
}
.leftover-done { color: #52c41a; }
.leftover-cards { flex: 1; line-height: 1.9; }
.leftover-card {
    display: inline-block;
    padding: 0 4px;
    margin: 1px 2px;
    border-radius: 4px;
    background: rgba(255,255,255,0.12);
    font-size: 12px;
}
.leftover-card.red { color: #ff7875; }
.leftover-card.black { color: rgba(255,255,255,0.9); }
.leftover-count { color: #ffd700; margin-left: 6px; white-space: nowrap; }
