:root {
    --commonBorder: solid 1px white;
    --uiFont: monospace;
    --panelSurface: rgba(255, 255, 255, 0.9);
    --panelBorder: rgba(0, 0, 0, 0.922);
}

* {
    margin: 0;
    box-sizing: border-box;
    user-select: none;
}

[hidden] {
    display: none !important;
}

html,
body {
    /* Avoid scroll to refresh page in mobiles */
    overscroll-behavior: none;
}

body {
    font-family: sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #5aa8d4;
}

body[data-camera-mode="wow"] {
    cursor: url("assets/icons/cursor/Middle\ Ages--cursor--SweezyCursors.png") 1 1, auto;
}


body[data-camera-mode="wow"] button,
body[data-camera-mode="wow"] a,
body[data-camera-mode="wow"] label,
body[data-camera-mode="wow"] input,
body[data-camera-mode="wow"] select {
    cursor: url("assets/icons/cursor/Middle\ Ages--pointer--SweezyCursors.png") 1 1, pointer;
}

body[data-camera-mode="wow"] #crossHair,
body[data-camera-mode="legoLol"] #crossHair {
    display: none;
}

a {
    text-decoration: none;
    color: blue;
    transition: 0.2s;
}

a:hover {
    font-weight: bold;
}
#loadingScreen {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 35%, #98d9ff 0%, #5aa8d4 45%, #284a60 100%);
    color: #f3f8ff;
    transition: opacity 0.35s ease;
}

#loadingScreen.is-hidden {
    opacity: 0;
    pointer-events: none;
}

#loadingContent {
    width: min(520px, calc(100vw - 48px));
    padding: 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(14, 25, 34, 0.6);
    backdrop-filter: blur(4px);
    font-family: var(--uiFont);
}

#loadingContent h1 {
    margin-bottom: 12px;
    font-size: 1.25rem;
}

#loadingBarTrack {
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    overflow: hidden;
    margin-bottom: 10px;
}

#loadingBarFill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ffe38f 0%, #ffd042 100%);
    transition: width 0.15s linear;
}

#loadingText {
    font-size: 0.95rem;
}

#sceneView {
    position: relative;
    width: 100%;
    height: 100vh;
    border: none;
    outline: none;
    z-index: 0;
    contain: layout paint size;
}

#sceneView canvas {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
    outline: none;
}

img {
    max-width: 100%;
}

#consola {
    position: absolute;
    top: 0;
    left: 0;
    background-color: rgba(74, 74, 74, 0.426);
    font-family: var(--uiFont);
    font-size: 1rem;
    padding: 5px;
    height: 2rem;
    z-index: 40;
}

#chatBox {
    position: absolute;
    top: 2rem;
    left: 0;
    height: 150px;
    width: 50%;
    z-index: 1;
    padding: 5px;
    overflow: auto;
    font-family: var(--uiFont);
    font-size: 1rem;
    transition: 0.2s;
}

#chatBoxOutput {
    height: 80%;
    overflow: auto;
}

.backgrounded {
    background-color: rgba(16, 16, 108, 0.468);
}

#chatBoxInput {
    max-width: 100%;
    border: solid 1px rgb(0, 0, 120);
    background-color: unset;
    position: absolute;
    bottom: 5px;
    left: 5px;
    right: 5px;
}

#miniMap {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 200px;
    height: 200px;
    background-color: rgba(5, 20, 30, 0.65);
    border: var(--commonBorder);

    overflow: hidden;
    pointer-events: none;
    z-index: 45;
}

#miniMap canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#miniMapPlayerMarker {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 16px solid #ffd400;
    transform: translate(-50%, -50%);
    transform-origin: 50% 66%;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.45));
    z-index: 3;
}

.mini-map-entity-marker {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 10px solid #5aa7ff;
    transform: translate(-50%, -50%);
    transform-origin: 50% 66%;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.45));
    z-index: 2;
}

.mini-map-marker--walker {
    border-bottom-color: #1e7cff;
}

.mini-map-marker--chaser {
    border-bottom-color: #ff2a2a;
}

.mini-map-marker--talker {
    border-bottom-color: #b96bff;
}

#crossHair {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 2rem;
    user-select: none;
    z-index: 25;
    pointer-events: none;
}

#menuCentral {
    --menu-surface: rgba(255, 255, 255, 0.9);
    --menu-surface-strong: rgba(255, 255, 255, 0.72);
    --menu-border: rgba(0, 0, 0, 0.92);
    --menu-text: #181818;
    --menu-tab-bg: #ffffff;
    --menu-tab-text: #222222;
    --menu-tab-active-bg: #4da3ff;
    --menu-tab-active-text: #081a2f;
    --menu-link: #0052cc;
    --menu-control-bg: rgba(255, 255, 255, 0.96);
    --menu-control-bg-active: #4da3ff;
    --menu-control-text: #222222;
    --menu-control-border: rgba(0, 0, 0, 0.7);
    text-align: left;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 760px;
    height: 550px;
    max-height: 90%;
    width: min(760px, calc(100vw - 28px));
    background-color: var(--menu-surface);
    border-radius: 10px;
    border: solid 2px var(--menu-border);
    padding: 14px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    color: var(--menu-text);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

