/* Глобальні стилі та анімації */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(123, 44, 191, 0.5); }
    50% { box-shadow: 0 0 40px rgba(123, 44, 191, 0.9); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes slideUp {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes damageNumber {
    0% { 
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }
    20% {
        opacity: 1;
        transform: translateY(-20px) scale(1.5);
    }
    100% {
        transform: translateY(-80px) scale(1);
        opacity: 0;
    }
}

@keyframes critEffect {
    0% { 
        transform: scale(0.8) rotate(0deg);
        opacity: 0;
    }
    50% {
        opacity: 1;
        transform: scale(1.5) rotate(180deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 0;
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    background-size: 200% 200%;
    background-attachment: fixed;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    overflow-x: hidden;
    color: #ffffff;
    position: relative;
}

/* Частинки на фоні */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 70%);
    border-radius: 50%;
    animation: particleFloat 15s linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) translateX(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) translateX(100px) scale(1);
        opacity: 0;
    }
}

/* Контейнер арени */
.battle-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
    position: relative;
    z-index: 1;
}

/* Верхня панель */
.top-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    margin-bottom: 20px;
    border: 2px solid rgba(123, 44, 191, 0.3);
    animation: slideUp 0.6s ease;
}

.back-btn {
    background: linear-gradient(135deg, #dc3545, #c0392b);
    border: none;
    padding: 12px 24px;
    border-radius: 15px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(220, 53, 69, 0.6);
}

.back-btn span {
    margin-right: 8px;
    font-size: 20px;
}

.round-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.round-label {
    font-size: 12px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.round-number {
    font-size: 22px;
    font-weight: bold;
    color: #f39c12;
    text-shadow: 0 0 8px rgba(243, 156, 18, 0.8);
}

/* Поле бою */
.battle-field {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    margin: 30px 0;
    align-items: center;
    animation: fadeIn 0.8s ease;
}

.fighter {
    position: relative;
    animation: slideUp 0.8s ease;
    width: 200px;
    margin: 0 auto;
}

.fighter.player-side {
    animation-delay: 0.1s;
}

.fighter.enemy-side {
    animation-delay: 0.2s;
}

.fighter-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(123, 44, 191, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 3s ease-in-out infinite;
    pointer-events: none;
}

.character-frame {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    border: 3px solid rgba(123, 44, 191, 0.5);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.fighter:hover .character-frame {
    border-color: rgba(123, 44, 191, 0.9);
    transform: scale(1.02);
    box-shadow: 0 15px 50px rgba(123, 44, 191, 0.4);
}

.character-image {
    width: 100%;
    height: 300px; /* Змінено висоту */
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.fighter:hover .character-image {
    transform: scale(1.05);
}

.damage-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: bold;
    color: #ff4444;
    text-shadow: 0 0 20px #ff0000, 2px 2px 4px #000;
    pointer-events: none;
    z-index: 10;
}

.effect-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.fighter-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
}

.fighter-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
    text-align: center;
    color: #ffffff;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.8);
}

.enemy-name {
    color: #ff6b6b;
}

.hp-container {
    margin: 0;
}

.hp-bar {
    position: relative;
    height: 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.5);
}

