@import url("https://api.fontshare.com/v2/css?f[]=satoshi@1&display=swap");
@import url("https://api.fontshare.com/v2/css?f[]=satoshi@2&display=swap");

:root {
    --black: #1D1E20;
    --dark-black: #151719;
    --light-black: #252629;
    --dotted: radial-gradient(rgba(81, 81, 84, .5) 2px, transparent 1px);
    --main: #E74C3C;
    --secondary: #c1392b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--black);
    font-family: 'satoshi', sans-serif;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

.container {
    height: 100vh;
    max-height: 100dvh;
    width: 100%;
    overflow: hidden;
}

.container .top {
    width: 100%;
    height: 70vh;
    display: flex;
    position: relative;
    background: var(--light-black);
}

.container .top .left {
    position: relative;
    width: 50%;
    height: 100%;
    background: var(--black);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-left: 2rem;
    clip-path: polygon(0% 0%, 100% 0%, 80% 100%, 0% 100%);
    z-index: 2;
    transform: translateX(-120%);
    opacity: 0;
    transition: transform 1s cubic-bezier(.22, 1, .36, 1), opacity 0.8s ease;
}

.container .top .left.show {
    transform: translateX(0);
    opacity: 1;
}

.container .top .simu {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: var(--light-black);
    background-image: var(--dotted);
    background-size: 35px 35px;
    z-index: 1;
    overflow: hidden;
    transition: width 1.2s cubic-bezier(.22, 1, .36, 1);
}

.container .top .simu.show {
    width: 60%;
}

.container .top .simu #gameCanvas {
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 1;
}

.container .top .left .text {
    max-width: 70%;
}

.container .top .left h1 {
    font-size: 5.25vw;
    font-weight: 900;
    line-height: 100%;
    text-transform: uppercase;
    margin-bottom: 1rem;
    color: white;
}

.container .top .left h1 span {
    color: var(--main);
}

.container .top .left p {
    font-size: 1.1vw;
    opacity: 0.7;
}

.container .bottom {
    width: 100%;
    height: 30vh;
    background: var(--dark-black);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.carousel-container {
    width: 100%;
    margin: 0 auto;
    padding: 0 40px;
}

.carousel {
    display: flex;
    gap: 20px;
    cursor: grab;
    will-change: transform;
}

.carousel.dragging {
    cursor: grabbing;
}

.simulation {
    flex: 0 0 280px;
    text-decoration: none;
    color: white;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateY(120px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(.22, 1, .36, 1);
}

.simulation:hover {
    transform: translateY(-5px);
}

.simulation.show {
    opacity: 1;
    transform: translateY(0);
}


.mobile-lock {
    display: none;
}

.card-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #333;
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    background-size: cover;
    background-position: center;
    transition: all .3s ease-in-out;
}

.simulation:hover .card-img {
    border: 3px solid var(--main);
}

.simulation:nth-child(2) .card-img {
    background-image: url("./sprites/simulations/1.svg");
    background-size: cover;
    background-position: center center;
}

.simulation:nth-child(3) .card-img {
    background-image: url("./sprites/simulations/2.svg");
    background-size: cover;
    background-position: center center;
}

.simulation:nth-child(4) .card-img {
    background-image: url("./sprites/simulations/3.svg");
    background-size: cover;
    background-position: center center;
}

.simulation:nth-child(5) .card-img {
    background-image: url("./sprites/simulations/4.svg");
    background-size: cover;
    background-position: center center;
}

.simulation:nth-child(6) .card-img {
    background-image: url("./sprites/simulations/5.svg");
    background-size: cover;
    background-position: center center;
}

.simulation:nth-child(7) .card-img {
    background-image: url("./sprites/simulations/6.svg");
    background-size: cover;
    background-position: center center;
}

.simulation:nth-child(8) .card-img {
    background-image: url("./sprites/simulations/7.svg");
    background-size: cover;
    background-position: center center;
}

.simulation.sandbox-card .card-img {
    background-image: url("./sprites/simulations/8.svg");
    background-size: cover;
    background-position: center center;
}

.simulation span {
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    opacity: 0.8;
}

nav a {
    color: white;
    text-decoration: none;
    margin: 0 20px;
    font-weight: bold;
    text-transform: uppercase;
}

.sim-page {
    display: block;
    position: relative;
    width: 100%;
    height: 100vh;
    padding: 3rem;
    overflow: hidden;
}

#ui {
    color: white;
    width: 100%;
    height: 100%;
    z-index: 3000;
    position: relative;
    pointer-events: none;
}

