/* * { outline: 1px solid red; } */

:root {
    --slot-width: 20%; /* Consistent width for all 5 columns */
}

/* The Move Matrix Container */
.move-matrix {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 2px;
    width: 100px;
    height: 100px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #444;
    padding: 4px;
    border-radius: 4px;
}

/* Individual Squares */
.move-square {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

/* The Center (The Hashling) */
.move-square.origin {
    background: #fff;
    box-shadow: 0 0 5px #fff;
}

/* Highlighted Move Squares */
.move-square.valid-move {
    background: var(--hashling-color, #00ffcc);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* The Matrix Styling from previous step */
.move-matrix {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    width: 80px;
    height: 80px;
}


#team-dashboard {
    width: 90%;
    justify-content: center;
    padding: 5%;
}

.team-grid {
    display: flex;
    /* flex-direction: row; */
    justify-content: center;
    width: 100%;
    gap: 15px;
    padding-top: 20px;
    padding-bottom: 20px;
    flex-wrap: wrap; /* Allows wrapping on smaller screens */
}

.team-slot {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 10px;
    width: 15%;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.team-slot img {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    margin-bottom: 10px;
}

.team-slot h3 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    text-transform: uppercase;
    text-align: center;
}

/* The Empty Icon Styling */
.empty-icon {
    width: 60px;
    height: 60px;
    opacity: 0.2;
    border: 3px solid #666;
    border-radius: 50%;
    position: relative;
    margin-bottom: 10px;
}

.empty-icon::after {
    content: '+';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: #666;
}

.team-slot:hover {
    border-color: #555;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
}

.team-slot.filled {
    border-style: solid;
    background: rgba(255, 255, 255, 0.05);
}

.slot-header p {
    width: 100%;
    margin: 5px 0;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-actions{
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 20px;
}

/* Ensure the move card fills the slot properly */
.slot-moves {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    padding: 5%;
}

.slot-header img {
    width: 64px; /* Same as your pixel-sprite class */
    height: 64px;
    image-rendering: pixelated;
    margin-bottom: 5px;
    align-items: center;
    justify-content: center;
}

.builder-team-grid {
    width: 100%;
    padding: 0%;
    justify-content: center;
}

.game-screen {
    width: 100%;
}

#roster-section {
    width: 100%;
}

#roster-container {
    display: grid;
    /* This will automatically create as many columns as fit, 
       keeping cards at least 200px wide */
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 5vh;
    padding: 20px;
    width: 90%;
    margin: 0 auto;
    place-items: center;
}

.hashling-select-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 10px;
    padding: 15px;
    width: 100%; /* Fill the grid cell */
    max-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.hashling-select-card:hover {
    transform: translateY(-5px);
    border-color: #888;
    background: rgba(255, 255, 255, 0.08);
}

.hashling-select-card h3 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    text-transform: uppercase;
}

.pixel-sprite {
    width: 64px;
    height: 64px;
    image-rendering: pixelated; /* Keeps your hashlings crisp */
    margin-bottom: 10px;
    border-radius: 4px;
}


/* --------------------------------------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------------------- */



.team-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.secondary-btn {
    background: transparent;
    border: 1px solid #00ff96;
    color: #00ff96;
    padding: 10px 20px;
    cursor: pointer;
    font-family: inherit;
    transition: 0.2s;
}

.secondary-btn:hover {
    background: rgba(0, 255, 150, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 150, 0.3);
}

#game-arena {
    min-height: 300px;
    background: #111;
    border-top: 2px solid #333;
    padding-top: 40px;
    margin-top: 40px;
    text-align: center;
}

#battle-board {
    min-height: 300px;
    min-width: 300px;
    max-width: 90vw;
    max-height: 70vh;
    aspect-ratio: 1/1;
    justify-content: center;
    align-items: center;
    background: #222;
    display: grid;
    grid-template-columns: repeat(5, 19%); /* 5 columns */
    grid-template-rows: repeat(5, 19%);    /* 5 rows */
    gap: 4px;
    background: #222;
    padding: 10px;
    border: 4px solid rgb(73, 73, 46);
    border-radius: 8px;
    margin: 40px auto;
    /* width: fit-content; */
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.board-cell {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    background: #1a1a1a;
    border: 1px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: background 0.2s;
}

/* Give it a subtle checkerboard pattern */
.board-cell:nth-child(even) {
    background: #1d1d1d;
}

.board-cell.highlight-move {
    border: 2px solid var(--move-color, #00ffcc);
    background: radial-gradient(circle, var(--move-color) 0%, transparent 70%);
    opacity: 0.8;
    transition: opacity 0.2s;
    cursor: pointer;
}

.piece-sprite {
    width: 75%;
    height: auto;
    aspect-ratio: 1 /1;
    image-rendering: pixelated;
    position: relative; /* Allows left/top to work */
    z-index: 10;        /* Ensures it slides *over* the grid, not under */
    transition: transform 0.2s ease-out; /* Define the speed and smoothness */
    pointer-events: none; /* Keep this to pass clicks through */
}

/* Apply this to enemy sprites in your createBoard function */
.enemy-piece {
    /* Force the sprite to look dark maroon */
    filter: brightness(0.4) sepia(1) hue-rotate(-50deg) saturate(5) 
            drop-shadow(0 0 8px #ff0000); 

    
    
    /* Animation to make them feel "unstable" or shadow-like */
    animation: shadow-flicker 2s infinite alternate;
    z-index: 10;
}

@keyframes shadow-flicker {
    from {
        filter: brightness(0.4) sepia(1) hue-rotate(-50deg) saturate(5) 
                drop-shadow(0 0 5px #ff0000);
    }
    to {
        filter: brightness(0.5) sepia(1) hue-rotate(-50deg) saturate(7) 
                drop-shadow(0 0 15px #ff3333);
    }
}

/* We can add a simple active state to indicate it's the selected mover */
.piece-sprite.moving {
    z-index: 20;
}

.piece-sprite.selected-mover {
    z-index: 30;
    /* transform: scale(1.1) translateY(-10px); */
    animation: pulse-glow 1.5s infinite ease-in-out;
    transition: transform 0.3s ease-out;
}

/* Add a subtle pulse to the selected piece */
@keyframes pulse-glow {
    0% { 
        filter: drop-shadow(0 0 10px var(--move-color)) brightness(1.2); 
    }
    50% { 
        filter: drop-shadow(0 0 25px var(--move-color)) brightness(1.4); 
    }
    100% { 
        filter: drop-shadow(0 0 10px var(--move-color)) brightness(1.2); 
    }
}

.selected-mover {
    animation: pulse-glow 1.5s infinite ease-in-out;
}

@media (max-width: 768px) {
    .menu-actions{
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
}