:root {
    --accent: #3F51B5;
    --text-1: #000;
    --text-2: #666;
    --text-3: #999;
    --border: #DDD;
    --background: #F8F8F8;
    --preview-background: #FFF;
    --input-range-line: #B9B9B9;
    --input-background: #FFF;
    --input-border: rgba(0, 0, 0, .1);
    --input-background-disabled: rgba(0, 0, 0, .1);
    --checkbox-background: rgba(0, 0, 0, .15);
    --select-background: rgba(0, 0, 0, .15);
    --switch-background: #B9B9B9;
    --switch-thumb: #FFF;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text-1: #FFF;
        --text-2: #999;
        --text-3: #666;
        --border: #333;
        --background: #212121;
        --preview-background: #121212;
        --input-range-line: #454545;
        --input-background: #121212;
        --input-border: rgba(255, 255, 255, .1);
        --input-background-disabled: rgba(255, 255, 255, .1);
        --checkbox-background: rgba(255, 255, 255, .15);
        --select-background: rgba(255, 255, 255, .15);
        --switch-background: #454545;
        --switch-thumb: #FFF;
    }
}

html {
    box-sizing: border-box;
    background: transparent;
    overflow: hidden;
    cursor: default;
}
*, *:before, *:after {
    box-sizing: inherit;
    margin: 0;
    padding: 0;
    position: relative;
    -webkit-user-select: none;
    user-select: none;
}
input, textarea, code, pre code * {
    -webkit-user-select: auto;
    user-select: auto;
}

html, body {
    height: 100%;
    color: var(--text-1);
    background: var(--background);
}
body {
    font: medium Roboto, Helvetica, Arial, sans-serif;
}
pre code {
    display: block;
    font: 12px/1.6 Monaco, Consolas, monospace;
    padding: 16px;
}

pre *::selection {
    background-color: rgba(60, 80, 180, .2);
}

button {
    display: inline-block;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    border: 0;
    border-radius: 4px;
    height: 36px;
    line-height: 36px;
    margin: 0;
    padding: 0 16px;
    vertical-align: middle;
    outline: none;
    cursor: pointer;
    color: var(--text-1);
    background: none;
    transition: background-color .2s cubic-bezier(.4,0,.2,1);
}
button:hover {
    background: rgba(158, 158, 158, 0.2);
}
button:active{
    background: rgba(158, 158, 158, 0.4);
}
button.button-blue {
    background: var(--accent);
    color: #FFF;
}
button.button-blue:hover {
    background: #3949AB;
}
button.button-blue:active {
    background: #283593;
}

input[type="range"] {
    width: 160px;
    height: 2px;
    padding: 0;
    border: 0;
    -webkit-appearance: none;
    background-color: var(--input-range-line);
    background-image: linear-gradient(var(--accent), var(--accent));
    background-repeat: no-repeat;
    background-size: 0 100%;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 12px;
    width: 12px;
    border-radius: 12px;
    background: var(--accent);
    transition: all .1s cubic-bezier(.4,0,.2,1);
}
input[type=range]:active::-webkit-slider-thumb {
    transform: scale(1.333);
}
input[type=range]:focus {
    outline: none;
}

input[type=checkbox] {
    -webkit-appearance: none;
    background: var(--checkbox-background);
    height: 16px;
    width: 16px;
    border-radius: 4px;
    vertical-align: -2px;
    margin-right: 4px;
    box-shadow: 0 0 1px #FFF;
}
input[type=checkbox]:checked {
    background-color: var(--accent);
    background-position: 50% 50%;
    background-repeat: no-repeat;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16px' height='16px' viewBox='0 0 16 16'%3E%3Cpath stroke='%23FFF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none' d='M4 8 7 11 12 5'/%3E%3C/svg%3E");
}
input[type=text], input[type="number"] {
    background-color: var(--input-background);
    outline: none;
    padding: 0 8px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--input-border);
}
input[type=text]:disabled, input[type="number"]:disabled {
    background: var(--input-background-disabled);
}
input[type=text]:focus, input[type="number"]:focus {
    border-color: var(--accent);
}
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.text-input {
    position: relative;
}
.text-input-prefix input[type="text"], .text-input-prefix input[type="number"] {
    padding-left: 16px;
}
.text-input-prefix:before {
    content: "#";
    position: absolute;
    top: 50%;
    left: 8px;
    z-index: 1;
    font-size: 12px;
    color: var(--text-3);
    transform: translateY(-50%);
}
.text-input-suffix input[type="text"], .text-input-suffix input[type="number"] {
    padding-right: 16px;
}
.text-input-suffix:after {
    content: "%";
    position: absolute;
    top: 50%;
    right: 8px;
    z-index: 1;
    font-size: 12px;
    color: var(--text-3);
    transform: translateY(-50%);
}

