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

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

/* 星空背景 */
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%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 16px; /* 改为 0，让内部的 header 控制边距 */
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ---------- 顶部 ---------- */
.game-header {
    width: 100%;
    max-width: 100%; /* 去掉 1200px 限制，彻底撑满屏幕 */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    padding: 6px 20px; /* 左右各留 20px 的贴边边距 */
    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;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
    /* 标题和计分板之间的间距 */
    flex-wrap: wrap;
}

/* 对手手牌向上挪动 */
#oppArea {
    margin-top: -25px; /* 往上移，数值越大挪得越高 */
    position: relative;
    z-index: 2;
}

.connection-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 60px;
    padding: 8px 20px;
    border: 1px solid rgba(255, 215, 0, 0.08);
    flex-wrap: wrap;
    justify-content: center;
}

.connection-panel input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 30px;
    padding: 8px 16px;
    color: #d8c8e0;
    font-size: 0.9rem;
    width: 140px;
    outline: none;
    transition: 0.3s;
}

.connection-panel input:focus {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.15);
}

.connection-panel .btn {
    border: none;
    border-radius: 30px;
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #4a7a9c, #2a5a7a);
    color: #fff;
}

.connection-panel .btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(74, 122, 156, 0.4);
}

.connection-panel .btn-create {
    background: linear-gradient(135deg, #ffd700, #f0a500);
    color: #1a0a1e;
}

.connection-panel .btn-create:hover {
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
}

.connection-panel .peer-id-display {
    color: #ffd700;
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    cursor: pointer;
    transition: 0.3s;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.connection-panel .peer-id-display:hover {
    background: rgba(255, 215, 0, 0.1);
}

.scoreboard {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.5);
    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 1 auto;
    width: 100%;
    max-width: 1300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4px 0;
    min-height: 0;
    overflow: visible;
}

.hand-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
    overflow: visible;
    padding: 2px 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;
    flex: 0 1 auto;
    max-width: 100%;
    overflow: visible;
    min-height: 0;
    padding: 4px 80px;
    gap: 16px 20px;
}

/* 对手手牌叠放 */
#oppHand.hand-cards-opp {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    justify-content: flex-start;
    overflow: visible;
    padding: 4px 0;
    min-height: 100px;
}

#oppHand .card-slot:not(:first-child) {
    margin-left: -50px;
    flex-shrink: 0;
}

#oppHand .card-slot:first-child {
    margin-left: 0;
}

/* ---------- 卡牌 ---------- */
.card-slot {
    width: 110px;
    height: 165px;
    perspective: 1200px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    cursor: pointer;
}

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

.card-slot.selected {
    transform: translateY(-20px) scale(1.08);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    border-radius: 16px;
}

.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);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.card-front {
    transform: rotateY(180deg);
    background: linear-gradient(145deg, #1e1028, #2d1a38);
    border: 2px solid rgba(255, 215, 0, 0.25);
    color: #d8c8e0;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
}

.card-front .card-name {
    font-size: 1.1rem;
    color: #ffd700;
    margin-top: 4px;
}

.card-front .card-suit {
    font-size: 2.2rem;
}

.card-front .card-rank {
    font-size: 1.6rem;
    font-weight: 700;
}

.card-front .card-element {
    font-size: 1.8rem;
    opacity: 0.6;
    margin-top: 2px;
}

.card-front .card-sub {
    font-size: 0.7rem;
    opacity: 0.5;
    margin-top: 4px;
}

.card-front.red {
    color: #ff7a7a;
}

.card-front.black {
    color: #d8c8e0;
}

/* ---------- 卡牌 牌背 ---------- */
.card-back {
    background: linear-gradient(145deg, #12081a, #2d1a3d);
    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);
    font-size: 4rem;
    color: #ffd700;
    opacity: 1;
}

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

/* ---------- 牌名标签 ---------- */
.card-name-label {
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    text-align: center;
    color: #ffd700;
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.9;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
    margin: 0 auto;
}

/* ---------- 出牌区 ---------- */
.play-area {
    width: 100%;
    max-width: 1100px;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 30px;
    border: 1px dashed rgba(255, 215, 0, 0.1);
    margin: 8px 0;
    padding: 12px;
    flex-shrink: 0;
}
.play-area .play-label {
    font-size: 0.9rem;
    color: #6a5a7a;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

/* 关键修改：强制不换行，允许水平溢出时出现滚动条（兜底） */
.play-area .play-cards {
    display: flex;
    flex-wrap: nowrap;          /* 绝对不折行！ */
    gap: 6px;                   /* 牌与牌之间的最小间隙 */
    justify-content: center;
    min-height: 80px;
    align-items: center;
    padding: 4px 0;
    overflow-x: auto;           /* 极端情况下（手机）可左右滑动查看 */
    width: 100%;
}

.play-area .play-cards .card-slot {
    width: 90px;                /* 默认宽度（JS 会动态覆盖） */
    height: 135px;
    aspect-ratio: 2 / 3;       /* 保持卡牌比例 */
    cursor: default;
    flex-shrink: 0;             /* 拒绝被压缩 */
}
.play-area .play-cards .card-slot:hover {
    transform: none;
}

.hand-total {
    font-size: 1rem;
    color: #b8a0c0;
    margin-top: 4px;
    letter-spacing: 1px;
}

/* ---------- 底部 ---------- */
.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);
    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-play {
    background: linear-gradient(135deg, #4a7a9c, #2a5a7a);
    color: #fff;
}

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

.btn-pass {
    background: linear-gradient(135deg, #6a5a7a, #4a3a5a);
    color: #fff;
}

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

.btn-reset {
    background: linear-gradient(135deg, #ffd700, #f0a500);
    color: #1a0a1e;
}

.btn-reset: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;
}

.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);
}

/* ---------- 塔罗牌侧栏 ---------- */
#oppTarot,
#myTarot {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    pointer-events: none;
}