#menuCentral[data-theme="dark"] {
    --menu-surface: rgba(18, 24, 32, 0.94);
    --menu-surface-strong: rgba(29, 38, 48, 0.9);
    --menu-border: rgba(214, 224, 234, 0.28);
    --menu-text: #edf3f8;
    --menu-tab-bg: #22303d;
    --menu-tab-text: #edf3f8;
    --menu-tab-active-bg: #4da3ff;
    --menu-tab-active-text: #081a2f;
    --menu-link: #8cc4ff;
    --menu-control-bg: rgba(30, 42, 54, 0.96);
    --menu-control-bg-active: #4da3ff;
    --menu-control-text: #f4f8fb;
    --menu-control-border: rgba(214, 224, 234, 0.48);
}

#menuCentral h1 {
    font-family: var(--uiFont);
    margin-bottom: 10px;
    text-align: center;
}

#menuCloseButton {
    position: absolute;
    right: 15px;
    font-weight: bold;
    font-size: 1.4rem;
    transition: 0.2s;
}

#menuCloseButton:hover {
    text-shadow: 0 0 10px white;
    color: rgb(255, 127, 127);
}

#menuCloseButton:active {
    
    color: rgb(255, 0, 0);
}

.menu-tabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.menu-tab {
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid var(--menu-control-border);
    border-radius: 999px;
    padding: 6px 14px;
    font-family: var(--uiFont);
    font-weight: 700;
    background-color: var(--menu-tab-bg);
    color: var(--menu-tab-text);
    cursor: pointer;
}

.menu-tab:hover {
    filter: brightness(0.96);
}

.menu-tab.is-active {
    background-color: var(--menu-tab-active-bg) !important;
    color: var(--menu-tab-active-text);
    border-color: var(--menu-tab-active-bg);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18), 0 6px 14px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

.menu-panel {
    display: none;
    border: 2px solid var(--menu-border);
    border-radius: 8px;
    background: var(--menu-surface-strong);
    padding: 12px;
    line-height: 1.7;
    height: 100%;
}

.menu-panel.is-active {
    display: block;
    overflow: auto;
}

.menu-panel h2,
.menu-panel h3 {
    font-family: var(--uiFont);
    margin-bottom: 8px;
}

#menuCentral a {
    color: var(--menu-link);
}

#menuCentral input,
#menuCentral button,
#menuCentral select {
    color: inherit;
}

#menuCentral button,
#menuCentral select {
    border: 2px solid var(--menu-control-border);
    background: var(--menu-control-bg);
    color: var(--menu-control-text);
}

#menuCentral input[type="checkbox"],
#menuCentral input[type="range"] {
    accent-color: var(--menu-control-bg-active);
}

#menuCentral input:focus-visible,
#menuCentral button:focus-visible,
#menuCentral select:focus-visible {
    outline: 2px solid var(--menu-control-bg-active);
    outline-offset: 2px;
}

.settings-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.settings-toggle label {
    color: var(--menu-text);
}

#kolorlandiaCharacterMenu {
    display: flex;
    flex-wrap: wrap;
}

#kolorlandiaCharacterMenu_info {
    width: 50%;
    padding: 15px;
}

#kolorlandiaCharacterMenu_player {
    position: relative;
    background: transparent;
    width: 25%;
    aspect-ratio: 9/16;
    overflow: hidden;
    touch-action: pan-y;
    cursor: grab;
}

#kolorlandiaCharacterMenu_player:active {
    cursor: grabbing;
}

#kolorlandiaCharacterMenu_player canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#kolorlandiaCharacterMenu_slots {
    line-height: 0;
    background-color: gray;
    width: 25%;
    aspect-ratio: 1;
    margin: auto 0;
    height: max-content;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-gap: 5px;
    padding: 5px;
}

#kolorlandiaCharacterMenu_slots>div {
    border: solid 3px black;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;

}

#kolorlandiaCharacterMenu_slots>div>img {
    width: 100%;

}

.inverted {
    transform: scaleX(-1);
}

@media screen and (max-width: 650px) {
    #kolorlandiaCharacterMenu_info {
        width: 100%;

    }

    #kolorlandiaCharacterMenu_player {

        width: 100%;

    }

    #kolorlandiaCharacterMenu_slots {
        width: 100%;
    }
}

