body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    /* stolen from GitHub; could also just write "sans-serif" */
    line-height: 1.5em;
}

/* Reduce space at top and bottom */
#g-mainbar,
#g-footer,
.g-totop,
.g-content {
    padding: 0 !important;
}

@media (max-width: 47.99rem) {
    #g-navigation {
        padding: 1rem 0 !important;
    }
}

#g-mainbar .g-content {
    padding-top: 1.5rem !important;
}

.navbar-nav {
    margin-top: 0;
}

.mod-kunena-breadcrumbs {
    margin: 0 !important;
}

h1 {
    margin-bottom: 1rem;
}

/* Fix navigation padding arbitrarily disappearing */
@media (max-width: 47.99rem) {
    .container-fluid {
        padding: 0 var(--bs-gutter-x, 0.75rem);
    }
}

/* Re-space time and credit at the bottom */
.d-flex.justify-content-center {
    margin-top: 0.5rem;
}

#kunena+div[style *="center"] {
    margin-bottom: 0.5rem;
}

/* Fix forum-specific notice margin */
/* This also has some things used for the blue "last edit" box */
.alert {
    margin-top: 1.25rem;
    line-height: 1.25em;
    font-size: 0.875rem;
    /* columns: 30em auto; */
}

/* Shrink notice */
.kunena-topic-item .bbcode_center span {
    font-size: 1.5em !important;
}


/* "Last edit" */
.col-md-10 .alert {
    padding: 0.25em 0.5em 0.5em 0.5em !important;
    margin-bottom: 0.5em;
    /* fix narrow screens */
}

/* Unread tint */
tr:has(.topic-item-unread) {
    background-color: #0080000a;
    --darkreader-background-0000000d: #0080000a;
}

/* Move drop shadow up */
.shadow-lg {
    box-shadow: 0 0.5rem 3rem rgba(0, 0, 0, 0.175) !important;
}

/* Counter extra spaces after links */
/* .kmsg a { margin-right: -0.2em; } */

/* Improve awful code formatting */

/* Space post content and timestamp */
.float-end:has(.kdate) {
    margin: 0.75rem 0.25rem 0;
}

@media (max-width: 47.99rem) {
    .kmsg {
        margin-top: 2.5rem !important;
    }
}

/* Message aside */
.col-md-2 {
    font-size: 0.9rem;
    line-height: 1.25rem;
    padding: 0.5rem;
    box-shadow: -0.5rem 0.5rem 3rem -0.5rem rgba(0, 0, 0, 0.175) !important;
}

.col-md-2 li {
    margin-top: 0rem;
}

.col-md-2 li:has(strong) {
    font-size: 1rem;
    margin-bottom: 0.5rem !important;
}

.col-md-2 li strong {
    font-weight: normal;
}

/* Badge placement */
@media (width > 47.99rem) {
    .col-md-2 li:has(.topic-starter, .badge) {
        display: inline;
    }

    .topic-starter {
        display: inline-block !important;
    }
}

@media (max-width: 47.99rem) {
    .topic-starter {
        display: block !important;
        margin: 0 auto;
    }

    .kwho-user img {
        margin-bottom: 2px;
        /* Like . . . maybe? */
        float: left;
        margin-left: 20%;
    }

    .profilebox li:has(> strong) {
        margin-left: 20% !important;
        width: 144px !important;
    }
}

/* Fix invisible profile icons?? */
.kicon-profile-location:before {
    content: "🌐";
}

.kicon-profile-website:before {
    content: "🔗";
}

.kicon-profile-location:before,
.kicon-profile-website:before {
    filter: saturate(0);
    margin-left: -0.2em;
    opacity: 0.75;
}

a .kicon-profile {
    cursor: unset;
}

.profile-expand li:has(.kicon-profile) {
    display: inline-block !important;
}

