.combat_outer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 941;
    pointer-events: none;
    opacity: 0;
	-webkit-transition: opacity 1s;
	-o-transition: opacity 1s;
	transition: opacity 1s;
}
.combat_outer.active {
    pointer-events: all;
    opacity: 1;
}
.combat_outer .combat_bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 800;
    background: rgba(0, 0, 0, 0.85);
}
.combat_outer .combat_info {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 801;
}
.combat_info {
    z-index: 801;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100vw;
    pointer-events: none;
}
.combat_info .combat_info_content {
    position: relative;
    height: 100vh;
    width: 100vw;
}

.combat_outer .btn_test_combat {
    display: block;
}
.combat_outer .btn_end_combat {
    display: none;
}

.combat_outer .actions {
    padding: 24px 10px;
    margin: 0px 0;
}
.actions a.btn-primary {
    font-size: 125%;
}
.combat_ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 800;
    pointer-events: none;
}
.combat_ui .actions {
    pointer-events: all;
}
.combat_ui[data-type="simulation"] {
    bottom: 0;
    right: 0;
    top: auto;
    left: auto;
    width: fit-content;
    max-width: 320px;
    height: auto;
    text-align: right;
}
.combat_ui[data-type="simulation"] .actions {
    padding: 10px 16px 58px 10px;
    margin: 0px 0;
    z-index: 801;
    position: fixed;
    bottom: 0;
    right: 0;
}
.combat_ui[data-type="simulation"] .actions .btn {
    font-size: 14px;
    margin-top: 8px;
}

.data_combat_phase {
    font-size: 12px;
    margin-bottom: 4px;
    color: #2c9dff;
}

.combat_ui .top,
.combat_ui .right,
.combat_ui .bottom,
.combat_ui .left {
    position: fixed;
}
.combat_ui .top {
    top: 50px;
    bottom: auto;
}
.combat_ui .right {
    right: 14px;
    left: auto;
}
.combat_ui .bottom {
    bottom: 50px;
    top: auto;
}
.combat_ui .left {
    left: 14px;
    right: auto;
}

.combat_ui[data-phase] {
    display: none;
}

.versusname,
.versusstate {
    position: fixed;
    font-size: 36px;
    transform: translateY(-2vw);
    left: 0;
    right: auto;
    color: #2c9dff;
    top: auto;
    bottom: 50vh;
}
.versusstate {
    font-size: 2vw;
    color: #777777;
    transform: translateY(2vw);
    top: 50vh;
    bottom: auto;
}
[data-phase="precombat"] [data-ready="true"] {
    color: #FFFFFF;
}
[data-phase="precombat"] [data-key="attacker.username"],
[data-phase="precombat"] [data-key="defender.username"],
[data-phase="precombat"] [data-key="attacker.ready"],
[data-phase="precombat"] [data-key="defender.ready"] {
    right: auto;
    width: 33%;
    text-align: center;
    position: fixed;
}
[data-phase="precombat"] [data-key="attacker.username"],
[data-phase="precombat"] [data-key="attacker.ready"] {
    right: calc(50% + 60px);
    left: auto;
}
[data-phase="precombat"] [data-key="defender.username"],
[data-phase="precombat"] [data-key="defender.ready"] {
    left: calc(50% + 60px);
}
[data-phase="precombat"] [data-key="attacker.username"] .factionicon,
[data-phase="precombat"] [data-key="defender.username"] .factionicon {
    margin-right: 0em;
    margin-bottom: 0.15em;
}
.versustext {
    color: #FFFFFF;
    width: 60px;
    top: auto;
    bottom: 55vh;
    left: calc(50vw - 30px);
    font-size: 23px;
    text-align: center;
    font-weight: 900;
    position: fixed;
}
.combat_ui[data-phase="precombat"] .btnUnReady,
.combat_ui[data-phase="precombat"] .btnReadyUp {
    position: fixed;
    top: calc(50vh + 120px);
    width: 240px;
    left: calc(50vw - 120px);
}
.combat_ui[data-phase="precombat"] .btnUnReady {
    width: 160px;
    left: calc(50vw - 80px);
    font-size: 14px;
}


