/* 力争·上游 - 深色主题高级感样式设计 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a7c59;
    --secondary-color: #2c5530;
    --accent-color: #8fbc8f;
    --dark-bg: #0f1a15;
    --card-bg: rgba(30, 45, 35, 0.8);
    --text-light: #e8f5e8;
    --text-muted: #a5d6a7;
    --success: #48bb78;
    --warning: #ffb74d;
    --danger: #f56565;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: "Microsoft Yahei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #0a120e 0%, #15231a 50%, #1e3528 100%);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-light);
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 移动端触摸优化 */
@media (hover: none) and (pointer: coarse) {
    .card {
        touch-action: manipulation;
    }

    .lobby-btn, .lobby-join-btn, .lobby-input {
        min-height: 40px; /* 最小触摸目标尺寸 */
    }
}

/* ===== 大厅（首页）样式：横屏优先，标题区 + 双列操作区 ===== */
.lobby-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    background: linear-gradient(135deg, #2c5530 0%, #1e3528 100%);
    border: 2px solid rgba(143, 188, 143, 0.3);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    color: var(--text-light);
    padding: 18px 26px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.lobby-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
}

.lobby-title {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 5px;
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.lobby-help-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 7px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(15, 26, 21, 0.75);
    color: var(--text-light);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.lobby-help-btn:hover {
    border-color: var(--accent-color);
}

.lobby-columns {
    display: flex;
    gap: 26px;
    flex: 1;
    min-height: 0;
}

.lobby-panel {
    flex: 1;
    min-width: 0;
    background: rgba(15, 26, 21, 0.55);
    border: 2px solid rgba(143, 188, 143, 0.28);
    border-radius: 20px;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.lobby-panel-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-color);
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(143, 188, 143, 0.25);
}

.lobby-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lobby-field label {
    font-size: 13px;
    color: var(--text-muted);
}

.lobby-input {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1.5px solid rgba(143, 188, 143, 0.35);
    background: rgba(20, 30, 25, 0.75);
    color: var(--text-light);
    font-size: 15px;
    transition: var(--transition);
    width: 100%;
    box-sizing: border-box;
}

.lobby-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(143, 188, 143, 0.2);
}

.lobby-btn {
    margin-top: auto;
    padding: 13px 20px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 3px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.lobby-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.lobby-btn:disabled {
    background: rgba(100, 100, 100, 0.5);
    color: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: none;
    cursor: not-allowed;
}

/* 房间搜索框 */
.lobby-search-wrap {
    position: relative;
}

.lobby-search-wrap::before {
    content: '🔍';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    opacity: 0.7;
    pointer-events: none;
}

.lobby-search-wrap .lobby-input {
    padding-left: 34px;
}

/* 房间列表：固定行数，超出以省略号行收尾 */
.lobby-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.lobby-room {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(143, 188, 143, 0.25);
    border-radius: 12px;
    padding: 10px 14px;
    flex: 0 0 auto;
    transition: var(--transition);
}

.lobby-room:not(.lobby-room-more):hover {
    border-color: rgba(143, 188, 143, 0.55);
    background: rgba(255, 255, 255, 0.1);
}

.lobby-room-id {
    font-weight: 700;
    font-size: 17px;
    color: var(--accent-color);
    min-width: 60px;
    letter-spacing: 1px;
}

.lobby-room-info {
    flex: 1;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lobby-join-btn {
    padding: 7px 16px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    flex: 0 0 auto;
}

.lobby-join-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.lobby-join-btn:disabled {
    background: rgba(100, 100, 100, 0.5);
    color: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: none;
    cursor: not-allowed;
}

.lobby-room-more {
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    letter-spacing: 3px;
    border-style: dashed;
    cursor: default;
}

.lobby-empty {
    margin: auto;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    line-height: 2;
}

/* ===== 游戏页面样式（按 cardgame排版设计.pptx：顶部横条 + 四家落牌区） ===== */
/* 视觉降噪：牌桌内仅两种边框语言——白色描边（普通）、金色描边（回合/操作） */
.game-container {
    position: relative;
    max-width: 1000px;
    width: 100%;
    background: linear-gradient(135deg, #2c5530 0%, #1e3528 100%);
    border-radius: 24px;
    padding: 10px 14px 12px;
    box-shadow: var(--shadow-lg);
    border: 2px solid rgba(143, 188, 143, 0.3);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- 顶部信息横条：房间信息 / 玩法说明 / 玩家3 / 队伍比分 --- */
.top-bar {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 40px;
}

.corner-badge {
    padding: 4px 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(15, 26, 21, 0.75);
    color: var(--text-light);
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.corner-badge:hover {
    border-color: var(--accent-color);
}

#leaveRoomBtn {
    color: #ffc9c2;
    flex: 0 0 auto;
}

/* 房间信息：紧凑横排，左侧两行文字 + 内嵌退出按钮 */
.room-info-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 26, 21, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--text-light);
    line-height: 1.4;
}

.room-info-text {
    white-space: nowrap;
}

#helpBtn {
    flex: 0 0 auto;
    align-self: center;
}

/* 队伍比分面板：常驻直接显示，紧凑两行 */
.score-drawer {
    display: block;
    margin-left: auto;
    background: rgba(15, 26, 21, 0.75);
    border: 1px solid rgba(143, 188, 143, 0.4);
    border-radius: 10px;
    padding: 4px 10px;
    z-index: 50;
    text-align: left;
    font-size: 11px;
    line-height: 1.5;
}

#teamScores {
    text-align: center;
    font-size: 12px;
}

