/* =========================================
   ШРИФТЫ (FONTS)
   ========================================= */

/* --- 1. Вариативные шрифты (Variable Fonts) --- */
@font-face {
    font-family: 'Jura';
    src: url('../assets/fonts/Jura/Jura[wght].ttf') format('truetype');
    font-weight: 100 900;
}
@font-face {
    font-family: 'Montserrat';
    src: url('../assets/fonts/Montserrat/Montserrat[wght].ttf') format('truetype');
    font-weight: 100 900;
}
@font-face {
    font-family: 'Montserrat';
    src: url('../assets/fonts/Montserrat/Montserrat-Italic[wght].ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
}
@font-face {
    font-family: 'Cormorant Garamond';
    src: url('../assets/fonts/CormorantGaramond/CormorantGaramond[wght].ttf') format('truetype');
    font-weight: 100 900;
}
@font-face {
    font-family: 'Cormorant Garamond';
    src: url('../assets/fonts/CormorantGaramond/CormorantGaramond-Italic[wght].ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
}

/* --- 2. Статические многофайловые шрифты --- */
/* BigShouldersStencilText */
@font-face { font-family: 'Big Shoulders Stencil Text'; src: url('../assets/fonts/BigShouldersStencilText/BigShouldersStencilText-Thin.ttf') format('truetype'); font-weight: 100; }
@font-face { font-family: 'Big Shoulders Stencil Text'; src: url('../assets/fonts/BigShouldersStencilText/BigShouldersStencilText-Light.ttf') format('truetype'); font-weight: 300; }
@font-face { font-family: 'Big Shoulders Stencil Text'; src: url('../assets/fonts/BigShouldersStencilText/BigShouldersStencilText-Regular.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'Big Shoulders Stencil Text'; src: url('../assets/fonts/BigShouldersStencilText/BigShouldersStencilText-Medium.ttf') format('truetype'); font-weight: 500; }
@font-face { font-family: 'Big Shoulders Stencil Text'; src: url('../assets/fonts/BigShouldersStencilText/BigShouldersStencilText-SemiBold.ttf') format('truetype'); font-weight: 600; }
@font-face { font-family: 'Big Shoulders Stencil Text'; src: url('../assets/fonts/BigShouldersStencilText/BigShouldersStencilText-Bold.ttf') format('truetype'); font-weight: 700; }
@font-face { font-family: 'Big Shoulders Stencil Text'; src: url('../assets/fonts/BigShouldersStencilText/BigShouldersStencilText-ExtraBold.ttf') format('truetype'); font-weight: 800; }
@font-face { font-family: 'Big Shoulders Stencil Text'; src: url('../assets/fonts/BigShouldersStencilText/BigShouldersStencilText-Black.ttf') format('truetype'); font-weight: 900; }

/* PostNoBillsColombo */
@font-face { font-family: 'Post No Bills Colombo'; src: url('../assets/fonts/PostNoBillsColombo/PostNoBillsColombo-Light.ttf') format('truetype'); font-weight: 300; }
@font-face { font-family: 'Post No Bills Colombo'; src: url('../assets/fonts/PostNoBillsColombo/PostNoBillsColombo-Regular.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'Post No Bills Colombo'; src: url('../assets/fonts/PostNoBillsColombo/PostNoBillsColombo-Medium.ttf') format('truetype'); font-weight: 500; }
@font-face { font-family: 'Post No Bills Colombo'; src: url('../assets/fonts/PostNoBillsColombo/PostNoBillsColombo-SemiBold.ttf') format('truetype'); font-weight: 600; }
@font-face { font-family: 'Post No Bills Colombo'; src: url('../assets/fonts/PostNoBillsColombo/PostNoBillsColombo-Bold.ttf') format('truetype'); font-weight: 700; }
@font-face { font-family: 'Post No Bills Colombo'; src: url('../assets/fonts/PostNoBillsColombo/PostNoBillsColombo-ExtraBold.ttf') format('truetype'); font-weight: 800; }

/* Oswald */
@font-face { font-family: 'Oswald'; src: url('../assets/fonts/Oswald/Oswald-ExtraLight.ttf') format('truetype'); font-weight: 200; }
@font-face { font-family: 'Oswald'; src: url('../assets/fonts/Oswald/Oswald-Light.ttf') format('truetype'); font-weight: 300; }
@font-face { font-family: 'Oswald'; src: url('../assets/fonts/Oswald/Oswald-Regular.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'Oswald'; src: url('../assets/fonts/Oswald/Oswald-Medium.ttf') format('truetype'); font-weight: 500; }
@font-face { font-family: 'Oswald'; src: url('../assets/fonts/Oswald/Oswald-SemiBold.ttf') format('truetype'); font-weight: 600; }
@font-face { font-family: 'Oswald'; src: url('../assets/fonts/Oswald/Oswald-Bold.ttf') format('truetype'); font-weight: 700; }

/* --- 3. Одновесовые шрифты --- */
@font-face { font-family: 'Russo One'; src: url('../assets/fonts/RussoOne/RussoOne-Regular.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'Sofia Sans Condensed'; src: url('../assets/fonts/SofiaSansCondensed/SofiaSansCondensed.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'Kenyan Coffee Stencil'; src: url('../assets/fonts/KenyanCoffeeStencil/KenyanCoffeeStencilSb-Regular.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'Boston Traffic'; src: url('../assets/fonts/BostonTraffic/BostonTraffic.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'USSR Stencil'; src: url('../assets/fonts/USSRStencil/USSRStencil-Regular.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'Capture It'; src: url('../assets/fonts/CaptureIt/CaptureIt.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'Forum'; src: url('../assets/fonts/Forum/Forum-Regular.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'PT Mono'; src: url('../assets/fonts/PTMono/PTM55FT.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'Armalite Rifle'; src: url('../assets/fonts/ArmaliteRifle/ArmaliteRifle.ttf') format('truetype'); font-weight: 400; }

:root {
    --panel-bg: rgba(0, 0, 0, 0.2);
    --border-light: rgba(255, 255, 255, 0.2);
    --text-main: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent-active: rgba(255, 255, 255, 0.2);
    --accent-red: rgba(231, 76, 60, 0.6);
    --glass-blur: 10px;
    --top-bar-h: 48px;
    --ui-width: 230px;
    
    /* Global Board Scales */
    --sf: 1; /* Обновляется из JS */
    --card-w-base: 300px;
    --card-h-base: 428px;
    --card-scale: 0.4667; 
    --card-w: calc(140px * var(--sf));
    --card-h: calc(200px * var(--sf));
    
    --sidebar-w: calc(450px * var(--sf));
    --margin-board: 30px;
    --gap-board: calc(15px * var(--sf));

    /* Phaser-Matched Lines Math */
    --board-h: calc(100vh - var(--top-bar-h));
    --bot-y: calc(calc(var(--margin-board) * var(--sf)) + var(--card-h) / 2);
    --hand-y: calc(var(--board-h) - calc(var(--margin-board) * var(--sf)) - var(--card-h) / 2);
    
    --line-bot-y: var(--bot-y);
    --line-hand-y: var(--hand-y);
    
    /* Fixed 20px * sf gap between Hand and Player rows */
    --line-player-y: calc(var(--line-hand-y) - var(--card-h) - calc(20px * var(--sf)));
    
    /* Dynamic combat zone borders with fixed 20px * sf gaps */
    --combat-top: calc(var(--line-bot-y) + var(--card-h) / 2 + calc(20px * var(--sf)));
    --combat-bottom: calc(var(--line-player-y) - var(--card-h) / 2 - calc(20px * var(--sf)));
    
    /* Dynamic height of the combat plate */
    --combat-h: calc(var(--combat-bottom) - var(--combat-top));
    
    /* Dynamic combat card shifts relative to the combat zone borders */
    --combat-attacker-shift: calc(var(--combat-h) / 2 - var(--card-h) / 2 - calc(10px * var(--sf)));
    
    /* Dynamic remaining space divided equally for the upper section */
    --v-step: calc((var(--line-player-y) - var(--line-bot-y)) / 2);
    --line-combat-y: calc((var(--combat-top) + var(--combat-bottom)) / 2);
}

body {
    margin: 0;
    padding: 0;
    background: #000;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: transparent;
}

.glass-panel {
    background: var(--panel-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-light);
    border-radius: 2px;
}

.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--top-bar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    box-sizing: border-box;
    z-index: 1000;
}

/* Независимый стиль шапки в Лобби (Меню) */
#menu-interface .top-bar {
    background: var(--panel-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--border-light);
}

/* Независимый стиль шапки в Игре */
#game-interface .top-bar {
    background: var(--panel-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--border-light);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.top-bar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(14px * var(--sf));
}

.header-counter {
    font-family: 'Oswald', sans-serif;
    font-size: calc(20px * var(--sf));
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: calc(4px * var(--sf));
    white-space: nowrap;
}

#player-hand-counter {
    color: #ffcc00;
}

#bot-hand-counter {
    color: rgba(255, 255, 255, 0.5);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.flag-icon {
    width: 18px;
    height: 12px;
    display: inline-block;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
}

.flag-ua { background-image: url('../assets/flags/flag_ua.webp'); }
.flag-en { background-image: url('../assets/flags/flag_en.webp'); }
.flag-ru { background-image: url('../assets/flags/flag_ru.webp'); }

.lang-dropdown { position: relative; }

.lang-current {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-light);
    padding: 0 12px;
    height: 32px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 70px;
    transition: 0.2s;
}

.lang-list {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(15, 15, 15, 0.98);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-light);
    display: none;
    flex-direction: column;
    min-width: 110px;
}

.lang-list.show { display: flex; }

.lang-option {
    padding: 10px 15px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.2s;
    color: var(--text-secondary);
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.login-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.login-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 200px;
    padding: 30px;
}

.login-title {
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 25px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.login-input {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid var(--border-light);
    color: #fff;
    padding: 0 15px;
    height: 42px;
    font-size: 14px;
    margin-bottom: 15px;
    text-align: center;
    width: 100%;
    outline: none;
    box-sizing: border-box;
}

.login-button {
    background: #fff;
    color: #000;
    border: none;
    height: 42px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 90;
    background: rgba(0, 0, 0, 0.5);
    transition: opacity 0.5s;
}

.logout-btn, .profile-btn {
    color: var(--text-secondary);
    font-size: 11px;
    letter-spacing: 2px;
    cursor: pointer;
    padding: 0 15px;
    border: 1px solid var(--border-light);
    height: 32px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    transition: 0.3s;
}

.logout-btn:hover, .profile-btn:hover {
    color: #fff;
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Боевой интерфейс: ники игроков */
.game-nick-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    color: #ffffff;
    text-transform: uppercase;
    opacity: 0.9;
}

.game-nick-opponent {
    color: var(--text-secondary);
    font-weight: 400;
}

/* Кнопка СДАТЬСЯ */
.surrender-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 11px;
    letter-spacing: 2px;
    cursor: pointer;
    padding: 0 16px;
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    box-sizing: border-box;
    transition: 0.3s;
    border-radius: 8px;
}

.surrender-btn:hover {
    color: #ff4444;
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

.menu-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    height: 100%;
    padding: calc(var(--top-bar-h) + 25px) 25px 25px 25px;
    box-sizing: border-box;
}

.menu-left-group {
    display: flex;
    gap: 25px;
}

.menu-column {
    width: var(--ui-width);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.menu-section-title {
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
    padding-left: 5px;
}

.menu-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    width: var(--ui-width);
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    text-align: center;
    color: var(--text-secondary);
    box-sizing: border-box;
}

.menu-item.active {
    background: var(--accent-active);
    color: #fff;
    border-color: #fff;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.side-row {
    display: flex;
    gap: 10px;
    width: var(--ui-width);
}

.side-btn {
    flex: 1;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    cursor: pointer;
    font-size: 11px;
    letter-spacing: 2px;
    transition: 0.3s;
    color: var(--text-secondary);
}

.side-btn.active {
    background: var(--accent-active);
    color: #fff;
    border-color: #fff;
}

.side-btn.active.afu {
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.2);
}

.side-btn.active.rf {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.2);
}

/* КНОПКА "В БОЙ!" ВНИЗУ СПРАВА */
#start-btn {
    position: absolute;
    bottom: 25px;
    right: 25px;
    width: var(--ui-width);
    height: 50px;
    background: var(--accent-red);
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 4px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: 0.3s;
    text-transform: uppercase;
}

#start-btn:hover {
    background: rgba(231, 76, 60, 0.8);
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.3);
}

/* Utility classes to replace inline styles */
#global-fade {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    pointer-events: none;
    transition: opacity 0.4s ease-in-out;
    opacity: 1;
}

