/* =========================================
   1. 全局背景与字体设置
========================================= */
body {
    margin: 0; padding: 0;
    background-color: #121212; color: #e0e0e0;
    font-family: "Courier New", Courier, monospace;
    display: flex; justify-content: center; align-items: center;
    height: 100vh; overflow: hidden;
}

/* =========================================
   2. 人机认证与密码拦截层
========================================= */
#auth-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #121212; display: flex; justify-content: center; align-items: center; z-index: 9999;
}
.auth-box {
    display: flex; flex-direction: column; gap: 25px; 
    background-color: #1a1a1a; padding: 40px; border: 1px solid #333;
    border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.8); width: 260px;
}
.pwd-group { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.auth-label { color: #666; font-size: 12px; font-family: monospace; letter-spacing: 2px; text-transform: uppercase; user-select: none; }
#auth-pwd {
    padding: 12px; background-color: #000; border: 1px solid #444; border-bottom: 2px solid #555; 
    color: #fff; font-size: 20px; outline: none; font-family: monospace;
    width: 100%; box-sizing: border-box; text-align: center; letter-spacing: 10px; transition: 0.2s;
}
#auth-pwd:focus { border-color: #888; border-bottom-color: #d4af37; }

.captcha-container { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
#captcha-canvas { background-color: #e0e0e0; border-radius: 4px; cursor: pointer; border: 1px solid #444; }
#auth-captcha {
    padding: 0; height: 36px; width: 80px; background-color: #000;
    border: 1px solid #444; color: #fff; font-size: 18px; outline: none;
    font-family: monospace; text-align: center; letter-spacing: 4px;
    text-transform: uppercase; border-radius: 4px; transition: 0.2s;
}
#auth-captcha:focus { border-color: #888; }
#refresh-captcha {
    background: #222; border: 1px solid #444; color: #888;
    width: 36px; height: 36px; cursor: pointer; font-size: 18px;
    display: flex; justify-content: center; align-items: center; border-radius: 4px; transition: 0.2s;
}
#refresh-captcha:hover { color: #fff; border-color: #888; background: #333; }
#auth-btn {
    margin-top: 10px; padding: 12px; background-color: #333; color: #888;
    border: none; cursor: pointer; font-weight: bold; letter-spacing: 8px;
    transition: 0.2s; border-radius: 4px;
}
#auth-btn:hover { background-color: #d4af37; color: #111; }

/* =========================================
   3. 开始菜单大厅样式
========================================= */
#start-menu {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85); display: flex; justify-content: center; align-items: center; z-index: 100;
}
.menu-box {
    background-color: #0f4d30; border: 5px solid #d4af37; padding: 40px;
    border-radius: 15px; text-align: center; box-shadow: 0 0 40px rgba(212, 175, 55, 0.5);
}
.menu-box h1 {
    margin-top: 0; color: #f4f1ea; margin-bottom: 30px; font-size: 32px;
    text-shadow: 2px 2px 4px #000; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Android Emoji", sans-serif;
}
.menu-box button {
    display: block; width: 100%; margin: 15px 0; padding: 15px 20px;
    font-size: 18px; font-weight: bold; background-color: #f4f1ea; color: #111;
    border: none; border-radius: 8px; cursor: pointer; transition: all 0.2s; font-family: inherit; box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
.menu-box button:hover { background-color: #d4af37; color: #fff; transform: scale(1.05); }

/* =========================================
   4. 麻将桌主板与布局
========================================= */
#game-board {
    width: 900px; height: 800px; background-color: #0f4d30;
    border: 15px solid #3e2723; border-radius: 20px; position: relative; box-shadow: inset 0 0 60px rgba(0,0,0,0.6);
}
.retro-text { color: #ffcc00; text-shadow: 1px 1px 2px #000; font-weight: bold; }
.player-area { position: absolute; display: flex; justify-content: center; align-items: center; }
#player-bottom { bottom: 20px; left: 0; width: 100%; height: 110px; }
#player-top { top: 20px; left: 0; width: 100%; height: 90px; transform: rotate(180deg); }
#player-left { top: 0; left: -320px; width: 800px; height: 90px; transform: rotate(90deg); transform-origin: center; }
#player-right { top: 0; right: -320px; width: 800px; height: 90px; transform: rotate(-90deg); transform-origin: center; }

/* =========================================
   5. 中央桌面与弃牌池 (防遮挡)
========================================= */
#center-area {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 540px; height: 480px; display: flex; flex-direction: column; align-items: center;
}
#info-board {
    background: rgba(0,0,0,0.6); padding: 10px 30px; border-radius: 10px;
    text-align: center; margin-bottom: 15px; border: 1px solid rgba(255, 204, 0, 0.3); width: 70%;
}
#discard-pool { 
    width: 100%; height: 320px; display: flex; flex-wrap: wrap; 
    align-content: flex-start; justify-content: center; 
    overflow-y: auto; padding-right: 5px;
}
#discard-pool::-webkit-scrollbar { width: 8px; }
#discard-pool::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 4px; }
#discard-pool::-webkit-scrollbar-thumb { background: rgba(212, 175, 55, 0.5); border-radius: 4px; }
#discard-pool::-webkit-scrollbar-thumb:hover { background: rgba(212, 175, 55, 0.8); }

