:root {
    color-scheme: dark;
    --background: #101218;
    --surface: #181c25;
    --surface-hover: #222837;
    --border: #2b3140;
    --text: #edf0f7;
    --muted: #939daf;
    --accent: #4285ff;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: system-ui, sans-serif;
}

button, input {
    font: inherit;
}

button,
.topbar nav a {
    cursor: pointer;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 16px;
}

button:hover,
.topbar nav a:hover {
    background: var(--surface-hover);
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: #14171f;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    letter-spacing: 2px;
}

.logo {
    font-size: 30px;
    font-style: italic;
    color: var(--accent);
}

.topbar nav {
    --surface: #192538;
    --surface-hover: #253a56;
    --border: #344d70;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar nav :is(a, button) {
    line-height: 1.25;
    white-space: nowrap;
}

.topbar nav [aria-current="page"] {
    background: #233f68;
    border-color: #5683bc;
    color: #edf5ff;
}

.topbar nav [aria-current="page"]:hover {
    background: #2c4e7e;
}

.topbar nav :is(a, button):focus-visible {
    outline: 2px solid #91bbff;
    outline-offset: 3px;
}

#account-name:not(:empty) {
    padding-inline: 6px;
    color: #a8c8f7;
    overflow-wrap: anywhere;
}

.layout {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    min-height: calc(100vh - 72px);
}

.sidebar {
    padding: 24px 16px;
    border-right: 1px solid var(--border);
    background: #14171f;
}

.section-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    margin: 24px 12px 12px;
}

.sidebar button {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    margin-bottom: 4px;
}

.sidebar button:hover {
    background: var(--surface-hover);
}

.sidebar .selected {
    background: #203454;
    color: #8cb7ff;
}

main {
    padding: 32px;
    width: 100%;
    max-width: 1500px;
    margin: auto;
}

.hero {
    padding: 36px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(
        120deg, #1d2943, #181c25 75%
    );
}

.eyebrow {
    color: #8cb7ff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 3px;
}

h1 {
    font-size: clamp(28px, 4vw, 48px);
    margin: 16px 0;
}

p {
    color: var(--muted);
    line-height: 1.6;
}

.games {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 24px 0 36px;
}

.game-card {
    min-height: 170px;
    text-align: left;
    padding: 24px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gt3 {
    background: linear-gradient(135deg, #172d51, #181c25);
}

.gt4 {
    background: linear-gradient(135deg, #49202b, #181c25);
}

.game-number {
    font-size: 42px;
    font-weight: 800;
    opacity: .55;
}

.game-title {
    font-size: 23px;
    font-weight: 700;
}

.game-description {
    font-size: 14px;
    color: var(--muted);
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

input {
    padding: 12px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
}

.empty-state {
    padding: 60px 24px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: var(--surface);
}

footer {
    margin-top: 40px;
    color: var(--muted);
    font-size: 12px;
}

dialog {
    width: min(420px, 92vw);
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
}

dialog::backdrop {
    background: rgba(0, 0, 0, .75);
}

dialog label {
    display: block;
    margin: 18px 0 8px;
}

dialog input {
    width: 100%;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

#login-error {
    color: #ff8080;
}

@media (max-width: 750px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    main {
        padding: 16px;
    }

    .games {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 16px;
    }

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

/* Contributor registration */

.field-help {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
}

#register-error {
    color: #ff8080;
}

#register-dialog {
    max-height: 90vh;
    overflow-y: auto;
}

.dialog-footer {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.text-button {
    background: transparent;
    border: 0;
    color: #8cb7ff;
    padding: 4px;
}

.text-button:hover {
    background: transparent;
    text-decoration: underline;
}

button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

@media (max-width: 900px) {
    .topbar {
        height: auto;
        min-height: 72px;
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 16px;
    }

    .topbar nav {
        gap: 8px;
        flex-wrap: wrap;
    }

    .topbar nav :is(a, button) {
        padding: 8px 12px;
        font-size: 13px;
    }
}

#upload-dialog {
    width: min(560px, calc(100% - 2rem));
    max-height: calc(100dvh - 2rem);
    overflow: auto;
}

#upload-new-mod-fields {
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
}

.upload-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

#upload-dialog select,
#upload-dialog textarea,
#reject-dialog textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    color: inherit;
    background: #151922;
    border: 1px solid #424958;
    border-radius: 6px;
    font: inherit;
}

#upload-dialog textarea,
#reject-dialog textarea {
    resize: vertical;
}

#upload-drop {
    padding: 16px;
    border: 1px dashed #727f97;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
}

#upload-drop.dragging {
    background: #243452;
    border-color: #8bb3ff;
}

#upload-progress {
    width: 100%;
}

#upload-error {
    color: #ff9c9c;
}

#submissions-dialog,
#moderation-dialog {
    width: min(680px, calc(100% - 2rem));
    max-height: calc(100dvh - 2rem);
    overflow: auto;
}

.submission-card {
    padding: 16px;
    margin: 12px 0;
    background: #151922;
    border: 1px solid #424958;
    border-radius: 8px;
    overflow-wrap: anywhere;
}

.submission-card h3 {
    margin-top: 0;
}

.submission-card p {
    white-space: pre-wrap;
}

.submission-card a {
    color: #a7c4ff;
}

.category.selected {
    background: #263149;
}

.catalog-more {
    display: inline-block;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
}

.catalog-more:hover {
    background: var(--surface-hover);
}

.mod-page {
    max-width: 980px;
    margin: 0 auto;
}

.mod-page .mod-description {
    white-space: pre-wrap;
}

.mod-screenshot {
    display: block;
    max-width: 100%;
    max-height: 540px;
    object-fit: contain;
    border-radius: 6px;
}

#reject-dialog {
    width: min(520px, calc(100% - 2rem));
}

#reject-error {
    color: #ff9c9c;
}
