html {
    --bg-html: black;
    --bg-main: #32384d;
    --bg-secondary: #232b38;
    --fg-main: #ebebeb;
    --fg-link-normal: #6ba6e0;
    --fg-link-hover: white;
    --fg-link-visited: #bfd9f2;
    --fg-detail: #999999;
    --fg-border: white;
    --bg-code: #0d0c11;
    --border-code: #2D384C;
    --fg-code-block: #e9e9e9;
    --bg-code-block: #0d0c11;
    --border-code-block: #2D384C
}

@media(prefers-color-scheme:light) {
    html {
        --bg-html: white;
        --bg-main: #F8FAFC;
        --bg-secondary: #d0ddee;
        --fg-main: black;
        --fg-link-normal: #5297db;
        --fg-link-hover: black;
        --fg-link-visited: #2873bd;
        --fg-detail: #777777;
        --fg-border: black;
        --bg-code: #d8d6bd;
        --border-code: #c0bea1
    }
}

*:not(dialog) {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    color: var(--fg-main);
    font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 18px;
    background-color: var(--bg-secondary);
}

a:not(.midi-card, .random-midi, .nametag) {
    color: var(--fg-link-normal);

    &:visited {
        color: var(--fg-link-visited);
    }

    &:hover {
        color: var(--fg-link-hover);
    }
}

body {
    padding: 0 10px;
    background-color: var(--bg-main);
}

.header {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 20px;
}

.header > a {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    margin-bottom: 10px;
}

nav.links {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    row-gap: 0;
}

.link-array {
    display: flex;
    align-items: center;
    gap: 10px;
}

.link-header {
    font-weight: bold;
}

.link {
    margin-left: 0;
}

.link a:not(.nametag) {
    text-decoration: none;
    padding: 5px 10px;
    transition: background 0.2s;
}

.link a:hover:not(.nametag) {
    background-color: #333;
    border-radius: 4px;
    color: var(--fg-link-normal);
}

.link p {
    margin: 0;
}

.main {
    display: flex;
    gap: 10px;
    margin: 8px;
    padding: 10px;
}

.sidebar {
    width: 30%;
    display: flex;
    flex-direction: column;
}

.notifications {
    padding: 10px;
    display: flex;
    flex-direction: column;
    height: 50%;
    max-height: 50%;
    overflow-y: scroll;
}

.banned-notice {
    color: red !important;
}

.notification {
    border: 1px solid var(--fg-detail);
    border-radius: 5px;
    margin: 4px;
    padding: 10px;
}

.random-midis {
    padding: 10px;
    display: flex;
    flex-direction: column;
    height: 48%;
    max-height: 48%;
    overflow-y: scroll;
}

.random-midi {
    color: var(--fg-main);
    margin: 4px;
    padding: 10px;
    text-decoration: none;
}

.content {
    width: 70%;
}

.search {
    padding: 10px;
}

.search input[type='text'] {
    width: 100%;
    padding: 5px;
    border: none;
    outline: none;
    border-radius: 5px;
    margin-bottom: 6px;
}

.search select {
    padding: 8px;
    border: none;
    outline: none;
    border-radius: 5px;
}

.search input[type='submit'] {
    background-color: #54ea5b;
    padding: 8px;
    border: none;
    outline: none;
    border-radius: 5px;
    cursor: pointer;
}

.search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.upload-container {
    display: flex;
    flex-direction: column;
}

.upload-container input {
    border: none;
    outline: none;
    border-radius: 5px;
    padding: 8px;
}

.required::after {
    content: '*';
    color: red;
}

.basic-info {
    margin-bottom: 10px;
    margin-top: 10px;
    display: block;
}

.basic-info input {
    width: 100%;
}

.basic-info textarea {
    width: 100%;
}

.upload-button {
    padding: 10px;
}

.upload-more-container {
    display: flex;
    align-items: center;
    gap: 8px; /* space between checkbox and label */
    margin-top: 10px;
}

.upload-more {
    margin: 0; /* remove default margin */
}

