/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "SimHei", sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    overflow: hidden;
    user-select: none;
    height: 100vh;
}

/* 视频背景 */
#bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    #bg-video {
        object-fit: cover;
        width: 100vw;
        height: 100vh;
        min-width: 100%;
        min-height: 100%;
    }
    
    #game-screen {
        min-height: 100vh;
        min-height: -webkit-fill-available;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== 屏幕切换 ===== */
.screen {
    display: none;
    width: 100%;
    height: 100%;
}

.screen.active {
    display: flex;
}

/* ===== 武将选择界面 ===== */
#select-screen {
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    overflow-y: auto;
    padding: 20px;
}

.select-header {
    text-align: center;
    margin: 20px 0;
}

.select-header h1 {
    font-size: 56px;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 2px 2px 4px rgba(0,0,0,0.8);
    letter-spacing: 12px;
    font-weight: bold;
}

.subtitle {
    color: #ccc;
    font-size: 18px;
    margin-top: 8px;
    letter-spacing: 4px;
}

.select-info {
    color: #ffd700;
    font-size: 20px;
    margin: 15px 0;
    letter-spacing: 2px;
}

.hero-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
    max-width: 1000px;
    margin-bottom: 20px;
}

.hero-card {
    width: 140px;
    background: linear-gradient(180deg, #2a2a4a 0%, #1a1a2e 100%);
    border: 2px solid #444;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
}

.hero-card:hover {
    transform: translateY(-6px);
    border-color: #ffd700;
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.3);
}

.hero-card.selected {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    background: linear-gradient(180deg, #3a3a5a 0%, #2a2a4e 100%);
}

.hero-portrait {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    border: 3px solid;
    overflow: hidden;
    position: relative;
}

.hero-portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.hero-card .hero-card-name {
    font-size: 18px;
    color: #ffd700;
    font-weight: bold;
}

.hero-card .hero-card-faction {
    font-size: 12px;
    margin: 2px 0;
    color: #aaa;
}

.hero-card .hero-card-hp {
    color: #ff4444;
    font-size: 14px;
    margin: 4px 0;
}

.hero-card .hero-card-skill {
    font-size: 11px;
    color: #88ccff;
    margin-top: 4px;
    line-height: 1.4;
    min-height: 30px;
}

.hero-card .hero-card-skill-name {
    color: #ffd700;
    font-weight: bold;
}

.hero-card .hero-card-title {
    font-size: 11px;
    color: #aa9;
    margin: 1px 0;
    font-style: italic;
}

/* ===== 势力Tab ===== */
.faction-tabs {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 8px 0 20px;
}

.faction-tab {
    padding: 8px 28px;
    font-size: 20px;
    font-weight: bold;
    border: 2px solid #555;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(30, 30, 50, 0.7);
    color: #888;
    letter-spacing: 2px;
}

.faction-tab:hover {
    background: rgba(50, 50, 70, 0.9);
    transform: translateY(-2px);
}

.faction-tab.active {
    background: linear-gradient(180deg, rgba(40,40,60,0.95), rgba(20,20,40,0.95));
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
    text-shadow: 0 0 8px currentColor;
}

/* ===== 身份标签 ===== */
.role-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 2px solid #ffd700;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.role-badge.lord {
    background: linear-gradient(135deg, #FFD700, #B8860B);
    color: #4a2c00;
}

.role-badge.minister {
    background: linear-gradient(135deg, #4682B4, #2c5e8a);
    color: #fff;
}

.role-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: bold;
    border-radius: 4px;
    padding: 1px 6px;
    margin-right: 4px;
}

.role-tag.lord {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(184, 134, 11, 0.3));
    border: 1px solid #FFD700;
    color: #FFD700;
}

.role-tag.minister {
    background: rgba(70, 130, 180, 0.2);
    border: 1px solid #4682B4;
    color: #8ec4ee;
}

.select-confirm {
    margin: 20px 0;
}

