/* ── Reset & Base ─────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

[hidden] { display: none !important; }

:root {
    --bg: #0d0d0f;
    --surface: #161618;
    --surface-up: #1e1e22;
    --border: #2a2a2f;
    --border-hi: #3a3a42;
    --text: #e8e8ec;
    --text-2: #8a8a96;
    --text-3: #55555e;
    --text-shadow: rgba(23, 23, 19, 0.55);
    --text-2-shadow: rgba(117, 117, 105, 0.55);
    --text-3-shadow: rgba(170, 170, 161, 0.55);
    --accent: #e8671a;
    --accent-h: #f07830;
    --accent-dim: #7a3810;
    --accent-shadow: rgba(23, 152, 229, 0.55);
    --accent-text: #ffffff;
    --accent-text-shadow: rgba(0, 0, 0, 0.55);
    --current-text-shadow: var(--text-shadow);
    --control-bg: color-mix(in srgb, var(--surface-up) 88%, var(--accent) 12%);
    --control-bg-hover: color-mix(in srgb, var(--surface-up) 76%, var(--accent) 24%);
    --control-border: color-mix(in srgb, var(--border-hi) 62%, var(--text) 38%);
    --control-border-strong: color-mix(in srgb, var(--accent) 58%, var(--text) 42%);
    --control-text: var(--text);
    --control-text-shadow: var(--text-shadow);
    --control-placeholder: color-mix(in srgb, var(--text-2) 72%, var(--text) 28%);
    --control-placeholder-shadow: var(--text-2-shadow);
    --green: #4caf7a;
    --red: #e05050;
    --red-dim: #5a1a1a;
    --radius: 6px;
    --radius-lg: 12px;
    --font: system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono:
        "Cascadia Code", "JetBrains Mono", "Fira Code", ui-monospace, monospace;
    --site-header-height: 56px;
    --main-inline-padding: 1.25rem;
    --layout-sidebar-break: 960px;
}

html {
    font-size: 16px;
}

@media (min-width: 1440px) {
    html {
        font-size: 17px;
    }
}

@media (min-width: 1800px) {
    html {
        font-size: 18px;
    }
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

:where(body, body *):not(svg, svg *) {
    text-shadow: 0 0 0.1em var(--current-text-shadow);
}

a {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    text-decoration: none;
}
a:hover {
    color: var(--accent-h);
    --current-text-shadow: var(--accent-shadow);
    text-decoration: underline;
}

h1,
h2,
h3 {
    line-height: 1.25;
    font-weight: 700;
}

img {
    max-width: 100%;
    display: block;
}

code {
    font-family: var(--mono);
    font-size: 0.875em;
    background: var(--surface-up);
    padding: 0.1em 0.35em;
    border-radius: 3px;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */

.site-header {
    --header-text: var(--text);
    --header-text-2: var(--text-2);
    --header-text-3: var(--text-3);
    --header-text-shadow: var(--text-shadow);
    --header-surface: color-mix(in srgb, var(--surface-up) 86%, var(--accent) 14%);
    --header-surface-up: color-mix(in srgb, var(--surface-up) 72%, var(--accent) 28%);
    --header-border: var(--control-border);
    background: var(--header-surface);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--header-border);
    box-shadow:
        0 12px 30px -22px rgba(0, 0, 0, 0.55),
        0 0 0 1px color-mix(in srgb, var(--accent) 4%, transparent);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    width: 100%;
    height: var(--site-header-height);
}

.nav {
    width: calc(100% - 4rem);
    max-width: none;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: var(--site-header-height);
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: var(--site-header-height);
    position: relative;
    z-index: 1;
}

.page-content--splash {
    padding-top: 0;
}

.logo {
    font-family: var(--mono);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--header-text);
    --current-text-shadow: var(--header-text-shadow);
    letter-spacing: 0;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
}
.logo:hover {
    color: var(--header-text);
    --current-text-shadow: var(--header-text-shadow);
    text-decoration: none;
}
.logo strong {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    font-weight: 700;
}
.logo:hover strong {
    color: var(--header-text);
    --current-text-shadow: var(--header-text-shadow);
}

.logo.is-scrambling strong {
    transition: color 0.12s ease;
}

.splash-brand {
    font-family: var(--mono);
    font-size: clamp(3.5rem, 14vw, 10rem);
    font-weight: 600;
    line-height: 0.95;
    letter-spacing: -0.04em;
    color: var(--text);
    text-align: center;
}

.splash-brand strong {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    font-weight: 700;
}

.splash-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
    padding: 3rem 1.5rem 4rem;
    max-width: 54rem;
}

.splash-copy {
    display: grid;
    gap: 0.7rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: clamp(1rem, 1.6vw, 1.45rem);
    line-height: 1.55;
    letter-spacing: -0.01em;
}

.splash-copy p {
    max-width: 36rem;
    margin: 0 auto;
}

.nav-browse {
    display: flex;
    gap: 0.125rem;
    flex: 1;
    min-width: 0;
}

.nav-link {
    font-size: 0.95rem;
    color: var(--header-text-2, var(--text-2));
    --current-text-shadow: var(--header-text-shadow, var(--text-2-shadow));
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius);
    text-decoration: none;
    transition:
        color 0.15s,
        background 0.15s;
}
.nav-link:hover {
    color: var(--header-text, var(--text));
    --current-text-shadow: var(--header-text-shadow, var(--text-shadow));
    background: var(--header-surface-up);
    text-decoration: none;
}
.nav-link.active {
    color: var(--header-text, var(--text));
    --current-text-shadow: var(--header-text-shadow, var(--text-shadow));
    background: var(--header-surface-up);
    font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--accent);
    text-decoration: none;
}

.nav-link--metamod {
    font-size: 0.78rem;
    color: var(--header-text-3, var(--text-3));
    --current-text-shadow: var(--header-text-shadow, var(--text-3-shadow));
}

.nav-search {
    flex-shrink: 0;
}
.nav-search input[type="search"] {
    background: var(--header-surface-up);
    border: 1px solid var(--header-border);
    border-radius: var(--radius);
    color: var(--header-text);
    --current-text-shadow: var(--header-text-shadow);
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.4rem 0.65rem;
    height: 34px;
    width: 180px;
    appearance: none;
    transition:
        border-color 0.15s,
        width 0.15s;
}
.nav-search input[type="search"]:focus {
    outline: none;
    border-color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    width: 240px;
}
.nav-search input[type="search"]::placeholder {
    color: var(--header-text-2);
    --current-text-shadow: var(--header-text-shadow);
}
.nav-search input[type="search"]::-webkit-search-cancel-button {
    display: none;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0 1.5rem;
}
.search-form input[type="search"] {
    flex: 1;
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    color: var(--control-text);
    --current-text-shadow: var(--control-text-shadow);
    font-family: inherit;
    font-size: 0.9375rem;
    padding: 0.55rem 0.75rem;
    appearance: none;
}
.search-form input[type="search"]:focus {
    outline: none;
    border-color: var(--control-border-strong);
    color: var(--control-text);
    --current-text-shadow: var(--control-text-shadow);
}
.search-form input[type="search"]::placeholder {
    color: var(--control-placeholder);
    --current-text-shadow: var(--control-placeholder-shadow);
    font-weight: 650;
}
.search-form input[type="search"]::-webkit-search-cancel-button {
    display: none;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    margin-left: auto;
}

.nav-persona,
.nav-persona-menu {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    color: var(--header-text-2, var(--text-2));
    --current-text-shadow: var(--header-text-shadow, var(--text-2-shadow));
}
.nav-persona {
    gap: 0.75rem;
}
.nav-persona a,
.nav-persona-menu a {
    color: var(--header-text-2, var(--text-2));
    --current-text-shadow: var(--header-text-shadow, var(--text-2-shadow));
    text-decoration: none;
}
.nav-persona a:hover,
.nav-persona-menu a:hover {
    color: var(--header-text, var(--text));
    --current-text-shadow: var(--header-text-shadow, var(--text-shadow));
    text-decoration: none;
}

.nav-persona-link {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.nav-persona-menu {
    position: relative;
}

.nav-persona-trigger {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.15rem;
    max-width: 16rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--header-border);
    border-radius: 999px;
    background: var(--header-surface-up);
    color: var(--header-text, var(--text));
    --current-text-shadow: var(--header-text-shadow, var(--text-shadow));
    cursor: pointer;
    list-style: none;
}

.nav-persona-trigger::-webkit-details-marker {
    display: none;
}

.nav-persona-trigger::after {
    content: "v";
    color: var(--header-text-2, var(--text-2));
    font-size: 0.75rem;
    line-height: 1;
}

.nav-persona-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-persona-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    display: none;
    width: min(18rem, calc(100vw - 2rem));
    padding: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-up);
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.32);
}

.nav-persona-menu[open] .nav-persona-dropdown {
    display: block;
}

.nav-persona-dropdown-section {
    padding: 0.35rem 0;
}

.nav-persona-dropdown-section + .nav-persona-dropdown-section {
    border-top: 1px solid var(--border);
}

.nav-persona-dropdown-link,
.nav-persona-option {
    display: block;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
    font: inherit;
    text-align: left;
}

.nav-persona-dropdown-link:hover,
.nav-persona-option:hover,
.nav-persona-option--active {
    background: var(--surface);
}

.nav-persona-option span,
.nav-persona-option small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-persona-option small {
    margin-top: 0.15rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.78rem;
}

.nav-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--header-border);
    flex-shrink: 0;
}

.nav-avatar--glyph {
    background: var(--header-surface-up);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}

.main {
    flex: 1;
    width: calc(100% - 2rem);
    max-width: none;
    margin: 0 auto;
    padding: 1rem var(--main-inline-padding) 4rem;
}

.site-footer {
    width: 100%;
    max-width: none;
    margin: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1.1rem 2rem;
    background: rgba(10, 5, 1, 0.96);
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text);
    box-shadow: 0 -1px 0 color-mix(in srgb, var(--accent) 6%, transparent);
}
.site-footer p {
    margin: 0;
}
.site-footer a {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}
.site-footer a:hover {
    color: var(--accent-h);
    --current-text-shadow: var(--accent-shadow);
}

/* ── Flash ────────────────────────────────────────────────────────────────── */