#oppTarot {
    left: 12px;
}

#myTarot {
    right: 12px;
}

.tarot-card-mini {
    width: 110px;
    height: 165px;
    border-radius: 12px;
    background: #1a0a2e;
    border: 1px solid rgba(255, 215, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.7);
    text-align: center;
    position: relative;
    transition: transform 0.3s;
    overflow: hidden;
    pointer-events: auto;
}

.tarot-card-mini:hover {
    transform: scale(1.05);
}

.tarot-card-mini img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.tarot-card-mini .tarot-position {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 0.6rem;
    color: #ffd700;
    background: rgba(0, 0, 0, 0.6);
    padding: 1px 8px;
    border-radius: 12px;
    z-index: 2;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.tarot-card-mini .tarot-reverse-indicator,
.tarot-card-mini .tarot-upright-indicator {
    position: absolute;
    bottom: 6px;
    right: 6px;
    font-size: 0.65rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 10px;
    border-radius: 12px;
    z-index: 2;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.tarot-reverse-indicator {
    color: #ff7a7a;
    border: 1px solid rgba(255, 100, 100, 0.4);
}

.tarot-upright-indicator {
    color: #69f0ae;
    border: 1px solid rgba(100, 255, 100, 0.4);
}

.tarot-card-mini.face-down img {
    filter: brightness(0.6);
}

.tarot-column-label {
    color: #ffd700;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.15);
    margin-bottom: 8px;
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 0;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 215, 0, 0.08);
}

/* ---------- 大字模式 ---------- */
body.large-mode .card-name-label {
    font-size: 1.5rem;
    white-space: normal;
    line-height: 1.2;
    padding: 2px 2px;
    max-width: 95%;
}

body.large-mode .tarot-position {
    font-size: 1.6rem;
}

body.large-mode .tarot-reverse-indicator,
body.large-mode .tarot-upright-indicator {
    font-size: 1rem;
}

body.large-mode .tarot-column-label {
    font-size: 1.5rem;
}

.btn-large-font {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999;
    border: none;
    border-radius: 40px;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    background: rgba(255, 215, 0, 0.15);
    backdrop-filter: blur(8px);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.25);
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.btn-large-font:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: scale(1.05);
}

/* ---------- 动画与特效 ---------- */
@keyframes flash-play {
    0% {
        background-color: rgba(74, 122, 156, 0.2);
        border-left-color: #4a7a9c;
    }

    50% {
        background-color: rgba(74, 122, 156, 0.5);
        border-left-color: #69f0ae;
    }

    100% {
        background-color: rgba(0, 0, 0, 0.5);
        border-left-color: #ffd700;
    }
}

@keyframes flash-pass {
    0% {
        background-color: rgba(106, 90, 122, 0.2);
        border-left-color: #6a5a7a;
    }

    50% {
        background-color: rgba(106, 90, 122, 0.5);
        border-left-color: #b8a0c0;
    }

    100% {
        background-color: rgba(0, 0, 0, 0.5);
        border-left-color: #ffd700;
    }
}

.game-message.flash-play {
    animation: flash-play 0.8s ease 2;
}

.game-message.flash-pass {
    animation: flash-pass 0.8s ease 2;
}