.select-confirm button {
    padding: 12px 48px;
    font-size: 20px;
    background: linear-gradient(180deg, #8b0000 0%, #5a0000 100%);
    color: #ffd700;
    border: 2px solid #ffd700;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: 4px;
    transition: all 0.3s ease;
}

.select-confirm button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.select-confirm button:not(:disabled):hover {
    background: linear-gradient(180deg, #a00000 0%, #700000 100%);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
}

/* ===== 游戏界面 ===== */
#game-screen {
    flex-direction: column;
    background: linear-gradient(180deg, #1a3a1a 0%, #0d1f0d 50%, #1a3a1a 100%);
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* ===== 右上角音频控制面板 ===== */
.audio-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 15px;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    z-index: 100;
}

.audio-control-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #ffd700;
    background: rgba(255, 215, 0, 0.1);
    color: #ffd700;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.audio-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: scale(1.1);
}

.audio-btn.active {
    background: rgba(255, 215, 0, 0.4);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.volume-slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.volume-slider {
    width: 80px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffd700;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.8);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffd700;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.8);
}

.volume-label {
    font-size: 11px;
    color: #aaa;
    letter-spacing: 1px;
}

/* ===== 背景选择面板 ===== */
.bg-panel {
    position: absolute;
    top: 60px;
    right: 10px;
    width: 380px;
    max-height: 400px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 12px;
    z-index: 250;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.bg-panel.hidden {
    display: none;
}

.bg-panel-header {
    padding: 10px 15px;
    font-size: 14px;
    color: #ffd700;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    text-align: center;
    letter-spacing: 2px;
}

.bg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
    max-height: 340px;
}

.bg-item {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    background-color: #333;
}

.bg-item:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

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

.bg-item.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.bg-item-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    color: #ccc;
    white-space: nowrap;
}

.bg-panel-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #aaa;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.bg-panel-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.player-area {
    flex-shrink: 0;
    padding: 8px 16px;
}

.ai-area {
    background: linear-gradient(180deg, rgba(80,20,20,0.3) 0%, transparent 100%);
}

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