.flash {
    padding: 0.7rem 1.5rem;
    font-size: 0.98rem;
    text-align: center;
}
.flash-notice {
    background: var(--accent-dim);
    color: var(--accent-h);
    --current-text-shadow: var(--accent-shadow);
}
.flash-alert {
    background: var(--red-dim);
    color: var(--red);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    line-height: 1;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s,
        border-color 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-text);
    --current-text-shadow: var(--accent-text-shadow);
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-h);
    border-color: var(--accent-h);
    color: var(--accent-text);
    --current-text-shadow: var(--accent-text-shadow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    border-color: var(--border-hi);
}
.btn-ghost:hover {
    background: var(--surface-up);
    color: var(--text);
    border-color: var(--border-hi);
}

.btn-danger {
    background: transparent;
    color: var(--red);
    border-color: var(--red);
}
.btn-danger:hover {
    background: var(--red-dim);
    color: var(--red);
}

.btn-uphold {
    background: transparent;
    color: var(--green);
    border-color: var(--green);
}
.btn-uphold:hover {
    background: color-mix(in srgb, var(--green) 18%, transparent);
    color: var(--green);
}

.btn-overturn {
    background: transparent;
    color: var(--red);
    border-color: var(--red);
}
.btn-overturn:hover {
    background: var(--red-dim);
    color: var(--red);
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    padding: 0;
    font-size: inherit;
    cursor: pointer;
    text-decoration: none;
}
.btn-link:hover {
    color: var(--text);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.88rem;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */

.form-page {
    width: 100%;
    max-width: none;
    margin: 0;
}
.form-page h1 {
    font-size: 1.65rem;
    margin-bottom: 1.75rem;
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
    margin-bottom: 1.1rem;
}
.form-row .form-group {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.95rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.required {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}

.form-input {
    width: 100%;
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    color: var(--control-text);
    --current-text-shadow: var(--control-text-shadow);
    font-family: inherit;
    font-size: 0.9375rem;
    padding: 0.55rem 0.75rem;
    transition: border-color 0.15s;
    appearance: none;
}
.form-input:focus {
    outline: none;
    border-color: var(--control-border-strong);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.form-input::placeholder {
    color: var(--control-placeholder);
    --current-text-shadow: var(--control-placeholder-shadow);
    font-weight: 600;
}
.form-input[type="file"] {
    padding: 0.45rem 0.75rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    cursor: pointer;
}

.form-select {
    cursor: pointer;
}
.form-select option {
    background: var(--surface-up);
    color: var(--text);
}

.form-textarea {
    resize: vertical;
    min-height: 5rem;
}

.form-hint {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
}
.form-hint-link {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

.form-group--checkbox {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0;
}
.form-group--checkbox label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}
.form-group--checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    outline: 1px solid var(--control-border);
    outline-offset: 2px;
}

.form-errors {
    background: var(--red-dim);
    border: 1px solid var(--red);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}
.form-error {
    color: var(--red);
    font-size: 0.875rem;
    line-height: 1.5;
}

.field-error {
    color: var(--red);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.form-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

.form-footer .form-actions {
    margin-top: 0;
    margin-left: auto;
}

@media (max-width: 640px) {
    .form-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .form-footer .form-actions {
        justify-content: flex-end;
        margin-left: 0;
    }
}

/* ── Alert ────────────────────────────────────────────────────────────────── */

.alert {
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
.alert-error {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid var(--red);
}

/* ── Auth ─────────────────────────────────────────────────────────────────── */

.auth-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 2rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.auth-card {
    background: var(--surface-up);
    border: 2px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: 2.5rem 3rem;
    width: 100%;
    max-width: 700px;
    backdrop-filter: blur(18px) saturate(1.25) brightness(1.05);
    -webkit-backdrop-filter: blur(18px) saturate(1.25) brightness(1.05);
}

.auth-card--centered {
    text-align: center;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-glyph {
    font-size: 2rem;
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.auth-sub {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.9rem;
}

.auth-form .form-group {
    margin-bottom: 1rem;
}

.auth-footer-link {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}
.auth-footer-link a {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}

/* ── Modist Grid ──────────────────────────────────────────────────────────── */

.page-header {
    margin-bottom: 1.75rem;
}
.page-header h1 {
    font-size: 1.5rem;
}
.page-subtitle {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.about-page {
    max-width: 920px;
}

.about-copy {
    display: grid;
    gap: 1rem;
    color: var(--text);
    font-size: 1.08rem;
    line-height: 1.75;
}

.about-copy p {
    max-width: 72ch;
}

.home-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.775rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    text-decoration: none;
    transition:
        border-color 0.12s,
        color 0.12s;
}
.home-cat-pill:hover {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    border-color: var(--accent-dim);
    text-decoration: none;
}

.home-cat-count {
    font-size: 0.68rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    font-variant-numeric: tabular-nums;
}

.modist-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.home-activity-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    box-sizing: border-box;
    padding-right: 1.5rem;
}

.home-activity-empty {
    margin-top: 0;
}

@media (max-width: 960px) {
    .home-activity-page {
        padding-right: 0;
    }
}

.metamod-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
}

.metamod-context a {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

.metamod-context a::before {
    content: "/";
    margin-right: 0.35rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
}

/* Card columns follow the content column width (sidebar-aware), not viewport alone. */
.page-layout > :first-child,
.browse-page,
.profile-page {
    container-type: inline-size;
    container-name: card-grid;
}

/* Card columns scale with the content column's width so screenshots stay a
   sane size instead of stretching to fill whatever room is available. */
@container card-grid (max-width: 520px) {
    .modist-grid {
        grid-template-columns: 1fr;
    }
}

/* Pages with the sidebar visible (>=960px viewport) cap the content column
   at .page-layout's max-width minus the sidebar, so these thresholds are
   tuned against measured container widths, not viewport width — and kept
   well below the "typical" window width they target, since actual usable
   viewport varies a lot with browser chrome (vertical tab sidebars, devtools,
   etc). 700px hits on most laptop windows, 1300px around a ~1920px display,
   1650px around a ~2360px-wide (or ultrawide) window, up to the sidebar
   layout's ceiling. */
@container card-grid (min-width: 700px) {
    .modist-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@container card-grid (min-width: 1300px) {
    .modist-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@container card-grid (min-width: 1650px) {
    .modist-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.modist-card {
    display: flex;
    flex-direction: column;
    container-type: inline-size;
    font-size: clamp(1.12rem, 1rem + 0.22cqw, 1.18rem);
    background: var(--surface-up);
    border: 2px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(18px) saturate(1.25) brightness(1.05);
    -webkit-backdrop-filter: blur(18px) saturate(1.25) brightness(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition:
        border-color 0.15s,
        transform 0.15s,
        box-shadow 0.15s;
}
/* Lift up and to the right, shadow falling down-left to match. */
.modist-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: translate(4px, -5px);
    box-shadow: -6px 10px 20px rgba(0, 0, 0, 0.38);
}

.modist-card-preview {
    display: block;
    flex-shrink: 0;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--surface);
}
.modist-card-preview--journal {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding: 1rem;
    gap: 0.75rem;
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, transparent), rgba(0, 0, 0, 0.08));
}
.modist-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 0%;
    transition: object-position 0.2s;
}
.modist-card-preview--journal .modist-card-journal-excerpt {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text);
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* Screenshot strip for card previews. Horizontal navigation will be handled
   separately; hover only pans the visible screenshot vertically. */
.card-shots-track {
    display: flex;
    width: 100%;
    height: 100%;
}
.card-shots-track img {
    flex: 0 0 100%;
    min-width: 100%;
}

.modist-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.72em, 0.64em + 0.22cqw, 0.84em);
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.modist-card-meta {
    flex: 1 1 auto;
    padding: 0.8rem 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.42em;
    background: var(--surface-up);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.modist-card-meta-top {
    min-width: 0;
}

.modist-card-title {
    min-width: 0;
    font-size: clamp(1.02em, 0.92em + 0.42cqw, 1.22em);
    font-weight: 600;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
    line-height: 1.4;
}
.modist-card-title:hover {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    text-decoration: none;
}

.modist-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    /* Actions live at the bottom of the card; auto margin pins them there so
       they align across a grid row even when titles/tags differ in height. */
    margin-top: auto;
    padding-top: 0.45rem;
}

.modist-card-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.42em;
    min-width: 0;
    padding: 0.52em 0.82em;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
    color: var(--accent-h);
    --current-text-shadow: var(--accent-shadow);
    font-size: clamp(0.72em, 0.64em + 0.18cqw, 0.84em);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-decoration: none;
    white-space: nowrap;
}

.modist-card-download:hover {
    color: var(--accent-h);
    --current-text-shadow: var(--accent-shadow);
    text-decoration: none;
    background: color-mix(in srgb, var(--accent) 20%, transparent);
    border-color: color-mix(in srgb, var(--accent) 34%, transparent);
}

.modist-card-author-row {
    display: flex;
    align-items: center;
    gap: 0.5em;
    min-width: 0;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid rgba(5, 5, 6, 0.16);
}

.modist-card-author {
    display: flex;
    align-items: center;
    gap: 0.38em;
    font-size: clamp(0.86em, 0.76em + 0.28cqw, 1.02em);
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    font-weight: 750;
    text-decoration: none;
    min-width: 0;
    flex: 1 1 auto;
    max-width: 100%;
    justify-content: flex-start;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modist-card-category {
    flex: 0 1 34%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(0.68em, 0.6em + 0.16cqw, 0.78em);
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.modist-card-author:hover {
    color: var(--accent-h);
    --current-text-shadow: var(--accent-shadow);
    text-decoration: none;
}

.modist-card-avatar {
    width: 1.15em;
    height: 1.15em;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.modist-card-counts {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.76em;
    font-size: clamp(0.68em, 0.6em + 0.18cqw, 0.8em);
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.modist-card-counts span {
    color: inherit;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.28em;
}

.modist-card-counts .phosphor-icon {
    width: 1.08em;
    height: 1.08em;
    flex-shrink: 0;
}

.modist-card-download .phosphor-icon {
    width: 1.08em;
    height: 1.08em;
    flex-shrink: 0;
}

.modist-card-tags {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.32em;
    margin-top: 0.1em;
    overflow: hidden;
}

.card-tag {
    display: inline-block;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(0.66em, 0.58em + 0.18cqw, 0.78em);
    font-family: var(--mono);
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 0.14em 0.48em;
    text-decoration: none;
    transition:
        color 0.12s,
        border-color 0.12s,
        background 0.12s;
}
.card-tag:hover {
    color: var(--accent-text);
    --current-text-shadow: var(--accent-text-shadow);
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    text-decoration: none;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 2px solid #000;
    border-radius: var(--radius-lg);
}
.breadcrumb a {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    text-decoration: none;
}
.breadcrumb a:hover {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    font-weight: 700;
}
.breadcrumb span:last-child {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    font-weight: 700;
}
.breadcrumb-sep {
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    user-select: none;
}

/* ── Modist Detail ────────────────────────────────────────────────────────── */

.modist-show {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.modist-show--journal {
    display: block;
    max-width: 44rem;
    margin: 0 auto;
}

.modist-show-breadcrumb {
    margin-bottom: 1rem;
}

.modist-show-card-preview--journal {
    min-height: 10rem;
    padding: 1.35rem 1.25rem;
}

.modist-show-card-preview--journal .modist-card-journal-excerpt {
    -webkit-line-clamp: 6;
    font-size: 1rem;
}

.modist-show--journal .journal-article-body {
    margin-top: 0;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text);
}

.modist-show--skin {
    display: block;
    max-width: 44rem;
    margin: 0 auto;
}

.modist-show-card {
    pointer-events: auto;
}

.modist-show-card:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.06);
}

.modist-show-card-preview {
    position: relative;
    aspect-ratio: unset;
    min-height: 0;
    overflow: visible;
    background: var(--surface);
}

.modist-show-card-preview .carousel {
    width: 100%;
}

.modist-show-card-preview .carousel-stage {
    aspect-ratio: unset;
    min-height: 28rem;
    max-height: min(78vh, 52rem);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 0;
    background: var(--surface);
}

.modist-show-card-preview .carousel-main-img {
    width: 100%;
    height: auto;
    max-height: min(78vh, 52rem);
    object-fit: contain;
    object-position: center top;
}

.modist-show-card-preview .carousel-strip {
    padding: 0.5rem 0.75rem 0.65rem;
    background: var(--surface);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.modist-show-card-preview .carousel-thumb {
    width: 4.5rem;
    height: 4.5rem;
}

.modist-show-card-preview .modist-card-placeholder {
    min-height: 28rem;
}

.modist-show-card-preview .card-draft-badge {
    position: absolute;
    top: 0.65rem;
    left: 0.65rem;
    z-index: 2;
}

.modist-show-card-body {
    gap: 0.85rem;
    padding: 1rem 1rem 1.15rem;
}

.modist-show-card-body .modist-title {
    font-size: 1.35rem;
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
}

.modist-show-card-author {
    background: transparent;
    border: none;
    padding: 0.35rem 0 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 0.15rem;
}

.journal-main {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

@media (max-width: 960px) {
    .modist-show {
        grid-template-columns: 1fr;
    }
    .modist-show-card-preview .carousel-stage {
        min-height: 22rem;
    }
}

.modist-show--journal .page-sidebar {
    padding-top: 0;
}

.modist-show--journal .breadcrumb {
    margin-bottom: 0;
}

.journal-article-card {
    padding: 1.35rem 1.4rem;
}

.journal-article-header {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.modist-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.modist-header-top .modist-title {
    flex: 1 1 auto;
    margin-bottom: 0;
}

.modist-header-top form {
    flex: 0 0 auto;
}

.modist-show--journal .journal-article-body {
    margin-top: 1rem;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text);
}

.modist-show--journal .journal-article-body a {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}

.modist-show--journal .journal-article-body strong {
    color: var(--text);
}

.modist-preview-area {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    border: 2px solid #000;
    aspect-ratio: 4/3;
}

.modist-preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modist-preview-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
}

.modist-info {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modist-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.modist-title {
    font-size: 1.35rem;
    flex: 1 1 100%;
}

.modist-category-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--accent-dim);
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.draft-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--surface-up);
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.modist-license-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--surface-up);
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.modist-fork-notice {
    font-size: 0.82rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    margin-top: -0.25rem;
}
.modist-fork-notice a {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}
.modist-fork-notice a:hover {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}

.modist-license-text {
    padding: 0.85rem 1rem;
    background: var(--surface-up);
    border: 2px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.86rem;
    line-height: 1.55;
    backdrop-filter: blur(18px) saturate(1.25) brightness(1.05);
    -webkit-backdrop-filter: blur(18px) saturate(1.25) brightness(1.05);
}

.modist-license-text strong {
    display: block;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.modist-license-text p {
    margin: 0;
}

.modist-byline {
    font-size: 0.85rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}
.modist-byline a {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}
.modist-byline a:hover {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}

.modist-description {
    font-size: 0.9375rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    line-height: 1.65;
}
.modist-description p {
    margin: 0 0 0.6em;
}
.modist-description p:last-child {
    margin-bottom: 0;
}
.modist-description a {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}
.modist-description strong {
    color: var(--text);
}

.modist-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.modist-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.modist-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.modist-actions form {
    display: contents;
}
.modist-actions .btn {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}

.btn-favorited {
    background: var(--accent-dim);
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    border-color: var(--accent-dim);
}
.btn-favorited:hover {
    background: var(--surface-up);
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    border-color: var(--border-hi);
}

.modist-author-card {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    padding: 1rem;
    background: var(--surface-up);
    border: 2px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(18px) saturate(1.25) brightness(1.05);
    -webkit-backdrop-filter: blur(18px) saturate(1.25) brightness(1.05);
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.author-info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.author-handle {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    text-decoration: none;
}
.author-handle:hover {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    text-decoration: none;
}

.author-bio {
    font-size: 0.825rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    line-height: 1.5;
}

/* ── Modist Form ──────────────────────────────────────────────────────────── */

.modist-form {
    margin-top: 1.5rem;
}

.upload-target-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    margin-bottom: 1.1rem;
}

.upload-target-grid .form-group {
    margin-bottom: 0;
}

.upload-target-grid .form-label {
    margin-bottom: 0.5rem;
}

.license-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    margin-bottom: 1.1rem;
}

.license-textarea {
    min-height: 7.5rem;
}

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

.file-drop-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 11rem;
    padding: 1rem;
    background: var(--control-bg);
    border: 2px dashed var(--control-border);
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    transition:
        border-color 0.15s,
        background 0.15s;
    text-align: center;
    overflow: visible;
}
.file-drop-zone:hover,
.file-drop-zone:focus-within {
    border-color: var(--control-border-strong);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.file-drop-zone.drag-over {
    border-color: var(--control-border-strong);
    --current-text-shadow: var(--accent-shadow);
    background: color-mix(in srgb, var(--accent) 8%, var(--surface-up));
}
.file-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 0;
}
.file-drop-icon {
    font-size: 1.65rem;
    line-height: 1;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    pointer-events: none;
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
}
.file-drop-label {
    font-size: 0.9rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    pointer-events: none;
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
}
.file-drop-label strong {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}
.file-drop-name {
    font-size: 0.82rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    pointer-events: none;
    width: 100%;
    max-height: 2.6rem;
    overflow: hidden;
    word-break: break-word;
    position: relative;
    z-index: 1;
}

.file-drop-preview {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.7rem;
    max-width: 100%;
    max-height: none;
    overflow: visible;
    pointer-events: none;
    position: relative;
    z-index: 1;
}

.file-drop-preview img {
    width: 122px;
    height: 92px;
    object-fit: cover;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.file-drop-preview--initial {
    pointer-events: auto;
    width: 100%;
    margin-top: 0;
    padding: 0.75rem 0.75rem 0.85rem;
    background: var(--surface-up);
    border: 0;
    border-radius: 0;
}

.file-drop-preview--initial .attachment-card {
    padding: 0;
    background: transparent;
    border: 0;
    margin: 0;
}

.file-drop-preview--initial .screenshot-thumb-preview {
    width: 76px;
    height: 58px;
    display: block;
}

.attachment-card__name {
    font-size: 0.72rem;
    line-height: 1.2;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-drop-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--surface-up);
}

.file-drop-lightbox__img {
    max-width: min(92vw, 1400px);
    max-height: 88vh;
    object-fit: contain;
    background: var(--surface);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
}

.file-drop-lightbox__close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: var(--surface-up);
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.file-drop-lightbox__close:hover {
    border-color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}

.attachment-card {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    overflow: visible;
}

.attachment-card--file {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--surface-up);
    border-radius: var(--radius);
}

.attachment-card__remove {
    position: absolute;
    top: -0.55rem;
    right: -0.55rem;
    width: 1.45rem;
    height: 1.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-hi);
    border-radius: 999px;
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}
.attachment-card__remove:hover {
    border-color: var(--red);
    color: var(--red);
}

