/* ============================================
   联机扫雷 - 移动端专用样式
   专为手机屏幕优化，最小化滚动
   ============================================ */

/* ---------- 主题变量 ----------
   这些变量之前全项目没有任何定义，导致 18 处 var(--x) 全部取不到值、
   整条声明失效（观战提示条背景、退出按钮配色、棋盘辉光等都等于没写）。 */
:root {
    /* 输入 / 按钮 */
    --input-focus-shadow: rgba(255, 107, 53, 0.35);
    --exit-btn-bg: rgba(255, 255, 255, 0.08);
    --exit-btn-border: rgba(255, 255, 255, 0.25);
    --exit-btn-active: rgba(255, 255, 255, 0.18);

    /* 玩家下拉 */
    --dropdown-gradient: linear-gradient(180deg, rgba(32, 20, 9, 0.96), rgba(14, 9, 4, 0.97));
    --dropdown-border: rgba(212, 175, 55, 0.35);
    --hamburger-active-bg: rgba(255, 138, 0, 0.25);
    --hamburger-active-color: #ff8a00;

    /* 信息栏 */
    --bombs-color: #ff8a00;
    --room-info-accent: rgba(255, 248, 219, 0.75);
    --msg-info-bg: rgba(30, 20, 10, 0.85);
    --msg-info-border: rgba(212, 175, 55, 0.4);

    /* 棋盘 */
    --board-glow-1: rgba(255, 180, 80, 0.18);
    --board-glow-2: rgba(255, 140, 40, 0.10);
    --cell-check-glow: rgba(0, 206, 201, 0.8);

    /* 道具按钮辉光 */
    --item-skip-glow: rgba(255, 200, 80, 0.35);
    --item-peek-glow: rgba(0, 206, 201, 0.35);
    --item-shield-glow: rgba(120, 180, 255, 0.35);

    /* ---------- 主题图片变量（默认森林主题） ---------- */
    --img-gameSceneBg: url('/imgs/gameSceneBg.webp');
    --img-loginWoodFrameBase: url('/imgs/loginWoodFrameBase.webp');
    --img-enterGameBtn: url('/imgs/enterGameBtn.webp');
    --img-forestWoodPanel: url('/imgs/forest_wood_panel.webp');
    --img-mossStone: url('/imgs/moss_stone.webp');
    --img-bombMossForest: url('/imgs/bomb_moss_forest.webp');
    --img-msgTipWoodLight: url('/imgs/msg_tip_wood_light.webp');
    --img-itemBtnSkip: url('/imgs/item_btn_skip.webp');
    --img-itemBtnView: url('/imgs/item_btn_view.webp');
    --img-itemBtnShield: url('/imgs/item_btn_shield.webp');
    --img-tcmb: url('/imgs/tcmb.webp');
}

/* ---------- 酒馆主题（Alcohol Residence UI）---------- */
[data-theme="alcohol"] {
    --img-gameSceneBg: url('/imgs/Alcohol_Residence_UI/gameSceneBg.webp');
    --img-loginWoodFrameBase: url('/imgs/Alcohol_Residence_UI/loginWoodFrameBase.webp');
    --img-enterGameBtn: url('/imgs/Alcohol_Residence_UI/enterGameBtn.webp');
    --img-forestWoodPanel: url('/imgs/Alcohol_Residence_UI/forest_wood_panel.webp');
    --img-mossStone: url('/imgs/Alcohol_Residence_UI/moss_stone.webp');
    --img-bombMossForest: url('/imgs/Alcohol_Residence_UI/bomb_moss_forest.webp');
    --img-msgTipWoodLight: url('/imgs/Alcohol_Residence_UI/msg_tip_wood_light.webp');
    --img-itemBtnSkip: url('/imgs/Alcohol_Residence_UI/item_btn_skip.webp');
    --img-itemBtnView: url('/imgs/Alcohol_Residence_UI/item_btn_view.webp');
    --img-itemBtnShield: url('/imgs/Alcohol_Residence_UI/item_btn_shield.webp');
    --img-tcmb: url('/imgs/Alcohol_Residence_UI/tcmb.webp');
}

