/* ==========================================================================
   Booru engine stylesheet

   Single file on purpose: one request, no build step, and small enough that
   inlining it would be an option later. Layout is CSS grid; theming is done
   with custom properties so the light/dark switch costs one attribute change
   rather than a second stylesheet.
   ========================================================================== */

/* --------------------------------------------------------------- tokens --- */

:root {
    --bg:            #12141a;
    --bg-raised:     #191c24;
    --bg-sunken:     #0d0f14;
    --border:        #262a35;
    --border-strong: #333846;

    --text:          #e6e8ee;
    --text-muted:    #98a0b3;
    --text-faint:    #6b7385;

    --accent:        #5b8cff;
    --accent-hover:  #7aa2ff;
    --accent-text:   #ffffff;

    --danger:        #ef4d5a;
    --success:       #34c77b;
    --warning:       #e8a33d;

    --tag-general:   #8fb8ff;
    --tag-artist:    #ff8a5c;
    --tag-copyright: #d98cff;
    --tag-character: #5fd18a;
    --tag-metadata:  #ffd166;
    --tag-deprecated:#7a8296;

    --radius:     8px;
    --radius-sm:  5px;
    --shadow:     0 1px 2px rgba(0,0,0,.35), 0 4px 16px rgba(0,0,0,.22);

    --thumb-size: 180px;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="light"] {
    --bg:            #f6f7f9;
    --bg-raised:     #ffffff;
    --bg-sunken:     #eceef2;
    --border:        #dde0e7;
    --border-strong: #c6cbd6;

    --text:          #1b1f28;
    --text-muted:    #5b6376;
    --text-faint:    #858da0;

    --accent:        #2f6bdd;
    --accent-hover:  #1f56c2;

    --tag-general:   #2f6bdd;
    --tag-artist:    #c2410c;
    --tag-copyright: #9333ea;
    --tag-character: #15803d;
    --tag-metadata:  #a16207;
    --tag-deprecated:#6b7280;

    --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 12px rgba(16,24,40,.07);
}

/* ---------------------------------------------------------------- reset --- */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
}

img, video { max-width: 100%; height: auto; display: block; }

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

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 650; }
p { margin: 0 0 1em; }