.hp-bar-fill {
    position: absolute;
    height: 100%;
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.player-hp {
    background: linear-gradient(90deg, #4CAF50, #45a049);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
}

.enemy-hp {
    background: linear-gradient(90deg, #ff4444, #cc0000);
}

.hp-bar-damage {
    position: absolute;
    height: 100%;
    background: rgba(255, 100, 100, 0.5);
    border-radius: 15px;
    transition: width 0.5s ease, opacity 0.5s ease;
}

.hp-text {
    display: none; /* Приховуємо текстове значення HP, оскільки смуга вже інформативна */
}

.hp-divider {
    opacity: 0.6;
    margin: 0 5px;
}

.stats-container {
    position: absolute;
    top: 10px;
    left: -60px;
    right: -60px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.stats-left, .stats-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stats-left span, .stats-right span {
    background: rgba(0,0,0,0.6);
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 12px;
    color: white;
    pointer-events: all;
    border: 1px solid rgba(255,255,255,0.2);
}

.stats-quick span {
    font-size: 13px;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 10px;
    border-radius: 8px;
}

/* VS індикатор */
.vs-indicator {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 3s ease-in-out infinite;
}

.vs-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(243, 156, 18, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.vs-text {
    font-size: 48px;
    font-weight: 900;
    color: #f39c12;
    text-shadow: 0 0 20px rgba(243, 156, 18, 1),
                 0 0 40px rgba(243, 156, 18, 0.8),
                 2px 2px 10px rgba(0, 0, 0, 0.8);
    letter-spacing: 3px;
    z-index: 1;
}

/* Панель керування */
.controls-panel {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    padding: 20px;
    border: 2px solid rgba(123, 44, 191, 0.3);
    animation: slideUp 1s ease;
    animation-delay: 0.3s;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.control-section {
    flex: 1;
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
    color: #f39c12;
    text-shadow: 0 2px 10px rgba(243, 156, 18, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.zone-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.zone-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 60px;
}

.zone-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(123, 44, 191, 0.8);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(123, 44, 191, 0.4);
}

.zone-btn.active {
    background: linear-gradient(135deg, #7b2cbf, #5a189a);
    border-color: #7b2cbf;
    box-shadow: 0 5px 25px rgba(123, 44, 191, 0.6);
    transform: translateY(-3px);
}

.zone-icon {
    font-size: 22px; /* Зменшено іконку */
}

.zone-name {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.defense-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.defense-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 60px;
}

.defense-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(52, 152, 219, 0.8);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(52, 152, 219, 0.4);
}

.defense-btn.active {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-color: #3498db;
    box-shadow: 0 5px 25px rgba(52, 152, 219, 0.6);
    transform: translateY(-3px);
}

.defense-zones {
    font-size: 20px; /* Зменшено іконки */
}

.defense-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Кнопка атаки */
.attack-button-container {
    margin-top: 20px;
}

.attack-button {
    position: relative;
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #dc3545, #c0392b);
    border: none;
    border-radius: 15px;
    color: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.attack-button:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(220, 53, 69, 0.7);
}

.attack-button:active {
    transform: translateY(-2px) scale(0.98);
}

.attack-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.attack-icon {
    margin-right: 10px;
    font-size: 28px;
}

.button-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.attack-button:hover .button-glow {
    left: 100%;
}

/* Лог бою */
.battle-log {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    margin-top: 25px;
    border: 2px solid rgba(123, 44, 191, 0.3);
    overflow: hidden;
    animation: slideUp 1.2s ease;
    animation-delay: 0.4s;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: bold;
    cursor: pointer;
}

.log-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.log-header:hover .log-toggle {
    transform: scale(1.2);
}

.log-content {
    max-height: 150px; /* Зменшено висоту */
    overflow-y: auto;
    padding: 10px 15px; /* Зменшено відступи */
}

.log-content::-webkit-scrollbar {
    width: 8px;
}

.log-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.log-content::-webkit-scrollbar-thumb {
    background: rgba(123, 44, 191, 0.5);
    border-radius: 10px;
}

.log-content::-webkit-scrollbar-thumb:hover {
    background: rgba(123, 44, 191, 0.8);
}

.log-entry {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
    line-height: 1.6;
    animation: fadeIn 0.5s ease;
}

.log-entry:last-child {
    border-bottom: none;
}

/* Модал результату */
.result-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.result-modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95), rgba(48, 43, 99, 0.95));
    border-radius: 30px;
    padding: 40px;
    max-width: 600px;
    width: 100%;
    text-align: center;
    border: 3px solid rgba(123, 44, 191, 0.5);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.5s ease;
}

.result-icon {
    font-size: 100px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

.result-title {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.result-message {
    font-size: 18px;
    margin-bottom: 25px;
    opacity: 0.9;
}

.result-rewards {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 15px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-btn.primary {
    background: linear-gradient(135deg, #28a745, #218838);
    color: white;
    box-shadow: 0 5px 20px rgba(40, 167, 69, 0.4);
}

.modal-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(40, 167, 69, 0.6);
}

.modal-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.modal-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

/* Адаптивність для мобільних пристроїв */
@media (max-width: 1024px) {
    .battle-field {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .vs-indicator {
        order: 2;
        margin: 5px auto;
    }
    
    .fighter.player-side {
        order: 1;
    }
    
    .fighter.enemy-side {
        order: 3;
    }
    
.character-image {
        height: 350px;
    }
}

@media (max-width: 768px) {
    .battle-container {
        padding: 10px;
    }
    
    .top-bar {
        padding: 12px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .back-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .round-counter {
        padding: 8px 20px;
    }
    
    .round-number {
        font-size: 24px;
    }
    
.character-image {
        height: 320px;
    }
    
    .fighter-name {
        font-size: 18px;
    }
    
    .hp-bar {
        height: 25px;
    }
    
    .hp-text {
        font-size: 14px;
    }
    
    .stats-quick span {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .vs-indicator {
        width: 80px;
        height: 80px;
    }
    
    .vs-text {
        font-size: 36px;
    }
    
    .controls-panel {
        padding: 20px 15px;
    }
    
    .section-title {
        font-size: 16px;
    }
    
    .zone-grid,
    .defense-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .zone-btn,
    .defense-btn {
        padding: 12px;
    }
    
    .zone-icon {
        font-size: 24px;
    }
    
    .zone-name,
    .defense-label {
        font-size: 11px;
    }
    
    .defense-zones {
        font-size: 20px;
    }
    
    .attack-button {
        padding: 18px;
        font-size: 20px;
    }
    
    .attack-icon {
        font-size: 24px;
    }
    
    .log-content {
        max-height: 200px;
    }
    
    .log-entry {
        font-size: 12px;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .result-icon {
        font-size: 80px;
    }
    
    .result-title {
        font-size: 28px;
    }
    
    .result-message {
        font-size: 16px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .zone-grid,
    .defense-grid {
        grid-template-columns: 1fr;
    }
    
.character-image {
        height: 300px;
    }
}

/* Ефекти частинок */
.particle-effect {
    position: absolute;
    pointer-events: none;
    animation: particleRise 1s ease-out forwards;
}

@keyframes particleRise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) scale(0);
        opacity: 0;
    }
}

/* Ефект удару */
.hit-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 0, 0, 0.5) 0%, transparent 70%);
    animation: hitFlash 0.3s ease-out;
    pointer-events: none;
}

@keyframes hitFlash {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* Ефект критичного удару */
.crit-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.7) 0%, transparent 70%);
    animation: critFlash 0.5s ease-out;
    pointer-events: none;
}

@keyframes critFlash {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.5); }
}

/* Ефект блоку */
.block-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 5px solid rgba(52, 152, 219, 0.8);
    border-radius: 20px;
    animation: blockPulse 0.4s ease-out;
    pointer-events: none;
}

@keyframes blockPulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.2); opacity: 0; }
}

/* Ефект ухилення */
.dodge-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    animation: dodgeBlur 0.4s ease-out;
    pointer-events: none;
    filter: blur(10px);
}

@keyframes dodgeBlur {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(50px); opacity: 0; }
}