#global-bg-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.z-index-1 { z-index: 1; }
.text-bold-spaced { color: #fff; font-weight: bold; letter-spacing: 2px; }
.opacity-50 { opacity: 0.5; }
.mt-20 { margin-top: 20px; }
.pointer-auto { pointer-events: auto; }
.text-online { color: #2ecc71; }

.game-overlay-hidden {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 95;
}

/* -------------------------------------------
   NEW DOM-BASED TACTICAL BOARD STYLES
------------------------------------------- */

.hidden { display: none !important; }

.scene-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

#game-board-layout {
    position: absolute;
    top: var(--top-bar-h);
    left: 0;
    width: 100%;
    height: calc(100% - var(--top-bar-h));
    display: flex;
}

#tactical-board {
    position: relative;
    width: calc(100% - var(--sidebar-w));
    height: 100%;
    overflow: hidden;
}

#sidebar-panel {
    width: var(--sidebar-w);
    height: 100%;
    position: relative;
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}

#board-border-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.board-row {
    position: absolute;
    left: calc(var(--margin-board) * var(--sf));
    width: calc(100% - calc(var(--margin-board) * var(--sf)) * 2);
    height: var(--card-h);
    display: flex;
    align-items: center;
    pointer-events: none; /* Let clicks pass to background if needed */
}

