﻿/* Google Fonts: Ma Shan Zheng, ZCOOL KuaiLe, Noto Sans SC */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --table-bg: linear-gradient(135deg, #3a2518 0%, #5c3a28 25%, #6b4430 50%, #5c3a28 75%, #3a2518 100%);
    --table-felt: #5c3a28;
    --tile-bg: linear-gradient(160deg, #ffffff 0%, #faf8f0 20%, #f2edd8 50%, #e8e0c0 85%, #ddd5b0 100%);
    --tile-border: #c5b898;
    --tile-shadow:
        0 4px 2px -1px rgba(0, 0, 0, 0.25),
        0 2px 1px rgba(0, 0, 0, 0.15),
        0 1px 0 rgba(180, 165, 130, 0.8),
        0 6px 8px -2px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 1px 0 0 rgba(255, 255, 255, 0.4),
        inset -1px 0 0 rgba(200, 185, 150, 0.3);
    --tile-hover:
        0 8px 6px -2px rgba(0, 0, 0, 0.3),
        0 4px 2px rgba(0, 0, 0, 0.15),
        0 1px 0 rgba(180, 165, 130, 0.8),
        0 12px 16px -4px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        inset 1px 0 0 rgba(255, 255, 255, 0.5),
        inset -1px 0 0 rgba(200, 185, 150, 0.3);
    --tile-back: linear-gradient(145deg, #1fa06a 0%, #25b878 30%, #1a9460 60%, #158050 100%);
    --tile-back-shadow:
        0 4px 2px -1px rgba(0, 0, 0, 0.25),
        0 1px 0 rgba(10, 80, 50, 0.8),
        0 6px 8px -2px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        inset 1px 0 0 rgba(255, 255, 255, 0.15);
    --gold: #ffd700;
    --gold-glow: 0 0 20px rgba(255, 215, 0, 0.4);
    --btn-hu: linear-gradient(180deg, #d42020 0%, #a01515 100%);
    --btn-gang: linear-gradient(180deg, #d4a020 0%, #a07a10 100%);
    --btn-pong: linear-gradient(180deg, #2080d4 0%, #1560a0 100%);
    --btn-pass: linear-gradient(180deg, #666 0%, #444 100%);
    --panel-bg: rgba(0, 0, 0, 0.45);
    --panel-border: rgba(255, 200, 100, 0.25);
}

/* ========== 鐗屾涓婚 ========== */
/* 缁忓吀绾㈡湪 (榛樿) */

/* 缈＄繝鐜夌煶 */
:root.theme-jade {
    --table-bg: linear-gradient(135deg, #0d3b2e 0%, #1a5c47 25%, #1e6b52 50%, #1a5c47 75%, #0d3b2e 100%);
    --table-felt: #1a5c47;
}

/* 绔瑰腑娓呴 */
:root.theme-bamboo {
    --table-bg: linear-gradient(135deg, #3d3520 0%, #5a4f30 25%, #6b5e38 50%, #5a4f30 75%, #3d3520 100%);
    --table-felt: #5a4f30;
}

/* 鍗堝娣辫摑 */
:root.theme-night {
    --table-bg: linear-gradient(135deg, #0a0e1a 0%, #141e35 25%, #1a2845 50%, #141e35 75%, #0a0e1a 100%);
    --table-felt: #141e35;
}

/* 涓浗绾?*/
:root.theme-red {
    --table-bg: linear-gradient(135deg, #3a0e0e 0%, #5c1a1a 25%, #6b2020 50%, #5c1a1a 75%, #3a0e0e 100%);
    --table-felt: #5c1a1a;
}

/* 涓婚閫夋嫨鍣?*/
.theme-picker-btn {
    -webkit-appearance: none;
    appearance: none;
    position: fixed;
    top: 8px;
    left: 56px;
    z-index: 10000;
    padding: 6px 14px;
    font-size: 14px;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive !important;
    background: linear-gradient(180deg, rgba(92, 58, 40, 0.9), rgba(58, 37, 24, 0.9));
    color: var(--gold);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: none;
}

.theme-picker-btn:hover {
    opacity: 1;
}

/* 房间信息按钮 */
#room-info-btn {
    -webkit-appearance: none;
    appearance: none;
    position: fixed;
    top: 8px;
    left: 170px;
    z-index: 10000;
    padding: 6px 14px;
    font-size: 14px;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive !important;
    background: linear-gradient(180deg, rgba(92, 58, 40, 0.9), rgba(58, 37, 24, 0.9));
    color: var(--gold);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: none;
}

#room-info-btn:hover {
    opacity: 1;
}

.theme-picker-panel {
    position: fixed;
    top: 42px;
    left: 56px;
    z-index: 10001;
    background: rgba(20, 20, 40, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 8px;
    display: none;
    gap: 6px;
    flex-wrap: wrap;
    width: 160px;
    backdrop-filter: blur(10px);
}

.theme-picker-panel.show {
    display: flex;
}

.theme-swatch {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.2s;
    position: relative;
}

.theme-swatch:hover {
    transform: scale(1.15);
}

.theme-swatch.active {
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.theme-swatch::after {
    content: attr(data-label);
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
}

.theme-swatch[data-theme="classic"] {
    background: linear-gradient(135deg, #3a2518, #5c3a28);
}

.theme-swatch[data-theme="jade"] {
    background: linear-gradient(135deg, #0d3b2e, #1a5c47);
}

.theme-swatch[data-theme="bamboo"] {
    background: linear-gradient(135deg, #3d3520, #5a4f30);
}

.theme-swatch[data-theme="night"] {
    background: linear-gradient(135deg, #0a0e1a, #1a2845);
}

.theme-swatch[data-theme="red"] {
    background: linear-gradient(135deg, #3a0e0e, #5c1a1a);
}

/* 骞虫粦涓婚鍒囨崲 */
#game-container {
    transition: background 0.6s ease;
}

html,
body {
    width: 100%;
    height: 100%;
    font-family: 'ZCOOL KuaiLe', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    overflow: hidden;
    background: #1a0e08;
}

/* ===== 娓告垙妗岄潰 ===== */
#game-container {
    width: var(--real-vw, 100vw);
    height: var(--real-vh, 100vh);
    background: var(--table-bg);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#game-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at center, rgba(255, 200, 100, 0.06) 0%, transparent 60%),
        repeating-linear-gradient(90deg, transparent 0px, transparent 60px, rgba(0, 0, 0, 0.03) 60px, rgba(0, 0, 0, 0.03) 61px),
        repeating-linear-gradient(0deg, transparent 0px, transparent 40px, rgba(0, 0, 0, 0.02) 40px, rgba(0, 0, 0, 0.02) 41px);
    pointer-events: none;
}

/* ===== 娓告垙鏉€===== */
#game-board {
    width: 1200px;
    height: 780px;
    position: relative;
    transform-origin: center center;
}

/* ===== 涓ぎ淇℃伅 ===== */
#center-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 140px;
    background: var(--panel-bg);
    border-radius: 12px;
    border: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 5;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#center-info .turn-indicator {
    font-size: 18px;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    margin-bottom: 6px;
    font-family: 'ZCOOL KuaiLe', 'Noto Sans SC', sans-serif;
    text-align: center;
    white-space: pre-line;
}

#center-info .wall-count {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.75);
}

#center-info .wind-display {
    font-size: 10px;
    margin-top: 4px;
    color: rgba(255, 200, 100, 0.7);
    font-family: 'ZCOOL KuaiLe', 'Noto Sans SC', sans-serif;
    text-align: center;
    white-space: pre-line;
}

/* ===== 鏂逛綅鏍囩锛堝ご鍍忛潰鏉匡級 ===== */
.player-label {
    position: absolute;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    background: var(--panel-bg);
    border-radius: 10px;
    border: 1px solid var(--panel-border);
    white-space: nowrap;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.player-label .avatar {
    display: none;
}

.player-label .player-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

#label-east .player-info,
#label-west .player-info {
    align-items: center;
}

.label-name {
    font-size: 13px;
    font-weight: 500;
}

.label-score {
    font-size: 12px;
    color: var(--gold);
    font-weight: 700;
}

.player-label.active {
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.25), 0 2px 10px rgba(0, 0, 0, 0.3);
}

.player-label.active .avatar {
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

#label-south {
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
}

#label-east,
#label-west {
    white-space: normal;
    text-align: center;
    max-width: 75px;
    padding: 5px 8px;
}

#label-east {
    right: -65px;
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
}

#label-north {
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
}

#label-west {
    left: -65px;
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
}

/* ===== 楹诲皢鐗屽熀纭€锛€D绔嬩綋鏁堟灉锛€===== */
.tile {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 58px;
    background: var(--tile-bg);
    border-radius: 6px;
    border: 1px solid var(--tile-border);
    border-top: 1px solid rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid #b0a080;
    box-shadow: var(--tile-shadow);
    cursor: default;
    margin: 0 1px;
    transition: transform 0.15s, box-shadow 0.15s, margin-top 0.15s;
    user-select: none;
    position: relative;
    flex-shrink: 0;
}

/* 椤堕儴鍏夋辰鍙嶅皠 */
.tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.15) 0%,
            rgba(255, 255, 255, 0.05) 40%,
            transparent 100%);
    border-radius: 5px 5px 0 0;
    pointer-events: none;
    z-index: 1;
}

/* 搴曢儴鍘氬害杈圭紭锛堢珛浣撴劅锛€*/
.tile::after {
    content: '';
    position: absolute;
    left: 1px;
    right: 1px;
    bottom: -3px;
    height: 4px;
    background: linear-gradient(180deg, #d8ceb0 0%, #c0b490 50%, #a89870 100%);
    border-radius: 0 0 5px 5px;
    z-index: -1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.tile .tile-top {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', KaiTi, STKaiti, serif;
    position: relative;
    z-index: 1;
}

.tile .tile-bottom {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.1;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', KaiTi, STKaiti, serif;
    position: relative;
    z-index: 1;
}

/* 鑺辫壊棰滆壊 */
.tile.wan .tile-top,
.tile.wan .tile-bottom {
    color: #cc2233;
    font-weight: 900;
    text-shadow: 0.5px 0 0 #cc2233, -0.5px 0 0 #cc2233, 0 0.5px 0 #cc2233, 0 -0.5px 0 #cc2233;
}

.tile.wan .tile-top {
    font-size: 22px;
}

.tile.wan .tile-bottom {
    font-size: 20px;
}

/* 绛掑瓙/鏉″瓙 SVG 鍥炬瀹瑰櫒 */

/* 椋庣墝棰滆壊 */
.tile.feng .tile-bottom {
    color: #2a3d7c;
    font-size: 26px;
    font-weight: 900;
}

/* 绠墝棰滆壊 */
.tile.jian1 .tile-bottom {
    color: #c02030;
    font-size: 26px;
    font-weight: 900;
}

.tile.jian2 .tile-bottom {
    color: #1a8c4e;
    font-size: 26px;
    font-weight: 900;
}

.tile-svg {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    padding: 1px;
    position: relative;
    z-index: 1;
}

.tile-svg svg {
    width: 100%;
    height: 100%;
}

/* 璐村浘妯″紡 */
.tile-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    position: relative;
    z-index: 1;
    padding: 4%;
    box-sizing: border-box;
}

/* ===== 鑺辩墝灞曠ず鍖€===== */
.flower-area {
    position: absolute;
    display: flex;
    gap: 2px;
    z-index: 4;
}

.flower-area .tile {
    width: 40px;
    height: 52px;
    margin: 0;
    cursor: default;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    border: 1px solid #b89adb;
}

.flower-area .tile .tile-top {
    font-size: 14px;
}

.flower-area .tile .tile-bottom {
    font-size: 12px;
}

#flower-south {
    bottom: 155px;
    left: 80px;
}

#flower-north {
    top: 5px;
    left: 200px;
}

