:root {
    --multiplier: .75;
    --sprite-size: calc(128px * var(--multiplier));
}

body {
    background-color: whitesmoke;
    /* padding: 25px; */
    background-image: url(images/background/bg1.png);
    background-size: 100vh;
    overflow: hidden;
}

body img {
    image-rendering: pixelated;
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

.screen-layout {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto 1fr;
    height: 100vh;
    width: 100vw;
}

.nav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: lightgray;
    border-bottom: 3px solid black;
    /* position: sticky; */
    top: 0;
    z-index: 30;
    grid-column: 1 / 3; 
}

.nav button, .nav select {
    background-color: rgb(110, 191, 218);
    border: 2px solid black;
    padding: 5px 10px;
    transition: .25s;
}
.nav button:hover {
    background-color: rgb(95, 166, 190);
    /* color: white; */
}

.card-container {
    display: flex;
    gap: 10px;
    width: fit-content;
    overflow: auto;
}

.notice {
    display: inline-block;
    background-color: red;
    color: white;
    padding: 5px 10px;
    /* margin: 10px; */
    /* font-weight: bold; */
}

.inventory-section {
    grid-column: 2;
    grid-row: 2;
    display: grid;
    grid-template-rows: 200px 1fr;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    --sprite-size: 64px;
}

.inventory-section .item-holder {
    background-color: #e7e7e7;
    padding: 10px;
    border: 2px solid black;
    border-top: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 31;
    grid-column: span 2;
    --sprite-size: 32px;
}

.inventory-section .item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, var(--sprite-size));
    gap: 10px;
    overflow-y: auto;
}

.weapon-holder, .element-holder {
    /* position: fixed; */
    width: calc(20px + var(--sprite-size));
    /* height: 100vh; */
    background: #aabee7;
    top: 0;
    right: 0;
    padding: 10px;
    overflow-Y: scroll;
    z-index: 32;
    border-left: 2px solid black;
}

.weapon-holder::-webkit-scrollbar, .element-holder::-webkit-scrollbar {
    width: 0px;
    background-color: transparent;
}

.weapon-holder .debug-weapon, .element-holder .debug-weapon {
    display: none;
}

.element-holder {
    right: calc(20px + var(--sprite-size));
    background-color: #856ec2;
    max-width: 120px;
}

.element-holder .element-icon {
    margin-bottom: 10px;
    max-height: 128px;
    max-width: 128px;
}

.weapon-holder .weapon-icon {
    margin-bottom: 10px;
    max-width: 128px;
    max-height: 256px;
    height: fit-content !important;
}

img[src=""] {
    display: none;
}

.difficulty-stats {
    background-color: rgb(255, 255, 255);
    padding: 10px;
    width: fit-content;
    border: 1px solid black;
    /* position: fixed; */
    /* left: 200px; */
}

.upgradeScreen {
    position: fixed;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.3);
    left: 0;
    top: 0;
    z-index: 100;

    --multiplier: 1;
    --sprite-size: 128px;
}

.upgradeScreen .weapon-icon {
    max-height: 200px;
}

.upgradeContainer {
    /* position: fixed; */
    width: 800px;
    height: 600px;
    /* margin: auto; */
    background-color: rgb(223 153 255);
    padding: 60px;
    display: grid;
    align-items: center;
    gap: 1rem;
    grid-template-columns: auto 1fr;
}

.upgradeContainer .upgrade-options {
    display: flex;
    gap: .5rem;
    flex-direction: column;
}

