:root {
    --bg-deepest: #030404;
    --bg-deep: #080b0d;
    --bg-band: #111416;
    --bg-panel: rgba(12, 15, 17, 0.9);
    --text-primary: #f6f2e7;
    --text-secondary: #d2c9b5;
    --text-muted: #918b80;
    --accent: #a7ff57;
    --accent-strong: #e8ff98;
    --accent-rgb: 167, 255, 87;
    --blood: #ff4d38;
    --ember: #f0a23a;
    --hazard: #4ee8d0;
    --aether-blue: #74ccff;
    --violet: #c286ff;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(184, 104, 255, 0.31);
    --shadow: 0 22px 50px rgba(0, 0, 0, 0.38);
    --shadow-lg: 0 34px 90px rgba(0, 0, 0, 0.48);
    --font-heading: "Cinzel", serif;
    --font-body: "Manrope", sans-serif;
    --font-mono: "Share Tech Mono", monospace;
    --container: 1360px;
    --section-pad: 98px;
    --slab-pad: 26px;
    --radius-ui: 8px;
}

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

html {
    scroll-behavior: smooth;
    scrollbar-color: var(--accent) var(--bg-deep);
    scrollbar-width: thin;
    background: var(--bg-deepest);
}

body {
    min-height: 100vh;
    background:
        linear-gradient(rgba(255, 255, 255, 0.018) 50%, rgba(0, 0, 0, 0.018) 50%),
        linear-gradient(120deg, rgba(167, 255, 87, 0.1), transparent 28%, rgba(116, 204, 255, 0.08) 64%, transparent),
        linear-gradient(180deg, rgba(3, 4, 4, 0.78), rgba(8, 11, 13, 0.96) 42%, #030404 100%),
        url("containment-bg.png") center top / cover fixed;
    background-size: 100% 4px, auto, auto, cover;
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.62;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    letter-spacing: 0;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(167, 255, 87, 0.038) 1px, transparent 1px),
        linear-gradient(0deg, rgba(116, 204, 255, 0.028) 1px, transparent 1px),
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 7px);
    background-size: 76px 76px, 76px 76px, auto;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 72%);
    z-index: -1;
}

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

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    background: none;
}

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

.accent {
    color: var(--accent);
}

.hidden {
    display: none !important;
}

#loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #030404;
    z-index: 10000;
    transition: all 0.45s cubic-bezier(0.77, 0, 0.175, 1);
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loader-logo {
    width: 100px;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(167, 255, 87, 0.4));
    animation: iconPulse 2s infinite ease-in-out;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; filter: drop-shadow(0 0 25px rgba(167, 255, 87, 0.8)); }
}

.loader-text {
    font-family: var(--font-heading);
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 4px;
}

.loader-bar {
    width: 200px;
    height: 3px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

.loader-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--hazard));
    border-radius: 3px;
    animation: loaderFill 1.5s ease-out forwards;
}

@keyframes loaderFill {
    to { width: 100%; }
}

#main-nav {
    position: fixed;
    top: 70px;
    inset: 70px 0 auto 0;
    height: 74px;
    z-index: 1200;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
    padding: 0 28px;
    background: linear-gradient(90deg, rgba(3, 4, 4, 0.9), rgba(9, 11, 13, 0.78));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
}

.nav-hub-link-center {
    justify-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
}

.nav-hub-icon {
    width: 38px;
    height: 38px;
}

.site-switcher {
    position: relative;
    justify-self: start;
}

.site-switcher-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 0;
}

.nav-logo-icon-container {
    width: 42px;
    height: 42px;
    padding: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    background: rgba(var(--accent-rgb), 0.08);
}

.nav-logo-text {
    display: inline-flex;
    flex-direction: column;
    font-family: var(--font-heading);
    font-size: 1rem;
    line-height: 1.05;
}

.nav-status-pill {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    border: 1px solid rgba(240, 162, 58, 0.36);
    border-radius: 4px;
    background: rgba(240, 162, 58, 0.11);
    color: #ffd38c;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.site-switcher-caret {
    width: 9px;
    height: 9px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}

.site-switcher.open .site-switcher-caret {
    transform: rotate(-135deg);
}

.site-switcher-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    min-width: 260px;
    padding: 8px;
    background: rgba(6, 8, 6, 0.98);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
}

.site-switcher-menu[hidden] {
    display: none;
}

.site-switcher-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: background 0.2s ease, color 0.2s ease;
}

.site-switcher-link:hover,
.site-switcher-link:focus-visible {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
}

.site-switcher-link-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
}

.site-switcher-link-label {
    display: grid;
    gap: 2px;
    font-size: 0.78rem;
}

.site-switcher-link-accent {
    color: var(--accent-strong);
    font-weight: 800;
}

.nav-links {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.nav-link,
.nav-kofi-btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.86rem;
    text-transform: uppercase;
    white-space: nowrap;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--accent-strong);
    text-shadow: 0 0 14px rgba(var(--accent-rgb), 0.34);
}

.nav-kofi-btn {
    padding: 0 14px;
    border: 1px solid rgba(240, 162, 58, 0.32);
    color: var(--hazard);
    background: rgba(240, 162, 58, 0.08);
    flex: 0 0 auto;
}

.mobile-menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    justify-self: end;
}

.menu-bar {
    width: 20px;
    height: 2px;
    background: var(--accent);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.mobile-menu-toggle.active .menu-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.active .menu-bar:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .menu-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

#hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: center;
    padding: 118px 28px 72px;
    overflow: hidden;
    isolation: isolate;
}

.hero-bg-effects {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.hex-grid {
    position: absolute;
    inset: -20% -10%;
    opacity: 0.04;
}

.hero-glow {
    position: absolute;
    top: -30%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(167, 255, 87, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(80px);
    animation: heroGlowPulse 6s ease-in-out infinite;
}

@keyframes heroGlowPulse {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.6; transform: translateX(-50%) scale(1.1); }
}

.hero-media {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.78;
    filter: saturate(1.04) contrast(1.12) brightness(0.56);
}

.hero-vignette {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 85% 45%, rgba(167, 255, 87, 0.1) 0%, transparent 60%),
        linear-gradient(90deg, rgba(3, 4, 4, 0.94) 0%, rgba(3, 4, 4, 0.72) 38%, rgba(3, 4, 4, 0.36) 70%, rgba(3, 4, 4, 0.84) 100%),
        linear-gradient(180deg, rgba(3, 4, 4, 0.16) 0%, rgba(3, 4, 4, 0.68) 76%, var(--bg-deepest) 100%),
        repeating-linear-gradient(110deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 18px);
}