@font-face {
    font-family: 'ZCOOL KuaiLe';
    src: url('./fonts/zcool-kuaile-v22-chinese-simplified_latin-regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}


/* ---------- 基础重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

html, body {
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
}

body {
    font-family: 'ZCOOL KuaiLe', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--img-gameSceneBg) no-repeat center center fixed;
    background-size: cover;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    position: relative;
}

/* ---------- 启动页（资源预加载） ---------- */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background: linear-gradient(180deg, #0a0a1a 0%, #0d0d2b 15%, #111140 35%, #1a1a50 55%, #1e1040 75%, #0d0818 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    gap: 24px;
    overflow: hidden;
}

/* ---- 星空 ---- */
#splash-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #fff;
    box-shadow:
        30px 45px 0 #fff, 80px 20px 0 rgba(255,255,255,0.9), 150px 70px 0 #fff,
        220px 30px 0 rgba(255,255,255,0.7), 290px 90px 0 #fff, 350px 15px 0 rgba(255,255,255,0.8),
        410px 55px 0 #fff, 30px 120px 0 rgba(255,255,255,0.6), 100px 140px 0 #fff,
        180px 180px 0 rgba(255,255,255,0.8), 260px 130px 0 #fff, 330px 200px 0 rgba(255,255,255,0.7),
        400px 160px 0 #fff, 55px 250px 0 rgba(255,255,255,0.5), 140px 300px 0 #fff,
        210px 260px 0 rgba(255,255,255,0.6), 310px 290px 0 #fff, 380px 250px 0 rgba(255,255,255,0.7),
        70px 380px 0 #fff, 160px 400px 0 rgba(255,255,255,0.5), 250px 360px 0 #fff,
        340px 420px 0 rgba(255,255,255,0.6), 420px 380px 0 #fff, 10px 350px 0 rgba(255,255,255,0.4),
        120px 210px 0 rgba(255,255,255,0.9), 280px 60px 0 #fff, 190px 100px 0 rgba(255,255,255,0.5),
        360px 110px 0 #fff, 45px 190px 0 rgba(255,255,255,0.7), 440px 200px 0 #fff,
        20px 450px 0 rgba(255,255,255,0.5), 90px 490px 0 #fff, 200px 460px 0 rgba(255,255,255,0.4),
        320px 480px 0 #fff, 400px 450px 0 rgba(255,255,255,0.6), 110px 60px 0 rgba(255,255,255,0.3),
        240px 190px 0 rgba(255,255,255,0.4), 170px 340px 0 rgba(255,255,255,0.5),
        380px 330px 0 rgba(255,255,255,0.3), 50px 420px 0 rgba(255,255,255,0.4);
    animation: twinkle 3s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

@keyframes twinkle {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* ---- 流星 ---- */
#splash-screen::after {
    content: '';
    position: absolute;
    top: 60px;
    left: 350px;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.9));
    border-radius: 1px;
    transform: rotate(-35deg);
    animation: meteor1 2.5s linear infinite;
    pointer-events: none;
    z-index: 0;
    box-shadow: 0 0 6px rgba(255,255,255,0.6);
}

@keyframes meteor1 {
    0% { transform: rotate(-35deg) translateX(0); opacity: 0; }
    5% { opacity: 1; }
    15% { opacity: 0; transform: rotate(-35deg) translateX(-350px); }
    100% { opacity: 0; transform: rotate(-35deg) translateX(-350px); }
}

/* 第二颗流星 */
.splash-ground::before {
    content: '';
    position: absolute;
    top: 30px;
    right: 120px;
    width: 60px;
    height: 1.5px;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,200,255,0.8));
    border-radius: 1px;
    transform: rotate(-40deg);
    animation: meteor2 3.5s linear 1.5s infinite;
    box-shadow: 0 0 4px rgba(255,200,255,0.5);
}