.fleet_container {
    position: fixed;
    top: 18vh;
    height: calc(100vh - 200px);
    width: calc((100vh - 200px) * 0.45);
    pointer-events: all;
}
.fleet_container[data-role="attacker"] {
    left: 100px;
    right: auto;
    /* background: rgba(44, 157, 255, 0.25); */
}
.fleet_container[data-role="defender"] {
    right: 100px;
    left: auto;
    /* background: rgba(255, 157, 44, 0.25); */
}

.fleet_container .fleet_positions>.hangar_module .item[data-itemtype="1"],
.fleet_container .fleet-ship .item[data-itemtype="1"] {
    border: none;
}
.fleet_container[data-role="defender"] .fleet_positions>.hangar_module .item[data-itemtype="1"],
.fleet_container[data-role="defender"] .fleet-ship .item[data-itemtype="1"] {
    transform: scaleX(-1);
}

/* Ship overlay layer — ships positioned independently from tiles */
.fleet_ships {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}
.fleet-ship {
    position: absolute;
    pointer-events: all;
}
.fleet-ship .image_container {
    position: relative;
    width: 100%;
    height: 100%;
}
.fleet-ship .image_container img,
.fleet-ship .image_container .item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* During move mode, let clicks fall through ships to tiles */
.combat_outer.move-mode .fleet_ships {
    pointer-events: none;
}

.fleet_container {
    position: absolute;
}

.combat_container .fleet_container,
.combat_container .hangar_fleet,
.combat_container .hangar_fleet_inner,
.combat_container .hangar_fleet .fleet_positions {
    overflow: visible!important;
}
.fleet_container .hangar_fleet h5.cardTitle,
.fleet_container .hangar_fleet .row_header,
.fleet_container .hangar_fleet .fleet_instructions {
    display: none;
}
.fleet_container .hangar_fleet,
.fleet_container .hangar_fleet .hangar_fleet_inner {
    height: 100%!important;
}

.combat_container .fleets .hangar_fleet_inner > .row_grid > .col-12 {
    padding-left: 0;
    padding-right: 0;
}

.combat_container .hangar_module {
    background: rgba(255, 255, 255, 0);
    border-color: rgba(255, 255, 255, 0);
    overflow: visible;
}
.combat_container .item_eq_holder {
    opacity: 0;
}
.combat_container .hangar_module:hover {
    z-index: 1;
}

.fleet_positions .hangar_module .hex-combat {
    position: absolute;
    transform: scale(0.6);
    opacity: 0.5;
    -webkit-transition: all 0.3s;
    -o-transition: all 0.3s;
    transition: all 0.3s;
}
#panel_hangar .fleet_positions .hangar_module .hex-combat {
    width: 100%;
    height: 100%;
    transform: translate(0%, 0%);
}
.fleet_positions .hangar_module.empty .hex-combat {
    opacity: 0.15;
}
.fleet_positions:hover .hangar_module .hex-combat {
    /* opacity: 0.25; */
}
.fleet_positions:hover .hangar_module:hover .hex-combat {
    opacity: 0.5;
}
.fleet_positions .hangar_module .hex-combat.hex-combat-active {
    opacity: 0;
    z-index: 1;
    transform: scale(1);
    pointer-events: none;
    /* opacity: 1; */
}
.fleet_positions .hangar_module:hover .hex-combat.hex-combat,
.fleet_positions .hangar_module:focus .hex-combat.hex-combat,
.fleet_positions .hangar_module.hovered .hex-combat.hex-combat,
.fleet_positions .hangar_module.active .hex-combat.hex-combat {
    opacity: 0;
}
.fleet_positions .hangar_module.empty:hover .hex-combat.hex-combat,
.fleet_positions .hangar_module.empty:focus .hex-combat.hex-combat,
.fleet_positions .hangar_module.empty.active .hex-combat.hex-combat {
    opacity: 0.25;
}
.fleet_positions .hangar_module.empty:hover .hex-combat.hex-combat-active,
.fleet_positions .hangar_module.empty:focus .hex-combat.hex-combat-active,
.fleet_positions .hangar_module.empty.hovered .hex-combat.hex-combat-active,
.fleet_positions .hangar_module.empty.active .hex-combat.hex-combat-active {
    opacity: 1;
}