.hero-avatar {
    width: 100px;
    height: 130px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    background-color: #1a1a2e;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.hero-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}

/* 武将牌迷你样式 */
.hero-card-mini {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 6px;
    position: relative;
}

.hero-card-faction-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    font-weight: bold;
    border: 2px solid rgba(255,255,255,0.6);
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.hero-details {
    flex-shrink: 0;
    min-width: 180px;
}

.hero-name {
    font-size: 18px;
    color: #ffd700;
    font-weight: bold;
}

.hero-faction {
    font-size: 12px;
    color: #aaa;
}

.hp-bar {
    display: flex;
    gap: 3px;
    margin-top: 4px;
}

.hp-point {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #cc2222;
    border: 1px solid #ff6666;
    box-shadow: 0 0 4px rgba(255,50,50,0.6);
}

.hp-point.lost {
    background: #333;
    border-color: #555;
    box-shadow: none;
}

.hero-skills {
    font-size: 11px;
    color: #88ccff;
    margin-top: 2px;
}

/* 技能标签样式 - 参照装备槽和结束回合按钮 */
.hero-skills .skill-tag {
    display: inline-block;
    background: linear-gradient(180deg, #3a2a5a 0%, #2a1a3a 100%);
    border: 2px solid #8a6aaa;
    border-radius: 6px;
    padding: 3px 8px;
    margin-right: 6px;
    margin-top: 2px;
    color: #ccaaee;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero-skills .skill-tag:hover {
    background: linear-gradient(180deg, #4a3a6a 0%, #3a2a4a 100%);
    border-color: #aa8acc;
    box-shadow: 0 0 8px rgba(170, 138, 204, 0.3);
    transform: translateY(-1px);
}

/* 操作栏提示信息框 - 避免与背景混淆 */
.action-info-box {
    display: inline-block;
    background: linear-gradient(180deg, #5a3a2a 0%, #4a2a1a 100%);
    border: 2px solid #c9a227;
    border-radius: 6px;
    padding: 6px 14px;
    color: #ffd700;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.action-info-box.ai-thinking {
    background: linear-gradient(180deg, #3a4a5a 0%, #2a3a4a 100%);
    border-color: #88ccff;
    color: #88ccff;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.equip-area {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* 装备槽样式 - 参照结束回合按钮但有区别（蓝色系） */
.equip-slot {
    width: 42px;
    height: 56px;
    background: linear-gradient(180deg, #2a3a5a 0%, #1a2535 100%);
    border: 2px solid #5a7a9a;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #8aa;
    text-align: center;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.equip-slot:hover {
    background: linear-gradient(180deg, #3a4a6a 0%, #2a3545 100%);
    border-color: #7aaaca;
    box-shadow: 0 0 8px rgba(122, 170, 202, 0.3);
    transform: translateY(-1px);
}

/* 已装备状态 - 金色边框（类似结束回合的金色） */
.equip-slot.equipped {
    background: linear-gradient(180deg, #4a4a2a 0%, #3a3a1a 100%);
    border-color: #ffd700;
    color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.equip-slot.equipped:hover {
    background: linear-gradient(180deg, #5a5a3a 0%, #4a4a2a 100%);
    border-color: #ffec8b;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}

.card-count {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 20px;
    color: #ccc;
    flex-shrink: 0;
}

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

/* ===== 手牌区域 ===== */
.ai-hand-area {
    display: flex;
    justify-content: center;
    padding: 4px 0;
}

.player-hand-area {
    display: flex;
    justify-content: center;
    padding: 4px 0;
}

.hand-cards {
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: nowrap;
    align-items: flex-end;
}

/* ===== 卡牌样式 ===== */
.card {
    width: 64px;
    min-width: 64px;
    height: 90px;
    border-radius: 6px;
    border: 2px solid #ddd;
    background: linear-gradient(180deg, #f5f0e0 0%, #e8dfc8 100%);
    color: #333;
    display: flex;
    flex-direction: column;
    padding: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
    font-size: 12px;
}

.card:hover {
    transform: translateY(-12px);
    z-index: 10;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}

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

.card.playable {
    border-color: #44dd44;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.4), 0 0 8px rgba(68,221,68,0.4);
}

.card.unplayable {
    opacity: 0.6;
}

.card-suit-number {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: bold;
}

.card-suit.red {
    color: #cc0000;
}

.card-suit.black {
    color: #000;
}

.card-name {
    text-align: center;
    font-size: 15px;
    font-weight: bold;
    margin: auto 0;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 2px;
    line-height: 1;
    overflow: hidden;
}

.card-type {
    text-align: center;
    font-size: 9px;
    color: #666;
    margin-top: 2px;
}

/* AI手牌背面 */
.card-back {
    width: 40px;
    min-width: 40px;
    height: 60px;
    border-radius: 4px;
    border: 2px solid #8b0000;
    background: linear-gradient(135deg, #8b0000 0%, #4a0000 50%, #8b0000 100%);
    box-shadow: 1px 1px 4px rgba(0,0,0,0.4);
    position: relative;
}

.card-back::after {
    content: "殺";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: rgba(255,215,0,0.3);
}

/* ===== 战斗日志 ===== */
.battle-log {
    flex: 1;
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-start;
    overflow: hidden;
    padding: 8px 16px;
    min-height: 60px;
}

#log-content {
    display: flex;
    flex-direction: column-reverse;
    gap: 3px;
}

.log-entry {
    font-size: 13px;
    color: #ccc;
    padding: 4px 10px;
    border-radius: 6px;
    animation: logSlideIn 0.35s cubic-bezier(0.2, 0.6, 0.3, 1);
    margin-bottom: 1px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    display: inline-block;
    width: auto;
    align-self: flex-start;
    line-height: 1.5;
}

/* 有背景图时，日志条目显示背景框 - 使用CSS变量 */
.battle-log.with-bg .log-entry {
    background: rgba(var(--log-bg-color, 0, 0, 0), var(--log-opacity, 0.3));
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 无背景时，日志条目无背景框 */
.battle-log:not(.with-bg) .log-entry {
    background: transparent;
    border: none;
}

.battle-log.with-bg .log-entry.player {
    color: #88ccff;
    background: rgba(var(--log-bg-color, 0, 0, 0), var(--log-opacity, 0.3));
    border-color: rgba(136, 204, 255, 0.3);
}

.battle-log.with-bg .log-entry.ai {
    color: #ffaa88;
    background: rgba(var(--log-bg-color, 0, 0, 0), var(--log-opacity, 0.3));
    border-color: rgba(255, 170, 136, 0.3);
}

.battle-log.with-bg .log-entry.system {
    color: #ffd700;
    font-weight: bold;
    background: rgba(var(--log-bg-color, 0, 0, 0), var(--log-opacity, 0.3));
    border-color: rgba(255, 215, 0, 0.4);
}

.battle-log.with-bg .log-entry.damage {
    color: #ff6666;
    background: rgba(var(--log-bg-color, 0, 0, 0), var(--log-opacity, 0.3));
    border-color: rgba(255, 102, 102, 0.4);
}

.battle-log.with-bg .log-entry.heal {
    color: #66ff66;
    background: rgba(var(--log-bg-color, 0, 0, 0), var(--log-opacity, 0.3));
    border-color: rgba(102, 255, 102, 0.4);
}

@keyframes logSlideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ===== 日志富文本样式 ===== */

/* 卡牌/技能名高亮徽章 */
.log-entry .log-card {
    display: inline;
    color: #ffe082;
    font-weight: 600;
    text-shadow: 0 0 4px rgba(255, 180, 0, 0.4);
}

/* 动作图标 */
.log-entry .log-icon {
    display: inline-block;
    width: 16px;
    text-align: center;
    font-size: 12px;
    margin-right: 1px;
    opacity: 0.85;
}
.log-entry .icon-sys    { color: #ffd700; }
.log-entry .icon-turn   { color: #b0b0b0; font-size: 11px; }
.log-entry .icon-skill  { color: #ce93d8; }
.log-entry .icon-atk    { color: #ef5350; }
.log-entry .icon-def    { color: #66bb6a; font-size: 11px; }
.log-entry .icon-heal   { color: #66ff66; }
.log-entry .icon-dmg    { color: #ff6666; }
.log-entry .icon-death  { color: #999; }
.log-entry .icon-equip  { color: #90caf9; font-size: 11px; }
.log-entry .icon-draw   { color: #fff59d; }
.log-entry .icon-discard { color: #ffab91; }
.log-entry .icon-play   { color: #80cbc4; }

/* 回合分割线 */
.log-entry.log-turn {
    width: 100% !important;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    border-left: none;
    border-right: none;
    border-radius: 0;
    padding: 5px 10px;
    margin: 4px 0 2px;
    font-size: 12px;
    opacity: 0.9;
    text-align: center;
}
.battle-log:not(.with-bg) .log-entry.log-turn {
    background: rgba(255, 255, 255, 0.04);
}

/* 日志样式设置面板 */
.log-style-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.log-style-item label {
    display: block;
    font-size: 12px;
    color: #ccc;
    margin-bottom: 6px;
}

.color-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-preset {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-preset:hover {
    transform: scale(1.1);
}

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

/* ===== 操作按钮 ===== */
.action-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 6px;
}

.action-btn {
    padding: 8px 24px;
    font-size: 14px;
    background: linear-gradient(180deg, #8b0000 0%, #5a0000 100%);
    color: #ffd700;
    border: 1px solid #ffd700;
    border-radius: 6px;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.action-btn:hover {
    background: linear-gradient(180deg, #a00000 0%, #700000 100%);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

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

/* 语音开关按钮 */
.tts-btn {
    background: linear-gradient(180deg, #2a2a4a 0%, #1a1a2e 100%);
    border-color: #666;
    color: #aaa;
    font-size: 12px;
    padding: 6px 14px;
    letter-spacing: 1px;
}

.tts-btn.active {
    background: linear-gradient(180deg, #1a4a2a 0%, #0d2e1a 100%);
    border-color: #44dd44;
    color: #aaffaa;
}

.tts-btn:hover {
    background: linear-gradient(180deg, #3a3a5a 0%, #2a2a3e 100%);
}

.tts-btn.active:hover {
    background: linear-gradient(180deg, #2a5a3a 0%, #1a3e2a 100%);
}

.action-btn.green {
    background: linear-gradient(180deg, #2d6a2d 0%, #1a4a1a 100%);
    border-color: #44dd44;
    color: #aaffaa;
}

/* ===== 响应面板 ===== */
.response-panel {
    position: fixed;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(20, 20, 40, 0.95);
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 16px 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.8);
}

.response-panel.hidden {
    display: none;
}

.response-content {
    text-align: center;
}

.response-content p {
    color: #ffd700;
    font-size: 16px;
    margin-bottom: 12px;
}

.response-cards {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== 技能面板 ===== */
.skill-panel {
    position: fixed;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(20, 20, 40, 0.95);
    border: 2px solid #88ccff;
    border-radius: 12px;
    padding: 16px 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.8);
}

.skill-panel.hidden {
    display: none;
}

.skill-content {
    text-align: center;
}

.skill-content p {
    color: #88ccff;
    font-size: 16px;
    margin-bottom: 12px;
}

.skill-cards {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    justify-content: center;
}

/* ===== 游戏结束 ===== */
.gameover-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.gameover-overlay.hidden {
    display: none;
}

.gameover-content {
    text-align: center;
    padding: 40px;
    background: linear-gradient(180deg, #2a2a4a 0%, #1a1a2e 100%);
    border: 2px solid #ffd700;
    border-radius: 16px;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.3);
}

.gameover-content h1 {
    font-size: 48px;
    margin-bottom: 16px;
    letter-spacing: 8px;
}

.gameover-content h1.win {
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.gameover-content h1.lose {
    color: #888;
}

.gameover-content p {
    color: #ccc;
    font-size: 18px;
    margin-bottom: 24px;
}

/* ===== 卡牌/武将详情提示 ===== */
.card-tooltip {
    position: fixed;
    z-index: 300;
    background: rgba(10, 10, 20, 0.95);
    border: 1px solid #ffd700;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: #ccc;
    max-width: 280px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
    pointer-events: none;
}

.card-tooltip.hidden {
    display: none;
}

/* 触屏设备：tooltip 固定在顶部居中，不挡手牌 */
@media (hover: none) and (pointer: coarse) {
    .card-tooltip {
        position: fixed !important;
        top: 6px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        max-width: 92vw !important;
        max-height: 40vh !important;
        overflow-y: auto !important;
        z-index: 500 !important;
    }
}

.card-tooltip .tooltip-name {
    color: #ffd700;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
}

.card-tooltip .tooltip-desc {
    line-height: 1.5;
}

/* 武将技能提示 */
.hero-tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid #444;
}

.hero-tooltip-name {
    font-size: 16px;
    font-weight: bold;
}

.hero-tooltip-faction {
    font-size: 11px;
    color: #aaa;
}

.hero-tooltip-skills {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hero-tooltip-skill {
    line-height: 1.5;
}

.hero-tooltip-skill-name {
    font-size: 13px;
    font-weight: bold;
}

.hero-tooltip-skill-type {
    font-size: 10px;
    color: #888;
    margin-left: 4px;
}

.hero-tooltip-skill-desc {
    font-size: 12px;
    color: #bbb;
    margin-top: 2px;
    line-height: 1.6;
}

/* ===== 动画 ===== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.damaged {
    animation: shake 0.4s ease;
}

@keyframes flash {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(255, 0, 0, 0.2); }
}

.flash-damage {
    animation: flash 0.5s ease;
}

@keyframes healGlow {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 20px rgba(68, 255, 68, 0.6); }
}

.heal-glow {
    animation: healGlow 0.5s ease;
}

/* 回合指示器 */
.turn-indicator {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    z-index: 50;
}

.turn-indicator.player-turn {
    background: rgba(68, 221, 68, 0.2);
    border: 1px solid #44dd44;
    color: #44dd44;
}

.turn-indicator.ai-turn {
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid #ff4444;
    color: #ff4444;
}

/* 弃牌堆 */
.discard-info {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #888;
}

/* AI思考指示 */
.ai-thinking {
    display: inline-block;
    margin-left: 8px;
    color: #ff8866;
    font-size: 14px;
}

.ai-thinking::after {
    content: "...";
    animation: dots 1.4s infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* 选择面板中的背面手牌 */
#response-cards .card-back {
    width: 60px;
    height: 84px;
    background: linear-gradient(135deg, #4a3020 0%, #6b4a2e 50%, #4a3020 100%);
    border: 2px solid #8b6914;
    border-radius: 6px;
    transition: opacity 0.2s, transform 0.2s;
}

#response-cards .card-back:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

#response-cards .card.playable {
    cursor: pointer;
    border: 2px solid #ffd700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
    transition: transform 0.2s;
}

#response-cards .card.playable:hover {
    transform: scale(1.05);
}

/* ===== 武将台词气泡 ===== */
.speech-bubble {
    position: absolute;
    background: linear-gradient(135deg, rgba(255, 248, 220, 0.97), rgba(255, 235, 180, 0.97));
    color: #4a2c00;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: bold;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px) scale(0.8);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid #d4a017;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
}

.speech-bubble.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* 玩家区域气泡定位 */
#player-area .speech-bubble {
    top: -10px;
    right: 20px;
}

#player-area .speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 30px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #d4a017;
}

/* AI区域气泡定位 */
#ai-area .speech-bubble {
    bottom: -10px;
    left: 20px;
}

#ai-area .speech-bubble::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 30px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #d4a017;
}

/* ===== BGM / TTS 按钮 ===== */
.action-btn.bgm-btn,
.action-btn.tts-btn {
    font-size: 13px;
    padding: 6px 14px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.action-btn.bgm-btn:hover,
.action-btn.tts-btn:hover {
    opacity: 1;
}

.action-btn.bgm-btn.active,
.action-btn.tts-btn.active {
    opacity: 1;
    background: linear-gradient(135deg, #1a5c1a, #2d8f2d);
    border-color: #4aaf4a;
}

/* ===== 浮动人物简介卡片 ===== */
.hero-profile {
    position: fixed;
    width: 340px;
    z-index: 500;
    background: linear-gradient(180deg, #1a1a2e 0%, #0d0d1e 100%);
    border: 2px solid #ffd700;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.15);
    overflow: hidden;
    pointer-events: none;
    animation: profileFadeIn 0.25s ease;
}

.hero-profile.hidden {
    display: none;
}

/* 触屏设备：浮动简介固定在顶部居中 */
@media (hover: none) and (pointer: coarse) {
    .hero-profile {
        position: fixed !important;
        top: 6px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 92vw !important;
        max-width: 340px !important;
        max-height: 70vh !important;
        overflow-y: auto !important;
        z-index: 500 !important;
    }
}

@keyframes profileFadeIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.profile-header {
    display: flex;
    gap: 14px;
    padding: 16px;
    align-items: center;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
    border: 3px solid rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
    overflow: hidden;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile-titles {
    flex: 1;
}

.profile-name {
    font-size: 22px;
    font-weight: bold;
    color: #ffd700;
    letter-spacing: 2px;
}

.profile-subtitle {
    font-size: 12px;
    color: #ccc;
    margin: 2px 0 6px;
    font-style: italic;
}

.profile-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.profile-faction {
    font-size: 11px;
    font-weight: bold;
}

.profile-hp {
    font-size: 12px;
    color: #ff6666;
}

.profile-body {
    padding: 12px 16px 16px;
}

.profile-bio {
    font-size: 13px;
    color: #bbb;
    line-height: 1.7;
    text-indent: 2em;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-left: 3px solid #ffd700;
    border-radius: 0 6px 6px 0;
}

.profile-skills {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-skill {
    background: rgba(136, 204, 255, 0.06);
    border: 1px solid rgba(136, 204, 255, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
}

.profile-skill-name {
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
}

.profile-skill-type {
    font-size: 10px;
    color: #888;
    margin-left: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    padding: 1px 5px;
}

/* 移动端全面适配 */
@media screen and (max-width: 768px) {
    /* 音频控制面板 */
    .audio-controls {
        top: 5px;
        right: 5px;
        padding: 6px 10px;
        gap: 10px;
    }
    
    .audio-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .volume-slider-container {
        width: 60px;
    }
    
    /* 玩家区域 */
    .player-area {
        padding: 8px 10px;
        min-height: auto;
    }
    
    /* 武将牌尺寸 */
    .hero-card-large {
        width: 80px;
        height: 104px;
    }
    
    .hero-card-bg {
        width: 80px;
        height: 104px;
    }
    
    /* 手牌区域 */
    .hand-area {
        min-height: 100px;
        padding: 8px;
    }
    
    .card {
        width: 60px;
        min-width: 48px;
        height: 84px;
        font-size: 12px;
    }

    /* 手机端卡牌名称改为横排，避免竖排文字被裁剪 */
    .card .card-name {
        writing-mode: horizontal-tb;
        text-orientation: mixed;
        font-size: 14px;
        letter-spacing: 0;
        line-height: 1.1;
        word-break: break-all;
        overflow: hidden;
    }

    /* 手牌允许换行 */
    .hand-cards {
        flex-wrap: wrap;
        gap: 3px;
    }

    /* 紧凑模式：背景大字平铺风格 */
    .hand-cards.compact .card {
        width: 50px;
        min-width: 50px;
        height: 66px;
        padding: 2px;
        border-width: 1px;
        border-radius: 4px;
        font-size: 10px;
        box-shadow: 1px 1px 3px rgba(0,0,0,0.4);
        position: relative;
        overflow: hidden;
    }

    /* 花色数字缩小放在左上角 */
    .hand-cards.compact .card .card-suit-number {
        position: absolute;
        top: 1px;
        left: 2px;
        font-size: 8px;
        gap: 0;
        z-index: 2;
    }

    /* 卡牌名称大字居中平铺 */
    .hand-cards.compact .card .card-name {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 15px;
        font-weight: bold;
        letter-spacing: 0;
        line-height: 1.1;
        white-space: nowrap;
        margin: 0;
        z-index: 1;
        writing-mode: horizontal-tb;
        text-orientation: mixed;
    }

    /* 紧凑模式隐藏类型标签 */
    .hand-cards.compact .card .card-type {
        display: none;
    }

    .hand-cards.compact .card:hover {
        transform: translateY(-8px);
    }

    .hand-cards.compact .card.selected {
        transform: translateY(-14px);
    }
    
    /* 战斗日志 */
    .battle-log {
        max-height: 120px;
        padding: 6px 10px;
    }
    
    .log-entry {
        font-size: 12px;
        padding: 3px 8px;
    }
    
    /* 操作按钮 */
    .action-bar {
        padding: 8px;
        gap: 8px;
    }
    
    .action-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    /* 装备槽 */
    .equip-slot {
        width: auto;
        min-width: 32px;
        height: auto;
        padding: 4px 6px;
        font-size: 10px;
        border-width: 1px;
        border-radius: 4px;
        flex-direction: row;
        gap: 2px;
    }

    .equip-area {
        gap: 4px;
        flex-wrap: wrap;
    }

    /* 头像缩小 */
    .hero-avatar {
        width: 56px;
        height: 72px;
        border-radius: 6px;
        border-width: 2px;
    }

    /* 武将详情缩小 */
    .hero-details {
        min-width: 0;
        flex: 1;
    }

    .hero-name {
        font-size: 14px;
    }

    .hero-faction {
        font-size: 11px;
    }

    /* 信息栏间距缩小，允许换行 */
    .player-info-bar {
        gap: 6px;
        flex-wrap: wrap;
    }
    
    /* 背景选择面板 */
    .bg-panel {
        width: 90vw;
        max-width: 300px;
        max-height: 70vh;
    }
    
    .bg-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .bg-item {
        height: 70px;
    }
    
    /* 响应式面板 */
    #response-panel {
        width: 95vw;
        max-width: 400px;
    }
    
    #response-cards {
        max-height: 200px;
    }
    
    /* 提示信息 */
    .phase-info {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    /* 技能标签 */
    .skill-tag {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    /* 血条 */
    .hp-bar {
        width: 60px;
        height: 10px;
    }
    
    .hp-text {
        font-size: 11px;
    }

    /* 武将牌势力标记缩小 */
    .hero-card-faction-badge {
        width: 16px;
        height: 16px;
        font-size: 9px;
        border-width: 1px;
    }
}

/* 超窄屏幕（手机竖屏） */
@media screen and (max-width: 480px) {
    .hero-avatar {
        width: 44px;
        height: 58px;
        border-radius: 5px;
    }

    .hero-card-faction-badge {
        width: 14px;
        height: 14px;
        font-size: 8px;
    }

    .hero-name {
        font-size: 13px;
    }

    .hero-faction {
        font-size: 10px;
    }

    .equip-slot {
        min-width: 28px;
        padding: 3px 4px;
        font-size: 9px;
    }

    .equip-area {
        gap: 3px;
    }

    .player-info-bar {
        gap: 4px;
    }

    .card-count {
        font-size: 16px;
    }

    .hp-bar {
        width: 50px;
        height: 8px;
    }

    .hp-text {
        font-size: 10px;
    }

    .skill-tag {
        font-size: 9px;
        padding: 1px 4px;
    }
}

.profile-skill-desc {
    font-size: 12px;
    color: #aaccee;
    margin-top: 4px;
    line-height: 1.6;
}