.upgradeContainer .upgrade-option {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.upgradeContainer .upgrade-option .stat-display {
    font-size: 24px;
    font-weight: bold;
    color: white;
    width: 100px;
}

.upgradeContainer .stat-holder {
    display: none;
}

.upgradeContainer .upgrade-btn {
    background-color: rgb(8, 156, 8);
    width: 100%;
    height: 70px;
    color: white;
}

.upgradeContainer .upgrade-btn:hover {
    background-color: rgb(50, 208, 50);
    color: black;
}

.upgradeContainer h1 {
    font-size: 60px;
    font-weight: 700;
    color: white;
    text-align: center;
    margin-bottom: 2rem;
}

/* Weapon Styling */
.weapon-icon {
    width: var(--sprite-size);
    height: calc(var(--sprite-size)*2);
    /* padding: 10px; */
    display: inline-grid;
    align-items: end;
    transform-origin: 50% 100%;
    position: relative;
    animation-duration: .5s;
    align-content: end;
}

/* .weapon-icon.tall {
    height: calc(var(--sprite-size)*2);
    transform-origin: 50% 80%;
} */

.weapon-icon img {
    width: 100%;
    height: auto;
    grid-row: 1 / 1;
    grid-column: 1 / 1;
}


/* Element Styling */
.person-icon .element {
    margin-bottom: calc(32px*var(--multiplier));
}
.weapon-icon .element {
    margin-bottom: calc(64px*var(--multiplier));
}

.person-icon .element.weapon-element {
    margin-bottom: calc(-40px*var(--multiplier));
}

.element-icon {
    width: var(--sprite-size);
    height: var(--sprite-size);
    position: relative;
    /* animation-duration: .5s; */
}
.element-icon.active, .weapon-icon.active {
    outline: 2px solid yellow;
}
.error {
    animation: shake 0.5s;
    outline: 2px solid red;
}
.element-icon img {
    width: 100%;
    height: auto;
}
.element-icon .energy-level {
    background-color: rgba(255, 255, 255, 0.368);
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
}

.projectile {
    position: absolute;
    width: var(--sprite-size);
    /* background-color: rgba(255, 0, 0, 0.313); */
}
.projectile img {
    width: 100%;
}
.projectile[data-direction='left'] {
    scale: -1 1;
}

.weapon-icon .ammo {
    position: absolute;
    top: 56.5%;
}

.character, .monster {
    width: calc(var(--sprite-size)*2);
    display: inline-grid;
    grid-template-rows: calc(var(--sprite-size)*2) 1fr;
    margin: 10px;
    position: relative;
    z-index: 2;
}

.character.hover {
    outline: 2px solid cyan;
}

.monster.boss {
    grid-template-rows: calc(var(--sprite-size)*4) 1fr;
}

.monster.large {
    width: calc(var(--sprite-size)*4);
    grid-template-rows: calc(var(--sprite-size)*4) 1fr;
}

.monster.cage {
    grid-template-rows: calc(var(--sprite-size)*4) 1fr;
    width: calc(var(--sprite-size)*4);
    align-items: center;
    justify-items: center;
}
.monster.cage .cage-icon {
    width: calc(var(--sprite-size)*4);
    height: calc(var(--sprite-size)*4);
    grid-row: 1 / 1;
    grid-column: 1 / 1;
    z-index: 4;
}
.monster.cage .cage-icon img {
    width: 100%;
    height: auto;
}

.monster.cage .character.caged {
    grid-row: 1 / 1;
    grid-column: 1 / 1;
    top: calc(var(--sprite-size)/2) !important;
    position: relative !important;
}
.monster.cage .character.caged .hp-container {
    display: none;
}

.monster .char-name {
    display: none;
}

.monster.ally .char-name {
    display: block;
    color: green;
    /* font-weight: bold;
    text-align: center; */
}

.monster:not(.cage):hover .char-name {
    display: block;
}

#map-grid .character {
    position: absolute;
    top: 50%;
}

.person-icon {
    width: calc(var(--sprite-size)*2);
    height: calc(var(--sprite-size)*2);
    /* padding: 10px; */
    /* display: inline-grid; */
    position: relative;
    grid-template-rows: calc(var(--sprite-size)*2) 1fr;
    /* margin: 10px; */
    animation-duration: 1s;
}

.boss .person-icon {
    height: calc(var(--sprite-size)*4);
}

.large .person-icon {
    width: calc(var(--sprite-size)*4);
    height: calc(var(--sprite-size)*4);
}

.boat .person-icon {
    height: calc(var(--sprite-size)*4);
    width: calc(var(--sprite-size)*12);
}

.sticky-boat {
    position: sticky;
    bottom: 64px;
    width: calc(var(--sprite-size)*12);
    height: calc(var(--sprite-size)*4);
    z-index: 1;
    left: 25%;
}
.sticky-boat img {
    width: 100%;
    height: auto;
}

.character .char-name {
    font-size: calc(var(--sprite-size)/3);
    text-align: center;
    grid-row-start: 2;
    font-weight: bold;
}

.person-icon > img {
    width: 100%;
    height: auto;
}

.person-icon > img {
    position: absolute;
    left: 0;
    top: 0;
}

.person-icon .shoebox {
    top: auto;
    bottom: 0;
    height: calc(16px * var(--multiplier));
    width: 50%;
    position: absolute;
    left: 25%;
}

.person-icon .shoes.movedLeft {
    left: calc(-16px*var(--multiplier));
}
.person-icon .shoes.movedRight {
    left: calc(16px*var(--multiplier));
}
.person-icon .shoes.left-shoe {
    scale: -1 1;
}
.character .person-icon.moving {
    animation: moving 0.5s infinite;
}

.person-icon img.eyes, .person-icon img.mouth {
    z-index: 3;
}

.person-icon img.hair[src="images/people/hair-longbeard.png"],
.person-icon img.hair[src="images/people/hair-longbraid.png"] {
    z-index: 2;
}
.person-icon img.hair[src="images/people/hair-extralong.png"] {
    z-index: -1;
}
.person-icon img.accessory {
    z-index: 4;
}
.person-icon img.skin {
    z-index: -2;
}

