body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(90deg, rgb(156, 15, 15) 0%, rgb(206, 207, 141) 100%);
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 800px;
    height: 600px;
    background-color: #fff;
    border: 1px solid #ccc;
    margin-top: 50px;
    margin-bottom: 50px;
}

#ui-container {
    width: 800px;
    display: flex;
    justify-content: space-between;
    background-color: #fff;
    padding: 20px;
    border: 1px solid #ccc;
}

#controls, #description {
    width: 48%;
}

#controls h3, #description h3 {
    margin-top: 0;
    font-size: 1.2em;
    border-bottom: 2px solid #ccc;
    padding-bottom: 5px;
}

#controls ul {
    list-style-type: none;
    padding-left: 0;
}

#controls ul li {
    margin: 10px 0;
}

#controls ul li b {
    color: #333;
}

#description p {
    margin-top: 0;
    line-height: 1.5;
}

#gamefield {
    border: 1px solid rgb(0, 0, 0);
    width: fit-content;
    display: grid;
    position: relative;
    background-color: rgba(0, 0, 0, 0.5);
}

#background {
    grid-area: 1 / 1;
    display: grid;
    grid-template-columns: repeat(var(--GRID_WIDTH), var(--TILE_SIZE));
    grid-template-rows: repeat(var(--GRID_HEIGHT), var(--TILE_SIZE));
}

#background .tile {
    width: var(--TILE_SIZE);
    height: var(--TILE_SIZE);
    background-repeat: no-repeat;
    background-size: 100%;
    image-rendering: pixelated;
}

#buildings, #characters {
    grid-area: 1 / 1;
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#characters .enemy {
    position: absolute;
    width: var(--TILE_SIZE);
    height: var(--TILE_SIZE);
    background-image: url('enemies/Character 5.png');
    background-size: 400% 400%;
    image-rendering: pixelated;
}

.tile.water {
    background-image: url('tiles/water.png');
}

.tile.tree {
    background-image: url('tiles/tree.png');
}

.tile.grass {
    background-image: url('tiles/grass.png');
}

.tile.flower {
    background-image: url('tiles/flowers.png');
}

.tile.fence_hori {
    background-image: url('buildings/fence_hori.png');
    background-size: cover;
}

.tile.fence_vert {
    background-image: url('buildings/fence_vert.png');
    background-size: cover;
}

.tile.tower {
    background-image: url('buildings/pot.png');
    position: absolute;
    background-size: cover;
}

.tile.tower_broken {
    background-image: url('buildings/pot_smashed.png');
    position: absolute;
    background-size: cover;
}

#score {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    color: white;
    background-color: rgba(187, 153, 0, 0.5);
    padding: 5px 10px;
    border-radius: 5px;
}

#player {
    outline: none;
    position: absolute;
    width: var(--TILE_SIZE);
    height: var(--TILE_SIZE);
    border: 1px solid rgb(0, 123, 205);
    box-shadow: 5 5 20px 5px rgb(0, 123, 205);
    border-radius: 10%;
    animation: player-glow 2s infinite alternate;
}

@keyframes player-glow {
    from {
        box-shadow: 0 0 10px 3px rgba(58, 176, 255, 0.911);
    }
    to {
        box-shadow: 0 0 20px 5px rgba(0, 119, 255, 0.75);
    }
}

.enemy .health-bar {
    position: absolute;
    top: -10px;
    left: 0;
    height: 4px;
    width: 100%;
    background-color: red;
    z-index: 1;
}

.enemy .health-bar-inner {
    height: 100%;
    background-color: green;
}

.arrow {
    width: 32px;
    height: 8px;
    background-image: url('buildings/arrow.png'); 
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: absolute;
    z-index: 2;
    image-rendering: pixelated;
}

.debug-step {
    position: absolute;
    font-size: 10px;
    font-weight: bold;
    border-radius: 25%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255, 0.89);
    background-color: transparent;
    border: none;
    box-shadow: 0 0 10px rgba(232, 232, 232, 0.582);
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}

.enemy {
    position: absolute;
    width: var(--TILE_SIZE);
    height: var(--TILE_SIZE);
    background-image: url('enemies/Character 5.png');
    background-size: 400% 400%;
    image-rendering: pixelated;
    animation-duration: 1s;
    animation-timing-function: steps(4);
    animation-iteration-count: infinite;
}

.enemy.down {
    background-position: 0% 0%;
    animation-name: down;
}

.enemy.left {
    background-position: 0% -200%;
    animation-name: left;
}

.enemy.right {
    background-position: 0% -300%;
    animation-name: right;
}

.enemy.up {
    background-position: 0% -100%;
    animation-name: up;
}

@keyframes down {
    from {
        background-position: 0% 0%;
    }
    to {
        background-position: -400% 0%;
    }
}

@keyframes left {
    from {
        background-position: 0% -200%;
    }
    to {
        background-position: -400% -200%;
    }
}

@keyframes right {
    from {
        background-position: 0% -300%;
    }
    to {
        background-position: -400% -300%;
    }
}

@keyframes up {
    from {
        background-position: 0% -100%;
    }
    to {
        background-position: -400% -100%;
    }
}
