/* 银河牌局 V2.0 - 游戏样式 */

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

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 50%, #0a0a2a 100%);
    min-height: 100vh;
    color: #fff;
}

/* ========== 大厅屏幕 ========== */
#lobbyScreen {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
}

.lobby-header {
    text-align: center;
    margin-bottom: 30px;
}

.game-title {
    font-size: 48px;
    color: #0ff;
    text-shadow: 0 0 30px rgba(0,255,255,0.5);
    margin-bottom: 10px;
}

.game-title .version {
    font-size: 24px;
    color: #ffd700;
}

.game-subtitle {
    color: #888;
    font-size: 16px;
    letter-spacing: 2px;
}

/* 玩家信息栏 */
.player-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.05);
    border-radius: 15px;
    padding: 15px 25px;
    margin-bottom: 40px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-avatar {
    font-size: 28px;
}

.player-name {
    font-size: 18px;
    font-weight: bold;
}

.player-currency {
    display: flex;
    gap: 20px;
}

.currency-item {
    background: rgba(0,0,0,0.3);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
}

.nav-links {
    display: flex;
    gap: 15px;
}

.nav-link {
    color: #0ff;
    text-decoration: none;
    padding: 8px 20px;
    border: 1px solid rgba(0,255,255,0.3);
    border-radius: 20px;
    transition: all 0.3s;
}

.nav-link:hover {
    background: rgba(0,255,255,0.1);
    border-color: #0ff;
}

/* 模式选择 */
.mode-select {
    margin-bottom: 40px;
    position: relative;
    z-index: 950;
}

.mode-title {
    text-align: center;
    font-size: 24px;
    color: #fff;
    margin-bottom: 30px;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 25px;
}

.mode-card {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid rgba(0,255,0,0.5);
    border-radius: 20px;
    padding: 30px 25px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    max-width: 320px;
    margin: 0 auto;
    position: relative;
    z-index: 100;
}

.mode-card:hover {
    transform: translateY(-8px);
    border-color: #0f0;
    box-shadow: 0 15px 40px rgba(0,255,0,0.2);
}

/* 顶部标签 */
.mode-tag {
    display: inline-block;
    background: rgba(0,255,0,0.15);
    color: #0f0;
    font-size: 13px;
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(0,255,0,0.3);
}

/* 卡牌预览 */
.mode-card-preview {
    margin-bottom: 20px;
}

.mini-card {
    width: 60px;
    height: 84px;
    background: linear-gradient(135deg, #fff, #f0f0f0);
    border: 2px solid #333;
    border-radius: 8px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    color: #333;
}

.mini-card-rank {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 14px;
    font-weight: bold;
}

.mini-card-suit {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 12px;
}

.mini-card-icon {
    font-size: 28px;
}

.mode-name {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #fff;
}

.mode-desc {
    color: #888;
    font-size: 14px;
    margin-bottom: 20px;
}

.mode-features {
    text-align: left;
    list-style: none;
    margin-bottom: 15px;
    padding-left: 10px;
}

.mode-features li {
    color: #ccc;
    font-size: 13px;
    padding: 5px 0;
    line-height: 1.5;
}

.mode-features li::before {
    content: "• ";
    color: #0ff;
}

.mode-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.mode-badge.beginner { background: rgba(0,255,0,0.2); color: #0f0; }
.mode-badge.standard { background: rgba(0,255,255,0.2); color: #0ff; }
.mode-badge.ranked { background: rgba(255,215,0,0.2); color: #ffd700; }
.mode-badge.custom { background: rgba(255,100,255,0.2); color: #ff64ff; }

/* 规则面板 */
.rules-panel {
    background: rgba(255,255,255,0.03);
    border-radius: 20px;
    padding: 30px;
}

.rules-panel h3 {
    text-align: center;
    margin-bottom: 25px;
    color: #0ff;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.rule-item {
    text-align: center;
    padding: 20px;
    background: rgba(0,0,0,0.2);
    border-radius: 15px;
}

.rule-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.rule-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.rule-desc {
    color: #888;
    font-size: 13px;
}

/* ========== 游戏屏幕 ========== */
#gameScreen {
    display: grid;
    grid-template-rows: auto auto 1fr auto auto;
    min-height: 100vh;
    padding: 10px;
    gap: 8px;
    max-width: 1100px;
    margin: 0 auto;
}

/* 游戏标题栏（参考新手模式） */
.game-title-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 24px;
    background: linear-gradient(180deg, rgba(0,20,50,0.9), rgba(0,10,30,0.7));
    border-bottom: 1px solid rgba(0,255,255,0.15);
}

.title-icon {
    font-size: 32px;
    filter: drop-shadow(0 0 8px rgba(100,180,255,0.5));
}

.title-main {
    font-size: 26px;
    font-weight: bold;
    color: #fff;
    margin: 0;
    letter-spacing: 2px;
}

.title-mode {
    color: #a78bfa;
    font-weight: normal;
}

.title-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.title-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.title-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.4);
    transform: scale(1.1);
}

.game-subtitle-bar {
    text-align: center;
    padding: 6px 0;
    font-size: 13px;
    color: #999;
    background: rgba(0,10,25,0.5);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* 顶部信息栏 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 6px 16px;
}

.game-mode-badge {
    background: rgba(0,255,255,0.2);
    color: #0ff;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
}

.turn-info {
    color: #fff;
    margin-left: 20px;
}

.game-actions {
    display: flex;
    gap: 10px;
}

.header-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.header-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* 能量条 */
.energy-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 0;
}