.characterCreator {
    padding: 25px;
    width: 100%;
    background-color: rgb(146, 242, 255);
    border-top: 3px solid black;
    margin-top: 30px;
    position: absolute;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr auto;
}

.characterCreator .character-selectors {
    width: 100%;
    padding: 10px;
    border: 2px solid black;
    background-color: lightseagreen;
}

.characterCreator .creator-grid {
    display: grid;
    grid-template-columns: 100px repeat(auto-fit, 200px);
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.characterCreator select, .characterCreator input {
    width: 100%;
    padding: 5px;
    background-color: rgb(204, 195, 195);
}

.characterCreator label {
    font-weight: bold;
    text-transform: capitalize;
}

.characterCreator button {
    padding: 10px;
    background-color: rgb(71, 130, 71);
    color: white;
    border: none;
}
.characterCreator button:hover {
    background-color: rgb(66, 109, 66);
}

.characterCreator .custom-colors {
    position: absolute;
    padding: 25px;
    background-color: gray;
}

.characterCreator .custom-colors .btn-close {
    position: absolute;
    top: 10px;
    right: 10px;
}

.characterCreator .custom-holder {
    --multiplier: 1;
    --sprite-size: 128px;
}

.characterCreator .custom-holder .hp-container {
    display: none;
}

.person-icon .weapon-icon {
    position: absolute;
    right: 0;
    bottom: calc(64px*var(--multiplier));
    height: calc(64px*var(--multiplier));
    z-index: 5;
    /* top: -5px; */
}

/* .person-icon .weapon-icon.tall {
    bottom: 20px;
} */

.boss .weapon-icon {
    bottom: calc(128px*var(--multiplier));
    right: calc(-32px*var(--multiplier));
}

/* Hitboxes */
body.show-hitboxes .character.selected .weapon-icon {
    background-color: rgba(255, 255, 0, 0.404);
}
body.show-hitboxes .character.p2 .weapon-icon {
    background-color: rgba(0, 255, 68, 0.404);
}
body.show-hitboxes .character.p3 .weapon-icon {
    background-color: rgba(224, 85, 255, 0.404);
}
body.show-hitboxes .character.attacking .weapon-icon {
    border: red 1px solid;
}
body.show-hitboxes .projectile {
    border: 1px solid red;
    background-color: rgba(217, 141, 65, 0.404);
}
body.show-hitboxes .character {
    border: 2px solid gray;
}
body.show-hitboxes .character.cooldown {
    background-color: rgba(255, 87, 61, 0.37);
}
body.show-hitboxes .monster .weapon-icon {
    background-color: rgba(255, 0, 0, 0.404);
}

body.show-hitboxes .shoebox {
    background-color: rgba(0, 255, 0, 0.404);
    /* border: 1px solid green; */
}

.ground {
    /* height: 300px; */
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: rgba(104, 6, 104, 0.201);
}

.ground-hitbox {
    position: absolute;
    width: 100%;
    /* height: 50px; */
    bottom: 0;
    left: 0;
    background-color: transparent;
    pointer-events: none;
}

body.show-hitboxes .ground-hitbox {
    background-color: rgba(255, 0, 251, 0.404);
    z-index: 4;
}

.platform {
    position: absolute !important;
    /* background-color: rgba(0, 255, 255, 0.404); */
    background-color: transparent;
    border: 1px solid transparent;
    /* border-color: rgba(128, 128, 128, 0.057); */
    background-size: calc(2* var(--sprite-size)) auto;
    background-repeat: no-repeat;
}

.platform.ladder {
    background-repeat: repeat-y;
    /* background-image: url(images/decoration/ladder.png); */
}

.platform.tree {
    background-repeat: repeat-y;
    background-size: var(--sprite-size);
}

.platform.leaves {
    background-size: calc(128px*var(--multiplier)*4) auto;
}

.platform.ladderS {
    background-repeat: repeat-y;
    background-size: var(--sprite-size);
    /* background-image: url(images/decoration/ladder-short.png); */
}

.platform.stone, .platform.wood {
    background-repeat: repeat;
    background-position: center;
}

.platform.box {
    background-repeat: no-repeat;
    /* background-position: center; */

}

body.show-hitboxes .platform {
    background-color: rgba(0, 255, 255, 0.404);
    z-index: 10;
}

.platform.selected {
    border-color: yellow;
    background-color: rgba(221, 240, 136, 0.523);
}

body.hide-healthbars .character .hp-container {
    display: none;
}

.person-icon[data-direction='left'] {
    transform: rotateY(180deg);
}

.character .hp-container {
    position: absolute;
    height: calc(24px*var(--multiplier));
    width: 100%;
    top: -20px;
    right: 0;
    background-color: rgb(203, 0, 0);
    /* border: 2px solid black; */
    /* display: grid; */
    /* align-items: center; */
}

.character .hp-container .hp {
    background-color: rgb(59, 222, 26);
    height: 100%;
    width: 100%;
    transition: width 0.25s;
}

.character .hp-container .stat-health {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: calc(14px*var(--multiplier));
}

.character .hp.med {background-color: yellow;}
.character .hp.low {background-color: rgb(255, 157, 0);}

.character .hp-container .xp-container {
    width: 100%;
    height: 5px;
    background-color: black;
}

.character .hp-container .xp-container .xp-bar {
    height: 100%;
    background-color: rgb(0, 0, 255);
    width: 0;
}

.character.selected .char-name {
    /* outline: 2px solid yellow; */
    color: yellow;
}
.character.p2 .char-name {
    /* outline: 2px solid green; */
    color: blue;
}
.character.p3 .char-name {
    color: pink;
    /* outline: 2px solid pink; */
}

.character.selected, .character.p2, .character.p3 {
    z-index: 4;
}

.person-icon img.weapon {
    position: relative;
    bottom: calc(-40px*var(--multiplier));
}

.coin, .map-item {
    width: var(--sprite-size);
    height: auto;
    position: absolute;
    top: 200px;
}
.coin img, .map-item img {
    width: 100%;
    height: auto;
}

.map-item .cost-indicator {
    position: absolute;
    top: 0;
    right: 0;
    background-color: rgb(234, 255, 0);
    color: rgb(0, 0, 0);
    font-size: 12px;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 5px;
}

.food {
    width: var(--sprite-size);
    height: auto;
    /* position: absolute;
    top: 200px; */
}
.food img, .item img {
    width: 100%;
    height: auto;
}

.item {
    width: var(--sprite-size);
    height: var(--sprite-size);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.item .item-amount {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 3px;
}

.quest {
    background-color: white;
    border: 2px solid black;
    padding: 10px;
    margin-bottom: 10px;
    position: absolute;
    width: calc(var(--sprite-size)*2);
    top: calc(var(--sprite-size) * -1.5);
}
.quest.complete {
    background-color: lightgreen;
    border-color: green;
}

.door {
    /* width: calc(var(--sprite-size)*2); */
    height: calc(var(--sprite-size)*2);
    position: absolute;
    top: 50%;
    aspect-ratio: 1 / 1;
}

.door img {
    width: 100%;
    height: auto;
    position: absolute;
    left: 0;
    top: 0;
}

.map-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.map-container .scroll-controls {
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background-color: gray;
    padding: 5px;
}

#map-grid {
    /* min-width: 400vw; */
    width: fit-content;
    height: 100%;
    position: absolute;
    z-index: -1;
    background-image: url(images/background/bg1.png);
    background-size: auto 100%;
    image-rendering: pixelated;
}
#map-grid .special-bg {
    /* position: absolute; */
    width: 100%;
    height: 100%;
    /* top: 0; */
    z-index: -1;
    display: flex;
}
#map-grid .special-bg .map-section {
    width: 100%;
    min-width: fit-content;
    height: 100%;
    position: relative;
}
#map-grid .special-bg .room-bg {
    height: 100%;
    width: auto;
    image-rendering: pixelated;
}

