* {
    box-sizing: border-box;
}

html {
    scroll-padding-top: 30px;
}

body {
    min-height: 100vh;
    margin: 0 8px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(var(--background-top) 3em, var(--background-bottom) 300px);
    color: var(--font-color);
    font-family: arial,helvetica,sans-serif;
    font-size: 10pt;
}

header {
    display: flex;
    gap: 0px 3px;
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    border-bottom:  1px solid var(--post-border);
    font-size: 9pt;
    position: sticky;
    top: 0;
    background: var(--background-top);
    margin-left: -8px;
    margin-right: -8px;
    z-index: 30;
    padding: 0 4px;
}

a, a:visited {
    text-decoration: underline;
    color: var(--link-color);
}

header a, header .link-button {
    text-decoration: none;
    font-size: 9pt;
}

a:hover, .link-button:hover {
    color: var(--link-color-hover);
}

.poster_id {
    cursor: pointer;
}

.poster_id:hover {
    color: var(--link-color-hover) !important;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0px;
}

hgroup {
    margin-top: 14px;
    margin-bottom: 14px;
}

hgroup h1 {
    font-family: tahoma;
    letter-spacing: -2px;
    font-size: 30px;
    text-align: center;
    color: var(--title);
}

hgroup p {
    margin: 0px;
    text-align: center;
    color: var(--title);
    font-size: 11px;
}

main {
    margin: 0 4px;
}

footer {
    text-align: center;
    margin-top: auto;
    margin-bottom: 8px;
    font-size: 10px;
}

form {
    margin: auto auto 0px;
}

.grid-form {
    display: grid;
    gap: 1px 2px;
    width: max-content;
    margin-bottom: 50px;
}

label:not(.image-box, .drop-zone), #reply-handle {
    border: 1px solid var(--label-border);
    padding: 0 3px;
    grid-column: 1;
    font-weight: bold;
    background: var(--form-label);
    display: flex;
    align-items: center;
}

#reply-handle {
    cursor: move;
    padding: 2px 0px;
    margin-bottom: 2px;
    text-align: center;
    display: block;
}

input {
    grid-column: 2;
}

hr {
    border: none;
    border-top: 1px solid var(--post-border);
}

fieldset {
    margin: auto;
    min-width: auto;
}

.separator {
    margin: 0 0 6px 0;
    padding: 4px 6px;
    background: var(--form-label);
    font-weight: bold;
}

.inline {
    display: inline;
    margin: 0;
}

.link-button {
    background: none;
    border: none;
    color: var(--link-color);
    padding: 0;
    text-decoration: underline;
    cursor: pointer;
    font-family: arial,helvetica,sans-serif;
    font-size: 10pt;
}

.link-button:focus {
    outline: none;
}

.link-button:active {
    color:var(--link-color-hover);
}

.search-container {
    display: flex;
    align-items: center;
}

.search-link {
    display: none;
}

.nav-links {
    flex-grow: 1;
}

.nav-links > span {
    white-space: nowrap;
}

@media only screen and (max-width: 800px) {
    header {
        display: unset;
    }

    .search-container {
        display: none;
    }

    .search-link {
        display: inline;
    }
}

.categories-list {
    display: flex;
    flex-direction: column;
}

.forums-list, .forum-thread-list {
    border: 1px solid var(--label-border);
    margin: 0 0 12px 0;
    display: flex;
    flex-direction: column;
    width: 85%;
    margin-left: auto;
    margin-right: auto;
}

.news-block {
    display: flex;
    flex-direction: column;
    margin: 0px auto 12px;
    width: 85%;
    border: 1px solid var(--label-border);
}

.block-header {
    background: var(--form-label);
    padding: 4px;
}

.block-entry {
    display: flex;
    flex-direction: row;
    background: white;
    padding: 4px;
    flex-wrap: nowrap;
    gap: 4px;
}

.block-title {
    width: 25%;
}

.block-content {
    width: 65%;
}

@media only screen and (max-width: 800px) {
    .forums-list, .forum-thread-list, .news-block {
        width: 100%;
    }
}