/* CONTAINMENT BAR */
.containment-bar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1010;
    background: linear-gradient(180deg, rgba(8, 12, 24, 0.98) 0%, rgba(5, 8, 15, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0 20px;
    display: flex;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    height: 70px;
}

.containment-bar-content {
    width: 100%;
    max-width: 750px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding-bottom: 6px;
    animation: barAmbientPulse 4s ease-in-out infinite;
}

@keyframes barAmbientPulse {
    0%, 100% { opacity: 0.95; filter: brightness(1); }
    50% { opacity: 1; filter: brightness(1.2) drop-shadow(0 0 5px rgba(var(--accent-rgb), 0.1)); }
}

.comp-meta-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    width: 100%;
    margin-bottom: -1px;
}

.comp-title {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 1.5px;
    opacity: 0.95;
}

.comp-paused-result {
    color: var(--blood);
    font-weight: 800;
    margin-left: 6px;
    letter-spacing: 2px;
}

.comp-live-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: -4px;
    transform: translateY(-2px);
}

.live-dot {
    width: 6px;
    height: 6px;
    background: #ef4444;
    border-radius: 50%;
    animation: redPulse 2s infinite ease-in-out;
}

@keyframes redPulse {
    0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 0 5px rgba(255, 0, 0, 0.8); }
    50% { transform: scale(1.2); opacity: 0.6; box-shadow: 0 0 12px rgba(255, 0, 0, 1); }
}

.comp-week-gold {
    color: var(--blood);
    font-weight: 800;
    font-style: italic;
    margin-left: 5px;
}

.comp-main-row {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    position: relative;
}

.comp-faction {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.comp-faction.req { justify-content: flex-end; }
.comp-faction.outbreak { justify-content: flex-start; }

.comp-faction-details {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.comp-faction-name {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.comp-faction-percent {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
}

.comp-faction.req .comp-faction-percent { color: var(--aether-blue); }
.comp-faction.outbreak .comp-faction-percent { color: var(--blood); }

.comp-progress-container {
    flex: 1;
    height: 18px;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.06);
    display: flex;
    position: relative;
    clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
    overflow: hidden;
}

.comp-progress-fill {
    height: 100%;
    transition: width 1s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
}

.comp-progress-fill.req { background: linear-gradient(90deg, #092e42, var(--aether-blue)); }
.comp-progress-fill.outbreak { background: linear-gradient(270deg, #300808, var(--blood)); }

.comp-progress-divider {
    position: absolute;
    top: -5px;
    bottom: -5px;
    width: 3px;
    background: #fff;
    box-shadow: 0 0 12px rgba(255,255,255,0.9);
    z-index: 10;
    transform: translateX(-50%) skewX(-15deg);
    transition: left 1s cubic-bezier(0.19, 1, 0.22, 1);
}

.comp-bar-glitch {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--blood), transparent);
    opacity: 0.3;
    animation: glitchLine 4.5s infinite linear;
}

@keyframes glitchLine {
    0% { transform: translateX(-100%); opacity: 0; }
    10% { opacity: 0.3; }
    20% { transform: translateX(100%); }
    21% { opacity: 0; }
    100% { transform: translateX(100%); opacity: 0; }
}

.hero-layout {
    position: relative;
    z-index: 2;
    width: min(100%, var(--container));
    margin: 0 auto;
    display: block;
    min-width: 0;
}

.hero-content {
    max-width: 820px;
    margin: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 10px;
    border-left: 3px solid var(--accent);
    background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.14), rgba(0, 0, 0, 0.2));
    color: var(--accent-strong);
    font-family: var(--font-mono);
    text-transform: uppercase;
    margin-bottom: 14px;
    box-shadow: 0 0 28px rgba(var(--accent-rgb), 0.12);
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 6.2rem;
    line-height: 0.98;
    text-transform: uppercase;
    max-width: 920px;
    overflow-wrap: normal;
    word-break: normal;
    text-shadow: 0 14px 34px rgba(0, 0, 0, 0.62);
}

.hero-title span {
    display: block;
}

.hero-title .outline {
    color: transparent;
    -webkit-text-stroke: 1px var(--accent);
    text-shadow: 0 0 28px rgba(var(--accent-rgb), 0.24);
}

.hero-subtitle {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 1.02rem;
    max-width: 60ch;
    margin-left: 0;
    margin-right: 0;
    overflow-wrap: anywhere;
    text-shadow: 0 8px 18px rgba(0, 0, 0, 0.72);
}

.hero-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.hero-cta,
.hero-secondary {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 18px;
    border-radius: 4px;
    font-weight: 800;
    text-transform: uppercase;
}

.btn-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hero-cta {
    color: #071005;
    background: linear-gradient(135deg, var(--accent), var(--hazard));
    box-shadow: 0 16px 36px rgba(var(--accent-rgb), 0.18);
}

.hero-secondary {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.34);
    color: var(--text-primary);
}

.hero-stats {
    margin-top: 22px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 12px;
    width: min(100%, 620px);
}

.stat-item {
    min-width: 150px;
    padding: 12px 16px 11px;
    border-top: 3px solid rgba(var(--accent-rgb), 0.62);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.055), transparent), rgba(0, 0, 0, 0.34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.stat-number {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.9rem;
    line-height: 1;
    color: var(--accent-strong);
}

.stat-label {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.latest-panel {
    position: relative;
    min-width: 0;
    width: min(100%, 820px);
    margin: 24px 0 0;
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 2px solid var(--blood);
    background: linear-gradient(135deg, rgba(8, 12, 12, 0.85), rgba(8, 10, 13, 0.7));
    backdrop-filter: blur(12px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    display: grid;
    grid-template-columns: minmax(140px, 0.34fr) minmax(0, 1fr);
    gap: 4px 18px;
    text-align: left;
}

.latest-panel::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.latest-label,
.latest-date {
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
}

.latest-label {
    grid-column: 1;
    grid-row: 1;
    color: var(--accent-strong);
}

.latest-date {
    grid-column: 1;
    grid-row: 2;
}

.latest-panel h2 {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.14rem;
    overflow-wrap: anywhere;
}

.latest-panel p {
    grid-column: 2;
    grid-row: 2;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 0.88rem;
    line-height: 1.45;
}

main {
    background: transparent;
}

.latest-source {
    display: inline-flex;
    margin-top: 16px;
    color: var(--accent-strong);
    font-weight: 800;
}

.scroll-indicator {
    position: absolute;
    right: 34px;
    bottom: 24px;
    z-index: 3;
    display: grid;
    justify-items: center;
    gap: 9px;
    opacity: 0.68;
    pointer-events: none;
}

.scroll-track {
    width: 2px;
    height: 44px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.92), rgba(var(--accent-rgb), 0));
}

.scroll-arrow {
    width: 15px;
    height: 15px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: rotate(45deg);
    animation: scrollBounce 1.9s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0) rotate(45deg); }
    50% { transform: translateY(8px) rotate(45deg); }
}