#map-grid .special-bg[data-theme='night'] img {
    filter: brightness(0.5);
}
#map-grid .special-bg[data-theme='invert'] img {
    filter: invert(1);
}
#map-grid .special-bg[data-theme='gray'] img {
    filter: grayscale(1);
}
#map-grid .special-bg[data-theme='vibrant'] img {
    filter: saturate(2) brightness(1.2);
}
#map-grid .special-bg[data-theme='nightmare'] img {
    filter: grayscale(1) brightness(0.8);
}
#map-grid .special-bg[data-theme='nightmare'] .parallax-bg {
    filter: grayscale(1) brightness(.2);
}


#map-grid .special-bg .advanced-bg {
    position: relative;
}
#map-grid .special-bg .fg {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}
#map-grid .special-bg .decor {
    position: absolute;
    width: auto;
    height: 50%;
}

#map-grid .special-bg .parallax-bg {
    position: absolute;
    width: 200%;
    height: 100%;
    left: 0;
    top: 0;
    z-index: -1;
    background-size: auto 100%;
    background-repeat: repeat-x;
}

#transition-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: black;
    top: 0;
    left: 0;
    z-index: 50;
    display: none;
}

.c-lightning {background-color: yellow;}
.c-nature {background-color: green;}
.c-water {background-color: blue;}
.c-earth {background-color: brown;}
.c-fire {background-color: red;}
.c-light {background-color: rgb(255, 255, 211);}
.c-dark {background-color: black; color: white;}
.c-ice {background-color: lightblue;}
.c-air {background-color: lightgray;}
.c-metal {background-color: silver;}