@media (width > 47.99rem) {

    /* Align post buttons */
    .col-md-10 .btn-toolbar {
        padding: 0 1.5rem;
    }

    /* Align thank-yous and edit messages */
    .kmessage-thankyou,
    .col-md-10 .alert {
        margin: 0.5rem 1.5rem;
    }
}

/* Fix thank-yous on narrow screens */
.kmessage-thankyou {
    margin-bottom: 0.5em;
}

/* Improve edit message padding */
.col-md-10 .alert {
    padding: 0.25em 0.5em !important;
}

/* Alternate: move post timestamps to the left */
/* .col-md-10 {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.col-md-10 > * {
    display: block;
}
.fpost-content-box {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}
.float-end:has(.kdate) {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
} */

/* Fix spoilers messing with cursor */
#kunena.layout .kspoiler-header {
    cursor: unset;
}

/* Remove blank attachment box (when all attachments are embedded) */
/* Cannot do .thumbnails:empty because it has non-collapsible whitespace */
.card:has(> .thumbnails):not(:has(> .thumbnails > *)) {
    display: none;
}

/* Signature border */
hr {
    border-width: 1px;
}

/* Remove extra space above post buttons */
.fpost-content-box {
    padding-bottom: 0px !important;
}

/* Remove erroneous space around thread page buttons  */
h2:has(.kunena-search),
ul.pagination.ms-0 {
    margin: 0 !important;
}

/* Make thread page buttons consistent size with search bar */
.page-link {
    padding: 0.5rem 1rem !important;
}

/* Space between thread page buttons and actions at the bottom */
.float-end:has(#mod-search-searchword) {
    margin-bottom: 1rem;
}

.float-start h1 small {
    display: inline-block !important;
    margin-left: 0.25em;
    opacity: 0.5;
}

.kfrontend {
    margin-bottom: 1rem !important;
}

/* De-emphasize time and credit at the bottom */
.d-flex.justify-content-center,
#kunena+div[style *="center"] {
    opacity: 0.5;
    font-size: 0.875em;
}

/* Reply page - remove superfluous space */
#postform .mb-5 {
    margin-bottom: 1rem !important;

    .p-3 {
        padding: 0 !important;
    }
}

#postform h2 {
    margin-bottom: 0.5rem;
}

#postform #myTab {
    margin-top: 0.5rem;
}

#cke_message,
#postform #kpost-attachments {
    margin-bottom: 0 !important;
}

#postform .control-group:has([type="hidden"]) {
    margin: 0;
}

#postform .bg-info+br,
#postform .clearfix+br {
    display: none;
}

#postform .bg-info {
    margin-bottom: 0.5rem;
}

#progress {
    margin-top: 0.5rem;
    transition: opacity 500ms ease 400ms;

    &:has([style *="100%"]) {
        opacity: 0;
    }
}

/* De-emphasize file names */
#files p a {
    font-size: 0.875em;
    opacity: 0.75;
}

/* Reply page - post history */
/* Fix post headers */
#history .khistory.badger-info {
    height: 100%;
    margin: 0 !important;
    padding-top: 2.5em !important;
}

/* Place timestamps in post boxes */
#history small {
    justify-content: right !important;
    display: flex !important;
    margin: 1em 12px -4rem 0 !important;
    line-height: 1.25em;
}

/* Fix overlap at the bottom of each post */
#history .badger-left.badger-info.khistory {
    padding-bottom: 2.5rem !important;
}

/* Space posts */
#history>* {
    margin-bottom: 1rem;
}

/* Avatars */
#history .row .center {
    padding-top: 0;
}

/* Post titles */
#kunena.layout [class *="badger"]::after {
    margin: 8px 10em 0 14px;
}

/* Reply page - source view */
textarea.cke_source {
    font-family: monospace;
    line-height: 1.5;
    padding: 20px;
}

.bbcode_url {
    margin-right: -0.25ch;
}

.communityhighlight {
    padding: 1em !important;
}