:root {
    --format-width: 60pt;
    --line-format-color: #8886;
    --line-format-background: transparent;
    --inline-format-color: #8886;

    --current-section-color: transparent;
    --current-item-color: transparent;
    --current-line-color: #057EAE22;
    --current-inline-part-color: var(--background);

    --selection-section-color: transparent;
    --selection-item-color: transparent;
    --selection-line-color: #057EAE11;
    --selection-inline-part-color: transparent;

    --text-font: 'OpenSans';
    --text-color: unset;
    --link-color: #057EAE;
    --background: unset;

    --heading-border-color: #8883;
    --quote-border-color: #8889;
    --code-font: 'Courier New', Courier, monospace;
    --code-color: unset;
    --code-border-color: #8882;
    --code-background-color: #8881;
    --hr-color: #8883;
}
@media (prefers-color-scheme: light) {
    :root {
        --text-color: black;
        --code-color: black;
        --background: white;
    }
}
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #EEE;
        --code-color: #EEE;
        --background: #111;
    }
}


@font-face {
    font-family: 'OpenSans';
    src: url('../font/OpenSans-Light.woff') format('woff'), url('../font/OpenSans-Light.ttf') format('truetype');
}
@font-face {
    font-family: 'OpenSans';
    src: url('../font/OpenSans-Bold.woff') format('woff'), url('../font/OpenSans-Bold.ttf') format('truetype');
    font-weight: bold;
}


body {
    color: var(--text-color);
    background: var(--background);
    font-family: var(--text-font);
}
textarea:focus {
    outline: none;
}
.hidden {
    display: none !important;
}


#input, #display, #settings, #drag-drop-indicator {
    left: 0;
    top: 0;
}
#display {
    position: absolute;
    right: 0;
    min-height: 100%;
    padding-bottom: 50vh;
    box-sizing: border-box;
}
#settings, #drag-drop-indicator {
    position: fixed;
    right: 0;
    bottom: 0;
}
#input {
    position: fixed;
    opacity: 0;

    white-space: nowrap;
}


#display div, #display p , #display ul, #display ol, #display li {
    margin: 0;
    padding: 0;
}

#display {
    cursor: text;
}

#display span.left {
    display: inline-block;
    width: var(--format-width);
    padding-right: 5pt;
    box-sizing: border-box;
    color: var(--line-format-color);
    background: var(--line-format-background);
    text-align: right;
    visibility: hidden;
}
#display .current span.left {
    visibility: visible;
}
#display span.left:before {
    content: '';
    display: inline-block;
}
#display span.right {
    display: inline-block;
    box-sizing: border-box;
}
#display span.right {
    width: calc(100% - var(--format-width));
}
#display li > span.right {
    width: 100%;
}
#display span.right:after {
    content: '';
    display: inline-block;
    height: 1em;
}

#display .selection {
    background: var(--selection-section-color);
}
#display .selection .selection {
    background: var(--selection-item-color);
}
#display .selection .selection .selection,
#display .list.selection .selection .selection .left {
    background: var(--selection-line-color);
}
#display .selection .selection .selection .selection,
#display .list.selection .selection .selection .selection.left {
    background: var(--selection-inline-part-color);
}

#display .current {
    white-space: pre-wrap;
    background: var(--current-section-color);
}
#display .current .current {
    background: var(--current-item-color);
}
#display .current .current .current,
#display .list.current .current .current .left {
    background: var(--current-line-color);
}
#display .current .current .current .current,
#display .list.current .current .current .current.left {
    background: var(--current-inline-part-color);
}

