/* style.css */
@font-face {
    font-family: Trueno;
    src: url("Trueno.otf") format("opentype");
}

html {
    font-family: sans-serif;
}

body{
    font-family: "Trueno",sans-serif;
    margin: 0;
    overflow: hidden;
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

#board {
    display: grid;
    grid-template-columns: repeat(9, 50px);
    grid-template-rows: repeat(9, 50px);
    gap: 1px;
    background: #ddd;
    border: 2px solid #333;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.cell {
    background: white;
    border: 1px solid #999;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.building-area-1 {
    box-shadow: inset 0 0 10px 2px rgba(255, 50, 50, 0.6); /* Stronger glow for build area */
    background-color: rgba(255, 50, 50, 0.15); /* Slightly more visible background */
}

.building-area-2 {
    box-shadow: inset 0 0 10px 2px rgba(50, 50, 255, 0.6); /* Stronger glow for build area */
    background-color: rgba(50, 50, 255, 0.15); /* Slightly more visible background */
}
.disabled-panel {
    pointer-events: none; /* Prevents all mouse events */
    opacity: 0.5;       /* Makes it slightly dimmed */
    cursor: not-allowed; /* Changes the cursor to indicate it's disabled */
    transition: opacity 0.3s ease; /* Smooth transition */
}
.player-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 25px;
    border: 2px solid #333;
    border-radius: 8px; /* Slightly more rounded corners */
    background: linear-gradient(160deg, #f0f0f0, #e0e0e0); /* Subtle gradient for panel */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); /* Soft shadow */
    transition: opacity 0.3s ease;
}

/* BUTTON STYLES */
.piece-button {
    width: 60px;
    height: 60px;
    border: 3px solid #333;
    border-radius: 8px;
    background: none;
    padding: 0;
    cursor: pointer;
    margin: 5px;
    position: relative;
    z-index: 1;
}

/* Universal shape container */
.piece-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 45%;
    transform: translate(-45%, -50%);
    width: 40px;
    height: 40px;
    background-color: var(--piece-color, #ccc);
}

/* Square button - already perfect */
.piece-button.square::before {
    border-radius: 0;
}

/* Circle button */
.piece-button.circle::before {
    border-radius: 50%;
}