.category-desc, .forum-desc, .forum-index-desc, .forum-threads, .forum-posts, .forum-last-post, .thread-preview-desc, .thread-posts, .thread-views, .thread-last-post {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 4px;
}

@media only screen and (max-width: 800px) {
    .thread-views, .thread-posts {
        display: none;
    }
}

.forum-last-post, .thread-last-post {
    flex: 1 1 25%;
}

dd {
    margin: 0px;
}

.forum-desc, .thread-preview-desc {
    flex: 1 1 65%;
}

@media only screen and (max-width: 800px) {
    .forum-desc, .thread-preview-desc {
        flex: 1 1 25%;
    }
}

.category-desc, .forum-index-desc {
    background: var(--form-label);
}

.forum-entry, .thread-preview, .account-settings {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
}

.account-settings > .separator {
    width: 100%;
}

.user-description {
    margin: 8px;
}

.forum-entry:nth-child(odd), .thread-preview:nth-child(odd) {
    background: var(--post-background);
}

.post.reply {
    padding: 2px 8px 6px 8px;
    background: var(--post-background);
    border-width: 1px;
    border-style: none solid solid none;
    border-color: var(--post-border);
    align-self: flex-start;
    max-width: 95%;
    border-radius: 5px;
}

@media only screen and (max-width: 800px) {
    .post.reply {
        max-width: 100%;
    }
}

.thread {
    display: flex;
    gap: 6px;
    flex-direction: column;
    margin-bottom: 6px;
}

.user {
    color: var(--user-color);
    font-weight: bold;
}

.user a, a.user {
    text-decoration: none;
    color: var(--user-color);
    font-weight: bold;
}

.user a:hover {
    text-decoration: none;
    color: var(--link-color-hover);
    font-weight: bold;
}

.tripcode {
    color: var(--user-color);
}

.post .info {
    margin: 3px 0 4px 0;
    display: flex;
    gap: 4px;
    flex-direction: row;
    flex-wrap: wrap;
}

.post .info input[type="checkbox"] {
    margin: 1px 0 1px 0;
}

.post .body {
    margin: 8px 36px 4px 24px;
    word-wrap: break-word;
}

.original-name {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    white-space:nowrap;
    vertical-align: text-bottom;
}

.post .files {
    display: flex;
    gap: 20px;
    flex-direction: row;
    flex-wrap: wrap;
    margin-left: 24px;
}

.post .files .file {
    display: flex;
    gap: 5px;
    flex-direction: column;
    width: fit-content;
}

.post .files .single-file .file-info {
    margin-left: -24px;
}

@media only screen and (max-width: 800px) {
    .post .files {
        margin-left: 16px;
    }

    .post .files .single-file .file-info {
        margin-left: -16px;
    }

    .post .body {
        margin: 8px 16px 4px 16px;
    }
}

.grid-form input[type='checkbox'] {
    margin-right: auto;
}

.pages {
    padding: 10px;
    background: var(--post-background);
    border-width: 1px;
    border-style: none solid solid none;
    border-color: var(--post-border);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 3px;
    width: fit-content;
}

.page-current {
    color: var(--user-color);
}

.pages > a {
    text-decoration: none;
}

span.quote {
    color: #789922;
}

span.quote2 {
    color: #f6750b;
}

span.heading {
    color: var(--title);
    font-size: 11pt;
    font-weight: bold;
}

span.glow {
    text-shadow:0px 0px 40px #00fe20, 0px 0px 2px #00fe20;
}

span.echo {
    background: #faf8f8;
    color: #3060a8;
    text-shadow: 0 0 5px rgba(48, 96, 168, 0.5);
}

table {
    border-collapse: collapse;
    background: white;
    border: 1px solid #98E;
}

th {
    background: #98E;
    padding: 0px 12px;
}

tbody th {
    text-align: left;
}

td, th {
    border: 1px solid black;
}

.inline-image {
    max-height: 400px;
    max-width: 600px;
}

.post-controls .popup {
    position: absolute;
    background: var(--background-bottom);
    border: 1px solid #ccc;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 29;
}

.popup ul {
    padding: 0;
    margin: 0;
    list-style: none;
}