#display .heading p:first-child .line {
    margin: 0;
    padding-bottom: 5pt;
}
#display .heading p:first-child .right {
    font-weight: bold;
    cursor: pointer;
}
#display .heading p:first-child .right span {
    cursor: text;
}
#display .h1 p:first-child .line {
    font-size: 200%;
    padding-top: 20pt;
    padding-bottom: 10pt;
}
#display .h2 p:first-child .line {
    font-size: 160%;
    padding-top: 15pt;
    padding-top: 10pt;
}
#display .h1 > p:first-child .left, #display .h1 > p:first-child .right,
#display .h2 > p:first-child .left, #display .h2 > p:first-child .right {
    border-bottom: 1px solid var(--heading-border-color);
}
#display .h3 p:first-child .line,
#display .h4 p:first-child .line,
#display .h5 p:first-child .line,
#display .h6 p:first-child .line {
    padding-top: 10pt;
}
#display .h3 p:first-child .line {
    font-size: 140%;
}
#display .h4 p:first-child .line {
    font-size: 130%;
}
#display .h5 p:first-child .line {
    font-size: 120%;
}
#display .h6 p:first-child .line {
    font-size: 110%;
}

#display .quote div p span.right {
    border-left: 1px solid var(--quote-border-color);
    padding-left: 15pt;
}

#display .math code {
    display: none;
}
#display .math code+div {
    padding-left: var(--format-width);
}
#display .math.current code+div {
    padding-left: 10pt;
}
#display .math.current code,
#display .math.current code+div {
    display: inline-block;
    width: 50%;
    max-width: 50%;
    box-sizing: border-box;
    vertical-align: middle;
}
#display .code code span.right,
#display .math code span.right {
    white-space: pre-wrap;
    border-left: 1px solid var(--code-border-color);
    border-right: 1px solid var(--code-border-color);
    padding: 0 5pt;
    color: var(--code-color);
    background: var(--code-background-color);
}
#display .code code p:first-child span.right,
#display .math code p:first-child span.right {
    font-family: var(--code-font);
    color: var(--inline-format-color);
}
#display .code code p:first-child span.right,
#display .code code p:last-child span.right,
#display .math code p:first-child span.right,
#display .math code p:last-child span.right {
    border: none;
    padding: 0;
    background: none;
}
#display .code code p:nth-child(2) span.right,
#display .math code p:nth-child(2) span.right {
    border-top: 1px solid var(--code-border-color);
    padding-top: 5pt;
}
#display .code code p:nth-last-child(2) span.right,
#display .math code p:nth-last-child(2) span.right {
    border-bottom: 1px solid var(--code-border-color);
    padding-bottom: 5pt;
}

#display .ul ul,
#display .ol ol {
    margin-left: calc(var(--format-width) + 12pt);
}
#display .ul li span.left,
#display .ol li span.left {
    position: absolute;
    left: 0;
    width: calc(var(--format-width) + 12pt);
    padding-right: calc(5pt + 12pt);
}
#display .ol li span.right,
#display .ul li span.right {
    width: 100%;
    padding-left: 5pt;
    vertical-align: top;
}

#display .hr div .line span.right::after {
    content: ' ';
    width: 100%;
    height: 0;
    vertical-align: middle;
    border-bottom: 1px solid var(--hr-color);
}


#display span.fmt {
    color: var(--inline-format-color);
    display: none;
}
#display .current span.fmt {
    display: inline;
}
#display span.bold {
    font-weight: bold;
}
#display span.italic {
    font-style: italic;
}
#display span.strike {
    text-decoration: line-through;
}
#display span.code, #display span.math {
    white-space: pre-wrap;
    font-family: monospace;
    border: 1px solid var(--code-border-color);
    padding: 2pt 5pt;
    color: var(--code-color);
    background: var(--code-background-color);
}
#display span.math {
    display: none;
}
#display .current span.math {
    display: inline;
}

#display .right a.link {
    color: var(--link-color);
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}
#display .right a.link:hover {
    text-decoration: underline;
}

#display .right img.img {
    max-width: 100%;
}


#display i.cursor {
    position: relative;
}
#display i.cursor::after {
    position: absolute;
    margin-left: -1pt;
    content: ' ';
    display: inline-block;
    height: 1em;
    bottom: 0;
    border-left: 2px solid var(--text-color);

    animation-name: cursor;
    animation-duration: 2s;
    animation-iteration-count: infinite;
}
@keyframes cursor {
    20% { opacity: 1; }
    50% { opacity: 0; }
    80% { opacity: 1; }
}


