/* =========================================
   PokeWar — 完整样式表
   从 index.html 内联抽离 + UX 优化
   ========================================= */
:root {
    --bg: #fef6f5;
    --primary: #ffb6c1;
    --primary-hover: #ff9fb0;
    --self: #4facfe;
    --hp: #ff7675;
    --shield: #74b9ff;
    --text: #2d3436;
    --text-muted: #636e72;
    --card: #fff;
    --font: 'Comic Sans MS', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24"><text y="22" font-size="20">🐾</text></svg>'), auto;
}

.page-view { display: none; width: 100vw; height: 100vh; position: relative; }
.page-view.active { display: block; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

/* ═══ 动画 ═══ */
@keyframes fadeIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
@keyframes bounceHover { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes attackDash { 0% { transform: translate(0,0) scale(1.05); } 50% { transform: translate(30px,-60px) scale(1.1); opacity: .8; } 100% { transform: translate(0,0) scale(1); opacity: 0; } }
@keyframes timerShrink { from { width: 100%; background: #55efc4; } 50% { background: #ffeaa7; } to { width: 0%; background: #ff7675; } }
@keyframes popIn { 0% { transform: scale(.8); opacity: 0; } 80% { transform: scale(1.05); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes floatTrophy { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes pulseTarget { 0% { box-shadow: 0 0 0 0 rgba(255,118,117,.4); } 70% { box-shadow: 0 0 0 10px rgba(255,118,117,0); } 100% { box-shadow: 0 0 0 0 rgba(255,118,117,0); } }

/* ═══ 按钮 ═══ */
.btn {
    background: var(--primary); color: #fff; border: none;
    padding: 10px 20px; border-radius: 20px; font-size: 16px;
    font-family: inherit; cursor: pointer;
    transition: all .15s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 6px 0 rgba(0,0,0,.1), 0 8px 15px rgba(0,0,0,.08);
    font-weight: bold;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.1), 0 3px 6px rgba(0,0,0,.08); }
.btn-secondary { background: #a29bfe; box-shadow: 0 6px 0 rgba(0,0,0,.1), 0 8px 15px rgba(162,155,254,.3); }
.btn-small { padding: 5px 15px; font-size: 14px; margin-left: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: 0 6px 0 rgba(0,0,0,.1), 0 8px 15px rgba(0,0,0,.08) !important; }
.btn-ready { background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%); color: #fff; }
.btn-leave { background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%); color: #fff; }
.suit-red { color: #dc2626; }
.suit-black { color: #1e293b; }

/* ═══ 主页（Bug Fix：移除 DIY 概念，头像有房时自动分配） ═══ */
.home-container {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; height: 100vh; animation: fadeIn .5s;
}
.home-box {
    background: #fff; padding: 40px; border-radius: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,.05); text-align: center;
    border: 3px solid #fff; transition: .3s;
}
.home-box:hover { border-color: var(--primary); }
.home-box h2 { margin-bottom: 20px; color: var(--hp); }
.home-logo { font-size: 60px; animation: bounceHover 3s infinite; margin-bottom: 15px; cursor: pointer; transition: transform .2s; }
.home-logo:hover { transform: scale(1.2); }
.input-group input, .join-group input {
    width: 100%; margin: 10px 0; padding: 12px;
    border: 2px solid #eee; border-radius: 15px; text-align: center;
    outline: none; font-family: inherit; font-size: 16px; transition: .3s;
}
.input-group input:focus, .join-group input:focus {
    border-color: var(--primary); box-shadow: 0 0 10px rgba(255,182,193,.3);
}
.room-actions { margin-top: 25px; display: flex; flex-direction: column; gap: 15px; }
.join-group { display: flex; gap: 10px; justify-content: center; }
.join-group input { margin: 0; width: 140px; }

/* ═══ 等待大厅 ═══ */
.waiting-container { display: flex; height: 100vh; padding: 40px 50px; gap: 30px; animation: fadeIn .4s; }
.main-area { flex: 1; display: flex; flex-direction: column; background: #fff; border-radius: 25px; box-shadow: 0 10px 30px rgba(0,0,0,.05); padding: 30px; border: 3px solid #eee; }
.room-header { text-align: center; margin-bottom: 30px; }
.room-header h2 { color: var(--hp); margin-bottom: 10px; font-size: 28px; }
.room-code-display { font-size: 20px; font-weight: bold; background: #fdf6f6; display: inline-block; padding: 10px 25px; border-radius: 15px; border: 2px dashed var(--primary); }
.room-code-display span { color: #d63031; font-size: 24px; letter-spacing: 2px; margin-left: 5px; }
.players-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px; align-content: start; overflow-y: auto; padding: 10px; }
.player-slot { background: #fdfdfd; border: 3px solid #eee; border-radius: 15px; height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: .3s; position: relative; }
.player-slot.occupied { background: #fff; border-color: var(--primary); box-shadow: 0 5px 15px rgba(255,182,193,.2); }
.player-slot.empty { border-style: dashed; background: #f5f6fa; color: #b2bec3; }
.player-slot.host { border-color: #fdcb6e; box-shadow: 0 5px 15px rgba(253,203,110,.3); }
.player-slot .avatar { font-size: 45px; margin-bottom: 10px; }
.cute-bounce { animation: bounceHover 3s infinite; }
.player-slot .name { font-weight: bold; font-size: 15px; text-align: center; width: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-badge { position: absolute; top: -10px; right: -10px; background: #55efc4; color: var(--text); font-size: 12px; padding: 4px 10px; border-radius: 10px; font-weight: bold; box-shadow: 0 2px 5px rgba(0,0,0,.1); }
.host-badge { background: #ffeaa7; color: #d35400; left: -10px; right: auto; }
.action-buttons { display: flex; justify-content: center; gap: 20px; margin-top: 20px; padding-top: 20px; border-top: 2px dashed #eee; }

/* ═══ 聊天侧栏 ═══ */
.chat-sidebar { width: 320px; background: #fff; border: 3px solid #eee; border-radius: 25px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.05); }
.chat-header { background: #fdf6f6; padding: 15px; text-align: center; font-weight: bold; color: var(--hp); border-bottom: 2px solid #eee; }
.chat-messages { flex: 1; padding: 15px; overflow-y: auto; font-size: 14px; display: flex; flex-direction: column; gap: 12px; }
.chat-input { display: flex; border-top: 2px solid #eee; }
.chat-input input { flex: 1; border: none; padding: 12px; outline: none; font-family: inherit; font-size: 13px; }
.chat-input button { background: var(--primary); color: #fff; border: none; padding: 0 15px; font-family: inherit; font-weight: bold; cursor: pointer; }

/* 聊天气泡 */
.chat-bubble-container { display: flex; flex-direction: column; max-width: 80%; }
.chat-bubble-container.self { align-self: flex-end; align-items: flex-end; }
.chat-bubble-container.other { align-self: flex-start; align-items: flex-start; }
.chat-sender-name { font-size: 11px; color: #a0a0a0; margin-bottom: 3px; padding: 0 4px; }
.chat-bubble { padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.4; word-break: break-word; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.chat-bubble-container.self .chat-bubble { background: linear-gradient(135deg, #ffc3a0 0%, #ffafbd 100%); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble-container.other .chat-bubble { background: #fff; color: #2d3436; border: 1.5px solid #eee; border-bottom-left-radius: 4px; }
.msg.system { color: #b2bec3; font-size: 11px; text-align: center; align-self: center; background: #f1f2f6; padding: 6px 12px; border-radius: 12px; margin: 4px 0; }

/* ═══ 游戏对局 ═══ */
#page-game { display: none; }
#page-game.active { display: flex; }
.game-main { flex: 1; width: calc(100% - 300px); position: relative; display: flex; flex-direction: column; }
.opponents-area { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 15px 20px; max-height: 42vh; overflow-y: auto; align-content: flex-start; }
.player-card { background: #fff; border: 3px solid #eee; border-radius: 15px; width: 115px; padding: 8px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 5px 15px rgba(0,0,0,.05); transition: .3s; position: relative; flex-shrink: 0; }
.player-card.targetable:hover { border-color: var(--primary); transform: translateY(-8px) scale(1.05); }
.player-card.targeted { border-color: var(--hp) !important; transform: translateY(-8px) scale(1.05); box-shadow: 0 8px 20px rgba(255,118,117,.4); animation: pulseTarget 1.5s infinite; }
.player-card .name { font-weight: bold; margin-bottom: 4px; font-size: 12px; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-card .avatar { font-size: 28px; animation: bounceHover 3s infinite; }
.player-card .role { font-size: 17px; font-weight: bold; margin: 4px 0; }
.status-bar { width: 100%; height: 8px; border-radius: 4px; background: #eee; margin-top: 5px; position: relative; overflow: hidden; }
.status-hp { height: 100%; background: linear-gradient(90deg, #ff7675, #ff9a9e); transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.status-shield { height: 100%; position: absolute; top: 0; left: 0; background: linear-gradient(90deg, #74b9ff, #00cec9, #74b9ff); background-size: 200% 100%; animation: shieldShimmer 2s infinite linear; opacity: 0.9; transition: width 0.3s ease; border-radius: 4px; }
@keyframes shieldShimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.hand-count { position: absolute; bottom: -8px; right: -8px; background: var(--text); color: #fff; border-radius: 50%; width: 22px; height: 22px; line-height: 22px; text-align: center; font-size: 11px; font-weight: bold; }
.current-turn-indicator { position: absolute; top: -12px; left: -12px; background: #55efc4; color: #fff; border-radius: 50%; width: 26px; height: 26px; line-height: 26px; text-align: center; font-size: 13px; box-shadow: 0 2px 6px rgba(0,0,0,.2); z-index: 2; }
.board-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.deck-info { font-size: 15px; color: #636e72; background: #fff; padding: 6px 18px; border-radius: 15px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.action-area { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.timer-bar-bg { width: 280px; height: 10px; background: #eee; border-radius: 5px; overflow: hidden; }
.timer-bar-fill { height: 100%; }
.timer-active .timer-bar-fill { animation: timerShrink 30s linear forwards; }

/* ═══ 底部区域 ═══ */
.game-bottom { display: flex; align-items: flex-end; padding: 10px 20px 15px; gap: 20px; }
.self-area { flex-shrink: 0; }
.self-area .player-card { border: 4px solid var(--self); width: 135px; padding: 12px 10px; box-shadow: 0 0 15px rgba(79,172,254,.3); }
.hand-area { flex: 1; display: flex; justify-content: center; align-items: flex-end; padding: 30px 10px 0; overflow: visible; }
.poker-card { width: 78px; height: 112px; background: var(--card); border: 2px solid #ddd; border-radius: 8px; box-shadow: -3px 0 12px rgba(0,0,0,.1); display: flex; flex-direction: column; justify-content: center; align-items: center; font-size: 24px; font-weight: bold; transition: transform .3s, margin .3s, z-index 0s; margin-left: -25px; position: relative; cursor: pointer; flex-shrink: 0; }
.hand-area .poker-card:first-child { margin-left: 0; }
.poker-card:hover { transform: translateY(-15px); z-index: 10; border-color: var(--primary); margin: 0 6px; }
.poker-card.selected { transform: translateY(-20px) scale(1.05); border-color: var(--primary); z-index: 20; box-shadow: 0 10px 20px rgba(0,0,0,.15); margin: 0 10px; }
.card-joker { color: #8e44ad; }

#page-game:not(.spectator-mode) .spectator-notice { display: none; }
#page-game.spectator-mode .board-center .action-area,
#page-game.spectator-mode .hand-area { display: none; }
#page-game.spectator-mode .self-area .player-card { border-color: #b2bec3 !important; background: #f5f6fa !important; filter: grayscale(.8); box-shadow: none !important; }
.spectator-notice { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 24px; color: #b2bec3; font-weight: bold; letter-spacing: 2px; z-index: 5; }
.chat-box { width: 300px; background: #fff; border-left: 3px solid #eee; display: flex; flex-direction: column; overflow: hidden; }
.anim-layer { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 999; }

/* ═══ 结算 ═══ */
.result-container { display: flex; align-items: center; justify-content: center; height: 100vh; background: rgba(254,246,245,.95); }
.result-panel { background: #fff; padding: 40px 50px; border-radius: 30px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.15); border: 4px solid var(--primary); animation: popIn .5s cubic-bezier(.25,1,.5,1) forwards; }
.ribbon { font-size: 32px; color: var(--hp); font-weight: bold; margin-bottom: 30px; animation: floatTrophy 3s ease-in-out infinite; }
.stats-list { background: #fef9f9; padding: 25px 30px; border-radius: 15px; text-align: left; list-style: none; margin-bottom: 35px; border: 2px dashed var(--primary); }
.stats-list li { margin: 18px 0; font-size: 18px; display: flex; align-items: center; }
.stats-list .icon { font-size: 26px; margin-right: 15px; }
.stats-list .label { font-weight: bold; color: var(--text); margin-right: 15px; width: 120px; }
.stats-list .value { color: #d63031; font-weight: bold; }
.result-actions { display: flex; gap: 20px; justify-content: center; }

/* ═══ 弹窗 ═══ */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,.4); display: none; align-items: center; justify-content: center; z-index: 9999; }
.modal-overlay.show { display: flex; }
.modal-box { background: #fff; padding: 30px 40px; border-radius: 20px; box-shadow: 0 20px 50px rgba(0,0,0,.3); text-align: center; max-width: 400px; animation: popIn .3s; }
.modal-box h3 { color: var(--hp); margin-bottom: 15px; font-size: 22px; }
.modal-box p { margin-bottom: 20px; font-size: 16px; line-height: 1.6; }
/* Emoji picker */
.emoji-picker-box {
    background: #fff; padding: 20px; border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,.3); text-align: center;
    max-width: 380px; width: 95%; animation: popIn .3s;
}
.emoji-picker-box h3 { color: var(--hp); margin-bottom: 12px; }
.emoji-picker-box emoji-picker { width: 100%; max-height: 320px; }
.emoji-picker-box .btn { margin-top: 12px; }

/* ═══ Toast ═══ */
.toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 10001; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 24px; border-radius: 12px; font-size: 14px; font-weight: bold; color: #fff; opacity: 0; transform: translateY(-16px); transition: all .3s cubic-bezier(.4,0,.2,1); box-shadow: 0 4px 12px rgba(0,0,0,.15); white-space: nowrap; }
.toast.in { opacity: 1; transform: translateY(0); }
.toast.out { opacity: 0; transform: translateY(-16px); }
.toast-info { background: linear-gradient(135deg, #74b9ff, #a29bfe); }
.toast-error { background: linear-gradient(135deg, #ff7675, #d63031); }
.toast-success { background: linear-gradient(135deg, #55efc4, #00b894); }

/* ═══ 飘字 (Damage VFX) ═══ */
@keyframes floatUp { 0% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-40px) scale(1.3); } }
.damage-text, .heal-text { position: absolute; top: 0; left: 50%; transform: translateX(-50%); font-size: 20px; font-weight: 900; z-index: 10; pointer-events: none; opacity: 0; }
.damage-text.fly { animation: floatUp .8s ease-out forwards; color: #ff7675; text-shadow: 0 2px 6px rgba(255,118,117,.5); }
.heal-text.fly { animation: floatUp .9s ease-out forwards; color: #55efc4; text-shadow: 0 2px 8px rgba(85,239,196,.6); }

/* ═══ 受击震屏 ═══ */
@keyframes hitShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
.player-card.hit-shake { animation: hitShake .4s ease; box-shadow: 0 0 20px rgba(255,118,117,.7), 0 0 40px rgba(255,0,0,.3) !important; }

/* ═══ 回血翻转 ═══ */
@keyframes healFlip { 0% { transform: scale(1) rotateY(0deg); } 50% { transform: scale(1.3) rotateY(360deg); box-shadow: 0 0 20px #55efc4; } 100% { transform: scale(1) rotateY(720deg); } }
.player-card.heal-anim { animation: healFlip .7s ease; }

/* ═══ 发牌动画 ═══ */
@keyframes cardDeal { 0% { opacity: 0; transform: translate(200px, -100px) rotate(-30deg) scale(.5); } 100% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); } }
.poker-card.card-deal-anim { animation: cardDeal .4s cubic-bezier(.34,1.56,.64,1) var(--deal-delay, 0s) both; }

/* ═══ Loading ═══ */
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.7); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); z-index: 10002; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.loading-overlay.hidden { display: none; }
.spinner { width: 44px; height: 44px; border: 4px solid #eee; border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 16px; color: var(--text-muted); font-weight: bold; }

/* ═══ 悬浮图标按钮 ═══ */
.btn-icon { position: fixed; z-index: 10000; width: 40px; height: 40px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.4); color: #fff; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: .2s; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn-icon:hover { background: rgba(0,0,0,.6); transform: scale(1.1); }
#btn-fullscreen { top: 10px; right: 10px; }
#mobile-chat-toggle { top: 10px; right: 58px; display: none; }

/* ═══ 横屏锁定覆盖层 ═══ */
.orientation-prompt { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: var(--bg); z-index: 9999; flex-direction: column; justify-content: center; align-items: center; text-align: center; font-weight: bold; color: var(--text-muted); font-size: 16px; }
.rotate-icon { font-size: 40px; animation: spin 2s linear infinite; }

/* ═══ 聊天抽屉（移动端） ═══ */
.chat-box.show-mobile-chat { right: 0 !important; }
.chat-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 999; }
.chat-overlay.show { display: block; }

/* ──────── 📱 媒体查询 ──────── */

/* ═══ 竖屏：阻断操作 ═══ */
@media screen and (max-width: 900px) and (orientation: portrait) {
    .orientation-prompt { display: flex; }
    .page-view.active { display: none !important; }
}

/* ═══ 横屏低矮：极限压缩 ═══ */
@media screen and (max-height: 500px) {
    .player-card { width: 90px; padding: 3px; border-radius: 10px; }
    .player-card .avatar { font-size: 18px; }
    .player-card .name { font-size: 10px; margin-bottom: 1px; }
    .player-card .role { font-size: 12px; margin: 1px 0; }
    .status-bar { height: 4px; margin-top: 2px; }
    .hand-count { width: 16px; height: 16px; line-height: 16px; font-size: 9px; bottom: -5px; right: -5px; }
    .current-turn-indicator { width: 18px; height: 18px; line-height: 18px; font-size: 10px; top: -8px; left: -8px; }
    .self-area .player-card { width: 100px; padding: 5px; }
    .game-bottom { flex-direction: row; align-items: center; gap: 8px; padding: 4px 8px 6px; }
    .hand-area { padding-top: 15px; }
    .poker-card { width: 55px; height: 72px; font-size: 16px; margin-left: -18px; }
    .poker-card.selected { margin: 0 8px; }
    .poker-card:hover { margin: 0 4px; }
    .opponents-area { max-height: 30vh; gap: 4px; padding: 4px 8px; }
    .board-center { gap: 3px; }
    .deck-info { font-size: 10px; padding: 2px 8px; }
    .timer-bar-bg { width: 160px; height: 5px; }
    .btn { padding: 5px 12px; font-size: 12px; }
    .action-btns { gap: 6px; }
    .player-card .status-bar { height: 4px; }
    .player-card [style*="font-size:10px"] { font-size: 8px !important; }
    .char-dots span { width: 6px !important; height: 6px !important; }
}

/* ═══ 移动端横屏全面适配 ═══ */
@media screen and (max-width: 768px) and (orientation: landscape) {
    /* 主布局 */
    .game-main { width: 100%; }
    .game-bottom { padding: 4px 8px 6px; gap: 8px; }

    /* 对手区紧凑 */
    .opponents-area { max-height: 28vh; gap: 4px; padding: 4px 6px; }
    .player-card { width: 82px; padding: 3px; border-radius: 10px; border-width: 2px; }
    .player-card .avatar { font-size: 18px; }
    .player-card .name { font-size: 9px; margin-bottom: 1px; }
    .player-card .role { font-size: 12px; margin: 1px 0; }
    .player-card [style*="font-size:10px"] { font-size: 8px !important; }
    .status-bar { height: 4px; margin-top: 2px; }
    .hand-count { width: 16px; height: 16px; line-height: 16px; font-size: 8px; bottom: -5px; right: -5px; }
    .current-turn-indicator { width: 18px; height: 18px; line-height: 18px; font-size: 10px; top: -7px; left: -7px; }

    /* 自己区域 */
    .self-area .player-card { width: 95px; padding: 5px; border-width: 3px; }

    /* 手牌 */
    .hand-area { padding: 12px 5px 0; }
    .poker-card { width: 50px; height: 68px; font-size: 15px; margin-left: -16px; border-width: 1.5px; border-radius: 6px; }
    .poker-card.selected { transform: translateY(-16px) scale(1.05); margin: 0 6px; }
    .poker-card:hover { transform: translateY(-8px); margin: 0 3px; }

    /* 中央控制区 */
    .board-center { gap: 4px; }
    .deck-info { font-size: 10px; padding: 2px 8px; }
    .action-area { gap: 6px; }
    .action-btns { gap: 6px; }
    .timer-bar-bg { width: 140px; height: 5px; }
    .btn { padding: 5px 12px; font-size: 12px; border-radius: 16px; }

    /* 聊天抽屉 */
    .chat-box { width: 240px; }
    .chat-messages { font-size: 12px; padding: 8px; gap: 8px; }
    .chat-bubble { padding: 6px 10px; font-size: 12px; }

    /* 万化弹窗 */
    .wanhua-modal-content { max-width: 320px; }
    .combo-card-btn { padding: 8px 14px; min-width: 80px; }
    .combo-card-btn .suit-icon { font-size: 24px; }
    .combo-card-btn .suit-text { font-size: 11px; }
    .wanhua-value-section input { width: 55px; font-size: 14px; }

    /* 选将弹窗 */
    .starter-card { width: 75px; height: 105px; }
    .starter-card .starter-suit { font-size: 24px; }
    .starter-card .starter-rank { font-size: 18px; }
    .starter-card .starter-hp { font-size: 10px; }

    /* 飘字 VFX 缩小 */
    .vfx-popup { font-size: 22px; }

    /* 大厅 */
    .waiting-container { padding: 15px 20px; gap: 15px; }
    .main-area { padding: 15px; border-radius: 15px; }
    .players-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
    .player-slot { height: 120px; border-radius: 12px; }
    .player-slot .avatar { font-size: 32px; }
    .room-header h2 { font-size: 20px; }
    .room-code-display { font-size: 16px; padding: 6px 15px; }
}

/* ═══ 移动端聊天抽屉 ═══ */
@media screen and (max-width: 900px) {
    .chat-box { position: fixed; top: 0; right: -320px; width: 300px; height: 100vh; z-index: 1000; transition: right .3s cubic-bezier(.4,0,.2,1); box-shadow: -5px 0 15px rgba(0,0,0,.1); }
    .chat-sidebar { position: fixed; top: 0; right: -320px; width: 300px; height: 100vh; z-index: 1000; transition: right .3s cubic-bezier(.4,0,.2,1); box-shadow: -5px 0 15px rgba(0,0,0,.1); }
    .chat-sidebar.show-mobile-chat { right: 0 !important; }
    .game-main { width: 100%; }
    #mobile-chat-toggle { display: flex; }
}

/* ═══ 防误触 ═══ */
@media (hover: none) and (pointer: coarse) {
    .poker-card:hover { transform: none; margin: 0; }
    .poker-card.selected { transform: translateY(-25px) scale(1.08); margin: 0 18px; z-index: 100; border-color: var(--primary); box-shadow: 0 0 20px rgba(255,182,193,.6), 0 12px 30px rgba(0,0,0,.2); }
    .poker-card { margin-left: -20px; }
}

/* ═══ 夸张战斗飘字 ═══ */
.vfx-popup {
    position: absolute; top: 20%; left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    font-size: 32px; font-weight: 900;
    text-shadow: 0 0 10px rgba(0,0,0,0.8), 0 4px 6px rgba(0,0,0,0.5);
    pointer-events: none; z-index: 9999;
    animation: vfxPopUp 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.vfx-dmg { color: #ff4757; }
.vfx-shd { color: #2ed573; }

@keyframes vfxPopUp {
    0% { transform: translate(-50%, -20%) scale(0.5); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    80% { transform: translate(-50%, -80%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -120%) scale(1); opacity: 0; }
}

@keyframes cardShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
.card-shake { animation: cardShake 0.4s ease-in-out; border-color: #ff4757 !important; }

/* ═══ 万化组合方案弹窗 ═══ */
.combo-item { background: #fdf6f6; border: 2px solid #eee; border-radius: 15px; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; transition: all 0.2s ease; }
.combo-item:hover { border-color: var(--primary); background: #fff; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(255,182,193,0.3); }
.combo-cards-preview { display: flex; gap: 6px; }
.mini-poker-card { width: 40px; height: 58px; background: white; border: 1.5px solid #ddd; border-radius: 6px; display: flex; flex-direction: column; justify-content: center; align-items: center; font-size: 14px; font-weight: bold; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

/* ═══ 智能提示呼吸灯 ═══ */
@keyframes suggestPulse {
    0% { border-color: #ffeaa7; box-shadow: 0 0 3px #ffeaa7; }
    50% { border-color: #fdcb6e; box-shadow: 0 0 8px #fdcb6e; }
    100% { border-color: #ffeaa7; box-shadow: 0 0 3px #ffeaa7; }
}
.poker-card.suggested { animation: suggestPulse 2s infinite; }

/* ═══ Bug4: 选将弹窗 ═══ */
.starter-card {
    width: 100px; height: 140px; background: white; border: 3px solid #ddd; border-radius: 12px;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    cursor: pointer; transition: all 0.2s ease; font-weight: bold; box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}
.starter-card:hover { border-color: var(--primary); transform: translateY(-5px); box-shadow: 0 8px 20px rgba(255,182,193,0.4); }
.starter-card .starter-suit { font-size: 32px; }
.starter-card .starter-rank { font-size: 24px; margin-top: 5px; }
.starter-card .starter-hp { font-size: 12px; color: #636e72; margin-top: 5px; }

/* ═══ Bug3: 濒死弹窗 ═══ */
#modal-dying .modal-box { border: 3px solid #ff4757; animation: dyingPulse 1s infinite; }
@keyframes dyingPulse { 0%,100% { box-shadow: 0 0 10px rgba(255,71,87,0.3); } 50% { box-shadow: 0 0 30px rgba(255,71,87,0.6); } }

/* ═══ 万化浸染弹窗 ═══ */
.action-btns { display: flex; gap: 10px; align-items: center; }
.btn-ghost { background: transparent; border: 2px dashed var(--primary); color: var(--primary); }
.btn-ghost:hover { background: rgba(255,182,193,0.15); }

.wanhua-modal-content { max-width: 480px; width: 90%; text-align: center; }
.wanhua-header h3 { margin: 0 0 6px; font-size: 20px; }
.wanhua-header p { color: #888; font-size: 13px; margin: 0 0 15px; }

.wanhua-suit-options { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 15px 0; }
.combo-card-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 14px 20px; border: 2px solid #eee; border-radius: 14px;
    background: #fdf6f6; cursor: pointer; transition: all .18s ease;
    font-family: inherit; min-width: 100px;
}
.combo-card-btn:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 5px 14px rgba(255,182,193,.35); }
.combo-card-btn.active { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(255,182,193,.4), 0 5px 14px rgba(255,182,193,.4); }
.combo-card-btn .suit-icon { font-size: 30px; line-height: 1; }
.combo-card-btn .suit-icon.red { color: #dc2626; }
.combo-card-btn .suit-icon.black { color: #1e293b; }
.combo-card-btn .suit-text { font-size: 13px; font-weight: bold; color: #555; }

.wanhua-value-section { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 15px 0; font-size: 14px; }
.wanhua-value-section input {
    width: 70px; padding: 6px 10px; border: 2px solid var(--primary); border-radius: 8px;
    font-family: inherit; font-size: 15px; text-align: center; outline: none;
}
.wanhua-actions { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }
