
:root {
    /* TODO keep defaults for validity but embed dynamically via JS */
    --movement-transition: 0.10s;
    --zoom-transition: 0.20s;
}


/* general */

html,
html > body {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
}

#panes {
    display: flex;
    /* flex-direction: row; */
    /* gap: 6px; */
    /* align-items: stretch; */
    /* display: grid; */
    /* column-gap: 4px; */
    /* row-gap: 4px; */
    /* padding: 4px; */
    width: 100%;
    height: 100%;
    /* box-sizing: border-box; */
}

@media screen and (orientation:landscape) {
    #panes {
        /* grid-template-columns: 1fr 1fr; */
        flex-direction: row;
    }
}

@media screen and (orientation:portrait) {
    #panes {
        /* grid-template-rows: 1fr 1fr; */
        flex-direction: column;
    }
}

#pane-world,
#pane-components {
    flex: 0 0 50%;
}

.pane-description {
    background-color: #ffffff;
    padding: 1em;
}

#pane-world {
    position: relative;
    overflow: hidden;
    image-rendering: pixelated;
    /* outline: 2px solid #888888; */
    background-repeat: no-repeat;
    background-position: center;
    background-size: 256px 128px;
    /* "Space loading..." indicator. */
    background-image: url("data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyNTYgMTI4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjx0ZXh0IHg9IjEyOC4xMDQxOSIgeT0iMTA4LjQ1NzAyIiBmaWxsPSIjZmZmZmZmIiBmb250LWZhbWlseT0ic2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNnB4IiB0ZXh0LWFsaWduPSJjZW50ZXIiIHRleHQtYW5jaG9yPSJtaWRkbGUiPjx0c3BhbiB4PSIxMjguMTA0MTkiIHk9IjEwOC40NTcwMiIgZmlsbD0iI2ZmZmZmZiIgZm9udC1mYW1pbHk9InNhbnMiPkxvYWRpbmcgc3BhY2UuLi48L3RzcGFuPjwvdGV4dD48cGF0aCBkPSJtMTI4IDE2YTMyIDMyIDAgMCAwLTMyIDMyIDMyIDMyIDAgMCAwIDMyIDMyIDMyIDMyIDAgMCAwIDMyLTMyaC04YTI0IDI0IDAgMCAxLTI0IDI0IDI0IDI0IDAgMCAxLTI0LTI0IDI0IDI0IDAgMCAxIDI0LTI0eiIgZmlsbD0iI2ZmZmZmZiI+PGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiBkdXI9IjVzIiBmcm9tPSIwIDEyOCA0OCIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIHRvPSIzNjAgMTI4IDQ4IiB0eXBlPSJyb3RhdGUiLz48L3BhdGg+PC9zdmc+IA==");
    transition: ease-in-out 0.2s filter;
}

#pane-world:not(:focus) {
    /* outline: none; */
    filter: grayscale(80%);
}

.map-background,
.map-foreground {
    background-position: 0 0;
    background-repeat: no-repeat;
}

#pane-world .map-container,
#pane-world .map-container > * {
    position: absolute;
    /* height: 100%; */
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    pointer-events: none;
}

.map-avatars .avatar,
.map-gadgets .gadget {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    pointer-events: all;
}

.map-avatars .avatar:hover,
.map-gadgets .gadget:hover,
.map-avatars .selected,
.map-gadgets .selected {
    filter: drop-shadow(0 0 8px #ffff00);
    z-index: 100;
}

/* .map-avatars, */
.map-avatars .avatar,
.map-gadgets .gadget {
    transition:
        left var(--movement-transition) ease-in-out,
        top var(--movement-transition) ease-in-out;
    -moz-transition:
        left var(--movement-transition) ease-in-out,
        top var(--movement-transition) ease-in-out,
        zoom var(--zoom-transition) ease-out;
}

.map-avatars .avatar-nametag {
    /* top: -3em; */
    bottom: 3em;
    position: absolute;
    color: #ffffff;
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.75);
    padding: 0.3em 0.5em;
    border-radius: 0.5em;
    font-size: 0.75em;
    z-index: 100;
    white-space: nowrap;
    text-align: center;
    font-family: sans-serif;
}

.avatar-nametag .avatar-pronouns {
    font-size: 75%;
    color: #cccccc;
}

