/* ---------- 全局重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100vh;
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #0d0610 0%, #1a0a2e 30%, #2d1b3d 60%, #1a0a2e 100%);
    color: #d8c8e0;
    overflow-x: hidden;
}

/* 星空背景（全屏） */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(2px 2px at 20px 30px, #ffd700, transparent),
        radial-gradient(2px 2px at 40px 70px, #ffd700, transparent),
        radial-gradient(2px 2px at 50px 160px, #ffd700, transparent),
        radial-gradient(2px 2px at 90px 40px, #ffd700, transparent),
        radial-gradient(2px 2px at 130px 80px, #ffd700, transparent),
        radial-gradient(2px 2px at 160px 30px, #ffd700, transparent);
    background-size: 200px 200px;
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
}

/* ---------- 游戏容器：全屏沉浸 ---------- */
.game-container {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 20px;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ---------- 顶部：标题 + 计分板 ---------- */
.game-header {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    padding: 6px 0;
    flex-shrink: 0;
}

.game-title {
    color: #ffd700;
    font-size: 2.4rem;
    font-weight: 300;
    letter-spacing: 6px;
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.15);
}

.game-title::before {
    content: '♠ ';
    opacity: 0.5;
}

.game-title::after {
    content: ' ♥';
    opacity: 0.5;
}

.scoreboard {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 60px;
    padding: 8px 24px;
    border: 1px solid rgba(255, 215, 0, 0.08);
    font-size: 1rem;
    color: #b8a0c0;
    flex-wrap: wrap;
    justify-content: center;
}

.scoreboard .score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.scoreboard .score .num {
    font-weight: 700;
    font-size: 1.6rem;
    color: #ffd700;
    min-width: 28px;
    text-align: center;
}

.scoreboard .vs {
    color: #6a5a7a;
    padding: 0 4px;
}

.scoreboard .round-info {
    color: #8a7a9a;
    font-size: 0.85rem;
}

/* ---------- 牌桌区域：中央（弹性占满） ---------- */
.table-area {
    flex: 1;
    width: 100%;
    max-width: 1300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 8px 0;
    min-height: 0;
    /* 防止溢出 */
}

.hand-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 6px 0;
}

.hand-area:first-child {
    margin-bottom: 4px;
}

.hand-area:last-child {
    margin-top: 4px;
}

.hand-label {
    font-size: 1.1rem;
    letter-spacing: 3px;
    color: #b8a0c0;
    opacity: 0.7;
    margin-bottom: 4px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.hand-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 16px 20px;
    min-height: 200px;
    padding: 6px 0;
}

/* ---------- 卡牌尺寸放大 ---------- */
.hand-cards .card-slot {
    width: 150px;
    height: 235px;
    perspective: 1200px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.hand-cards .card-slot:hover {
    transform: translateY(-8px) scale(1.04);
}

.hand-cards .card-label {
    display: none;
}

.hand-cards .card-back img {
    width: 70%;
    height: 70%;
    object-fit: contain;
}

.hand-cards .card-front img {
    object-fit: contain;
    padding: 6px;
}

.hand-total {
    font-size: 1.4rem;
    color: #d8c8e0;
    margin-top: 4px;
    font-weight: 400;
    letter-spacing: 1px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.hand-total .total-num {
    color: #ffd700;
    font-weight: 600;
    font-size: 1.8rem;
    margin: 0 6px;
}

.hand-total .bust {
    color: #ff7a7a;
    font-weight: 700;
    margin-left: 8px;
}

.hand-total .blackjack {
    color: #69f0ae;
    font-weight: 700;
    margin-left: 8px;
}

/* ---------- 消息 & 操作（底部） ---------- */
.game-footer {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    padding-top: 10px;
}

.game-message {
    color: #c8b8d0;
    font-size: 1.2rem;
    padding: 12px 28px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 60px;
    border-left: 4px solid #ffd700;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    max-width: 700px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.game-actions {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.game-actions .btn {
    border: none;
    border-radius: 50px;
    padding: 14px 36px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    min-width: 130px;
}

.btn-hit {
    background: linear-gradient(135deg, #4a7a9c, #2a5a7a);
    color: #fff;
}

.btn-hit:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 40px rgba(74, 122, 156, 0.5);
}

.btn-stand {
    background: linear-gradient(135deg, #9a6a4a, #7a4a2a);
    color: #fff;
}

.btn-stand:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 40px rgba(154, 106, 74, 0.5);
}

.btn-newgame {
    background: linear-gradient(135deg, #ffd700, #f0a500);
    color: #1a0a1e;
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.25);
}

.btn-newgame:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 45px rgba(255, 215, 0, 0.4);
}

.game-actions .btn:disabled {
    opacity: 0.35;
    transform: none !important;
    cursor: not-allowed;
    box-shadow: none !important;
}

/* ---------- 翻转等动画（复用原有） ---------- */
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
}

.card-slot.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), inset 0 0 40px rgba(0, 0, 0, 0.3);
}

.card-front {
    transform: rotateY(180deg);
    background: linear-gradient(145deg, #1e1028, #2d1a38);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: 2px solid rgba(255, 215, 0, 0.25);
}

.card-front img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 12px;
}

.card-front.reversed img {
    transform: rotate(180deg);
}

.card-back {
    background: linear-gradient(145deg, #12081a, #2d1a3d);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), inset 0 0 60px rgba(255, 215, 0, 0.05);
}

.card-back img {
    width: 80%;
    height: 80%;
    object-fit: contain;
    opacity: 0.85;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.1));
}

.card-back::after {
    content: '✦';
    position: absolute;
    font-size: 3rem;
    color: #ffd700;
    opacity: 0.08;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
}

/* 特殊状态 */
@keyframes bustFlash {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(255, 50, 50, 0.2);
    }

    50% {
        box-shadow: 0 0 60px rgba(255, 50, 50, 0.6);
    }
}