#flower-east {
    right: 70px;
    top: 140px;
}

#flower-west {
    left: 70px;
    top: 140px;
}

/* ===== 璁″垎闈㈡澘 ===== */
.score-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 16px 0;
    padding: 12px 20px;
    background: rgba(60, 30, 15, 0.85);
    border-radius: 10px;
    border: 1px solid rgba(255, 200, 100, 0.2);
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
}

/* 璁″垎闈㈡澘 + 绉垎琛ㄥ苟鎺€*/
.tables-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 12px;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 16px;
    width: 90%;
}

.tables-row>* {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: 50% !important;
}

.score-detail .score-row {
    display: flex;
    justify-content: space-between;
}

.score-detail .score-total {
    border-top: 1px solid rgba(255, 200, 100, 0.25);
    padding-top: 6px;
    margin-top: 4px;
    font-size: 20px;
    font-weight: 700;
    color: var(--gold);
}

/* ===== 鐜╁鎵嬬墝 ===== */
/* 鐜╁鍔ㄤ綔娴姩鏂囧瓧 */
.player-action-text {
    position: absolute;
    font-size: 32px;
    font-weight: 900;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', KaiTi, STKaiti, serif;
    white-space: nowrap;
    pointer-events: none;
    z-index: 9000;
    opacity: 1;
    transition: opacity 0.3s, transform 0.3s;
    animation: actionPop 0.4s ease-out;
}

@keyframes actionPop {
    0% {
        opacity: 0;
        filter: blur(8px);
        scale: 0.3;
    }

    60% {
        opacity: 1;
        filter: blur(0);
        scale: 1.2;
    }

    100% {
        scale: 1;
    }
}

#hand-south {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    z-index: 10;
    gap: 2px;
    padding-bottom: 4px;
}

#hand-south .tile {
    width: 52px;
    height: 68px;
    cursor: pointer;
}

#hand-south .tile .tile-top {
    font-size: 18px;
}

#hand-south .tile .tile-bottom {
    font-size: 16px;
}

#hand-south .tile.wan .tile-top {
    font-size: 24px;
}

#hand-south .tile.wan .tile-bottom {
    font-size: 20px;
}

#hand-south .tile.feng .tile-bottom,
#hand-south .tile.jian1 .tile-bottom,
#hand-south .tile.jian2 .tile-bottom,
#hand-south .tile.jian3 .tile-bottom {
    font-size: 26px;
}

#hand-south .tile:hover {
    transform: translateY(-10px);
    box-shadow: var(--tile-hover);
    z-index: 20;
}

#hand-south .tile.selected {
    transform: translateY(-16px);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.5);
    border-color: var(--gold);
}

#hand-south .tile.new-tile {
    margin-left: 12px;
}

/* ===== 瀵规墜鎵嬬墝锛堢墝鑳€3D锛€===== */
.tile-back {
    display: inline-block;
    width: 32px;
    height: 42px;
    background: var(--tile-back);
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(10, 80, 50, 0.6);
    box-shadow: var(--tile-back-shadow);
    margin: 0 1px;
    position: relative;
    flex-shrink: 0;
}

/* 鐗岃儗搴曢儴鍘氬害 */
.tile-back::before {
    content: '';
    position: absolute;
    left: 1px;
    right: 1px;
    bottom: -3px;
    height: 4px;
    background: linear-gradient(180deg, #147050 0%, #0d5a3e 50%, #094530 100%);
    border-radius: 0 0 4px 4px;
    z-index: -1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 鐗岃儗鍐呰竟妗嗚楗€*/
.tile-back::after {
    content: '';
    position: absolute;
    inset: 3px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, transparent 50%, rgba(0, 0, 0, 0.05) 100%);
}

#hand-north {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    z-index: 2;
}

#hand-east {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    z-index: 2;
}

#hand-east .tile-back {
    width: 42px;
    height: 32px;
    margin: 1px 0;
}

#hand-east .tile {
    width: 42px;
    height: 32px;
    min-height: 32px;
    margin: 1px 0;
    font-size: 9px;
    padding: 0;
    border-radius: 3px;
}

#hand-east .tile .tile-top {
    display: none;
}

#hand-east .tile .tile-bottom {
    font-size: 10px;
    line-height: 32px;
}

#hand-east .tile .tile-svg {
    width: 28px;
    height: 24px;
}

#hand-west {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    z-index: 2;
}

#hand-west .tile-back {
    width: 42px;
    height: 32px;
    margin: 1px 0;
}

#hand-west .tile {
    width: 42px;
    height: 32px;
    min-height: 32px;
    margin: 1px 0;
    font-size: 9px;
    padding: 0;
    border-radius: 3px;
}

#hand-west .tile .tile-top {
    display: none;
}

#hand-west .tile .tile-bottom {
    font-size: 10px;
    line-height: 32px;
}

#hand-west .tile .tile-svg {
    width: 28px;
    height: 24px;
}

/* ===== 鍑虹墝鍖€===== */
.discard-area {
    position: absolute;
    display: flex;
    flex-wrap: wrap;
    z-index: 3;
    padding: 4px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
}

.discard-area:empty {
    background: none;
    padding: 0;
}

.discard-area .tile {
    width: 40px;
    height: 52px;
    cursor: default;
    margin: 2px 1px;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(180, 165, 130, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.discard-area .tile .tile-top {
    font-size: 14px;
}

.discard-area .tile .tile-bottom {
    font-size: 12px;
}

.discard-area .tile.feng .tile-bottom,
.discard-area .tile.jian1 .tile-bottom,
.discard-area .tile.jian2 .tile-bottom,
.discard-area .tile.jian3 .tile-bottom {
    font-size: 20px;
}

.discard-area .tile.last-discard {
    border-color: #ff6b6b;
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.6);
}

/* 鍗楋紙鐜╁锛夌殑鍑虹墝锛氫腑蹇冧笅鏂€*/
#discard-south {
    top: calc(50% + 85px);
    left: 50%;
    transform: translateX(-50%);
    max-width: 500px;
    justify-content: center;
}

/* 鍖楋紙瀵瑰锛夌殑鍑虹墝锛氫腑蹇冧笂鏂€*/
#discard-north {
    bottom: calc(50% + 85px);
    left: 50%;
    transform: translateX(-50%);
    max-width: 500px;
    justify-content: center;
}