/* Base Y coordinates matched 100% to Phaser center-line calculations */
.line-bot { top: calc(var(--line-bot-y) - var(--card-h) / 2); }
.line-combat {
    top: var(--combat-top);
    height: var(--combat-h);
}
.line-player { top: calc(var(--line-player-y) - var(--card-h) / 2); }
.line-hand { top: calc(var(--line-hand-y) - var(--card-h) / 2); }

/* --- Красная зона боя (Combat Zone Strip) --- */
.combat-zone-bg {
    position: absolute;
    left: calc(-1 * var(--margin-board) * var(--sf));
    top: 0;
    width: calc(100% + var(--margin-board) * var(--sf) * 2);
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(231, 76, 60, 0.08) 15%,
        rgba(231, 76, 60, 0.18) 50%,
        rgba(231, 76, 60, 0.08) 85%,
        transparent 100%
    );
    border-top: 1px solid rgba(231, 76, 60, 0.45);
    border-bottom: 1px solid rgba(231, 76, 60, 0.45);
    box-shadow:
        0 0 18px rgba(231, 76, 60, 0.12) inset,
        0 1px 0 rgba(231, 76, 60, 0.2),
        0 -1px 0 rgba(231, 76, 60, 0.2);
    pointer-events: none;
    z-index: 0;
}

.combat-cards {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Card DOM Classes */
.card-dom {
    pointer-events: auto;
    cursor: pointer;
    background-color: #15171e;
    transition: filter 0.3s ease, box-shadow 0.2s ease, transform 0.2s ease, z-index 0.2s ease, top 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    transform: translate(var(--tx, -50%), var(--ty, -50%)) scale(var(--ts, calc(var(--card-scale) * var(--sf))));
    border-radius: 26px;
    overflow: hidden;
    width: 300px;
    height: 428px;
    position: absolute;
    transform-origin: center center;
    will-change: top, left;
    /* We handle transform animation via JS or setting CSS vars explicitly on hover */
}

.card-dom.exhausted {
    filter: brightness(0.55) grayscale(100%) contrast(0.95);
}

.card-dom:hover {
    --ts: calc(var(--card-scale) * var(--sf) * 1.05);
    --ty: calc(-50% - 15px);
    z-index: 1000 !important;
}

.card-dom.selected {
    --ts: calc(var(--card-scale) * var(--sf));
    --ty: calc(-50% - 30px);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    z-index: 1000 !important;
}

.card-dom.faction-afu.selected {
    box-shadow: 0 0 25px rgba(33, 150, 243, 0.95), 0 0 10px rgba(33, 150, 243, 0.5) !important;
}

.card-dom.faction-rf.selected {
    box-shadow: 0 0 25px rgba(244, 67, 54, 0.95), 0 0 10px rgba(244, 67, 54, 0.5) !important;
}


.card-dom.blocker {
    z-index: 1500 !important;
}

.card-dom.blocker:hover {
    z-index: 1501 !important;
}

.card-dom.dimmed {
    filter: brightness(0.35) grayscale(0.5) contrast(0.9) !important;
    pointer-events: none !important;
    transition: filter 0.3s, transform 0.3s;
}

.card-dom.valid-target {
    box-shadow: 0 0 18px rgba(231, 76, 60, 0.7) !important;
    animation: target-pulse 1.5s infinite ease-in-out;
    cursor: crosshair !important;
}

.card-dom.valid-target:hover {
    box-shadow: 0 0 30px rgba(231, 76, 60, 1.0) !important;
    --ts: calc(var(--card-scale) * var(--sf) * 1.08) !important;
    --ty: calc(-50% - 15px) !important;
    filter: brightness(1.2) !important;
    z-index: 1000 !important;
}

@keyframes target-pulse {
    0% { box-shadow: 0 0 18px rgba(231, 76, 60, 0.6); }
    50% { box-shadow: 0 0 30px rgba(231, 76, 60, 0.95); }
    100% { box-shadow: 0 0 18px rgba(231, 76, 60, 0.6); }
}

/* Matching CMS Card Structure */
.card-art-area {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    overflow: hidden;
    z-index: 1;
    /* Исправление бага Chromium/WebKit с overflow:hidden и скруглением углов для трансформированных потомков */
    transform: translateZ(0);
    will-change: transform;
    isolation: isolate;
}

.card-art-scaler {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: transform .1s ease-out;
    z-index: 1;
    mix-blend-mode: multiply;
}

.card-frame {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: 100% 100%;
    z-index: 2;
    pointer-events: none;
}

.fixed-item {
    position: absolute;
    z-index: 3;
    pointer-events: none;
}

.stat-name {
    transform: translate(-100%, -50%);
    text-align: right;
    white-space: nowrap;
    text-transform: none !important;
}

/* Cost is left-aligned by default, matching setOrigin(0,0) in Phaser */

/* -------------------------------------------
   TACTICAL BOARD SIDEBAR LAYOUT
   100% Phaser Coordinates Parity
------------------------------------------- */

#sidebar-panel {
    width: var(--sidebar-w);
    height: 100%;
    position: relative;
    border: none !important; /* Убираем любые рамки, унаследованные от glass-panel */
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.2) !important; /* Чистый черный с прозрачностью 0.2 без эффекта стекла */
    backdrop-filter: none !important; /* Принудительно отключаем размытие стекла */
    -webkit-backdrop-filter: none !important; /* Принудительно отключаем размытие стекла */
}