.btn-back,
.controls-bottom-left,
.main-actions,
#sandboxUI,
#draftUI,
.btn-cycle,
.btn-info,
#infoModal {
    pointer-events: auto;
}

.btn-back {
    position: absolute;
    top: 2rem;
    left: 2rem;
    margin-bottom: 20px;
    font-size: 1.5rem;
    line-height: 100%;
    background: var(--light-black);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

h2#scenarioName {
    position: absolute;
    top: 2rem;
    left: 50%;
    line-height: 4rem;
    transform: translateX(-50%);
}

.btn-info {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    line-height: 50%;
    border-radius: 50%;
    background: var(--light-black);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: serif;
    font-style: italic;
    font-size: 1.2rem;
    z-index: 3005;
    pointer-events: auto;
}

#infoModal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 4000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#infoModal.hidden-modal {
    opacity: 0;
    pointer-events: none;
}

.info-content {
    background: var(--black);
    padding: 2.5rem;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    position: relative;
    color: white;
}

.info-content h2 {
    color: var(--main);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    font-weight: 900;
}



#infoBody {
    line-height: 1.6;
    opacity: 0.9;
    font-size: 0.95rem;
}

.btn-close-info {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    padding: 5px;
    transition: all .3s ease-in-out;
}

.btn-close-info:hover {
    background: none;
    color: var(--main);
}

.info-content h2 {
    font-size: 2rem;
    line-height: 100%;
    margin-bottom: 1.5rem;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: white;
}

.info-content h2::after {
    content: "";
    display: block;
    width: 80px;
    height: 4px;
    margin-top: 14px;
    border-radius: 999px;
    background: var(--main);
}

#infoBody {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    font-size: 1rem;
    line-height: 1.8;
    color: rgba(255,255,255,0.82);
}

#infoBody p {
    padding-left: 1rem;
    border-left: 2px solid rgba(255,255,255,0.08);
}

.btn-close-info {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.7);
    font-size: 1.4rem;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease, color .15s ease;
}

.btn-close-info:hover {
    background: rgba(255,255,255,0.12);
    color: white;
    transform: rotate(90deg);
}

.info-header {
    display: flex;
    flex-direction: column;
    gap: .7rem;
    margin-bottom: 2rem;
}

.info-badge {
    width: fit-content;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--main);
    color: white;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.info-subtitle {
    color: rgba(255,255,255,0.45);
    font-size: .95rem;
    letter-spacing: 1px;
}

.stats {
    position: absolute;
    top: 6rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--black);
    backdrop-filter: blur(5px);
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 900;
    font-size: 1.2rem;
    display: flex;
    gap: 15px;
    pointer-events: none;
    height: fit-content;
}

#countA, #countB {
    color: var(--main);
}

.main-actions {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    flex-direction: row;
    gap: 10px;
    pointer-events: auto;
}

.main-actions button {
    min-width: 120px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.main-actions button:last-child {
    background: var(--light-black);
}

.main-actions button:last-child:hover {
    background: #333438;
}

#gameArea {
    position: absolute;
    width: calc(100% - 6rem);
    height: calc(100% - 6rem);
    border-radius: 15px;
    cursor: grab;
}

#gameArea:active {
    cursor: grabbing;
}


