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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a2e 50%, #16213e 100%);
    color: #fff;
}

#game-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 星空背景 */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* 游戏面板 */
#game-board {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    border: 2px solid #4a90e2;
    display: flex;
    flex-direction: column;
    padding: 10px;
    box-shadow: 0 0 30px rgba(74,144,226,0.3);
    overflow: hidden;
}

/* 顶部状态栏 */
#status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: rgba(0,0,0,0.5);
    border-radius: 10px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.hq-display {
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    border: 2px solid;
    text-align: center;
    min-width: 120px;
}

.enemy-hq {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-color: #e74c3c;
}

.player-hq {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    border-color: #27ae60;
}

.turn-info {
    text-align: center;
    color: #ffd700;
    flex: 1;
}

.turn-info h2 {
    font-size: 20px;
    margin-bottom: 3px;
    text-shadow: 0 0 10px rgba(255,215,0,0.5);
}

.energy-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #3498db;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
}

.energy-dot {
    width: 10px;
    height: 10px;
    background: #ffd700;
    border-radius: 50%;
    box-shadow: 0 0 10px #ffd700;
}

.deck-info {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 3px;
}

/* 战线标签 */
.line-label {
    text-align: center;
    font-size: 12px;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 3px;
    padding: 5px;
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    margin: 5px 0;
}

.line-label.supply {
    color: #f39c12;
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.line-label.front {
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

/* 战场区域 - 占据中间主要空间 */
#battlefield {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 5px;
    min-height: 0;
    overflow-y: auto;
}

.field-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field-label {
    font-size: 12px;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.shield-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(52, 152, 219, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: #3498db;
}

.slots-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    min-height: 110px;
}

.slot {
    width: 95px;
    height: 120px;
    border: 2px dashed rgba(255,255,255,0.3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s;
    background: rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.slot.active {
    border-color: #4a90e2;
    background: rgba(74,144,226,0.1);
    box-shadow: 0 0 15px rgba(74,144,226,0.3);
}

.slot.targetable {
    border-color: #e74c3c;
    background: rgba(231,76,60,0.1);
    cursor: crosshair;
    animation: pulse 1.5s infinite;
}

.slot.shielded {
    border-color: #3498db;
    background: rgba(52,152,219,0.2);
    box-shadow: 0 0 20px rgba(52,152,219,0.4);
}

.slot.supply-line {
    border-color: #f39c12;
    background: rgba(243,156,18,0.1);
}

.slot.front-line {
    border-color: #e74c3c;
    background: rgba(231,76,60,0.1);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 5px rgba(231,76,60,0.5); }
    50% { box-shadow: 0 0 20px rgba(231,76,60,0.8); }
}

/* 卡牌样式 */
.card {
    width: 85px;
    height: 105px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border: 2px solid #95a5a6;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    z-index: 100;
}

.card.selected {
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255,215,0,0.8);
    transform: translateY(-8px);
}

.card.exhausted {
    opacity: 0.6;
    filter: grayscale(0.7);
}

.card.shielded {
    border-color: #3498db;
    box-shadow: 0 0 10px rgba(52,152,219,0.6);
}

.card.supply-only {
    border-color: #f39c12;
    opacity: 0.9;
}

.card-cost {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 11px;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.card-atk {
    position: absolute;
    bottom: -10px;
    left: -10px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 11px;
    border: 2px solid #fff;
}

.card-def {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 11px;
    border: 2px solid #fff;
}

.card-icon {
    font-size: 30px;
    margin-top: 5px;
}

.card-name {
    font-size: 10px;
    text-align: center;
    font-weight: bold;
    color: #ecf0f1;
    line-height: 1.1;
}

.card-desc {
    font-size: 8px;
    text-align: center;
    color: #bdc3c7;
    margin-top: 1px;
}

.card-keyword {
    display: inline-block;
    background: rgba(241, 196, 15, 0.3);
    color: #f1c40f;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 7px;
    margin-top: 1px;
}

.permission-hint {
    position: absolute;
    bottom: 2px;
    font-size: 8px;
    color: #f39c12;
    background: rgba(243, 156, 18, 0.2);
    padding: 1px 4px;
    border-radius: 3px;
}

/* 底部区域 - 手牌和日志 */
#bottom-area {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    height: 180px;
    flex-shrink: 0;
}

/* 手牌区域 - 左下 */
#hand-area {
    flex: 1;
    padding: 12px;
    background: rgba(0,0,0,0.4);
    border-radius: 10px;
    border: 2px solid #9b59b6;
    display: flex;
    flex-direction: column;
}

#hand-area h3 {
    color: #9b59b6;
    margin-bottom: 8px;
    font-size: 13px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.hand-cards {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    overflow-y: auto;
    flex: 1;
    align-content: flex-start;
}