@keyframes meteor2 {
    0% { transform: rotate(-40deg) translateX(0); opacity: 0; }
    5% { opacity: 1; }
    12% { opacity: 0; transform: rotate(-40deg) translateX(-300px); }
    100% { opacity: 0; transform: rotate(-40deg) translateX(-300px); }
}

/* ---- 地面 ---- */
.splash-ground {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 42%;
    background: linear-gradient(180deg, 
        #1a3a1a 0%, 
        #163016 8%, 
        #1e4420 20%, 
        #0d220d 100%);
    border-radius: 60% 70% 0 0 / 30px 25px 0 0;
    pointer-events: none;
}

/* 草地起伏纹理 */
.splash-ground::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 20px;
    background: 
        radial-gradient(ellipse 30px 10px at 10% 50%, #2d5a2d 0%, transparent 100%),
        radial-gradient(ellipse 25px 8px at 30% 40%, #1e4420 0%, transparent 100%),
        radial-gradient(ellipse 35px 10px at 55% 55%, #2d5a2d 0%, transparent 100%),
        radial-gradient(ellipse 28px 9px at 75% 45%, #1e4420 0%, transparent 100%),
        radial-gradient(ellipse 32px 10px at 90% 50%, #2d5a2d 0%, transparent 100%);
    pointer-events: none;
}

/* ---- 标题 ---- */
#splash-logo {
    font-family: 'ZCOOL KuaiLe', sans-serif;
    font-size: 2.2rem;
    color: #fff;
    letter-spacing: 6px;
    text-shadow:
        0 0 10px rgba(255, 200, 100, 0.6),
        0 0 30px rgba(255, 180, 50, 0.35),
        0 0 60px rgba(200, 150, 100, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.5);
    animation: splashPulse 1.5s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

@keyframes splashPulse {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.05); opacity: 1; }
}

/* ---- 进度条 ---- */
.splash-progress-bar {
    width: 60%;
    max-width: 280px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    z-index: 2;
    box-shadow: 0 0 10px rgba(255, 200, 100, 0.1);
}

.splash-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4a90d9, #7bb3e0, #ffcc66);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(74, 144, 217, 0.4);
    position: relative;
}

.splash-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 100%);
    border-radius: 3px 3px 0 0;
}

.splash-progress-text {
    font-family: 'ZCOOL KuaiLe', sans-serif;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 2px;
    position: relative;
    z-index: 2;
}

.splash-progress-detail {
    font-family: 'ZCOOL KuaiLe', sans-serif;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1px;
    text-align: center;
    line-height: 1.6;
    position: relative;
    z-index: 2;
    min-height: 2.4em;
}

.splash-progress-detail .detail-icon {
    font-size: 0.7rem;
}

.splash-progress-detail .detail-file {
    color: rgba(255, 200, 100, 0.5);
    font-size: 0.6rem;
}

/* ---------- 游戏容器 ---------- */
#game-container {
    width: 100%;
    max-width: 460px;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px;
    gap: 8px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* ---------- 面板通用 ---------- */
#login-panel,
#room-select-panel,
#game-panel {
    border-radius: 16px;
    animation: fadeIn 0.3s ease-out;
}

#login-panel {
    width: 94%;
    max-width: 480px;
    margin: -6vh auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 20% 10% 20%;
    background: var(--img-loginWoodFrameBase) center center / 100% 100% no-repeat;
}

.login-title-img {
    width: 90%;
    height: auto;
    display: block;
    margin: 0;
}

#login-panel #username-input {
    width: 78%;
    margin: 0;
    background: rgba(30, 17, 8, 0.85);
    color: #fff;
    text-align: center;
}

#login-panel #username-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#login-panel #login-btn {
    width: 52%;
    aspect-ratio: 2 / 1;
    margin: 0;
    padding: 0;
    background: var(--img-enterGameBtn) center center / 100% 100% no-repeat;
    border: none;
    box-shadow: none;
    cursor: pointer;
    background-color: transparent;
}

/* ---------- 风格切换按钮（右上角固定） ---------- */
.theme-toggle-wrap {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 10px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.theme-toggle-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 1px;
    white-space: nowrap;
}