input[type="text"]:invalid {
    border-color: #DD1144;
}

select {
    -webkit-appearance: none;
    font-size: 14px;
    padding: 0 24px 0 8px;
    height: 24px;
    outline: none;
    border: 0;
    border-radius: 5px;
    color: inherit;
    background-color: var(--select-background);
    background-position: calc(100% - 3px) 50%;
    background-repeat: no-repeat;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18px' height='18px' viewBox='0 0 18 18'%3E%3Crect width='18' height='18' rx='3' fill='%233F51B5'/%3E%3Cpath stroke='%23FFF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none' d='M6 6.5 9 4 12 6.5 M6 11.5 9 14 12 11.5'/%3E%3C/svg%3E");
}

.switch {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 16px;
    vertical-align: -4px;
}
.switch input {
    display: none;
}
.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    width: 28px;
    height: 16px;
    border-radius: 8px;
    background-color: var(--switch-background);
    transition: .4s;
}
.switch .slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    top: 2px;
    left: 2px;
    border-radius: 10px;
    background-color: var(--switch-thumb);
    transition: .4s;
}
.switch input:checked + .slider {
    background-color: #9DA6D8;
}
.switch input:checked + .slider:before {
    background-color: var(--accent);
    transform: translateX(12px);
}

#main {
    height: 100%;
}
#main, #preview, #preview pre {
    display: flex;
    flex-direction: column;
}
#preview, #preview pre {
    flex: auto;
    background: var(--preview-background);
    white-space: break-spaces;
    word-break: break-all;
}
#foot-actions {
    padding: 8px;
    align-items: center;
    display: flex;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.gap {
    display: block;
    width: 8px;
}
.gap-flex {
    flex: auto;
}

#preview {
    position: relative;
    overflow: auto;
    transition: background .2s;
}
#background_toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
}
#background_toggle li {
    float: left;
    margin-left: 12px;
    list-style: none;
}
#background_toggle a {
    display: block;
    width: 20px;
    height: 20px;
    border-radius: 12px;
    border: 2px solid #FFF;
    overflow: hidden;
    background: var(--background);
    box-shadow: 0 2px 3px rgba(0,0,0,.3), inset 0 2px 3px rgba(0,0,0,.3);
}
#background_toggle #bg_toggle_light, #preview.bg_light {
    background: #FFF url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTBweCIgaGVpZ2h0PSIxMHB4IiB2aWV3Qm94PSIwIDAgMTAgMTAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ2LjEgKDQ0NDYzKSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5Hcm91cDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGZpbGw9IiNFM0UzRTMiPgogICAgICAgICAgICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNSIgaGVpZ2h0PSI1Ij48L3JlY3Q+CiAgICAgICAgICAgIDxyZWN0IHg9IjUiIHk9IjUiIHdpZHRoPSI1IiBoZWlnaHQ9IjUiPjwvcmVjdD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg==") repeat;
}
#background_toggle #bg_toggle_dark, #preview.bg_dark {
    background: #2B2B2B url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTBweCIgaGVpZ2h0PSIxMHB4IiB2aWV3Qm94PSIwIDAgMTAgMTAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ2LjEgKDQ0NDYzKSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5Hcm91cDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGZpbGw9IiMwMDAwMDAiPgogICAgICAgICAgICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNSIgaGVpZ2h0PSI1Ij48L3JlY3Q+CiAgICAgICAgICAgIDxyZWN0IHg9IjUiIHk9IjUiIHdpZHRoPSI1IiBoZWlnaHQ9IjUiPjwvcmVjdD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg==") repeat;
}

#nine_patch_preview {
    position: absolute;
    width: 100px;
    height: 100px;
    top: 50%;
    left: 50%;
    box-sizing: border-box;
}
#controller {
    font-size: 14px;
    box-sizing: border-box;
    padding: 8px 16px;
    align-items: center;
    display: flex;
    border-top: 1px solid var(--border);
}
#controller label {
    margin-right: 8px;
}
#controller input[type="range"] {
    margin-right: 16px;
}
#controller + #foot-actions {
    border: 0;
}