.section-band {
    padding: var(--section-pad) 28px 0;
    scroll-margin-top: 92px;
}

#filters.section-band {
    padding-top: 82px;
}

.section-inner {
    width: min(100%, var(--container));
    margin: 0 auto;
}

.section-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: center;
    justify-items: center;
    max-width: 900px;
    margin: 0 auto 34px;
    text-align: center;
}

.section-kicker {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    padding: 0 14px;
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.24);
    color: var(--accent-strong);
    font-family: var(--font-mono);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 3.1rem;
    line-height: 1.05;
    text-transform: uppercase;
    text-wrap: balance;
}

.section-desc {
    color: var(--text-secondary);
    max-width: 62ch;
    margin: 0 auto;
    font-size: 1rem;
    text-wrap: pretty;
}

.section-slab {
    position: relative;
    padding: var(--slab-pad);
    border: 1px solid var(--border);
    border-radius: var(--radius-ui);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
        rgba(7, 10, 11, 0.7);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.section-slab::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(var(--accent-rgb), 0.08), transparent 36%),
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 8px);
    opacity: 0.72;
}

.section-slab > * {
    position: relative;
    z-index: 1;
}

.search-panel {
    display: grid;
    gap: 12px;
    width: 100%;
    text-align: left;
}

.search-slab {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    gap: 18px;
    align-items: end;
}

.search-panel label {
    color: var(--text-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
}

.search-panel input {
    min-height: 52px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    padding: 0 14px;
}

.section-shell .section-inner {
    position: relative;
}

.containment-layout {
    display: grid;
    grid-template-columns: minmax(340px, 0.95fr) minmax(0, 1fr);
    gap: 22px;
    align-items: stretch;
}

.map-slab {
    padding: 24px;
}

.containment-map {
    position: relative;
    min-height: 420px;
    overflow: hidden;
    border-radius: var(--radius-ui);
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    background:
        linear-gradient(135deg, rgba(var(--accent-rgb), 0.08), transparent 44%),
        linear-gradient(180deg, rgba(10, 17, 14, 0.94), rgba(4, 6, 7, 0.96)),
        repeating-linear-gradient(60deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 26px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025), var(--shadow);
}

.containment-map::before {
    content: "";
    position: absolute;
    inset: 22px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

.map-node {
    position: absolute;
    z-index: 2;
    min-width: 118px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    border: 1px solid currentColor;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.52);
    color: var(--accent-strong);
    font-family: var(--font-mono);
    font-weight: 800;
    text-transform: uppercase;
    box-shadow: 0 0 26px rgba(var(--accent-rgb), 0.14);
}

.map-node-core {
    left: 50%;
    top: 50%;
    min-width: 142px;
    min-height: 58px;
    color: var(--text-primary);
    border-color: rgba(var(--accent-rgb), 0.66);
    transform: translate(-50%, -50%);
}

.map-node-aether {
    left: 9%;
    top: 17%;
    color: #f4d35e;
}

.map-node-dark {
    right: 8%;
    top: 20%;
    color: #9ef06a;
}

.map-node-chaos {
    left: 12%;
    bottom: 18%;
    color: #49d4ff;
}

.map-node-standalone {
    right: 9%;
    bottom: 16%;
    color: #ff9f5a;
}

.map-line {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 34%;
    height: 1px;
    background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.66), transparent);
    transform-origin: left center;
    opacity: 0.62;
}

.line-a { transform: rotate(214deg); }
.line-b { transform: rotate(326deg); }
.line-c { transform: rotate(145deg); }
.line-d { transform: rotate(35deg); }

.map-panel {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    min-height: 50px;
    padding: 0 14px;
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    border-radius: var(--radius-ui);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.map-panel span {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    text-transform: uppercase;
}

.map-panel strong {
    color: var(--accent-strong);
    font-family: var(--font-heading);
    text-align: right;
    text-transform: uppercase;
}

.filter-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    justify-content: center;
}

.map-filter-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 0 0 24px;
}

.map-btn {
    min-height: 40px;
    min-width: 112px;
    padding: 0 15px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.map-btn:hover,
.map-btn:focus-visible,
.map-btn.active {
    color: var(--accent-strong);
    border-color: rgba(var(--accent-rgb), 0.48);
    background: rgba(var(--accent-rgb), 0.1);
}

.filter-btn {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.filter-btn:hover,
.filter-btn:focus-visible,
.filter-btn.active {
    color: var(--accent-strong);
    border-color: rgba(var(--accent-rgb), 0.45);
    background: rgba(var(--accent-rgb), 0.11);
}

.scope-grid,
.factions-grid,
.creature-grid,
.character-grid,
.sources-grid {
    display: grid;
    gap: 18px;
}

.dossier-slab {
    display: grid;
    gap: 18px;
}

.scope-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.containment-layout .scope-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.factions-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
}

.creature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.character-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sources-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-line {
    display: inline-flex;
    justify-self: start;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    text-transform: uppercase;
}

.scope-card,
.dossier-card,
.entity-card,
.character-card,
.source-card,
.timeline-card,
.empty-state {
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--item-color, var(--accent)), transparent 88%), transparent 46%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
        rgba(12, 15, 17, 0.95);
}