/* --- Visual Decks --- */
.deck-card-back {
    position: absolute;
    width: calc(140px * var(--sf)) !important;
    height: calc(200px * var(--sf)) !important;
    border-radius: calc(12px * var(--sf)) !important;
    border: calc(3px * var(--sf)) solid #ffffff !important;
    background-color: #6b7a3a !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="140" height="200" viewBox="0 0 140 200"><circle cx="35" cy="50" r="15" fill="%234a5a2a" opacity="0.6"/><circle cx="110" cy="40" r="18" fill="%233d5a1e" opacity="0.5"/><circle cx="80" cy="100" r="22" fill="%238b6914" opacity="0.4"/><circle cx="20" cy="140" r="16" fill="%233d5a1e" opacity="0.5"/><circle cx="120" cy="150" r="20" fill="%234a5a2a" opacity="0.6"/><circle cx="70" cy="30" r="12" fill="%238b6914" opacity="0.4"/><circle cx="115" cy="95" r="16" fill="%233d5a1e" opacity="0.5"/></svg>') !important;
    box-shadow: 0 calc(8px * var(--sf)) calc(20px * var(--sf)) rgba(0,0,0,0.5) !important;
}

#bot-deck-card {
    left: calc(30px * var(--sf));
    top: calc(30px * var(--sf));
    transform: none !important;
    z-index: 60 !important;
}

#player-deck-card {
    left: calc(30px * var(--sf));
    bottom: calc(30px * var(--sf));
    transform: none !important;
    z-index: 60 !important;
}

/* --- Deck Count Tabs --- */
.deck-tab-bg {
    position: absolute;
    width: calc(100px * var(--sf));
    height: calc(65px * var(--sf));
    background: linear-gradient(180deg, #525252 0%, #3a3a3a 100%) !important;
    border-radius: calc(12px * var(--sf));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50 !important;
    box-sizing: border-box;
}

#bot-deck-tab {
    left: calc(30px * var(--sf) + 73px * var(--sf));
    transform: translateX(-50%) !important;
    top: calc(30px * var(--sf) + 180px * var(--sf));
    padding-top: calc(20px * var(--sf));
}

#player-deck-tab {
    left: calc(30px * var(--sf) + 73px * var(--sf));
    transform: translateX(-50%) !important;
    bottom: calc(30px * var(--sf) + 180px * var(--sf));
    z-index: 50 !important;
    padding-bottom: calc(20px * var(--sf));
}

.deck-count-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: calc(28px * var(--sf));
    color: #ffffff;
    font-weight: normal;
}

/* --- Resource Groups --- */
.res-group {
    position: absolute;
    left: calc(200px * var(--sf));
    width: calc(220px * var(--sf));
    height: calc(92px * var(--sf));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 50;
}

#bot-resources-group {
    left: calc(200px * var(--sf));
    top: calc(30px * var(--sf) + 114px * var(--sf));
}

#player-resources-group {
    left: calc(200px * var(--sf));
    bottom: calc(30px * var(--sf) + 114px * var(--sf));
}

.res-item {
    font-family: 'Oswald', sans-serif;
    font-size: calc(24px * var(--sf));
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: calc(8px * var(--sf));
    white-space: nowrap;
    height: calc(28px * var(--sf));
    line-height: calc(28px * var(--sf));
}

.cp-res {
    color: #ffd700; /* Gold */
}

.fuel-res {
    color: #ff4444; /* Red */
}

.fact-res {
    color: #44bbff; /* Blue */
}

/* Анимация вспышки при пополнении ресурса (v6.2) */
@keyframes pulseGoldGlow {
    0%   { text-shadow: 0 0 0px transparent; filter: brightness(1); }
    30%  { text-shadow: 0 0 12px rgba(255, 215, 0, 0.9), 0 0 24px rgba(255, 215, 0, 0.5); filter: brightness(1.6); }
    100% { text-shadow: 0 0 0px transparent; filter: brightness(1); }
}

.pulse-glow {
    animation: pulseGoldGlow 0.7s ease-out forwards;
}

/* --- Center of Panel (Log and Chat Boxes) --- */
:root {
    --box-h: calc((100vh - 48px - 640px * var(--sf)) / 2);
}

.side-box {
    position: absolute;
    left: calc(30px * var(--sf));
    width: calc(var(--sidebar-w) - 60px * var(--sf));
    height: var(--box-h);
    border-radius: calc(12px * var(--sf));
    box-sizing: border-box;
    padding: calc(15px * var(--sf));
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.log-box-style {
    top: calc(305px * var(--sf));
    background: rgba(130, 156, 115, 0.2);
    border: calc(1px * var(--sf)) solid rgba(255, 255, 255, 0.5);
}

.chat-box-style {
    bottom: calc(305px * var(--sf));
    background: rgba(90, 122, 138, 0.2);
    border: calc(1px * var(--sf)) solid rgba(255, 255, 255, 0.5);
}

.side-box-text {
    font-family: 'Oswald', sans-serif;
    font-size: calc(16px * var(--sf));
    color: #ffffff;
    line-height: 1.4;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    font-family: 'Oswald', sans-serif;
    font-size: calc(14px * var(--sf));
    display: flex;
    flex-direction: column;
    gap: calc(4px * var(--sf));
    color: #ffffff;
    scrollbar-width: thin;
    margin-bottom: calc(8px * var(--sf));
}

.chat-messages-area::-webkit-scrollbar,
.side-box-text::-webkit-scrollbar {
    width: 4px;
}

.chat-messages-area::-webkit-scrollbar-thumb,
.side-box-text::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.chat-msg {
    word-break: break-word;
}

.chat-msg.system {
    color: #ffd700;
}

.chat-msg.user {
    color: #4facfe;
}

.chat-input-row {
    display: flex;
    gap: calc(6px * var(--sf));
    height: calc(32px * var(--sf));
}

#chat-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3) !important;
    border: calc(1px * var(--sf)) solid rgba(255, 255, 255, 0.2) !important;
    border-radius: calc(6px * var(--sf));
    color: #ffffff;
    font-family: 'Oswald', sans-serif;
    font-size: calc(13px * var(--sf));
    padding: 0 calc(10px * var(--sf));
    outline: none;
    box-sizing: border-box;
}

