/*
 The page's colours, made of one: the theme's background (the user's,
 --base-light / --base-dark, set by theme.js). OKLCH: lightness as the
 eye sees it, so the same steps read the same at every hue. The
 background's lightness is held in a band (the text on it always
 readable whatever colour is picked), its chroma held low (never
 garish); the text is the background's hue at a fixed lightness; muted
 text a mix of the text and the block, not transparency.
*/
:root,
:root.light {
    color-scheme: light;
    --background: oklch(from var(--base-light, #cccccc) clamp(0.78, l, 0.96) min(c, 0.08) h);
    --blockBackground: oklch(from var(--background) calc(l + 0.05) c h);
    --color: oklch(from var(--background) 0.2 min(c, 0.03) h);
    --muted: color-mix(in oklch, var(--color) 54%, var(--blockBackground));
    --link: oklch(from var(--background) 0.45 0.15 250);
}

:root.dark {
    color-scheme: dark;
    --background: oklch(from var(--base-dark, #18191a) clamp(0.14, l, 0.32) min(c, 0.06) h);
    --blockBackground: oklch(from var(--background) calc(l + 0.06) c h);
    --color: oklch(from var(--background) 0.93 min(c, 0.02) h);
    --muted: color-mix(in oklch, var(--color) 62%, var(--blockBackground));
    --link: oklch(from var(--background) 0.78 0.12 250);
}

:root {
    --gap: 16px;
    --width: 960px;
    --radius: 6px;
    font-family: system-ui, sans-serif;
    line-height: 1.5;
}

* {
    box-sizing: border-box;
}

html {
    color: var(--color);
    background-color: var(--background);
}

body {
    margin: 0;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.block {
    background-color: var(--blockBackground);
    border-radius: var(--radius);
}

.text-muted {
    color: var(--muted);
}

/* The top: the logo, the sections, the theme and the sign-in. */
.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap);
    padding: 10px var(--gap);
    background-color: var(--blockBackground);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--color);
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap);
}

.nav a {
    color: var(--muted);
}

.nav a[aria-current] {
    color: var(--color);
    font-weight: 600;
}

.top-right {
    display: flex;
    align-items: center;
    gap: var(--gap);
    margin-left: auto;
}

button {
    font: inherit;
    color: inherit;
    background-color: var(--background);
    border: 1px solid var(--muted);
    border-radius: var(--radius);
    padding: 4px 12px;
    cursor: pointer;
}

button:disabled {
    color: var(--muted);
    cursor: default;
}

#page {
    max-width: var(--width);
    margin: 0 auto;
    padding: var(--gap);
}

.games {
    display: grid;
    gap: 8px;
}

.game {
    padding: 10px var(--gap);
}

.theme-form {
    display: grid;
    gap: 8px;
    padding: var(--gap);
    max-width: 320px;
}

.theme-form fieldset {
    border: none;
    padding: 0;
    display: grid;
    gap: 4px;
}

.account {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar {
    border-radius: 50%;
}

.button {
    color: inherit;
    border: 1px solid var(--muted);
    border-radius: var(--radius);
    padding: 4px 12px;
}

.button:hover {
    text-decoration: none;
    background-color: var(--background);
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap);
}

.cards {
    display: grid;
    gap: 8px;
    margin-bottom: var(--gap);
}

.card,
.post {
    padding: 10px var(--gap);
}

.card-title {
    font-weight: 600;
    color: var(--color);
    overflow-wrap: anywhere;
}

.meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.9em;
}

.post .text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin: var(--gap) 0;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}

.actions {
    display: flex;
    gap: 8px;
    margin-top: var(--gap);
}

.post-form {
    display: grid;
    gap: 12px;
    padding: var(--gap);
}

.post-form label {
    display: grid;
    gap: 4px;
}

input,
textarea {
    font: inherit;
    color: inherit;
    background-color: var(--background);
    border: 1px solid var(--muted);
    border-radius: var(--radius);
    padding: 6px 8px;
}

button.tag {
    border: none;
    background: none;
    padding: 0;
    color: var(--link, inherit);
    cursor: pointer;
    font: inherit;
}

.narrow {
    margin-bottom: var(--gap);
}

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px var(--gap);
    margin-bottom: 8px;
}

.grow {
    flex: 1;
}

.tag-edit {
    display: grid;
    gap: 8px;
    padding: var(--gap);
    margin-bottom: 8px;
}

.tag-edit label {
    display: grid;
    grid-template-columns: 9em 1fr;
    align-items: center;
}

.meter {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
}

.meter-bar {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background-color: var(--background);
    border: 1px solid var(--muted);
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    background-color: var(--link);
}

.thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius);
}

.images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.images img {
    max-width: 100%;
    max-height: 320px;
    border-radius: var(--radius);
}

.files {
    display: grid;
    gap: 8px;
    margin-bottom: var(--gap);
}