.map-container {
    /*
     * Guess what! The 'zoom' property is officially not animatable. Chrome
     * will mess up if animating 'zoom' is attempted. But Firefox messes up,
     * if it doesn't attempt it. Good job, guys. Anyway, using 'transform:
     * scale()' would work, but that will introduce anchoring problems and we
     * won't get into that now.
     */
    transition:
        left var(--movement-transition) ease-in-out,
        top var(--movement-transition) ease-in-out;
    -moz-transition:
        left var(--movement-transition) ease-in-out,
        top var(--movement-transition) ease-in-out,
        zoom var(--zoom-transition) ease-out;
}

/* .map-background, .map-foreground { */
/*     transition: background-position 0.2s; */
/* } */

.avatar-self {
    z-index: 10;
}

#pane-world .map-controls {
    position: absolute;
    width: 100px;
    height: 100px;
    right: 1em;
    bottom: 1em;
    display: none;
    rotate: 45deg;
}

#pane-world:focus .map-controls-show {
    display: block;
}

.map-controls > * {
    position: absolute;
    width: 44px;
    height: 44px;
    background-color: #cccccc;
    border: 2px solid #444444;
    line-height: 44px;
    font-size: 30px;
    color: #444444;
    vertical-align: middle;
    font-family: sans-serif;
    /* cursor: pointer; */
    user-select: none;
    opacity: 0.5;
    text-align: center;
    pointer-events: none;
}

.map-controls .map-control-left {
    bottom: 0;
    left: 0;
    border-radius: 25% 25% 25% 50%;
}

.map-controls .map-control-right {
    top: 0;
    right: 0;
    border-radius: 25% 50% 25% 25%;
}

.map-controls .map-control-up {
    top: 0;
    left: 0;
    border-radius: 50% 25% 25% 25%;
}

.map-controls .map-control-down {
    bottom: 0;
    right: 0;
    border-radius: 25% 25% 50% 25%;
}


.map-drag-drop-finder {
    display: none;
    outline: 0.5vw solid #ff0000;
    position: relative;
}


#pane-components {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 4px;
    box-sizing: border-box;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    column-gap: .3em;
}

.tab {
    padding: 0.5em 1em 0.5em;
    color: #555555;
    background-color: #aaaaaa;
    /* border: 0 solid #444444; */
    border-width: 1px 1px 1px 0;
    /* margin: 0 0.2em; */
    border-radius: 0.5em 0.5em 0 0;
    cursor: pointer;
    order: 100;
    font-family: sans;
}

.tab.tab-active {
    color: #000000;
    background-color: #ffffff;
    cursor: auto;
}

.tab-spacer {
    flex-grow: 1;
    order: 200;
}

.tab-right {
    order: 300;
    /* Tabs on the right are currently only system tabs with emoji titles. */
    /* A little bit of shadow makes them easier to read on gray background. */
    text-shadow: #000000 0 0 0.25em;
}

.tab-contents {
    background-color: #ffffff;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tab-content {
    display: none;
    flex-grow: 1;
    overflow-y: auto;
    /* delay display of loading info */
    transition: background-size 0s step-end 1.5s;
    background-size: 0 0;
}

.tab-content.tab-active {
    display: block;
}

.tab-highlight {
    background-color: #ffff7f;
}

.tab-gadget {
    background-repeat: no-repeat;
    background-position: 0.75em center;
    background-size: 1.5em;
    padding-left: 2.75em;
}

.text-read-only {
    padding: 1.5em 2.5em;
}


#builder-gadget-types {
    padding-left: 0;
}

#builder-gadget-types .gadget-type {
    background-color: #ccf;
    list-style: none;
    margin: 0.5em 0;
}

#builder-gadget-types .gadget-type details {
    padding: 0 0.5em;
}

#builder-gadget-types .gadget-type details[open] {
    padding-bottom: 1em;
}

#builder-gadget-types .gadget-type details > summary {
    padding: 0.5em 0;
}

#builder-gadget-types .gadget-type-icon {
    cursor: pointer;
    background-color: #fff;
    border: 4px outset #ccc;
    border-radius: 0.75em;
    max-width: 64px;
    max-height: 64px;
    margin: 0 auto;
    padding: 0.5em;
}

#builder-gadget-types .gadget-type-icon img {
    width: 100%;
}

.gadget-view-actions {
    display: flex;
    column-gap: 0.5em;
}

.gadget-view-actions button {
    padding: 0.5em 1.0em;
}



h1, h2, h3, h4, h5, h6 {
    font-family: sans;
}