.joystick {
    border: var(--commonBorder);
    width: 60%;
    aspect-ratio: 1;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    background-color: gray;
    align-items: center;
    touch-action: none;
}

.pad {
    border: var(--commonBorder);
    background-color: rgb(75, 75, 75);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    position: relative;
    z-index: 2;
    will-change: transform;
}

.flex {
    display: flex !important;
}

#menuInferior {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20%;
    background-color: rgba(0, 0, 0, 0.783);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: space-around;
    align-items: center;
    z-index: 35;
    touch-action: none;
}

#playerHud {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    width: min(520px, calc(100vw - 20px));
    z-index: 24;
    pointer-events: none;
}

#gameModeReadout,
#voxelReadout {
    text-align: center;
    font-family: var(--uiFont);
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffebeb;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

#gameModeReadout {
    margin-bottom: 4px;
}

#playerInventorySlots,
#inventorySlots,
#itemEncyclopediaSlots,
#hotbar {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border: 2px solid rgba(255, 255, 255, 0.72);
    background: rgba(10, 12, 16, 0.6);
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#playerInventorySlots,
#inventorySlots,
#itemEncyclopediaSlots {
    margin-top: 10px;
}

.inventory-slot {
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: rgba(255, 255, 255, 0.65);
    font-family: var(--uiFont);
    color: #1f2630;
    cursor: pointer;
    gap: 8px;
    padding: 8px 10px;
}

.icon-chip {
    position: relative;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, 0.3));
}

.icon-chip__square {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #4a90ff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 0 2px rgba(15, 23, 42, 0.18);
}

.image-icon__img {
    display: block;
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.voxel-icon {
}

.voxel-icon__svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.inventory-slot.is-selected {
    border-color: #fff5a8;
    box-shadow: 0 0 0 2px rgba(255, 239, 140, 0.7);
}

.creative-slot {
    width: 100%;
}

#inventorySelected {
    margin-top: 10px;
    font-family: var(--uiFont);
    font-weight: 700;
}

#playerInventorySummary,
#playerInventorySelection {
    font-family: var(--uiFont);
    font-weight: 700;
}

.inventory-help {
    margin-top: 10px;
    font-family: var(--uiFont);
    opacity: 0.9;
}

#voxelReadout {
    margin-bottom: 6px;
}

#playerHealthBar {
    position: relative;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    background: rgba(35, 35, 35, 0.8);
    overflow: hidden;
}

#playerHealthFill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    background: linear-gradient(90deg, #1ca646 0%, #62d84a 100%);
    transition: width 0.1s linear;
}

#playerHealthText {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--uiFont);
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

#hotbar {
    margin-top: 8px;
    pointer-events: auto;
}

.hotbar-slot {
    appearance: none;
    -webkit-appearance: none;
    aspect-ratio: 1 / 1;
    border: 2px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    touch-action: manipulation;
    padding: 0;
}

.hotbar-slot.is-selected {
    border-color: #fef8bc;
    box-shadow: 0 0 0 2px rgba(255, 238, 128, 0.35);
    background: rgba(255, 248, 188, 0.18);
}

.hotbar-slot.is-empty {
    opacity: 0.72;
}

.item-slot-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -45%);
}

.hotbar-slot .voxel-icon {
    width: 46px;
    height: 46px;
    filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, 0.3));
}

.hotbar-slot .voxel-icon__svg {
    width: 100%;
    height: 100%;
}

.hotbar-slot-label,
.hotbar-slot-count {
    position: absolute;
    left: 4px;
    right: 4px;
    font-family: var(--uiFont);
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hotbar-slot-label {
    top: 3px;
    max-width: calc(100% - 8px);
}

.hotbar-slot-count {
    left: auto;
    bottom: 3px;
    text-align: right;
}

.inventory-menu-slot {
    cursor: pointer;
    touch-action: none;
}

.creative-slot,
.inventory-menu-slot,
.encyclopedia-item-slot {
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.08);
}

.creative-slot:hover,
.inventory-menu-slot:hover,
.encyclopedia-item-slot:hover {
    background: rgba(255, 248, 188, 0.14);
}

.inventory-menu-slot.is-drag-source {
    opacity: 0.35;
}

.inventory-drag-preview {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 120;
    pointer-events: none;
}

.inventory-drag-preview>.inventory-menu-slot {
    width: 64px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    opacity: 0.96;
}

.game-mode-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-family: var(--uiFont);
    font-weight: 700;
}

.game-mode-button {
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid var(--menu-control-border);
    border-radius: 999px;
    background-color: var(--menu-control-bg);
    color: var(--menu-control-text);
    cursor: pointer;
    font-family: var(--uiFont);
    font-weight: 700;
    padding: 4px 12px;
}