.scope-card,
.dossier-card,
.entity-card,
.source-card,
.timeline-card,
.empty-state {
    padding: 16px;
}

.scope-card {
    position: relative;
    min-height: 170px;
}

.scope-marker {
    width: 38px;
    height: 3px;
    background: var(--item-color);
    margin-bottom: 14px;
    box-shadow: 0 0 18px color-mix(in srgb, var(--item-color), transparent 40%);
}

.scope-card h3,
.dossier-card strong,
.entity-card strong,
.character-card strong,
.source-card strong,
.timeline-card h3 {
    font-family: var(--font-heading);
    line-height: 1.15;
}

.scope-card p,
.card-summary,
.entity-card p,
.character-copy span,
.source-card span,
.timeline-card p {
    color: #d2cdbc;
}

.dossier-card .card-summary,
.entity-card p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    line-height: 1.42;
    font-size: 0.92rem;
}

.dossier-card .card-summary {
    -webkit-line-clamp: 2;
}

.entity-card p {
    -webkit-line-clamp: 3;
}

.dossier-card,
.entity-card,
.character-card {
    position: relative;
    min-height: 100%;
    color: inherit;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.dossier-card {
    display: grid;
    align-content: start;
    min-height: 456px;
}

.dossier-card::before,
.entity-card::before,
.character-card::before {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    top: 0;
    height: 3px;
    border-radius: 0 0 999px 999px;
    background: var(--item-color);
}

.timeline-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--item-color);
}

.dossier-card:hover,
.dossier-card:focus-visible,
.entity-card:hover,
.entity-card:focus-visible,
.character-card:hover,
.character-card:focus-visible {
    transform: translateY(-6px);
    border-color: color-mix(in srgb, var(--item-color), transparent 30%);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--item-color), transparent 80%), transparent 50%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)),
        rgba(15, 16, 22, 0.85);
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7), 0 0 20px color-mix(in srgb, var(--item-color), transparent 80%);
}

.card-kicker,
.entity-class,
.card-file-count {
    display: block;
    color: #a8a296;
    font-family: var(--font-mono);
    font-size: 0.71rem;
    text-transform: uppercase;
}

.card-title-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 11px 0;
}

.card-sigil,
.portrait-fallback,
.entity-sigil {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--item-color), transparent 45%);
    background: color-mix(in srgb, var(--item-color), transparent 88%);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-weight: 800;
    box-shadow: inset 0 0 18px color-mix(in srgb, var(--item-color), transparent 84%);
}

.entity-sigil {
    display: inline-flex;
    margin-bottom: 10px;
}

.card-title-row strong {
    display: block;
    font-size: 1.15rem;
}

.card-title-row em,
.character-copy em {
    display: block;
    color: var(--item-color);
    font-style: normal;
    font-size: 0.82rem;
}

.card-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 9px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.card-footer-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: color-mix(in srgb, var(--item-color), white 32%);
    font-weight: 800;
    font-size: 0.78rem;
    text-transform: uppercase;
}

.record-card-body {
    position: relative;
    z-index: 1;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.record-media {
    position: relative;
    display: block;
    width: 100%;
    min-height: 196px;
    margin: -20px -20px 18px;
    width: calc(100% + 40px);
    overflow: hidden;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--item-color), transparent 80%), rgba(0, 0, 0, 0.2)),
        #070908;
}

.dossier-card .record-media,
.entity-card .record-media {
    min-height: 218px;
    margin: -16px -16px 18px;
    width: calc(100% + 32px);
}

.entity-card .record-media {
    min-height: 184px;
}

.record-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, transparent 24%, rgba(5, 7, 5, 0.82) 100%),
        linear-gradient(90deg, rgba(0, 0, 0, 0.5), transparent 58%);
}

.record-media-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 22%;
    filter: saturate(1.02) contrast(1.12);
}

.record-media-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: color-mix(in srgb, var(--item-color), white 24%);
    font-family: var(--font-heading);
    font-size: 2.4rem;
    font-weight: 800;
    opacity: 0.42;
}

.record-media-scan {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 6px),
        linear-gradient(90deg, color-mix(in srgb, var(--item-color), transparent 72%), transparent 34%);
    mix-blend-mode: screen;
    opacity: 0.28;
}

.member-strip {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 16px;
    margin-bottom: 14px;
    padding-left: 2px;
}

.member-avatar,
.member-more {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 2px solid rgba(13, 14, 19, 0.95);
    background: color-mix(in srgb, var(--item-color), transparent 84%);
    color: var(--text-primary);
    overflow: hidden;
    margin-left: -8px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.34);
}

.member-avatar:first-child,
.member-more:first-child {
    margin-left: 0;
}

.member-avatar {
    position: relative;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
}

.member-avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 18%;
    filter: saturate(0.95) contrast(1.08);
}

.member-avatar-fallback {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--accent-strong);
}

.member-more {
    display: inline-grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 800;
}

.member-avatar:hover,
.member-avatar:focus-visible {
    transform: translateY(-2px);
    border-color: var(--item-color);
}

.entity-card strong {
    display: block;
    margin: 6px 0 7px;
    font-size: 1.2rem;
}

.threat-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.threat-line b {
    color: var(--item-color);
}

.character-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
}

.portrait-fallback {
    width: 58px;
    height: 58px;
}

.character-copy {
    display: grid;
    gap: 5px;
}

.character-copy strong {
    font-size: 1.15rem;
}

.timeline-container {
    position: relative;
    max-width: 1040px;
    margin: 0 auto;
    padding-left: 48px;
}

.timeline-slab {
    padding-top: 30px;
    padding-bottom: 10px;
}

.timeline-container::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, transparent, var(--accent), var(--blood), transparent);
}

