:root {
    --page-bg: #050505;
    --panel-bg: #111111;
    --panel-bg-2: #171717;
    --text: #f2f2f2;
    --muted: #a8a8a8;
    --line: #2a2a2a;
    --accent: #e11919;
    --accent-red: #bf0000;
    --link: #ff4d4d;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--page-bg);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background:
        linear-gradient(180deg, rgba(191, 0, 0, 0.2), transparent 300px),
        linear-gradient(90deg, rgba(191, 0, 0, 0.08), transparent 40%, rgba(191, 0, 0, 0.08)),
        var(--page-bg);
    color: var(--text);
}

body.modal-open {
    overflow: hidden;
}

a {
    color: var(--link);
}

button,
input {
    font: inherit;
}

.header {
    max-width: 1180px;
    width: calc(100% - 32px);
    margin: 0 auto;
    padding: 28px 0 16px;
    text-align: left;
}

.header h1 {
    margin: 0 0 8px;
    font-size: clamp(1.7rem, 3vw, 2.6rem);
    line-height: 1.08;
    letter-spacing: 0;
}

.header p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.subdomain-label {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.theme-toggle {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    background: rgba(5, 5, 5, 0.94);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

#search-term {
    width: min(460px, 100%);
    min-height: 42px;
    padding: 0 12px;
    color: var(--text);
    background: #080808;
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent-red);
    border-radius: 6px;
    outline: none;
}

#search-term:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(225, 25, 25, 0.22);
}

.sort-button,
.download-button,
.asset-modal-links a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    color: #ffffff;
    background: var(--accent);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sort-button:hover,
.download-button:hover,
.asset-modal-links a:hover {
    background: #ff2b2b;
}

.download-button.secondary,
.asset-modal-links a:first-child {
    color: var(--text);
    background: #15171a;
    border-color: var(--line);
}

.download-button.secondary:hover,
.asset-modal-links a:first-child:hover {
    border-color: var(--accent);
}

.image-grid {
    width: min(1480px, calc(100% - 32px));
    margin: 18px auto 42px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
    gap: 14px;
}

.image-container {
    min-width: 0;
    padding: 10px;
    background: rgba(26, 28, 32, 0.92);
    border: 1px solid var(--line);
    border-top-color: rgba(225, 25, 25, 0.55);
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.image-container[hidden] {
    display: none;
}

.image-container:hover {
    border-color: rgba(225, 25, 25, 0.85);
}

.asset-preview-button {
    width: 100%;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    padding: 12px;
    background: #101214;
    border: 1px solid #292e36;
    border-radius: 6px;
    cursor: pointer;
}

.asset-preview-button:hover,
.asset-preview-button:focus {
    border-color: var(--accent);
    outline: none;
}

.asset-preview-button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: auto;
}

.asset-caption {
    min-height: 58px;
    margin: 10px 0;
}

.asset-name {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.25;
}

.asset-type {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.asset-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.asset-actions .download-button {
    width: 100%;
    min-width: 0;
    font-size: 0.86rem;
}

.asset-card-details {
    display: none;
}

.asset-card-detail-body {
    margin-top: 10px;
    display: grid;
    gap: 10px;
}

.asset-description {
    margin: 0;
    color: #d8d8d8;
    line-height: 1.45;
}

.asset-detail-list {
    display: grid;
    gap: 6px;
    margin: 0;
}

.asset-detail-row {
    min-width: 0;
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px solid #242424;
}

.asset-detail-row dt {
    color: var(--muted);
}

.asset-detail-row dd {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.asset-related-groups {
    display: grid;
    gap: 10px;
}

.asset-related-group {
    min-width: 0;
}

.asset-related-group h4 {
    margin: 0 0 6px;
    color: #ffffff;
    font-size: 0.86rem;
}

.asset-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    gap: 8px;
}

.asset-related-item {
    min-width: 0;
    display: grid;
    gap: 4px;
    align-content: start;
    padding: 7px;
    color: var(--text);
    background: #090909;
    border: 1px solid #272727;
    border-radius: 6px;
    text-decoration: none;
}

.asset-related-item:hover,
.asset-related-item:focus {
    border-color: var(--accent);
    outline: none;
}

.asset-related-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
}

.asset-related-item span,
.asset-related-item small {
    overflow-wrap: anywhere;
}

.asset-related-item span {
    font-size: 0.76rem;
    line-height: 1.2;
}

.asset-related-item small {
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.15;
}

.asset-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
}

.asset-modal.is-open {
    display: block;
}