@keyframes card-appear {
    0% {
        transform: scale(0.8) translateY(-20px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.play-cards .card-slot {
    animation: card-appear 0.3s ease-out;
}

/* 禁止图片拖动 */
img {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

/* 塔罗组合特效 */
.tarot-card-mini.tarot-combo-active {
    animation: comboPulse 1.8s ease-in-out infinite;
    border-color: #ffd700 !important;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6), 0 0 60px rgba(255, 215, 0, 0.3), inset 0 0 30px rgba(255, 215, 0, 0.1);
    z-index: 5;
    position: relative;
}

.tarot-card-mini.tarot-combo-active::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 14px;
    background: conic-gradient(from 0deg, #ffd700, #ff8c00, #ffd700, #ff8c00, #ffd700);
    background-size: 200% 200%;
    animation: borderRotate 3s linear infinite;
    z-index: -1;
    opacity: 0.8;
    padding: 3px;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

@keyframes comboPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.06);
    }
}

@keyframes borderRotate {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* 发牌动画 */
.card-slot.dealing {
    will-change: transform, opacity;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
    .card-slot {
        width: 95px;
        height: 142px;
    }

    .tarot-card-mini {
        width: 95px;
        height: 142px;
    }

    #oppHand .card-slot:not(:first-child) {
        margin-left: -40px;
    }

    .hand-cards {
        padding: 4px 70px;
        gap: 16px 20px;
    }

    .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;
    }

    .connection-panel input {
        width: 110px;
    }

    #oppTarot {
        left: 8px;
    }

    #myTarot {
        right: 8px;
    }

    .tarot-card-mini .tarot-position {
        font-size: 0.6rem;
        padding: 1px 8px;
    }

    .tarot-card-mini .tarot-reverse-indicator,
    .tarot-card-mini .tarot-upright-indicator {
        font-size: 0.65rem;
        padding: 2px 10px;
    }
}

@media (max-width: 768px) {
    .card-slot {
        width: 80px;
        height: 120px;
    }

    .tarot-card-mini {
        width: 80px;
        height: 120px;
    }

    #oppHand .card-slot:not(:first-child) {
        margin-left: -30px;
    }

    .hand-cards {
        padding: 4px 50px;
        gap: 12px 16px;
    }

    .play-area {
        min-height: 130px;
    }

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

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

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

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

    .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;
    }

    .play-area .play-cards .card-slot {
        width: 70px;
        height: 105px;
    }

    .play-area .play-cards .card-slot.stacked {
        margin-left: -25px; /* 小屏卡牌小，负边距也改小 */
    }

    #oppTarot {
        left: 6px;
    }

    #myTarot {
        right: 6px;
    }

    .tarot-card-mini .tarot-position {
        font-size: 0.5rem;
        padding: 1px 6px;
    }

    .tarot-card-mini .tarot-reverse-indicator,
    .tarot-card-mini .tarot-upright-indicator {
        font-size: 0.5rem;
        padding: 1px 6px;
        bottom: 4px;
        right: 4px;
    }

    .tarot-column-label {
        font-size: 0.9rem;
        margin-bottom: 6px;
        padding: 2px 0;
    }

    body.large-mode .tarot-position {
        font-size: 1.5rem;
    }

    body.large-mode .tarot-reverse-indicator,
    body.large-mode .tarot-upright-indicator {
        font-size: 1.5rem;
    }

    body.large-mode .tarot-column-label {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .card-slot {
        width: 60px;
        height: 90px;
    }

    .tarot-card-mini {
        width: 60px;
        height: 90px;
    }

    #oppHand .card-slot:not(:first-child) {
        margin-left: -20px;
    }

    .hand-cards {
        padding: 4px 30px;
        gap: 8px 12px;
    }

    .play-area {
        min-height: 100px;
        padding: 8px;
    }

    .header-left {
        gap: 12px;
    }

    .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;
    }

    .connection-panel input {
        width: 90px;
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .connection-panel .btn {
        padding: 6px 14px;
        font-size: 0.8rem;
    }

    .play-area .play-cards .card-slot {
        width: 60px;
        height: 90px;
    }

    .play-area .play-cards .card-slot.stacked {
        margin-left: -20px;
    }

    #oppTarot {
        left: 4px;
    }

    #myTarot {
        right: 4px;
    }

    .tarot-card-mini .tarot-position {
        font-size: 0.4rem;
        padding: 1px 4px;
        top: 2px;
        left: 2px;
    }

    .tarot-card-mini .tarot-reverse-indicator,
    .tarot-card-mini .tarot-upright-indicator {
        font-size: 0.4rem;
        padding: 1px 4px;
        bottom: 2px;
        right: 2px;
    }

    .tarot-column-label {
        font-size: 0.7rem;
        margin-bottom: 4px;
        padding: 2px 0;
    }

    body.large-mode .tarot-position {
        font-size: 0.55rem;
    }

    body.large-mode .tarot-reverse-indicator,
    body.large-mode .tarot-upright-indicator {
        font-size: 0.55rem;
    }

    body.large-mode .tarot-column-label {
        font-size: 0.9rem;
    }

    .card-front .card-name {
        font-size: 0.7rem;
    }

    .card-front .card-rank {
        font-size: 1rem;
    }

    .card-front .card-suit {
        font-size: 1.4rem;
    }

    .card-front .card-element {
        font-size: 1.2rem;
    }
}