.timeline-item {
    position: relative;
    margin-bottom: 22px;
    transition-delay: var(--delay, 0s);
}

.timeline-pin {
    position: absolute;
    left: -42px;
    top: 26px;
    width: 14px;
    height: 14px;
    background: var(--bg-deepest);
    border: 2px solid var(--item-color);
    transform: rotate(45deg);
    box-shadow: 0 0 18px color-mix(in srgb, var(--item-color), transparent 35%);
}

.timeline-card {
    position: relative;
    overflow: hidden;
}

.timeline-date {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0 9px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--item-color), transparent 88%);
    color: var(--item-color);
    font-family: var(--font-mono);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.timeline-card h3 {
    font-size: 1.18rem;
    margin-bottom: 10px;
}

.timeline-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    text-transform: uppercase;
}

.timeline-footer span:last-child {
    color: color-mix(in srgb, var(--item-color), white 32%);
    text-align: right;
}

.source-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.source-row span {
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
}

.source-row a {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    border-radius: 6px;
    color: var(--accent-strong);
    background: rgba(var(--accent-rgb), 0.08);
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-card {
    display: grid;
    gap: 8px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.source-card:hover,
.source-card:focus-visible {
    transform: translateY(-3px);
    border-color: rgba(var(--accent-rgb), 0.38);
}

.source-card strong {
    color: var(--accent-strong);
}

.empty-state {
    color: var(--text-secondary);
    border-style: dashed;
    grid-column: 1 / -1;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(2, 4, 4, 0.86);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: min(1120px, 100%);
    max-height: min(88vh, 880px);
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--item-color), transparent 62%);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--item-color), transparent 91%), transparent 42%),
        linear-gradient(180deg, rgba(17, 23, 22, 0.98), rgba(7, 9, 9, 0.98));
    box-shadow: 0 36px 90px rgba(0, 0, 0, 0.62);
    transform: translateY(16px);
    transition: transform 0.22s ease;
}

.modal-overlay.visible .modal {
    transform: translateY(0);
}

.modal-accent-bar {
    height: 4px;
    background: linear-gradient(90deg, var(--item-color), var(--blood), var(--ember), var(--hazard));
}

.modal-close {
    position: sticky;
    top: 14px;
    float: right;
    width: 40px;
    height: 40px;
    margin: 14px 14px 0 0;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.32);
    color: var(--text-secondary);
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.modal-back {
    position: sticky;
    top: 14px;
    float: left;
    min-height: 40px;
    margin: 14px 0 0 14px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.32);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    text-transform: uppercase;
    cursor: pointer;
    z-index: 2;
}

.modal-back:hover,
.modal-back:focus-visible,
.modal-close:hover,
.modal-close:focus-visible {
    color: var(--accent-strong);
    border-color: rgba(var(--accent-rgb), 0.36);
}

.modal-header,
.modal-body {
    padding: 28px;
}

.modal-header {
    padding-top: 32px;
}

.modal-header .card-kicker {
    color: var(--item-color);
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 2.4rem;
    line-height: 1.05;
    margin: 8px 0;
}

.modal-header p {
    color: var(--text-secondary);
}

.modal-lead {
    color: var(--text-secondary);
    font-size: 1.02rem;
}

.modal-section-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.modal-section-grid section {
    border-left: 2px solid color-mix(in srgb, var(--item-color), transparent 45%);
    padding-left: 14px;
    min-width: 0;
}

.modal-section-grid h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    margin-bottom: 8px;
}

.modal-section-grid p,
.modal-section-grid li {
    color: var(--text-secondary);
}

.modal-section-grid ul {
    display: grid;
    gap: 8px;
    padding-left: 17px;
}

.dossier-open {
    display: grid;
    grid-template-columns: minmax(300px, 0.54fr) minmax(0, 1fr);
    gap: 22px;
    align-items: stretch;
}

.modal-visual {
    position: relative;
    min-height: 330px;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--item-color), transparent 55%);
    background: #060806;
}

.modal-visual .record-media {
    min-height: 100%;
    height: 100%;
    margin: 0;
    width: 100%;
    min-height: 330px;
}

.portrait-visual .record-media-img {
    object-position: center 14%;
}

.file-stamp {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 2;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border: 1px solid color-mix(in srgb, var(--item-color), transparent 42%);
    background: rgba(0, 0, 0, 0.58);
    color: var(--accent-strong);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.modal-brief {
    display: grid;
    gap: 18px;
    align-content: start;
}

.intel-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.intel-tile {
    min-height: 92px;
    padding: 13px;
    border-left: 2px solid color-mix(in srgb, var(--item-color), transparent 45%);
    background: rgba(255, 255, 255, 0.045);
    min-width: 0;
}

.intel-tile span {
    display: block;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.intel-tile strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.25;
}

.dossier-panel {
    margin-top: 22px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
}

.dossier-panel h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    margin-bottom: 14px;
}

.member-chip-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.member-chip {
    min-width: 0;
    min-height: 90px;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 13px;
    align-items: center;
    padding: 11px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(0, 0, 0, 0.24);
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.member-chip:hover,
.member-chip:focus-visible {
    border-color: color-mix(in srgb, var(--item-color), transparent 42%);
    background: color-mix(in srgb, var(--item-color), transparent 91%);
}

.member-chip-avatar {
    position: relative;
    width: 64px;
    height: 64px;
    display: inline-grid;
    place-items: center;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--item-color), transparent 44%);
    background: rgba(0, 0, 0, 0.35);
}

.member-chip-copy {
    min-width: 0;
}

