/* customized */
/* MVP.css v1.14 - https://github.com/andybrewer/mvp */

:root {
    --active-brightness: 0.85;
    --border-radius: 5px;
    --box-shadow: 2px 2px 10px;
    --color-accent: #118bee15;
    --color-bg: #fff;
    --color-bg-secondary: #e9e9e9;
    --color-bg-transparent: rgba(0,0,0,.2);
    --color-link: #118bee;
    --color-secondary: #920de9;
    --color-secondary-accent: #920de90b;
    --color-shadow: #f4f4f4;
    --color-table: #118bee;
    --color-text: #000;
    --color-text-secondary: #999;
    --font-family: monospace;
    --hover-brightness: 1.2;
    --justify-important: center;
    --justify-normal: left;
    --line-height: 1.5;
    --width-card: 285px;
    --width-card-medium: 460px;
    --width-card-wide: 800px;
    --width-content: 1080px;
}

/*todo: temporary turned off light/dark scheme changing*/
/*@media (prefers-color-scheme: dark) {*/
    :root {
        --color-accent: #0097fc4f;
        --color-bg: #333;
        --color-bg-secondary: #555;
        --color-bg-transparent: rgba(250,250,250,.2);
        --color-link: #f0f0f0;
        --color-secondary: #a0a0a0;
        --color-secondary-accent: #a0a0a0f;
        --color-shadow: #bbbbbb20;
        --color-table: #0097fc;
        --color-text: #f7f7f7;
        --color-text-secondary: #aaa;
        --hover-brightness: 0.8;
    }
/*}*/

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Layout */
article aside {
    background: var(--color-secondary-accent);
    border-left: 4px solid var(--color-secondary);
    padding: 0.01rem 0.8rem;
}

body {
    position: absolute;
    box-sizing: border-box;
    width: 100%;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-family);
    line-height: var(--line-height);
    margin: 0;
    overflow-x: hidden;
    padding: 0;
}

footer,
header,
main {
    margin: 0 auto;
    max-width: var(--width-content);
    padding: 3rem 1rem;
}

hr {
    background-color: var(--color-bg-secondary);
    border: none;
    height: 1px;
    margin: 4rem 0;
    width: 100%;
}

section {
    display: flex;
    flex-wrap: wrap;
    justify-content: var(--justify-important);
}

section img,
article img {
    max-width: 100%;
}

section pre {
    overflow: auto;
}

section aside {
    border: 1px solid var(--color-bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow) var(--color-shadow);
    margin: 1rem;
    padding: 1.25rem;
    width: var(--width-card);
}

section aside:hover {
    box-shadow: var(--box-shadow) var(--color-bg-secondary);
}

[hidden] {
    display: none;
}

/* Headers */
article header,
div header,
main header {
    padding-top: 0;
}

header {
    text-align: var(--justify-important);
}

header a b,
header a em,
header a i,
header a strong {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
}

header nav img {
    margin: 1rem 0;
}

section header {
    padding-top: 0;
    width: 100%;
}

/* Nav */
nav {
    align-items: center;
    display: flex;
    font-weight: bold;
    justify-content: space-between;
    margin-bottom: 7rem;
}

nav ul {
    list-style: none;
    padding: 0;
}

nav ul li {
    display: inline-block;
    margin: 0 0.5rem;
    position: relative;
    text-align: left;
}

/* Nav Dropdown */
nav ul li:hover ul {
    display: block;
}

nav ul li ul {
    background: var(--color-bg);
    border: 1px solid var(--color-bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow) var(--color-shadow);
    display: none;
    height: auto;
    left: -2px;
    padding: .5rem 1rem;
    position: absolute;
    top: 1.7rem;
    white-space: nowrap;
    width: auto;
    z-index: 1;
}

nav ul li ul::before {
    /* fill gap above to make mousing over them easier */
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -0.5rem;
    height: 0.5rem;
}

nav ul li ul li,
nav ul li ul li a {
    display: block;
}

/* Typography */
code,
samp {
    background-color: var(--color-accent);
    border-radius: var(--border-radius);
    color: var(--color-text);
    display: inline-block;
    margin: 0 0.1rem;
    padding: 0 0.5rem;
}

details {
    margin: 1.3rem 0;
}

details summary {
    font-weight: bold;
    cursor: pointer;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: var(--line-height);
    text-wrap: balance;
}

mark {
    padding: 0.1rem;
}

ol li,
ul li {
    padding: 0.2rem 0;
}

p {
    margin: 0.75rem 0;
    padding: 0;
    width: 100%;
}