#start-info {
    position: relative;
    top: 50vh;
    transform: translateY(-50%);
    width: 100%;
    text-align: center;
    font-style: italic;
    cursor: text;
    display: flex;
    flex-direction: column;
}
#start-info h1 {
    color: #8881;
    font-size: 10vw;
    margin: 0;
}
#start-info #pwa-install {
    background: #057EAE;
    border: none;
    border-radius: 2pt;
    padding: 15pt;
    opacity: .2;
}
#start-info #pwa-install:hover {
    opacity: 1;
}


body.settings-visible {
    overflow-y: hidden;
}
#settings > div {
    max-height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    backdrop-filter: blur(4pt);
    padding: 5vh 10%;
}
@media only screen and (min-width: 768px) {
    #settings > div {
        padding: 10vh 10%;
    }
}

#settings::before {
    content: '';
    background-color: var(--background);
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    opacity: .85;
    z-index: -1;
}
#settings h2 {
    text-align: center;
    font-size: 200%;
    color: gray;
}
#settings #custom-styles {
    margin-bottom: 10pt;
    text-align: center;
}
#settings #custom-styles input {
    display: none;
}
#settings #custom-styles input+label {
    padding: 5px 10px;
    background: #8881;
}
#settings #custom-styles input+label:hover {
    background: #8883;
}
#settings #custom-styles input:checked+label {
    border: 1px solid #8886;
}
#settings #list {
    padding: 20pt;
    background: var(--background);
    border: 1px solid #8883;
    box-shadow: 3pt 3pt 10pt #8886;
}
#settings #list [id^="settings-info"] {
    color: #888;
    text-align: center;
    margin-bottom: 20pt;
}
#settings #list .row {
    margin: 5pt 0;
    text-align: center;
}
#settings #list .row:hover {
    background: #8881;
}
#settings #list .label {
    text-align: left;
}
#settings #list .label,
#settings #list .preview {
    display: inline-block;
}
#settings #list .label,
#settings #list .value {
    min-width: 200pt;
    width: 40%;
    max-width: 400pt;
}
#settings #list .preview {
    width: 10pt;
    height: 10pt;
    border: 1px solid #8881;
    border-radius: 5pt;
}
#settings #list .value {
    color: var(--text-color);
    background: var(--background);
    border: 1px solid #8883;
    padding: 5pt 10pt;
}
#settings #list .value:focus{
    outline: none;
    border-color: #8886;
}
#settings #list .value.own-default::placeholder {
    color: #888B;
}
#settings #list .value.general-custom::placeholder {
    color: #8887;
}
#settings #list .value.general-default::placeholder {
    color: #8883;
}

#controls-info {
    margin-top: 20pt;
}
#controls-info p {
    margin: 5pt 0 0;
    display: inline-block;
    min-width: 51%;
}
#controls-info p.more {
    margin-top: 0;
}
#controls-info p span:first-child {
    display: inline-block;
    width: 70pt;
    font-weight: bold;
    vertical-align: top;
}
#controls-info p span:last-child {
    display: inline-block;
    width: calc(100% - 70pt);
}

#settings #about {
    color: #8886;
    float: right;
    text-align: right;
    margin-top: 30pt;
}
@media only screen and (min-width: 768px) {
    #settings #about {
        margin-top: 0;
        transform: translateY(-100%);
    }
}
#settings #about a {
    text-decoration: none;
    color: #8886;
    font-weight: bold;
}

#settings > div::after {
    clear: both;
    content: '';
    display: block;
}


#drag-drop-indicator {
    backdrop-filter: blur(4pt);
    padding: 10%;
}
#drag-drop-indicator > div {
    height: 100%;
    box-sizing: border-box;

    border: 5pt dashed #8883;
    border-radius: 20pt;

    position: relative;
}
#drag-drop-indicator div div {
    position: absolute;
    top: 50%;
    width: 100%;
    text-align: center;

    font-size: 5vw;
    font-weight: bold;
    color: #8886;
}

#update-notification {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: right;
    padding: 10pt 20pt;
    font-style: italic;
}
#update-notification::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: #8882;
    backdrop-filter: blur(3px);
    z-index: -1;
}