.theme-toggle-btn {
    position: relative;
    width: 46px;
    height: 24px;
    border-radius: 12px;
    background: rgba(60, 40, 20, 0.5);
    border: 1.5px solid rgba(212, 175, 55, 0.4);
    cursor: pointer;
    padding: 0;
    margin: 0;
    box-shadow: none;
    transition: background 0.3s ease, border-color 0.3s ease;
    flex-shrink: 0;
}

.theme-toggle-btn::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffcc66, #ff8a00);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, background 0.3s ease;
}

[data-theme="alcohol"] .theme-toggle-btn {
    background: rgba(80, 30, 20, 0.55);
    border-color: rgba(255, 180, 80, 0.5);
}

[data-theme="alcohol"] .theme-toggle-btn::after {
    transform: translateX(22px);
    background: linear-gradient(135deg, #ff9944, #cc4400);
}

.theme-toggle-btn:active {
    transform: none;
    box-shadow: none;
}

.theme-toggle-btn:active::after {
    width: 20px;
}

#game-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 6px;
}

/* ---------- 标题 ---------- */
h2 {
    font-size: 2rem;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #ff6b35, #ff006e, #ff6b35);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease infinite;
    text-shadow: none;
    letter-spacing: 2px;
}

/* ---------- 输入框 / 按钮 / 下拉 ---------- */
input, button, select {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border-radius: 10px;
    border: none;
    font-size: 1rem;
    transition: all 0.15s ease;
}

input, select {
    font-family: inherit;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

select option {
    background: #2d0a3d;
    color: #fff;
}

input:focus, select:focus {
    outline: none;
    border-color: #ff6b35;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 12px var(--input-focus-shadow);
}

input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

button {
    font-family: inherit;
    background: linear-gradient(135deg, #6a1b9a, #8e24aa);
    color: white;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(106, 27, 154, 0.35);
    letter-spacing: 1px;
}

button:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(106, 27, 154, 0.35);
}

/* ---------- room-card 图片按钮 ---------- */
.btn-join-room {
    width: 40px;
    height: 40px;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.1s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.btn-join-room:active {
    transform: scale(0.9);
}

.btn-img-create-room,
.btn-img-refresh {
    width: 100%;
    height: auto;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    transition: transform 0.1s ease;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45));
}

.btn-img-create-room:active,
.btn-img-refresh:active {
    transform: scale(0.95);
}

/* ---------- 游戏信息栏 ---------- */
#game-info {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.82rem;
    flex-shrink: 0;
}

#room-info {
    background: var(--img-forestWoodPanel) center center / 100% 100% no-repeat;
    padding: 18px 40px;
    flex: 1;
    min-width: 45%;
}

#player-info, #player-list {
    background: var(--img-forestWoodPanel) center center / 100% 100% no-repeat;
    padding: 8px 20px;
    border-radius: 8px;
    flex: 1;
    min-width: 45%;
}

#player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#player-list {
    position: relative;
    z-index: 10;
}

.player-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hamburger-btn {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    box-shadow: none;
    transition: background 0.15s, color 0.15s;
}

.hamburger-btn.active {
    background: var(--hamburger-active-bg);
    color: var(--hamburger-active-color);
}

.hamburger-btn:active {
    transform: scale(0.9);
}

.player-item {
    font-size: 0.8rem;
    padding: 3px 0;
    color: rgba(255, 255, 255, 0.8);
}

.players-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--dropdown-gradient);
    border: 1px solid var(--dropdown-border);
    border-radius: 8px;
    padding: 8px 10px;
    z-index: 100;
    display: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.players-dropdown.expanded {
    display: block;
}

#room-info {
    width: 100%;
}

.room-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.room-info-text {
    flex: 1;
    min-width: 0;
}

/* ---------- 退出按钮（小按钮） ---------- */
.exit-btn-small {
    width: auto !important;
    flex-shrink: 0;
    background: var(--exit-btn-bg) !important;
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: bold;
    border: 1px solid var(--exit-btn-border) !important;
    border-radius: 6px !important;
    padding: 4px 10px !important;
    font-size: 0.7rem !important;
    letter-spacing: 1px;
    margin: 0 !important;
    box-shadow: none !important;
}