#gameCanvas, #homeCanvas {
    width: 100%;
    height: 100%;
    position: absolute;
    background: var(--light-black);
    background-image: var(--dotted);
    background-size: 35px 35px;
    transform-origin: center center;
    border-radius: 15px;
    display: block;
}
#winModal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    pointer-events: auto;
    opacity: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.5s ease;
}

#winModal.hidden {
    opacity: 0;
    pointer-events: none;
}

.win-content {
    text-align: center;
    color: white;
    transform: scale(1.2);
    z-index: 2002;
}

.win-content h1 {
    font-size: 4rem;
    margin-bottom: 10px;
}

.win-stats {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    opacity: 0.8;
}

#confettiContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.confetti {
    position: absolute;
    z-index: 2001;
}

.entity {
    position: absolute;
    opacity: 0;
    pointer-events: auto;
    cursor: pointer;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center bottom;
    scale: 0.85;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.3));
    transition: opacity 0.3s ease-out, scale 0.3s ease-out;
}

.entity.visible {
    opacity: 1 !important;
    scale: 1;
}

.entity.sandbox-preview {
    pointer-events: auto;
    cursor: pointer;
}

.entity.adulte {
    background-image: url("./sprites/adulte/idle.svg");
}

.entity.enfant {
    background-image: url("./sprites/enfant/idle.svg");
}

.entity.chien {
    background-image: url("./sprites/chien/idle.svg");
}

.entity.gorille {
    background-image: url("./sprites/gorille/idle.svg");
}

.entity.oie {
    background-image: url("./sprites/oie/idle.svg");
}

.entity.boxeur {
    background-image: url("./sprites/boxeur/idle.svg");
}

.entity.batte {
    background-image: url("./sprites/batte/idle.svg");
}

.entity.batman {
    background-image: url("./sprites/batman/idle.svg");
}

.entity.attacking {
    z-index: 10;
}

.entity.adulte.attacking {
    background-image: url("./sprites/adulte/attack.svg");
}

.entity.enfant.attacking {
    background-image: url("./sprites/enfant/attack.svg");
}

.entity.chien.attacking {
    background-image: url("./sprites/chien/attack.svg");
}

.entity.gorille.attacking {
    background-image: url("./sprites/gorille/attack.svg");
}

.entity.oie.attacking {
    background-image: url("./sprites/oie/attack.svg");
}

.entity.boxeur.attacking {
    background-image: url("./sprites/boxeur/attack.svg");
}

.entity.batte.attacking {
    background-image: url("./sprites/batte/attack.svg");
}

.entity.batman.attacking {
    background-image: url("./sprites/batman/attack.svg");
}

.entity.adulte.hit {
    background-image: url("./sprites/adulte/hit.svg");
}

.entity.enfant.hit {
    background-image: url("./sprites/enfant/hit.svg");
}

.entity.chien.hit {
    background-image: url("./sprites/chien/hit.svg");
}

.entity.gorille.hit {
    background-image: url("./sprites/gorille/hit.svg");
}

.entity.oie.hit {
    background-image: url("./sprites/oie/hit.svg");
}

.entity.boxeur.hit {
    background-image: url("./sprites/boxeur/hit.svg");
}

.entity.batte.hit {
    background-image: url("./sprites/batte/hit.svg");
}

.entity.batman.hit {
    background-image: url("./sprites/batman/hit.svg");
}

.particle {
    position: absolute;
    pointer-events: none;
    transition: filter 0.25s ease-in-out;
}

.particle.landed {
    filter: brightness(0.7);
    z-index: 0 !important;
    transition: none !important;
}

.hp-bar-container {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 5px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 1000;
}

.hp-bar-fill {
    height: 100%;
    background: #4cd137;
    width: 100%;
    border-radius: 2px;
    transition: width 0.2s, background 0.2s;
}

.hp-low .hp-bar-fill { background: #e84118; }
.hp-mid .hp-bar-fill { background: #fbc531; }


.control-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
}

input,
select {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: none;
    margin-bottom: 5px;
}

.main-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

button {
    padding: 1rem;
    font-family: 'satoshi', sans-serif;
    font-weight: 900;
    background: var(--main);
    border: none;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all .3s ease-in-out;
}

button:hover {
    background: var(--secondary);
}

#playPause.paused {
    background: #2e5bcc;
}