code, pre { font-family: var(--mono); font-size: .9em; }
code { background: var(--bg-sunken); padding: .1em .35em; border-radius: 4px; }
pre.code {
    background: var(--bg-sunken);
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    border: 1px solid var(--border);
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

.muted { color: var(--text-muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.wrap { max-width: 32ch; }
.required { color: var(--danger); }

/* --------------------------------------------------------------- header --- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg-raised) 92%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.site-header__bar {
    max-width: 1680px;
    margin: 0 auto;
    padding: .6rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    text-decoration: none;
    flex-shrink: 0;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand__mark {
    width: 22px; height: 22px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--accent), var(--tag-copyright));
}

.site-nav { display: flex; gap: .25rem; flex-shrink: 0; }
.site-nav__link {
    padding: .4rem .7rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
.site-nav__link:hover { background: var(--bg-sunken); color: var(--text); text-decoration: none; }
.site-nav__link.is-active { color: var(--text); background: var(--bg-sunken); }

.search-form { flex: 1 1 auto; min-width: 0; max-width: 640px; }
.search-form__field { position: relative; display: flex; }
.search-form__field input {
    width: 100%;
    padding: .5rem 2.4rem .5rem .8rem;
    font: inherit;
    color: var(--text);
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.search-form__field input::placeholder { color: var(--text-faint); }
.search-form__field button {
    position: absolute;
    right: 4px; top: 50%;
    transform: translateY(-50%);
    display: grid; place-items: center;
    width: 30px; height: 30px;
    background: none; border: 0;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.search-form__field button:hover { color: var(--text); background: var(--bg); }

.site-account { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.site-account__link { position: relative; color: var(--text-muted); }
.badge {
    position: absolute;
    top: -6px; right: -10px;
    min-width: 17px;
    padding: 0 4px;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    color: #fff;
    background: var(--danger);
    border-radius: 9px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: .5rem;
    background: none;
    border: 0;
    cursor: pointer;
}
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; }

/* --------------------------------------------------------------- layout --- */

.page__main { flex: 1; max-width: 1680px; width: 100%; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

.layout { display: grid; gap: 1.5rem; }
.layout--sidebar { grid-template-columns: 250px minmax(0, 1fr); }
.layout--admin { grid-template-columns: 210px minmax(0, 1fr); }

.content { min-width: 0; }
.content--narrow { max-width: 760px; margin: 0 auto; }
.content--auth { max-width: 400px; margin: 2rem auto; }

.content__header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .75rem;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}
.content__title { margin: 0; font-size: 1.4rem; }
.content__meta { margin: 0; color: var(--text-muted); font-size: .875rem; }
.content__more { margin-left: auto; font-size: .9rem; }
.content__actions { margin-left: auto; display: flex; gap: .5rem; }

.section-title {
    margin: 1.75rem 0 .75rem;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.section-title__count {
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-sunken);
    padding: .1rem .45rem;
    border-radius: 10px;
}

/* -------------------------------------------------------------- sidebar --- */

.sidebar { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.panel {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .85rem;
}
.panel__title { margin: 0 0 .6rem; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.panel__subtitle { margin: .8rem 0 .3rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
.panel__subtitle:first-of-type { margin-top: 0; }
.panel__hint { margin: .5rem 0 0; font-size: .78rem; color: var(--text-faint); }
.panel--info ul { margin: 0; padding-left: 1.1rem; color: var(--text-muted); font-size: .9rem; }
.panel--edit summary { cursor: pointer; }

.tag-search textarea {
    width: 100%;
    resize: vertical;
    padding: .5rem;
    font: inherit;
    font-size: .9rem;
    color: var(--text);
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: .5rem;
}

/* -------------------------------------------------------------- taglist --- */

.tag-list { list-style: none; margin: 0; padding: 0; }
.tag-list__item {
    display: flex;
    align-items: baseline;
    gap: .3rem;
    padding: .1rem 0;
    font-size: .88rem;
    line-height: 1.35;
}
.tag-list__add, .tag-list__remove, .tag-list__wiki {
    color: var(--text-faint);
    font-size: .75rem;
    text-decoration: none;
    flex-shrink: 0;
    width: .9em;
    text-align: center;
}
.tag-list__add:hover { color: var(--success); text-decoration: none; }
.tag-list__remove:hover { color: var(--danger); text-decoration: none; }
.tag-list__wiki:hover { color: var(--accent); text-decoration: none; }
.tag-list__name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tag-list__count { color: var(--text-faint); font-size: .78rem; font-variant-numeric: tabular-nums; }

.tag-type-general   { color: var(--tag-general); }
.tag-type-artist    { color: var(--tag-artist); }
.tag-type-copyright { color: var(--tag-copyright); }
.tag-type-character { color: var(--tag-character); }
.tag-type-metadata  { color: var(--tag-metadata); }
.tag-type-deprecated{ color: var(--tag-deprecated); text-decoration: line-through; }

/* ---------------------------------------------------------- thumb grid --- */

.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--thumb-size), 1fr));
    gap: .6rem;
}

.thumb {
    position: relative;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color .12s, transform .12s;
}
.thumb:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.thumb--pending { border-color: var(--warning); }
.thumb--deleted { opacity: .55; }
.thumb--blacklisted { display: none; }

.thumb__link { display: block; position: relative; }
.thumb__image {
    width: 100%;
    height: var(--thumb-size);
    object-fit: contain;
    background: var(--bg-sunken);
}

.thumb__badge {
    position: absolute;
    top: 4px; left: 4px;
    padding: .1rem .35rem;
    font-size: .68rem;
    font-weight: 700;
    color: #fff;
    background: rgba(0,0,0,.72);
    border-radius: 3px;
}
.thumb__badge--pending { top: auto; bottom: 4px; background: var(--warning); color: #201704; }

.thumb__meta {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .25rem .4rem;
    font-size: .72rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
.thumb__score { font-weight: 700; color: var(--text); }
.thumb__rating { margin-left: auto; font-weight: 700; }
.thumb__rating--safe { color: var(--success); }
.thumb__rating--questionable { color: var(--warning); }
.thumb__rating--explicit { color: var(--danger); }

/* ---------------------------------------------------------- post media --- */

.post-nav {
    display: flex;
    gap: .5rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .75rem;
}
.post-nav__link {
    padding: .35rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-raised);
    font-size: .875rem;
}
.post-nav__link:hover { text-decoration: none; border-color: var(--border-strong); }
.post-nav__link.is-disabled { opacity: .4; pointer-events: none; }

.post-media { margin: 0 0 1rem; }
.post-media__frame { position: relative; display: inline-block; max-width: 100%; }
.post-media__image, .post-media__video {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    border-radius: var(--radius-sm);
    background: var(--bg-sunken);
}
.post-media__image.is-full { max-height: none; }
.post-media__caption { margin-top: .5rem; font-size: .85rem; color: var(--text-muted); }

.note-layer { position: absolute; inset: 0; pointer-events: none; }
.note {
    position: absolute;
    border: 1px solid rgba(0,0,0,.6);
    background: rgba(255,255,225,.35);
    pointer-events: auto;
    cursor: help;
}
.note:hover { background: rgba(255,255,225,.55); }
.note__body {
    position: absolute;
    top: 100%; left: 0;
    z-index: 5;
    min-width: 180px;
    max-width: 340px;
    margin-top: 3px;
    padding: .5rem .65rem;
    font-size: .85rem;
    color: #16181d;
    background: #fffde7;
    border: 1px solid #b9b48a;
    border-radius: 4px;
    box-shadow: var(--shadow);
}

.post-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.stat-list { display: grid; grid-template-columns: auto 1fr; gap: .2rem .7rem; margin: 0; font-size: .875rem; }
.stat-list dt { color: var(--text-muted); }
.stat-list dd { margin: 0; overflow-wrap: anywhere; }

/* -------------------------------------------------------------- buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .45rem .85rem;
    font: inherit;
    font-size: .9rem;
    font-weight: 550;
    color: var(--text);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); background: var(--bg-sunken); text-decoration: none; color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.btn--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.btn--ghost { background: transparent; }
.btn--block { width: 100%; }
.btn--vote.is-active { border-color: var(--accent); color: var(--accent); }
.btn.is-active { border-color: var(--accent); color: var(--accent); }

.link-button {
    padding: 0;
    font: inherit;
    font-size: .875rem;
    color: var(--accent);
    background: none;
    border: 0;
    cursor: pointer;
}
.link-button:hover { text-decoration: underline; color: var(--accent-hover); }

.inline-form { display: inline-flex; gap: .35rem; align-items: center; }

/* ---------------------------------------------------------------- forms --- */

.form { display: block; }
.form__row { margin-bottom: 1rem; }
.form__row > label { display: block; margin-bottom: .3rem; font-size: .875rem; font-weight: 550; }
.form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form__hint { margin: .3rem 0 0; font-size: .8rem; color: var(--text-muted); }
.form__actions { display: flex; gap: .5rem; margin-top: 1.25rem; }
.form__fieldset { margin: 1rem 0; padding: .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.form__fieldset legend { padding: 0 .4rem; font-size: .8rem; color: var(--text-muted); }
.form--inline { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin-bottom: 1.25rem; }
.form--inline label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; color: var(--text-muted); }

input[type="text"], input[type="password"], input[type="email"], input[type="url"],
input[type="number"], input[type="search"], input[type="date"], select, textarea {
    width: 100%;
    padding: .45rem .6rem;
    font: inherit;
    font-size: .9rem;
    color: var(--text);
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
textarea { resize: vertical; min-height: 4.5em; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }

.checkbox { display: flex; align-items: center; gap: .45rem; margin: .4rem 0; font-size: .9rem; cursor: pointer; }
.checkbox input { width: auto; }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: 1rem;
}
.filter-bar input, .filter-bar select { width: auto; min-width: 160px; }

.dropzone {
    position: relative;
    padding: 1.75rem 1rem;
    text-align: center;
    background: var(--bg-sunken);
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
}
.dropzone.is-dragover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg-sunken)); }
.dropzone__hint { margin: .6rem 0 0; font-size: .85rem; color: var(--text-muted); }
.dropzone__preview img, .dropzone__preview video { max-height: 240px; margin: .75rem auto 0; border-radius: var(--radius-sm); }