h2 {
    border-top: 1px dashed gray;
    padding-top: 1em;
    margin-top: 1em;
}

iframe {
    border-width: 0;
    display: block;
}


.notification {
    margin: 0.5em 0;
    padding: 0.5em 1em;
    padding-left: 4em;
    color: #444444;
    border: 1px solid #888888;
    background-color: #eeeeee;
    overflow: scroll;
    position: relative;
}

.notification:before {
    /* content: "✔️"; */
    position: absolute;
    left: 0.75em;
    top: 1em;
    font-size: 1.5em;
}

.notification details {
    margin: 16px 0;
}

.notification details summary {
    text-decoration: underline;
    list-style: disclosure-closed;
    cursor: pointer;
    margin-left: 1em;
}

.notification details[open] summary {
    list-style: disclosure-open;
}

.notification-info {
    /* default to above */
}

.notification-error {
    color: #662222;
    border: 1px solid #aa6666;
    background-color: #ffdddd;
    /* TODO nice svg things */
    /* background-image: ...; */    
}

.notification-warning:before {
    content: "❌️";
}

.notification-warning {
    color: #666622;
    border: 1px solid #aaaa66;
    background-color: #ffffdd;
    /* TODO nice svg things */
    /* background-image: ...; */    
}

.notification-warning:before {
    content: "⚠️";
}

.notification-copy {
    float: right;
}

.loading-gadget {
    background-repeat: no-repeat;
    background-position: center;
    background-size: 256px 128px;
    background-image: url("loading-gadget.svg");
}

.attention {
    border: 1px solid #660;
    color: #660;
    background-color: #ffc;
    padding: 1em;
}



/* JSON Editor styling */

.je-ready {
    font-family: sans;
}

.je-ready [data-schemapath="root"] > .je-header {
    font-size: 2em;
    font-weight: bold;
    margin-block: 0.67em;
}

.je-ready .je-header {
    /* font-size: 1.25em; */
    /* font-weight: bold; */
    /* padding: 1.5em 0; */
  display: block;
  font-size: 1.5em;
  font-weight: bold;
  margin-block: 0.83em;
}

.je-ready .je-indented-panel {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
}

/* Container for one set of label, input element, spacer, description. */
.je-ready .form-control {
    /* display: inline-block; */
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.je-ready .form-control > div {
    display: none;
}

/* Workaround some hardcoded weirdness. */
.je-ready div[data-schematype="boolean"] .form-control {
    width: 100%;
    display: flex !important;
    justify-content: unset;
}
.je-ready div[data-schematype="boolean"] .form-control label {
    /* width: 100%; */
    /* display: flex; */
    /* flex-direction: row-reverse; */
    /* justify-content: space-between; */
    padding-right: 1em;
    width: 33.333%;
    box-sizing: border-box;
    flex-basis: unset;
    flex-grow: unset;
}
.je-ready div[data-schematype="boolean"] .form-control input {
    flex-grow: unset;
    zoom: 1.5;
    flex-basis: unset;
    flex-grow: unset;
}

.je-ready .form-control > label {
    display: inline-block;
    /* TODO add proper value */
    /* min-width: 12em; */
    flex-basis: 25%;
    flex-grow: 1;
}

.je-ready .form-control input,
.je-ready .form-control select {
    flex-grow: 1;
    /* max-width: 50%; */
    box-sizing: border-box;
    padding: 0.5em 0.5em;
    flex-basis: 25%;
    flex-grow: 4;
}

.je-ready .form-control > p[id$="-description"] {
    font-size: 0.8em;
    color: #444;
    margin: 1em 0 2em;
    width: 100%;
}

.je-ready .row {
    /* margin-bottom: 1.5em; */
}

/* TODO proper access to that button */
.je-ready + div button {
    padding: 0.5em 1.0em;
    margin: 1em;
    font-size: 1.125em;
}

.je-ready .je-object__controls {
    margin: 0;
}

.je-ready .row .je-object__container {
  border-top: 1px dashed gray;
  margin-top: 2.0em;
  padding-top: 1.0em;
}

.je-ready > .je-object__container {
  border-bottom: 1px dashed gray;
  margin-bottom: 1.5em;
  padding-bottom: 1.5em;
}

.je-ready label.required::after {
  content: " *";
  color: #ff0000;
}

.je-ready label.required ~ p::before {
  content: "Required. ";
}
