.lgn-shared-header,
.lgn-front-portal {
    font: 600 15px/1.4 Inter, system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
    text-align: start;
}

.lgn-shared-header *, .lgn-front-portal * { box-sizing: border-box; }
.lgn-shared-header a, .lgn-front-portal a { text-decoration: none; }
.lgn-shared-header :focus-visible, .lgn-front-portal :focus-visible {
    outline: 2px solid #f7d594;
    outline-offset: 3px;
}

html:has(.lgn-front-portal) { overflow-x: clip; }

body:has(.lgn-shared-header:not([data-lgn-masthead="legacy"])) {
    min-height: 100svh;
    isolation: isolate;
    background: #1f84e4;
}

.lgn-sky {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    background: linear-gradient(132deg, #63ccfa 0%, #259eeb 29%, #146ed9 62%, #1747c0 100%);
}
.lgn-sky i { position: absolute; display: block; }
.lgn-sky i:nth-child(1) {
    inset: -62% -18% auto -24%;
    height: 85%;
    border-radius: 0 0 51% 48% / 0 0 38% 57%;
    transform: rotate(7deg);
    background: linear-gradient(110deg,#83ddfaf2,#31b2f3bb 44%,#2468c9b0);
    box-shadow: 0 2px 2px #b2f3ff54;
}
.lgn-sky i:nth-child(2) {
    right: -28%; bottom: -42%; width: 124%; height: 62%;
    border-radius: 66% 45% 0 0; transform: rotate(-12deg);
    background: linear-gradient(120deg,#9c57f1,#5654ed 63%,#393fd4);
    box-shadow: 0 -3px 2px #c5b6ff73;
}
.lgn-sky i:nth-child(3) {
    right: -32%; bottom: -28%; width: 96%; height: 44%;
    border-radius: 76% 24% 0 0; transform: rotate(-13deg);
    background: linear-gradient(145deg,#ffa365,#ff5975 70%);
    box-shadow: 0 -7px 0 #ffdd80, 0 -10px 15px #ffcaa875;
}
.lgn-sky i:nth-child(4) {
    left: -44%; bottom: -45%; width: 75%; height: 60%;
    border-radius: 50%; transform: rotate(13deg);
    background: linear-gradient(135deg,#8251e7,#4d38bf);
}

.lgn-shared-header {
    position: relative;
    z-index: 1100;
    width: min(1200px, calc(100% - 36px));
    max-width: 100%;
    margin: 0 auto;
    padding: 15px 0 0;
    color: #fff;
    clear: both;
}

.lgn-utility {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 6px 9px;
    gap: clamp(3px, 1vw, 12px);
    border: 1px solid #e9f8ff85;
    border-radius: 17px;
    background: linear-gradient(135deg,#ffffff61,#e6f7ff28);
    box-shadow: inset 0 1px 0 #ffffff55, 0 10px 30px #0b347744;
    backdrop-filter: blur(16px);
}
.lgn-utility details, .lgn-portal-dropdown { position: static; margin: 0; }
.lgn-utility summary, .lgn-portal-dropdown summary {
    list-style: none;
    cursor: pointer;
    color: #fff;
    user-select: none;
}
.lgn-utility summary::-webkit-details-marker, .lgn-portal-dropdown summary::-webkit-details-marker { display: none; }
.lgn-utility summary {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 7px;
    min-height: 33px;
    border-radius: 9px;
    white-space: nowrap;
}
.lgn-utility :is(summary:hover,details[open]>summary) { background: #f6fbff29; }
.lgn-utility summary > i, .lgn-portal-dropdown summary > i {
    display: block;
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    margin: -3px 1px 0;
    border: solid currentColor;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
    transition: transform 140ms ease;
}
.lgn-utility details[open]>summary>i, .lgn-portal-dropdown[open]>summary>i { transform: rotate(225deg) translate(-2px,-2px); }
.lgn-utility .lgn-user > summary { max-width: min(185px, 35vw); }
.lgn-utility .lgn-user > summary > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.lgn-utility :is(.lgn-user-photo,.lgn-user-glyph,.member-avatar,summary img,.avatar-placeholder) {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: inline-grid;
    place-items: center;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid #e9faff98;
    color: #fff;
    background: #164986;
}

.lgn-site-mark {
    position: relative;
    isolation: isolate;
    display: grid;
    justify-items: center;
    padding: clamp(10px, 2.1vw, 26px) 0 15px;
}
.lgn-site-mark > a { display: block; width: min(475px, 86%); }
.lgn-site-mark img { display: block; width: 100%; height: auto; filter: drop-shadow(0 12px 15px #16397765); }
.lgn-site-mark p {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: .05em 0 0;
    color: #fff;
    text-shadow: 0 2px 6px #0d378b;
    font: italic 700 clamp(17px, 2vw, 25px)/1.14 Georgia, serif;
}
.lgn-site-mark p::before, .lgn-site-mark p::after {
    content: "";
    width: min(9vw, 58px);
    height: 1px;
    background: linear-gradient(90deg,transparent,#edfaff);
}
.lgn-site-mark p::after { transform: scaleX(-1); }
.lgn-clouds { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.lgn-clouds i {
    position: absolute;
    width: min(30%,285px);
    height: min(36%,64px);
    left: 5%;
    top: 46%;
    border-radius: 50%;
    background: radial-gradient(ellipse at 39% 55%,#fff9,#e5faff7c 43%,#e5f5ff41 62%,transparent 75%);
    filter: blur(4px);
    animation: lgn-cloud-float 18s ease-in-out infinite alternate;
}
.lgn-clouds i:nth-child(2) { left: auto; right: 3%; top: 27%; animation-delay: -10s; }
.lgn-clouds i:nth-child(3) { left: 15%; top: 18%; width: 13%; opacity: .62; animation-delay: -4s; }
@keyframes lgn-cloud-float { from { transform: translateX(-2vw); } to { transform: translate(4vw, -5px); } }

.lgn-portal {
    position: relative;
    z-index: 4;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px clamp(9px, 2vw, 25px);
    width: 100%;
    margin: 0 auto;
    padding: 6px 9px;
    color: #fff;
    border: 2px solid #dff6ff;
    border-radius: 21px 9px;
    background: linear-gradient(#2999fa,#134ad8 49%,#1838a4 50%,#1c73ea);
    box-shadow: inset 0 0 0 2px #c7edff51, 0 9px 19px #12317b68;
}
.lgn-front-portal { width: min(980px, 94%); margin-bottom: 20px; padding-block: 8px; }
.lgn-portal-item { display: inline-flex; align-items: stretch; gap: 0; }
.lgn-portal > .lgn-portal-item > a {
    display: grid;
    place-items: center;
    color: #fff;
    min-height: 36px;
    padding: 5px 3px 5px 9px;
    border-radius: 8px 0 0 8px;
    text-align: center;
    font-weight: 700;
    line-height: 1.25;
    text-wrap: balance;
}
.lgn-portal-dropdown > summary {
    display: grid;
    place-items: center;
    min-width: 23px;
    min-height: 36px;
    padding: 4px;
    border-radius: 0 8px 8px 0;
}
.lgn-portal-item:hover > .lgn-portal-link, .lgn-portal-item:has([open]) > .lgn-portal-link,
.lgn-portal-item:hover > details > summary, .lgn-portal-item [aria-current="true"], .lgn-portal-item [open] > summary {
    background: #dbf3ff35;
}

.lgn-panel, body:has(.lgn-front-portal) .shell > .toolbar .menu {
    background: linear-gradient(132deg, #fbfdfff9, #eff7fff7 55%, #e2ebfcfa);
    color: #122e55;
    border: 1px solid #fafeff;
    border-radius: 17px;
    box-shadow: 0 16px 37px #0c2e6b55, inset 0 1px 0 #fff;
    backdrop-filter: blur(22px) saturate(1.2);
    font: 550 14px/1.35 Inter, system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
    text-align: start;
}
.lgn-panel {
    position: absolute;
    z-index: 10;
    margin: 0;
    max-height: min(59vh, 420px);
    max-height: min(59dvh, 420px);
    padding: 10px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}
.lgn-panel::before {
    content: "";
    display: block;
    height: 2px;
    margin: 0 7px 6px;
    background: linear-gradient(90deg, transparent, #85b8f370 22%, #f4d085da 50%, #85b8f370 78%, transparent);
}
.lgn-panel:not([data-position]), .lgn-panel[data-position="bottom"] { top: calc(100% - 2px); }
.lgn-panel[data-position="top"] { bottom: calc(100% - 2px); }
.lgn-portal-panel { left: 50%; transform: translateX(-50%); width: min(610px, calc(100vw - 32px)); }
.lgn-panel-topics { width: min(725px, calc(100vw - 32px)); }
.lgn-utility-panel { left: 50%; transform: translateX(-50%); width: min(255px, calc(100vw - 28px)); }
.lgn-old-sites { width: min(640px, calc(100vw - 28px)); }
.lgn-language-panel { width: min(375px, calc(100vw - 28px)); }
.lgn-language-panel[hidden], details:not([open]) > .lgn-panel { display: none; }
.lgn-utility-language[open] > .lgn-language-panel { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 2px 6px; }
.lgn-language-panel::before { grid-column: 1/-1; }
.lgn-language-panel > a,
.lgn-menu-group li > a { color: #173964; border-radius: 8px; }
.lgn-language-panel > a { padding: 9px 8px; overflow-wrap: anywhere; }
.lgn-panel a:hover, .lgn-panel a[aria-current] { background: #d9ebff; color: #133b71; }
.lgn-panel :focus-visible { outline: 2px solid #255a9b; outline-offset: 1px; }
.lgn-panel-groups { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px 9px; }
.lgn-panel-groups.lgn-panel-single { grid-template-columns: 1fr; }
.lgn-menu-group { min-width: 0; padding: 2px 4px 3px; }
.lgn-menu-group h2 {
    font: 740 12px/1.35 Inter,system-ui,"Microsoft YaHei",sans-serif;
    color: #47678c;
    border-bottom: 1px solid #bcd5efac;
    padding: 4px 8px 7px;
    margin: 0 0 4px;
    text-align: start;
}
.lgn-menu-group ul { list-style: none; margin: 0; padding: 0; }
.lgn-menu-group li { margin: 0; }
.lgn-menu-group li > a {
    display: flex;
    align-items: center;
    min-height: 34px;
    padding: 5px 8px;
    gap: 8px;
    text-decoration: none;
    overflow-wrap: anywhere;
}
.lgn-menu-group a > i {
    display: block;
    flex: 0 0 6px;
    height: 6px;
    margin-inline: auto 2px;
    border: solid #5073a1;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(-45deg);
}
.lgn-menu-group a > img { width: 52px; height: 34px; border-radius: 5px; object-fit: cover; }
.lgn-account-panel > section + section { margin-top: 6px; }
.lgn-utility .lgn-discuz-account .menu { display: none; }
.lgn-utility .lgn-discuz-account[open] .menu {
    display: block;
    position: absolute;
    inset: calc(100% - 2px) auto auto 50%;
    transform: translateX(-50%);
    width: min(310px, calc(100vw - 24px));
    max-height: min(68dvh, 480px);
    overflow-y: auto;
    padding: 8px;
    border-radius: 15px;
    border: 1px solid #fff;
    background: #f0f7ff;
    color: #153760;
    box-shadow: 0 16px 32px #06276068;
}
.lgn-discuz-account .menu a { color: #153760; }
.lgn-discuz-account .menu a:hover { background: #d9ebff; }
body:has(.lgn-front-portal) .shell > .toolbar .menu a { color: #173964; }
body:has(.lgn-front-portal) .shell > .toolbar .menu a:hover { background: #daeaff; }

body:has([data-lgn-masthead="wp"]) {
    --lgn-document: #f4fafff5;
    --lgn-document-edge: #f8fcffc9;
    --lgn-document-shadow: 0 13px 32px #092c692e;
}
body:has([data-lgn-masthead="wp"]) :is(header#site-header.site-header, .lrg-top) { display: none; }
body:has([data-lgn-masthead="wp"]) .lrg-mast { border: 0; background: transparent; }
body:has([data-lgn-masthead="wp"]) .lrg-mast::before { display: none; }
body:has([data-lgn-masthead="wp"]) .lrg-title {
    margin-top: 17px;
    padding: clamp(16px,3.2vw,35px) clamp(18px,4vw,43px);
    border: 1px solid var(--lgn-document-edge);
    border-radius: 21px;
    color: #102d52;
    background: linear-gradient(130deg,#dff2ffef,#e1eaffed);
    box-shadow: var(--lgn-document-shadow);
}
body:has([data-lgn-masthead="wp"]) .lrg-title :is(h1,a,span) { color: #15355d; }
body:has([data-lgn-masthead="wp"]) .lrg-title h1 { font-size: clamp(1.6rem,4.5vw,2.9rem); }

body:has([data-lgn-masthead="wp"]) :is(.lrg-catalog,.lrg-chapters,.lrg-section-copy,.lrg-reading .lrg-content,.lrg-reading .lrg-side,.lgn-video-main,.lgn-video-side,.lgn-comments, main.site-main:not(.lrg-main):not(.lgn-video-layout)) {
    background: var(--lgn-document);
    border: 1px solid var(--lgn-document-edge);
    border-radius: 19px;
    box-shadow: var(--lgn-document-shadow);
}
.lgn-shared-header ~ .lgn-video-layout { margin-top: 20px; }
body:has([data-lgn-masthead="wp"]) :is(.lrg-catalog,.lgn-video-main,.lgn-video-side,.lrg-reading .lrg-side) { min-width: 0; padding: clamp(14px,2.45vw,25px); }
body:has([data-lgn-masthead="wp"]) .lrg-catalog .lrg-indexbar { margin-top: 0; }
body:has([data-lgn-masthead="wp"]) .lrg-overview .lrg-content > .lgn-video-cards { margin-top: 12px; }
body:has([data-lgn-masthead="wp"]) main.site-main:not(.lrg-main):not(.lgn-video-layout) {
    width: min(980px, calc(100% - 36px));
    margin: 20px auto 44px;
    padding: clamp(18px, 4vw, 42px);
    color: #102e50;
    overflow-wrap: anywhere;
}
body:has([data-lgn-masthead="wp"]) .lrg-footer { color: #edf7ff; }
body:has([data-lgn-masthead="wp"]) :is(.lrg-footer a,#site-footer .site-title a) { color: inherit; }

body:has([data-lgn-masthead="forum"]) { background-attachment: fixed; min-width: 0; }
body:has([data-lgn-masthead="forum"]) :is(#hd,#toptb,.lr-native-brand,.lr-native-nav,#lr-native-toolbar,.lr-mobile-bar,.lr-mobile-brand) { display: none !important; }
body:has([data-lgn-masthead="forum"]) :is(.lr-native,#wp) { min-width: 0; }
body:has([data-lgn-masthead="forum"]) :is(.lr-discussion-panel,.lr-thread-panel,#wp .bm,.lr-board-navigation) {
    border-radius: 18px;
    border-color: #f0faffbe;
    background-color: #f2f9fff4;
    box-shadow: 0 11px 26px #0a397130;
}
body:has([data-lgn-masthead="forum"]) :is(#wp,.lr-discussion-home) { margin-top: 16px; }
body:has([data-lgn-masthead="forum"]) #ft { color: #eef8ff; }
body:has([data-lgn-masthead="legacy"]) .lgn-shared-header { margin-bottom: 16px; }
[data-lgn-mount]:has([data-lgn-masthead="legacy"]) { position: relative; isolation: isolate; }
[data-lgn-mount]:has([data-lgn-masthead="legacy"]) > .lgn-sky { position: absolute; border-radius: 0 0 18px 18px; }
[data-lgn-masthead="legacy"] .lgn-site-mark > a { width: min(400px,80%); }

@media (max-width: 640px) {
    .lgn-shared-header { width: calc(100% - 22px); padding-top: 11px; }
    .lgn-site-mark { padding-bottom: 12px; }
    .lgn-site-mark > a { width: min(345px,92%); }
    .lgn-front-portal { width: 100%; }
    .lgn-portal { gap: 2px 6px; border-radius: 15px 8px; padding: 4px; }
    .lgn-portal > .lgn-portal-item > a { min-height: 39px; padding-inline-start: 5px; font-size: .84rem; }
    .lgn-portal-dropdown > summary { min-width: 24px; min-height: 39px; }
    .lgn-utility summary { font-size: .85rem; padding-inline: 6px; }
    .lgn-portal-panel { width: min(520px, calc(100vw - 22px)); }
    .lgn-panel-groups { gap: 5px; }
    .lgn-panel { padding: 8px; }
    .lgn-menu-group { padding-inline: 0; }
    .lgn-menu-group li > a { padding-inline: 6px; }
}
@media (max-width: 365px) {
    .lgn-panel-groups { grid-template-columns: 1fr; }
    .lgn-utility summary { padding-inline: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    .lgn-clouds i { animation: none; }
    .lgn-utility summary i, .lgn-portal-dropdown summary i { transition: none; }
}
