:root {
    --rail-bg: rgba(8, 8, 10, .94);
    --rail-line: rgba(255,255,255,.10);
    --rail-card: #121214;
    --rail-soft: #1a1a1e;
    --rail-text: #ffffff;
    --rail-muted: #a8a8ad;
    --rail-accent: #3d7cff;
    --rail-gold: #f0bf42;
}

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

.command-rail {
    position: sticky;
    top: 0;
    z-index: 5000;
    width: 100%;
    background: var(--rail-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--rail-line);
    box-shadow: 0 12px 30px rgba(0,0,0,.28);
}

.rail-inner {
    width: min(1240px, calc(100% - 24px));
    min-height: 72px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
}

.rail-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--rail-text);
    text-decoration: none;
    min-width: max-content;
}

.rail-brand-mark {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--rail-accent), #16161a 62%, var(--rail-gold));
    border: 1px solid rgba(255,255,255,.16);
    font-size: 14px;
    font-weight: 1000;
    letter-spacing: -.03em;
}

.rail-brand-text {
    font-size: 18px;
    font-weight: 1000;
    letter-spacing: -.03em;
}

.rail-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    background: var(--rail-card);
    border: 1px solid var(--rail-line);
    border-radius: 999px;
    padding: 5px;
    min-width: 0;
}

.rail-search input {
    width: 100%;
    min-width: 0;
    height: 40px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--rail-text);
    padding: 0 14px;
    font-size: 14px;
}

.rail-search input::placeholder {
    color: #777984;
}

.rail-search button {
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: var(--rail-accent);
    color: #fff;
    padding: 0 18px;
    font-weight: 900;
    cursor: pointer;
}

.rail-links {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: max-content;
}

.rail-links a {
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding: 0 13px;
    border-radius: 999px;
    color: #d6d6da;
    text-decoration: none;
    font-size: 14px;
    font-weight: 900;
}

.rail-links a:hover {
    background: var(--rail-soft);
    color: #fff;
}

.rail-command {
    position: relative;
    min-width: max-content;
}

.command-badge {
    height: 46px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: var(--rail-card);
    color: var(--rail-text);
    border: 1px solid var(--rail-line);
    border-radius: 999px;
    padding: 4px 10px 4px 4px;
    cursor: pointer;
}

.command-avatar {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #252b37, var(--rail-accent));
    color: #fff;
    font-size: 14px;
    font-weight: 1000;
}

.command-name {
    max-width: 115px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #f3f3f5;
    font-size: 13px;
    font-weight: 900;
}

.command-gear {
    color: var(--rail-muted);
    font-size: 15px;
}

.command-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 12px);
    width: 280px;
    display: none;
    background: #101013;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0,0,0,.46);
    padding: 10px;
}

.command-menu.is-open {
    display: block;
}

.command-menu::before {
    content: "";
    position: absolute;
    right: 24px;
    top: -7px;
    width: 12px;
    height: 12px;
    transform: rotate(45deg);
    background: #101013;
    border-left: 1px solid rgba(255,255,255,.12);
    border-top: 1px solid rgba(255,255,255,.12);
}

.command-menu-head {
    padding: 12px 12px 10px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 8px;
}

.command-menu-head strong,
.command-menu-head span {
    display: block;
}

.command-menu-head strong {
    color: #fff;
    font-size: 14px;
}

.command-menu-head span {
    color: var(--rail-muted);
    line-height: 1.45;
    font-size: 12px;
    margin-top: 4px;
}

.command-menu a {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 12px;
    color: #dcdce2;
    text-decoration: none;
    font-weight: 900;
    font-size: 14px;
}

.command-menu a:hover {
    background: var(--rail-soft);
    color: #fff;
}

.command-reward-mini {
    display: grid;
    gap: 8px;
    margin: 0 0 8px;
    padding: 0 4px 8px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.command-reward-mini-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
}

.command-reward-mini-stats span {
    min-width: 0;
    padding: 7px 5px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 10px;
    background: rgba(255,255,255,.045);
    text-align: center;
}

.command-reward-mini-stats small,
.command-reward-mini-stats strong {
    display: block;
}

.command-reward-mini-stats small {
    margin-bottom: 3px;
    color: var(--rail-muted);
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.command-reward-mini-stats strong {
    color: #fff;
    font-size: 13px;
    font-weight: 1000;
    line-height: 1;
    white-space: nowrap;
}

.command-reward-mini-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,.10);
}

.command-reward-mini-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--rail-accent), #77a6ff);
    box-shadow: 0 0 14px rgba(61,124,255,.45);
}

body.is-guest .command-menu {
    display: block;
}

body.is-guest.command-menu-dismissed .command-menu {
    display: none;
}

body.is-guest .command-menu.is-open {
    display: block;
}

.site-main {
    padding-top: 24px;
}

@media (max-width: 920px) {
    .rail-inner {
        grid-template-columns: auto 1fr auto;
        gap: 12px;
        padding: 10px 0;
    }

    .rail-links {
        display: none;
    }

    .rail-brand-text {
        display: none;
    }
}

@media (max-width: 640px) {
    .rail-inner {
        grid-template-columns: auto 1fr auto;
        width: calc(100% - 16px);
    }

    .rail-search button {
        width: 42px;
        padding: 0;
        overflow: hidden;
        text-indent: -999px;
        position: relative;
    }

    .rail-search button::after {
        content: "⌕";
        position: absolute;
        inset: 0;
        display: grid;
        place-items: center;
        text-indent: 0;
        font-size: 18px;
        font-weight: 1000;
    }

    .command-name {
        display: none;
    }

    .command-badge {
        padding-right: 6px;
    }

    .command-menu {
        position: fixed;
        right: 8px;
        left: 8px;
        top: 78px;
        width: auto;
    }

    .command-menu::before {
        display: none;
    }
}

/* WRUniverse launch logo integration: header only, constrained to existing rail layout. */
.rail-brand-logo {
    display: block;
    width: auto;
    height: 42px;
    max-width: 142px;
    object-fit: contain;
}

.rail-brand-has-logo {
    gap: 10px;
}

.rail-brand-has-logo .rail-brand-mark {
    display: none;
}

@media (max-width: 920px) {
    .rail-brand-logo {
        height: 38px;
        max-width: 124px;
    }
}

@media (max-width: 640px) {
    .rail-brand-logo {
        height: 32px;
        max-width: 104px;
    }
}