#discard-pool .tile { width: 34px; height: 48px; font-size: 34px; margin: 2px; background-color: #f4f1ea; }

/* =========================================
   6. 麻将牌核心样式
========================================= */
.tile {
    width: 60px; height: 84px; background-color: #f4f1ea; border: 1px solid #bba;
    border-radius: 8px; display: flex; justify-content: center; align-items: center;
    font-size: 52px; line-height: 1; margin: 0 3px; 
    box-shadow: 3px 4px 6px rgba(0,0,0,0.4), inset -2px -3px 4px rgba(0,0,0,0.1); 
    user-select: none; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Android Emoji", sans-serif; font-variant-emoji: emoji;
}
.human-area .tile { cursor: pointer; transition: transform 0.1s ease-in-out, background-color 0.1s; }
.human-area .tile:hover { transform: translateY(-12px); background-color: #ffffff; }
.ai-area .tile { background-color: #00897b; border: 1px solid #004d40; box-shadow: 3px 4px 6px rgba(0,0,0,0.4), inset 1px 2px 3px rgba(255,255,255,0.2); }

/* =========================================
   7. 游戏中操作菜单 (明牌与碰/上拦截)
========================================= */
.reveal-container { display: flex; align-items: center; margin-right: 20px; border-right: 2px solid rgba(255,255,255,0.2); padding-right: 10px; height: 84px; }
.hand-container { display: flex; align-items: center; height: 84px; }
.reveal-container .tile { width: 50px; height: 70px; font-size: 44px; background-color: #e0dcd3; box-shadow: none; border-color: #999; }

#action-menu {
    position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 15px; background: rgba(0,0,0,0.85); padding: 10px 20px;
    border-radius: 10px; border: 2px solid #d4af37; z-index: 50; box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
#action-menu button {
    padding: 10px 25px; font-size: 20px; font-weight: bold; border: none; border-radius: 5px;
    cursor: pointer; background: #f4f1ea; color: #111; transition: 0.1s; font-family: inherit;
}
#action-menu button:hover { background: #d4af37; color: #fff; transform: scale(1.05); }
#btn-pass { background: #555 !important; color: #ccc !important; }
#btn-pass:hover { background: #777 !important; color: #fff !important; }

/* =========================================
   8. 胡牌特效与结束状态
========================================= */
#btn-hu {
    background: #cc0000 !important; color: #fff !important; border: 2px solid #ffcc00 !important;
    box-shadow: 0 0 15px rgba(204, 0, 0, 0.8); animation: pulse 1s infinite alternate;
}
#btn-hu:hover { background: #ff0000 !important; transform: scale(1.15) !important; }

@keyframes pulse {
    from { box-shadow: 0 0 10px rgba(204, 0, 0, 0.6); }
    to { box-shadow: 0 0 25px rgba(255, 50, 50, 1); }
}
.ai-revealed {
    background-color: #f4f1ea !important; border: 1px solid #bba !important;
    box-shadow: 3px 4px 6px rgba(0,0,0,0.4), inset -2px -3px 4px rgba(0,0,0,0.1) !important;
}