/* 涓滐紙鍙冲锛夌殑鍑虹墝锛氫腑蹇冨彸渚€*/
#discard-east {
    left: calc(50% + 105px);
    top: 50%;
    transform: translateY(-50%);
    max-width: 320px;
    max-height: 500px;
    justify-content: center;
    align-content: center;
}

/* 瑗匡紙宸﹀锛夌殑鍑虹墝锛氫腑蹇冨乏渚€*/
#discard-west {
    right: calc(50% + 105px);
    top: 50%;
    transform: translateY(-50%);
    max-width: 320px;
    max-height: 500px;
    justify-content: center;
    align-content: center;
}

/* ===== 鍓湶锛堝悆纰版潬锛€===== */
.meld-area {
    position: absolute;
    display: flex;
    gap: 6px;
    z-index: 4;
}

.meld-group {
    display: flex;
    flex-direction: row;
    gap: 1px;
    align-items: flex-end;
}

/* 横放的副露牌（标识来源方向） */
.meld-area .tile.meld-rotated {
    transform: rotate(90deg);
    /* 不改宽高，只用margin补偿旋转后的布局偏移 */
    /* 南北位牌 40×52 旋转后视觉 52×40，margin补差 */
    margin: -6px 6px;
}

/* 2行分排显示（东西位副露：上/下方来的牌） */
.meld-group.meld-split {
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}

.meld-group.meld-split.align-right {
    align-items: flex-end;
}

.meld-row {
    display: flex;
    flex-direction: row;
    gap: 1px;
}

.meld-area .tile {
    width: 40px;
    height: 52px;
    margin: 0;
    cursor: default;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(180, 165, 130, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.meld-area .tile-back {
    width: 40px;
    height: 52px;
    margin: 0;
    border-radius: 4px;
}

.meld-area .tile .tile-top {
    font-size: 14px;
}

.meld-area .tile .tile-bottom {
    font-size: 12px;
}

.meld-area .tile.feng .tile-bottom,
.meld-area .tile.jian1 .tile-bottom,
.meld-area .tile.jian2 .tile-bottom,
.meld-area .tile.jian3 .tile-bottom {
    font-size: 20px;
}

#meld-south {
    bottom: 100px;
    left: 400px;
}

#meld-north {
    top: 68px;
    left: 200px;
    flex-direction: row-reverse;
}

#meld-east {
    right: 70px;
    top: 200px;
    flex-direction: column;
}

#meld-east .tile,
#meld-west .tile {
    width: 30px;
    height: 40px;
}

#meld-east .tile-back,
#meld-west .tile-back {
    width: 30px;
    height: 40px;
}

#meld-east .tile .tile-top,
#meld-west .tile .tile-top {
    font-size: 11px;
}

#meld-east .tile .tile-bottom,
#meld-west .tile .tile-bottom {
    font-size: 10px;
}

#meld-east .tile.meld-rotated,
#meld-west .tile.meld-rotated {
    /* 东西位牌 30×40 旋转后视觉 40×30，margin补差 */
    margin: -5px 5px;
}

#meld-west {
    left: 70px;
    top: 200px;
    flex-direction: column;
}

/* ===== 鎿嶄綔鎸夐挳锛堜功娉曢鏍硷級 ===== */
#action-bar {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 12px;
    z-index: 50;
}

#action-bar.show {
    display: flex;
}

.action-btn {
    padding: 8px 20px;
    font-size: 28px;
    font-weight: 900;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s, box-shadow 0.15s;
    letter-spacing: 4px;
    min-width: 70px;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.action-btn:hover {
    transform: translateY(-2px) scale(1.05);
}

.action-btn:active {
    transform: translateY(0) scale(0.98);
}

.action-btn.btn-hu {
    background: var(--btn-hu);
    box-shadow: 0 4px 15px rgba(200, 30, 30, 0.6), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    animation: pulse-glow 1.5s infinite;
}

.action-btn.btn-kong,
.action-btn.btn-pong {
    background: var(--btn-gang);
    box-shadow: 0 4px 15px rgba(200, 150, 20, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    color: #fff;
}

.action-btn.btn-chi {
    background: var(--btn-pong);
    box-shadow: 0 4px 15px rgba(30, 100, 200, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.action-btn.btn-pass {
    background: var(--btn-pass);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    font-size: 22px;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 4px 15px rgba(200, 30, 30, 0.6), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    }

    50% {
        box-shadow: 0 4px 25px rgba(200, 30, 30, 0.9), 0 0 40px rgba(200, 30, 30, 0.3), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    }
}

/* ===== 寮€濮€缁撴潫瑕嗙洊灞€===== */
:root {
    --mobile-scale: 1;
}

#overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 10, 5, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: calc(var(--real-vh, 100vh) * 0.15);
    z-index: 100;
    backdrop-filter: blur(6px);
    overflow-y: auto;
}

#overlay.home-screen {
    background: linear-gradient(135deg, #3a2518 0%, #5c3a28 50%, #3a2518 100%);
    backdrop-filter: none;
}

/* 鎵嬫満绔鐩栧眰鍐呭缂╂斁 */
.is-mobile #overlay {
    font-size: calc(14px * var(--mobile-scale));
}

.is-mobile #overlay h1 {
    font-size: calc(36px * var(--mobile-scale));
    margin-bottom: calc(4px * var(--mobile-scale));
    letter-spacing: calc(6px * var(--mobile-scale));
}

/* 棣栭〉鐘舵€侊細鏍囬鏀惧ぇ銆佸唴瀹逛笅绉?*/
.is-mobile #overlay.home-screen h1 {
    font-size: 40px !important;
    margin-bottom: 12px !important;
    letter-spacing: 8px !important;
}

.is-mobile #overlay .subtitle {
    font-size: calc(12px * var(--mobile-scale));
    margin-bottom: calc(8px * var(--mobile-scale));
}

.is-mobile #overlay .result-text {
    font-size: calc(14px * var(--mobile-scale));
}

.is-mobile #overlay button:not(.home-btn):not(.overlay-rules-btn) {
    font-size: calc(13px * var(--mobile-scale));
    padding: calc(7px * var(--mobile-scale)) calc(20px * var(--mobile-scale));
}

.is-mobile #overlay .score-detail {
    font-size: calc(11px * var(--mobile-scale));
    padding: calc(5px * var(--mobile-scale)) calc(8px * var(--mobile-scale));
    margin: calc(6px * var(--mobile-scale)) 0;
    gap: 2px;
}

.is-mobile #overlay .score-detail .score-total {
    font-size: calc(14px * var(--mobile-scale));
}

.is-mobile #overlay .tile {
    width: calc(42px * var(--mobile-scale));
    height: calc(56px * var(--mobile-scale));
}

.is-mobile #overlay .tile .tile-top {
    font-size: calc(15px * var(--mobile-scale));
}

.is-mobile #overlay .tile .tile-bottom {
    font-size: calc(14px * var(--mobile-scale));
}

.is-mobile #overlay .tables-row {
    gap: 6px;
    margin-bottom: 6px;
    width: 95%;
}

.is-mobile #overlay .winning-hand {
    margin-bottom: 6px;
}

#overlay.hidden {
    display: none;
}

#overlay h1 {
    font-size: 112px;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive;
    color: var(--gold);
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.6), 0 3px 6px rgba(0, 0, 0, 0.6);
    margin-top: 10px;
    margin-bottom: 8px;
    letter-spacing: 12px;
}

#overlay .subtitle {
    font-size: 16px;
    color: rgba(255, 200, 100, 0.7);
    margin-bottom: 48px;
    letter-spacing: 2px;
}

#overlay .result-text {
    font-size: 36px;
    color: #fff;
    margin-bottom: 30px;
    font-weight: 700;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive;
}

/* 棣栭〉鎸夐挳瀹瑰櫒 */
.home-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    align-items: center;
    min-width: 280px;
}

/* 缁熶竴鎸夐挳鍩虹鏍峰紡 */
.home-btn {
    padding: 10px 40px;
    font-size: 22px;
    font-weight: 400;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive;
    color: #fff;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    letter-spacing: 4px;
    transition: transform 0.15s, box-shadow 0.15s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    width: 100%;
    -webkit-font-smoothing: antialiased;
}

.home-btn:hover {
    transform: translateY(-3px) scale(1.02);
}