.attachment-file-body {
    display: grid;
    gap: 0.1rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.82rem;
    min-width: 0;
}

.attachment-file-body strong {
    color: var(--text);
    font-weight: 600;
    word-break: break-word;
}

.replace-fields {
    padding: 0;
    background: transparent;
    border: 0;
}

@media (max-width: 720px) {
    .upload-target-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Page layout (content + sidebar) ─────────────────────────────────────── */

.page-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.5rem;
    align-items: start;

    max-width: 2400px;
    margin: 0 auto;
}

.page-layout > * {
    min-width: 0;
}

@media (max-width: 960px) {
    .page-layout {
        grid-template-columns: 1fr;
    }
    .page-layout .page-sidebar {
        display: none;
    }
}

.page-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-top: 1.6em;
    position: sticky;
    top: var(--filter-bar-top, 53px);
    font-family: "Helvetica Neue", "Arial Nova", Arial, sans-serif;
}

.sidebar-info-card {
    padding: 1.1rem 1.2rem;
    background: var(--surface-up);
    border: 2px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    backdrop-filter: blur(18px) saturate(1.25) brightness(1.05);
    -webkit-backdrop-filter: blur(18px) saturate(1.25) brightness(1.05);
}

.sidebar-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
}

.sidebar-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
    letter-spacing: -0.01em;
}

.sidebar-description {
    font-size: 1rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    line-height: 1.6;
}

.sidebar-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.95rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    justify-content: center;
    text-align: center;
}
.sidebar-stats a {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    text-decoration: none;
}
.sidebar-stats a:hover {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}
.sidebar-stats strong {
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
}