/* Triangle button */
.piece-button.triangle::before {
    background: none;
    width: 40px;
    height: 40px;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    background-color: var(--piece-color, #ccc);
}

/* Selected state */
.piece-button.selected {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.color-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(3, 30px);
    gap: 2px;
    padding: 5px;
    background: white;
    border: 2px solid #333;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
    z-index: 100;
    pointer-events: auto;
}

.color-option {
    width: 30px;
    height: 30px;
    cursor: pointer;
    border: 1px solid #999;
    border-radius: 3px;
}

.color-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Game Piece Styles */
.piece {
    width: 45px;
    height: 45px;
    position: absolute;
    font-weight: bold;
    color: white; /* HP text color */
    box-shadow:
            0 2px 4px rgba(0,0,0,0.3), /* Base shadow */
            0 4px 8px rgba(0,0,0,0.2), /* Ambient shadow */
            inset 0 1px 1px rgba(255,255,255,0.5); /* Top highlight */
    overflow: hidden;
    transform-style: preserve-3d;
    background-size: cover; /* Ensures background color covers the shape */
    background-repeat: no-repeat;
    background-position: center;
    transition: all 0.2s ease-out;
    z-index: 2;
}

.piece.square {
    border-radius: 0;
    box-shadow:
            0 3px 6px rgba(0,0,0,0.3),
            0 6px 12px rgba(0,0,0,0.2),
            inset 0 1px 2px rgba(255,255,255,0.7);
}

.piece.circle {
    border-radius: 50%;
    box-shadow:
            0 3px 6px rgba(0,0,0,0.3),
            0 6px 12px rgba(0,0,0,0.2),
            inset 0 1px 2px rgba(255,255,255,0.7),
            0 0 10px 2px var(--piece-glow, transparent);
}

.piece.triangle {
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    /*   border-radius: 0 !important; Override any circular border */
    width: 40px;
    height: 40px;
    position: relative;
    border-radius: 0 !important; /* No border-radius for sharp triangle corners */
    box-shadow:
            0 3px 6px rgba(0,0,0,0.3),
            0 6px 12px rgba(0,0,0,0.2),
            inset 0 1px 2px rgba(255,255,255,0.7),
            0 0 10px 2px var(--piece-glow, transparent);
    transform-style: preserve-3d;
}

.player1 .piece {
    --piece-glow: rgba(255, 50, 50, 0.5);
}

.player2 .piece {
    --piece-glow: rgba(50, 50, 255, 0.5);
}

/* Selection and Animation Styles */
.selected-unit {
    box-shadow:
            0 0 15px 5px rgba(255, 215, 0, 0.7),
            0 5px 20px rgba(0,0,0,0.5),
            inset 0 2px 4px rgba(255,255,255,0.9);
    z-index: 10;

}

/* Edge Lighting for Depth */
.piece::after {
    content: '';
    position: absolute;
    overflow: visible;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 0 10px rgba(255,255,255,0.3);
}

/* Square Edge Lighting */
.piece.square::after {
    box-shadow: inset 0 0 15px rgba(255,255,255,0.4);
}

/* Animation Enhancements */
@keyframes pulse-glow {
    0% { box-shadow: 0 0 10px 2px var(--piece-glow); }
    50% { box-shadow: 0 0 20px 5px var(--piece-glow); }
    100% { box-shadow: 0 0 10px 2px var(--piece-glow); }
}

@keyframes moveAnimation {
    0% { transform: translate(0, 0); }
    100% { transform: translate(var(--tx), var(--ty)); }
}

@keyframes attackAnimation {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes takeDamage {
    0% { transform: scale(1); background-color: inherit; }
    25% { transform: scale(1.2); background-color: #ff0000; }
    100% { transform: scale(1); background-color: inherit; }
}

@keyframes deathAnimation {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0); opacity: 0; }
}

.attacking {
    animation: attackAnimation 0.3s ease-out;
}

.taking-damage {
    animation: takeDamage 0.5s ease-out;
}

.dying {
    animation: deathAnimation 0.5s ease-out forwards;
}

.moving-piece {
    position: absolute;
    transition: transform 0.4s ease-out;
    will-change: transform;
    z-index: 20;
    left: 0;
    top: 0;
}

.moving-piece-start {
    transform: translate(0, 0);
}

.moving-piece-end {
    transform: translate(var(--tx), var(--ty));
}

/* HP Display */
.hp-display {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 15px;
    height: 15px;
    font-size: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.hp-display.hp-hidden {
    opacity: 0;
    pointer-events: none;
}

.piece:hover .hp-display,
.piece.damaged .hp-display {
    opacity: 1;
}
/* Timer and Victory Dialog */
#timer {
    text-align: center;
    font-size: 24px;
    margin: 20px;
}

#victory-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border: 3px solid gold;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    z-index: 1000;
}

.dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    max-width: 90%;
    width: 500px;
}

.lobby-container {
    display: flex;
    gap: 20px;
    margin: 20px 0;
}

.player-info, .online-players {
    flex: 1;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

#players-list {
    list-style: none;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}

#players-list li {
    padding: 8px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

#players-list li:hover {
    background-color: #f0f0f0;
}

#player2 buttonBot {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

#player2 buttonBot:hover {
    background: #45a049;
}

.game-header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    position: relative;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.game-header h1 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: bold;
}

.header-buttons {
    display: flex;
    gap: 1rem;
}

.header-button {
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.header-button:hover {
    background: rgba(255,255,255,0.2);
}

.header-button span {
    font-size: 1.5rem;
    font-weight: bold;
}

.mastodon-button img {

}

#bot-button {
    background-color: #4a5568;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    margin: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#bot-button:hover {
    background: rgba(255, 255, 255, 0.2);
}
#bot-button img {
    width: 36px;
    height: 36px;
}
#bot-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 400px;
    width: 90%;
}

#bot-dialog .modal-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#bot-dialog .dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

#bot-dialog .dialog-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

#confirm-bot {
    background-color: #4CAF50;
    color: white;
}

#cancel-bot {
    background-color: #f44336;
    color: white;
}
#multiplayer-button {
    /* Match the help button's circular style */
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0; /* Remove any default padding */
}

#multiplayer-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

#multiplayer-button img {
    width: 36px;
    height: 36px;
}

/* Help Dialog Styles */
#help-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    max-width: 500px;
    z-index: 1000;
/*display: none; */
}

#help-dialog h2 {
    margin-top: 0;
    color: #2c3e50;
}

#help-dialog button {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 1rem;
}

#help-dialog.hidden {
    display: none;
}

.hidden {
    display: none;
}