.fleet_positions .hangar_module:hover .hex-combat,
.fleet_positions .hangar_module:focus .hex-combat,
.fleet_positions .hangar_module:hover .hex-combat.hex-combat-active,
.fleet_positions .hangar_module:focus .hex-combat.hex-combat-active,
.fleet_positions .hangar_module.hovered .hex-combat.hex-combat-active,
.fleet_positions .hangar_module.active .hex-combat.hex-combat-active {
    transform: scale(0.55);
    opacity: 1;
}
.fleet_positions .hangar_module.ui-droppable-active.ui-state-active.empty .hex-combat {
    opacity: 1;
}

.combat_ui .fleet_positions .hangar_module .stats_holder,
.combat_ui .fleet_positions .hangar_module .stats_holder,
.combat_ui .fleet_positions .hangar_module .stats_holder {
    opacity: 0;
}
body[data-option-healthbar-numbers="1"] .combat_ui .fleet_positions .hangar_module .stats_holder,
.combat_ui .fleet_positions .hangar_module:hover .stats_holder,
.combat_ui .fleet_positions .hangar_module:focus .stats_holder,
.combat_ui .fleet_positions .hangar_module.hovered .stats_holder,
.combat_ui .fleet_positions .hangar_module.active .stats_holder {
    opacity: 1;
}

.ui-draggable-dragging {
    z-index: 10;
}

.combat_background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 100%;
    background: url('https://qf-dist.s3.us-east-2.amazonaws.com/bgs/combat/001.jpg') no-repeat center center;
    background-size: cover;
}

.combat_container .hangar_module .stats_container,
.combat_container .fleet-ship .stats_container {
    position: absolute;
    width: 40px;
    left: calc(50% - 20px);
    top: 0;
    height: 40px;
    transform: translate(0, -8px);
    pointer-events: none;
    opacity: 1;
    -webkit-transition: all 0.3s;
    -o-transition: all 0.3s;
    transition: all 0.3s;
}
body[data-option-healthbar-numbers="1"] .combat_container .hangar_module .stats_container,
body[data-option-healthbar-numbers="1"] .combat_container .fleet-ship .stats_container,
.combat_container .hangar_module:hover .stats_container,
.combat_container .hangar_module:focus .stats_container,
.combat_container .hangar_module.hovered .stats_container,
.combat_container .hangar_module.active .stats_container,
.combat_container .fleet-ship:hover .stats_container,
.combat_container .fleet-ship.hovered .stats_container {
    opacity: 1;
}
.combat_container .hangar_module:hover .stats_container,
.combat_container .hangar_module:focus .stats_container,
.combat_container .hangar_module.hovered .stats_container,
.combat_container .hangar_module.active .stats_container,
.combat_container .fleet-ship:hover .stats_container,
.combat_container .fleet-ship.hovered .stats_container {
    width: 100px;
    left: calc(50% - 50px);
}