.controls-bottom-left {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    display: flex;
    flex-direction: column-reverse;
    gap: .5rem;
    z-index: 1001;
}

.control-group-mini {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-group-mini label {
    color: white;
    font-weight: 900;
    text-transform: uppercase;
    font-size: 1rem;
    width: 90px;
}

.btn-cycle {
    width: 65px;
    padding: 8px;
    background: var(--light-black);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-family: 'satoshi', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
}

.btn-cycle:hover {
    background: var(--secondary);
}

.btn-cycle:active {
    transform: scale(0.9);
}

.zoom-controls {
    display: flex;
    gap: 4px;
}

.zoom-controls button {
    background: var(--light-black);
}

.btn-speed.active,
.zoom-controls button.active {
    background: #E74C3C;
}

.btn-zoom {
    flex: 1;
    background: #252629;
    font-size: 10px;
}

.shockwave {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    pointer-events: none;
    transform: scale(0);
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.shake {
    animation: shake 0.2s cubic-bezier(.36, .07, .19, .97) both;
}

.scene-combat {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-center {
    position: relative;
    z-index: 10;
}

.sprite-hero {
    height: 300px;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.6));
}

.attacker {
    position: absolute;
    height: 150px;
    z-index: 5;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.4));
}

.pos-top-left {
    top: 15%;
    left: 20%;
    rotate: 15deg;
}

.pos-bottom-left {
    bottom: 15%;
    left: 15%;
    rotate: -10deg;
}

.pos-right {
    top: 40%;
    right: 15%;
    scale: -1 1;
}

.pos-knockback {
    top: 10%;
    right: 25%;
    rotate: 135deg;
    scale: -0.9 0.9;
    opacity: 0.8;
    animation: knockback-float 4s ease-in-out infinite;
}

.yoyo {
    animation: yoyo-upDown-move 4s ease-in-out infinite;
}

.yoyo-delay-1 {
    animation: yoyo-move 4.5s ease-in-out infinite 0.5s;
}

.yoyo-delay-2 {
    animation: yoyo-move 3.8s ease-in-out infinite 1.2s;
}

.yoyo-delay-3 {
    animation: yoyo-move 5s ease-in-out infinite 0.2s;
}


#sandboxUI {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(620px, calc(100% - 40px));
    display: flex;
    gap: 14px;
    align-items: flex-start;
    justify-content: center;
    z-index: 2000;
    transition: opacity .25s ease, transform .25s ease;
}

#sandboxUI.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -46%);
}

.sandbox-team {
    flex: 1;
    min-width: 0;
    background: rgba(21, 23, 25, 0.88);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.sandbox-team-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sandbox-team-header h2 {
    margin: 0;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 2px;
    color: white;
}

.unit-select {
    width: 100%;
    height: 38px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: white;
    padding: 0 12px;
    font-family: 'satoshi', sans-serif;
    font-weight: 700;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border .2s ease, background .2s ease;
}

.unit-select:hover {
    background: rgba(255,255,255,0.06);
}

.unit-select:focus {
    border-color: var(--main);
}

.unit-select option {
    background: #151719;
    color: white;
    border: none;
}

.team-list {
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 8px;
    max-height: 340px;
    overflow-y: auto;
}

.team-list::-webkit-scrollbar {
    width: 6px;
}

.team-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 999px;
}

.sandbox-unit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 10px;
    padding: 0 10px;
}

.sandbox-unit-name {
    color: white;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sandbox-unit-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sandbox-unit-controls span {
    width: 20px;
    text-align: center;
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.sandbox-unit-controls button {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: white;
    font-size: 14px;
    font-weight: 900;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background .2s ease, transform .15s ease;
}

.sandbox-unit-controls button:hover {
    background: var(--main);
}

.sandbox-unit-controls button:active {
    transform: scale(0.92);
}

#bootScreen {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: linear-gradient(180deg, #17191c 0%, #111214 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity .4s ease;
}

#bootScreen::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: .45;
}