.date-range-picker-row {
    display: flex;
    justify-content: flex-end;
}

.sidebar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    align-items: stretch;
}
.sidebar-actions .btn {
    min-width: 9.5rem;
    min-height: 2.25rem;
}
.sidebar-actions form {
    display: contents;
}

.btn-sidebar-browse {
    background: transparent;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    border-color: var(--border-hi);
}
.btn-sidebar-browse:hover {
    background: var(--surface-up);
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
    border-color: var(--text-2);
}

.btn-sidebar-submit {
    background: transparent;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    border-color: var(--accent);
}
.btn-sidebar-submit:hover {
    background: var(--surface-up);
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
    border-color: var(--accent-h);
}

.sidebar-category-nav {
    padding: 0.85rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.sidebar-category-nav-heading {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #888898;
    --current-text-shadow: rgba(119, 119, 103, 0.55);
    margin-bottom: 0.4rem;
}

.sidebar-category-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    color: #c0c0cc;
    --current-text-shadow: rgba(63, 63, 51, 0.55);
    text-decoration: none;
}
.sidebar-category-link:hover {
    background: var(--surface-up);
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
}
.sidebar-category-link.is-active {
    background: var(--surface-up);
    color: var(--text);
}

.sidebar-category-count {
    font-size: 0.88rem;
    color: rgba(248, 191, 138, 0.96);
    --current-text-shadow: rgba(7, 64, 117, 0.55);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.sidebar-category-link .sidebar-category-count {
    flex: 0 0 auto;
    min-width: 4ch;
    text-align: left;
}

.sidebar-category-link.is-active .sidebar-category-count {
    color: rgba(248, 191, 138, 0.96);
    --current-text-shadow: rgba(7, 64, 117, 0.55);
}

/* ── Browse ───────────────────────────────────────────────────────────────── */

.browse-page {
    padding-top: 1.38em;
}

.browse-empty-state {
    margin: 0 0 2rem;
    padding: 2rem 1.5rem;
    border: 1px solid var(--border-hi);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, transparent), rgba(22, 22, 24, 0.98)),
        var(--surface);
    box-shadow: 0 12px 32px -24px rgba(0, 0, 0, 0.7);
}

.browse-empty-state h2 {
    margin-bottom: 0.75rem;
    font-size: 1.55rem;
    color: var(--text);
}

.browse-empty-state p {
    max-width: 60ch;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

.browse-empty-state p + p {
    margin-top: 0.85rem;
}

/* ── Profile ──────────────────────────────────────────────────────────────── */

.profile-page {
    width: 100%;
    padding-top: 1.38em;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
}

.profile-hero {
    gap: 1.1rem;
}

.profile-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.profile-hero-identity {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    min-width: 0;
    flex: 1;
}

.profile-hero-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
    box-shadow: 0 10px 28px -16px rgba(0, 0, 0, 0.65);
}

.profile-hero-avatar--placeholder {
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 55%),
        rgba(24, 12, 4, 0.92);
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    font-size: 2rem;
}

.profile-hero-copy {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.profile-hero-kicker {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}

.profile-hero-handle {
    font-size: clamp(1.75rem, 4vw, 2.35rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
}

.profile-hero-display-name {
    font-size: 1.05rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

.profile-hero-bio {
    max-width: 62ch;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.98rem;
    line-height: 1.65;
    margin-top: 0.25rem;
}

.profile-hero-bio--empty {
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
}

.profile-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: flex-end;
    align-items: center;
}

.profile-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.profile-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.18);
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.86rem;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}

.profile-stat-pill:hover {
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
    text-decoration: none;
}

.profile-stat-pill strong {
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
    font-weight: 700;
}

.profile-section {
    display: grid;
    gap: 1rem;
}

.profile-section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.profile-section-title {
    font-size: 1.15rem;
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
}

.profile-section-lede {
    margin-top: 0.2rem;
    font-size: 0.9rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
}

.profile-activity-graph {
    height: 52px;
    margin: 0;
}

.profile-activity-legend {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: #888898;
    --current-text-shadow: rgba(119, 119, 103, 0.55);
}

.profile-activity-legend-cell {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.profile-owner-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.92rem;
}

.profile-empty {
    margin: 0;
    padding: 2.5rem 1.5rem;
    border: 1px solid var(--border-hi);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, transparent), rgba(22, 22, 24, 0.98)),
        var(--surface);
    box-shadow: 0 12px 32px -24px rgba(0, 0, 0, 0.7);
    text-align: center;
}

.profile-empty-glyph {
    font-size: 1.75rem;
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    margin-bottom: 0.75rem;
}

.profile-empty h2 {
    margin-bottom: 0.65rem;
    font-size: 1.45rem;
    color: var(--text);
}

.profile-empty p {
    max-width: 46ch;
    margin-inline: auto;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

.profile-empty p + p {
    margin-top: 1rem;
}

.profile-journal-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.profile-sidebar-nav {
    display: grid;
    gap: 0.35rem;
}

.profile-sidebar-link {
    display: block;
    padding: 0.45rem 0.55rem;
    border-radius: var(--radius);
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.95rem;
    text-decoration: none;
}

.profile-sidebar-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    text-decoration: none;
}

.profile-sidebar-link--active {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}

.profile-subpage-header {
    display: grid;
    gap: 0.65rem;
}

.profile-subpage-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
    letter-spacing: -0.02em;
}

.profile-persona-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@container card-grid (min-width: 640px) {
    .profile-persona-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

.profile-persona-card {
    padding: 0;
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s;
}

.profile-persona-card:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
    transform: translateY(-2px);
}

.profile-persona-card-link {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    color: inherit;
    text-decoration: none;
}

.profile-persona-card-link:hover {
    text-decoration: none;
}

.profile-persona-card-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
}

.profile-persona-card-avatar--placeholder {
    display: grid;
    place-items: center;
    background: rgba(24, 12, 4, 0.92);
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    font-size: 1.4rem;
}

.profile-persona-card-body {
    min-width: 0;
    display: grid;
    gap: 0.25rem;
}

.profile-persona-card-handle {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
}

.profile-persona-card-name {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.92rem;
}

.profile-persona-card-bio {
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    font-size: 0.88rem;
    line-height: 1.5;
}

.profile-header {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.profile-handle {
    font-size: 1.6rem;
    font-weight: 700;
}

.profile-display-name {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.9rem;
}

.profile-bio {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.9375rem;
    line-height: 1.6;
    max-width: 60ch;
}

.profile-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}
.profile-stats a {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    text-decoration: none;
}
.profile-stats a:hover {
    color: var(--text);
}
.profile-stats strong {
    color: var(--text);
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.25rem;
}

.draft-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0 0.4rem;
    min-width: 1.25rem;
    line-height: 1.4;
}

.persona-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}
.persona-list a {
    font-size: 0.9375rem;
}

/* ── Custom Pages ─────────────────────────────────────────────────────────── */

.custom-page-shell {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.custom-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.custom-page-kicker {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.82rem;
    margin-bottom: 0.25rem;
}

.custom-page-header h1 {
    font-size: 1.5rem;
}

.custom-page-draft {
    display: inline-flex;
    margin-bottom: 1rem;
    padding: 0.25rem 0.55rem;
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius);
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    font-size: 0.8rem;
}

.mod-customize-page {
    position: relative;
    min-height: 620px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.mod-widget {
    overflow: hidden;
}

.custom-editor-preview .mod-widget {
    overflow: visible;
}

.mod-widget[data-editor-widget="true"] {
    outline: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
}

.mod-widget-text,
.mod-widget-link,
.mod-widget-music {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0.75rem;
    background: var(--surface-up);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.mod-widget-link {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    text-decoration: none;
}

.mod-widget-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
}

.mod-widget-music {
    color: var(--text);
    border-color: var(--accent-dim);
}

.mod-widget-editor-controls {
    position: absolute;
    inset: -0.2rem -0.2rem auto auto;
    display: flex;
    gap: 0.35rem;
    pointer-events: none;
    z-index: 5;
}

.mod-widget-handle {
    pointer-events: auto;
    border: 1px solid var(--accent);
    background: rgba(13, 13, 15, 0.92);
    color: var(--text);
    border-radius: 999px;
    font-size: 0.72rem;
    padding: 0.3rem 0.5rem;
    cursor: grab;
}

.mod-widget-handle--resize {
    cursor: nwse-resize;
}

.mod-widget-handle:active {
    cursor: grabbing;
}

/* ── Custom Page Editor ───────────────────────────────────────────────────── */

.custom-editor {
    width: min(1280px, 100%);
    margin: 0 auto;
}

.custom-page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: flex-end;
}

.custom-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1rem;
    align-items: start;
}

.custom-editor-preview {
    min-width: 0;
    position: relative;
}

.custom-editor-panel {
    display: grid;
    gap: 1rem;
}

.custom-editor-section,
.custom-editor-widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.custom-editor-section h2 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
}

.custom-editor-widget {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.8rem;
}

.custom-editor-widget h3 {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.custom-editor-widget h3 span {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.75rem;
    font-weight: 500;
}

.transform-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    margin: 0.75rem 0;
}

.transform-grid label {
    display: grid;
    gap: 0.25rem;
}

.transform-grid span,
.checkbox-line {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.78rem;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.45rem;
}

.inline-form {
    margin-top: 0.65rem;
}

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

/* ── Activity graph ───────────────────────────────────────────────────────── */