.combat_container .hangar_module .stat_row,
.combat_container .fleet-ship .stat_row {
    position: relative;
}
.combat_container .hangar_module .stat_row .progress,
.combat_container .fleet-ship .stat_row .progress {
    --h: 2px;                              /* segmented bar: glass.css (.qf-seg) */
    --seg: 6px;
    margin: 0;
}
.combat_container .hangar_module .stat_row .progress,
.combat_container .hangar_module .stat_row .progress-bar,
.combat_container .fleet-ship .stat_row .progress,
.combat_container .fleet-ship .stat_row .progress-bar {
    border-radius: 0;
}
.combat_container .hangar_module .stat_row .stat_label,
.combat_container .fleet-ship .stat_row .stat_label {
    text-transform: uppercase;
    position: absolute;
    right: calc(100% + 0px);
    top: -4px;
    font-size: 9px;
    font-weight: 900;
    opacity: 0;
    -webkit-transition: all 0.3s;
    -o-transition: all 0.3s;
    transition: all 0.3s;
    background: rgba(0, 0, 0, 0.75);
    padding: 2px;
    white-space: nowrap;
}
.combat_container .hangar_module .stat_row .stat_label .long,
.combat_container .fleet-ship .stat_row .stat_label .long {
    display:inline-block;
    max-width:0;
    overflow:hidden;
    transition: max-width 0.3s ease;
    vertical-align: bottom;
}
.combat_container .hangar_module:hover .stat_row .stat_label .long,
.combat_container .hangar_module:focus .stat_row .stat_label .long,
.combat_container .hangar_module.hovered .stat_row .stat_label .long,
.combat_container .hangar_module.active .stat_row .stat_label .long,
.combat_container .fleet-ship:hover .stat_row .stat_label .long,
.combat_container .fleet-ship.hovered .stat_row .stat_label .long {
    display: inline-block;
    max-width: 50px;
    transition: max-width 0.8s ease;
}
.combat_container .hangar_module .stat_row .stat_label.value,
.combat_container .fleet-ship .stat_row .stat_label.value {
    right: auto;
    left: calc(100% + 0px);
    font-family: 'Courier', 'Courier New', monospace;
    line-height: 9px;
}
body[data-option-healthbar-numbers="1"] .combat_container .hangar_module .stat_row .stat_label,
body[data-option-healthbar-numbers="1"] .combat_container .fleet-ship .stat_row .stat_label,
.combat_container .hangar_module:hover .stat_row .stat_label,
.combat_container .hangar_module:focus .stat_row .stat_label,
.combat_container .hangar_module.hovered .stat_row .stat_label,
.combat_container .hangar_module.active .stat_row .stat_label,
.combat_container .fleet-ship:hover .stat_row .stat_label,
.combat_container .fleet-ship.hovered .stat_row .stat_label {
    opacity: 1;
}
body[data-option-healthbar-numbers="1"] .combat_container .hangar_module .stat_row .progress,
body[data-option-healthbar-numbers="1"] .combat_container .fleet-ship .stat_row .progress,
.combat_container .hangar_module:hover .stat_row .progress,
.combat_container .hangar_module:focus .stat_row .progress,
.combat_container .hangar_module.hovered .stat_row .progress,
.combat_container .hangar_module.active .stat_row .progress,
.combat_container .fleet-ship:hover .stat_row .progress,
.combat_container .fleet-ship.hovered .stat_row .progress {
    --h: 4px;
}

.combat_container .hangar_module .stat_row[data-label="stat_shield"] .stat_label,
.combat_container .fleet-ship .stat_row[data-label="stat_shield"] .stat_label {
    color: #2cbfff;
}
.combat_container .hangar_module .stat_row[data-label="stat_shield"] .progress,
.combat_container .fleet-ship .stat_row[data-label="stat_shield"] .progress {
    --fc: 44, 191, 255;
}
.combat_container .hangar_module .stat_row[data-label="stat_hp"] .stat_label,
.combat_container .fleet-ship .stat_row[data-label="stat_hp"] .stat_label {
    color: #ff2121;
}
.combat_container .hangar_module .stat_row[data-label="stat_hp"] .progress,
.combat_container .fleet-ship .stat_row[data-label="stat_hp"] .progress {
    --fc: 255, 64, 64;
}

.combat_ui .hangar_module:hover:before,
.combat_ui .hangar_module:focus:before,
.combat_ui .hangar_module.hovered:before,
.combat_ui .hangar_module.active:before {
    transform: translateY(-30%);
    display: none;
}