/* ---------- 塔罗选牌遮罩 ---------- */
.tarot-draft-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(13, 6, 16, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.draft-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    width: 100%;
    max-width: 1100px;
}

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

.draft-message {
    color: #d8c8e0;
    font-size: 1.3rem;
    margin-bottom: 24px;
    text-align: center;
    line-height: 1.6;
}
.draft-message strong {
    color: #ffd700;
}

.draft-cards-container {
    display: flex;
    flex-direction: column;  /* 纵向排列每一行 */
    align-items: center;     /* 整体居中 */
    gap: 16px 20px;          /* 上下行之间的间距 */
    max-width: 600px;
    width: 100%;
    padding: 10px;
    margin: 0 auto;
}

.draft-card-row {
    display: flex;
    justify-content: center; /* 每一行内部居中 */
    gap: 16px 20px;          /* 左右卡牌之间的间距 */
    width: 100%;
}

.draft-card-slot {
    width: 100%;             /* 自适应单元格 */
    max-width: 110px;        /* 单张牌最大宽度 */
    aspect-ratio: 2 / 3;     /* 强制 2:3 比例 */
    perspective: 1200px;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.draft-card-slot:hover:not(.selected) {
    transform: translateY(-6px) scale(1.03);
}

/* 以下保持原来的翻转、背面、选中高亮等 CSS 不变 */
.draft-card-slot .card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
}
.draft-card-slot.flipped .card-inner {
    transform: rotateY(180deg);
}
.draft-card-slot .card-front,
.draft-card-slot .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);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.draft-card-slot .card-front {
    transform: rotateY(180deg);
    background: linear-gradient(145deg, #1e1028, #2d1a38);
    border: 2px solid rgba(255, 215, 0, 0.25);
    color: #d8c8e0;
    font-weight: 600;
    text-align: center;
    font-size: 1.2rem;
}
.draft-card-slot .card-front img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.draft-card-slot .card-back {
    background: linear-gradient(145deg, #12081a, #2d1a3d);
    border: 3px solid rgba(255, 215, 0, 0.3);
    color: #ffd700;
    font-size: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.draft-card-slot .card-back::after {
    content: '✦';
    opacity: 0.2;
    font-size: 3rem;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
}
.draft-card-slot.selected {
    transform: translateY(-10px) scale(1.05);
}
.draft-card-slot.selected .card-front {
    border-color: #ffd700 !important;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}
.draft-position-label {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 0.7rem;
    color: #ffd700;
    background: rgba(0, 0, 0, 0.8);
    padding: 2px 10px;
    border-radius: 12px;
    z-index: 5;
    border: 1px solid rgba(255, 215, 0, 0.4);
    backdrop-filter: blur(4px);
}
.draft-confirm-btn {
    margin-top: 20px;
    font-size: 1.2rem;
    padding: 14px 40px;
}

/* 响应式调整 */
@media (max-width: 1024px) {
    .draft-card-slot { max-width: 95px; }
}
@media (max-width: 768px) {
    .draft-cards-container { gap: 12px; max-width: 450px; }
    .draft-card-row { gap: 12px; }
    .draft-card-slot { max-width: 80px; }
    .draft-title { font-size: 1.8rem; }
    .draft-message { font-size: 1.1rem; }
}
@media (max-width: 480px) {
    .draft-cards-container { gap: 8px; max-width: 300px; }
    .draft-card-row { gap: 8px; }
    .draft-card-slot { max-width: 60px; }
    .draft-title { font-size: 1.4rem; }
    .draft-message { font-size: 0.9rem; }
    .draft-position-label { font-size: 0.5rem; padding: 1px 6px; }
}