/* 閲戣壊鎸夐挳锛堝紑濮嬫父鎴€/ 閲嶆柊寮€濮嬶級 */
.home-btn-gold,
#restart-btn {
    background: linear-gradient(180deg, #c9a742 0%, #8b6914 100%);
    border: 2px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 6px 20px rgba(180, 140, 40, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.home-btn-gold:hover,
#restart-btn:hover {
    box-shadow: 0 8px 30px rgba(180, 140, 40, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* 钃濊壊鎸夐挳锛堣仈鏈哄鎴橈級 */
.home-btn-blue {
    background: linear-gradient(180deg, #2a6fd4 0%, #1550a0 100%);
    border: 2px solid rgba(100, 160, 255, 0.4);
    box-shadow: 0 6px 20px rgba(26, 80, 160, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.home-btn-blue:hover {
    box-shadow: 0 8px 30px rgba(26, 80, 160, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* 閲嶆柊寮€濮嬫寜閽部鐢€home-btn 灏哄 */
#restart-btn {
    padding: 14px 40px;
    font-size: 22px;
    font-weight: 700;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive;
    letter-spacing: 4px;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* 棣栭〉搴曢儴鏂囧瓧 */
.home-footer {
    margin-top: 40px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 2px;
}

/* ===== 鎵嬫満棣栭〉閫傞厤 ===== */
.is-mobile #overlay h1 {
    font-size: 32px;
    letter-spacing: 6px;
    margin-bottom: 6px;
}

.is-mobile #overlay.home-screen h1 {
    font-size: 40px;
    letter-spacing: 8px;
    margin-bottom: 12px;
}

.is-mobile #overlay .subtitle {
    font-size: 11px;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.is-mobile .home-buttons {
    flex-direction: column;
    gap: 10px;
    width: 70%;
    max-width: 260px;
}

.is-mobile #overlay .home-btn {
    font-size: 18px;
    padding: 24px 20px;
    letter-spacing: 4px;
    border-radius: 12px;
    width: 100%;
}

.is-mobile .home-footer {
    margin-top: 16px;
    font-size: 11px;
}

.is-mobile #overlay .overlay-rules-btn {
    font-size: 12px;
    padding: 4px 10px;
    top: 10px;
    right: 10px;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive;
}


/* ===== 鎵嬫満妯睆缁撶畻椤典紭鍖栵紙鐢╟lass閫夋嫨鍣ㄤ唬鏇縨edia query锛岀‘淇濇棆杞悗涔熺敓鏁堬級 ===== */
#landscape-wrapper.force-landscape .is-mobile #overlay,
.is-mobile #landscape-wrapper.force-landscape #overlay {
    gap: 0px;
    padding: 12px 8px 2px 8px;
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 棣栭〉鐘舵€侊細灞呬腑鏄剧ず鎵€鏈夊唴瀹?*/
#landscape-wrapper.force-landscape .is-mobile #overlay.home-screen,
.is-mobile #landscape-wrapper.force-landscape #overlay.home-screen {
    justify-content: center !important;
    align-items: center !important;
    padding: 8px 16px !important;
    gap: 4px !important;
    overflow-y: auto;
}

#landscape-wrapper.force-landscape .is-mobile #overlay.home-screen h1,
.is-mobile #landscape-wrapper.force-landscape #overlay.home-screen h1 {
    font-size: 32px !important;
    margin-bottom: 2px !important;
    letter-spacing: 6px !important;
}

#landscape-wrapper.force-landscape .is-mobile #overlay.home-screen .subtitle,
.is-mobile #landscape-wrapper.force-landscape #overlay.home-screen .subtitle {
    font-size: 11px !important;
    margin-bottom: 8px !important;
}

#landscape-wrapper.force-landscape .is-mobile #overlay.home-screen .home-buttons,
.is-mobile #landscape-wrapper.force-landscape #overlay.home-screen .home-buttons {
    gap: 6px !important;
    width: 55% !important;
    max-width: 300px !important;
}

#landscape-wrapper.force-landscape .is-mobile #overlay.home-screen .home-btn,
.is-mobile #landscape-wrapper.force-landscape #overlay.home-screen .home-btn {
    padding: 10px 16px !important;
    font-size: 18px !important;
}

#landscape-wrapper.force-landscape .is-mobile #overlay.home-screen .home-sub-buttons,
.is-mobile #landscape-wrapper.force-landscape #overlay.home-screen .home-sub-buttons {
    margin-top: 4px !important;
    gap: 8px !important;
}

#landscape-wrapper.force-landscape .is-mobile #overlay.home-screen .home-sub-btn,
.is-mobile #landscape-wrapper.force-landscape #overlay.home-screen .home-sub-btn {
    padding: 4px 12px !important;
    font-size: 12px !important;
}

#landscape-wrapper.force-landscape .is-mobile #overlay.home-screen .difficulty-selector,
.is-mobile #landscape-wrapper.force-landscape #overlay.home-screen .difficulty-selector {
    margin-top: 4px !important;
}

#landscape-wrapper.force-landscape .is-mobile #overlay.home-screen .home-footer,
.is-mobile #landscape-wrapper.force-landscape #overlay.home-screen .home-footer {
    margin-top: 6px !important;
    font-size: 10px !important;
}

/* 缁撶畻椤垫爣棰樺帇缂?*/
.is-mobile #overlay:not(.home-screen) h1 {
    font-size: 20px !important;
    margin-bottom: 8px !important;
    letter-spacing: 2px;
}

.is-mobile #overlay .result-text {
    font-size: 9px !important;
    margin-bottom: 1px !important;
}

/* 楹诲皢鐗?鈥斺€?閫備腑澶у皬 */
.is-mobile #overlay .tile {
    width: 35px !important;
    height: 46px !important;
}

.is-mobile #overlay .tile .tile-top {
    font-size: 14px !important;
}

.is-mobile #overlay .tile .tile-bottom {
    font-size: 13px !important;
}

/* SVG鍥炬鏀惧ぇ锛屽～婊＄墝闈?*/
.is-mobile #overlay .tile .tile-svg {
    transform: scale(1.4);
    transform-origin: center center;
}

.is-mobile #overlay .tile .tile-svg svg {
    width: 28px !important;
    height: 28px !important;
}

/* 琛ㄦ牸/闈㈡澘瀛椾綋缁熶竴寰蒋闆呴粦锛坔1/result-text淇濈暀鑹烘湳瀛椾綋锛?*/
.is-mobile #overlay div,
.is-mobile #overlay span {
    font-family: 'Microsoft YaHei', '寰蒋闆呴粦', 'PingFang SC', 'Noto Sans SC', sans-serif !important;
}

.is-mobile #overlay button:not(#restart-btn) {
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive !important;
}

.is-mobile #overlay .score-detail {
    font-size: 12px !important;
    padding: 4px 8px !important;
    margin: 0 !important;
    gap: 1px;
}

.is-mobile #overlay .score-detail .score-total {
    font-size: 14px !important;
}

/* 鎵嬬墝鍖哄煙闂磋窛鍘嬬缉 */
.is-mobile #overlay>div[style*="flex"] {
    margin-bottom: 2px !important;
}

/* 缁х画涓嬩竴灞€ / 鏂颁竴閿?鎸夐挳 鈥斺€?寮哄埗瑕嗙洊锛屼笌棣栭〉鎸夐挳涓€鑷?*/
.is-mobile #overlay #restart-btn {
    padding: 8px 28px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive !important;
    color: #fff !important;
    letter-spacing: 3px !important;
    border: 2px solid rgba(255, 215, 0, 0.4) !important;
    border-radius: 10px !important;
    background: linear-gradient(180deg, #c9a742 0%, #8b6914 100%) !important;
    box-shadow: 0 3px 12px rgba(180, 140, 40, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4) !important;
    cursor: pointer !important;
    transition: transform 0.15s, box-shadow 0.15s;
    margin-top: 2px !important;
}

.is-mobile #overlay #restart-btn:active {
    transform: scale(0.96) !important;
}

/* ===== 鍚冪墝閫夋嫨寮圭獥 ===== */
#chi-select {
    position: absolute;
    bottom: 170px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(40, 20, 10, 0.9);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 16px;
    display: none;
    flex-direction: column;
    gap: 10px;
    z-index: 55;
    backdrop-filter: blur(8px);
}

#chi-select.show {
    display: flex;
}

#chi-select .chi-title {
    color: var(--gold);
    font-size: 14px;
    text-align: center;
    margin-bottom: 4px;
}

.chi-option {
    display: flex;
    gap: 4px;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.chi-option:hover {
    background: rgba(255, 200, 100, 0.15);
}

.chi-option .tile {
    width: 36px;
    height: 48px;
    cursor: pointer;
}

/* ===== 娑堟伅鎻愮ず ===== */
#message {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 42px;
    font-weight: 900;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.7), 0 3px 6px rgba(0, 0, 0, 0.6);
    z-index: 60;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    letter-spacing: 6px;
}

#message.show {
    opacity: 1;
}

/* ========== 鎵嬫満绔竷灞€ (900x500 璁捐) ========== */

/* 鍩虹 touch 浼樺寲 */
@media (pointer: coarse) {

    html,
    body {
        touch-action: manipulation;
        overflow: hidden;
        -webkit-tap-highlight-color: transparent;
    }
}