/* animations */
.hangar_module .anim_container,
.fleet-ship .anim_container {
    height: 70%;
    width: 100%;
    position: absolute;
    left: 0%;
    top: 15%;
    pointer-events: none;
}
.fleet_container[data-role="defender"] .hangar_module .anim_container,
.fleet_container[data-role="defender"] .fleet-ship .anim_container {
    transform: scaleX(-1);
}
.hangar_module .anim_container .inner,
.fleet-ship .anim_container .inner {
    position:relative;
    width:100%;
    height: 100%;
}
.hangar_module .anim_container .anim_sprite,
.fleet-ship .anim_container .anim_sprite {
    position: absolute;
}

/* Shoots animations */
.anim_shoot[data-itemtype="2"][data-itemid="64"] {
    /* position: absolute;
    width: 50%;
    height: 50%;
    top: 50%;
    left: 50%;
    animation-name: SPRITE_SHOOT;
    animation-duration: 1s;
    transform-origin: center left;
    opacity: 0; */
}
@keyframes SPRITE_SHOOT {
  /* 0%   { transform: scale(0.1); opacity: 0; }
  30%  { transform: scale(0.2,1); opacity: 1; }
  60%  { transform: scale(1,0.7); opacity: 1; }
  100% { transform: scale(1.2,0.2); opacity: 0; } */
}

.sprite_container_shoot {
    position: absolute;
    height: 50%;
    width: 30%;
    top: 0;
    left: 26%;
    overflow: hidden;
    transform: translate(100%, 100%);
}
body .sprite_container_shoot > img.anim_shoot[data-itemtype][data-itemid] {
    position: absolute;
    width: 500%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 1;
    animation-name: SPRITE_ANIM_001;
    animation-duration: 0.5s;
    animation-iteration-count: 1;
    animation-timing-function: steps(5,end);
    animation-fill-mode: forwards;
}
@keyframes SPRITE_ANIM_001 {
  0%   { transform: translate(0%, 0); }
  100% { transform: translate(-100%, 0); }
}


/* Projectiles animations */
.anim_projectile {
    position: absolute;
    width: 6vw;
    height: 1.2vw;
    transform: translate(-3vw,-0.6vw);
    transition-timing-function: linear;
    transform-origin: center;
}
.anim_projectile[data-role="defender"] {
    transform: translate(-5.5vw,-1.1vw) scale(-1);
}
.anim_projectile.animating {
	-webkit-transition: top 0.25s, left 0.25s;
	-o-transition: top 0.25s, left 0.25s;
	transition: top 0.25s, left 0.25s;
    transition-timing-function: ease-in;
}


/* Hits animations */
.anim_hit[data-itemtype="2"] {
    position: absolute;
    width: 70%;
    height: 100%;
    top: 0%;
    left: 15%;
    animation-name: SPRITE_HIT;
    animation-duration: 1.5s;
    opacity: 0;
    z-index: 2;
}
@keyframes SPRITE_HIT {
  0%   { transform: scale(0.3); opacity: 0; }
  15%  { opacity: 1; }
  20%  { transform: scale(1);  }
  50%  { opacity: 0.9; }
  100% { transform: scale(1.1); opacity: 0; }
}
/* Hits animations - shields */
.anim_hit[data-itemtype="2"][data-has-sh="1"] {
    animation-name: SPRITE_HIT_SHIELD;
    transform: scale(1);
}
@keyframes SPRITE_HIT_SHIELD {
  0%   { transform: scale(0.3); opacity: 0; }
  15%  { transform: scale(0.85); opacity: 0.7;  }
  20%, 50%, 80%  { transform: scale(0.9); }
  35%, 65%, 100%  { transform: scale(0.85); }
  85%  { opacity: 0.5; }
  100% { opacity: 0; }
}
/* Hits animations - explosions */
.anim_hit[data-itemtype="2"][data-has-hp="0"] {
    animation-name: SPRITE_HIT_EXPLODE;
    z-index: 1;
}
@keyframes SPRITE_HIT_EXPLODE {
  0%   { transform: scale(0.3); opacity: 0; }
  15%  { transform: scale(0.9); opacity: 1;  }
  50%  { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.1); opacity: 0; }
}

