/* TV HUD Enhancements (Phase 8 Polish) */
.tv-hud {
    position: absolute;
    top: 30px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 50px;
    pointer-events: none;
    z-index: 100;
}

.tv-p1-stats,
.tv-p2-stats {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.6);
    padding: 15px 30px;
    border-radius: 50px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
}

.tv-p1-stats {
    border-color: #3498db;
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.3);
}

.tv-p2-stats {
    border-color: #e74c3c;
    flex-direction: row-reverse;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.3);
}

.tv-p1-stats .faction-icon,
.tv-p2-stats .faction-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

.tv-p1-stats .name,
.tv-p2-stats .name {
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    text-shadow: 0 2px 4px black;
}

.tv-p1-stats .hp-bar-container,
.tv-p2-stats .hp-bar-container {
    width: 200px;
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    margin-top: 5px;
    overflow: hidden;
}

.tv-p1-stats .hp-bar {
    background: #3498db;
    height: 100%;
}

.tv-p2-stats .hp-bar {
    background: #e74c3c;
    height: 100%;
}

.tv-vs {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 4rem;
    font-weight: 900;
    font-style: italic;
    color: var(--gold-base);
    text-shadow: 0 0 20px rgba(245, 215, 66, 0.8), 3px 3px 0px black;
    background: transparent;
    animation: vs-pulse 2s infinite;
}

@keyframes vs-pulse {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
    }

    50% {
        transform: translateX(-50%) scale(1.1);
        filter: brightness(1.2);
    }
}

/* === PHASE 9 TV HUD ENHANCEMENTS === */

/* Match Timer */
.tv-timer {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 80px;
    font-size: 1.5rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 4px black;
}

/* HP Bar Animations */
.hp-bar {
    transition: width 0.5s ease-out;
}

.hp-bar.low {
    animation: hp-warning 0.5s infinite;
}

@keyframes hp-warning {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Floating Damage Numbers */
.damage-number {
    position: absolute;
    font-weight: bold;
    font-size: 1.2rem;
    animation: damage-float 1s ease-out forwards;
    pointer-events: none;
    z-index: 500;
}

.damage-number.player {
    color: #e74c3c;
}

.damage-number.enemy {
    color: #3498db;
}

@keyframes damage-float {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-30px) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translateY(-50px) scale(0.8);
    }
}

/* Age Evolution Announcement */
.age-announcement {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--gold-base);
    text-shadow: 0 0 30px rgba(245, 215, 66, 0.8), 4px 4px 0px black;
    animation: age-announce 2.5s ease-out forwards;
    z-index: 1000;
}

@keyframes age-announce {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    40% {
        transform: translate(-50%, -50%) scale(1);
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-50px);
    }
}

/* === TV HUD RESOURCE DISPLAY === */
.tv-resources {
    display: flex;
    gap: 15px;
    margin-top: 5px;
    font-size: 1rem;
    font-weight: 700;
}

.tv-gold {
    color: var(--gold-base);
}

.tv-xp {
    color: var(--accent-base);
}

/* === XP VALUE ANIMATION === */
.tv-xp span,
.tv-gold span {
    transition: transform 0.3s ease-out, color 0.3s ease-out;
    display: inline-block;
}

.tv-xp span.pulse-up,
.tv-gold span.pulse-up {
    animation: value-pulse-up 0.5s ease-out;
}

.tv-xp span.pulse-down,
.tv-gold span.pulse-down {
    animation: value-pulse-down 0.5s ease-out;
}

@keyframes value-pulse-up {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
        color: #00ff00;
        text-shadow: 0 0 10px #00ff00;
    }

    100% {
        transform: scale(1);
    }
}

@keyframes value-pulse-down {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.8);
        color: #ff4444;
        text-shadow: 0 0 10px #ff4444;
    }

    100% {
        transform: scale(1);
    }
}

/* === STATS MODAL === */
#stats-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

#stats-modal.hidden {
    display: none;
}

.stats-modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid var(--gold-base, #f5d742);
    border-radius: 20px;
    padding: 30px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(245, 215, 66, 0.3);
}

.stats-modal-content h2 {
    color: var(--gold-base, #f5d742);
    font-size: 2rem;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px black;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.1rem;
    color: white;
}

.stats-table th,
.stats-table td {
    padding: 12px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-table th {
    background: rgba(0, 0, 0, 0.4);
    color: var(--gold-base, #f5d742);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.stats-table .base-row td {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

.stats-table .faction-row td {
    background: rgba(0, 0, 0, 0.2);
}

.stats-table .stat-up {
    color: #2ecc71;
    font-weight: 700;
}

.stats-table .stat-down {
    color: #e74c3c;
    font-weight: 700;
}

#btn-close-stats {
    position: absolute;
    top: 15px;
    right: 20px;
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: transform 0.2s;
}

#btn-close-stats:hover {
    transform: scale(1.2);
    color: #e74c3c;
}

/* Stats Button */
#btn-stats {
    background: linear-gradient(135deg, #2c3e50, #1a252f);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

#btn-stats:hover {
    background: linear-gradient(135deg, #f5d742, #d4b82e);
    color: #1a1a2e;
    border-color: #f5d742;
    transform: scale(1.05);
}

/* === TV VERSION DISPLAY === */
.tv-version {
    position: absolute;
    bottom: 10px;
    right: 60px;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-shadow: 0 1px 2px black;
    font-family: 'Outfit', monospace;
    letter-spacing: 1px;
}