* { box-sizing: border-box; }
body {
    margin: 0;
    background: #101418;
    color: #eef4fa;
    font-family: system-ui, Segoe UI, Arial, sans-serif;
}
a { color: #8fd0ff; text-decoration: none; }
a:hover { text-decoration: underline; }
header {
    background: linear-gradient(135deg, #1f3b57, #12202d);
    border-bottom: 1px solid #31475a;
    padding: 1rem 1.25rem;
}
.header-inner, main { max-width: 1180px; margin: auto; }
.header-inner { display: flex; justify-content: space-between; gap: 1rem; align-items: end; }
h1, h2, h3 { margin: 0 0 .5rem; }
p { color: #c8d4df; }
nav { display: flex; gap: .6rem; flex-wrap: wrap; }
nav a, .button, button {
    border: 1px solid #5d7c99;
    background: #20364a;
    color: #fff;
    border-radius: .5rem;
    padding: .52rem .75rem;
    cursor: pointer;
    display: inline-block;
}
.button.danger, button.danger { background: #5a1d1d; border-color: #9a4a4a; }
main { padding: 1.25rem; }
.panel, .card {
    background: #17212b;
    border: 1px solid #293949;
    border-radius: .75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; align-items: end; }
label { display: grid; gap: .3rem; color: #dbe7f3; }
label.check { display: flex; align-items: center; gap: .5rem; }
input, select, textarea {
    width: 100%;
    border: 1px solid #40566c;
    border-radius: .45rem;
    padding: .55rem;
    background: #0e151c;
    color: #edf2f7;
}
.cards { display: grid; gap: 1rem; }
.craft-card {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
}
.thumb {
    width: 220px;
    height: 145px;
    object-fit: cover;
    border-radius: .55rem;
    border: 1px solid #31475a;
    background: #0e151c;
}
.hero-img { width: 100%; max-height: 420px; object-fit: cover; border-radius: .75rem; border: 1px solid #31475a; }
.meta { color: #9fb4c6; font-size: .92rem; }
.tag {
    display: inline-block;
    margin: .12rem;
    padding: .16rem .4rem;
    border-radius: .4rem;
    background: #0e151c;
    border: 1px solid #304050;
    color: #dbe7f3;
}
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.flash { padding: .75rem 1rem; border-radius: .5rem; margin-bottom: 1rem; }
.flash.error { background: #4a1818; border: 1px solid #8a3838; }
.flash.success { background: #164327; border: 1px solid #3a8c55; }
table { width: 100%; border-collapse: collapse; }
td, th { border-bottom: 1px solid #293949; padding: .5rem; text-align: left; }
pre { white-space: pre-wrap; background: #0e151c; padding: 1rem; border-radius: .5rem; overflow: auto; }
@media (max-width: 720px) {
    .header-inner { display: block; }
    .craft-card { grid-template-columns: 1fr; }
    .thumb { width: 100%; height: 190px; }
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}
.image-grid figure {
    margin: 0;
    background: #0e151c;
    border: 1px solid #304050;
    border-radius: .55rem;
    padding: .5rem;
}
.gallery-img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: .4rem;
}
figcaption {
    margin-top: .4rem;
    color: #c8d4df;
    font-size: .9rem;
}
.image-admin-row {
    display: grid;
    grid-template-columns: 160px 1fr 100px auto;
    gap: .75rem;
    align-items: end;
}
.image-admin-row img {
    width: 160px;
    height: 100px;
    object-fit: cover;
    border-radius: .4rem;
    border: 1px solid #304050;
}
@media (max-width: 720px) {
    .image-admin-row { grid-template-columns: 1fr; }
    .image-admin-row img { width: 100%; height: 180px; }
}

fieldset {
    border: 1px solid #304050;
    border-radius: .55rem;
    padding: .75rem;
}
legend {
    color: #dbe7f3;
    padding: 0 .35rem;
}

.tag-filter {
    margin-top: .25rem;
}
.tag-filter-group {
    margin: .75rem 0;
    padding: .5rem;
    border: 1px solid #304050;
    border-radius: .5rem;
    background: #111a22;
}
.tag-checks {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem 1rem;
    margin-top: .4rem;
}
.tag-checks .check {
    min-width: 145px;
}
\n
/* v6 checkbox spacing fix */
.check {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.check input[type="checkbox"] {
    margin: 0;
}

.tag-checks .check {
    min-width: 0;
}

.tag-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}


.site-footer {
    margin-top: 3rem;
    padding: 1rem;
    border-top: 1px solid #304050;
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem 1.5rem;
}

.footer-links a {
    text-decoration: none;
}

.find-links {
    margin-top: .4rem;
    align-items: center;
}
.find-links a {
    padding: .2rem .35rem;
}


/* v11 compact exclusive tag layout */
.exclusive-tag-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0.5rem 0 0.75rem;
}

.exclusive-tag-box {
    border: 1px solid #304050;
    border-radius: 0.45rem;
    background: #111a22;
    padding: 0.45rem 0.55rem;
}

.exclusive-tag-box strong {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.exclusive-tag-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.6rem;
}

.exclusive-tag-options .check {
    font-size: 0.9rem;
}

.role-tag-group {
    margin-top: 0.75rem;
}

@media (max-width: 850px) {
    .exclusive-tag-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .exclusive-tag-row {
        grid-template-columns: 1fr;
    }
}


/* v12 search checkbox alignment fix */
.search-checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    align-self: end;
}

.search-checkbox-row .check {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    white-space: nowrap;
}

.search-checkbox-row input[type="checkbox"] {
    margin: 0;
}

.nested-table {
    margin: 0;
    font-size: 0.9rem;
}
.nested-table th,
.nested-table td {
    padding: 0.25rem 0.4rem;
}


.settings-form-actions {
    align-self: end;
}


.admin-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.admin-checkbox input[type="checkbox"] {
    margin: 0;
    width: auto;
}


.site-version {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    opacity: 0.7;
    text-align: center;
}

.inline-form {
    display: inline;
}

.button.tagged,
button.tagged {
    border-color: #6aa84f;
}


.inline-form {
    display: inline;
}

.tag-toggle-form {
    margin: 0;
}

.button.tag-toggle,
button.tag-toggle {
    min-width: 5.5rem;
}

.button.tagged,
button.tagged {
    border-color: #6aa84f;
}

.button.untagged,
button.untagged {
    border-color: #8899aa;
}



/* If the header still owns the nav, lay the page as a visual sidebar. */
@media (min-width: 800px) {
    header {
        display: grid;
        grid-template-columns: 180px 1fr;
        column-gap: 1.25rem;
    }

    header nav,
    header .side-nav {
        grid-column: 1;
        grid-row: 2 / span 20;
    }

    header > *:not(nav):not(.side-nav) {
        grid-column: 1 / span 2;
    }

    .site-shell {
        padding-left: calc(1rem + 180px + 1.25rem);
    }
}

@media (max-width: 799px) {
    .site-shell {
        display: block;
    }

    header nav,
    .side-nav {
        max-width: none;
        width: 100%;
        margin-bottom: 1rem;
    }
}


/* v44 left sidebar navigation layout */
.site-shell {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

.side-nav {
    flex: 0 0 190px;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    position: sticky;
    top: 1rem;
}

.side-nav a {
    display: block;
    text-align: left;
    padding: 0.55rem 0.75rem;
    border-radius: 0.35rem;
}

.site-main {
    flex: 1 1 auto;
    min-width: 0;
}

header {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1rem 0 1rem;
}

header nav {
    display: none;
}

@media (max-width: 799px) {
    .site-shell {
        display: block;
    }

    .side-nav {
        position: static;
        width: 100%;
        max-width: none;
        margin-bottom: 1rem;
    }
}


/* v45 equal craft action buttons */
.card .actions,
.craft-card .actions,
.panel .actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.45rem;
}

.card .actions .button,
.card .actions button,
.craft-card .actions .button,
.craft-card .actions button,
.panel .actions .button,
.panel .actions button {
    min-height: 2.35rem;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

.card .actions form,
.craft-card .actions form,
.panel .actions form,
.inline-form.tag-toggle-form {
    display: inline-flex;
    align-items: stretch;
    margin: 0;
}

.card .actions form button,
.craft-card .actions form button,
.panel .actions form button,
.inline-form.tag-toggle-form button {
    height: 100%;
}


/* v46 checkbox alignment */
input[type="checkbox"] {
    margin-right: 0.2rem;
    vertical-align: middle;
}

.checkbox-row,
.checkbox-group label,
label.checkbox,
form label:has(input[type="checkbox"]) {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

.checkbox-group label input[type="checkbox"],
label.checkbox input[type="checkbox"] {
    margin: 0;
}


/* v47 checkbox hardening */
.checkbox-group label,
label.checkbox,
label.check,
.admin-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.checkbox-group label input[type="checkbox"],
label.checkbox input[type="checkbox"],
label.check input[type="checkbox"],
.admin-checkbox input[type="checkbox"] {
    margin: 0;
    width: auto;
}


.craft-image-link,
.craft-detail-image-link {
    display: inline-block;
    text-decoration: none;
}

.craft-image-link img,
.craft-detail-image-link img {
    cursor: pointer;
}


.craft-image-link,
.craft-detail-image-link {
    display: inline-block;
    text-decoration: none;
}

.craft-image-link img,
.craft-detail-image-link img {
    cursor: pointer;
}

.craft-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    border: 1px dashed #888;
    opacity: 0.75;
}


/* v54 thumbnail size limit */
.craft-image-link img,
.craft-thumbnail img,
.craft-card img {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
}


/* v55 craft card layout */
.craft-card,
.craft-entry,
.craft-list-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.craft-card .craft-image-link,
.craft-entry .craft-image-link,
.craft-list-item .craft-image-link {
    flex: 0 0 200px;
}

.craft-card .craft-image-link img,
.craft-entry .craft-image-link img,
.craft-list-item .craft-image-link img {
    max-width: 200px;
    max-height: 200px;
    display: block;
}

.craft-card .craft-details,
.craft-card .craft-info,
.craft-entry .craft-details,
.craft-entry .craft-info,
.craft-list-item .craft-details,
.craft-list-item .craft-info {
    flex: 1 1 auto;
    min-width: 0;
}

/* fallback if details aren't wrapped */
.craft-card > :not(.craft-image-link),
.craft-entry > :not(.craft-image-link),
.craft-list-item > :not(.craft-image-link) {
    flex: 1 1 auto;
}


/* v56 repaired craft card layout */
.craft-card,
.card,
.craft-entry,
.craft-list-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.craft-image-link {
    flex: 0 0 200px;
    max-width: 200px;
    text-decoration: none;
}

.craft-image-link img {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    cursor: pointer;
}

.craft-info,
.craft-details {
    flex: 1 1 auto;
    min-width: 0;
}

.craft-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    border: 1px dashed #888;
    opacity: 0.75;
}


/* v57 no-image placeholder fix */
.craft-image-link {
    flex: 0 0 200px;
    width: 200px;
    max-width: 200px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    padding: 0;
    box-shadow: none;
}

.craft-image-placeholder {
    width: 200px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #888;
    background: transparent;
    color: inherit;
    box-sizing: border-box;
    opacity: 0.75;
}

/* Do not let broad card styles turn the thumbnail link/placeholder into an extra dark panel. */
.craft-image-link.craft-image-placeholder {
    background: transparent;
    box-shadow: none;
}

/* Keep the horizontal craft row limited to actual craft list containers. */
.craft-card,
.craft-entry,
.craft-list-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.craft-info,
.craft-details {
    flex: 1 1 auto;
    min-width: 0;
}


/* v58 no placeholder thumbnail */
.craft-image-placeholder {
    display: none !important;
}

.craft-image-link:empty {
    display: none !important;
}

/* Only reserve thumbnail width when an actual image exists. */
.craft-image-link {
    flex: 0 0 auto;
    width: auto;
    max-width: 200px;
    min-height: 0;
}

.craft-image-link img {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}


/* v59 placeholder without extra dark box */
.craft-image-link {
    flex: 0 0 200px;
    width: 200px;
    max-width: 200px;
    min-height: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    text-decoration: none;
}

.craft-image-link img {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.craft-image-link.no-image {
    height: auto;
}

.craft-image-placeholder {
    width: 200px;
    height: 120px;
    min-height: 120px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border: 1px dashed #888;
    background: transparent !important;
    box-shadow: none !important;
    color: inherit;
    opacity: 0.75;
}

/* Prevent generic card/link/button styles from drawing a second panel around the placeholder. */
.craft-card > .craft-image-link,
.card > .craft-image-link,
.craft-entry > .craft-image-link,
.craft-list-item > .craft-image-link {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* Main craft card row stays image-left, details-right. */
.craft-card,
.craft-entry,
.craft-list-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}


/* v62 larger craft gallery images */
/* Keep list thumbnails small, but show craft-page gallery images larger. */
.gallery-img,
.craft-gallery img,
.gallery img,
.craft-detail-image-link img {
    max-width: min(900px, 100%);
    max-height: 650px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.craft-gallery,
.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}

.craft-gallery a,
.gallery a,
.craft-detail-image-link {
    display: inline-block;
}


/* v63 gallery full-size override */
/* This must appear after the 200x200 thumbnail rules. */
.gallery-img {
    max-width: 900px !important;
    max-height: none !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
}

.gallery .gallery-img,
.craft-gallery .gallery-img {
    max-width: min(900px, 100%) !important;
    max-height: none !important;
}

.gallery a,
.craft-gallery a {
    flex: 0 1 auto !important;
    width: auto !important;
    max-width: 900px !important;
}

.gallery,
.craft-gallery {
    display: block !important;
}

.gallery img.gallery-img,
.craft-gallery img.gallery-img {
    min-width: 400px;
}


/* v64 gallery size limits */
.gallery-img,
.gallery img,
.craft-gallery img {
    max-width: 800px !important;
    max-height: 600px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

/* remove forced minimum size from v63 */
.gallery img.gallery-img,
.craft-gallery img.gallery-img {
    min-width: 0 !important;
}


.api-docs {
    white-space: pre-wrap;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.35;
}

/* v69 Bungie-style API docs */
.api-doc-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.api-doc-sidebar {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow: auto;
    padding: 1rem;
    border: 1px solid rgba(127, 127, 127, 0.35);
    border-radius: 0.5rem;
}

.api-doc-sidebar a,
.api-doc-sidebar strong {
    display: block;
    margin: 0.2rem 0;
}

.api-doc-endpoint-link {
    padding-left: 0.35rem;
    font-size: 0.9rem;
}

.api-endpoint-list {
    list-style: none;
    padding-left: 0;
}

.api-endpoint-list li {
    margin: 0.35rem 0;
}

.api-method {
    display: inline-block;
    min-width: 3.6rem;
    padding: 0.1rem 0.35rem;
    margin-right: 0.35rem;
    border-radius: 0.25rem;
    font-weight: bold;
    text-align: center;
    font-size: 0.85rem;
}

.api-method-get { background: rgba(80, 140, 255, 0.18); }
.api-method-post { background: rgba(80, 200, 120, 0.18); }

.api-docs {
    white-space: pre-wrap;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.35;
}

@media (max-width: 900px) {
    .api-doc-layout { display: block; }
    .api-doc-sidebar { position: static; max-height: none; margin-bottom: 1rem; }
}