.error-text {
    margin-top: 10px;
    border: 1px solid red;
    border-radius: 5px;
    padding: 5px;
    color: red;
}

.errornt-text {
    margin-top: 10px;
    border: 1px solid deepskyblue;
    border-radius: 5px;
    padding: 5px;
    color: deepskyblue;
}

.hidden {
    display: none;
}

.midi-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    margin: 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    color: var(--fg-main);
}

.midi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
}

.midi-card-header h4 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--fg-main);
}

.midi-card-body {
    margin-top: 0.5rem;
    flex: 1;
}

.midi-card-body p {
    margin: 0.2rem 0;
    font-size: 0.9rem;
    color: var(--fg-main);
}

.midi-card-body .artist {
    font-weight: 600;
    color: var(--fg-main);
}

.midi-card-body .album {
    font-style: italic;
}

.midi-card-body .rating {
    margin-top: 0.4rem;
    font-size: 1rem;
}

.midi-card-body .star {
    margin-right: 2px;
}

.midi-card-footer {
    margin-top: 0.8rem;
    font-size: 0.75rem;
    color: #888;
    text-align: right;
}

.good {
    color: green;
}

.bad {
    color: firebrick;
}

.neutral {
    color: grey;
}

.midi-page-info {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    line-height: 1.5;
}

.midi-page-info p {
    margin: 0.5rem 0;
}

.midi-page-info strong {
    color: var(--fg-main);
    margin-right: 4px;
}

.midi-page-ratings {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0.75rem 0;
}

.midi-page-ratings p {
    margin: 0;
}

.midi-page-ratings button {
    background: var(--bg-main);
    border: 1px solid var(--fg-border);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s, transform 0.1s;
    color: var(--fg-main);
}

.midi-page-ratings button:active {
    transform: scale(0.95);
}

.midi-page-description {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-main);
    border-left: 4px solid var(--fg-border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--fg-main);
}

.midi-page-uploaded-by {
    font-weight: lighter;
    font-size: 0.8rem;
}

.midi-page-ratings button[up].voted {
    background-color: green;
}

.midi-page-ratings button[down].voted {
    background-color: firebrick;
}

.midi-page-ratings button[up]:hover {
    background-color: green;
    color: var(--bg-main);
}

.midi-page-ratings button[down]:hover {
    background-color: firebrick;
    color: var(--bg-main);
}

.midi-page-ratings button:disabled {
    background-color: gray;
    cursor: not-allowed;
}