.upload-progress { height: 4px; margin-top: 1rem; background: var(--bg-sunken); border-radius: 2px; overflow: hidden; }
.upload-progress__bar { height: 100%; width: 0; background: var(--accent); transition: width .15s; }

.api-key { display: inline-block; padding: .4rem .6rem; word-break: break-all; }

/* ------------------------------------------------------------- comments --- */

.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.comment {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .7rem .85rem;
}
.comment:target { border-color: var(--accent); }
.comment--collapsed .comment__inner { display: none; }
.comment__reveal { background: none; border: 0; color: var(--text-faint); font: inherit; font-size: .85rem; cursor: pointer; padding: 0; }
.comment__header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; margin-bottom: .35rem; font-size: .82rem; }
.comment__author { font-weight: 600; }
.comment__time, .comment__edited { color: var(--text-faint); }
.comment__score { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.comment__body { font-size: .93rem; overflow-wrap: anywhere; }
.comment__body blockquote {
    margin: .5rem 0;
    padding: .35rem .7rem;
    border-left: 3px solid var(--border-strong);
    color: var(--text-muted);
}
.comment__body .spoiler { background: var(--text); color: transparent; border-radius: 3px; }
.comment__body .spoiler:hover, .comment__body .spoiler:focus { color: var(--bg); }
.comment__actions { display: flex; gap: .75rem; margin-top: .5rem; font-size: .8rem; }

.comment-form { margin-top: 1rem; }
.comment-form textarea { margin-bottom: .5rem; }
.comment-form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.comment-form__actions .form__hint { margin: 0; flex: 1; }

.comment-block { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
.comment-block__thumb img { width: 100px; height: 100px; object-fit: contain; background: var(--bg-sunken); border-radius: var(--radius-sm); }
.comment-block .comment-list { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- forum --- */

.forum-posts { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.forum-post {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 1rem;
    padding: .85rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.forum-post:target { border-color: var(--accent); }
.forum-post__author { display: flex; flex-direction: column; font-size: .875rem; }
.forum-post__meta { margin-bottom: .4rem; font-size: .8rem; color: var(--text-faint); display: flex; gap: .5rem; }

/* --------------------------------------------------------------- tables --- */

.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th, .data-table td { padding: .45rem .6rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.data-table tbody tr:hover { background: var(--bg-raised); }

.plain-list { margin: 0 0 1rem; padding-left: 1.2rem; }
.plain-list li { margin-bottom: .2rem; }

.diff--added { color: var(--success); }
.diff--removed { color: var(--danger); }

.pill {
    display: inline-block;
    padding: .05rem .4rem;
    font-size: .72rem;
    font-weight: 600;
    border-radius: 10px;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.pill--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.pill--muted { opacity: .7; }

/* ----------------------------------------------------------- pagination --- */

.paginator {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin: 1.5rem 0;
}
.paginator__pages { display: flex; flex-wrap: wrap; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.paginator__page, .paginator__step {
    display: inline-block;
    min-width: 2rem;
    padding: .3rem .55rem;
    text-align: center;
    font-size: .875rem;
    color: var(--text);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.paginator__page:hover, .paginator__step:hover { border-color: var(--border-strong); text-decoration: none; }
.paginator__page.is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.paginator__step.is-disabled { opacity: .4; pointer-events: none; }
.paginator__gap { padding: .3rem .2rem; color: var(--text-faint); }
.paginator__jump { display: flex; gap: .3rem; margin-left: auto; }
.paginator__jump input { width: 5rem; }

/* ---------------------------------------------------------------- cards --- */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .85rem; }
.card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card__media { display: block; height: 170px; background: var(--bg-sunken); }
.card__media img { width: 100%; height: 100%; object-fit: contain; }
.card__placeholder { display: grid; place-items: center; height: 100%; color: var(--text-faint); font-size: .85rem; }
.card__body { padding: .6rem .7rem; }
.card__title { margin: 0 0 .2rem; font-size: .92rem; }
.card__meta { margin: 0; font-size: .8rem; color: var(--text-muted); }

.queue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .85rem; }
.queue-item { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem; }
.queue-item img { width: 100%; height: 180px; object-fit: contain; background: var(--bg-sunken); border-radius: var(--radius-sm); }
.queue-item__meta { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0; font-size: .75rem; color: var(--text-muted); }
.queue-item__tags { margin: 0 0 .5rem; font-size: .78rem; color: var(--text-muted); }
.queue-item__actions { display: flex; gap: .4rem; }

/* ----------------------------------------------------------------- hero --- */

.hero { text-align: center; padding: 2.5rem 1rem 2rem; }
.hero__title { margin: 0 0 .25rem; font-size: 2rem; }
.hero__tagline { color: var(--text-muted); margin-bottom: 1.5rem; }
.hero__search { display: flex; gap: .5rem; max-width: 560px; margin: 0 auto 1.75rem; }
.hero__stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.75rem; margin: 0; }
.hero__stats > div { text-align: center; }
.hero__stats dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.hero__stats dd { margin: 0; font-size: 1.3rem; font-weight: 650; font-variant-numeric: tabular-nums; }

.tag-strip { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin-bottom: 2rem; }
.tag-chip {
    display: inline-flex;
    align-items: baseline;
    gap: .3rem;
    padding: .25rem .6rem;
    font-size: .85rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.tag-chip:hover { border-color: var(--border-strong); text-decoration: none; }
.tag-chip__count { font-size: .72rem; color: var(--text-faint); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: .3rem .7rem; align-items: baseline; line-height: 1.9; }
.tag-cloud__item--0 { font-size: .8rem; opacity: .75; }
.tag-cloud__item--1 { font-size: .95rem; }
.tag-cloud__item--2 { font-size: 1.1rem; }
.tag-cloud__item--3 { font-size: 1.3rem; }
.tag-cloud__item--4 { font-size: 1.55rem; }
.tag-cloud__item--5 { font-size: 1.85rem; font-weight: 600; }
.tag-cloud__item--6 { font-size: 2.15rem; font-weight: 700; }

/* -------------------------------------------------------------- notices --- */

.flash-stack { max-width: 1680px; margin: .75rem auto 0; padding: 0 1rem; display: flex; flex-direction: column; gap: .5rem; }
.flash {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-raised);
    font-size: .9rem;
}
.flash--success { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.flash--error   { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.flash--notice  { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.flash__close { margin-left: auto; background: none; border: 0; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; line-height: 1; }

.notice {
    padding: .6rem .85rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border-strong);
    background: var(--bg-raised);
    font-size: .9rem;
}
.notice--warning { border-left-color: var(--warning); }
.notice--error { border-left-color: var(--danger); }
.notice--subtle { color: var(--text-muted); }

.empty-state { padding: 3rem 1rem; text-align: center; color: var(--text-muted); }

.error-page { text-align: center; padding: 3rem 1rem; }
.error-page__code { font-size: 4rem; font-weight: 700; color: var(--text-faint); margin: 0; line-height: 1; }
.error-page__message { color: var(--text-muted); max-width: 46ch; margin: 0 auto 1.5rem; }
.error-page__actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- misc ---- */

.option-list { display: flex; flex-direction: column; gap: .45rem; font-size: .88rem; }
.option-list__label { display: flex; flex-direction: column; gap: .25rem; color: var(--text-muted); font-size: .8rem; }

.health-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 1rem; }
.health-list__item--ok strong { color: var(--success); }
.health-list__item--bad strong { color: var(--danger); }

.admin-nav { display: flex; flex-direction: column; gap: .1rem; }
.admin-nav__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .35rem .5rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: .875rem;
}
.admin-nav__link:hover { background: var(--bg-sunken); color: var(--text); text-decoration: none; }
.admin-nav__link.is-active { background: var(--bg-sunken); color: var(--text); }
.admin-nav__link .badge { position: static; }

.menu { position: relative; }
.menu__summary { cursor: pointer; list-style: none; padding: .35rem .6rem; border-radius: var(--radius-sm); font-weight: 600; }
.menu__summary::-webkit-details-marker { display: none; }
.menu__summary:hover { background: var(--bg-sunken); }
.menu__panel {
    position: absolute;
    right: 0; top: calc(100% + 4px);
    z-index: 60;
    min-width: 190px;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .45rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.menu__panel a, .menu__button {
    padding: .35rem .5rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .875rem;
    text-align: left;
    background: none;
    border: 0;
    font: inherit;
    cursor: pointer;
}
.menu__panel a:hover, .menu__button:hover { background: var(--bg-sunken); text-decoration: none; }
.menu__panel label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; color: var(--text-muted); }

.user-admin { color: var(--danger); font-weight: 650; }
.user-mod { color: var(--tag-copyright); font-weight: 650; }
.user-trusted { color: var(--tag-character); }
.user-member { color: var(--text); }

.modal { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); color: var(--text); padding: 0; max-width: 480px; width: 92%; }
.modal::backdrop { background: rgba(0,0,0,.6); }
.modal__form { padding: 1.25rem; }
.modal__form label { display: block; margin: .75rem 0 .25rem; font-size: .875rem; font-weight: 550; }
.modal__actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }

.notification-list { list-style: none; margin: 0; padding: 0; }
.notification { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.notification--unread { font-weight: 600; }
.notification time { margin-left: auto; color: var(--text-faint); font-size: .8rem; font-weight: 400; }

.note-feed { list-style: none; margin: 0; padding: 0; }
.note-feed__item { display: flex; gap: .85rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.note-feed__item img { width: 80px; height: 80px; object-fit: contain; background: var(--bg-sunken); border-radius: var(--radius-sm); }

.prose { max-width: 72ch; }
.prose h2 { margin-top: 1.75rem; font-size: 1.15rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose table { margin-bottom: 1.25rem; }
.prose .bb-image { margin: .75rem 0; border-radius: var(--radius-sm); }

/* --------------------------------------------------------------- footer --- */

.site-footer { border-top: 1px solid var(--border); background: var(--bg-raised); margin-top: auto; }
.site-footer__inner { max-width: 1680px; margin: 0 auto; padding: 1.25rem 1rem; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .875rem; }
.site-footer__tools { display: flex; gap: 1rem; margin-left: auto; font-size: .85rem; }
.site-footer__note { width: 100%; margin: 0; font-size: .8rem; color: var(--text-faint); }

/* ----------------------------------------------------------- responsive --- */

@media (max-width: 1100px) {
    .layout--sidebar, .layout--admin { grid-template-columns: 1fr; }
    .sidebar { order: 2; }
    .content { order: 1; }
    .sidebar .panel--search { order: -1; }
}

@media (max-width: 860px) {
    .site-header__bar { flex-wrap: wrap; gap: .5rem; }
    .nav-toggle { display: flex; order: 1; margin-left: auto; }
    .site-nav {
        order: 4;
        width: 100%;
        flex-direction: column;
        display: none;
    }
    .site-nav.is-open { display: flex; }
    .search-form { order: 3; width: 100%; max-width: none; flex-basis: 100%; }
    .site-account { order: 2; }
    .form__grid { grid-template-columns: 1fr; }
    .forum-post { grid-template-columns: 1fr; }
    .forum-post__author { flex-direction: row; gap: .5rem; align-items: baseline; }
    .paginator__jump { display: none; }
    :root { --thumb-size: 140px; }
}

@media (max-width: 520px) {
    body { font-size: 14px; }
    .page__main { padding: .85rem .6rem 2.5rem; }
    :root { --thumb-size: 110px; }
    .thumb-grid { gap: .35rem; }
    .hero { padding: 1.5rem .5rem; }
    .hero__title { font-size: 1.5rem; }
    .comment-block { flex-direction: column; }
}

@media print {
    .site-header, .site-footer, .sidebar, .post-actions, .comment-form, .paginator { display: none; }
    body { background: #fff; color: #000; }
}