/* 鎵嬫満绔鐩栧眰 - 瑙﹀睆璁惧 */
@media (pointer: coarse) {
    #overlay {
        padding: 10px 8px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 缁撶畻椤垫爣棰樼缉灏忥紝棣栭〉鏍囬淇濇寔澶у彿 */
    #overlay:not(.home-screen) h1 {
        font-size: 14px;
        margin-bottom: 4px;
    }

    #overlay .subtitle {
        font-size: 8px;
    }

    #overlay .result-text {
        font-size: 9px;
    }

    .score-detail {
        font-size: 9px;
        padding: 5px 8px;
        min-width: auto;
        width: auto;
        max-width: none;
        margin: 6px 0;
        gap: 2px;
    }

    .score-detail .score-total {
        font-size: 11px;
        padding-top: 3px;
        margin-top: 2px;
    }

    .score-detail .score-row {
        font-size: 9px;
    }

    #start-btn,
    #restart-btn {
        padding: 6px 18px;
        font-size: 13px;
    }

    /* 鑱婂ぉ */
    #chat-panel {
        bottom: 4px;
        right: 4px;
    }

    #chat-toggle,
    #voice-toggle,
    #voice-mute {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    #chat-box {
        width: 90px;
        max-height: 15px;
    }

    #chat-messages {
        max-height: 20px;
        font-size: 7px;
        padding: 2px;
    }

    #chat-quick button {
        font-size: 6px;
        padding: 1px 2px;
    }

    #chat-input {
        font-size: 8px;
        padding: 2px 4px;
    }

    #fullscreen-btn {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
}

/* ===== 娓告垙鏉垮唴鎵嬫満甯冨眬 ===== */
#game-board.mobile {
    width: 900px;
    height: 500px;
}

/* 涓ぎ淇℃伅 */
#game-board.mobile #center-info {
    width: 130px;
    height: 95px;
    border-radius: 8px;
}

#game-board.mobile #center-info .turn-indicator {
    font-size: 14px;
    margin-bottom: 1px;
    font-family: 'ZCOOL KuaiLe', 'Noto Sans SC', sans-serif;
    text-align: center;
    white-space: pre-line;
}

#game-board.mobile #center-info .wall-count {
    font-size: 10px;
}

#game-board.mobile #center-info .wind-display {
    font-size: 9px;
    margin-top: 1px;
    text-align: center;
    white-space: pre-line;
}

/* 鏂逛綅鏍囩 */
#game-board.mobile .player-label {
    font-size: 10px;
    padding: 4px 8px;
    gap: 4px;
    border-radius: 8px;
}

#game-board.mobile .player-label .avatar {
    width: 24px;
    height: 24px;
    font-size: 12px;
    border-width: 1px;
}

#game-board.mobile .label-name {
    font-size: 10px;
}

#game-board.mobile .label-score {
    font-size: 9px;
}

#game-board.mobile #label-south {
    bottom: 3px;
    left: 55px;
    right: auto;
    transform: none;
    z-index: 6;
}

#game-board.mobile #label-north {
    top: 10px;
    right: 130px;
    left: auto;
    transform: none;
}

#game-board.mobile #label-east {
    right: 5px;
    bottom: 8px;
    top: auto;
    transform: none;
}

#game-board.mobile #label-west {
    left: 5px;
    bottom: 8px;
    top: auto;
    transform: none;
}

/* 鎵嬫満妯睆鏍囩璐磋竟 */
@media (orientation: landscape) {
    #game-board.mobile #label-north {
        top: -38px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    #game-board.mobile #label-south {
        bottom: -38px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    #game-board.mobile #label-west {
        left: -66px;
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
    }

    #game-board.mobile #label-east {
        right: -66px;
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
    }
}

/* ===== 鐗€- 鎵嬫満鍩虹灏哄 ===== */
#game-board.mobile .tile {
    width: 30px;
    height: 40px;
    border-radius: 3px;
    margin: 0;
}

#game-board.mobile .tile .tile-top {
    font-size: 11px;
}

#game-board.mobile .tile .tile-bottom {
    font-size: 10px;
}

/* ===== 鐜╁鎵嬬墝 ===== */
#game-board.mobile #hand-south {
    bottom: 6px;
    gap: 1px;
}

#game-board.mobile #hand-south .tile {
    width: 38px;
    height: 50px;
    cursor: pointer;
}

#game-board.mobile #hand-south .tile .tile-top {
    font-size: 14px;
}

#game-board.mobile #hand-south .tile .tile-bottom {
    font-size: 12px;
}

#game-board.mobile #hand-south .tile.feng .tile-bottom,
#game-board.mobile #hand-south .tile.jian1 .tile-bottom,
#game-board.mobile #hand-south .tile.jian2 .tile-bottom,
#game-board.mobile #hand-south .tile.jian3 .tile-bottom {
    font-size: 18px;
}

#game-board.mobile #hand-south .tile:hover {
    transform: none;
}

#game-board.mobile #hand-south .tile.selected {
    transform: translateY(-10px);
}

#game-board.mobile #hand-south .tile.new-tile {
    margin-left: 6px;
}

/* ===== 瀵规墜鐗岃儗 ===== */
#game-board.mobile .tile-back {
    width: 24px;
    height: 32px;
    border-radius: 3px;
    margin: 0 0.5px;
}

#game-board.mobile #hand-north {
    top: 6px;
}

#game-board.mobile #hand-east {
    right: 6px;
}

#game-board.mobile #hand-east .tile-back {
    width: 32px;
    height: 24px;
    margin: 0.5px 0;
}

#game-board.mobile #hand-west {
    left: 6px;
}

#game-board.mobile #hand-west .tile-back {
    width: 32px;
    height: 24px;
    margin: 0.5px 0;
}

/* ===== 鍑虹墝鍖€===== */
#game-board.mobile .discard-area {
    padding: 2px;
    border-radius: 4px;
}

#game-board.mobile .discard-area .tile {
    width: 26px;
    height: 34px;
    margin: 0.5px;
    border-radius: 2px;
}

#game-board.mobile .discard-area .tile .tile-top {
    font-size: 9px;
}

#game-board.mobile .discard-area .tile .tile-bottom {
    font-size: 8px;
}

#game-board.mobile .discard-area .tile.feng .tile-bottom,
#game-board.mobile .discard-area .tile.jian1 .tile-bottom,
#game-board.mobile .discard-area .tile.jian2 .tile-bottom,
#game-board.mobile .discard-area .tile.jian3 .tile-bottom {
    font-size: 12px;
}

#game-board.mobile #discard-south {
    top: calc(50% + 55px);
    max-width: 380px;
}

#game-board.mobile #discard-north {
    bottom: calc(50% + 55px);
    max-width: 380px;
}

#game-board.mobile #discard-east {
    left: calc(50% + 75px);
    max-width: 200px;
    max-height: 300px;
}

#game-board.mobile #discard-west {
    right: calc(50% + 75px);
    max-width: 200px;
    max-height: 300px;
}

/* ===== 鍓湶鍖€===== */
#game-board.mobile .meld-area {
    gap: 3px;
}

#game-board.mobile .meld-area .tile {
    width: 26px;
    height: 34px;
}

#game-board.mobile .meld-area .tile .tile-top {
    font-size: 9px;
}

#game-board.mobile .meld-area .tile .tile-bottom {
    font-size: 8px;
}

#game-board.mobile .meld-area .tile.meld-rotated {
    margin: -4px 4px;
}

#game-board.mobile #meld-south {
    bottom: 62px;
    left: 250px;
}

#game-board.mobile #meld-north {
    top: 42px;
    left: 120px;
}

#game-board.mobile #meld-east {
    right: 44px;
    top: 120px;
    flex-direction: column;
}

#game-board.mobile #meld-west {
    left: 44px;
    top: 120px;
    flex-direction: column;
}

/* ===== 鑺辩墝鍖€===== */
#game-board.mobile .flower-area .tile {
    width: 22px;
    height: 28px;
}

#game-board.mobile .flower-area .tile .tile-top {
    font-size: 8px;
}

#game-board.mobile .flower-area .tile .tile-bottom {
    font-size: 7px;
}

#game-board.mobile #flower-south {
    bottom: 62px;
    left: 120px;
}

#game-board.mobile #flower-north {
    top: 4px;
    left: 120px;
}

#game-board.mobile #flower-east {
    right: 44px;
    top: 85px;
}

#game-board.mobile #flower-west {
    left: 44px;
    top: 85px;
}

/* ===== 鎿嶄綔鎸夐挳 ===== */
#game-board.mobile #action-bar {
    bottom: 60px;
    gap: 6px;
}

#game-board.mobile #action-bar button,
#game-board.mobile .action-btn {
    padding: 5px 12px;
    font-size: 18px;
    min-width: 44px;
    border-radius: 8px;
}

/* ===== 娑堟伅 ===== */
#game-board.mobile #message {
    font-size: 22px;
}

/* ===== 瑙勫垯鎸夐挳 ===== */
.is-mobile #rules-btn {
    position: fixed;
    padding: 3px 8px;
    font-size: 12px;
    right: 90px;
    top: 4px;
    z-index: 10000;
}

/* ===== 鍚冪閫夋嫨 ===== */
#game-board.mobile #chi-select {
    bottom: 80px;
    padding: 8px;
}

#game-board.mobile .chi-option .tile {
    width: 28px;
    height: 36px;
}








/* ========== 规则按钮和弹窗 ========== */
#rules-btn {
    -webkit-appearance: none;
    appearance: none;
    position: fixed;
    top: 8px;
    right: 170px;
    z-index: 10000;
    padding: 6px 14px;
    font-size: 14px;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive !important;
    background: linear-gradient(180deg, rgba(92, 58, 40, 0.9), rgba(58, 37, 24, 0.9));
    color: var(--gold);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#fullscreen-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1000;
    padding: 8px 12px;
    font-size: 18px;
    background: rgba(30, 30, 60, 0.85);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