.bootContent {
    position: relative;
    z-index: 2;
    width: min(1300px, 90vw);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.bootTop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3rem;
}

.bootSprite {
    flex-shrink: 0;
    width: 340px;
    height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.bootSprite::before {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(rgba(255,255,255,.06), transparent 70%);
}

.bootSpriteImg {
    height: 80%;
    width: auto;
    object-fit: contain;
    image-rendering: pixelated;
    opacity: .92;
    filter: drop-shadow(0 0 25px rgba(0,0,0,.35));
}

.bootTitle {
    font-size: clamp(5rem, 15vw, 13rem);
    line-height: 82%;
    font-weight: 900;
    letter-spacing: -0.08em;
    text-transform: uppercase;
    color: #f5f5f5;
}

.bootTitle span {
    color: var(--main);
}

.bootBar {
    width: 100%;
    height: 5px;
    background: rgba(255,255,255,.08);
    overflow: hidden;
    position: relative;
}

.bootBarFill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--main), #ff7b5c);
    transition: width .12s linear;
}

.bootPercent {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255,255,255,.45);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .18em;
}

.bootPercent::before {
    content: "Initializing simulation";
}

#bootScreen.hide {
    opacity: 0;
    pointer-events: none;
}


#sandboxUI {
    max-width: calc(100vw - 40px);
}

.sandbox-unit-card {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: .2s ease;
    position: relative;
}

.sandbox-unit-card img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    pointer-events: none;
}

.sandbox-unit-card:hover {
    transform: translateY(-3px);
    border-color: var(--main);
}

.sandbox-unit-card.active {
    border-color: var(--main);
    background: var(--main);
}

.sandbox-unit-count {
    position: absolute;
    bottom: 6px;
    right: 8px;
    color: white;
    font-size: .7rem;
    font-weight: 800;
}

.team-switch {
    display: flex;
    gap: 10px;
}

.team-picker {
    position: relative;
    padding: 14px 22px;
    border-radius: 12px;
    border: 2px solid transparent;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.6);
    font-weight: 900;
    letter-spacing: 1px;
    transition: all .2s ease;
    backdrop-filter: blur(4px);
}

.team-picker:hover {
    transform: translateY(-2px);
}

.team-picker.active {
    background: color-mix(in srgb, var(--main) 20%, #111);
    border-color: var(--main);
    color: white;
}

.team-picker.active::after {
    content: "ACTIF";
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--main);
    color: white;
    font-size: 9px;
    padding: 3px 6px;
    border-radius: 999px;
    font-weight: 900;
}



.sandbox-unit-card {
    position: relative;
    border: 2px solid transparent;
    transition: transform .15s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.sandbox-unit-card:hover {
    transform: translateY(-2px);
}

.sandbox-unit-card.active {
    background: color-mix(in srgb, var(--main) 20%, var(--black));
    transform: scale(1.05);
}

.sandbox-unit-card.active {
    border-color: var(--main);
}


.entity-info-capsule {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(6px);
    background: var(--black);
    padding: 8px 12px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    opacity: 0;
    transition: all .15s ease;
    white-space: nowrap;
    z-index: 9999;
}

.entity-info-capsule.visible {
    opacity: 1;
}

.entity-team {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1px;
    color: #fff;
}

.entity-life {
    font-size: 11px;
    font-weight: 700;
    color: var(--main);
}




#lobbyContainer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    width: 100%;
    max-width: 400px;
    background: rgba(29, 30, 32, 0.95);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    color: white;
}

#lobbyContainer.hidden {
    display: none;
}

.lobby-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}


#multiplayerView {
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark-black);
    background-image: var(--dotted);
    background-size: 24px 24px;
}