/* --- 玩家胶囊卡：贴边浮动 --- */
.player-chip {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.94);
    color: #2a3a2e;
    border-radius: 16px;
    padding: 6px 16px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    box-shadow: var(--shadow-sm);
    z-index: 10;
    transition: var(--transition);
    text-align: center;
}

/* 玩家3：屏幕顶部正中央（绝对定位同时保证内部角标以其为锚点） */
.chip-top {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    gap: 10px;
    align-items: baseline;
    border-radius: 999px;
    z-index: 20;
}

/* 顶条其余元素：房间信息靠左，玩法说明紧随其右，队伍比分推到最右侧 */
#scoreDrawer { margin-left: auto; }

/* 左右家信息胶囊上提，与各自落牌区（34%）上下错开，避免遮挡出牌 */
.chip-left { left: 6px; top: 8%; }
.chip-right { right: 6px; top: 8%; }

.player-chip .player-name,
.me-chip .player-name {
    font-weight: 600;
    font-size: 13px;
    color: #2f4a35;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    word-break: break-all;
}

.player-chip .card-count,
.me-chip .card-count {
    font-size: 14px;
    font-weight: 700;
    color: #c0392b;
    white-space: nowrap;
    line-height: 1.4;
}

/* 回合高亮：金色描边 + 出牌中角标 + 呼吸光晕 */
.player-chip.turn-active {
    border-color: #e9b100;
    background: #fff6da;
    animation: chipPulse 1.6s ease-in-out infinite;
}

.player-chip.turn-active::after {
    content: '出牌中';
    position: absolute;
    top: -9px;
    right: -8px;
    background: #e9b100;
    color: #3d2c00;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

@keyframes chipPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
    50% { box-shadow: 0 0 14px 2px rgba(255, 215, 0, 0.45); }
}