.activity-graph {
    display: flex;
    width: 100%;
    min-width: 0;
    gap: 2px;
    align-items: stretch;
    height: 28px;
    margin: 1.5rem 0 2rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.activity-graph::-webkit-scrollbar {
    display: none;
}

.activity-cell {
    flex-shrink: 0;
    border-radius: 3px;
    cursor: default;
    transition: opacity 0.1s;
}
.activity-cell:hover {
    opacity: 0.75;
}

.activity-cell--month {
    width: 14px;
}
.activity-cell--week {
    width: 8px;
}
.activity-cell--day {
    width: 5px;
}

.activity-level-0 {
    background: var(--surface-up);
}
.activity-level-1 {
    background: var(--accent-dim);
    opacity: 0.6;
}
.activity-level-2 {
    background: var(--accent-dim);
}
.activity-level-3 {
    background: var(--accent);
    opacity: 0.6;
}
.activity-level-4 {
    background: var(--accent);
}

/* ── Pagination ───────────────────────────────────────────────────────────── */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2.5rem;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

.pagination .btn[aria-disabled="true"] {
    opacity: 0.4;
    pointer-events: none;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */

.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.9375rem;
}

.recordable-empty-state {
    max-width: 36rem;
    margin: 0 auto;
}

.recordable-empty-title {
    margin-bottom: 0.65rem;
    font-size: 1.35rem;
    color: var(--text);
}

.recordable-empty-text {
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.recordable-empty-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ── Settings ─────────────────────────────────────────────────────────────── */

.settings-page {
    width: 100%;
    max-width: none;
}

.settings-title {
    font-size: 1.4rem;
    margin-bottom: 1.75rem;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-form {
    margin-top: 0.5rem;
}

.settings-hint {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.875rem;
    line-height: 1.6;
}

.settings-status {
    font-weight: 600;
}
.settings-status--on {
    color: var(--green);
}

/* ── TOTP / QR ────────────────────────────────────────────────────────────── */

.qr-block {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.qr-code {
    flex-shrink: 0;
    background: #fff;
    border-radius: var(--radius);
    padding: 0.5rem;
}
.qr-code svg {
    display: block;
}

.qr-manual {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.qr-manual-label {
    font-size: 0.8rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.qr-secret {
    font-family: var(--mono);
    font-size: 0.875rem;
    color: var(--text);
    word-break: break-all;
    background: none;
    padding: 0;
}

.totp-input {
    font-size: 1.5rem;
    letter-spacing: 0.5rem;
    font-family: var(--mono);
    text-align: center;
}

/* ── Backup codes ─────────────────────────────────────────────────────────── */

.backup-codes-warn {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--accent-h);
    --current-text-shadow: var(--accent-shadow);
    margin-bottom: 1rem;
}

.backup-codes-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
}

.backup-code {
    font-family: var(--mono);
    font-size: 0.9rem;
    color: var(--text);
    background: var(--surface-up);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.45rem 0.75rem;
    text-align: center;
    letter-spacing: 0.1em;
}

/* ── Error pages ──────────────────────────────────────────────────────────── */

.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 1rem;
    min-height: 50vh;
}

.error-glyph-cluster {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.error-glyph-large {
    font-size: 3rem;
    line-height: 1;
}

.error-code {
    font-size: 4rem;
    font-weight: 800;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    font-family: var(--mono);
    line-height: 1;
    margin-bottom: 0.75rem;
}

.error-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.error-text {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.9375rem;
    max-width: 40ch;
}

/* ── Rich editor ─────────────────────────────────────────────────────────── */

.rich-editor {
    width: 100%;
    min-height: 120px;
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    color: var(--control-text);
    --current-text-shadow: var(--control-text-shadow);
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.6;
    padding: 0.6rem 0.75rem;
    transition: border-color 0.15s;
    outline: none;
}
.rich-editor:focus {
    border-color: var(--control-border-strong);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.rich-editor p {
    margin: 0 0 0.5em;
}
.rich-editor p:last-child {
    margin-bottom: 0;
}
.rich-editor a {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}

lexxy-editor.rich-editor {
    display: block;
    min-height: 180px;
    padding: 0;
    overflow: visible;
    --lexxy-color-canvas: var(--control-bg);
    --lexxy-color-ink: var(--text);
    --lexxy-color-text: var(--text);
    --lexxy-color-text-subtle: var(--text-2);
    --lexxy-color-ink-medium: var(--text-2);
    --lexxy-color-ink-lighter: var(--control-border);
    --lexxy-color-ink-lightest: rgba(255, 255, 255, 0.06);
    --lexxy-color-ink-inverted: #fff;
    --lexxy-color-link: var(--accent);
    --lexxy-color-accent-dark: var(--accent);
    --lexxy-color-accent-medium: var(--accent-h);
    --lexxy-color-selected: color-mix(in srgb, var(--accent) 22%, transparent);
    --lexxy-color-selected-hover: color-mix(in srgb, var(--accent) 32%, transparent);
    --lexxy-focus-ring-color: color-mix(in srgb, var(--accent) 60%, transparent);
    --lexxy-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
    --lexxy-radius: var(--radius);
    --lexxy-toolbar-button-size: 2.3rem;
    background: var(--control-bg);
    border-color: var(--control-border);
}

lexxy-editor.rich-editor:focus-within {
    border-color: var(--control-border-strong);
    --current-text-shadow: var(--accent-shadow);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}

lexxy-editor.rich-editor lexxy-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem;
    padding: 0.35rem;
    background: rgba(16, 16, 18, 0.96);
    border-block-end: 1px solid var(--control-border);
    border-radius: var(--radius) var(--radius) 0 0;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

lexxy-editor.rich-editor .lexxy-editor__toolbar-button {
    min-width: 2.3rem;
    min-height: 2.3rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

lexxy-editor.rich-editor .lexxy-editor__toolbar-button svg {
    width: 1.25rem;
    height: 1.25rem;
}

lexxy-editor.rich-editor
    .lexxy-editor__toolbar-button:hover:not([aria-disabled="true"]) {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-color: color-mix(in srgb, var(--accent) 22%, transparent);
    color: var(--text);
}

lexxy-editor.rich-editor
    .lexxy-editor__toolbar-button:active:not([aria-disabled="true"]),
lexxy-editor.rich-editor .lexxy-editor__toolbar-button[aria-pressed="true"],
lexxy-editor.rich-editor
    .lexxy-editor__toolbar-dropdown
    > .lexxy-editor__toolbar-button[aria-expanded="true"] {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
    color: var(--text);
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 16%, transparent);
}

lexxy-editor.rich-editor .lexxy-editor__toolbar-group-end::after {
    background-color: var(--border);
}

lexxy-editor.rich-editor .lexxy-editor__toolbar-dropdown [data-dropdown-panel] {
    background: var(--surface-up);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    color: var(--text);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

lexxy-editor.rich-editor .lexxy-editor__toolbar-dropdown-list button,
lexxy-editor.rich-editor
    .lexxy-editor__toolbar-dropdown
    [data-dropdown-panel]
    input {
    color: var(--text);
}

lexxy-editor.rich-editor
    .lexxy-editor__toolbar-dropdown
    [data-dropdown-panel]
    input {
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
}

lexxy-editor.rich-editor .lexxy-editor__toolbar-dropdown-list button:hover,
lexxy-editor.rich-editor
    .lexxy-editor__toolbar-dropdown-list
    button[aria-pressed="true"] {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--text);
}

lexxy-editor.rich-editor .lexxy-editor__toolbar-separator {
    background: var(--border);
}

lexxy-editor.rich-editor .lexxy-editor__content {
    min-height: 140px;
    padding: 0.75rem;
    color: var(--text);
    background: var(--surface-up);
    border-radius: 0 0 var(--radius) var(--radius);
}

lexxy-editor.rich-editor
    .lexxy-floating-controls
    .lexxy-floating-controls__group,
lexxy-editor.rich-editor
    lexxy-node-delete-button
    .lexxy-floating-controls__group,
lexxy-editor.rich-editor lexxy-table-tools .lexxy-floating-controls__group {
    background: rgba(16, 16, 18, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.32);
}

.lexxy-prompt-menu {
    background: rgba(16, 16, 18, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
    color: var(--text);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.lexxy-prompt-menu__item {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

.lexxy-prompt-menu__item:hover,
.lexxy-prompt-menu__item[aria-selected] {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--text);
}

.lexxy-prompt-menu__item--empty {
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
}

.lexxy-category-option {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.lexxy-category-option strong {
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.86rem;
}

.lexxy-category-option span {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.78rem;
}

/* ── Card type badge ─────────────────────────────────────────────────────── */

.modist-card-preview {
    position: relative;
}

.card-draft-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.15rem 0.5rem;
    background: var(--surface-up);
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    pointer-events: none;
}

.card-type-badge {
    display: none;
}

/* ── Tags as links ───────────────────────────────────────────────────────── */

.tag {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    background: var(--surface-up);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.78rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-family: var(--mono);
    text-decoration: none;
    transition:
        color 0.12s,
        border-color 0.12s;
}
a.tag:hover {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    border-color: var(--accent-dim);
    text-decoration: none;
}

/* ── Tag filter chip ─────────────────────────────────────────────────────── */

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
    background: var(--accent-dim);
    color: var(--accent-h);
    --current-text-shadow: var(--accent-shadow);
    border-radius: 999px;
    font-size: 0.78rem;
    font-family: var(--mono);
    font-weight: 500;
}

.tag-chip-clear {
    color: var(--accent-h);
    --current-text-shadow: var(--accent-shadow);
    font-size: 0.9rem;
    line-height: 1;
    text-decoration: none;
    font-style: normal;
}
.tag-chip-clear:hover {
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
    text-decoration: none;
}

/* ── Delete modal ────────────────────────────────────────────────────────── */

.delete-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    padding: 0;
    max-width: 440px;
    width: calc(100% - 2rem);
}

.delete-modal::backdrop {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
}

.delete-modal-inner {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.delete-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--red);
}

.delete-modal-body {
    font-size: 0.9rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    line-height: 1.55;
}

.delete-modal-body strong {
    color: var(--text);
    font-family: var(--mono);
}

.delete-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.25rem;
}

.btn-danger:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.btn-danger:disabled:hover {
    background: transparent;
    color: var(--red);
}

/* ── Settings profile grid ───────────────────────────────────────────────── */

.settings-page {
    width: 100%;
    max-width: none;
}

.settings-profile-grid {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 2rem;
    align-items: start;
}

.settings-avatar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.avatar-preview-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
}

.avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    display: block;
}

.avatar-preview--empty {
    background: var(--surface-up);
    border: 2px dashed var(--border-hi);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    text-transform: uppercase;
}

/* ── Filter bar ──────────────────────────────────────────────────────────── */

.filter-bar-sentinel {
    height: 1px;
    margin-top: -1px;
}

.filter-bar {
    display: flex;
    flex-direction: column;
    background: var(--surface-up);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-lg);
    margin: 0.25rem 0 2rem;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    position: sticky;
    top: var(--filter-bar-top, 53px);
    z-index: 90;
    backdrop-filter: blur(18px) saturate(1.25) brightness(1.05);
    -webkit-backdrop-filter: blur(18px) saturate(1.25) brightness(1.05);
    box-shadow:
        0 18px 35px -24px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition:
        margin-top 0.18s ease,
        margin-bottom 0.25s ease,
        transform 0.25s ease,
        border-radius 0.18s ease,
        border-top-color 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease,
        opacity 0.2s ease;
}

