#grid-container {
    position: relative;
    margin: 2rem auto;
    width: fit-content;
}

#hex-grid {
    position: relative;
    margin: 52px;
}

#hex-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

.hex-tile {
    position: absolute;
    width: 75px;
    height: 64px;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    cursor: pointer;
    transition: transform 0.2s;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transform: translate(-50%, -50%);
    background-clip: padding-box;
}

#status-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.8);
    padding: 1rem;
    color: white;
    border-radius: 8px;
}

.terrain-plains { background: #7cb342; }
.terrain-forest { background: #2e7d32; }
.terrain-hill { background: #795548; }
.terrain-water { background: #1976d2; }
.terrain-bridge {
    background: #1976d2 linear-gradient(
        0deg,
        transparent 33%,
        #8b4513 50%,
        transparent 66%
    );
}

.terrain-treehouse {
    background: #228B22;
    position: relative;
}

.terrain-treehouse::after {
    content: '🌳';
    position: absolute;
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.terrain-cave {
    background: #36454F;
    position: absolute;
}

.terrain-cave::after {
    content: '⛰️';
    position: absolute;
    font-size: 24px;
    filter: brightness(0.8);
}

.hex-tile.terrain-bridge:hover {
    background: #d4a574 linear-gradient(
        45deg,
        transparent 45%,
        #8b4513 50%,
        transparent 55%
    );
}

.battle-unit {
    width: 30px;
    height: 30px;
    background: #ff4444;
    border-radius: 50%;
    border: 2px solid #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2;
}

.battle-unit.player {
  background: #4CAF50;
}

.battle-unit.enemy {
  background: #f44336;
}

.movement-range {
    filter: brightness(1.2) !important;
    box-shadow: 0 0 10px rgba(255,255,0,0.5);
}


#selection {
    transform: translateX(-0%);
    left: 0%;
    width: 25%;
    background: rgba(0,0,0,0.7);
    padding: 1rem;
    border-radius: 8px;
}

.action-button {
    background: #4CAF50;
    border: none;
    padding: 8px 16px;
    margin: 4px;
    color: white;
    cursor: pointer;
}

.message-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

#status-panel, #message-container {
    z-index: 1000;
}

.hex-tile.movement-range:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
    z-index: 100;
}

:root {
    --player-color: #4CAF50;
    --enemy-color: #f44336;
    --movement-glow: rgba(255,255,0,0.3);
}

.battle-unit.player { background: var(--player-color); }

.hex-targeting-ui {
    background: rgba(0, 0, 0, 0.9);
    padding: 1rem;
    border: 2px solid #00ff88;
    margin-top: 1rem;
}

.movement-range {
    filter: brightness(1.2);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
    cursor: pointer;
}

.movement-range.active {
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.5);
    filter: brightness(1.4);
}

.hex-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.hex-action-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 0;
}

[data-hex-coord]::before {
    content: attr(data-hex-coord);
    display: block;
    font-size: 0.8em;
    color: #00ff88;
    margin-bottom: 4px;
}

.elevation-marker {
    position: absolute;
    top: 2px;
    left: 2px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.8em;
}

.terrain-water::after {
    content: '^';
    color: rgba(255,255,255,0.7);
    position: absolute;
    font-size: 36px;
    animation: flow 1.4s ease-out .3s infinite;
}

@keyframes flow {
    from { transform: translateY(75%); }
    to { transform: translateY(-25%); }
}

@media (max-width: 768px) {
    #status-panel {
        top: 5px;
        right: 5px;
        padding: 0.5rem;
        font-size: 0.8em;
    }
    
    .action-button {
        padding: 6px 12px;
        font-size: 14px;
    }
}