/* 过牌标记：就地显示在对应玩家卡上 */
.pass-badge {
    display: none;
    position: absolute;
    top: -8px;
    left: -6px;
    background: linear-gradient(135deg, var(--danger), #e53e3e);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    z-index: 12;
}

/* 房主设/移电脑的小按钮 */
.bot-control button {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 6px;
    border: 1px solid rgba(60, 90, 65, 0.5);
    background: #4a7c59;
    color: white;
    cursor: pointer;
    margin-top: 2px;
}

/* --- 中部牌桌区：四家落牌区 + 左右玩家 + 分数牌 + 中央提示 --- */
.table-mid {
    position: relative;
    flex: 1;
    min-height: 300px;
}

/* 落牌区：无边框无底纹，仅作为各家出牌的落点范围 */
.play-zone {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    min-width: 120px;
    min-height: 64px;
}

.zone-top    { left: 50%; top: 4px; transform: translateX(-50%); }
.zone-left   { left: 118px; top: 34%; }
.zone-right  { right: 118px; top: 34%; }
.zone-bottom { left: 50%; bottom: 6px; transform: translateX(-50%); }

/* 落牌与手牌区牌面同尺寸，保证各家出牌清晰可读 */
.play-zone .card {
    min-width: 58px;
    min-height: 80px;
    font-size: 24px;
}

/* 中央提示与结算覆盖层：不拦截点击；垂直居中，与三号位顶部落牌区错位 */
.table-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.table-banner {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.turn-prompt {
    background: rgba(143, 188, 143, 0.2);
    padding: 4px 12px;
    border-radius: 16px;
    font-weight: 600;
    color: var(--accent-color);
    font-size: 12px;
}

.turn-prompt:empty { display: none; }

/* Bot 思考中提示呼吸闪烁 */
.turn-prompt.thinking { animation: pulse 1.2s ease-in-out infinite; }

/* 组队模式分数牌展示区：左下角（玩家4落牌区下方） */
.score-card-box {
    position: absolute;
    left: 6px;
    bottom: 6px;
    background: rgba(20, 32, 24, 0.7);
    border: 1px solid rgba(143, 188, 143, 0.3);
    color: var(--text-light);
    padding: 8px 12px;
    border-radius: 12px;
    text-align: left;
    font-size: 13px;
}

/* --- 手牌区：左端并入我的信息胶囊 --- */
.hand-bar {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 14px;
    min-height: 118px;
    padding: 10px 14px;
    background: rgba(15, 26, 21, 0.45);
    border: 2px solid rgba(143, 188, 143, 0.3);
    border-radius: 18px;
    transition: var(--transition);
}

.hand-bar.my-turn {
    border-color: rgba(255, 215, 0, 0.85);
}

/* 结算时压暗手牌区 */
body.game-ended .hand-bar {
    opacity: 0.45;
}

.me-chip {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.94);
    color: #2a3a2e;
    border-radius: 14px;
    padding: 6px 14px;
    border: 2px solid rgba(255, 215, 0, 0.5);
    position: relative;
    text-align: center;
    align-self: center;
}

.hand-cards {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    white-space: nowrap;
    /* 预留预选上浮空间（约 12px + 余量），避免 overflow-x:auto 连带纵向裁切选中牌 */
    min-height: 100px;
    padding-top: 4px;
    overflow-x: auto;
}

.hand-cards::-webkit-scrollbar { height: 5px; }
.hand-cards::-webkit-scrollbar-thumb { background: rgba(143, 188, 143, 0.5); border-radius: 3px; }
.hand-cards::-webkit-scrollbar-track { background: rgba(143, 188, 143, 0.2); border-radius: 3px; }

/* --- 浮动操作按钮：开局后仅轮到我时在我的落牌区右侧弹出 --- */
.action-float {
    position: absolute;
    /* 在我落牌区右侧基础上再右移约 1.5 个按钮宽，远离右手手牌 */
    left: calc(66% + 130px);
    transform: translateX(-50%);
    /* 手牌区加高后（约128px）需同步上移，保持按钮与手牌区上缘有足够间距 */
    bottom: 148px;
    z-index: 30;
    width: max-content;
    max-width: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* 未开局：准备/开始按钮放在牌桌正中央 */
.action-float.pre-game {
    left: 50%;
    bottom: auto;
    top: 45%;
}

/* 一局结束后：准备/开始按钮移到结算面板下方，并高于结算面板层级，保证可见可点 */
.action-float.post-game {
    top: auto;
    bottom: 150px;
    left: 50%;
    z-index: 120;
}

.action-float.hidden {
    opacity: 0;
    pointer-events: none;
}

.action-float:not(.pre-game).hidden {
    transform: translateX(-50%) translateY(10px);
}

.action-float.pre-game.hidden {
    transform: translateX(-50%) translateY(10px);
}

.action-float .button-container {
    /* 去掉外框胶囊，按钮直接浮在牌桌上；按钮固定单行不换行 */
    background: transparent;
    border: none;
    padding: 0;
    gap: 12px;
    flex-wrap: nowrap;
}

/* 操作按钮：圆倒角长方形（非正圆），可用时为炫金配色，与绿色牌桌形成高对比 */
.action-float .button-container button {
    min-width: 78px;
    height: 46px;
    min-height: 46px;
    padding: 0 20px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
}

.action-float .button-container button:not(:disabled) {
    background: linear-gradient(135deg, #fff3b0 0%, #ffd700 30%, #f5b301 65%, #e89b00 100%);
    color: #4a2f00;
    border: 1px solid rgba(255, 240, 180, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35), 0 0 14px rgba(255, 215, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.65);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.action-float .button-container button:not(:disabled):hover {
    background: linear-gradient(135deg, #fff7c4 0%, #ffe14d 30%, #ffc21a 65%, #f0a800 100%);
}

.action-float .button-container button:disabled {
    background: rgba(100, 100, 100, 0.5);
    color: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* 我回合的操作按钮不加动态效果（保留 Bot 等其他玩家"思考中"呼吸提示） */

.button-container {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.button-container button {
    padding: 8px 20px;
    font-size: 1em;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    color: white;
    box-shadow: var(--shadow-sm);
}

.button-container button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.button-container button:disabled {
    background: rgba(100, 100, 100, 0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 房主开始游戏按钮下方的等待提示（独占一行，避免挤占按钮布局） */
.action-float .button-container .start-tip {
    flex-basis: 100%;
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    margin-top: 6px;
}

.card {
    /* max-width: 60px; */
    min-width: 58px;
    /* max-height: 85px; */
    min-height: 80px;
    background: linear-gradient(145deg, #f8faf8, #e8f5e8);
    border-radius: 8px;
    border: 2px solid rgba(143, 188, 143, 0.5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 3px 3px 10px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 5px 5px 15px rgba(0,0,0,0.4);
    border-color: var(--accent-color);
}

.card.selected {
    transform: translateY(-8px) scale(1.05);
    border-color: gold;
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5);
}

.card[data-suit="♥"], .card[data-suit="♦"] {
    color: #e53e3e;
}

.card[data-suit="♠"], .card[data-suit="♣"] {
    color: #1a1a1a;
}

/* 分数牌样式 */
.score-card {
    width: 42px; /* 60px * 70% */
    height: 59.5px; /* 85px * 70% */
    font-size: 14px; /* 20px * 70% */
    cursor: default;
}

.score-card:hover {
    transform: none;
    box-shadow: 3px 3px 10px rgba(0,0,0,0.3);
    border-color: rgba(143, 188, 143, 0.5);
}

.score-card.selected {
    transform: none;
    border-color: rgba(143, 188, 143, 0.5);
    box-shadow: 3px 3px 10px rgba(0,0,0,0.3);
}

.error-toast {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--danger), #e53e3e);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 10000;
    animation: fadeOut 3s forwards;
    box-shadow: var(--shadow-lg);
    font-weight: 600;
}

@keyframes fadeOut {
    0% { opacity: 1; transform: translateX(-50%) translateY(0); }
    70% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-15px); display: none; }
}

.game-result {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 45, 35, 0.95);
    color: var(--text-light);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    min-width: 260px;
    text-align: center;
    font-size: 15px;
    line-height: 1.6;
    border: 2px solid var(--accent-color);
    backdrop-filter: blur(15px);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: rgba(30, 45, 35, 0.95);
    margin: 8% auto;
    padding: 25px;
    border-radius: var(--border-radius);
    width: 65%;
    max-height: 65%;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 2px solid rgba(143, 188, 143, 0.4);
    backdrop-filter: blur(15px);
}

.close {
    color: var(--text-muted);
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    color: var(--accent-color);
}

#helpText {
    white-space: pre-wrap;
    font-family: "Courier New", monospace;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-light);
}

/* 响应式设计 - 移动端优化 */

/* 手机竖屏模式 - 主要用于首页 */
/* 手机横屏/竖屏适配已由 JS 整体缩放 + 旋转引导方案接管（scaled-mode / #rotateHint），
   旧的分辨率媒体查询会导致内容溢出被裁剪，故移除。
   首页（大厅）与游戏页共用同一套方案。 */

/* 加载动画 */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ===== 移动端整体缩放模式（JS 驱动，见 game.js fitGameToViewport） ===== */
/* 触摸设备横屏时：牌桌按 1000px 设计宽度渲染，再整体 scale 到刚好铺满屏幕，
   保证所有机型完整可见、无滚动条。PC 端不进入此模式，布局完全不变。 */
body.scaled-mode {
    padding: 0;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* 动态视口高度，跟随手机地址栏伸缩 */
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

body.scaled-mode .game-container {
    width: 1000px;
    max-width: 1000px;
    max-height: none;
    flex: 0 0 auto;
    transform: scale(var(--gs, 1));
    transform-origin: center center;
}

/* 大厅（首页）在触摸设备横屏时同样按 1000×620 设计尺寸整体缩放 */
body.scaled-mode .lobby-container {
    width: 1000px;
    max-width: 1000px;
    height: 620px;
    flex: 0 0 auto;
    transform: scale(var(--gs, 1));
    transform-origin: center center;
}

/* ===== 竖屏旋转引导遮罩 ===== */
#rotateHint {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: linear-gradient(135deg, #0a120e 0%, #15231a 50%, #1e3528 100%);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    color: var(--text-light);
    text-align: center;
}

body.is-portrait-mobile #rotateHint {
    display: flex;
}

.rotate-phone {
    width: 42px;
    height: 70px;
    border: 3px solid var(--accent-color);
    border-radius: 8px;
    position: relative;
    animation: rotatePhoneAnim 1.8s ease-in-out infinite;
}

.rotate-phone::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 3px;
    border-radius: 2px;
    background: var(--accent-color);
}

@keyframes rotatePhoneAnim {
    0%, 25% { transform: rotate(0deg); }
    60%, 100% { transform: rotate(90deg); }
}

.rotate-title {
    font-size: 18px;
    font-weight: 600;
}

.rotate-sub {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== 触摸设备反馈补充（hover 在触屏上无效，用 :active 等价反馈） ===== */
@media (hover: none) and (pointer: coarse) {
    .card:active {
        transform: translateY(-3px);
        border-color: var(--accent-color);
    }

    .card.selected:active {
        transform: translateY(-8px) scale(1.05);
    }

    .button-container button:active:not(:disabled) {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
    }

    .player-chip:active, .me-chip:active {
        transform: translateY(-2px);
    }
}