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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    overflow: hidden;
    height: 100vh;
    color: white;
}

.game-screen {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* HUD - Thanh thông tin */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    z-index: 100;
    border-bottom: 2px solid #f39c12;
}

.player-stats, .enemy-stats {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.money-display, .army-count, .enemy-money, .enemy-count {
    font-size: 1.2em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.money-display, .army-count {
    color: #2ecc71;
}

.enemy-money, .enemy-count {
    color: #e74c3c;
}

.game-title {
    font-size: 2em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    color: #ecf0f1;
}

/* Sân đấu chính */
.battlefield-arena {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 100px 1fr;
    background: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 50px,
            rgba(255, 255, 255, 0.05) 50px,
            rgba(255, 255, 255, 0.05) 52px
        );
}

.army-zone {
    padding: 30px;
    position: relative;
    overflow: hidden;
}

.player-zone {
    background: linear-gradient(90deg, rgba(46, 204, 113, 0.1) 0%, transparent 100%);
    border-right: 2px dashed rgba(46, 204, 113, 0.5);
}

.enemy-zone {
    background: linear-gradient(270deg, rgba(231, 76, 60, 0.1) 0%, transparent 100%);
    border-left: 2px dashed rgba(231, 76, 60, 0.5);
}

.zone-label {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.army-units {
    width: 100%;
    height: 100%;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 15px;
    padding-top: 60px;
}

/* Đường giữa sân */
.center-line {
    background: linear-gradient(180deg, 
        rgba(241, 196, 15, 0.3) 0%, 
        rgba(230, 126, 34, 0.3) 50%, 
        rgba(241, 196, 15, 0.3) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.center-line::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    background: repeating-linear-gradient(
        180deg,
        #f1c40f 0px,
        #f1c40f 20px,
        transparent 20px,
        transparent 40px
    );
}

.battle-controls {
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.individual-controls {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.individual-controls h4 {
    margin-bottom: 10px;
    color: #f1c40f;
    font-size: 1em;
}

.individual-attack-btn {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

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

.rifle-btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
}

.sword-btn {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
}

.flame-btn {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
}

.individual-attack-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.attack-button {
    padding: 20px 30px;
    font-size: 1.5em;
    font-weight: bold;
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.attack-button:hover {
    transform: rotate(-90deg) scale(1.1);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.attack-button:active {
    transform: rotate(-90deg) scale(0.95);
}

/* Panel điều khiển */
.control-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 350px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    border: 2px solid #3498db;
    z-index: 200;
    transition: all 0.3s ease;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(45deg, #3498db, #2980b9);
    border-radius: 18px 18px 0 0;
}

.panel-header h3 {
    margin: 0;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.panel-content {
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.soldier-creation {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.create-soldier-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: linear-gradient(45deg, #34495e, #2c3e50);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.create-soldier-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #2c3e50, #34495e);
}

.create-soldier-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.soldier-preview {
    width: 50px;
    height: 50px;
    position: relative;
    transform: scale(0.7);
}

.soldier-info {
    flex: 1;
}

.soldier-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.soldier-cost {
    color: #f1c40f;
    font-size: 0.9em;
}

.panel-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.action-btn {
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.enemy-btn {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
}

.merge-btn {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    color: white;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.ai-btn {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
}

.ai-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.ai-stats {
    margin-top: 10px;
}

.ai-stats div {
    margin-bottom: 5px;
    font-size: 0.9em;
}

.battle-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
}

.info-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #f1c40f;
}

.reward-list div, .hotkey-list div {
    margin-bottom: 5px;
    font-size: 0.9em;
}

.hotkey-list div {
    color: #bdc3c7;
}

/* Hình lính */
.soldier {
    width: 80px;
    height: 80px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: soldier-spawn 0.5s ease-out;
}

@keyframes soldier-spawn {
    0% {
        opacity: 0;
        transform: scale(0) rotate(180deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.soldier:hover {
    transform: scale(1.1);
}

.soldier-figure {
    width: 70px;
    height: 70px;
    border-radius: 50% 50% 60% 60%;
    position: relative;
}

.soldier.rifle .soldier-figure {
    background: linear-gradient(145deg, #3498db, #2980b9);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
}

.soldier.sword .soldier-figure {
    background: linear-gradient(145deg, #9b59b6, #8e44ad);
    box-shadow: 0 8px 20px rgba(155, 89, 182, 0.3);
}

.soldier.flamethrower .soldier-figure {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.3);
}

/* Đầu lính */
.soldier-figure::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #f4d03f, #f39c12);
    border-radius: 50%;
    border: 2px solid #2c3e50;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Thân lính */
.soldier-figure::after {
    content: '';
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 25px;
    height: 30px;
    border-radius: 5px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.soldier.rifle .soldier-figure::after {
    background: linear-gradient(180deg, #3498db, #2980b9);
}

.soldier.sword .soldier-figure::after {
    background: linear-gradient(180deg, #e67e22, #d35400);
}

.soldier.flamethrower .soldier-figure::after {
    background: linear-gradient(180deg, #c0392b, #a93226);
}

/* Vũ khí */
.weapon {
    position: absolute;
    z-index: 5;
}

/* Súng trường */
.soldier.rifle .weapon {
    top: 25px;
    right: -15px;
    width: 30px;
    height: 4px;
    background: linear-gradient(90deg, #34495e, #2c3e50);
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.soldier.rifle .weapon::before {
    content: '';
    position: absolute;
    right: 0;
    top: -2px;
    width: 8px;
    height: 8px;
    background: linear-gradient(45deg, #2c3e50, #1a252f);
    border-radius: 2px;
}

/* Kiếm */
.soldier.sword .weapon {
    top: 5px;
    right: -20px;
    width: 3px;
    height: 40px;
    background: linear-gradient(180deg, #ecf0f1, #bdc3c7);
    border-radius: 1px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.soldier.sword .weapon::before {
    content: '';
    position: absolute;
    top: 0;
    left: -3px;
    width: 9px;
    height: 8px;
    background: linear-gradient(45deg, #f39c12, #e67e22);
    border-radius: 2px;
}

.soldier.sword .weapon::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -1px;
    width: 5px;
    height: 6px;
    background: linear-gradient(180deg, #8b4513, #654321);
    border-radius: 2px;
}

/* Súng phun lửa */
.soldier.flamethrower .weapon {
    top: 20px;
    right: -25px;
    width: 35px;
    height: 12px;
    background: linear-gradient(90deg, #34495e, #2c3e50);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.soldier.flamethrower .weapon::before {
    content: '';
    position: absolute;
    right: -5px;
    top: 2px;
    width: 15px;
    height: 8px;
    background: linear-gradient(90deg, #2c3e50, #1a252f);
    border-radius: 4px;
}

.soldier.flamethrower .weapon::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 4px;
    width: 8px;
    height: 4px;
    background: #f39c12;
    border-radius: 2px;
    animation: flame 0.5s infinite alternate;
    box-shadow: 0 0 10px #f39c12;
}

@keyframes flame {
    0% { 
        background: #f39c12;
        transform: scale(1);
        box-shadow: 0 0 10px #f39c12;
    }
    100% { 
        background: #e74c3c;
        transform: scale(1.2);
        box-shadow: 0 0 15px #e74c3c;
    }
}

/* Chân lính */
.legs {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 15px;
}

.legs::before,
.legs::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 15px;
    background: linear-gradient(180deg, #2c3e50, #1a252f);
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.legs::before {
    left: 2px;
}

.legs::after {
    right: 2px;
}

/* Số lượng lính */
.soldier-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(45deg, #f1c40f, #f39c12);
    color: #2c3e50;
    border-radius: 12px;
    min-width: 25px;
    height: 25px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

/* Số lượng lính cho số lớn (3 chữ số) */
.soldier-count.large-number {
    font-size: 10px;
    min-width: 30px;
}

/* Kẻ thù */
.soldier.enemy .soldier-figure {
    filter: hue-rotate(180deg) brightness(0.8);
    border: 2px solid #e74c3c;
}

/* Thông báo trận đấu */
.battle-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 20px;
    border: 3px solid #f39c12;
    z-index: 1000;
    text-align: center;
    min-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.battle-notification.hidden {
    display: none;
}

.notification-content {
    color: white;
}

.notification-text {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.notification-reward {
    font-size: 1.5em;
    color: #f1c40f;
    font-weight: bold;
}

/* Hiệu ứng chiến đấu */
.battle-effect {
    animation: battle-shake 0.8s ease-in-out;
}

@keyframes battle-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* Hiệu ứng tấn công cho từng loại lính */

/* Hiệu ứng sóng kiếm */
.sword-wave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border: 3px solid #f1c40f;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
}

.sword-wave.active {
    animation: sword-wave-effect 0.8s ease-out;
}

@keyframes sword-wave-effect {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.3);
        border-color: #f1c40f;
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(0.8);
        border-color: #e67e22;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
        border-color: #c0392b;
    }
}

/* Hiệu ứng lửa */
.flame-effect {
    position: absolute;
    top: 20px;
    right: -40px;
    width: 60px;
    height: 40px;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
}

.flame-effect.active {
    animation: flame-burst 0.8s ease-out;
}

.flame-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #ff6b35 0%, #f7931e 50%, #ffcc02 100%);
    border-radius: 50%;
    opacity: 0;
}

@keyframes flame-burst {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes flame-particle {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--dx), var(--dy)) scale(0.3);
    }
}

/* Hiệu ứng đạn súng trường */
.bullet-effect {
    position: absolute;
    top: 27px;
    right: -15px;
    width: 4px;
    height: 2px;
    background: linear-gradient(90deg, #f1c40f, #fff);
    border-radius: 1px;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
    box-shadow: 0 0 8px #f1c40f;
}

.bullet-effect.active {
    animation: bullet-fire 0.6s ease-out;
}

@keyframes bullet-fire {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translateX(100px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateX(200px) scale(0.5);
    }
}

/* Hiệu ứng nổ khi đạn trúng */
.bullet-impact {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff 0%, #f1c40f 30%, #e67e22 70%, transparent 100%);
    opacity: 0;
    pointer-events: none;
    z-index: 25;
}

.bullet-impact.active {
    animation: bullet-explosion 0.4s ease-out;
}

@keyframes bullet-explosion {
    0% {
        opacity: 1;
        transform: scale(0.2);
    }
    50% {
        opacity: 0.8;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.5);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .control-panel {
        width: 300px;
        bottom: 10px;
        left: 10px;
    }
    
    .game-title {
        font-size: 1.5em;
    }
    
    .hud {
        padding: 0 15px;
        height: 60px;
    }
    
    .battlefield-arena {
        top: 60px;
    }
    
    .army-zone {
        padding: 15px;
    }
    
    .attack-button {
        padding: 15px 20px;
        font-size: 1.2em;
    }
}