#chat-input:focus {
    border-color: rgba(255, 255, 255, 0.4) !important;
    background: rgba(0, 0, 0, 0.5) !important;
}

#chat-send-btn {
    width: calc(35px * var(--sf));
    background: rgba(255, 255, 255, 0.1) !important;
    border: calc(1px * var(--sf)) solid rgba(255, 255, 255, 0.2) !important;
    border-radius: calc(6px * var(--sf));
    color: #ffffff;
    cursor: pointer;
    font-family: 'Oswald', sans-serif;
    font-weight: bold;
    font-size: calc(14px * var(--sf));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}

#chat-send-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* --- Action Button --- */
#board-action-btn {
    position: absolute;
    left: calc(200px * var(--sf));
    bottom: calc(30px * var(--sf));
    width: calc(220px * var(--sf));
    height: calc(60px * var(--sf));
    border: calc(2px * var(--sf)) solid #ffffff !important;
    border-radius: calc(12px * var(--sf));
    font-size: calc(20px * var(--sf)) !important;
    letter-spacing: calc(1.5px * var(--sf)) !important;
    font-weight: 700 !important;
    font-family: 'Oswald', sans-serif !important;
    cursor: pointer;
    color: white;
    outline: none;
    text-shadow: 0 calc(1px * var(--sf)) calc(2px * var(--sf)) rgba(0,0,0,0.5);
    box-shadow: 0 calc(4px * var(--sf)) 0 calc(2px * var(--sf)) rgba(0,0,0,0.4);
    background: rgba(0, 179, 0, 0.8);
    transition: background 0.3s, transform 0.1s, box-shadow 0.2s;
    z-index: 100 !important;
    /* Улучшения для многострочного текста */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.15;
    padding: 0 calc(5px * var(--sf)) !important;
    white-space: pre-wrap;
}

#board-action-btn:hover {
    box-shadow: 0 calc(2px * var(--sf)) 0 calc(1px * var(--sf)) rgba(0, 0, 0, 0.4);
}

#board-action-btn:active {
    transform: translateY(calc(2px * var(--sf)));
}

/* --- Header Badge Timer/Turn --- */
#game-header-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(12px * var(--sf));
    width: calc(220px * var(--sf));
    height: calc(40px * var(--sf));
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: calc(8px * var(--sf));
    box-sizing: border-box;
}

#game-timer-txt {
    font-family: monospace;
    font-size: calc(26px * var(--sf));
    color: #2ecc71;
}

.header-divider {
    width: 1px;
    height: calc(20px * var(--sf));
    background: rgba(255, 255, 255, 0.2);
}

#game-turn-txt {
    font-family: 'Bebas Neue', sans-serif;
    font-size: calc(22px * var(--sf));
    color: #ffffff;
}

.surrender-btn {
    position: absolute;
    right: calc(var(--sidebar-w) + 20px * var(--sf));
    top: 50%;
    transform: translateY(-50%);
    height: calc(40px * var(--sf));
    padding: 0 calc(15px * var(--sf));
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: calc(6px * var(--sf));
    color: #ffffff;
    font-family: 'Bebas Neue', sans-serif;
    font-size: calc(18px * var(--sf));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.surrender-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

/* -------------------------------------------
   RESERVE OVERLAYS (v6.1)
   ------------------------------------------- */

/* Эффект Резерва */
.card-dom.in-reserve {
    filter: grayscale(0.2) brightness(0.9);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.4) !important;
}

/* Анимированная dashed-рамка */
.card-dom.in-reserve::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 4px dashed #ffcc00;
    border-radius: inherit;
    z-index: 10;
    pointer-events: none;
    box-shadow: inset 0 0 20px rgba(255, 204, 0, 0.3);
    animation: borderBlink 2s infinite ease-in-out;
}

@keyframes borderBlink {
    0%, 100% { 
        border-color: rgba(255, 204, 0, 0.8); 
        box-shadow: inset 0 0 12px rgba(255, 204, 0, 0.25), 0 0 10px rgba(255, 204, 0, 0.2); 
    }
    50% { 
        border-color: rgba(255, 204, 0, 0.35); 
        box-shadow: inset 0 0 6px rgba(255, 204, 0, 0.1), 0 0 2px rgba(255, 204, 0, 0.05); 
    }
}

/* Диагональный военный штамп "РЕЗЕРВ" */
.card-dom.in-reserve::after {
    content: 'РЕЗЕРВ';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-25deg);
    color: #ff9900;
    font-family: 'Bebas Neue', sans-serif;
    font-size: calc(52px * var(--sf));
    font-weight: 900;
    letter-spacing: 6px;
    border: 5px solid #ff9900;
    padding: 8px 20px;
    background: rgba(10, 0, 0, 0.9);
    border-radius: 6px;
    z-index: 15;
    pointer-events: none;
    text-shadow: 0 0 12px rgba(255, 102, 0, 0.9);
    box-shadow: 0 0 25px rgba(255, 102, 0, 0.6), inset 0 0 15px rgba(255, 102, 0, 0.4);
    opacity: 0.95;
    animation: stampPulse 2.5s infinite ease-in-out;
}

@keyframes stampPulse {
    0%, 100% {
        transform: translate(-50%, -50%) rotate(-25deg) scale(1);
        box-shadow: 0 0 20px rgba(255, 102, 0, 0.5), inset 0 0 10px rgba(255, 102, 0, 0.3);
    }
    50% {
        transform: translate(-50%, -50%) rotate(-25deg) scale(1.05);
        box-shadow: 0 0 35px rgba(255, 102, 0, 0.8), inset 0 0 20px rgba(255, 102, 0, 0.5);
    }
}