#fullscreen-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

#rules-btn:hover {
    opacity: 1;
}

#rotation-guide-btn {
    -webkit-appearance: none;
    appearance: none;
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 10000;
    padding: 6px 14px;
    font-size: 14px;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive !important;
    background: linear-gradient(180deg, rgba(92, 58, 40, 0.9), rgba(58, 37, 24, 0.9));
    color: var(--gold);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#rotation-guide-btn:hover {
    opacity: 1;
}

.is-mobile #rotation-guide-btn {
    position: fixed;
    padding: 3px 8px;
    font-size: 12px;
    right: 16px;
    top: 4px;
    z-index: 10000;
}

#back-home-btn {
    -webkit-appearance: none;
    appearance: none;
    position: fixed;
    top: 8px;
    right: 250px;
    z-index: 10000;
    padding: 6px 14px;
    font-size: 14px;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive !important;
    background: linear-gradient(180deg, rgba(92, 58, 40, 0.9), rgba(58, 37, 24, 0.9));
    color: var(--gold);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: none;
}

#back-home-btn:hover {
    opacity: 1;
}

#bgm-btn {
    -webkit-appearance: none;
    appearance: none;
    position: fixed;
    top: 8px;
    right: 90px;
    z-index: 10000;
    padding: 6px 14px;
    font-size: 14px;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive !important;
    background: linear-gradient(180deg, rgba(92, 58, 40, 0.9), rgba(58, 37, 24, 0.9));
    color: var(--gold);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#bgm-btn:hover {
    opacity: 1;
}

#game-board.mobile #back-home-btn,
.is-mobile #back-home-btn {
    position: fixed;
    padding: 3px 8px;
    font-size: 12px;
    right: 90px;
    top: 36px;
    z-index: 10000;
}

.is-mobile #bgm-btn {
    padding: 3px 8px;
    font-size: 12px;
    right: 15px;
    top: 36px;
}

.is-mobile .theme-picker-btn,
#game-board.mobile .theme-picker-btn {
    position: fixed;
    padding: 3px 8px;
    font-size: 12px;
    left: 55px;
    top: 4px;
    z-index: 10000;
}

.is-mobile #room-info-btn,
#game-board.mobile #room-info-btn {
    position: fixed;
    padding: 3px 8px;
    font-size: 12px;
    left: 156px;
    top: 4px;
    z-index: 10000;
}

.is-mobile .theme-picker-panel,
#game-board.mobile .theme-picker-panel {
    position: fixed;
    top: 30px;
    left: 50px;
    z-index: 10001;
}

.rules-content {
    background: linear-gradient(135deg, #2a1a10 0%, #3a2518 50%, #2a1a10 100%);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: calc(var(--real-vh, 100vh) * 0.85);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.rules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.rules-header h2 {
    color: var(--gold);
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive;
    font-size: 24px;
    margin: 0;
}

.rules-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.rules-close:hover {
    color: #ff5252;
    background: rgba(255, 82, 82, 0.1);
}

.rules-body {
    padding: 16px 20px;
    overflow-y: auto;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.5;
}

.rules-body h3 {
    color: var(--gold);
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive;
    font-size: 20px;
    margin: 16px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
}

.rules-body h3:first-child {
    margin-top: 0;
}

.rules-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
}

.rules-body th {
    background: rgba(255, 215, 0, 0.12);
    color: var(--gold);
    text-align: left;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
}

.rules-body td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 13px;
}

.rules-body td:first-child {
    white-space: nowrap;
    font-weight: 600;
    color: rgba(255, 215, 0, 0.85);
    width: 80px;
}

.rules-body tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

.rules-body b {
    color: #ff7043;
}

@media (max-width: 600px) {
    .rules-content {
        max-height: calc(var(--real-vh, 100vh) * 0.9);
        border-radius: 12px;
    }

    .rules-body {
        padding: 12px 14px;
        font-size: 13px;
    }

    .rules-body td {
        padding: 4px 8px;
        font-size: 12px;
    }

    .rules-header h2 {
        font-size: 20px;
    }
}

/* ===== 鑱婂ぉ闈㈡澘 ===== */
#chat-panel {
    position: fixed;
    bottom: 12px;
    right: 12px;
    z-index: 99999;
}

#chat-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(30, 30, 60, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: auto;
    transition: transform 0.2s, box-shadow 0.2s;
}

#chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

#chat-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

#voice-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(30, 30, 60, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
}

#voice-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.4);
}

#voice-mute {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(239, 83, 80, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

#voice-mute:hover {
    transform: scale(1.1);
}

#chat-toggle.chat-notify {
    animation: chatPulse 0.5s ease-in-out 3;
}

@keyframes chatPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: none;
    }

    50% {
        transform: scale(1.2);
        box-shadow: 0 0 16px rgba(255, 215, 0, 0.6);
    }
}

#chat-box {
    display: flex;
    flex-direction: column;
    width: 320px;
    max-height: 420px;
    background: rgba(20, 20, 50, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    backdrop-filter: blur(12px);
    margin-bottom: 8px;
    overflow: hidden;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    max-height: 260px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-bubble {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 13px;
    color: #eee;
    max-width: 90%;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
}

.chat-bubble.chat-me {
    align-self: flex-end;
    background: rgba(255, 215, 0, 0.12);
}

#chat-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#chat-quick button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ddd;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

#chat-quick button:hover {
    background: rgba(255, 255, 255, 0.2);
}

#chat-input-row {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#chat-input {
    flex: 1;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 13px;
    outline: none;
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

#chat-input-row button {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    background: var(--gold);
    color: #1a1a2e;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== 妯睆鎵嬫満锛氳亰澶╃獥鍙ｇ缉灏€===== */
@media (max-height: 500px) {
    #chat-box {
        width: 180px;
        max-height: 720px;
        margin-bottom: 4px;
    }

    #chat-messages {
        max-height: 120px;
        font-size: 10px;
        padding: 4px;
    }

    #chat-quick button {
        font-size: 9px;
        padding: 2px 4px;
    }

    #chat-input {
        font-size: 9px;
        padding: 1px 4px;
        height: 18px;
    }

    #chat-toggle,
    #voice-toggle,
    #voice-mute {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    #chat-panel {
        bottom: 2px;
        right: 2px;
    }
}

/* ========== 鑳＄墝杩囧満鍔ㄧ敾 ========== */
#win-animation-overlay {
    position: absolute;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.85) 100%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

#win-animation-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.win-text-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.win-big-char {
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', serif;
    font-size: clamp(100px, calc(var(--real-vw, 100vw) * 0.25), 200px);
    font-weight: 900;
    color: #ffd700;
    text-shadow:
        0 0 20px rgba(255, 215, 0, 0.8),
        0 0 40px rgba(255, 165, 0, 0.6),
        0 0 80px rgba(255, 69, 0, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.5);
    transform: scale(0);
    animation: winCharZoom 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    letter-spacing: 8px;
}

.win-sub-text {
    font-family: 'Noto Sans SC', sans-serif;
    font-size: clamp(16px, calc(var(--real-vw, 100vw) * 0.04), 28px);
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    opacity: 0;
    animation: winSubFade 0.5s 0.4s ease-out forwards;
}

.win-glow-ring {
    position: absolute;
    width: clamp(200px, calc(var(--real-vw, 100vw) * 0.5), 400px);
    height: clamp(200px, calc(var(--real-vw, 100vw) * 0.5), 400px);
    border-radius: 50%;
    border: 3px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 60px rgba(255, 215, 0, 0.2), inset 0 0 60px rgba(255, 215, 0, 0.1);
    transform: scale(0);
    animation: ringExpand 0.8s 0.1s ease-out forwards;
}

.win-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffd700;
    box-shadow: 0 0 6px #ffd700;
    animation: particleBurst 1.2s ease-out forwards;
}

@keyframes winCharZoom {
    0% {
        transform: scale(0) rotate(-10deg);
        opacity: 0;
    }

    60% {
        transform: scale(1.15) rotate(2deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes winSubFade {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes ringExpand {
    0% {
        transform: scale(0);
        opacity: 1;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes particleBurst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(var(--px), var(--py)) scale(0);
        opacity: 0;
    }
}

/* ===== 鑱婂ぉ闈㈡澘 ===== */
#chat-panel {
    position: fixed;
    bottom: 12px;
    right: 12px;
    z-index: 99999;
}

#chat-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(30, 30, 60, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: auto;
    transition: transform 0.2s, box-shadow 0.2s;
}

#chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

#chat-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

#voice-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(30, 30, 60, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
}

#voice-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.4);
}

#voice-mute {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(239, 83, 80, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

#voice-mute:hover {
    transform: scale(1.1);
}

#chat-toggle.chat-notify {
    animation: chatPulse 0.5s ease-in-out 3;
}

@keyframes chatPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: none;
    }

    50% {
        transform: scale(1.2);
        box-shadow: 0 0 16px rgba(255, 215, 0, 0.6);
    }
}