.lobby-card {
    background: rgba(37, 38, 41, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
    margin: auto;
}

.lobby-header h2 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #FFF;
    margin-bottom: 8px;
}

.lobby-header p {
    color: #8A8B8C;
    font-size: 0.95rem;
    margin-bottom: 32px;
}

.btn-lobby {
    width: 100%;
    padding: 14px 20px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.main-action {
    background: var(--main);
    color: #FFF;
}

.main-action:hover {
    background: var(--secondary);
    transform: translateY(-2px);
}

.separator {
    margin: 20px 0;
    position: relative;
    color: #515154;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}


.join-box {
    display: flex;
    gap: 10px;
}

.join-box input {
    flex: 1;
    background: var(--black);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0 16px;
    color: #FFF;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.join-box input:focus {
    outline: none;
    border-color: var(--main);
}

.second-action {
    background: rgba(255, 255, 255, 0.08);
    color: #FFF;
    width: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.second-action:hover {
    background: rgba(255, 255, 255, 0.15);
}


.lobby-waiting {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.status-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.pulse-icon {
    width: 10px;
    height: 10px;
    background: var(--main);
    border-radius: 50%;
}

#roomDisplay {
    color: white;
}

.btn-ready {
    width: 100%;
    padding: 16px;
    background: var(--main);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-ready:hover {
    opacity: 0.9;
}

.btn-back {
    display: inline-block;
    margin-top: 1rem;
    padding: .75rem;
    color: #8A8B8C;
    text-decoration: none;
    font-size: 1.25rem;
    border-radius: .5rem;
    transition: color 0.2s;
}

.btn-back:hover {
    color: #FFF;
}




#draftUI {
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    z-index: 5000;
}
#draftUI.hidden { display: none; }

.sandbox-unit-cost {
    position: absolute;
    top: 6px;
    left: 8px;
    color: var(--main);
    font-size: .8rem;
    font-weight: 900;
}

#arenaDivider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: repeating-linear-gradient(0deg, rgba(231, 76, 60, 0.2), rgba(231, 76, 60, 0.2) 20px, transparent 20px, transparent 40px);
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 5;
}




@keyframes shake {
    10%,
    90% {
        transform: translate3d(-2px, 0, 0);
    }
    30%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }
    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

@keyframes yoyo-move {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(10px, -15px);
    }
}

@keyframes yoyo-upDown-move {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(10px);
    }
}

@keyframes knockback-float {
    0%, 100% {
        transform: rotate(45deg) translate(0, 0);
    }
    50% {
        transform: rotate(50deg) translate(30px, -70px);
    }
}