/* --- Анимация столкновения карт (Clash Shake) --- */
.clash-shake {
    animation: shakeCard 0.4s cubic-bezier(.36,.07,.19,.97) both;
    backface-visibility: hidden;
    perspective: 1000px;
}

@keyframes shakeCard {
    10%, 90% { transform: translate(calc(var(--tx, -50%) - 4px), var(--ty, -50%)) scale(var(--ts, calc(var(--card-scale) * var(--sf)))); }
    20%, 80% { transform: translate(calc(var(--tx, -50%) + 6px), var(--ty, -50%)) scale(var(--ts, calc(var(--card-scale) * var(--sf)))); }
    30%, 50%, 70% { transform: translate(calc(var(--tx, -50%) - 10px), var(--ty, -50%)) scale(var(--ts, calc(var(--card-scale) * var(--sf)))); }
    40%, 60% { transform: translate(calc(var(--tx, -50%) + 10px), var(--ty, -50%)) scale(var(--ts, calc(var(--card-scale) * var(--sf)))); }
}

/* --- Всплывающие флоатеры урона (Damage Floaters) --- */
.damage-floater {
    position: absolute;
    font-family: 'Bebas Neue', sans-serif;
    font-size: calc(36px * var(--sf));
    font-weight: 700;
    color: #ff4d4d; /* Ярко-красный для урона */
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.9), 0 0 15px rgba(255, 77, 77, 0.4);
    -webkit-text-stroke: 1.5px #000;
    pointer-events: none;
    z-index: 9999;
    animation: floatUp 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    transform: translate(-50%, -50%);
}

.damage-floater.destroyed {
    color: #e74c3c;
    font-size: calc(30px * var(--sf));
    letter-spacing: 2px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.9), 0 0 25px rgba(231, 76, 60, 0.8);
}

.damage-floater.breakthrough {
    color: #ffaa00; /* Золотой/Оранжевый для прорыва */
    font-size: calc(42px * var(--sf));
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.9), 0 0 20px rgba(255, 170, 0, 0.6);
}

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translate(-50%, 0) scale(0.6);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -40px) scale(1.1);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -100px) scale(1.0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -130px) scale(0.85);
    }
}

/* --- Подсветка пустых слотов для перемещения --- */
.empty-slot-placeholder {
    position: absolute;
    width: calc(140px * var(--sf));
    height: calc(200px * var(--sf));
    transform: translate(-50%, -50%);
    border: 3px dashed #2ecc71; /* Тактический зеленый */
    border-radius: calc(12px * var(--sf));
    background: rgba(46, 204, 113, 0.08);
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.15), inset 0 0 15px rgba(46, 204, 113, 0.1);
    cursor: pointer;
    z-index: 100;
    pointer-events: auto;
    animation: pulseGlow 1.8s infinite ease-in-out;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.empty-slot-placeholder:hover {
    background: rgba(46, 204, 113, 0.22);
    border-color: #27ae60;
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.45), inset 0 0 20px rgba(46, 204, 113, 0.2);
}

@keyframes pulseGlow {
    0%, 100% {
        border-color: rgba(46, 204, 113, 0.85);
        box-shadow: 0 0 12px rgba(46, 204, 113, 0.25), inset 0 0 15px rgba(46, 204, 113, 0.15);
    }
    50% {
        border-color: rgba(46, 204, 113, 0.35);
        box-shadow: 0 0 4px rgba(46, 204, 113, 0.05), inset 0 0 6px rgba(46, 204, 113, 0.05);
    }
}

/* --- Подсветка пустых слотов для развертывания мобильных ПТРК --- */
.empty-redeploy-placeholder {
    position: absolute;
    width: calc(140px * var(--sf));
    height: calc(200px * var(--sf));
    transform: translate(-50%, -50%);
    border: 3px dashed #3498db; /* Тактический синий */
    border-radius: calc(12px * var(--sf));
    background: rgba(52, 152, 219, 0.08);
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.15), inset 0 0 15px rgba(52, 152, 219, 0.1);
    cursor: pointer;
    z-index: 100;
    pointer-events: auto;
    animation: redeployPulseGlow 1.8s infinite ease-in-out;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.empty-redeploy-placeholder:hover {
    background: rgba(52, 152, 219, 0.22);
    border-color: #2980b9;
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.45), inset 0 0 20px rgba(52, 152, 219, 0.2);
}

@keyframes redeployPulseGlow {
    0%, 100% {
        border-color: rgba(52, 152, 219, 0.85);
        box-shadow: 0 0 12px rgba(52, 152, 219, 0.25), inset 0 0 15px rgba(52, 152, 219, 0.15);
    }
    50% {
        border-color: rgba(52, 152, 219, 0.35);
        box-shadow: 0 0 4px rgba(52, 152, 219, 0.05), inset 0 0 6px rgba(52, 152, 219, 0.05);
    }
}