small {
    color: var(--color-text-secondary);
}

sup {
    background-color: var(--color-secondary);
    border-radius: var(--border-radius);
    color: var(--color-bg);
    font-size: xx-small;
    font-weight: bold;
    margin: 0.2rem;
    padding: 0.2rem 0.3rem;
    position: relative;
    top: -2px;
}

/* Links */
a {
    color: var(--color-link);
    display: inline-block;
    font-weight: bold;
    text-decoration: none;
}

a:active {
    filter: brightness(var(--active-brightness));
}

a:hover {
    filter: brightness(var(--hover-brightness));
}

span {
    cursor: default;
}

a b,
a em,
a i,
a strong,
button,
a.button,
input[type="submit"] {
    border-radius: var(--border-radius);
    display: inline-block;
    padding: 0.4rem 0.8rem;
}

button,
input,
select,
a.button {
    font-family: var(--font-family);
}

button:active,
a.button:active,
input[type="submit"]:active {
    filter: brightness(var(--active-brightness));
}

button:hover,
a.button:hover,
input[type="submit"]:hover {
    cursor: pointer;
    filter: brightness(var(--hover-brightness));
}

a b,
a strong,
button,
a.button,
input[type="submit"] {
    background-color: var(--color-link);
    border: 2px solid var(--color-link);
    color: var(--color-bg);
    font-weight: normal;
    line-height: normal;
}

a em,
a i {
    border: 2px solid var(--color-link);
    border-radius: var(--border-radius);
    color: var(--color-link);
    display: inline-block;
    padding: 1rem 2rem;
}

article aside a {
    color: var(--color-secondary);
}

/* Images */
figure {
    margin: 0;
    padding: 0;
}

figure img {
    max-width: 100%;
}

figure figcaption {
    color: var(--color-text-secondary);
}

/* Forms */
button:disabled,
a.button:disabled,
input:disabled {
    background: var(--color-bg-secondary);
    border-color: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    cursor: not-allowed;
}

button[disabled]:hover,
a.button[disabled]:hover,
input[type="submit"][disabled]:hover {
    filter: none;
}

form {
    border: 1px solid var(--color-bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow) var(--color-shadow);
    display: block;
    max-width: var(--width-card-wide);
    min-width: var(--width-card);
    padding: 1.5rem;
    text-align: var(--justify-normal);
}

form header {
    margin: 1.5rem 0;
    padding: 1.5rem 0;
}

input,
label,
select,
textarea {
    display: block;
    font-size: inherit;
    max-width: var(--width-card-wide);
}

input[type="checkbox"],
input[type="radio"] {
    display: inline-block;
}

input[type="checkbox"] + label,
input[type="radio"] + label {
    display: inline-block;
    font-weight: normal;
    position: relative;
    top: 1px;
}

input[type="range"] {
    padding: 0.4rem 0;
}