/* ===== FLOATING DAMAGE NUMBERS ===== */
.damage-number {
    position: absolute;
    top: 20%;
    font-size: 16px;
    font-weight: 900;
    font-family: 'Courier', 'Courier New', monospace;
    pointer-events: none;
    z-index: 10;
    animation: damage-float 0.85s ease-out forwards;
    text-shadow: 0 0 6px currentColor, 0 1px 2px rgba(0,0,0,0.8);
    white-space: nowrap;
}
.damage-number.shield {
    color: #2cbfff;
}
.damage-number.hull {
    color: #ff6633;
}
/* Unflip text for defender side (anim_container is scaleX(-1)) */
.fleet_container[data-role="defender"] .damage-number {
    transform: scaleX(-1);
}
@keyframes damage-float {
    0%   { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-30px); }
}
/* Keep unflip during float for defender */
.fleet_container[data-role="defender"] .damage-number {
    animation: damage-float-flip 0.85s ease-out forwards;
}
@keyframes damage-float-flip {
    0%   { opacity: 1; transform: scaleX(-1) translateY(0); }
    100% { opacity: 0; transform: scaleX(-1) translateY(-30px); }
}

/* ===== SHIP MOVEMENT SYSTEM ===== */

/* Ability Flyout Menu */
.ability-flyout {
    position: fixed;
    z-index: 1000;
    pointer-events: all;
    background: rgba(255, 0, 0, 0); /* Debug: red tint to see hitbox */
    padding: 50px 80px 124px 80px; /* Add padding to expand hitbox */
    margin: -80px; /* Negative margin to keep abilities centered */
}

.ability-button {
    width: 42px;
    height: 48px;
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: all;
    left: -21px;
    top: -24px;
    z-index: 1000;
}

.ability-button::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 115 100"><polygon points="29,2 86,2 113,50 86,98 29,98 2,50" fill="rgba(0,50,100,0.75)" stroke="%2300aaff" stroke-width="2" /></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: all 0.2s;
    z-index: -1;
}

.ability-button::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 0;
    transition: all 0.2s;
    pointer-events: none;
}

.ability-button:hover::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 115 100"><polygon points="29,2 86,2 113,50 86,98 29,98 2,50" fill="rgba(0,150,255,0.5)" stroke="%2300ffff" stroke-width="2" /></svg>');
    filter: drop-shadow(0 0 8px rgba(0, 255, 255, 0.75));
}

.ability-button:hover {
    transform: scale(1.25);
    z-index: 1001;
}

/* Disabled ability state */
.ability-button.ability-disabled {
    cursor: not-allowed;
    opacity: 0.75;
}

.ability-button.ability-disabled::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 115 100"><polygon points="29,2 86,2 113,50 86,98 29,98 2,50" fill="rgba(80,80,80,0.3)" stroke="%23AAAAAA" stroke-width="2" /></svg>');
}

.ability-button.ability-disabled:hover::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 115 100"><polygon points="29,2 86,2 113,50 86,98 29,98 2,50" fill="rgba(80,80,80,0.3)" stroke="%23AAAAAA" stroke-width="2" /></svg>');
    filter: none;
}

.ability-button.ability-disabled:hover {
    transform: none;
}

.ability-icon {
    font-size: 17px;
    z-index: 1;
}

.ability-icon-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

.ability-label {
    font-size: 10px;
    color: #fff;
    margin-top: 2px;
    font-weight: bold;
    z-index: 1;
    width: 160%;
    text-align: center;
    position: absolute;
    left: -30%;
    top: 100%;
    opacity: 0;
    -webkit-opacity: 0;
    transition: opacity 0.2s;
}

.ability-button:hover .ability-label {
    opacity: 1;
    -webkit-opacity: 1;
}

/* Move Mode */
.combat_outer.move-mode {
    cursor: crosshair;
}