@media (max-width: 768px) {
    .container .top {
        height: 60dvh;
    }

    .container .top .left {
        padding: 0;
        clip-path: none;
        width: 100%;
    }

    .container .top .left .text {
        max-width: fit-content;
        width: min-content;
    }

    .container .top .left h1 {
        font-size: 3.5rem;
        width: min-content;
    }

    .container .top .left p {
        font-size: 1.1rem;
    }

    .container .top .simu {
        display: none;
    }

    .container .bottom {
        height: 40dvh;
    }

    #sandboxUI {
        flex-direction: column;
    }

    .sim-page {
        padding: 0;
        height: 100dvh;
    }

    #gameArea {
        width: 100%;
        height: 100%;
    }

    .simulation {
        transform: translateY(360px);
    }

    .btn-back {
        top: 15px;
        left: 15px;
        width: 40px;
        height: 40px;
        z-index: 3005;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .btn-info {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        z-index: 3005;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    h2#scenarioName {
        position: absolute;
        top: calc(15px + .75rem);
        left: 60px;
        right: 60px;
        transform: none;
        font-size: 0.9rem;
        line-height: 1.2;
        text-align: left;
        white-space: normal;
        height: auto;
    }

    .controls-bottom-left {
        bottom: 115px;
        left: 0;
        width: 100%;
        flex-direction: row;
        justify-content: center;
        padding: 0 5px;
    }

    .control-group-mini {
        flex-direction: column;
        gap: 2px;
    }

    .control-group-mini label {
        width: auto;
        font-size: 0.6rem;
        text-align: center;
    }

    .stats {
        bottom: 75px;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        min-width: 150px;
        justify-content: center;
        padding: 6px 15px;
        font-size: 0.85rem;
        background: rgba(29, 30, 32, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .main-actions {
        bottom: 15px;
        left: 10px;
        right: 10px;
        flex-direction: row;
        gap: 10px;
    }

    .main-actions button {
        flex: 1;
        height: 50px;
        font-size: 0.8rem;
        margin: 0;
    }

    #winModal {
        background: rgba(0, 0, 0, 0.7);
    }

    .win-content {
        transform: scale(1);
        width: 90%;
        padding: 20px;
    }

    .win-content h1 {
        font-size: 2.2rem;
        margin-bottom: 20px;
        line-height: 1;
    }

    .win-stats {
        flex-direction: column;
        gap: 10px;
        font-size: 1rem;
        background: rgba(255, 255, 255, 0.05);
        padding: 15px;
        border-radius: 12px;
        opacity: 1;
    }

    #winStatsA, #winStatsB {
        display: block;
        padding: 5px 0;
    }

    .info-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 80vh;
        overflow-y: auto;
    }

    .info-content h2 {
        font-size: 1.4rem;
        padding-right: 30px;
    }

    #infoBody {
        font-size: 0.9rem;
    }

    .btn-close-info {
        top: 5px;
        right: 10px;
        width: 44px;
        height: 44px;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .sandbox-card {
        opacity: .45;
        pointer-events: none;
        filter: grayscale(1);
    }

    .mobile-lock {
        display: block;
        position: absolute;
        top: 10px;
        right: 10px;
        padding: 4px 8px;
        border-radius: 999px;
        background: var(--black);
        border: 1px solid rgba(255,255,255,.1);
        font-size: .65rem;
        font-weight: 900;
        letter-spacing: 1px;
    }


}

@media (min-width: 769px) {
    #sandboxUI {
        width: calc(100% - 20px);
        flex-direction: column;
        gap: 10px;
    }

    .sandbox-team {
        width: 100%;
    }

    .team-list {
        max-height: 220px;
    }

    .sandbox-unit-card {
        width: 82px;
        height: 82px;
    }

    .sandbox-unit-card img {
        width: 64px;
        height: 64px;
    }

    .sandbox-units {
        gap: 8px;
        padding: 10px;
    }

    .team-picker {
        padding: 10px 14px;
        font-size: .8rem;
    }

    #sandboxUI {
        position: fixed;
        left: 50%;
        bottom: 20px;
        top: auto;
        transform: translateX(-50%);
        width: auto;
        max-width: calc(100vw - 40px);

        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 14px;

        z-index: 5000;
    }

    .sandbox-units {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: center;
        gap: 12px;

        padding: 14px 18px;

        border-radius: 18px;
        /* background: rgba(15,15,15,.88);
        backdrop-filter: blur(12px); */

        overflow-x: auto;
        max-width: calc(100vw - 80px);
    }

    .sandbox-unit-card {
        flex-shrink: 0;
    }

    .sandbox-top-bar {
        display: flex;
        align-items: center;
        gap: 12px;

        padding: 10px 14px;

        border-radius: 14px;
        /* background: rgba(15,15,15,.88);
        backdrop-filter: blur(12px);*/
    }

    .sandbox-top-bar .team-switch {
        display: flex;
        gap: 1rem;
    }

    .sandbox-top-bar .team-picker {
        margin: 0;
    }
}


@media (max-width: 900px) {

    .bootTop {
        display: block;
    }

    .bootSprite {
        display: none;
    }

    .bootContent {
        width: 92vw;
    }

    .bootTitle {
        width: 100%;
        font-size: 21vw;
        line-height: 80%;
        word-break: keep-all;
    }

    .bootBar {
        width: 100%;
    }

}