.exit-btn-small:active {
    background: var(--exit-btn-active) !important;
    transform: scale(0.92);
}

.bombs-info {
    font-size: 0.78rem;
    color: var(--bombs-color);
    margin-top: 2px;
    font-weight: bold;
}


.room-id {
    font-family: monospace;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* ---------- 游戏棋盘 ---------- */
#game-board {
    display: grid;
    gap: 2px;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1/1;
    flex-shrink: 0;
    overflow: hidden;
}

.cell {
    background-image: var(--img-mossStone);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s ease;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.cell:active {
    transform: scale(0.9);
}

.cell.opened {
    background-image: none;
    background-color: transparent;
    transform: scale(0.95);
    box-shadow: none;
    pointer-events: none;
}

.cell.peeked {
    filter: brightness(0.35) blur(1px);
    transition: all 0.5s ease;
}

.cell.peeked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: rgba(0, 206, 201, 0.9);
    font-weight: bold;
    pointer-events: none;
    z-index: 1;
    text-shadow: 0 0 8px var(--cell-check-glow);
    animation: peekFadeIn 0.4s ease;
}

.cell.bomb {
    background-image: var(--img-bombMossForest);
    animation: bombExplode 0.5s ease-out;
}

/* ---------- 游戏消息 ---------- */
.game-message {
    padding: 8px;
    text-align: center;
    border-radius: 6px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* 观战提示条：JS 里用 className = 'game-message message-info' */
.message-info { background: var(--msg-info-bg); border: 1px solid var(--msg-info-border); }

/* ---------- 道具栏 ---------- */
#item-bar {
    padding: 8px;
}

.item-buttons {
    display: flex;
    gap: 6px;
}

.item-btn {
    flex: 1;
    padding: 8px 4px;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.7rem;
    transition: all 0.15s ease;
    letter-spacing: 0;
    position: relative;
}

.item-btn:active {
    transform: scale(0.94);
}

.item-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.item-btn:disabled:active {
    transform: none;
}

.item-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: rgba(0, 0, 0, 0.6);
    color: #ff4444;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 0.65rem;
    font-weight: bold;
}

.btn-skip:not(:disabled) {
    background: var(--img-itemBtnSkip) center center / 100% 100% no-repeat;
    box-shadow: 0 0 10px var(--item-skip-glow);
}

.btn-peek:not(:disabled) {
    background: var(--img-itemBtnView) center center / 100% 100% no-repeat;
    box-shadow: 0 0 10px var(--item-peek-glow);
}

.btn-shield:not(:disabled) {
    background: var(--img-itemBtnShield) center center / 100% 100% no-repeat;
    box-shadow: 0 0 10px var(--item-shield-glow);
}

/* ---------- 房间选择面板 ---------- */
#room-select-panel {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    align-items: center;
    padding: 16px 14px;
    gap: 14px;
    overflow: hidden;
    text-align: center;
    border-radius: 0;
}

.room-title-img {
    display: block;
    max-width: 280px;
    width: 80%;
    margin: 0 auto;
    height: auto;
}

.room-card {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 24px;
    padding: 18px 16px 16px;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.room-card::-webkit-scrollbar {
    display: none;
}

.room-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    align-items: center;
}

/* room-card 底部的 sticky 按钮栏 */
.room-card > .room-actions {
    position: sticky;
    bottom: 0;
    padding: 10px 16px;
    margin: 0 -16px;
}

.room-list {
    overflow-y: auto;
    border-radius: 12px;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}

.room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 10%;
    margin: 6px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
    box-sizing: border-box;
    background: var(--img-msgTipWoodLight) center center / 100% 100% no-repeat;
}

.room-item:active {
    background: rgba(212, 175, 55, 0.08);
    transform: scale(0.98);
}

.room-info {
    text-align: left;
    flex: 1;
}