.valid-move-tile {
    background: rgba(0, 255, 0, 0.2) !important;
    border: 2px dashed #00ff00 !important;
    cursor: pointer;
}

.valid-move-tile:hover {
    background: rgba(0, 255, 0, 0.4) !important;
}

.tile-clicked {
    animation: tile-pulse 0.5s ease-out;
}

@keyframes tile-pulse {
    0%, 100% {
        transform: scale(1);
        background: rgba(0, 255, 0, 0.2);
    }
    50% {
        transform: scale(1.05);
        background: rgba(0, 255, 0, 0.6);
    }
}

/* Ship Traversing State */
.image_container.traversing {
    opacity: 0.85;
    filter: brightness(1.3) drop-shadow(0 0 8px rgba(0, 200, 255, 0.8));
    animation: ship-moving 0.5s ease-in-out infinite alternate;
    pointer-events: none; /* Disable interaction while moving */
    cursor: not-allowed;
}

.image_container.traversing img {
    pointer-events: none;
}

@keyframes ship-moving {
    0% {
        filter: brightness(1.2) drop-shadow(0 0 6px rgba(0, 200, 255, 0.6));
    }
    100% {
        filter: brightness(1.4) drop-shadow(0 0 12px rgba(0, 255, 255, 1));
    }
}

/* Ship Dead State */
.image_container.ship-dead {
    opacity: 0.4;
    filter: grayscale(100%) brightness(0.5);
    pointer-events: none !important;
    cursor: not-allowed;
}

.image_container.ship-dead img {
    pointer-events: none !important;
}

.hangar_module.has-dead-ship {
    pointer-events: none;
}

.hangar_module.has-dead-ship .stats_container,
.fleet-ship.has-dead-ship .stats_container {
    opacity: 0.4;
}

.fleet-ship.has-dead-ship {
    pointer-events: none;
}

/* Drag Preview */
.ship-drag-preview {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.6;
    display: none;
}

.ship-drag-preview img {
    width: 60px;
    height: 60px;
}

/* ===== CONCLUSION OVERLAY ===== */

.conclusion_overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 900;
    pointer-events: all;
    animation: conclusion-fade-in 0.8s ease-out forwards;
}

@keyframes conclusion-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.conclusion_banner {
    text-align: center;
}

.conclusion_result {
    font-size: 6vw;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 2vh;
    text-shadow: 0 0 30px currentColor;
    animation: conclusion-result-in 0.6s ease-out 0.3s both;
}

@keyframes conclusion-result-in {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}