.asset-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.asset-modal-panel {
    position: relative;
    width: min(1080px, calc(100% - 28px));
    max-height: calc(100vh - 28px);
    margin: 14px auto;
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    overflow: hidden;
    background: var(--panel-bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.asset-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 40px;
    height: 40px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.44);
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.asset-modal-close:hover,
.asset-modal-close:focus {
    border-color: var(--accent);
    outline: none;
}

.asset-modal-media {
    min-height: 420px;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        linear-gradient(135deg, rgba(191, 0, 0, 0.22), transparent 45%),
        #080808;
    border-right: 1px solid var(--line);
}

.asset-modal-image {
    max-width: 100%;
    max-height: 68vh;
    object-fit: contain;
}

.asset-modal-content {
    min-width: 0;
    max-height: calc(100vh - 28px);
    overflow: auto;
    padding: 28px 28px 22px;
}

.asset-modal-kicker {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

.asset-modal-title {
    margin: 0;
    font-size: 1.8rem;
    line-height: 1.1;
}

.asset-modal-subtitle {
    margin: 6px 0 14px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.asset-modal-description {
    margin: 0 0 18px;
    color: #d7dbe2;
    line-height: 1.55;
}

.asset-modal-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 18px;
}

.asset-modal-meta .asset-detail-row,
.asset-meta-row {
    min-width: 0;
    padding: 10px;
    background: var(--panel-bg-2);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.asset-modal-meta .asset-detail-row {
    display: block;
}

.asset-modal-meta .asset-detail-row dt,
.asset-meta-row dt {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 0.78rem;
}

.asset-modal-meta .asset-detail-row dd,
.asset-meta-row dd {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.asset-modal-related {
    display: grid;
    gap: 14px;
}

.asset-modal-related .asset-related-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}

.asset-modal-lists {
    display: grid;
    gap: 10px;
}

.asset-list-section {
    padding: 12px;
    background: #15171a;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.asset-list-section h3 {
    margin: 0 0 8px;
    font-size: 0.98rem;
}

.asset-list-section ul {
    margin: 0;
    padding-left: 18px;
    columns: 2;
    column-gap: 28px;
}

.asset-list-section li {
    margin: 0 0 5px;
    color: #d9dde4;
    break-inside: avoid;
    overflow-wrap: anywhere;
}

.asset-modal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.asset-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.asset-detail-card {
    min-width: 0;
    padding: 14px;
    background: rgba(12, 12, 12, 0.96);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent-red);
    border-radius: 8px;
}

.asset-detail-card[hidden] {
    display: none;
}

.asset-detail-card h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    line-height: 1.25;
}

.asset-detail-card h3 span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.asset-detail-card p {
    margin: 0 0 10px;
    color: #d8d8d8;
    line-height: 1.45;
}

.asset-detail-card dl {
    display: grid;
    gap: 6px;
    margin: 0 0 10px;
}

.asset-detail-card dl div {
    display: grid;
    grid-template-columns: 108px 1fr;
    gap: 8px;
    padding: 7px 0;
    border-top: 1px solid #242424;
}

.asset-detail-card dt {
    color: var(--muted);
}

.asset-detail-card dd {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.asset-detail-card a {
    color: var(--link);
}

.site-footer {
    margin-top: 40px;
    padding: 24px 16px;
    background: #030303;
    border-top: 1px solid #2a0000;
}

.site-footer section {
    width: min(1180px, 100%);
    margin: 0 auto;
}

.site-footer h2 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.site-footer p {
    max-width: 820px;
    margin: 0 0 8px;
    color: var(--muted);
    line-height: 1.5;
}

.legion-killfeed-official-site-links {
    width: min(1180px, calc(100% - 32px));
}

.legion-killfeed-official-site-links h2 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.legion-killfeed-official-site-links p {
    margin: 0 0 14px;
    color: var(--muted);
    line-height: 1.45;
}

.legion-killfeed-official-site-links ul {
    list-style: none;
}

.legion-killfeed-official-site-links > ul {
    margin: 0;
    padding: 0;
}

.legion-killfeed-official-site-links > ul > li > ul {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 8px;
}

.legion-killfeed-official-site-links > ul > li > a {
    display: none;
}

@media (max-width: 760px) {
    .theme-toggle {
        align-items: stretch;
        flex-direction: column;
    }

    #search-term,
    .sort-button {
        width: 100%;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
        gap: 10px;
    }

    .asset-modal-panel {
        grid-template-columns: 1fr;
        overflow: auto;
    }

    .asset-modal-media {
        min-height: 240px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .asset-modal-content {
        max-height: none;
        padding: 22px 16px 18px;
    }

    .asset-modal-meta {
        grid-template-columns: 1fr;
    }

    .asset-list-section ul {
        columns: 1;
    }
}