.room-name {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 2px;
}

.room-details {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
}

.no-rooms {
    text-align: center;
    padding: 36px 12px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 1rem;
    line-height: 1.6;
}

/* ---------- 创建房间表单 ---------- */
#create-room-form {
    display: none;
    overflow-y: auto;
    background: transparent;
    padding: 8px 4px;
    border-radius: 0;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

#create-room-form .form-group {
    margin-bottom: 12px;
    text-align: left;
}

#create-room-form .form-label {
    display: block;
    margin-bottom: 6px;
    color: rgba(255, 248, 219, 0.9);
    font-size: 0.9rem;
    font-weight: bold;
}

#create-room-form input,
#create-room-form select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.4);
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    font-size: 1rem;
}

#create-room-form .form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

#create-room-form .form-actions .btn-img-cancel,
#create-room-form .form-actions .btn-img-confirm {
    flex: 1;
    height: auto;
    cursor: pointer;
    min-width: 0;
    transition: transform 0.1s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

#create-room-form .form-actions .btn-img-cancel:active,
#create-room-form .form-actions .btn-img-confirm:active {
    transform: scale(0.95);
}

.form-group {
    margin-bottom: 10px;
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
    font-size: 0.9rem;
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ---------- 悬浮提示框 ---------- */
.loading-overlay,
.message-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 12vh;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active,
.message-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-text {
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 16px 28px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    animation: pulse 1.5s infinite;
}

.message-box {
    background: var(--img-msgTipWoodLight) center center / 100% 100% no-repeat;
    color: #fff;
    padding: 20px 28px;
    border-radius: 0;
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    max-width: 320px;
    min-width: 200px;
}

.message-overlay.active .message-box {
    animation: slideDown 0.35s ease;
}

.message-box.info { }
.message-box.success { }
.message-box.error { animation: shake 0.4s ease; }

.room-info-text {
    font-size: 0.8rem;
    margin-top: 6px;
    color: var(--room-info-accent);
    font-style: italic;
}

/* ---------- 动画 ---------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-40px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes bombExplode {
    0% { transform: scale(1); }
    30% { transform: scale(1.2); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-6px); }
    30% { transform: translateX(6px); }
    50% { transform: translateX(-4px); }
    70% { transform: translateX(4px); }
    90% { transform: translateX(-2px); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

@keyframes peekFadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ---------- 小屏手机微调 ---------- */
@media (max-height: 700px) {
    #game-container {
        padding: 8px;
        gap: 4px;
    }

    h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    input, button, select {
        padding: 10px;
        margin: 5px 0;
        font-size: 0.95rem;
    }

    #game-info {
        font-size: 0.75rem;
    }

    #game-board {
        gap: 1px;
    }

    .exit-btn-small {
        padding: 8px 12px !important;
        font-size: 0.7rem !important;
    }
}

@media (max-height: 600px) {
    h2 {
        font-size: 1.3rem;
        margin-bottom: 6px;
    }

    input, button, select {
        padding: 8px;
        margin: 4px 0;
        font-size: 0.9rem;
    }

    #game-info {
        font-size: 0.7rem;
        gap: 4px;
    }

    #player-info, #player-list, #room-info {
        padding: 5px 8px;
    }

    .exit-btn-small {
        padding: 6px 10px !important;
        font-size: 0.65rem !important;
    }
}

/* ---------- 退出确认模态框 ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    background-image: var(--img-tcmb);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    width: 85%;
    height: 45%;
    max-width: 360px;
    text-align: center;
    position: relative;
    animation: slideUp 0.25s ease;
}


.modal-actions {
    position: absolute;
    bottom: 18%;
    left: 0;
    right: 0;
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 0 30px;
    transform: scale(0.88);
}

.modal-btn-cancel,
.modal-btn-confirm {
    flex: 1;
    height: auto;
    cursor: pointer;
    min-width: 0;
    transition: transform 0.1s ease;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.modal-btn-cancel:active,
.modal-btn-confirm:active {
    transform: scale(0.95);
}


@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}