.conclusion_result[data-result="victory"] { color: #00ff88; }
.conclusion_result[data-result="defeat"] { color: #ff4444; }
.conclusion_result[data-result="draw"] { color: #ffaa00; }
.conclusion_result[data-result="spectator"] { color: #2c9dff; }

.conclusion_matchup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    animation: conclusion-matchup-in 0.5s ease-out 0.6s both;
}

@keyframes conclusion-matchup-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.conclusion_side {
    text-align: center;
    min-width: 200px;
}

.conclusion_username {
    font-size: 24px;
    margin-bottom: 8px;
}

.conclusion_fleet_summary {
    font-size: 14px;
    color: #aaaaaa;
}

.conclusion_vs {
    font-size: 20px;
    font-weight: 900;
    color: #ffffff;
}

/* ===== COMBAT INTRO ANIMATION ===== */

/* --- Ship fly-in --- */

/* Hide fleet-ship elements during intro until they get the fly-in class */
.combat_outer.intro-active .fleet-ship:not(.intro-ship-fly-in-attacker):not(.intro-ship-fly-in-defender) {
    opacity: 0 !important;
}

.fleet-ship.intro-ship-fly-in-attacker {
    animation: ship-fly-in-attacker 800ms ease-out both;
}

.fleet-ship.intro-ship-fly-in-defender {
    animation: ship-fly-in-defender 800ms ease-out both;
}

@keyframes ship-fly-in-attacker {
    0% {
        opacity: 0;
        transform: translateX(-200vw);
        filter: brightness(2) drop-shadow(0 0 20px rgba(100, 200, 255, 0.8));
    }
    30% {
        opacity: 1;
        filter: brightness(1.5) drop-shadow(0 0 15px rgba(100, 200, 255, 0.5));
    }
    80% {
        filter: brightness(1.1) drop-shadow(0 0 5px rgba(100, 200, 255, 0.2));
    }
    100% {
        opacity: 1;
        transform: translateX(0);
        filter: brightness(1) drop-shadow(0 0 0 transparent);
    }
}

@keyframes ship-fly-in-defender {
    0% {
        opacity: 0;
        transform: translateX(200vw);
        filter: brightness(2) drop-shadow(0 0 20px rgba(255, 180, 100, 0.8));
    }
    30% {
        opacity: 1;
        filter: brightness(1.5) drop-shadow(0 0 15px rgba(255, 180, 100, 0.5));
    }
    80% {
        filter: brightness(1.1) drop-shadow(0 0 5px rgba(255, 180, 100, 0.2));
    }
    100% {
        opacity: 1;
        transform: translateX(0);
        filter: brightness(1) drop-shadow(0 0 0 transparent);
    }
}

/* --- Intro overlay --- */

.combat_intro_overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 950;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    background: transparent;
}

.combat_intro_overlay.active {
    opacity: 1;
    background: rgba(0, 0, 0, 0.6);
    transition: opacity 0.5s ease, background 0.5s ease;
}

.combat_intro_overlay.active.outro {
    animation: intro-overlay-out 2s ease-in forwards;
}

@keyframes intro-overlay-out {
    0%   { opacity: 1; background: rgba(0, 0, 0, 0.6); }
    100% { opacity: 0; background: transparent; }
}

/* --- Intro content layout --- */

.combat_intro_content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
}

/* --- Name animations --- */

.combat_intro_side {
    font-size: 3vw;
    min-width: 200px;
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
}

.combat_intro_side.intro-name-in {
    animation: name-slide-in 1.5s ease-out forwards;
}

@keyframes name-slide-in {
    0%   { opacity: 0; transform: translateY(30px) scale(0.9); }
    60%  { transform: translateY(-5px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.combat_intro_attacker {
    color: #2c9dff;
}

.combat_intro_defender {
    color: #ff9d2c;
}

/* --- VS / BATTLE text --- */

.combat_intro_vs {
    font-size: 5vw;
    font-weight: 900;
    color: #ff4444;
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.8), 0 0 40px rgba(255, 68, 68, 0.4);
    letter-spacing: 0.15em;
    opacity: 0;
    transform: scale(0.5);
}

.combat_intro_vs.intro-vs-in {
    animation: vs-slam-in 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes vs-slam-in {
    0%   { opacity: 0; transform: scale(2); }
    60%  { opacity: 1; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

/* Standalone spectator page (/combat/view/<slug>): a fixed, non-scrolling screen.
   The combat overlay is 100vh; nothing else on the page should add scrollable height. */
body.combatview {
    height: 100vh;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    overscroll-behavior: none;
    /* main.css gives body a perspective, which turns it into the containing block for
       position:fixed children. The 100vh combat overlay then follows the body instead of
       the viewport, and any body offset/growth shows up as a few px of page scroll. */
    perspective: none;
}
body.combatview .battle_title { margin: 0; }

/* ===== WEAPON FX LAYER (combat-fx.js): beams, tracer bolts, impact bursts ===== */
.qf-fx-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: visible;
    pointer-events: none;
    z-index: 950;                 /* above .combat_outer (941) */
    mix-blend-mode: screen;       /* additive glow on the dark combat backdrop */
}
.qf-fx-layer .qf-fx-beam line { filter: drop-shadow(0 0 2px currentColor); }

/* combat view loaded inside the in-game battle modal (?embed=1) */
body.combatview.embedded .main_footer,
body.combatview.embedded .canary_indicator { display: none; }