.hand-card {
    width: 75px;
    height: 95px;
    background: linear-gradient(135deg, #8e44ad 0%, #9b59b6 100%);
    border: 2px solid #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px;
    flex-shrink: 0;
}

.hand-card:hover {
    transform: translateY(-10px);
    z-index: 50;
}

.hand-card.unplayable {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.8);
}

.hand-card.selected {
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255,215,0,0.6);
    transform: translateY(-15px);
}

/* 游戏日志 - 右下 */
#game-log {
    width: 300px;
    padding: 12px;
    background: rgba(0,0,0,0.5);
    border-radius: 10px;
    border-left: 4px solid #4a90e2;
    display: flex;
    flex-direction: column;
}

#game-log-header {
    color: #4a90e2;
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 13px;
    flex-shrink: 0;
}

#log-content {
    overflow-y: auto;
    font-size: 12px;
    flex: 1;
}

.log-entry {
    margin-bottom: 4px;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-turn {
    color: #ffd700;
    font-weight: bold;
    min-width: 35px;
    font-size: 10px;
}

.log-damage { color: #e74c3c; }
.log-heal { color: #27ae60; }
.log-shield { color: #3498db; }
.log-enemy { color: #e74c3c; }
.log-system { color: #95a5a6; }
.log-line { color: #f39c12; }
.log-error { color: #e74c3c; }

/* 控制按钮 - 底部中央 */
#controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
    flex-shrink: 0;
}

.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-end {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(231,76,60,0.3);
}

.btn-end:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(231,76,60,0.4);
}

.btn-surrender {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
}

.btn-shield {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    position: relative;
}

.btn-shield:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.shield-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

/* 开始界面 */
#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0c0c1d 0%, #1a1a2e 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

#start-screen h1 {
    font-size: 40px;
    margin-bottom: 15px;
    background: linear-gradient(90deg, #4a90e2, #9b59b6, #e74c3c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(74,144,226,0.3);
}

#start-screen p {
    color: #7f8c8d;
    font-size: 18px;
    margin-bottom: 25px;
    text-align: center;
    max-width: 600px;
    line-height: 1.6;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    max-width: 900px;
    margin-bottom: 25px;
}

.feature-box {
    background: rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
}

.feature-box h4 {
    color: #4a90e2;
    margin-bottom: 8px;
    font-size: 16px;
}

.feature-box p {
    font-size: 13px;
    margin: 0;
    color: #95a5a6;
}

.start-btn {
    padding: 18px 45px;
    font-size: 22px;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 25px rgba(74,144,226,0.4);
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 50px rgba(74,144,226,0.6);
}

/* 游戏结束 */
#game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

#game-over h2 {
    font-size: 42px;
    margin-bottom: 20px;
}

.victory {
    color: #27ae60;
    text-shadow: 0 0 20px rgba(39,174,96,0.5);
}

.defeat {
    color: #e74c3c;
    text-shadow: 0 0 20px rgba(231,76,60,0.5);
}

/* 动画效果 */
.damage-popup {
    position: absolute;
    font-size: 26px;
    font-weight: bold;
    color: #e74c3c;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
    z-index: 1000;
}

.heal-popup {
    position: absolute;
    font-size: 26px;
    font-weight: bold;
    color: #27ae60;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
    z-index: 1000;
}

.shield-popup {
    position: absolute;
    font-size: 22px;
    font-weight: bold;
    color: #3498db;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
    z-index: 1000;
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-50px) scale(1.3); opacity: 0; }
}

.turn-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255,215,0,0.8);
    pointer-events: none;
    opacity: 0;
    z-index: 1500;
    transition: opacity 0.3s;
}

/* 卡牌详情提示 */
.card-tooltip {
    position: absolute;
    background: rgba(0,0,0,0.95);
    border: 2px solid #4a90e2;
    border-radius: 10px;
    padding: 15px;
    width: 220px;
    z-index: 2000;
    pointer-events: none;
    display: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.card-tooltip h4 {
    color: #ffd700;
    margin-bottom: 8px;
    font-size: 15px;
}

.card-tooltip .stats {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 13px;
}

.card-tooltip .desc {
    font-size: 12px;
    color: #bdc3c7;
    line-height: 1.4;
}

.keyword-tag {
    display: inline-block;
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-right: 4px;
}

/* 响应式适配 */
@media (max-width: 1200px) {
    #game-log {
        width: 250px;
    }
}

@media (max-width: 900px) {
    #game-log {
        width: 200px;
    }
    
    .slot {
        width: 85px;
        height: 110px;
    }
    
    .card {
        width: 75px;
        height: 95px;
    }
}

@media (max-width: 768px) {
    #game-board {
        padding: 5px;
    }
    
    #bottom-area {
        flex-direction: column;
        height: auto;
        max-height: 250px;
    }
    
    #game-log {
        width: 100%;
        height: 100px;
    }
    
    .slots-row {
        gap: 8px;
    }
    
    .slot {
        width: 75px;
        height: 95px;
    }
    
    .hand-card {
        width: 65px;
        height: 85px;
    }
}