#chat-box {
    display: flex;
    flex-direction: column;
    width: 320px;
    max-height: 420px;
    background: rgba(20, 20, 50, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    backdrop-filter: blur(12px);
    margin-bottom: 8px;
    overflow: hidden;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    max-height: 260px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-bubble {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 13px;
    color: #eee;
    max-width: 90%;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
}

.chat-bubble.chat-me {
    align-self: flex-end;
    background: rgba(255, 215, 0, 0.12);
}

#chat-quick {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#emoji-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.emoji-tab {
    flex: 1;
    padding: 5px 4px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.emoji-tab:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.emoji-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.emoji-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
}

.emoji-grid button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ddd;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.emoji-grid button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* 鐗屾娴姩琛ㄦ儏姘旀场 */
.emoji-float {
    position: absolute;
    font-size: 40px;
    pointer-events: none;
    z-index: 9500;
    animation: emojiFloat 2s ease-out forwards;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

@keyframes emojiFloat {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(10px);
    }

    15% {
        opacity: 1;
        transform: scale(1.2) translateY(0);
    }

    30% {
        transform: scale(1) translateY(0);
    }

    80% {
        opacity: 1;
        transform: scale(1) translateY(-20px);
    }

    100% {
        opacity: 0;
        transform: scale(0.8) translateY(-40px);
    }
}

#chat-input-row {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#chat-input {
    flex: 1;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 13px;
    outline: none;
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

#chat-input-row button {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    background: var(--gold);
    color: #1a1a2e;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== 妯睆鎵嬫満锛氳亰澶╃獥鍙ｇ缉灏?===== */
@media (max-height: 500px) {
    #chat-box {
        width: 180px;
        max-height: 720px;
        margin-bottom: 4px;
    }

    #chat-messages {
        max-height: 120px;
        font-size: 10px;
        padding: 4px;
    }

    .emoji-tab {
        font-size: 9px;
        padding: 3px 2px;
    }

    .emoji-grid button {
        font-size: 9px;
        padding: 2px 4px;
    }

    #chat-input {
        font-size: 9px;
        padding: 1px 4px;
        height: 18px;
    }

    #chat-toggle,
    #voice-toggle,
    #voice-mute {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    #chat-panel {
        bottom: 2px;
        right: 2px;
    }
}

/* ===== 鎵嬫満鍏ㄥ睆鍏ュ彛 ===== */
#mobile-entry {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 99999;
    background: linear-gradient(135deg, #3a2518 0%, #5c3a28 50%, #3a2518 100%);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.mobile-entry-content {
    text-align: center;
    color: #fff;
}

.mobile-entry-icon {
    font-size: 72px;
    margin-bottom: 16px;
    animation: entryPulse 2s ease-in-out infinite;
}

.mobile-entry-content h1 {
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive;
    font-size: 36px;
    color: var(--gold);
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.6), 0 3px 6px rgba(0, 0, 0, 0.6);
    margin-bottom: 8px;
    letter-spacing: 8px;
}

.mobile-entry-sub {
    font-size: 14px;
    color: rgba(255, 200, 100, 0.7);
    margin-bottom: 28px;
    letter-spacing: 2px;
    font-family: 'Noto Sans SC', sans-serif;
}

#mobile-enter-btn {
    background: linear-gradient(180deg, #e8a820 0%, #c08010 100%);
    color: #fff;
    border: none;
    padding: 14px 48px;
    font-size: 20px;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(200, 150, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    letter-spacing: 4px;
    transition: transform 0.15s;
}

#mobile-enter-btn:active {
    transform: scale(0.95);
}

@keyframes entryPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* ===== 妯睆瀹瑰櫒 ===== */
#landscape-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

/* 杩涘叆娓告垙鍚庢縺娲诲己鍒舵í灞?*/
#landscape-wrapper.force-landscape {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    /* 浣跨敤vmax/vmin纭繚鍦ㄤ换浣曟柟鍚戦兘鏄竴鏍风殑鍍忕礌鍊?*/
    --real-vw: 100vmax;
    --real-vh: 100vmin;
}

/* 鍏抽敭锛氭妸wrapper鍐呮墍鏈塮ixed瀹氫綅鏀逛负absolute锛岃瀹冧滑鐩稿浜巜rapper鑰岄潪瑙嗗彛 */
/* 鍗庝负绛夋祻瑙堝櫒涓嶆敮鎸乼ransform鍒涘缓fixed鍖呭惈鍧楋紝蹇呴』鐢╝bsolute浠ｆ浛 */
#landscape-wrapper.force-landscape #overlay,
#landscape-wrapper.force-landscape #rules-modal,
#landscape-wrapper.force-landscape #stats-modal,
#landscape-wrapper.force-landscape #lobby-overlay,
#landscape-wrapper.force-landscape #fullscreen-btn,
#landscape-wrapper.force-landscape #chat-panel,
#landscape-wrapper.force-landscape .achievement-toast,
#landscape-wrapper.force-landscape .win-animation-overlay {
    position: absolute !important;
}

/* 绔栧睆鏃舵棆杞瑆rapper */
@media (orientation: portrait) and (max-width: 900px) {
    #landscape-wrapper.force-landscape {
        left: 100vw;
        width: 100vh;
        height: 100vw;
        transform: rotate(90deg);
        transform-origin: top left;
    }

    /* 闃叉html/body鍦ㄧ珫灞忔椂鍑虹幇婊氬姩鏉?*/
    html:has(#landscape-wrapper.force-landscape),
    html:has(#landscape-wrapper.force-landscape)>body {
        overflow: hidden !important;
        width: 100vw !important;
        height: 100vh !important;
    }
}

/* 绔栧睆鎻愮ず锛堝凡涓嶅啀闇€瑕侊級 */
#portrait-prompt {
    display: none !important;
}

/* ========== 鎴樼哗缁熻寮圭獥 ========== */
.stats-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 20px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    color: #fff;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    max-height: calc(var(--real-vh, 100vh) * 0.85);
    overflow-y: auto;
}

.stats-header h2 {
    text-align: center;
    margin: 0 0 16px;
    font-size: 22px;
    letter-spacing: 4px;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive;
    color: var(--gold);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.stats-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 6px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-num {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    font-family: 'Noto Sans SC', sans-serif;
}

.stats-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

/* ========== 棣栭〉鍓寜閽?========== */
.home-sub-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 10px;
}

.home-sub-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.95);
    padding: 6px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Microsoft YaHei', '寰蒋闆呴粦', 'PingFang SC', 'Noto Sans SC', sans-serif;
    letter-spacing: 2px;
    transition: all 0.2s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.home-sub-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

/* ========== 鎴愬氨瑙ｉ攣鎻愮ず ========== */
.achievement-toast {
    position: absolute;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2a1a00, #4a3010);
    border: 2px solid rgba(255, 215, 0, 0.6);
    border-radius: 14px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    z-index: 99999;
    box-shadow: 0 4px 30px rgba(255, 215, 0, 0.3);
    transition: top 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: calc(var(--real-vw, 100vw) * 0.9);
}

.achievement-toast.show {
    top: 20px;
}

.ach-icon {
    font-size: 36px;
}

.ach-title {
    font-size: 12px;
    color: rgba(255, 215, 0, 0.8);
    letter-spacing: 2px;
}

.ach-name {
    font-size: 18px;
    font-weight: 700;
    color: #ffd700;
}

.ach-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* ========== 鎴愬氨闈㈡澘缃戞牸 ========== */
.ach-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.ach-item {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    transition: all 0.2s;
}

.ach-item.unlocked {
    background: rgba(255, 215, 0, 0.08);
    border-color: rgba(255, 215, 0, 0.3);
}

.ach-item.locked {
    opacity: 0.5;
}

.ach-item-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.ach-item-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.ach-item-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

/* ========== AI 闅惧害閫夋嫨鍣?========== */
.difficulty-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    margin-top: 10px;
}

.diff-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Noto Sans SC', sans-serif;
}

.diff-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-family: 'Noto Sans SC', sans-serif;
    transition: all 0.2s;
}

.diff-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.diff-btn.active {
    background: linear-gradient(180deg, #c9a742, #8b6914);
    border-color: rgba(255, 215, 0, 0.5);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(180, 140, 40, 0.4);
}

/* ========== 娈嬪眬鎸戞垬 ========== */
.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.puzzle-item {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.puzzle-item:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
}

.puzzle-diff {
    font-size: 12px;
    margin-bottom: 2px;
}

.puzzle-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.puzzle-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 3px;
}

/* 娈嬪眬鎻愮ず */
.puzzle-hint {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1a3a2a, #2a5a3a);
    border: 2px solid rgba(100, 255, 150, 0.4);
    border-radius: 14px;
    padding: 12px 24px;
    text-align: center;
    color: #fff;
    z-index: 99999;
    box-shadow: 0 4px 30px rgba(100, 255, 150, 0.2);
    transition: top 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.puzzle-hint.show {
    top: 20px;
}

.puzzle-hint-title {
    font-size: 18px;
    font-weight: 700;
    color: #80ff80;
}

.puzzle-hint-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
}