.filter-bar.is-oversized.is-retracted {
    transform: translateY(calc(-100% - 0.25rem));
    margin-bottom: calc(2rem - var(--filter-bar-height, 0px));
    opacity: 0;
    pointer-events: none;
}

.filter-bar.is-stuck {
    margin-top: 0;
    border-top: 0;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.filter-bar.is-stuck {
    box-shadow:
        0 18px 35px -24px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Category row and tag row — bottom segment(s), each horizontally scrollable
   and on their own line. When both are present, the tag row drops its own
   top border so they don't double up on a shared divider. */
.filter-cat-row,
.filter-tag-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 0.4rem;
    padding: 0.55rem 0 0.65rem 0.875rem;
    margin-right: 0.875rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.filter-cat-row + .filter-tag-row {
    border-top: 0;
    padding-top: 0;
}

.filter-cat-row::-webkit-scrollbar,
.filter-tag-row::-webkit-scrollbar {
    display: none;
}

.filter-cat-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 650;
    color: var(--text);
    background: rgba(255, 224, 190, 0.12);
    border: 1px solid rgba(255, 224, 190, 0.32);
    text-decoration: none;
    transition:
        color 0.12s,
        border-color 0.12s,
        background 0.12s;
    white-space: nowrap;
    cursor: pointer;
}
.filter-cat-btn:hover {
    background: rgba(255, 224, 190, 0.2);
    border-color: rgba(255, 224, 190, 0.55);
    text-decoration: none;
}
.filter-cat-btn--active {
    background: var(--accent);
    color: var(--accent-text);
    --current-text-shadow: var(--accent-text-shadow);
    border-color: var(--accent);
}
.filter-cat-btn--active:hover {
    background: var(--accent-h);
    border-color: var(--accent-h);
    color: var(--accent-text);
    --current-text-shadow: var(--accent-text-shadow);
}
.filter-cat-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    /* The theme --border disappears against the brown page bg; pills need a
       visibly outlined resting state. */
    border: 1px solid rgba(255, 224, 190, 0.32);
    text-decoration: none;
    transition:
        color 0.12s,
        border-color 0.12s,
        background 0.12s;
    white-space: nowrap;
    cursor: pointer;
}
.filter-cat-pill:hover {
    color: var(--text);
    border-color: rgba(255, 224, 190, 0.55);
    text-decoration: none;
}
.filter-cat-pill--active {
    background: var(--accent);
    color: var(--accent-text);
    --current-text-shadow: var(--accent-text-shadow);
    border-color: var(--accent);
}
.filter-cat-pill--active:hover {
    background: var(--accent-h);
    border-color: var(--accent-h);
    color: var(--accent-text);
    --current-text-shadow: var(--accent-text-shadow);
}

/* Controls row — bottom section, separated by a top border */
.filter-controls-row {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 0.875rem;
    position: relative;
}

.filter-controls-form {
    --filter-primary-control-height: 52px;
    display: grid;
    grid-template-columns: minmax(14rem, 1fr) var(--filter-primary-control-height);
    grid-template-rows: var(--filter-primary-control-height) auto;
    align-items: stretch;
    gap: 0.85rem;
    width: 100%;
    min-width: 0;
    overflow: visible;
}

.filter-left-group {
    display: flex;
    grid-column: 1;
    grid-row: 1;
    align-self: stretch;
    flex: 1 1 0;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.filter-field--category {
    position: relative;
    flex: 0 0 220px;
    min-width: 0;
    overflow: hidden;
}

.filter-right-group {
    display: flex;
    grid-column: 1 / -1;
    grid-row: 2;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.6rem;
    justify-content: flex-start;
    min-width: 0;
    max-width: 100%;
    max-height: 3rem;
    opacity: 1;
    overflow: hidden;
    transition:
        max-width 0.25s ease,
        max-height 0.25s ease,
        opacity 0.2s ease;
}

.filter-field--search {
    flex: 1 1 auto;
    min-width: 14rem;
    height: var(--filter-primary-control-height);
}

/* Chevron toggle — collapses the bar down to just the search field so a
   full-width search is the default, revealing everything else on demand. */
.filter-bar-toggle {
    display: inline-flex;
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: var(--filter-primary-control-height);
    height: var(--filter-primary-control-height);
    padding: 0;
    border-radius: var(--radius);
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    color: var(--control-text);
    --current-text-shadow: var(--control-text-shadow);
    cursor: pointer;
    transition:
        color 0.12s,
        border-color 0.12s,
        background 0.12s;
}
.filter-bar-toggle:hover {
    color: var(--control-text);
    background: var(--control-bg-hover);
    border-color: var(--control-border-strong);
}
.filter-bar-toggle-chevron {
    transition: transform 0.18s ease;
}
.filter-bar.is-expanded .filter-bar-toggle-chevron {
    transform: rotate(180deg);
}

/* Collapsed state — only the search field and toggle show; everything
   else (date/sort controls, category row, tag row) animates shut instead
   of snapping via display:none, and the search field grows to fill the
   row on its own. */
.filter-bar:not(.is-expanded) .filter-right-group {
    max-width: 0;
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.filter-bar:not(.is-expanded) .filter-controls-form {
    row-gap: 0;
}

.filter-bar:not(.is-expanded) .date-range-picker-row,
.filter-bar:not(.is-expanded) .filter-cat-row,
.filter-bar:not(.is-expanded) .filter-tag-row {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    border-top-color: transparent;
    pointer-events: none;
}

.date-range-picker-row,
.filter-cat-row,
.filter-tag-row {
    max-height: 4rem;
    opacity: 1;
    overflow-y: hidden;
    transition:
        max-height 0.25s ease,
        opacity 0.2s ease,
        padding-top 0.25s ease,
        padding-bottom 0.25s ease,
        margin-top 0.25s ease,
        margin-bottom 0.25s ease,
        border-top-color 0.25s ease;
}

.filter-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
}

.filter-actions .btn {
    height: 34px;
    padding-top: 0;
    padding-bottom: 0;
}

.filter-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.filter-input {
    box-sizing: border-box;
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    color: var(--control-text);
    --current-text-shadow: var(--control-text-shadow);
    font-family: inherit;
    font-size: 0.875rem;
    padding: 0.4rem 0.65rem;
    height: 34px;
    transition: border-color 0.15s;
    appearance: none;
    backdrop-filter: blur(12px) saturate(1.2) brightness(1.05);
    -webkit-backdrop-filter: blur(12px) saturate(1.2) brightness(1.05);
}
.filter-input:focus {
    outline: none;
    border-color: var(--control-border-strong);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.filter-input::placeholder {
    color: var(--control-placeholder);
    --current-text-shadow: var(--control-placeholder-shadow);
    font-weight: 600;
}

.filter-search-input {
    width: 100%;
    min-width: 14rem;
    height: var(--filter-primary-control-height);
    font-size: 1.15rem;
    padding-left: 1rem;
    color: var(--control-text);
    --current-text-shadow: var(--control-text-shadow);
    font-weight: 500;
    border-color: var(--control-border);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--control-border) 22%, transparent);
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}
.filter-search-input:hover {
    border-color: var(--control-border-strong);
}
.filter-search-input:focus {
    border-color: var(--control-border-strong);
    color: var(--control-text);
    --current-text-shadow: var(--control-text-shadow);
    box-shadow:
        inset 0 0 0 1px color-mix(in srgb, var(--control-border) 24%, transparent),
        0 0 0 1px color-mix(in srgb, var(--accent) 26%, transparent);
}
.filter-search-input::placeholder {
    color: var(--control-placeholder);
    --current-text-shadow: var(--control-placeholder-shadow);
    font-weight: 750;
    opacity: 0.92;
}
.filter-search-input::-webkit-search-cancel-button {
    display: none;
}

.filter-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 100%;
    height: 36px;
    overflow: hidden;
}

.filter-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 100%;
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    color: var(--control-text);
    --current-text-shadow: var(--control-text-shadow);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0 2.2rem 0 0.85rem;
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 2px 8px rgba(0, 0, 0, 0.18);
    transition: border-color 0.15s;
}

.filter-select:hover {
    border-color: var(--control-border-strong);
}

.filter-select:focus {
    outline: none;
    border-color: var(--control-border-strong);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

.filter-select option {
    background: var(--surface-up);
    color: var(--text);
    font-weight: 500;
}

.filter-select-chevron {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    pointer-events: none;
    line-height: 1;
}


.sort-tabs,
.date-range-tabs {
    display: flex;
    flex: 0 0 auto;
    /*gap: 0.2rem;*/
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    /*padding: 0.2rem;*/
    min-height: 34px;
    align-items: center;
    box-shadow:
        inset 0 0 0 1px color-mix(in srgb, var(--control-border) 20%, transparent),
        0 2px 8px rgba(0, 0, 0, 0.1);
}

.date-range-tabs {
    width: 14.5rem;
    max-width: 100%;
}

.sort-tab,
.date-range-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--control-text);
    --current-text-shadow: var(--control-text-shadow);
    padding: 0 0.62rem;
    border-radius: calc(var(--radius) - 2px);
    text-decoration: none;
    transition:
        background 0.12s,
        color 0.12s,
        transform 0.12s,
        box-shadow 0.12s;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.04);
}
.sort-tab:hover,
.date-range-tab:hover {
    color: var(--control-text);
    --current-text-shadow: var(--control-text-shadow);
    background: var(--control-bg-hover);
    transform: translateY(-1px);
}
.sort-tab.active,
.date-range-tab.active {
    background: var(--accent);
    color: var(--accent-text);
    --current-text-shadow: var(--accent-text-shadow);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent);
    border-color: var(--accent);
}
.date-range-tab.active {
    font-weight: 700;
}

/* Date range "Other" popup trigger */
.date-range-wrap {
    position: relative;
}

button.date-range-tab {
    -webkit-appearance: none;
    appearance: none;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: inherit;
    height: 36px;
    border: none;
    outline: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    color: var(--control-text);
    --current-text-shadow: var(--control-text-shadow);
    background: rgba(255, 255, 255, 0.04);
}