.member-chip-copy strong,
.member-chip-copy em {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-chip-copy strong {
    font-family: var(--font-heading);
    line-height: 1.1;
}

.member-chip-copy em {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-style: normal;
    white-space: nowrap;
}

.mini-timeline {
    display: grid;
    gap: 10px;
}

.mini-timeline article {
    display: grid;
    gap: 2px;
    padding-left: 11px;
    border-left: 2px solid color-mix(in srgb, var(--item-color), transparent 45%);
}

.mini-timeline span,
.muted-copy {
    color: var(--text-muted);
}

.mini-timeline span {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.mini-timeline strong {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.linked-group-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.linked-group {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px 0 7px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(0, 0, 0, 0.24);
    color: inherit;
    cursor: pointer;
}

.linked-group span {
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--item-color), transparent 84%);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 800;
}

.linked-group strong {
    font-family: var(--font-heading);
}

.influence-shell {
    padding: 26px;
    border-color: rgba(var(--accent-rgb), 0.18);
    background:
        linear-gradient(135deg, rgba(var(--accent-rgb), 0.07), transparent 40%),
        rgba(7, 10, 11, 0.9);
    box-shadow: var(--shadow-lg);
}

.influence-picker {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.influence-picker-label {
    color: var(--accent-strong);
    font-family: var(--font-mono);
    text-transform: uppercase;
}

.influence-selector {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.influence-selector-btn {
    min-width: 0;
    min-height: 94px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(4, 6, 7, 0.64);
    color: var(--text-primary);
    text-align: center;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.influence-selector-btn:hover,
.influence-selector-btn:focus-visible {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--item-color), transparent 42%);
    background: color-mix(in srgb, var(--item-color), transparent 90%);
}

.influence-selector-btn.active {
    border-color: color-mix(in srgb, var(--item-color), transparent 22%);
    background: color-mix(in srgb, var(--item-color), transparent 84%);
    box-shadow: inset 0 0 22px color-mix(in srgb, var(--item-color), transparent 88%);
}

.influence-selector-portrait {
    position: relative;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--item-color), transparent 45%);
    border-radius: 5px;
    background: color-mix(in srgb, var(--item-color), transparent 88%);
}

.influence-selector-fallback {
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 800;
}

.influence-selector-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.influence-selector-name {
    max-width: 100%;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.12;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.influence-selector-btn.active .influence-selector-name {
    color: var(--text-primary);
}

.influence-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr;
    gap: 14px;
}

.influence-card {
    min-width: 0;
    padding: 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid color-mix(in srgb, var(--item-color, var(--accent)), transparent 26%);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--item-color, var(--accent)), transparent 91%), transparent 54%),
        rgba(8, 11, 12, 0.88);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.influence-prime {
    grid-row: span 2;
}

.influence-card h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    line-height: 1.1;
    margin-bottom: 10px;
}

.influence-card p {
    color: var(--text-secondary);
}

.influence-open {
    min-height: 38px;
    margin-top: 18px;
    padding: 0 13px;
    border-radius: 4px;
    border: 1px solid color-mix(in srgb, var(--item-color, var(--accent)), transparent 34%);
    background: color-mix(in srgb, var(--item-color, var(--accent)), transparent 88%);
    color: var(--text-primary);
    font-family: var(--font-mono);
    text-transform: uppercase;
    cursor: pointer;
}

.member-chip-grid.compact {
    grid-template-columns: 1fr;
}

.member-chip-grid.compact .member-chip {
    min-height: 70px;
    grid-template-columns: 48px minmax(0, 1fr);
}

.member-chip-grid.compact .member-chip-avatar {
    width: 48px;
    height: 48px;
}

.influence-entity-list,
.influence-source-list {
    display: grid;
    gap: 10px;
}

.influence-source-list a {
    min-height: 38px;
    display: flex;
    align-items: center;
    padding: 0 11px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.24);
    color: var(--accent-strong);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.modal-open,
body.menu-open {
    overflow: hidden;
}

body.menu-open #main-nav {
    z-index: 1700;
}

#footer {
    margin-top: 90px;
    padding: 44px 28px;
    background: #050705;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-content {
    width: min(100%, var(--container));
    margin: 0 auto;
    display: grid;
    gap: 10px;
    justify-items: center;
    text-align: center;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
}

.footer-logo img {
    width: 36px;
    height: 36px;
}

.footer-note {
    color: var(--text-muted);
    font-size: 0.86rem;
}

.footer-credit-link,
.kofi-link {
    color: var(--accent-strong);
}

.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 50px;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: rgba(4, 6, 4, 0.88);
    color: var(--accent-strong);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 1400;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover,
.back-to-top:focus-visible {
    transform: translateY(-2px);
}

.command-palette {
    position: fixed;
    inset: 0;
    z-index: 10030;
    display: grid;
    place-items: start center;
    padding: 16vh 24px 24px;
    background: rgba(2, 4, 4, 0.82);
    backdrop-filter: blur(10px) saturate(140%);
}

.command-palette.hidden {
    display: none;
}

.command-palette-panel {
    width: min(760px, 100%);
    max-height: min(680px, calc(100svh - 130px));
    overflow: hidden;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    border-radius: 8px;
    border: 1px solid rgba(var(--accent-rgb), 0.42);
    background:
        linear-gradient(135deg, rgba(var(--accent-rgb), 0.08), transparent 46%),
        rgba(8, 11, 12, 0.98);
    box-shadow: 0 34px 90px rgba(0, 0, 0, 0.68), 0 0 28px rgba(var(--accent-rgb), 0.16);
}

.command-palette-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.command-palette-head h2 {
    font-family: var(--font-heading);
    font-size: 1rem;
    text-transform: uppercase;
    color: var(--accent-strong);
}

#command-palette-close {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
}

#command-palette-input {
    min-height: 54px;
    margin: 0 20px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--text-primary);
    padding: 0 14px;
}

#command-palette-input:focus {
    outline: none;
    border-color: rgba(var(--accent-rgb), 0.58);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14);
}

.command-results {
    overflow-y: auto;
    display: grid;
    gap: 8px;
    padding: 0 20px 20px;
}

.command-result {
    min-height: 64px;
    display: grid;
    gap: 3px;
    align-content: center;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.24);
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.command-result:hover,
.command-result:focus-visible {
    border-color: rgba(var(--accent-rgb), 0.42);
    background: rgba(var(--accent-rgb), 0.08);
}

