/* 故事视图只重置自身样式，不影响专栏首页。 */
:where(#muguang-story, #muguang-story *) {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#muguang-story {
    --mg-paper: #f0ece4;
    --mg-text: #c9c4bb;
    --mg-muted: #aaa296;
    --mg-gold: #e0bd7c;
    --mg-line: #37322b;
    --mg-bg: #000;
    color: var(--mg-text);
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    text-align: left;
}

body.muguang-story-view {
    overflow-x: clip;
    overflow-y: visible;
}

body:not(.muguang-story-view) #muguang-story {
    display: none !important;
}

body.muguang-story-view > nav,
body.muguang-story-view > main > section:not(#muguang-story),
body.muguang-story-view > footer {
    display: none !important;
}

body.muguang-story-view #muguang-story {
    display: block !important;
    max-width: none;
    min-height: 100vh;
    padding: 0 0 72px !important;
    background: var(--mg-bg);
}

#muguang-story :is(a, button, summary):focus-visible {
    outline: 2px solid var(--mg-gold);
    outline-offset: 5px;
}

#muguang-story button {
    font: inherit;
    cursor: pointer;
}

#muguang-story svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mg-shell {
    width: min(1280px, calc(100% - 112px));
    margin-inline: auto;
}

.mg-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--mg-bg);
    border-bottom: 1px solid var(--mg-line);
}

.mg-topbar-inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.mg-masthead {
    display: flex;
    align-items: baseline;
    gap: 20px;
    color: var(--mg-paper);
    font-size: 19px;
    font-weight: 600;
}

#muguang-story .muguang-home-link {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--mg-gold);
    font-size: 14px;
    font-weight: 400;
    opacity: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: color 180ms ease;
}

#muguang-story .muguang-home-link:hover {
    color: #fff0ce;
    transform: none;
}

.mg-hero {
    padding-block: 40px 64px;
}

.mg-editions {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-bottom: 56px;
    font-size: 13px;
    color: var(--mg-muted);
}

.mg-editions strong {
    font-weight: 500;
    color: var(--mg-gold);
}

.mg-hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: clamp(48px, 7vw, 120px);
    align-items: center;
}

.mg-name {
    margin: 0 0 28px;
    color: var(--mg-paper);
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
    font-size: clamp(64px, 7vw, 104px);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: 0.04em;
}

/* 标题只承接入场后的焦点定位，不显示交互控件的焦点框。 */
.mg-name:focus {
    outline: none;
}

.mg-hero-quote {
    margin-bottom: 24px;
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
    font-size: clamp(24px, 2.6vw, 36px);
    line-height: 1.6;
    color: var(--mg-gold);
}

.mg-hero-description {
    max-width: 32em;
    font-size: 16px;
    line-height: 1.9;
    color: var(--mg-muted);
}

.mg-hero-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px 28px;
    margin-top: 36px;
}

.mg-read-link,
.mg-manuscript-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    line-height: 24px;
    text-decoration: none;
}

.mg-read-link {
    color: #19150e;
    background: var(--mg-gold);
    border-radius: 8px;
    padding: 11px 20px;
    transition: background 180ms ease;
}

.mg-read-link:hover {
    background: #f3d7a2;
}

.mg-manuscript-link {
    background: none;
    border: 0;
    color: var(--mg-paper);
    padding: 10px 0;
    transition: color 180ms ease;
}

.mg-manuscript-link:hover {
    color: var(--mg-gold);
}

.mg-manuscript-link small {
    color: var(--mg-muted);
    font-size: 12px;
}

.mg-admission-link {
    margin-top: 12px;
    color: var(--mg-gold);
}

.mg-admission-link:hover {
    color: var(--mg-paper);
}

.mg-attachment-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 28px;
}

.mg-profile {
    border-top: 1px solid var(--mg-gold);
    padding-top: 28px;
}

.mg-profile-caption {
    display: flex;
    justify-content: space-between;
    color: var(--mg-muted);
    font-size: 12px;
    margin-bottom: 30px;
}

.mg-school span {
    display: block;
    margin-bottom: 10px;
    color: var(--mg-muted);
    font-size: 13px;
}

.mg-school strong {
    display: block;
    color: var(--mg-paper);
    font-size: clamp(21px, 2.1vw, 28px);
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 8px;
}