/* --- Эффект пульсации ресурсов при получении (v6.2) --- */
.pulse-glow {
    animation: pulseGlowGold 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes pulseGlowGold {
    0% {
        background-color: rgba(241, 196, 15, 0.45);
        box-shadow: 0 0 15px rgba(241, 196, 15, 0.65), inset 0 0 10px rgba(241, 196, 15, 0.3);
        transform: scale(1.05);
    }
    50% {
        background-color: rgba(241, 196, 15, 0.2);
        box-shadow: 0 0 8px rgba(241, 196, 15, 0.35);
        transform: scale(1.02);
    }
    100% {
        background-color: transparent;
        box-shadow: none;
        transform: scale(1);
    }
}


/* --- Артиллерийская поддержка: подсветка выбранного арт-юнита --- */
.selected-artillery {
    border: 2px solid rgba(243, 156, 18, 0.95) !important;
    box-shadow: 0 0 16px rgba(243, 156, 18, 0.6), inset 0 0 12px rgba(243, 156, 18, 0.2) !important;
    animation: artilleryPulse 1.2s ease-in-out infinite;
}

@keyframes artilleryPulse {
    0%, 100% {
        border-color: rgba(243, 156, 18, 0.95);
        box-shadow: 0 0 16px rgba(243, 156, 18, 0.6), inset 0 0 12px rgba(243, 156, 18, 0.2);
    }
    50% {
        border-color: rgba(243, 156, 18, 0.45);
        box-shadow: 0 0 6px rgba(243, 156, 18, 0.2), inset 0 0 4px rgba(243, 156, 18, 0.05);
    }
}

/* -------------------------------------------
   IN-GAME CARD DETAILED INFO POPUP (v6.23)
   Standard dimensions: 800px x 468px at sf=1
------------------------------------------- */

.game-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1900;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.game-popup-info {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    box-sizing: border-box;
    width: 736px;
    height: 428px;
    display: block;
    align-items: center;
    padding: 20px;
    gap: 20px;
    border-radius: 26px;
    background: rgba(10, 14, 18, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8),
                0 0 20px rgba(94, 129, 109, 0.2);
    z-index: 2000;
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
}

/* Animations for Popup */
.game-popup-info.hidden, .game-popup-overlay.hidden {
    opacity: 0;
    pointer-events: none !important;
}

.game-popup-info.hidden {
    transform: translate(-50%, -46%) scale(0.96) rotateX(10deg) !important;
}

.popup-close-btn {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 32px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    line-height: 1;
    z-index: 2010;
    transition: color 0.2s, transform 0.1s;
    user-select: none;
    -webkit-user-select: none;
}

.popup-close-btn:hover {
    color: #ff4d4d;
    transform: scale(1.15);
}

.game-popup-info .popup-card-wrap {
    width: 272px;
    height: 388px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    border-radius: 23.6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border: none;
    background-color: #b57a3d;
}

.game-popup-info .popup-card-wrap > div {
    transform: scale(0.91) !important;
    transform-origin: top left !important;
    width: 300px !important;
    height: 428px !important;
    box-shadow: none !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
}

.game-popup-info .popup-card-wrap .card-render-base {
    box-shadow: none !important;
    border-radius: 26px !important;
    border: none !important;
    background-color: transparent !important;
    --fw: 6px;
}



.game-popup-info .popup-info-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    justify-content: flex-start;
}





.game-popup-info .popup-desc-area {
    overflow-y: auto;
    flex: 1;
    padding-right: 8px;
    white-space: pre-wrap;
    line-height: 1.4;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

/* Enable mouse events on the CardFactory info icon so it receives hovers and click events correctly */
.info-icon-btn {
    pointer-events: auto !important;
}

/* Premium Properties List inside info popup */
.popup-properties-list {
    margin-top: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-right: 4px;
}
.popup-properties-list::-webkit-scrollbar {
    width: 4px;
}
.popup-properties-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}
.popup-property-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    transition: background 0.2s, border-color 0.2s;
}
.popup-property-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}
.popup-property-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    font-size: 16px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    color: #fff;
}
.popup-property-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.popup-property-title {
    font-weight: 600;
    font-size: 13px;
    color: #ffd700; /* gold highlight for title */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Oswald', sans-serif;
}
.popup-property-desc {
    font-size: 11px;
    color: #ccc;
    line-height: 1.3;
}

@media (max-width: 800px) {
    :root {
        --sf: 0.85;
    }
    .top-bar-center {
        display: none !important;
    }
    #sidebar-panel {
        display: none !important;
    }
    #tactical-board {
        width: 100% !important;
    }
}
\n.u-symbol-svg { display: inline-block; vertical-align: middle; flex-shrink: 0; pointer-events: none; }

/* Ability Menu Overlay on Cards */
.card-ability-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: calc(12px * var(--sf));
    padding: calc(15px * var(--sf));
    box-sizing: border-box;
    border-radius: 26px;
    z-index: 10000;
    animation: ability-fade-in 0.2s ease-out;
}

@keyframes ability-fade-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.card-ability-title {
    font-family: 'Oswald', sans-serif;
    font-size: calc(14px * var(--sf));
    font-weight: 600;
    letter-spacing: 2px;
    color: #fff;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: calc(5px * var(--sf));
}

.card-ability-btn {
    width: 90%;
    height: calc(36px * var(--sf));
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    font-family: 'Montserrat', sans-serif;
    font-size: calc(10px * var(--sf));
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.card-ability-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: #fff;
}

.card-ability-btn.salvo-btn {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.4);
    color: #ff8a80;
}

.card-ability-btn.salvo-btn:hover {
    background: rgba(231, 76, 60, 0.4);
    border-color: #ff5252;
    color: #fff;
}

.card-ability-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
    border-color: rgba(255, 255, 255, 0.1);
}

.card-ability-btn.cancel-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: calc(9px * var(--sf));
    height: calc(24px * var(--sf));
    margin-top: calc(5px * var(--sf));
}

.card-ability-btn.cancel-btn:hover {
    color: #ff4444;
}

/* Valid salvo target style */
.card-dom.valid-salvo-target {
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.8) !important;
    animation: target-pulse 1.5s infinite ease-in-out;
    cursor: crosshair !important;
}

.card-dom.valid-salvo-target::after {
    content: "🎯";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: calc(48px * var(--sf));
    pointer-events: none;
    animation: aim-spin 6s linear infinite;
    z-index: 100;
}

@keyframes aim-spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.card-dom.valid-salvo-target:hover {
    box-shadow: 0 0 35px #e74c3c !important;
    --ts: calc(var(--card-scale) * var(--sf) * 1.08) !important;
    --ty: calc(-50% - 15px) !important;
    filter: brightness(1.2) !important;
    z-index: 1000 !important;
}

/* Breakthrough Aiming Styles */
.card-dom.valid-breakthrough-target {
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.8) !important;
    animation: target-pulse 1.5s infinite ease-in-out;
    cursor: crosshair !important;
}

.card-dom.valid-breakthrough-target::after {
    content: "💥";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: calc(48px * var(--sf));
    pointer-events: none;
    z-index: 100;
}

.card-dom.valid-breakthrough-target:hover {
    box-shadow: 0 0 35px #f1c40f !important;
    --ts: calc(var(--card-scale) * var(--sf) * 1.08) !important;
    --ty: calc(-50% - 15px) !important;
    filter: brightness(1.2) !important;
    z-index: 1000 !important;
}