.pagination {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.pagination ul {
    list-style: none;
    display: flex;
    gap: 6px;
    padding: 0;
}

.pagination li {
    border-radius: 6px;
    overflow: hidden;
}

.pagination li.disabled a {
    pointer-events: none;
    opacity: 0.4;
}

.pagination li.current a {
    background-color: var(--fg-link-normal);
    color: var(--bg-main);
}

.page-link {
    display: block;
    padding: 6px 12px;
    background-color: var(--bg-secondary);
    color: var(--fg-link-normal);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.page-link:hover {
    background-color: var(--fg-link-normal);
    color: var(--bg-main);
}

.delete-account-form {
    border: 1px solid red;
    border-radius: 5px;
    padding: 5px;
    display: flex;
}

.delete-account-form b {
    color: red;
}

.manage-account-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 30px;
}

/* Revision History */
.midi-history-revision-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.midi-history-revision-list li {
    background: var(--bg-secondary);
    border: 1px solid var(--fg-border);
    border-radius: 10px;
    padding: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.midi-history-revision-list li:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.midi-history-revision-list a {
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
}

.midi-history-revision-list small {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.8rem;
    color: var(--fg-detail);
    font-style: italic;
}

.midi-history-rev-author {
    margin: 0.5rem 0 0 0;
    font-size: 0.85rem;
    color: var(--fg-detail);
}

.midi-history-rev-summary {
    margin: 0.3rem 0 0 0;
    font-size: 0.95rem;
    color: var(--fg-main);
}

.report-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 1.5rem;

    max-height: 400px;
    overflow-y: auto;
    padding-right: 6px;
}

.report-message {
    background: var(--bg-secondary);
    border: 1px solid var(--fg-border);
    border-radius: 10px;
    padding: 0.8rem 1rem;
}

.report-message p.message {
    margin-bottom: 0.5rem;
    color: var(--fg-main);
    font-size: 0.95rem;
}

.report-message small {
    font-size: 0.8rem;
    color: var(--fg-detail);
}

.report-send-message form {
    background: var(--bg-secondary);
    border: 1px solid var(--fg-border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.report-send-message label {
    font-weight: bold;
    margin-bottom: 0.3rem;
}

.report-send-message textarea {
    width: 100%;
    border-radius: 5px;
    border: 1px solid var(--fg-border);
    padding: 0.5rem;
    background: var(--bg-main);
    color: var(--fg-main);
    font-family: inherit;
}

.report-send-message input[type="submit"] {
    align-self: flex-start;
    background-color: var(--fg-link-normal);
    color: var(--bg-main);
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.report-send-message input[type="submit"]:hover {
    background-color: var(--fg-link-hover);
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0.5rem;
}

.quick-links a,button {
    background-color: var(--bg-main);
    border: 1px solid var(--fg-border);
    padding: 5px 10px;
    border-radius: 5px;
    text-decoration: none;
    color: var(--fg-link-normal);
    transition: background 0.2s, color 0.2s;
}

.quick-links a:hover,button:hover {
    background-color: var(--fg-link-normal);
    color: var(--bg-main);
}

.quick-links button:disabled {
    cursor: not-allowed;
}

h3 {
    margin: 1rem 0;
    font-size: 1.6rem;
    color: var(--fg-main);
    border-bottom: 2px solid var(--fg-border);
    padding-bottom: 0.3rem;
}

.ticket-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin: 1rem 0;
}

.ticket {
    background: var(--bg-secondary);
    border: 1px solid var(--fg-border);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ticket:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
}

.ticket p {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    color: var(--fg-main);
}

.ticket small {
    font-size: 0.8rem;
    color: var(--fg-detail);
    margin-bottom: 0.5rem;
}

.ticket a {
    align-self: flex-start;
    text-decoration: none;
    background: var(--fg-link-normal);
    color: var(--bg-main) !important;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.ticket a:hover {
    background: var(--fg-link-hover);
    color: var(--bg-main) !important;
}

.user-overview {
    background: var(--bg-secondary);
    border: 1px solid var(--fg-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.user-basic-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.user-basic-info p {
    margin: 0;
    color: var(--fg-main);
}

.user-notes {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.user-note {
    background: var(--bg-main);
    border: 1px solid var(--fg-border);
    border-radius: 8px;
    padding: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.user-note:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.user-note p {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.user-note small {
    font-size: 0.8rem;
    color: var(--fg-detail);
}

form:not(#mainsearch) {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--fg-border);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    margin-top: 1.5rem;
}

form:not(#mainsearch) label {
    font-weight: 600;
    margin-bottom: 0.2rem;
}

form textarea {
    resize: vertical;
    border: 1px solid var(--fg-border);
    border-radius: 6px;
    padding: 0.6rem;
    background: var(--bg-main);
    color: var(--fg-main);
    font-family: inherit;
    font-size: 1rem;
    min-height: 100px;
}

form:not(#mainsearch) small {
    font-size: 0.8rem;
    color: var(--fg-detail);
}

form:not(#mainsearch) input[type="submit"] {
    align-self: flex-start;
    background: var(--fg-link-normal);
    color: var(--bg-main);
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

form:not(#mainsearch) input[type="submit"]:hover {
    background: var(--fg-link-hover);
    color: var(--bg-main);
}

form:not(#mainsearch) input[type="submit"]:active {
    transform: scale(0.96);
}

.hamburger {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--fg-main);
}

@media (max-width: 1100px) {
    .main {
        flex-direction: column;
        gap: 10px;
    }

    .content {
        width: 100%;
        order: 1;
    }

    .sidebar {
        width: 100%;
        display: flex;
        flex-direction: column;
        order: 2;
    }

    .sidebar .notifications {
        order: 1;
        max-height: none;
        margin-bottom: 10px;
    }

    .sidebar .random-midis {
        order: 2;
        max-height: none;
        margin-top: 10px;
    }
}

@media (max-width: 600px) {
    .link-array {
        flex-direction: column;
        gap: 5px;
    }

    nav.links {
        display: none; /* hide by default */
        flex-direction: column;
        gap: 10px;
        background: var(--bg-secondary);
        padding: 10px;
        border-radius: 8px;
        margin-top: 10px;
    }

    nav.links.open {
        display: flex;
    }

    .hamburger {
        display: block;
    }
}

a.nametag[trust="Banned"] {
    color: #888888;
    font-weight: lighter;
}

a.nametag[trust="Normal"] {
    color: inherit;
}

a.nametag[trust="Trusted"] {
    color: green;
}

a.nametag[trust="Moderator"] {
    color: orange;
    font-weight: bold;
}

a.nametag[trust="Admin"] {
    color: red;
    font-weight: bold;
}

.pagination ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.pagination li.ellipsis span {
    display: block;
    padding: 6px 12px;
    background: var(--bg-secondary);
    color: var(--fg-main);
    border-radius: 6px;
}

.respect-newlines {
    white-space: pre-wrap; /* respects newlines and wraps text */
}

.author-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.remove-author {
    background: #f87171;
    border: none;
    color: white;
    font-weight: bold;
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
}

.remove-author:hover {
    background: #dc2626;
}

.notification-bubble {
    background-color: red;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 50%;
    padding: 2px 6px;
    margin-left: 6px;
    display: inline-block;
    min-width: 20px;
    text-align: center;
    line-height: 1.2;
    vertical-align: middle;
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.notifications-page-notifications {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
    padding: 0.5rem;
}

.notification-page-notification {
    background: var(--bg-secondary);
    border: 1px solid var(--fg-border);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.notification-page-notification p {
    margin: 0;
    line-height: 1.4;
    color: var(--fg-main);
}

.notifications-page-dismiss {
    align-self: flex-end;
    background: var(--fg-link-normal);
    color: var(--bg-main);
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.notifications-page-dismiss:hover {
    background: var(--fg-link-hover);
}

.notifications-page-dismiss:active {
    transform: scale(0.95);
}

.mass-edit-results {
    background-color: #1e1e1e;
    color: #dcdcdc;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.4;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #333;
    height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.mass-edit-results .info {
    color: #4fc3f7;
}

.mass-edit-results .error {
    color: #ef5350;
    font-weight: bold;
}

.mass-edit-results .success {
    color: #81c784;
}

.mass-edit-results .warn {
    color: #ffb74d;
}

pre {
    background:#1e1e1e;
    color:#dcdcdc;
    padding:10px;
    border-radius:6px;
    overflow:auto;
}

/* Modal Window */
.shitty-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--fg-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 22px rgba(0,0,0,0.35);
    color: var(--fg-main);
}

.shitty-modal p {
    margin-bottom: 1rem;
    color: var(--fg-main);
    line-height: 1.4;
}

.shitty-modal input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--fg-border);
    background: var(--bg-main);
    color: var(--fg-main);
    border-radius: 8px;
}

.shitty-modal button:hover {
    background: var(--fg-link-hover);
}

/* Playlist list */
.playlist-array {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: var(--bg-main);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.4rem;
    border: 1px solid var(--fg-border);
    max-height: 450px;
    overflow-y: scroll;
}

.playlist-item {
    display: flex;
}

.playlist-item input {
    margin-right: 0.5rem;
}

.playlist-array p {
    margin: 0;
}

.pwease-wait {
    text-align: center;
    color: var(--fg-detail);
}

.hash {
    font-family: monospace;
    font-size: small;
}