:root {
    --brand: #7c3cff;
    --brand-accent: #a369ff;
    --bg: #0d0f18;
    --bg-alt: #141824;
    --panel: #191e2d;
    --panel-alt: #22283a;
    --border: #30384d;
    --text: #f2f4fb;
    --text-dim: #a8b0c6;
    --radius: 14px;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html[data-theme="light"] {
    --brand: #6425e8;
    --brand-accent: #7d43ef;
    --bg: #f4f6fb;
    --bg-alt: #eef1f7;
    --panel: #ffffff;
    --panel-alt: #f3f5fa;
    --border: #dce1eb;
    --text: #171b29;
    --text-dim: #5f687e;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin-bottom: 0 !important;
}

.ed-shell-header {
    position: sticky;
    top: 0;
    z-index: 2000;
    width: 100%;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(145%);
    backdrop-filter: blur(18px) saturate(145%);
}

.ed-shell-header-inner {
    width: min(100%, 1880px);
    min-height: 72px;
    margin: 0 auto;
    padding: 0 28px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 24px;
}

.ed-brand {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.ed-brand:hover { color: var(--text); }

.ed-brand-logo {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 10px;
    object-fit: contain;
    image-rendering: auto;
    box-shadow: 0 10px 28px rgba(124, 60, 255, .20);
}

.ed-brand-copy {
    display: grid;
    gap: 1px;
    line-height: 1.1;
}

.ed-brand-copy strong {
    font-size: .94rem;
    letter-spacing: -.02em;
    font-weight: 760;
}

.ed-brand-copy small {
    color: var(--text-dim);
    font-size: .59rem;
    letter-spacing: .035em;
}

.ed-version-badge {
    padding: 5px 8px;
    border: 1px solid rgba(163, 105, 255, .38);
    border-radius: 8px;
    background: rgba(124, 60, 255, .12);
    color: var(--brand-accent);
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .03em;
}

.ed-primary-nav {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    white-space: nowrap;
}

.ed-nav-link,
.ed-nav-dropdown > summary {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: .72rem;
    font-weight: 680;
    cursor: pointer;
    list-style: none;
    transition: color .16s ease, background .16s ease, border-color .16s ease;
}

.ed-nav-dropdown > summary::-webkit-details-marker,
.ed-account-menu > summary::-webkit-details-marker { display: none; }

.ed-nav-link svg,
.ed-nav-dropdown > summary > svg:not(.ed-chevron),
.ed-icon-button svg,
.ed-mobile-menu svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ed-nav-link:hover,
.ed-nav-link.active,
.ed-nav-dropdown > summary:hover,
.ed-nav-dropdown.active > summary,
.ed-nav-dropdown[open] > summary {
    color: var(--text);
    background: var(--panel);
    border-color: var(--border);
}

.ed-nav-link.active,
.ed-nav-dropdown.active > summary {
    color: var(--brand-accent);
}

.ed-nav-dropdown,
.ed-account-menu { position: relative; }

.ed-chevron {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .16s ease;
}

.ed-nav-dropdown[open] .ed-chevron,
.ed-account-menu[open] .ed-chevron { transform: rotate(180deg); }

.ed-dropdown-menu,
.ed-account-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 272px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--panel) 96%, transparent);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.ed-dropdown-menu-right { left: auto; right: 0; }

.ed-dropdown-menu a {
    display: grid;
    gap: 2px;
    padding: 10px 11px;
    border-radius: 9px;
    color: var(--text);
    text-decoration: none;
}

.ed-dropdown-menu a:hover,
.ed-dropdown-menu a.active { background: var(--panel-alt); }

.ed-dropdown-menu a span { font-size: .76rem; font-weight: 720; }
.ed-dropdown-menu a small { color: var(--text-dim); font-size: .62rem; line-height: 1.35; }

.ed-disabled-nav-item {
    display: grid;
    gap: 2px;
    padding: 10px 11px;
    border-radius: 9px;
    color: var(--text-dim);
    background: color-mix(in srgb, var(--panel-alt) 68%, transparent);
    opacity: .68;
    cursor: not-allowed;
    user-select: none;
}
.ed-disabled-nav-item > span { font-size: .76rem; font-weight: 720; }
.ed-disabled-nav-item small { color: var(--text-dim); font-size: .62rem; line-height: 1.35; }

.ed-header-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
}

.ed-icon-button,
.ed-mobile-menu {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--panel);
    color: var(--text-dim);
    cursor: pointer;
}

.ed-icon-button:hover,
.ed-mobile-menu:hover { color: var(--text); border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); }

html[data-theme="dark"] .ed-theme-sun,
html[data-theme="light"] .ed-theme-moon { display: none; }


.ed-create-account {
    min-height: 38px;
    padding: 0 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 11px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: .76rem;
    font-weight: 800;
    white-space: nowrap;
}
.ed-create-account:hover { color: var(--text); border-color: color-mix(in srgb,var(--brand-accent) 42%,var(--border)); }

.ed-sign-in {
    min-height: 38px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), var(--brand-accent));
    color: #fff;
    text-decoration: none;
    font-size: .72rem;
    font-weight: 800;
    box-shadow: 0 10px 28px rgba(124, 60, 255, .22);
}

.ed-sign-in:hover { color: #fff; filter: brightness(1.05); }

.ed-account-menu > summary {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 9px 4px 5px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    list-style: none;
}

.ed-avatar {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--brand), var(--brand-accent));
    color: #fff;
    font-size: .72rem;
    font-weight: 850;
}

.ed-avatar.large { width: 40px; height: 40px; border-radius: 11px; }
.ed-account-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; font-size: .72rem; font-weight: 750; }

.ed-account-dropdown {
    left: auto;
    right: 0;
    width: 238px;
}