.popup li {
    padding: 8px;
}

details summary {
    list-style: none;
}

details summary::before {
    content: '▶';
    display: inline-block;
    transition: transform 0.2s ease;
}

details[open] summary::before {
    transform: rotate(90deg);
}

.show-image {
    display: none;
}

.image-box {
    width:fit-content;
    cursor: pointer;
}

.post-image, .post-video {
    display: none;
}

.post-image, .post-video, .body img, .body video {
    max-width: 98%;
    max-height: 98vh;
    width: auto;
    height: auto;
}

.image-box input[type=checkbox]:checked + .post-thumbnail {
    display: none;
}

.image-box input[type=checkbox]:checked + .post-thumbnail + .post-image {
    display: block;
}

.post-collapse-video {
    float: left;
    display: none;
}

.image-box input[type=checkbox]:checked + .post-thumbnail + .post-collapse-video {
    display: block;
}

.image-box:has(input[type=checkbox]:checked) + .post-video {
    display: block;
}

#reply {
    display: none;
}

#reply.reply-default-position {
    top: 102px;
    right: 25px;
}

@media only screen and (min-width: 800px) {
    #reply:target, #reply.reply-focus {
        display: block;
        position: fixed;
        background: var(--post-background);
        padding: 5px;
        border-width: 1px;
        border-color: var(--post-border);
        border-style: solid;
        z-index: 2;
        touch-action: none;
    }
}

#reply-close {
    position: absolute;
    top: 7px;
    right: 7px;
}

#reply form {
    margin: 0px;
}

.post-link, .post-link:visited {
    text-decoration: none;
    color: black;
}

.post-link:hover {
    color: var(--link-color-hover);
}

.ban-message {
    display: block;
    color: red;
    font-weight: bold;
    margin-top: 15px;
}

.expired {
    text-decoration:line-through;
}

.thread-subject {
    color: var(--thread-subject);
    font-weight: bold;
}

div.body a.post-reply {
    color: var(--reply-color);
}

.navigation-links {
    margin-bottom: 10px;
    font-size: 9pt;
    display: flex;
    flex-direction: row;
    gap: 3px;
    justify-content: center;
}

.omitted {
    display: block;
    margin-top: 12px;
}

.post:target {
    background: var(--post-highlight);
}

.post.highlighted {
    background: var(--post-highlight);
}

.sage a {
    color: var(--link-color);
}

.thread-preview-desc > span {
    display: flex;
    gap: 4px;
    flex-direction: row;
}

.box {
    background: white;
    border: 1px solid var(--form-label);
    max-width: 700px;
    margin: 30px auto;
    padding: 10px;
}

.mod-controls, .user-actions {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 3px;
    width: fit-content;
}

.mod-controls a, .mod-controls .link-button, .user-actions a, .user-actions .link-button {
    text-decoration: none;
}

.post-history-link {
    margin-top: 6px;
    text-align: right;
    font-size: 9pt;
}

.post-history-entry {
    margin-bottom: 14px;
}

.post-history-meta {
    margin-bottom: 6px;
    font-size: 9pt;
}

noscript {
    display: contents;
}

.capcode, .not-approved {
    color: red;
}

.vpn {
    color: blue;
}

.tor {
    color: purple;
}

.thread-not-approved {
    color: orange;
}

.centered {
    margin: auto;
}

.multiple-files {
    max-width: min-content;
}

.multiple-files:has(input[type=checkbox]:checked) {
    max-width: fit-content;
}

.table2 {
    margin: auto;
    width: 100%;
    background: none;
    border: none;
    font-size: 10pt;
    border-collapse: separate;
    border-spacing: 2px;
}

.table2 th {
    background: #98E;
    white-space: nowrap;
}

.table2 td, .table2 th {
    padding: 4px 15px 5px 5px;
    text-align: left;
    border: none;
}

.table2 tr:nth-child(even) {
    background: var(--post-background);
}

.error {
    text-align: center;
}

.news-elem {
    background: white;
    border: 1px solid var(--form-label);
    max-width: 700px;
    margin: 30px auto;

}