.date-range-tab {
    flex: 1 1 0;
}

.date-range-picker-popup {
    position: static;
    z-index: 110;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border-hi);
    border-radius: var(--radius-lg);
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    white-space: nowrap;
    margin: 0 0.875rem 0.55rem auto;
}

.date-range-picker-popup[hidden] {
    display: none;
}

/* Date range separator */
.date-range-separator {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 0.25rem;
}

.date-range-input {
    font-size: 0.84rem;
    padding: 0.45rem 0.55rem !important;
    height: 36px;
    min-width: 118px;
    background: var(--control-bg) !important;
    border: 1px solid var(--control-border) !important;
    border-radius: calc(var(--radius) - 1px);
}

.filter-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.75rem;
}
.date-range-dash {
    font-size: 0.75rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    padding: 0 0.25rem;
}

.date-range-or {
    font-size: 0.75rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    padding: 0 0.3rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: lowercase;
}

/* Active filter chips — rendered inside .filter-bar below controls row */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 0.875rem 0.875rem;
}

/* ── Comments ────────────────────────────────────────────────────────────── */

.modist-comments {
    margin-top: 2.5rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 2px solid #000;
    border-radius: var(--radius-lg);
    max-width: 780px;
}

.modist-show--journal .modist-comments,
.modist-show-card-comments {
    margin-top: 0.35rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    max-width: none;
    background: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding-left: 0;
    padding-right: 0;
}

.comments-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

.comment {
    display: flex;
    gap: 0.875rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}
.comment:last-of-type {
    border-bottom: none;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    transition: border-color 0.15s;
    text-decoration: none;
}
.comment-avatar:hover {
    border-color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}
.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-avatar-glyph {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    font-size: 0.75rem;
    opacity: 0.6;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
    flex-wrap: wrap;
}

.comment-author {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}
.comment-author:hover {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    text-decoration: none;
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
}

.comment-karma {
    font-size: 0.75rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.05rem 0.35rem;
}

.comment-community-moderation-form {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.comment-moderation-select {
    height: 1.75rem;
    max-width: 10rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-2);
    font: inherit;
    font-size: 0.75rem;
    padding: 0 0.35rem;
}

.comment-text {
    font-size: 0.9375rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    margin: 0;
}

.comment-delete-form {
    margin-left: auto;
}

.comment-delete {
    background: none;
    border: none;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.125rem 0.25rem;
    transition: color 0.15s;
    line-height: 1;
}
.comment-delete:hover {
    color: var(--red);
}

.comment-form {
    display: flex;
    gap: 0.875rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.comment-form-input {
    flex: 1;
    min-width: 0;
}

.comment-input {
    width: 100%;
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    color: var(--control-text);
    --current-text-shadow: var(--control-text-shadow);
    font-family: inherit;
    font-size: 0.9375rem;
    padding: 0.6rem 0.875rem;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.15s;
}
.comment-input:focus {
    outline: none;
    border-color: var(--control-border-strong);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.comment-input::placeholder {
    color: var(--control-placeholder);
    --current-text-shadow: var(--control-placeholder-shadow);
    font-weight: 600;
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.comments-sign-in {
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    text-align: center;
}
.comments-sign-in a {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}
.comments-sign-in a:hover {
    color: var(--accent-h);
    --current-text-shadow: var(--accent-shadow);
}

/* ── Screenshot carousel ─────────────────────────────────────────────────── */

.modist-preview-area {
    /* override aspect-ratio so carousel strip can expand below */
    aspect-ratio: unset;
    overflow: visible;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
}

.carousel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.carousel-stage {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    aspect-ratio: 4/3;
}

.carousel-main-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface-up);
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
    border: none;
    border-radius: var(--radius);
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition:
        opacity 0.15s,
        background 0.15s;
    z-index: 2;
}
.carousel-stage:hover .carousel-btn {
    opacity: 1;
}
.carousel-btn:hover {
    background: color-mix(in srgb, var(--surface-up), black 10%);
}
.carousel-prev {
    left: 0.5rem;
}
.carousel-next {
    right: 0.5rem;
}

.carousel-counter {
    position: absolute;
    bottom: 0.5rem;
    right: 0.625rem;
    font-size: 0.72rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    background: var(--surface-up);
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

.carousel-strip {
    display: flex;
    gap: 0.375rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0.1rem 0;
}
.carousel-strip::-webkit-scrollbar {
    display: none;
}

.carousel-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--border);
    background: var(--surface-up);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.15s;
}
.carousel-thumb:hover {
    border-color: var(--border-hi);
}
.carousel-thumb.is-active {
    border-color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
}
.carousel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* modist-preview-img used for single image (no carousel) */
.modist-preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* single-image wrapper when no carousel */
.modist-show .modist-preview-area > img {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    aspect-ratio: 4/3;
    object-fit: contain;
    width: 100%;
    display: block;
}
.modist-show .modist-preview-area > .modist-preview-placeholder {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--text-3);
    --current-text-shadow: var(--text-3-shadow);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
}

/* ── Lightbox ─────────────────────────────────────────────────────────────── */

.carousel-main-img--zoom,
.modist-preview-img--zoom {
    cursor: zoom-in;
}

.lightbox {
    background: var(--surface-up);
    border: none;
    padding: 0;
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100dvh;
    display: none;
    align-items: center;
    justify-content: center;
}

.lightbox::backdrop {
    background: var(--surface-up);
}

.lightbox[open] {
    display: flex;
}

.lightbox-img {
    max-width: 92vw;
    max-height: 92dvh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.8);
    cursor: zoom-out;
    display: block;
}

.lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1.25rem;
    background: var(--surface-up);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text);
    --current-text-shadow: var(--text-shadow);
    font-size: 1.5rem;
    line-height: 1;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 1;
}

.lightbox-close:hover {
    background: color-mix(in srgb, var(--surface-up), black 10%);
}

/* ── Edit form screenshot thumbnails ─────────────────────────────────────── */

.screenshot-thumb-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.screenshot-thumb-preview {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-up);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    :root {
        --main-inline-padding: 1rem;
    }

    .nav {
        width: 100%;
        gap: 0.75rem;
        padding: 0 1rem;
    }
    .nav-browse {
        display: none;
    }
    .main {
        width: 100%;
        padding: 0.9rem var(--main-inline-padding) 3rem;
    }
    .site-footer {
        width: 100%;
    }
    .filter-controls-form {
        grid-template-columns: minmax(0, 1fr) var(--filter-primary-control-height);
        row-gap: 0.65rem;
    }
    .filter-left-group {
        grid-column: 1;
        grid-row: 1;
        width: auto;
        min-width: 0;
    }
    .filter-right-group {
        grid-column: 1 / -1;
        grid-row: 2;
        width: auto;
        min-width: 0;
    }
    .filter-field--search {
        min-width: 0;
    }
    .filter-right-group {
        justify-content: flex-start;
    }
    .profile-header {
        flex-direction: column;
        gap: 1rem;
    }
    .profile-avatar {
        width: 64px;
        height: 64px;
    }
    .qr-block {
        flex-direction: column;
    }
    .auth-card {
        padding: 1.75rem 1.5rem;
    }
    .settings-profile-grid {
        grid-template-columns: 1fr;
    }
    .settings-avatar-col {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }
    .avatar-preview-wrap {
        width: auto;
    }
    .delete-modal-inner {
        padding: 1.5rem;
    }
}

/* ── Journal ──────────────────────────────────────────────────────────────── */

.journal-page {
    max-width: 720px;
    margin: 0 auto;
}

.journal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.entry-group {
    margin-bottom: 1.5rem;
}

.entry-date-header {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    margin-bottom: 0.5rem;
}

.entry-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.entry-card {
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border);
}

.entry-card-header {
    margin-bottom: 0.3rem;
}

.entry-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
    font-size: 0.75rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

.entry-time {
    font-family: var(--mono);
}

.entry-byline {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}
.entry-byline:hover {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    text-decoration: none;
}

.entry-card-title {
    font-size: 1.05rem;
    font-weight: 600;
}

.entry-card-title a:hover {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    text-decoration: none;
}

.entry-card-excerpt {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0.3rem 0;
}

.entry-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

.entry-card-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.entry-card-link {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}
.entry-card-link:hover {
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    text-decoration: none;
}

.empty-glyph {
    font-size: 1.5rem;
    color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    margin-bottom: 0.75rem;
}