.bust-flash .card-slot {
    animation: bustFlash 0.6s ease 3;
}

@keyframes winGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.2));
    }

    50% {
        filter: drop-shadow(0 0 50px rgba(255, 215, 0, 0.6));
    }
}

.win-glow .card-slot {
    animation: winGlow 1.2s ease infinite;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
    .hand-cards .card-slot {
        width: 130px;
        height: 200px;
    }

    .game-title {
        font-size: 2rem;
    }

    .scoreboard {
        font-size: 0.9rem;
        padding: 6px 18px;
        gap: 14px;
    }

    .game-message {
        font-size: 1rem;
        padding: 10px 20px;
        min-height: 48px;
    }

    .game-actions .btn {
        padding: 12px 28px;
        font-size: 1rem;
        min-width: 110px;
    }
}

@media (max-width: 768px) {
    .hand-cards .card-slot {
        width: 110px;
        height: 170px;
    }

    .hand-cards {
        gap: 12px;
    }

    .game-title {
        font-size: 1.6rem;
        letter-spacing: 3px;
    }

    .game-header {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .scoreboard {
        width: 100%;
        justify-content: center;
    }

    .game-message {
        font-size: 0.9rem;
        min-height: 44px;
    }

    .game-actions .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        min-width: 90px;
    }
}

@media (max-width: 480px) {
    .hand-cards .card-slot {
        width: 80px;
        height: 125px;
    }

    .hand-cards {
        gap: 8px;
        min-height: 140px;
    }

    .hand-total {
        font-size: 1rem;
    }

    .hand-total .total-num {
        font-size: 1.3rem;
    }

    .game-message {
        font-size: 0.8rem;
        padding: 8px 14px;
        min-height: 40px;
    }

    .game-actions .btn {
        padding: 8px 16px;
        font-size: 0.8rem;
        min-width: 70px;
    }
}

.btn-rules {
    background: rgba(255, 255, 255, 0.06);
    color: #b8a0c0;
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 50px;
    padding: 14px 28px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    min-width: 110px;
}
.btn-rules:hover {
    background: rgba(255, 215, 0, 0.08);
    color: #fff;
    border-color: rgba(255, 215, 0, 0.3);
    transform: translateY(-4px) scale(1.05);
}