.news-elem-content {
    padding: 0px 10px;
}

.news-elem-title {
    background: var(--form-label);
    padding: 4px;
}

.news-elem-title time {
    float: right;
}

.embed-elem {
    float: left;
    margin: 10px 20px;
}

.banner {
    width: 300px;
    height: 100px;
    display: block;
    margin: 12px auto 0 auto;
}

.banner-thumbnail {
    max-width: 300px;
    max-height: 100px;
    width: auto;
    height: auto;
}

.cc-container {
    position: relative;
}

.cc-counter {
    position: absolute;
    right: 8px;
    bottom: 5px;
    font-size: 12px;
    opacity: 0.5;
    pointer-events: none;
    user-select: none;
}

.cc-counter.warn {
    color: red;
    opacity: 1;
    font-weight: bold;
}

a {
    cursor: pointer;
}

.own-post {
    font-style: italic;
    font-weight: normal;
    opacity: 0.67;
}

.drop-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 1em;
    border: 2px dashed #cccccc;
    background: white;
    cursor: pointer;
}

.drop-zone input {
    display: none;
}

.preview {
    grid-column: 2;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    list-style: none;
    padding: 0;
    overflow-y: scroll;
    max-height: 100px;
    margin: 0;
}

.preview li {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin: 0;
    padding: 5px;
}

.preview img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.preview .file-ext {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 50px;
    height: 50px;
    background: lightgray;
    font-weight: bold;
}

.preview a {
    margin-left: auto;
    margin-right: 5px;
    font-size: 25px;
    text-decoration: none;
}

.info-box {
    padding: 8px;
    border-width: 1px;
    background: var(--post-background);
    border-style: none solid solid none;
    border-color: var(--post-border);
    display: flex;
    width: fit-content;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.listener-status {
    align-items: baseline;
    gap: 7px;
}

.dot {
    border-radius: 50%;
    display: inline-block;
    height: 10px;
    width: 10px;
}

.vertical-line {
    width: 1px;
    height: 100%;
    background-color: red;
    display: none;
    position: absolute;
}

.horizontal-line {
    width: 100%;
    height: 1px;
    background-color: red;
    display: none;
    position: absolute;
}

.forum-catalog {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5em;
    justify-content: center;
}

.catalog-entry {
    display: flex;
    flex-direction: column;
    width: 200px;
    height: 240px;
    border-width: 1px;
    background: var(--post-background);
    border-style: none solid solid none;
    border-color: var(--post-border);
    overflow: auto;
    text-align: center;
    overflow-wrap: break-word;
    gap: 2px;
}

.catalog-entry .post-thumbnail {
    max-height: 120px;
    max-width: 120px;
    width: auto;
    height: auto;
}

.catalog-thread-info {
    display: flex;
    flex-direction: column;
}

.catalog-thread-info a {
    text-decoration: none;
}

.forums-list .catalog-entry {
    background: none;
    border-style: none;
}

.thread-form {
    flex-direction: column;
    margin: auto;
}

.thread-form form, .popup form {
    margin-bottom: 0;
}

.announcement {
    text-align: center;
    color: red;
    font-weight: bold;
}

@media only screen and (max-width: 800px) {
    .grid-form {
        width: 100%;
    }

    textarea {
        width: 100%;
    }
}

.system-dashboard {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.system-dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.system-dashboard-card {
    background: white;
    border: 1px solid var(--post-border);
    padding: 10px;
}

.system-dashboard-card-label {
    color: var(--link-color);
    font-size: 9pt;
    margin-bottom: 4px;
}

.system-dashboard-card-value {
    font-size: 16pt;
    font-weight: bold;
    color: var(--thread-subject);
}

.system-dashboard-card-details {
    margin-top: 4px;
    color: #444;
    font-size: 9pt;
}

.system-info-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.system-info-section > p {
    margin: 0;
    font-weight: bold;
}

.icon, .post .info form, .post .info a, .post .info summary {
    height: 16px;
}

code {
    display: block;
    overflow-x: auto;
    padding: 1em;
}

.post-preview {
    overflow: auto;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

footer div {
    margin: 4px;
}