input,
select,
textarea {
    border: 1px solid var(--color-bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: .5em;
    padding: 0.4rem 0.8rem;
}

button,
a.button {
    margin-bottom: .5em;
}

input[type="text"],
textarea {
    width: calc(100% - 1.6rem);
}

input[readonly],
textarea[readonly] {
    background-color: var(--color-bg-secondary);
}

label {
    margin-bottom: 1rem;
    padding: 0.4rem 0.8rem;
}

/* Popups */
dialog {
    border: 1px solid var(--color-bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow) var(--color-shadow);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    z-index: 999;
}

/* Tables */
table {
    border: 1px solid var(--color-bg-secondary);
    border-radius: var(--border-radius);
    border-spacing: 0;
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
    padding: 0;
    white-space: nowrap;
}

table td,
table th,
table tr {
    padding: 0.4rem 0.8rem;
    text-align: var(--justify-important);
}

table thead {
    background-color: var(--color-table);
    border-collapse: collapse;
    border-radius: var(--border-radius);
    color: var(--color-bg);
    margin: 0;
    padding: 0;
}

table thead th:first-child {
    border-top-left-radius: var(--border-radius);
}

table thead th:last-child {
    border-top-right-radius: var(--border-radius);
}

table thead th:first-child,
table tr td:first-child {
    text-align: var(--justify-normal);
}

table tr:nth-child(even) {
    background-color: var(--color-accent);
}

/* Quotes */
blockquote {
    display: block;
    font-size: x-large;
    line-height: var(--line-height);
    margin: 1rem auto;
    max-width: var(--width-card-medium);
    padding: 1.5rem 1rem;
    text-align: var(--justify-important);
}

blockquote footer {
    color: var(--color-text-secondary);
    display: block;
    font-size: small;
    line-height: var(--line-height);
    padding: 1.5rem 0;
}

/* Scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: rgb(202, 202, 232) auto;
}

*::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-color: rgb(202, 202, 232);
    border-radius: 10px;
}

.blocks-container {
    clear: both;
}

.blocks-container button,
.blocks-container a.button,
.blocks-container label,
.blocks-container input,
.blocks-container select {
    float: left;
    margin-right: 1em;
}

#users-container > a, #users-container > span {
    padding: 3px 5px;
    border-radius: var(--border-radius);
    display: inline-block;
    background-color: var(--color-bg);
    border: 2px solid var(--color-link);
}

#users-container > a {
    cursor: text;
    font-weight: bold;
}

#users-container > a:hover {
    background: var(--color-secondary-accent);
    color: var(--color-secondary);
}

@media (max-width: 900px) {
    #users-container {
        display: none;
    }
}

.textarea {
    float: left;
    border: 1px solid #666;
    cursor: text;
    width: calc(100% - 2px);
}

.textarea > div.CodeMirror {
    background: rgba(0, 0, 0, .7);
    height: 100%;
}

.textarea > div.CodeMirror > .CodeMirror-scroll > .CodeMirror-gutters {
    background: rgba(0, 0, 0, .3);
}

.textarea.content {
    height: calc(100% - 2px);
}

.textarea.result {
    height: calc(100% - 2px);
}

.textarea > textarea {
    display: none;
}

input:invalid {
    background-color: lightpink;
}

#big-fat-boss-block {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

#file {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 400px;
    padding: 0 5px;
    overflow: hidden;
}

#file-header {
    height: 48px;
    flex: 0 0 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.5em;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.25em;
}

.header-right {
    display: flex;
    align-items: center;
}

.header-icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.header-icon-btn:hover {
    background: var(--color-bg-secondary);
    border-color: var(--color-bg-transparent);
}

.header-icon-btn svg {
    width: 20px;
    height: 20px;
}

#file-name {
    margin-left: 0.75em;
    padding: 0.25em 0.5em;
    border-radius: var(--border-radius);
}

#history-panel {
    position: fixed;
    top: 48px;
    left: 0px;
    width: 280px;
    max-height: calc(100vh - 58px);
    background: var(--color-bg);
    border: 1px solid var(--color-bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow) var(--color-shadow);
    z-index: 100;
    overflow-y: auto;
    transform: translateX(-100%);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    padding: 0.5em;
}

#history-panel.open {
    transform: translateX(0);
    opacity: 1;
}

#versions-panel {
    position: fixed;
    top: 48px;
    left: 0px;
    width: 280px;
    max-height: calc(100vh - 58px);
    background: var(--color-bg);
    border: 1px solid var(--color-bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow) var(--color-shadow);
    z-index: 100;
    overflow-y: auto;
    transform: translateX(-100%);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    padding: 0.5em;
}

#versions-panel.open {
    transform: translateX(0);
    opacity: 1;
}

#encrypt-panel {
    position: fixed;
    top: 48px;
    left: 0px;
    width: 320px;
    max-height: calc(100vh - 58px);
    background: var(--color-bg);
    border: 1px solid var(--color-bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow) var(--color-shadow);
    z-index: 100;
    overflow-y: auto;
    transform: translateX(-100%);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    padding: 0.8em;
}

#encrypt-panel.open {
    transform: translateX(0);
    opacity: 1;
}

.encrypt-panel-msg {
    font-size: 0.85em;
    color: var(--color-text-secondary);
    margin: 0 0 0.8em 0;
    line-height: 1.4;
}

.encrypt-action-btn {
    width: 100%;
    margin-top: 0.3em;
}

.encrypt-action-danger {
    opacity: 0.7;
    font-size: 0.85em;
}

.encrypt-link-row {
    margin-bottom: 0.8em;
}

.encrypt-link-label {
    font-size: 0.8em;
    color: var(--color-text-secondary);
    margin-bottom: 0.2em;
}

.encrypt-link-input-wrap {
    display: flex;
    gap: 0.3em;
}

.encrypt-link-input {
    flex: 1;
    font-size: 0.75em;
    padding: 0.3em 0.4em;
    border: 1px solid var(--color-bg-secondary);
    border-radius: var(--border-radius);
    background: var(--color-bg-secondary);
    color: var(--color-text);
    min-width: 0;
}

.encrypt-copy-btn {
    font-size: 0.8em;
    padding: 0.2em 0.6em;
    flex-shrink: 0;
}

#no-key-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

#no-key-dialog {
    background: var(--color-bg);
    border-radius: var(--border-radius);
    padding: 1.5em 2em;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

#no-key-dialog p {
    margin: 0 0 0.8em 0;
    font-size: 0.9em;
}

#no-key-input {
    width: 100%;
    font-family: monospace;
    font-size: 0.8em;
    padding: 0.5em;
    border: 1px solid var(--color-bg-secondary);
    border-radius: var(--border-radius);
    background: var(--color-bg-secondary);
    color: var(--color-text);
    box-sizing: border-box;
    margin-bottom: 0.5em;
}

#no-key-submit {
    width: 100%;
}

.no-key-error {
    color: #e74c3c;
    font-size: 0.8em;
    min-height: 1.2em;
}

#file-content {
    flex: 1;
    min-height: 300px;
    overflow: hidden;
}

#file-controls {
    height: 4em;
    flex: 0 0 4em;
    display: flex;
    align-items: end;
    padding-left: 8px;
}

@media (max-width: 600px) {
    #file-controls {
        height: 7em;
        flex: 0 0 7em;
    }
}

#file-result {
    flex: 0 0 300px;
    min-height: 300px;
    overflow: hidden;
}

#history {
    width: 100%;
}

.history-item {
    display: flex;
    white-space: nowrap;
    width: 100%;
    padding: 0.4em 0.25em;
    border-radius: var(--border-radius);
    transition: background 0.15s;
}

.history-item:hover {
    background: var(--color-bg-secondary);
}

.history-item > a.history-go {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item > a {
    font-weight: normal;
    cursor: pointer;
}

.history-item > a.history-delete {
    flex-shrink: 0;
    min-width: 1.5em;
    text-align: center;
    opacity: 0.6;
}

.history-item > a.history-delete:hover {
    opacity: 1;
    color: #e55;
}

.history-item > a:first-child {
    visibility: hidden;
}

.history-item:hover > a:first-child {
    visibility: visible;
}

#versions {
    width: 100%;
}

.versions-empty {
    padding: 0.5em;
    color: var(--color-text-secondary);
    text-align: center;
}

.version-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0.4em 0.25em;
    border-radius: var(--border-radius);
    transition: background 0.15s;
}

.version-item:hover {
    background: var(--color-bg-secondary);
}

.version-item-top {
    display: flex;
    white-space: nowrap;
    width: 100%;
}

.version-item-top > a.version-restore {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: normal;
    cursor: pointer;
}

.version-item-top > span.version-date {
    flex-shrink: 0;
    margin-left: 0.5em;
    color: var(--color-text-secondary);
    font-size: 0.85em;
}

.version-preview {
    font-size: 0.8em;
    color: var(--color-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 0.1em;
    font-family: monospace;
}

#content-markdown {
    padding: 1em;
    overflow: auto;
    height: calc(100% - 2em);
}

#content-markdown h1, #content-markdown h2, #content-markdown h3 {
    border-bottom: 1px solid;
}

#content-markdown pre {
    padding: 1em;
    overflow: auto;
}

#content-markdown code {
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

#content-markdown a {
    text-decoration: underline;
}

/* File controls styling */
#controls-container select,
#controls-container button {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-bg-transparent);
    color: var(--color-text);
    height: 32px;
    vertical-align: middle;
}

#controls-container select {
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23aaa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 1.75rem;
}

#controls-container select:hover,
#controls-container button:hover {
    background: var(--color-bg-transparent);
    border-color: var(--color-text-secondary);
}

#controls-container select:focus,
#controls-container button:focus {
    outline: none;
    border-color: var(--color-link);
}

#controls-container button {
    padding: 0 0.75rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

#controls-container button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#controls-container button:disabled:hover {
    background: var(--color-bg-secondary);
    border-color: var(--color-bg-transparent);
}

#runner-container input,
#runner-container button,
#runner-container label {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-bg-transparent);
    color: var(--color-text);
}

#runner-container input {
    padding: 0.25rem 0.5rem;
    height: 32px;
    box-sizing: border-box;
}

#runner-container button {
    height: 32px;
    padding: 0 0.75rem;
    cursor: pointer;
}

#runner-container button:hover {
    background: var(--color-bg-transparent);
    border-color: var(--color-text-secondary);
}

#runner-container label {
    background: transparent;
    border: none;
    padding: 0.25rem 0;
}