.energy-slot {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.energy-pip {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #0ff;
    transition: all 0.3s;
}

.energy-pip.filled {
    background: radial-gradient(circle, #0ff, #08f);
    box-shadow: 0 0 15px #0ff;
}

.energy-pip.empty {
    background: rgba(0,255,255,0.1);
}

.energy-cap {
    color: #0ff;
    font-size: 14px;
    font-weight: bold;
    margin-left: 8px;
}

.energy-overflow {
    color: #ffd700;
    font-size: 18px;
    font-weight: bold;
    margin-left: 10px;
}

/* 分支选择面板 - 右侧折叠 */
.branch-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 900;
    display: flex;
}

/* 折叠按钮（圆形悬浮图标） */
.branch-toggle {
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(0,180,255,0.2), rgba(0,80,120,0.4));
    border: 2px solid rgba(0,255,255,0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
    color: #0ff;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0,255,255,0.15);
}

.branch-toggle:hover {
    background: linear-gradient(135deg, rgba(0,220,255,0.35), rgba(0,120,180,0.5));
    box-shadow: 0 0 20px rgba(0,255,255,0.3), 0 0 40px rgba(0,255,255,0.1);
    transform: translateY(-50%) scale(1.1);
}

/* 展开的面板主体（默认隐藏） */
.branch-body {
    width: 260px;
    height: 100vh;
    background: rgba(5, 10, 25, 0.97);
    border-left: 2px solid rgba(0,255,255,0.3);
    padding: 20px 16px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

/* 展开状态 */
.branch-panel.open .branch-body {
    transform: translateX(0);
}

.branch-panel.open .branch-toggle {
    background: linear-gradient(180deg, rgba(0,255,255,0.25), rgba(0,120,180,0.35));
    border-color: #0ff;
}

.branch-title {
    text-align: center;
    font-size: 16px;
    color: #ffd700;
    margin-bottom: 4px;
    font-weight: bold;
}

.branch-subtitle {
    text-align: center;
    font-size: 11px;
    color: #888;
    margin-bottom: 16px;
}

.branch-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.branch-option {
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(0,255,255,0.2);
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
}

.branch-option:hover {
    border-color: #0ff;
    background: rgba(0,255,255,0.08);
    transform: scale(1.04);
    box-shadow: 0 0 12px rgba(0,255,255,0.15);
}

.branch-icon { font-size: 24px; margin-bottom: 4px; }
.branch-name { font-size: 12px; font-weight: bold; margin-bottom: 2px; color: #ddd; }
.branch-desc { color: #777; font-size: 10px; }

/* 主游戏区域 - 紧凑布局：玩家在前AI在后 */
.game-area {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 12px;
    align-items: start;
}

/* 玩家/对手卡片 */
.player-card {
    background: rgba(0,0,0,0.4);
    border-radius: 12px;
    padding: 12px;
    border: 2px solid transparent;
}

.player-card.player { 
    border-color: rgba(0,255,0,0.4); 
    transform: scale(1.05);
    transform-origin: center bottom;
}
.player-card.ai { 
    border-color: rgba(255,60,60,0.25); 
    opacity: 0.85;
}

.player-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.player-avatar { font-size: 22px; }
.player-name { font-size: 14px; font-weight: bold; }

.player-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 8px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 10px;
    color: #888;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
}

.level-bar {
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.level-fill {
    height: 100%;
    background: linear-gradient(90deg, #0f0, #0ff);
    transition: width 0.5s;
}

/* 手牌区域 */
.player-hand, .ai-hand {
    margin-top: 8px;
}

.hand-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 6px;
}

.hand-cards {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding: 3px;
}

/* 手牌样式 */
.card {
    width: 78px;
    height: 110px;
    background: linear-gradient(135deg, #2a2a4a, #1a1a3a);
    border: 2px solid #0ff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 5px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    flex-shrink: 0;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,255,255,0.3);
}

.card.selected {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255,215,0,0.5);
}

/* 顶部：点数+花色 左右排列 */
.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 5px;
    margin-bottom: 1px;
}

.card-top .card-rank {
    font-size: 14px;
    font-weight: bold;
}

.card-top .card-suit {
    font-size: 12px;
}

/* 卡牌大图标（占卡片中间） */
.card-icon {
    font-size: 34px;
    line-height: 1;
    margin: 1px 0 2px;
    display: block;
}

/* 花色符号 fallback 图标 - 大号彩色花色 */
.card-icon-fallback {
    font-size: 38px;
    opacity: 0.85;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.card.spade .card-icon-fallback { color: #64b5f6; }
.card.heart .card-icon-fallback  { color: #ef5350; }
.card.diamond .card-icon-fallback { color: #ffd54f; }
.card.club .card-icon-fallback   { color: #81c784; }

.card-name {
    font-size: 8px;
    color: #ccc;
    text-align: center;
    line-height: 1.1;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    padding: 0 2px;
}

.card.spade { border-color: #4a9; }
.card.heart { border-color: #f44; }
.card.diamond { border-color: #48f; }
.card.club { border-color: #a8a; }

/* AI手牌（背面）- 居中好看图标 */
.card.face-down {
    background: linear-gradient(145deg, #1a1a3e, #0d0d25);
    border-color: #334;
    justify-content: center !important;
    padding-top: 0 !important;
}

.card.face-down .card-suit::before {
    content: "🌌";
    font-size: 36px;
    filter: drop-shadow(0 0 8px rgba(100,150,255,0.5));
}

.card.face-down .card-top,
.card.face-down .card-icon,
.card.face-down .card-name,
.card.face-down .card-cost {
    display: none !important;
}

/* 中央区域 */
.center-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.deck-area {
    display: flex;
    gap: 20px;
    margin-bottom: 8px;
}

.deck, .discard-pile {
    width: 68px;
    height: 95px;
    background: rgba(0,0,0,0.5);
    border: 2px dashed rgba(255,255,255,0.15);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.deck-icon, .discard-icon {
    font-size: 22px;
    margin-bottom: 3px;
}

.deck-count, .discard-count {
    font-size: 10px;
    color: #666;
}

.play-area {
    min-height: 95px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-slot {
    width: 68px;
    height: 95px;
    border: 2px dashed rgba(0,255,255,0.25);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-hint {
    color: #666;
    font-size: 12px;
}

/* 行动面板 */
.action-panel {
    background: rgba(0,0,0,0.4);
    border-radius: 12px;
    padding: 12px;
}

.action-title {
    text-align: center;
    margin-bottom: 10px;
    color: #0ff;
    font-size: 14px;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    background: linear-gradient(135deg, #2a2a4a, #1a1a3a);
    border: 2px solid rgba(0,255,255,0.3);
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.action-btn:hover:not(:disabled) {
    border-color: #0ff;
    background: rgba(0,255,255,0.1);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn.end-turn {
    border-color: #ffd700;
}

.action-btn.end-turn:hover {
    background: rgba(255,215,0,0.1);
}

.btn-icon { font-size: 20px; }
.btn-text { font-size: 13px; }

/* 组合技提示 */
.combo-hint {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.95);
    border: 2px solid #ffd700;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    z-index: 1000;
    animation: comboAppear 0.5s ease-out;
}

@keyframes comboAppear {
    from { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.combo-icon { font-size: 48px; animation: pulse 1s infinite; }
.combo-name { font-size: 24px; color: #ffd700; margin: 15px 0; }
.combo-desc { color: #ccc; }

/* 游戏日志 */
.game-log {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 250px;
    max-height: 200px;
    background: rgba(0,0,0,0.8);
    border-radius: 10px;
    overflow: hidden;
}

.log-title {
    padding: 10px;
    background: rgba(0,0,0,0.5);
    font-size: 14px;
    color: #0ff;
}

.log-content {
    padding: 10px;
    max-height: 150px;
    overflow-y: auto;
    font-size: 12px;
}

.log-entry {
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #0ff;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    min-width: 400px;
}

.modal-content h2 {
    font-size: 28px;
    margin-bottom: 20px;
}

.game-over-icon {
    font-size: 80px;
    margin: 20px 0;
}

.game-stats {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 12px 30px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-btn.primary {
    background: rgba(0,255,0,0.2);
    border-color: #0f0;
}

.modal-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* 分支显示 */
.player-branches, .ai-branches {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.branch-tag {
    font-size: 16px;
    padding: 3px 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
}

/* 响应式 */
@media (max-width: 900px) {
    .game-area {
        grid-template-columns: 1fr;
    }

    .rules-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .branch-options {
        grid-template-columns: 1fr;
    }

    .branch-body {
        width: 220px;
    }
}

/* ========== 专精选择面板 ========== */
.spec-panel {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
}
.spec-overlay {
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.3s ease;
}
.spec-dialog {
    background: linear-gradient(135deg, #1a1a3a, #2a2a5a);
    border: 2px solid #6a5acd;
    border-radius: 16px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    text-align: center;
}
.spec-dialog h2 {
    font-size: 1.5em;
    margin-bottom: 8px;
    color: #c8b6ff;
}
.spec-dialog p {
    color: #8888aa;
    margin-bottom: 24px;
    font-size: 0.9em;
}
.spec-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.spec-option {
    background: rgba(255,255,255,0.05);
    border: 1px solid #4a4a7a;
    border-radius: 12px;
    padding: 20px 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.spec-option:hover {
    background: rgba(106,90,205,0.3);
    border-color: #6a5acd;
    transform: translateY(-4px);
}
.spec-icon {
    font-size: 2em;
    margin-bottom: 8px;
}
.spec-name {
    font-size: 1.1em;
    font-weight: bold;
    color: #fff;
    margin-bottom: 6px;
}
.spec-desc {
    font-size: 0.8em;
    color: #8888aa;
}
.level-up-btn {
    background: linear-gradient(135deg, #8b6914, #c9941a) !important;
    border-color: #daa520 !important;
}
.level-up-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #a07818, #daa520) !important;
}

@media (max-width: 500px) {
    .spec-options {
        grid-template-columns: 1fr;
    }
}

/* ========== 手机端适配 (375px~768px) ========== */
@media (max-width: 768px) {
    /* 标题栏缩小 */
    .game-title-bar {
        padding: 10px 16px;
        gap: 8px;
    }

    .title-icon { font-size: 24px; }
    .title-main { font-size: 18px; letter-spacing: 1px; }
    .title-btn { width: 32px; height: 32px; font-size: 14px; }
    .game-subtitle-bar { font-size: 11px; padding: 4px 0; }

    /* 游戏区域：纵向堆叠 */
    .game-area {
        grid-template-columns: 1fr !important;
        gap: 8px;
        padding: 0 6px;
    }

    /* 玩家卡片：左右并排（AI上，玩家下）*/
    .player-card {
        padding: 8px;
    }

    .player-card.player {
        transform: none;
        order: 2; /* 玩家在下方 */
    }

    .player-card.ai {
        opacity: 0.9;
        order: 1; /* AI在上方 */
    }

    /* 卡牌更小更紧凑 */
    .card {
        width: 64px;
        height: 92px;
        border-radius: 6px;
        padding-top: 3px;
    }

    .card-icon { font-size: 28px !important; }
    .card-name { font-size: 9px !important; }
    .card-rank { font-size: 12px !important; }
    .card-suit { font-size: 11px !important; }
    .card-cost { font-size: 9px !important; right: 2px; top: 2px; }

    /* 手牌横向滚动 */
    .hand-cards {
        gap: 5px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        justify-content: flex-start;
    }

    /* AI手牌背面更小 */
    .card.face-down {
        width: 44px;
        height: 62px;
        font-size: 16px;
    }

    /* 能量条紧凑 */
    .energy-dots {
        gap: 4px;
    }
    .energy-dot {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }

    /* 分支面板：全屏覆盖 */
    .branch-panel {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100% !important;
        max-width: none !important;
        border-radius: 0;
        transform: translateX(100%);
    }

    .branch-panel.open {
        transform: translateX(0);
    }

    .branch-toggle {
        left: -16px;
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    .branch-body {
        max-height: 70vh;
        overflow-y: auto;
    }

    /* 规则弹窗全屏 */
    .rules-overlay {
        align-items: flex-start;
        padding-top: 40px;
    }

    .rules-dialog {
        width: 95%;
        max-height: 80vh;
        overflow-y: auto;
    }

    /* 顶部信息栏紧凑 */
    .game-header {
        padding: 6px 10px;
        font-size: 13px;
    }

    .header-btn {
        padding: 4px 10px;
        font-size: 12px;
    }

    /* 战斗日志区域 */
    .battle-log {
        max-height: 120px;
        font-size: 11px;
    }

    /* 等级/回合信息 */
    .stat-value { font-size: 16px; }
    .player-avatar { font-size: 18px; }
    .player-name { font-size: 12px; }
}

/* 超小屏 (iPhone SE等) */
@media (max-width: 400px) {
    .card {
        width: 56px;
        height: 82px;
    }
    .card-icon { font-size: 24px !important; }
    .card-name { font-size: 8px !important; }
    .hand-cards { gap: 3px; }
    .title-main { font-size: 15px; }
}