.puzzle-hint-diff {
    font-size: 12px;
    margin-top: 4px;
}

/* ========== 璧涘鎸夐挳 & 閫夐」 ========== */
.home-btn-green {
    background: linear-gradient(180deg, #2d8a4e, #1a5c30);
    border: 2px solid rgba(100, 200, 120, 0.4);
    box-shadow: 0 4px 15px rgba(50, 150, 80, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.home-btn-green:hover {
    background: linear-gradient(180deg, #3a9d5c, #217038);
}

.season-options {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.season-opt {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 16px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.season-opt:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.4);
    transform: translateY(-2px);
}

.season-opt-num {
    font-size: 36px;
    font-weight: 700;
    color: var(--gold);
}

.season-opt-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
}

/* ========== 棣栨杩涘叆寮€濮嬫寜閽?========== */
#game-start-overlay {
    position: absolute;
    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: 9999;
}

.game-start-btn {
    padding: 16px 48px;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 6px;
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 14px;
    background: linear-gradient(180deg, #c9a742 0%, #8b6914 100%);
    box-shadow: 0 4px 20px rgba(180, 140, 40, 0.6), 0 0 40px rgba(255, 215, 0, 0.15);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    font-family: 'Zhi Mang Xing', 'Ma Shan Zheng', cursive;
    animation: startPulse 2s ease-in-out infinite;
    transition: transform 0.15s;
}

.game-start-btn:hover {
    transform: scale(1.05);
}

.game-start-btn:active {
    transform: scale(0.97);
}

@keyframes startPulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(180, 140, 40, 0.6), 0 0 40px rgba(255, 215, 0, 0.15);
    }

    50% {
        box-shadow: 0 4px 30px rgba(180, 140, 40, 0.8), 0 0 60px rgba(255, 215, 0, 0.3);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-12px);
    }
}

/* ========== 杩炲簞鐏劙 ========== */
.dealer-streak-flame {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    pointer-events: none;
    z-index: 100;
    animation: flameFlicker 0.4s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 6px rgba(255, 100, 0, 0.8));
}

.dealer-streak-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, #ff6b35, #ff2d55);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 8px;
    z-index: 101;
    box-shadow: 0 0 8px rgba(255, 69, 0, 0.6);
    animation: flamePulse 1s ease-in-out infinite;
}

@keyframes flameFlicker {
    0% {
        transform: translateX(-50%) scale(1) rotate(-3deg);
        opacity: 0.9;
    }

    100% {
        transform: translateX(-50%) scale(1.15) rotate(3deg);
        opacity: 1;
    }
}

@keyframes flamePulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(255, 69, 0, 0.6);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 14px rgba(255, 69, 0, 0.9);
    }
}

/* ========== 寮瑰箷 ========== */
.danmaku-text {
    position: absolute;
    white-space: nowrap;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8), -1px -1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 8500;
    animation: danmakuScroll var(--dm-duration, 6s) linear forwards;
    opacity: 0.9;
}

@keyframes danmakuScroll {
    0% {
        transform: translateX(0);
        opacity: 0.9;
    }

    90% {
        opacity: 0.9;
    }

    100% {
        transform: translateX(calc(-100% - 100vw));
        opacity: 0;
    }
}

/* ========== 瑙傛垬鐐硅禐/榧撴帉 ========== */
.applause-particle {
    position: absolute;
    font-size: 28px;
    pointer-events: none;
    z-index: 9600;
    animation: applauseRise 1.5s ease-out forwards;
}

@keyframes applauseRise {
    0% {
        transform: translateY(0) scale(0.5) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: translateY(-40px) scale(1.2) rotate(15deg);
        opacity: 0.9;
    }

    100% {
        transform: translateY(-80px) scale(0.8) rotate(-10deg);
        opacity: 0;
    }
}

/* ========== 鎺烽鍒嗗骇鍔ㄧ敾 ========== */
.dice-phase-overlay {
    position: absolute;
    inset: 0;
    z-index: 200;
    background: linear-gradient(135deg, #0a1628 0%, #162544 40%, #1a3a5c 70%, #0a1628 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: dicePhaseFadeIn 0.5s ease;
    overflow: hidden;
    border-radius: 20px;
    transition: opacity 0.3s ease;
}

.dice-phase-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 30%, rgba(255, 215, 0, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 20% 80%, rgba(46, 204, 113, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(52, 152, 219, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

@keyframes dicePhaseFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.dice-phase-overlay.fade-out {
    animation: dicePhaseFadeOut 0.6s ease forwards;
}

@keyframes dicePhaseFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* 鏍囬 */
.dice-phase-title {
    font-family: 'Ma Shan Zheng', 'ZCOOL KuaiLe', cursive;
    font-size: 28px;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.6);
    margin-bottom: 8px;
    letter-spacing: 6px;
    z-index: 1;
    opacity: 0;
    animation: titleAppear 0.6s ease 0.2s forwards;
}

@keyframes titleAppear {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 3D楠板瓙瀹瑰櫒 */
.dice-scene {
    display: flex;
    gap: 40px;
    margin-bottom: 20px;
    z-index: 1;
    position: relative;
}

.dice-scene::before {
    content: '';
    position: absolute;
    width: 260px;
    height: 260px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, rgba(255, 100, 0, 0.12) 35%, transparent 65%);
    border-radius: 50%;
    animation: diceGlow 1.5s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes diceGlow {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.4;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 1;
    }
}

/* Canvas骰子容器 — 阴影和动画全在Canvas内绘制 */

/* 骰子结果数字（大号显示） */
.dice-result-value {
    font-size: 36px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 16px rgba(255, 215, 0, 0.5);
    z-index: 1;
    opacity: 0;
    animation: resultPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    margin-bottom: 8px;
    font-family: 'Ma Shan Zheng', 'ZCOOL KuaiLe', cursive;
}

@keyframes resultPop {
    from {
        opacity: 0;
        transform: scale(0.3);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 鐜╁缁撴灉鍗＄墖銈般儶銉冦儔 */
.dice-cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    max-width: 460px;
    z-index: 1;
    margin-bottom: 8px;
}

/* 鐜╁缁撴灉鍗＄墖 */
.dice-result-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    width: calc(50% - 6px);
    min-width: 140px;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    animation: cardSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.dice-result-card.seated {
    border-color: rgba(46, 204, 113, 0.4);
    background: rgba(46, 204, 113, 0.08);
}

.dice-result-card.bench {
    border-color: rgba(243, 156, 18, 0.4);
    background: rgba(243, 156, 18, 0.08);
}

.dice-result-card.self {
    border-color: rgba(255, 215, 0, 0.6);
    background: rgba(255, 215, 0, 0.12);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.15);
}

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dice-card-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    flex-shrink: 0;
}

.dice-card-rank.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
}

.dice-card-rank.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #808080);
}

.dice-card-rank.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #8b4513);
}

.dice-card-rank.rank-4 {
    background: linear-gradient(135deg, #5dade2, #2e86c1);
}

.dice-card-rank.rank-5,
.dice-card-rank.rank-6 {
    background: linear-gradient(135deg, #f39c12, #d68910);
}

.dice-card-info {
    flex: 1;
    min-width: 0;
}

.dice-card-name {
    font-size: 13px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dice-card-detail {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 1px;
}

url(../../xwechat_files/wxid_j8aub3oxv5bz22_a957/temp/RWTemp/2026-03/166321c0a22d35f8d0ae1b079f7b5c77.jpg) .dice-card-seat {
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 6px;
}

.dice-card-seat.seat-table {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.dice-card-seat.seat-bench {
    background: rgba(243, 156, 18, 0.2);
    color: #f39c12;
}

/* 纭鍖哄煙 */
.dice-confirm-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 1;
}

.dice-confirm-btn {
    padding: 8px 30px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    font-family: 'Ma Shan Zheng', 'ZCOOL KuaiLe', cursive;
    letter-spacing: 3px;
    box-shadow: 0 4px 16px rgba(46, 204, 113, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    opacity: 0;
    animation: btnAppear 0.4s ease forwards;
}

.dice-confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(46, 204, 113, 0.4);
}

.dice-confirm-btn:disabled {
    background: linear-gradient(135deg, #555, #444);
    cursor: default;
    box-shadow: none;
    transform: none;
}

@keyframes btnAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dice-confirm-progress {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    height: 18px;
}

/* 瑁呴グ绮掑瓙 */
.dice-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.4);
    pointer-events: none;
    animation: particleFloat 3s ease-in-out infinite;
}

@keyframes particleFloat {

    0%,
    100% {
        transform: translateY(0) scale(1);
        opacity: 0.4;
    }

    50% {
        transform: translateY(-20px) scale(1.5);
        opacity: 0.8;
    }
}

/* 鍗曚汉妯″紡绠€鍖栨樉绀?*/
.dice-single-msg {
    font-size: 16px;
    color: #2ecc71;
    text-align: center;
    padding: 16px;
    z-index: 1;
    animation: titleAppear 0.6s ease forwards;
    font-family: 'ZCOOL KuaiLe', 'Noto Sans SC', sans-serif;
}