#preferences {
    flex-grow: 1;
    padding: 16px;
    font-size: 14px;
    overflow: auto;
}
.from-row {
    margin-bottom: 24px;
}
.from-row .from-label {
    display: block;
    color: var(--text-2);
    margin-bottom: 8px;
    font-size: 12px;
    text-transform: uppercase;
}
.grid-list {
    display: grid;
    grid-gap: 8px;
    grid-template-columns: 1fr 1fr 1fr;
}
.flex-from {
    display: flex;
    gap: 8px;
    align-items: center;
}
.logo {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 16px 0 32px 0;
    color: var(--text-3);
}
.logo img {
    display: block;
    margin-bottom: 8px;
}

.asset-thumbs {
    padding: 16px;
    flex-wrap: wrap;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 8px;
}
.asset-thumbs .item {
    position: relative;
    width: 88px;
}
.asset-thumbs img {
    display: block;
    width: 88px;
    height: 88px;
    margin-bottom: 6px;
    border-radius: 4px;
    background: var(--background);
    object-fit: scale-down;
}
.asset-thumbs .name {
    font-size: 12px;
}
.asset-thumbs .name span {
    display: inline-block;
    padding: 2px 4px;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    border-radius: 4px;
}
.asset-thumbs input[type="checkbox"] {
    position: absolute;
    z-index: 1;
    top: 4px;
    left: 4px;
}
.asset-thumbs input:checked + img {
    background: rgba(63, 81, 181, 0.1);
}
.asset-thumbs input:checked + img + .name span {
    background: var(--accent);
    color: #FFFFFF;
}

.code-tab {
    position: absolute;
    z-index: 1;
    top: 8px;
    right: 8px;
    font-size: 12px;
    display: flex;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--background);
}
.code-tab label {
    padding: 4px 8px;
}
.code-tab label + label {
    border-left: 1px solid var(--border);
}
.code-tab input {
    display: none;
}
.code-tab input:checked + span {
    color: var(--accent);
}

/* github.com style (c) Vasily Polovnyov <vast@whiteants.net> */
.hljs{display:block;overflow-x:auto;color:#333;}
.hljs-comment,.hljs-quote{color:#999;font-style:italic}
.hljs-keyword,.hljs-selector-tag,.hljs-subst{color:#333;font-weight:700}
.hljs-number,.hljs-literal,.hljs-variable,.hljs-template-variable,.hljs-tag .hljs-attr{color:#094}
.hljs-string,.hljs-doctag{color:#d14}
.hljs-title,.hljs-section,.hljs-selector-id{color:#900;font-weight:500}
.hljs-type,.hljs-class .hljs-title{color:#458;font-weight:500}
.hljs-tag,.hljs-name,.hljs-attribute{color:#03F;}
.hljs-regexp,.hljs-link{color:#093}
.hljs-symbol,.hljs-bullet{color:#907}
.hljs-built_in,.hljs-builtin-name{color:#08A}
.hljs-meta{color:#999;font-weight:500}
.hljs-deletion{background:#fdd}
.hljs-addition{background:#dfd}
.hljs-emphasis{font-style:italic}
.hljs-strong{font-weight:500}

@media (prefers-color-scheme: dark) {
    .hljs{color:#EEE}
    .hljs-comment,.hljs-quote{color:#666}
    .hljs-keyword,.hljs-selector-tag,.hljs-subst{color:#EEE}
    .hljs-number,.hljs-literal,.hljs-variable,.hljs-template-variable,.hljs-tag .hljs-attr{color:#0CC}
    .hljs-string,.hljs-doctag{color:#E57}
    .hljs-title,.hljs-section,.hljs-selector-id{color:#E44}
    .hljs-type,.hljs-class .hljs-title{color:#57E}
    .hljs-tag,.hljs-name,.hljs-attribute{color:#44F}
    .hljs-regexp,.hljs-link{color:#3E6}
    .hljs-symbol,.hljs-bullet{color:#F3B}
    .hljs-built_in,.hljs-builtin-name{color:#3CF}
    .hljs-meta{color:#666}
    .hljs-deletion{background:#766}
    .hljs-addition{background:#8B8}
}