.empty-text {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

/* ── Frosted glass overrides ──────────────────────────────────────────────── */
/* These override the opaque defaults above for the dark translucent theme    */
:root {
    --bg:         rgba(13, 6, 0, 0.0);
    --surface:    rgba(16, 8, 2, 0.70);
    --surface-up: rgba(24, 12, 4, 0.78);
    --border:     rgba(60, 36, 12, 0.55);
    --border-hi:  rgba(90, 52, 18, 0.70);
}

html, body { background: #402314; }

.site-header,
.sidebar-info-card,
.auth-card,
.card, .card-body,
.modist-card,
.filter-bar,
.flash, .flash-notice, .flash-alert,
.site-footer,
dialog, .modal,
.nav-persona,
.nav-persona-menu,
.nav-persona-dropdown,
.activity-graph {
    backdrop-filter: blur(14px) saturate(1.3) brightness(0.85);
    -webkit-backdrop-filter: blur(14px) saturate(1.3) brightness(0.85);
}

.site-header,
.flash,
.flash-notice,
.flash-alert,
.main,
.site-footer {
    position: relative;
    z-index: 1;
}

/* ── Page utilities ───────────────────────────────────────────────────────── */
.main--centered {
    display: flex;
    align-items: center;
    justify-content: center;
}

.main--centered .about-page {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* ── Site theme editor + previews ─────────────────────────────────────────── */

.site-theme-editor-intro {
    margin-bottom: 1rem;
}

.site-theme-preview {
    --preview-bg: #402314;
    --preview-surface: rgba(255, 255, 255, 0.08);
    --preview-accent: #e8671a;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
}

.site-theme-preview--picker {
    margin-bottom: 0;
}

.site-theme-preview-bar {
    height: 2.5rem;
    background: var(--preview-surface);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-theme-preview-panel {
    min-height: 7rem;
    background: var(--preview-bg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}

.site-theme-preview-accent,
.site-theme-show-accent {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: var(--preview-accent, var(--accent));
    border: 2px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.site-theme-preview-text,
.site-theme-show-label {
    color: var(--text);
    font-weight: 600;
}

.site-theme-picker-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
}

.site-theme-picker-main {
    display: grid;
    grid-template-columns: minmax(12rem, 0.95fr) minmax(11rem, 0.8fr) minmax(14rem, 1.05fr) minmax(17rem, 1.15fr);
    gap: 1.25rem;
    align-items: start;
    padding: 1.25rem;
}

.site-theme-wheel-area {
    min-width: 0;
}

.site-theme-picker-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    color: var(--text);
}

.site-theme-color-wheel {
    position: relative;
    width: min(16rem, 100%);
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.72) 0 10%, rgba(255, 255, 255, 0.20) 29%, rgba(255, 255, 255, 0) 30%),
        conic-gradient(from -90deg, hsl(0, 54%, 48%), hsl(45, 54%, 48%), hsl(90, 48%, 40%), hsl(150, 48%, 38%), hsl(210, 54%, 48%), hsl(270, 50%, 52%), hsl(330, 54%, 50%), hsl(360, 54%, 48%));
    border: 1px solid var(--border-hi);
    box-shadow: inset 0 0 0 0.75rem rgba(0, 0, 0, 0.18), 0 1rem 2rem rgba(0, 0, 0, 0.22);
    cursor: grab;
    touch-action: none;
}

.site-theme-color-wheel:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.site-theme-color-wheel:active {
    cursor: grabbing;
}

.site-theme-wheel-point {
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: var(--preview-accent, var(--accent));
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.42), 0 0.35rem 1rem rgba(0, 0, 0, 0.32);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.site-theme-wheel-point--secondary {
    width: 0.95rem;
    height: 0.95rem;
    background: transparent;
    border-width: 3px;
}

.site-theme-picker-settings {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
}

.site-theme-hue-value {
    min-width: 3.5rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

.site-theme-picker-label {
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.site-theme-pattern-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.site-theme-pattern-options legend {
    grid-column: 1 / -1;
    margin-bottom: 0.15rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.site-theme-pattern-option {
    min-width: 0;
}

.site-theme-pattern-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.site-theme-pattern-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 4.5rem;
    gap: 0.65rem;
    align-items: center;
    min-height: 3rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    background: var(--control-bg);
    cursor: pointer;
}

.site-theme-pattern-option input:checked + .site-theme-pattern-body {
    border-color: var(--control-border-strong);
    --current-text-shadow: var(--accent-shadow);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.site-theme-pattern-option input:focus-visible + .site-theme-pattern-body {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.site-theme-pattern-name {
    overflow: hidden;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-theme-pattern-swatches {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: 1.45rem;
    overflow: hidden;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.site-theme-tuning-controls {
    display: grid;
    gap: 0.7rem;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.site-theme-tuning-controls legend {
    margin-bottom: 0.15rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.site-theme-tuning-group {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
    padding: 0.6rem;
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    background: var(--control-bg);
}

.site-theme-tuning-color {
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
}

.site-theme-tuning-group label {
    display: grid;
    grid-template-columns: 2.6rem minmax(0, 1fr) 3.25rem;
    gap: 0.5rem;
    align-items: center;
    min-width: 0;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-size: 0.74rem;
}

.site-theme-tuning-group input[type="range"] {
    width: 100%;
    accent-color: var(--preview-accent, var(--accent));
    outline: 1px solid var(--control-border);
    outline-offset: 0.2rem;
}

.site-theme-tuning-group output {
    color: var(--text);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.site-theme-preview-column {
    display: grid;
    gap: 0.75rem;
    min-width: 0;
}

.site-theme-color-readout {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.site-theme-color-row {
    display: grid;
    grid-template-columns: 1rem minmax(5.5rem, 1fr) minmax(4.8rem, auto);
    gap: 0.5rem;
    align-items: center;
    min-width: 0;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface-up) 62%, transparent);
}

.site-theme-color-chip {
    width: 1rem;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.site-theme-color-name {
    overflow: hidden;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-theme-color-row code {
    overflow: hidden;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-theme-color-row code:nth-of-type(n + 2) {
    grid-column: 2 / -1;
}

.site-theme-picker-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 760px) {
    .site-theme-picker-main {
        grid-template-columns: 1fr;
    }

    .site-theme-pattern-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .site-theme-pattern-body {
        grid-template-columns: 1fr;
    }
}

.site-theme-publish-form {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.card-site-theme-preview {
    display: flex;
    width: 100%;
    height: 100%;
}

.card-site-theme-swatch {
    flex: 1 1 0;
}

.site-theme-show-preview {
    width: 100%;
    min-height: 18rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.site-theme-show-panel {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--surface-up);
    border: 1px solid var(--border);
}

.site-theme-show-accent {
    background: var(--accent);
}

.site-theme-gallery {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-theme-gallery-heading,
.site-theme-custom-heading {
    font-size: 1rem;
    margin: 0 0 0.35rem;
}

.site-theme-gallery-intro {
    margin-bottom: 0.85rem;
}

.site-theme-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0.65rem;
}

.site-theme-gallery-form {
    margin: 0;
}

.site-theme-gallery-item {
    --text: hsl(0, 18%, 92%);
    --text-2: hsl(0, 12%, 62%);
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 7.5rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    overflow: hidden;
    text-align: left;
    font: inherit;
}

.site-theme-gallery-item:hover,
.site-theme-gallery-item:focus-visible {
    border-color: var(--accent);
    --current-text-shadow: var(--accent-shadow);
    box-shadow: 0 0 0 1px var(--accent);
    outline: none;
}

.site-theme-gallery-item--active {
    box-shadow: inset 0 0 0 2px var(--accent);
}

.site-theme-gallery-swatches {
    display: flex;
    height: 2.75rem;
    flex-shrink: 0;
}

.site-theme-gallery-swatch {
    flex: 1 1 0;
}

.site-theme-gallery-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.55rem 0.65rem 0.65rem;
    background: var(--surface-up);
}

.site-theme-gallery-title {
    font-size: 0.82rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.site-theme-gallery-byline {
    font-size: 0.72rem;
    color: var(--text-2);
    --current-text-shadow: var(--text-2-shadow);
}

.site-theme-gallery-hover-preview {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.site-theme-gallery-item:hover .site-theme-gallery-hover-preview,
.site-theme-gallery-item:focus-visible .site-theme-gallery-hover-preview {
    opacity: 1;
}

.site-theme-gallery-hover-bar {
    height: 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.site-theme-gallery-hover-panel {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem;
    background: var(--bg);
}

.site-theme-gallery-hover-accent {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--accent);
    border: 2px solid var(--border-hi);
    flex-shrink: 0;
}

.site-theme-gallery-hover-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

.site-theme-custom-heading {
    margin-top: 0.25rem;
}

.settings-identity-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0.55rem 0 0;
}

.identity-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.55rem;
    padding: 0.18rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-up);
    color: var(--text-2);
    font-size: 0.78rem;
    line-height: 1.2;
    white-space: nowrap;
}

.identity-badge--verified {
    border-color: color-mix(in srgb, var(--accent) 65%, var(--border));
    color: var(--accent);
}

.identity-badge--unclaimed {
    border-style: dashed;
}

.settings-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.settings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.settings-table th,
.settings-table td {
    padding: 0.7rem 0.65rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.settings-table th {
    color: var(--text-2);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.settings-muted {
    display: block;
    margin-top: 0.15rem;
    color: var(--text-2);
    font-size: 0.78rem;
}

.settings-actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.member-list {
    display: grid;
    gap: 0.65rem;
}

.member-row {
    display: grid;
    grid-template-columns: minmax(10rem, 1fr) minmax(18rem, 1.5fr) auto;
    align-items: start;
    gap: 0.65rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-up);
}

.member-row-form {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) minmax(9rem, 1fr) auto;
    gap: 0.45rem;
    margin: 0;
}

.persona-management-list {
    display: grid;
    gap: 0.75rem;
}

.persona-management-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-up);
}

.persona-management-row h3 {
    margin: 0;
    font-size: 1rem;
}

.persona-management-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
}

.review-request-list {
    display: grid;
    gap: 0.85rem;
}

.review-request-row {
    display: grid;
    grid-template-columns: minmax(14rem, 1fr) minmax(16rem, 0.75fr);
    gap: 1rem;
}

.review-request-main h2 {
    margin-top: 0.45rem;
}

.review-request-actions {
    display: grid;
    gap: 0.65rem;
}

.settings-inline-grid {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) minmax(9rem, 0.45fr) minmax(10rem, 0.55fr);
    gap: 0.8rem;
}

.member-add-form {
    margin-top: 1rem;
}

.moderation-review-form {
    display: grid;
    gap: 0.45rem;
    margin: 0 0 0.7rem;
}

.moderation-target-card,
.visibility-panel {
    margin-top: 1rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-up);
}

.moderation-target-card h3 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
}

.moderation-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.75rem;
}

.report-work-form {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
}

.report-work-form .form-select {
    width: auto;
    min-width: 7rem;
}

.discussion-mod-controls--expanded {
    display: grid;
    gap: 0.55rem;
    justify-items: end;
}

.discussion-button-row,
.discussion-settings-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: flex-end;
    gap: 0.45rem;
}

.discussion-settings-form {
    margin: 0;
}

.discussion-settings-form label {
    display: grid;
    gap: 0.15rem;
    color: var(--text-2);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.discussion-settings-form .form-input {
    width: 5.5rem;
    min-height: 2rem;
    padding: 0.25rem 0.4rem;
}

@media (max-width: 720px) {
    .settings-inline-grid {
        grid-template-columns: 1fr;
    }

    .member-row,
    .member-row-form {
        grid-template-columns: 1fr;
    }

    .persona-management-row {
        align-items: stretch;
        flex-direction: column;
    }

    .persona-management-actions {
        justify-content: flex-start;
    }

    .review-request-row {
        grid-template-columns: 1fr;
    }

    .report-work-form {
        display: flex;
        width: 100%;
    }

    .report-work-form .form-select {
        flex: 1 1 auto;
    }

    .discussion-mod-controls--expanded,
    .discussion-button-row,
    .discussion-settings-form {
        justify-items: stretch;
        justify-content: stretch;
    }

    .discussion-settings-form label,
    .discussion-settings-form .form-input {
        width: 100%;
    }
}