.ed-account-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 8px 13px;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--border);
}

.ed-account-heading div { min-width: 0; display: grid; }
.ed-account-heading strong { overflow: hidden; text-overflow: ellipsis; font-size: .78rem; }
.ed-account-heading small { color: var(--text-dim); font-size: .62rem; }

.ed-account-dropdown > a,
.ed-account-dropdown form button {
    width: 100%;
    display: block;
    padding: 10px 11px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    text-align: left;
    text-decoration: none;
    font: 680 .72rem 'Inter', sans-serif;
    cursor: pointer;
}

.ed-account-dropdown > a:hover,
.ed-account-dropdown form button:hover { background: var(--panel-alt); }
.ed-account-dropdown form { margin: 5px 0 0; padding-top: 5px; border-top: 1px solid var(--border); }
.ed-account-dropdown form button { color: #ff938d; }

.ed-mobile-menu { display: none; }

.ed-shell-main {
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
    padding: 18px 22px 36px;
    flex: 1 0 auto;
}

.ed-content-root { width: 100%; }

/* Several legacy pages include their own sticky toolbar. The shared shell now owns that job. */
.ed-content-root header.app-bar { display: none !important; }

.ed-shell-footer {
    min-height: 58px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-alt) 76%, transparent);
    color: var(--text-dim);
    font-size: .67rem;
}

.ed-shell-footer a { color: var(--brand-accent); text-decoration: none; }
.ed-footer-separator { width: 3px; height: 3px; border-radius: 50%; background: var(--border); }

@media (max-width: 1380px) {
    .ed-brand-copy small { display: none; }
    .ed-brand-copy strong { font-size: .88rem; }
    .ed-shell-header-inner { gap: 15px; padding: 0 20px; }
    .ed-nav-link, .ed-nav-dropdown > summary { padding-inline: 8px; }
}

@media (max-width: 1110px) {
    .ed-shell-header-inner {
        grid-template-columns: minmax(0, 1fr) auto auto;
        min-height: 66px;
    }

    .ed-version-badge { display: none; }
    .ed-mobile-menu { display: inline-grid; grid-column: 2; grid-row: 1; }
    .ed-header-actions { grid-column: 3; grid-row: 1; }

    .ed-primary-nav {
        display: none;
        position: absolute;
        top: calc(100% + 1px);
        left: 14px;
        right: 14px;
        padding: 10px;
        flex-direction: column;
        align-items: stretch;
        border: 1px solid var(--border);
        border-radius: 0 0 16px 16px;
        background: color-mix(in srgb, var(--panel) 97%, transparent);
        box-shadow: 0 25px 60px rgba(0,0,0,.32);
        white-space: normal;
    }

    .ed-primary-nav.is-open { display: flex; }
    .ed-nav-link, .ed-nav-dropdown > summary { width: 100%; justify-content: flex-start; min-height: 42px; }
    .ed-nav-dropdown { width: 100%; }
    .ed-nav-dropdown > summary .ed-chevron { margin-left: auto; }
    .ed-dropdown-menu, .ed-dropdown-menu-right {
        position: static;
        width: 100%;
        margin-top: 5px;
        box-shadow: none;
        background: var(--bg-alt);
    }
}

@media (max-width: 620px) {
    .ed-shell-header-inner { padding: 0 12px; gap: 8px; }
    .ed-brand-copy strong { font-size: .78rem; }
    .ed-brand-logo { width: 34px; height: 34px; flex-basis: 34px; }
    .ed-account-name { display: none; }
    .ed-account-menu > summary { padding-right: 6px; }
    .ed-header-actions { gap: 6px; }
    .ed-shell-main { padding: 12px 10px 28px; }
    .ed-shell-footer { padding-inline: 14px; }
}

/* v3.0.0 light-theme contrast corrections */
html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

html[data-theme="light"] .ed-content-root .state-panel h1 {
    background: linear-gradient(135deg, var(--text), var(--text-dim)) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
}

html[data-theme="light"] .ed-content-root input,
html[data-theme="light"] .ed-content-root select,
html[data-theme="light"] .ed-content-root textarea {
    color: var(--text);
}

html[data-theme="light"] .ed-content-root input::placeholder,
html[data-theme="light"] .ed-content-root textarea::placeholder {
    color: #687287;
    opacity: 1;
}

html[data-theme="light"] .ed-content-root :is(.release-body, .logs-table td, .ad-table td, .privacy-card p, .about-card p, .contact-card p) {
    color: var(--text-dim);
}

html[data-theme="light"] .ed-content-root :is(.release-body strong, .logs-table strong, .ad-table strong) {
    color: var(--text);
}

html[data-theme="light"] .ed-content-root .tag.major {
    color: #7a4a00 !important;
    background: #fff0c7 !important;
}

html[data-theme="light"] .ed-content-root .tag.fix {
    color: #17663a !important;
    background: #dff5e8 !important;
}

.map-coming-soon-disabled {
    pointer-events: none !important;
    cursor: not-allowed !important;
    filter: grayscale(1);
    opacity: .52 !important;
    background: var(--panel-alt) !important;
    color: var(--text-dim) !important;
    border-color: var(--border) !important;
    box-shadow: none !important;
}

/* Maps are an administrator-only preview in v3.0.0. Disable public map links
   before JavaScript runs, then the layout script removes their URLs entirely. */
body.map-access-disabled a[href^="/Maps"],
body.map-access-disabled a[href*="/Maps/"] {
    pointer-events: none !important;
    cursor: not-allowed !important;
    filter: grayscale(1);
    opacity: .52 !important;
    background: var(--panel-alt) !important;
    color: var(--text-dim) !important;
    border-color: var(--border) !important;
    box-shadow: none !important;
}
