html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    outline: none;
    box-shadow: none;
    font-family: inherit;
}

#main-body {
    flex-basis: 100%;
}

#editor-container {
    flex: 1 1 auto;
    flex-basis: calc(50% - 54px);
    min-height: 0;
}

#viewport-frame {
    flex-basis: 50%;
}

#editor-wrapper,
#viewport-frame {
    overflow: hidden;
    scroll-margin-top: 100vh;
}


#scratch {
  opacity: 0;
  z-index: -1;
  position: absolute;
}

#viewport-frame {
    /*position: absolute;*/
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    overflow: hidden;
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24em;
    z-index: 1;
    display: flex;
    /* padding-top:22px; */
    flex-direction: row;
    perspective: 1000px;
}

#viewport-frame canvas {
    background-color: rgba(0, 0, 0, 0.0);
    width: 0;
    height: 100%;
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: auto;
    display: inline-block;
}


#viewport-frame:focus {
    outline: none;
}

.done-loading #viewport-frame canvas {
    background-color: rgba(0, 0, 0, 1.0);
}

#viewport-frame:-moz-full-screen,
#viewport-frame canvas:-moz-full-screen {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    width: 100%;
    height: 100%;
}

#viewport-frame:-webkit-full-screen,
#viewport-frame canvas:-webkit-full-screen {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    width: 100%;
    height: 100%;
}

#editor {
    flex: 1 1 auto;
    flex-basis: 100%;
    min-height: 0;
}

.panel-row {
    display: flex;
    flex-direction: row;
}

.panel-column {
    display: flex;
    flex-direction: column;
}

*[id] {
    scroll-margin-top: 100vh;
}

#assetlist,
#gamelist,
#database,
#searchlist,
#filelist {
    overflow: scroll;
    flex-basis: 300px;
}


.treejs .treejs-node {
    white-space: nowrap;
    overflow: visible;
}

.treejs .treejs-node__close>.treejs-nodes {
    overflow: hidden;
}

#main {
    height: 100vh;
    max-height: calc(100vh);
    overflow: hidden;
}

#main>* {
    flex-shrink: 1;
    flex-grow: 1;
    min-height: 0;
}

#statusbar>* {
    flex-basis: 50%;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    /* The number of lines to show before the ellipsis */
    overflow: hidden;
}

#statusbar {
    display: flex;
    flex-direction: row;
    justify-content: stretch;
    overflow: hidden;
    white-space: nowrap;
}


#tabs {
    width: 54px;
}


#statusbar,
#toolbar {
    flex-shrink: 0;
    max-width: 100%;
}

#terminal {
    flex: 1 1 auto;
    flex-basis: 400px;
    min-height: 0;
}

.treejs-label {
    align-items: center;
}

#assetlist .treejs>.treejs-nodes,
#gamelist .treejs>.treejs-nodes,
#database .treejs>.treejs-nodes,
#searchlist .treejs>.treejs-nodes,
#filelist .treejs>.treejs-nodes {
    padding: 10px;
    margin: 0;
    overflow: visible;
    max-width: none;
}

.treejs-label::before {
    font-family: 'boxicons' !important;
    content: "\f413";
    /* Boxicons 'file' code */
    color: #555;
    position: relative;
    top: 3px;
    padding-right: 4px;
}

input,
select,
button {
    border: 2px solid #666;
    background: white;
    padding: 3px 5px;
    margin: 0;
}



#statusbar {
    background-color: #666;
}



#toolbar input,
#toolbar select,
#toolbar button {
    margin: 3px 5px;
}


.treejs-node__checked {
    background: #ccc;
}

#tabs ul {
    display: flex;
    flex-direction: column;
}

#toolbar ul {
    display: flex;
    flex-direction: row;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: end;
}

#toolbar ul>*:has(select) {
    min-width: 100px;
}

#toolbar ul>* {
    flex-shrink: 1;
    min-width: 0;
    flex-basis: 32px;
    flex-grow: 1;
    max-width: min-content;
}

#toolbar input,
#toolbar select,
#toolbar button {
    overflow: hidden;
    min-width: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: stretch;
}


#toolbar ul,
#toolbar li,
#tabs ul,
#tabs li {
    list-style: none;
    margin: 0;
    padding: 0;
}

#toolbar a {
    text-decoration: none;
    color: #666;
    padding: 3px 5px;
    font-size: 24px;
}

#tabs a {
    text-decoration: none;
    color: #666;
    padding: 5px 10px;
    font-size: 32px;
    border-left: 2px solid transparent;
}


#tabs a.active,
#toolbar a.active,
#tabs a:active,
#toolbar a:active,
#tabs a:hover,
#toolbar a:hover {
    background: rgba(0, 0, 0, .1)
}


#tabs a.active,
#toolbar a.active,
#tabs a:active,
#toolbar a:active {
    border-left-color: #333;
}

#database .treejs .treejs-checkbox,
#assetlist .treejs .treejs-checkbox,
#gamelist .treejs .treejs-checkbox,
#searchlist .treejs .treejs-checkbox,
#filelist .treejs .treejs-checkbox {
    display: none;
}

#database .treejs .treejs-node,
#assetlist .treejs .treejs-node,
#gamelist .treejs .treejs-node,
#searchlist .treejs .treejs-node,
#filelist .treejs .treejs-node {
    overflow: visible;
    max-width: none;
}

/* Folder Icon (When node has children) */
.treejs-node__close[data-extension="folder"]>.treejs-label::before {
    content: "\f440";
    /* Boxicons 'folder' code */
    color: #f1c40f;
}

.treejs-node__open[data-extension="folder"]>.treejs-label::before {
    content: "\f439";
    /* Boxicons 'folder' code */
    color: #f1c40f;
}

.treejs .treejs-node__open>.treejs-nodes {
    overflow: visible;
    max-width: none;
}

/*
.treejs-node[data-extension="js"] .treejs-label::before {
   content: "\ea71";
   color: #f7df1e;
}
*/

#editor {
    height: 100%;
    flex-basis: 100%;
}

[alt],
[data-tooltip] {
    position: relative;
    cursor: pointer;
}

#toolbar [alt]::after,
#toolbar [data-tooltip]::after {
    top: 100%;
    bottom: auto;
}

[alt]::after,
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 50%;
    /*left: max(10px, 50%);
    transform: translateX(-50%); */
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    font-size: 16px;
    z-index: 9999;
}

[alt]::after {
    content: attr(alt);
}

[alt]:hover::after,
[data-tooltip]:hover::after {
    opacity: 1;
}

#gh-token-input {
    width: 100%;
    box-sizing: border-box;
    /* Prevent the input from collapsing below a usable size */
    min-width: 200px;
}

#gh-token-input::placeholder {
    color: #888;
    font-style: italic;
}

#gh-token-input.has-token::placeholder {
    color: #4CAF50;
    /* Greenish to indicate "Success/Set" */
}

#token-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    /* Dim the rest of the UI */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    /* Stay above xterm and everything else */
    backdrop-filter: blur(4px);
    /* Modern touch */
}

/* The actual box */
.modal-content {
    background: #1e1e1e;
    color: #e0e0e0;
    border: 1px solid #333;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 400px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.modal-content h3 {
    margin-top: 0;
    color: #fff;
    border-bottom: 2px solid #333;
    padding-bottom: 0.5rem;
}

.modal-content p {
    color: #aaa;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

#token-modal.hidden {
    display: none;
}