.mg-school p {
    font-size: 15px;
}

.mg-school-destination strong {
    color: var(--mg-gold);
}

.mg-school-path {
    display: block;
    margin: 18px 0;
    color: var(--mg-gold);
}

.mg-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 30px;
    padding-top: 22px;
    border-top: 1px solid var(--mg-line);
}

.mg-dates dt {
    margin-bottom: 8px;
    color: var(--mg-paper);
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}

.mg-dates dd {
    font-size: 12px;
    color: var(--mg-muted);
    line-height: 1.7;
}

.mg-reader {
    display: grid;
    grid-template-columns: 172px minmax(0, 760px) minmax(0, 1fr);
    gap: 48px;
    border-top: 1px solid var(--mg-line);
    padding-top: 56px;
    align-items: start;
}

.mg-aside {
    position: sticky;
    top: 108px;
}

.mg-directory-title {
    font-size: 13px;
    color: var(--mg-muted);
    margin-bottom: 20px;
}

.mg-directory {
    list-style: none;
}

.mg-directory li + li {
    margin-top: 6px;
}

.mg-directory a {
    display: block;
    padding: 8px 0;
    font-size: 13px;
    line-height: 1.6;
    text-decoration: none;
    color: var(--mg-muted);
    transition: color 160ms ease;
}

.mg-directory a:is(:hover, [aria-current="location"]) {
    color: var(--mg-gold);
}

.mg-progress {
    display: block;
    width: 100%;
    height: 2px;
    margin-top: 28px;
    border: 0;
    appearance: none;
    background: var(--mg-line);
    color: var(--mg-gold);
}

.mg-progress::-webkit-progress-bar {
    background: var(--mg-line);
}

.mg-progress::-webkit-progress-value {
    background: var(--mg-gold);
}

.mg-progress::-moz-progress-bar {
    background: var(--mg-gold);
}

.mg-aside .mg-manuscript-link {
    margin-top: 16px;
    font-size: 12px;
}

.mg-mobile-directory {
    display: none;
}

.mg-essay {
    min-width: 0;
    font-size: 18px;
    line-height: 2;
    overflow-wrap: break-word;
}

.mg-essay-header {
    margin-bottom: 40px;
    scroll-margin-top: 108px;
}

.mg-essay-header h2 {
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
    color: var(--mg-paper);
    font-size: 40px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 14px;
}

.mg-essay-subtitle {
    font-size: 21px;
    color: var(--mg-paper);
}

.mg-byline {
    margin-top: 24px;
    color: var(--mg-muted);
    font-size: 13px;
    line-height: 1.8;
}

.mg-essay p {
    margin-bottom: 24px;
}

#muguang-story .mg-chapter {
    width: auto;
    max-width: none;
    margin: 56px 0 0;
    padding: 0 !important;
    text-align: left;
    scroll-margin-top: 108px;
}

.mg-chapter h3 {
    color: var(--mg-paper);
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
    font-size: 27px;
    font-weight: 500;
    line-height: 1.6;
    margin-bottom: 26px;
}

.mg-chapter h4 {
    color: var(--mg-paper);
    font-size: 19px;
    font-weight: 500;
    margin: 36px 0 18px;
    line-height: 1.8;
}

.mg-chapter strong {
    color: var(--mg-paper);
    font-weight: 600;
}

.mg-essay blockquote {
    margin: 38px 0;
    padding: 24px 0;
    border-block: 1px solid var(--mg-line);
    color: var(--mg-gold);
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
    font-size: 25px;
    line-height: 1.8;
}

.mg-essay blockquote p {
    margin: 0;
}

.mg-essay .mg-postscript {
    font-size: 14px;
    color: var(--mg-muted);
    margin-top: 40px;
}

.mg-essay-end {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 48px;
    padding: 22px 0;
    background: transparent;
    border-top: 1px solid var(--mg-line);
    font-size: 13px;
    color: var(--mg-muted);
}

.mg-essay-end a {
    color: var(--mg-gold);
    text-decoration: none;
}

.mg-manuscript-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(1160px, calc(100vw - 64px));
    height: min(900px, calc(100dvh - 64px));
    max-width: none;
    max-height: none;
    border: 1px solid var(--mg-line);
    border-radius: 12px;
    padding: 0;
    background: #191714;
    color: var(--mg-paper);
}