.game-mode-button.is-active {
    background-color: var(--menu-control-bg-active) !important;
    color: #17120a;
    border-color: var(--menu-control-bg-active);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.38);
    transform: translateY(-1px);
}

#menuInferiorLeft {
    background-color: rgba(255, 0, 0, 0.25);
    position: relative;
    height: 100%;
    flex: 50%;
    touch-action: none;
}

#menuInferiorRight {
    background-color: rgba(0, 128, 0, 0.25);
    position: relative;
    flex: 50%;
    height: 100%;
    touch-action: none;
}

#menuInferiorLeft>.joystick,
#menuInferiorRight>.joystick {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

/* BUTTONS */

#playButton {
    border: solid 6px green;
    color: rgb(0, 52, 0);
    background-color: rgb(72, 255, 72);
    margin-top: 10px;
    padding: 5px;
    min-width: 220px;
    font: unset;
    font-size: 2rem;
    font-family: var(--uiFont);
    transition: 0.2s;
}

#playButton:hover {
    color: white;

}

#playButton:active {
    color: red;
}

#Left0,
#Left1,
#buttonDown,
#buttonUp,
#buttonShoot,
#Right1,
#Right2,
#Right3 {
    position: absolute;
    background-color: rgb(75, 75, 75);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;

}

#buttonDown {
    left: 5px;
    bottom: 5px;
}

#buttonUp {
    right: 5px;
    bottom: 5px;
}

#Left0 {
    left: 5px;
    top: 5px;
}

#Left0.is-active,
#Left1.is-active,
#Right3.is-active {
    background-color: green;
}

#Left1 {
    right: 5px;
    top: 5px;
}

#Right1 {
    top: 5px;
    right: 5px;
}

#Right2 {
    bottom: 5px;
    left: 5px;
}

#Right3 {
    bottom: 5px;
    right: 5px;
}

#buttonShoot {
    left: 5px;
    top: 5px;

    transition: background-color 0.08s linear;
    touch-action: none;
}

.icon {
    filter: invert(1);
    pointer-events: none;
    padding: 5px;
}

#buttonShoot.is-shooting,
#Right1.is-shooting,
#Right2.is-shooting {
    background-color: rgb(210, 30, 30);
}

.button.is-active {
    background-color: rgb(210, 170, 30);
}

.button {
    border: var(--commonBorder);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    user-select: none;
    position: relative;
    z-index: 1;
    touch-action: none;
}

/* MOBILE PORTRAIT MODE */
body[data-mode="mobile-portrait"] {
    height: 100dvh;
    overflow: hidden;
}

body[data-mode="mobile-portrait"] #sceneView {
    position: relative;
    inset: auto;
    height: 80dvh;

}

body[data-mode="mobile-portrait"] #playerHud {
    bottom: 22%;
}

body[data-mode="mobile-portrait"] #miniMap {
    width: 100px;
    height: 100px;
}

body[data-mode="mobile-portrait"] #menuInferior {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 20dvh;
}

body[data-mode="mobile-portrait"] #menuCentral {
    position: fixed;
    top: 4dvh;
    bottom: 4dvh;
    left: 50%;
    transform: translateX(-50%);
    width: min(760px, calc(100vw - 20px));
    height: 90dvh;
    max-height: 90dvh;
}

body[data-mode="mobile-portrait"] #menuInferiorLeft {
    background-color: rgba(255, 0, 0, 0.377);
    
}

body[data-mode="mobile-portrait"] #menuInferiorRight {
    background-color: rgba(0, 96, 0, 0.493);
    
}

/* MOBILE LANDSCAPE MODE */
body[data-mode="mobile-landscape"] #menuInferior {
    top: 0;
    bottom: 0;
    height: 100%;
    justify-content: space-between;
    align-items: end;
    background-color: unset;
    backdrop-filter: unset;
    pointer-events: none;
}

body[data-mode="mobile-landscape"] {
    height: var(--app-height, 100vh);
}

body[data-mode="mobile-landscape"] #sceneView {
    height: var(--app-height, 100vh);
}

body[data-mode="mobile-landscape"] #menuInferiorLeft {
    background-color: rgba(255, 0, 0, 0.377);
    border-top-right-radius: 50%;
    height: 50%;
    flex: 25%;
    max-width: 25%;
    pointer-events: auto;
}

body[data-mode="mobile-landscape"] #menuInferiorRight {
    background-color: rgba(0, 96, 0, 0.493);
    border-top-left-radius: 50%;
    flex: 25%;
    height: 50%;
    max-width: 25%;
    pointer-events: auto;
}

body[data-mode="mobile-landscape"] #miniMap {
    width: 100px;
    height: 100px;
    right: 12px;
}

body[data-mode="mobile-landscape"] #playerHud {
    width: 50%;
}

body[data-mode="mobile-landscape"] .not-on-landscape{
    display: none;
}
