:root {
    --background: #ffe1d4;
    --background-2: #f7f0f0;
    --foreground: #800;
    --box-tab-background-dark: #d39c9c;
    --box-tab-background: #efc2c2;
    --box-tab-background-light: #e4a8a8;
    --box-tab-foreground: #800;
    --box-border: #800;
    --box-content-background: #fff;
    --box-content-background-2: #e6d9d9;
    --anchor-color: #c90000;
    --anchor-color-hovered: #f00;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #262626;
        --background-2: #202020;
        --foreground: #ffffff;
        --box-tab-background-dark: #500000;
        --box-tab-background: #800;
        --box-tab-background-light: #620000;
        --box-tab-foreground: #fff;
        --box-border: #575757;
        --box-content-background: #3a3a3a;
        --box-content-background-2: #282828;
        --anchor-color: #ff6161;
        --anchor-color-hovered: #ff9696;
    }

    button[type=submit].fancy {
        background: var(--box-tab-background);
        color: var(--box-tab-foreground);
    }

    button[type=submit].fancy:hover {
        background: var(--box-tab-background);
    }

    input,
    textarea {
        background: var(--background);
        border: 1px solid var(--box-border);
        color: var(--box-tab-foreground);
    }

    input::placeholder,
    textarea::placeholder {
        color: var(--box-border);
    }
}

* {
    padding: 0;
    margin: 0;
}

noscript {
    background: #000;
    color: #fff;
    padding: 8px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

a {
    color: var(--anchor-color);
}

a:hover {
    color: var(--anchor-color-hovered);
}

button.transparent {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    color: inherit;
    vertical-align: baseline;
    background: none;
}

button:hover {
    cursor: pointer;
}

body {
    background: linear-gradient(0deg, var(--background-2), var(--background));
    color: var(--foreground);

    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;

    font-family: Arial, Helvetica, sans-serif;
}

main {
    max-width: 50%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
}

main.full-size {
    max-width: 100%;
}

footer {
    border-top: 1px solid var(--box-border);
    padding-top: 4px;
}

code {
    background: var(--box-tab-background);
    padding: 4px 8px;
}

table.vertical {
    border-spacing: 8px;
}

table.vertical th {
    text-align: right;
    vertical-align: top;
}

table.vertical.left th,
table.left th,
table.left td {
    text-align: left;
}

ul {
    list-style: none;
}

/** FORM */
button[type=submit].fancy {
    background: linear-gradient(0deg, var(--box-tab-background), var(--background));
    padding: 8px;
    font-size: 18px;
    border: 1px solid var(--box-border);
}

button[type=submit].fancy:hover {
    background: linear-gradient(180deg, var(--box-tab-background), var(--background));
    cursor: pointer;
}

#form-upload-wrapper>button,
.big-upload-button {
    background: var(--background-2);
    padding: 32px 0;
    color: var(--foreground);
    border: 4px dashed var(--box-border);
}

#form-upload-wrapper>button:hover {
    background: var(--background);
    cursor: pointer;
}

#form-text-upload>textarea {
    resize: vertical;
    height: 256px;
}

/** BOX */
.box {
    background: var(--box-content-background);
    border: 2px solid var(--box-border);
    padding: 8px;
}

.box.red {
    background: var(--box-tab-foreground);
    color: var(--background);
}

.box>.tabs {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;

    color: var(--box-tab-foreground);
}

.box:has(.tabs),
.box:has(.tab) {
    padding: 0;
    background: none;
    border: none;
}

.box:has(.content)>.tab,
.tabs>.tab {
    background: var(--box-tab-background);
    color: var(--box-tab-foreground);
    border: 2px solid var(--box-border);
    border-bottom: none;
    padding: 8px;
    font-weight: bold;
}

.tabs>.tab.disabled,
.tabs>.tab[show-disabled='true'] {
    background: var(--box-tab-background-dark);
    padding: 4px 8px;
    margin-bottom: -8px;
}

.tabs>.tab.disabled:hover,
.tabs>.tab[show-disabled='true']:hover {
    background: var(--box-tab-background-light);
}

.box:has(.tab)>.content,
.box:has(.tabs)>.content {
    background: var(--box-content-background);
    border: 2px solid var(--box-border);
    padding: 8px;
}

.box>.content:has(.box) {
    background: var(--box-content-background-2);
}

.box>.content.file-preview {
    padding: 0;
}

.box.alert {
    padding: 8px;
    background: var(--box-content-background);
}

.box.alert.red {
    background: var(--anchor-color);
    color: #000;
}

/** FILES */
.file-preview-wrapper {}

.file-preview-wrapper>.box {
    max-width: 100%;
}

.file-preview:has(img),
.file-preview:has(video) {
    display: flex;
    justify-content: center;
    align-items: center;
}

.file-preview img,
.file-preview video {
    max-height: 80vh;
    max-width: 100%;
    border: 0.5px solid black;
}

.file-preview pre {
    max-width: 100%;
    overflow-x: scroll;
}

.file-preview-wrapper:has(pre) {
    flex-grow: 1;
    max-width: unset;
}

.item .delete-btn {
    position: absolute;
    align-self: flex-end;
}

.thumbnail.stock {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
}

/** FILE CATALOG (WALL) */
.wall {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.wall .brick {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 128px;
    height: 128px;
}

.brick.red img {
    border: 2px solid maroon;
}

.brick.blue img {
    border: 2px solid blue;
}

.brick img {
    min-width: 100%;
    height: auto;
}

/** SHORTCUTS */
.column {
    display: flex;
    flex-direction: column;
}

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

.grow {
    flex-grow: 1;
}

.wrap {
    flex-wrap: wrap;
}

.grid {
    display: grid;
}

.grid-3 {
    grid-template-columns: auto auto auto;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: end;
}

.justify-between {
    justify-content: space-between;
}

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

.align-bottom {
    align-items: end;
}

.pad-4 {
    padding: 4px;
}

.pad-8 {
    padding: 8px;
}

.gap-16 {
    gap: 16px;
}

.gap-8 {
    gap: 8px;
}

.gap-4 {
    gap: 4px;
}

.font-small {
    font-size: 10px;
}

.help {
    cursor: help;
    font-size: 10px;
    vertical-align: top;
}

.right {
    float: right;
}

@media screen and (max-width: 1000px) {
    main {
        width: 100%;
    }

    .file-preview-wrapper,
    .navbar {
        margin: 8px;
    }

    .navbar {
        align-items: start;
        flex-direction: column;
    }

    .grid-3 {
        grid-template-columns: auto;
    }
}