.mg-manuscript-dialog::backdrop {
    background: rgba(0, 0, 0, 0.76);
}

.mg-manuscript-dialog[open] {
    display: flex;
    flex-direction: column;
}

.mg-manuscript-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--mg-line);
}

.mg-manuscript-toolbar h2 {
    font-size: 18px;
    font-weight: 500;
}

.mg-manuscript-toolbar p {
    font-size: 12px;
    color: var(--mg-muted);
    margin-top: 6px;
}

.mg-manuscript-dialog button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 6px 8px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--mg-paper);
}

.mg-manuscript-dialog button:hover:not(:disabled) {
    background: #353028;
}

.mg-manuscript-dialog button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.mg-manuscript-stage {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}

.mg-manuscript-sheet {
    display: grid;
    place-items: center;
    width: max-content;
    min-width: 100%;
    min-height: 100%;
    padding: 24px;
}

.mg-manuscript-sheet img {
    display: block;
    height: auto;
    max-width: none;
}

.mg-manuscript-status {
    padding: 48px 24px;
    text-align: center;
    color: var(--mg-muted);
    line-height: 1.8;
    font-size: 15px;
}

.mg-manuscript-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 20px;
    padding: 12px 24px;
    border-top: 1px solid var(--mg-line);
    font-size: 13px;
}

.mg-control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mg-manuscript-controls > .mg-control-group:last-child {
    margin-left: auto;
}

#muguang-story [hidden] {
    display: none !important;
}

@media (max-width: 1100px) {
    .mg-shell { width: calc(100% - 64px); }
    .mg-hero-grid { gap: 48px; }
    .mg-reader { grid-template-columns: 150px minmax(0, 1fr); gap: 32px; }
}

@media (max-width: 760px) {
    .mg-shell { width: calc(100% - 40px); }
    .mg-topbar-inner { min-height: 64px; gap: 16px; }
    .mg-masthead { font-size: 17px; }
    .mg-hero { padding-block: 28px 40px; }
    .mg-editions { margin-bottom: 36px; gap: 16px; font-size: 12px; }
    .mg-hero-grid { grid-template-columns: 1fr; gap: 44px; }
    .mg-name { font-size: 64px; margin-bottom: 22px; }
    .mg-hero-quote { font-size: 26px; }
    .mg-hero-description { font-size: 15px; }
    .mg-hero-actions { gap: 12px 20px; margin-top: 28px; }
    .mg-profile { padding-top: 22px; }
    .mg-profile-caption { margin-bottom: 24px; }
    .mg-school strong { font-size: 24px; }
    .mg-reader { display: block; padding-top: 28px; }
    .mg-aside { position: sticky; top: 64px; z-index: 10; margin-bottom: 32px; padding-block: 8px; background: var(--mg-bg); border-bottom: 1px solid var(--mg-line); }
    .mg-aside > :not(.mg-mobile-directory) { display: none; }
    .mg-mobile-directory { display: block; }
    .mg-mobile-directory summary { cursor: pointer; color: var(--mg-gold); padding-block: 8px; font-size: 14px; }
    .mg-mobile-directory .mg-directory { margin-top: 14px; max-height: 45dvh; overflow-y: auto; }
    .mg-essay { font-size: 17px; line-height: 2; }
    .mg-essay-header h2 { font-size: 34px; }
    .mg-essay-subtitle { font-size: 18px; }
    .mg-essay-header { scroll-margin-top: 88px; }
    #muguang-story .mg-chapter { margin-top: 44px; scroll-margin-top: 88px; }
    .mg-chapter h3 { font-size: 24px; margin-bottom: 22px; }
    .mg-chapter h4 { font-size: 18px; }
    .mg-essay blockquote { font-size: 22px; }
    .mg-manuscript-dialog { width: calc(100vw - 24px); height: calc(100dvh - 32px); }
    .mg-manuscript-toolbar { padding: 16px; }
    .mg-manuscript-toolbar h2 { font-size: 16px; }
    .mg-manuscript-controls { padding: 10px 12px; gap: 8px; }
    .mg-control-group { gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
    #muguang-story *, #muguang-story *::before, #muguang-story *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