/* Valid Resource Targets in HUD */
.res-item.valid-resource-target {
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.9) !important;
    border: 2px solid #f1c40f !important;
    animation: target-pulse 1.2s infinite ease-in-out;
    cursor: pointer !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.res-item.valid-resource-target:hover {
    transform: scale(1.1);
    box-shadow: 0 0 25px #f1c40f !important;
    background: rgba(241, 196, 15, 0.2) !important;
}

/* Breakthrough Cancel Button in Sidebar */
.breakthrough-cancel-btn-styled {
    width: 100%;
    height: calc(48px * var(--sf));
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.3), rgba(192, 57, 43, 0.4));
    border: 1px solid rgba(231, 76, 60, 0.5);
    border-radius: calc(6px * var(--sf));
    color: #e74c3c;
    font-size: calc(18px * var(--sf));
    font-weight: bold;
    cursor: pointer;
    margin-bottom: calc(15px * var(--sf));
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.breakthrough-cancel-btn-styled:hover {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.5), rgba(192, 57, 43, 0.6));
    border-color: #e74c3c;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.4);
}

/* Directed Attack Styles */
.card-dom.valid-directed-target {
    box-shadow: 0 0 20px rgba(230, 126, 34, 0.8) !important;
    animation: target-pulse 1.5s infinite ease-in-out;
    cursor: crosshair !important;
}

.card-dom.valid-directed-target:hover {
    box-shadow: 0 0 35px #e67e22 !important;
    --ts: calc(var(--card-scale) * var(--sf) * 1.08) !important;
    --ty: calc(-50% - 15px) !important;
    filter: brightness(1.2) !important;
    z-index: 1000 !important;
}

.card-dom.directed-target-selected {
    box-shadow: 0 0 25px rgba(231, 76, 60, 0.95) !important;
    border: 3px solid #e74c3c !important;
    animation: target-pulse 1.2s infinite ease-in-out;
}

.card-dom.directed-target-selected::before {
    content: "🎯";
    position: absolute;
    top: calc(5px * var(--sf));
    right: calc(5px * var(--sf));
    font-size: calc(24px * var(--sf));
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    z-index: 101;
}

.card-dom.directed-attacker {
    box-shadow: 0 0 25px rgba(230, 126, 34, 0.95) !important;
    border: 3px dashed #e67e22 !important;
}

.card-dom.directed-attacker::before {
    content: "⚔️";
    position: absolute;
    top: calc(5px * var(--sf));
    right: calc(5px * var(--sf));
    font-size: calc(24px * var(--sf));
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    z-index: 101;
}

/* Directed Attack Resource Targets in HUD */
.res-item.valid-directed-target {
    box-shadow: 0 0 15px rgba(230, 126, 34, 0.9) !important;
    border: 2px solid #e67e22 !important;
    animation: target-pulse 1.2s infinite ease-in-out;
    cursor: pointer !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.res-item.valid-directed-target:hover {
    transform: scale(1.1);
    box-shadow: 0 0 25px #e67e22 !important;
    background: rgba(230, 126, 34, 0.2) !important;
}

.res-item.directed-target-selected {
    box-shadow: 0 0 25px rgba(231, 76, 60, 0.95) !important;
    border: 2px solid #e74c3c !important;
}

/* --- Анимации свечения и пульсации для измененных характеристик карт (v6.5) --- */

@keyframes stat-pulse-atk {
    0%, 100% {
        color: var(--base-color, inherit);
        text-shadow: 0 0 2px #ffd700, 0 0 1px #ffd700;
        filter: brightness(1);
    }
    50% {
        color: #8b0000; /* Темно-бордовый */
        text-shadow: 0 0 3px #ffd700, 0 0 1px #ffd700;
        filter: brightness(1.2);
    }
}

@keyframes stat-pulse-def {
    0%, 100% {
        color: var(--base-color, inherit);
        text-shadow: 0 0 2px #ffd700, 0 0 1px #ffd700;
        filter: brightness(1);
    }
    50% {
        color: #00008b; /* Темно-синий */
        text-shadow: 0 0 3px #ffd700, 0 0 1px #ffd700;
        filter: brightness(1.2);
    }
}

.buffed-atk-glow {
    display: inline-block;
    animation: stat-pulse-atk 3.0s infinite ease-in-out;
}

.buffed-def-glow {
    display: inline-block;
    animation: stat-pulse-def 3.0s infinite ease-in-out;
}

/* Matchmaking Search Overlay */
.matchmaking-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.matchmaking-overlay.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.matchmaking-card {
    width: 320px;
    padding: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: mm-card-appear 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes mm-card-appear {
    from {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.matchmaking-title {
    font-family: inherit;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 200, 255, 0.3);
    margin: 0;
    text-transform: uppercase;
}

.matchmaking-radar-container {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matchmaking-radar {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(0, 200, 255, 0.1);
    box-sizing: border-box;
}

.matchmaking-radar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #00c8ff;
    border-bottom-color: #00c8ff;
    animation: mm-spin 2s linear infinite;
}

.matchmaking-radar-inner {
    position: absolute;
    width: 70%;
    height: 70%;
    border-radius: 50%;
    border: 1px dashed rgba(0, 200, 255, 0.2);
    box-sizing: border-box;
    animation: mm-spin-reverse 3s linear infinite;
}

.matchmaking-faction-badge {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    z-index: 2;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    animation: mm-pulse 1.5s ease-in-out infinite alternate;
}

.matchmaking-faction-badge.afu {
    color: #00c8ff;
    text-shadow: 0 0 15px rgba(0, 200, 255, 0.6);
}

.matchmaking-faction-badge.rf {
    color: #ff3b30;
    text-shadow: 0 0 15px rgba(255, 59, 48, 0.6);
}

@keyframes mm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes mm-spin-reverse {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}

@keyframes mm-pulse {
    from {
        transform: scale(0.9);
        opacity: 0.7;
    }
    to {
        transform: scale(1.1);
        opacity: 1;
    }
}

.matchmaking-status {
    font-size: 0.95rem;
    color: #ccc;
    margin: 0;
}

.matchmaking-timer {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: monospace;
    color: #fff;
    letter-spacing: 0.1em;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 20px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}