.command-result span {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.command-result strong {
    color: var(--text-primary);
    font-family: var(--font-heading);
    line-height: 1.1;
}

.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.42s ease, transform 0.42s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1180px) {
    .hero-layout,
    .section-header {
        grid-template-columns: 1fr;
    }

    .search-slab {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .hero-content {
        max-width: 840px;
    }

    .containment-layout {
        grid-template-columns: 1fr;
    }

    .latest-panel {
        max-width: 720px;
    }

    .scope-grid,
    .creature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .factions-grid,
    .sources-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .influence-selector {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    :root {
        --section-pad: 76px;
        --slab-pad: 20px;
    }

    #main-nav {
        grid-template-columns: 1fr auto 1fr;
        grid-template-rows: 74px;
        align-content: start;
        padding: 0 18px;
    }

    body.menu-open #main-nav {
        height: 100svh;
        background: rgba(3, 5, 3, 0.98);
    }

    .mobile-menu-toggle {
        display: inline-flex;
    }

    .nav-links {
        position: absolute;
        top: 74px;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 2;
        width: 100%;
        height: calc(100svh - 74px);
        max-width: none;
        display: none;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 10px;
        padding: 22px;
        background: rgba(3, 5, 3, 0.98);
        overflow-y: auto;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-link,
    .nav-kofi-btn {
        position: relative;
        z-index: 1801;
        justify-content: flex-start;
        width: 100%;
        min-width: 0;
        padding: 0 12px;
        border: 1px solid rgba(255, 255, 255, 0.09);
        background: rgba(3, 5, 3, 0.74);
        white-space: normal;
        text-align: left;
        line-height: 1.2;
    }

    .nav-logo-text {
        display: none;
    }

    .nav-status-pill {
        display: none;
    }

    #hero {
        min-height: 100svh;
        padding: 96px 20px 42px;
    }

    .hero-title {
        font-size: 3.2rem;
        max-width: 100%;
    }

    .eyebrow {
        display: block;
        width: 100%;
        max-width: 32ch;
        min-height: 0;
        padding-top: 6px;
        padding-bottom: 6px;
        font-size: 0.86rem;
        white-space: normal;
    }

    .hero-subtitle {
        max-width: 40ch;
        font-size: 0.96rem;
    }

    .hero-stats {
        width: 100%;
        gap: 8px;
    }

    .stat-item {
        min-width: 104px;
        flex: 1 1 0;
        padding: 10px 8px;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.68rem;
        line-height: 1.2;
    }

    .latest-panel {
        grid-template-columns: 1fr;
        gap: 3px;
        padding: 13px 14px;
        text-align: center;
    }

    .latest-label,
    .latest-date,
    .latest-panel h2,
    .latest-panel p {
        grid-column: auto;
        grid-row: auto;
    }

    .hero-stats,
    .scope-grid,
    .containment-layout .scope-grid,
    .factions-grid,
    .creature-grid,
    .character-grid,
    .sources-grid,
    .influence-grid,
    .modal-section-grid,
    .dossier-open,
    .intel-grid,
    .member-chip-grid {
        grid-template-columns: 1fr;
    }

    .section-band {
        padding: var(--section-pad) 20px 0;
    }

    .section-title {
        font-size: 2.1rem;
    }

    .section-header {
        margin-bottom: 24px;
    }

    .section-slab {
        padding: var(--slab-pad);
    }

    .containment-map {
        min-height: 340px;
    }

    .map-panel {
        left: 12px;
        right: 12px;
        bottom: 12px;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 2px;
        padding: 8px 12px;
    }

    .map-panel strong {
        text-align: left;
    }

    .timeline-container {
        padding-left: 40px;
    }

    .modal-overlay {
        padding: 14px;
    }

    .modal-header,
    .modal-body {
        padding-left: 20px;
        padding-right: 20px;
    }

    .modal-header h2 {
        font-size: 1.9rem;
    }

    .source-row a {
        max-width: 100%;
    }

    .influence-shell {
        padding: 18px;
    }

    .influence-selector {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .influence-selector-btn {
        min-height: 82px;
        gap: 6px;
        padding: 8px 4px;
    }

    .influence-selector-portrait {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .influence-selector-name {
        font-size: 0.64rem;
    }

    .scroll-indicator {
        display: none;
    }
}

@media (max-width: 520px) {
    .site-switcher-menu {
        min-width: min(280px, calc(100vw - 32px));
    }

    .hero-title {
        font-size: 2.7rem;
    }

    .hero-actions {
        align-items: center;
    }

    .hero-cta,
    .hero-secondary {
        min-height: 40px;
        padding: 0 13px;
        font-size: 0.82rem;
    }

    .latest-panel p {
        display: none;
    }

    .character-card {
        grid-template-columns: 1fr;
    }

    .record-media {
        min-height: 150px;
    }

    .containment-map {
        min-height: 300px;
    }

    .map-node {
        min-width: 96px;
        min-height: 38px;
        padding: 0 9px;
        font-size: 0.72rem;
    }

    .map-node-core {
        min-width: 112px;
        min-height: 48px;
    }

    .filter-strip {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .map-filter-strip {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .map-btn {
        min-width: 0;
    }

    .command-palette {
        padding-top: 84px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.site-switcher-menu {
    min-width: 300px;
    max-width: min(340px, calc(100vw - 32px));
    padding: 10px;
}

.site-switcher-link {
    position: relative;
    align-items: center;
    gap: 14px;
    min-height: 58px;
    padding: 12px 14px 12px 16px;
    overflow: hidden;
}

.site-switcher-link::before {
    content: "";
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 0;
    width: 2px;
    background: var(--switcher-accent, var(--accent));
    opacity: 0.45;
}

.site-switcher-link:hover::before,
.site-switcher-link:focus-visible::before {
    opacity: 1;
    box-shadow: 0 0 14px var(--switcher-glow, rgba(255, 255, 255, 0.4));
}

.site-switcher-link-icon {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
}

.site-switcher-link-label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    line-height: 1.12;
    letter-spacing: 0;
}

.site-switcher-link-kicker {
    color: var(--text-muted, rgba(255, 255, 255, 0.58));
    font-size: 0.56rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.site-switcher-link-accent {
    font-size: 0.92rem;
    letter-spacing: 1.45px;
    text-transform: uppercase;
}

.site-switcher-link.ow-link { --switcher-accent: #d28cff; --switcher-glow: rgba(187, 41, 255, 0.55); }
.site-switcher-link.mr-link { --switcher-accent: #ff5c7a; --switcher-glow: rgba(255, 47, 96, 0.5); }
.site-switcher-link.cp-link { --switcher-accent: #fcee09; --switcher-glow: rgba(252, 238, 9, 0.55); }
.site-switcher-link.lol-link { --switcher-accent: #c8aa6e; --switcher-glow: rgba(200, 170, 110, 0.48); }
.site-switcher-link.ymir-link { --switcher-accent: #ff8a3d; --switcher-glow: rgba(255, 122, 48, 0.48); }
.site-switcher-link.shinobi-link { --switcher-accent: #ff9d3d; --switcher-glow: rgba(249, 115, 22, 0.55); }
.site-switcher-link.wf-link { --switcher-accent: #22d3ee; --switcher-glow: rgba(34, 211, 238, 0.55); }
.site-switcher-link.cod-link { --switcher-accent: #d8d7c4; --switcher-glow: rgba(216, 215, 196, 0.5); }
.site-switcher-link.tes-link { --switcher-accent: #d8b36a; --switcher-glow: rgba(216, 179, 106, 0.48); }
.site-switcher-link.dl-link { --switcher-accent: #d8a84d; --switcher-glow: rgba(216, 168, 77, 0.5); }

.site-switcher-link .site-switcher-link-accent {
    color: var(--switcher-accent, currentColor);
    text-shadow: 0 0 12px var(--switcher-glow, transparent);
}

.site-switcher-toggle .nav-logo-icon-container,
.site-switcher-toggle .nav-logo-mark {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.site-switcher-link[aria-disabled="true"] {
    opacity: 0.68;
    cursor: default;
}

.site-switcher-link[aria-disabled="true"]:hover,
.site-switcher-link[aria-disabled="true"]:focus-visible {
    opacity: 0.78;
    background: rgba(255, 255, 255, 0.05);
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border-strong, var(--border, rgba(255, 255, 255, 0.16)));
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.language-switcher label {
    color: var(--text-secondary, rgba(255, 255, 255, 0.68));
    font-size: 0.68rem;
    letter-spacing: 0.08rem;
    text-transform: uppercase;
}

.language-switcher select {
    min-width: 96px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.82rem;
    text-transform: uppercase;
    outline: 0;
}

.language-switcher select option {
    color: #111827;
    background: #ffffff;
}

@media (max-width: 768px) {
    .language-switcher {
        width: 100%;
        justify-content: space-between;
    }

    .language-switcher select {
        flex: 1;
        text-align: right;
    }
}

.site-switcher-toast {
    position: fixed;
    left: 50%;
    top: 50%;
    max-width: calc(100vw - 24px);
    padding: 10px 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-ui);
    background: rgba(8, 11, 13, 0.96);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    box-shadow: var(--shadow);
    z-index: 10001;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -44%);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.site-switcher-toast.visible {
    opacity: 1;
    transform: translate(-50%, -50%);
}

.nav-language-control,
.hero-language-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-height: 38px;
    padding: 5px 8px 5px 12px;
    border: 1px solid rgba(var(--accent-rgb), 0.32);
    border-radius: var(--radius-ui);
    background: rgba(3, 5, 3, 0.76);
    color: var(--text-primary);
    box-shadow: inset 0 0 16px rgba(var(--accent-rgb), 0.08), 0 0 18px rgba(var(--accent-rgb), 0.08);
    backdrop-filter: blur(10px);
}

.nav-language-control-mobile {
    display: none;
}

.nav-language-label,
.hero-language-label {
    color: var(--accent-strong);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.nav-language-select-wrap,
.hero-language-select-wrap {
    position: relative;
    min-width: 116px;
}

.nav-language-select,
.hero-language-select {
    width: 100%;
    min-height: 28px;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(var(--accent-rgb), 0.34);
    border-radius: calc(var(--radius-ui) - 2px);
    background: rgba(8, 11, 13, 0.9);
    color: var(--text-primary);
    padding: 4px 28px 4px 9px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    outline: 0;
    cursor: pointer;
}

.nav-language-select:hover,
.nav-language-select:focus,
.hero-language-select:hover,
.hero-language-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.14);
}

.nav-language-select option,
.hero-language-select option {
    color: var(--text-primary);
    background: var(--bg-deepest);
}

.nav-language-caret,
.hero-language-caret {
    position: absolute;
    right: 10px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}

@media (min-width: 821px) {
    .site-switcher {
        grid-column: 1;
        justify-self: start;
    }

    .nav-language-control-top {
        grid-column: 1;
        justify-self: end;
    }

    .nav-hub-link-center {
        grid-column: 2;
    }

    .nav-links {
        grid-column: 3;
    }
}

@media (min-width: 821px) and (max-width: 1180px) {
    #main-nav {
        grid-template-columns: auto auto minmax(0, 1fr);
    }

    .nav-language-control-top {
        grid-column: 2;
        justify-self: start;
    }

    .nav-hub-link-center {
        display: none;
    }

    .nav-links {
        grid-column: 3;
    }
}

@media (max-width: 820px) {
    .nav-language-control-top {
        display: none;
    }

    .nav-language-control-mobile {
        display: inline-flex;
        width: 100%;
        justify-content: space-between;
    }

    .nav-language-control-mobile .nav-language-select-wrap,
    .hero-language-select-wrap {
        min-width: 150px;
    }

    .hero-language-control {
        width: min(100%, 300px);
        justify-content: space-between;
    }
}

/* ---------- LORE CODEX ALIGNMENT: MOBILE MAP + BACK TO TOP ---------- */
@media (max-width: 768px) {
    #network-map {
        overflow-x: clip;
    }

    #network-map .map-slab {
        overflow: visible;
    }

    #network-map .containment-map {
        width: 100vw;
        max-width: 100vw;
        min-height: clamp(460px, 60svh, 540px);
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }

    #network-map .containment-map::before {
        inset: 14px;
    }

    .back-to-top {
        width: 48px;
        height: 48px;
        right: calc(18px + env(safe-area-inset-right));
        bottom: calc(18px + env(safe-area-inset-bottom));
        z-index: 1400;
    }
}
