:root {
    color-scheme: light;
    --paper: #f7f5ee;
    --paper-2: #eceff4;
    --ink: #15202b;
    --muted: #5f6875;
    --line: rgba(21, 32, 43, 0.16);
    --line-strong: rgba(21, 32, 43, 0.28);
    --blue: #295b8d;
    --red: #9f3d3d;
    --gold: #9a7b2f;
    --panel: rgba(255, 255, 255, 0.62);
    --nav-h: 72px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

html {
    scroll-behavior: auto;
}

body {
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(21, 32, 43, 0.035) 1px, transparent 1px),
        linear-gradient(rgba(21, 32, 43, 0.028) 1px, transparent 1px),
        radial-gradient(circle at 12% 18%, rgba(41, 91, 141, 0.12), transparent 32rem),
        radial-gradient(circle at 88% 16%, rgba(159, 61, 61, 0.09), transparent 30rem),
        linear-gradient(135deg, var(--paper), var(--paper-2));
    background-size: 32px 32px, 32px 32px, auto, auto, auto;
    font-family: "Times New Roman", "Noto Serif SC", "Songti SC", SimSun, serif;
    opacity: 0;
    transition: opacity 0.4s var(--ease-out);
}

body.is-ready {
    opacity: 1;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        repeating-linear-gradient(0deg, rgba(21, 32, 43, 0.016) 0 1px, transparent 1px 5px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.45), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.35));
}

a {
    color: inherit;
}

/* ─── Topbar ─── */

.topbar {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(210px, 1fr) auto minmax(250px, 1fr);
    align-items: center;
    width: min(1160px, calc(100% - 32px));
    min-height: var(--nav-h);
    padding: 12px 18px;
    border: 1px solid var(--line);
    background: rgba(247, 245, 238, 0.82);
    box-shadow: 0 18px 46px rgba(21, 32, 43, 0.12);
    backdrop-filter: blur(16px);
    transform: translate(-50%, -18px);
    opacity: 0;
    will-change: transform, opacity;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    color: var(--ink);
    text-decoration: none;
    transition: opacity 0.25s ease;
}

.brand:hover {
    opacity: 0.78;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: white;
    transition: transform 0.4s var(--ease-out);
}

.brand:hover .brand-mark {
    transform: rotate(-8deg) scale(1.04);
}

.brand span {
    display: grid;
    gap: 2px;
}

.brand strong {
    font-size: 1.02rem;
    font-weight: 700;
}

.brand em {
    color: var(--muted);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.78rem;
    font-style: normal;
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    justify-self: center;
    gap: 9px;
    color: var(--muted);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
}

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    width: 0;
    height: 0;
    opacity: 0;
}

.slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.58);
}

.slider::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--blue);
    transition: transform 0.28s var(--ease-out);
}

.switch input:checked + .slider::before {
    transform: translateX(24px);
}

.nav-links {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid transparent;
    color: var(--muted);
    font-size: 0.88rem;
    text-decoration: none;
    transition:
        background 0.28s var(--ease-out),
        border-color 0.28s var(--ease-out),
        color 0.28s var(--ease-out),
        transform 0.28s var(--ease-out);
}

.nav-links a:hover,
.nav-links a.active {
    border-color: rgba(41, 91, 141, 0.25);
    background: rgba(41, 91, 141, 0.08);
    color: var(--ink);
}

.nav-links a:hover {
    transform: translateY(-1px);
}

/* ─── Full-page stack ─── */

.page-stack {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.page {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    will-change: transform;
}

.page-inner {
    width: min(1120px, calc(100% - 40px));
    height: 100%;
    margin: 0 auto;
    padding: calc(var(--nav-h) + 36px) 0 36px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-inner-wide {
    width: min(1180px, calc(100% - 32px));
}

.page-center {
    width: 100%;
    margin: auto 0;
}

/* ─── Hero prologue ─── */

.hero-stage {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.manuscript-field {
    position: absolute;
    inset: 0;
    overflow: hidden;
    --frame-progress: 0;
}

.manuscript-field::before {
    content: "";
    position: absolute;
    inset: 114px 34px 34px;
    border: 1px solid rgba(21, 32, 43, 0.1);
    background: rgba(255, 255, 255, 0.18);
    opacity: var(--frame-progress);
    transform: scale(calc(0.96 + 0.04 * var(--frame-progress)));
    transform-origin: center;
}

.axis-line {
    position: absolute;
    background: rgba(21, 32, 43, 0.16);
    opacity: var(--frame-progress);
}

.axis-line-x {
    top: 48%;
    left: 8%;
    width: calc(84% * var(--frame-progress));
    height: 1px;
    transform: rotate(-2deg);
}

.axis-line-y {
    top: 18%;
    left: 50%;
    width: 1px;
    height: calc(58% * var(--frame-progress));
    transform: rotate(4deg);
}

/* Large, clear formula — primary readable layer */
.formula-ghost {
    position: absolute;
    left: 50%;
    top: 38%;
    z-index: 3;
    width: min(1100px, calc(100% - 32px));
    margin: 0;
    color: rgba(21, 32, 43, 0.92);
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    letter-spacing: 0.06em;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8),
        0 0 40px rgba(247, 245, 238, 0.9),
        0 12px 40px rgba(21, 32, 43, 0.06);
    transform: translate(-50%, -50%);
    opacity: 0;
    will-change: transform, opacity, filter;
    pointer-events: none;
    user-select: none;
}

.formula-ghost .formula-line {
    display: inline-block;
    font-size: clamp(2.8rem, 12vw, 9rem);
    white-space: nowrap;
}

.formula-ghost sup {
    font-size: 0.48em;
    vertical-align: super;
}

.formula-cloud {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

/* Particles: only e / i / π / + / 1 / = / 0 — support the main formula, don't replace it */
.formula-token {
    position: absolute;
    left: 0;
    top: 0;
    color: rgba(21, 32, 43, 0.28);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1;
    opacity: 0;
    transform-origin: center;
    will-change: transform, opacity;
    white-space: nowrap;
    backface-visibility: hidden;
    user-select: none;
}

.formula-token.major {
    color: rgba(41, 91, 141, 0.38);
    font-size: 0.95rem;
    font-weight: 700;
}

.formula-token.operator {
    color: rgba(159, 61, 61, 0.36);
    font-size: 0.9rem;
}

.formula-token.accent {
    color: rgba(154, 123, 47, 0.4);
}

.margin-notes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: var(--frame-progress);
}

.margin-notes span {
    position: absolute;
    color: rgba(21, 32, 43, 0.26);
    font-size: 1rem;
    font-style: italic;
    transform: rotate(-10deg);
}

.margin-notes span:nth-child(1) {
    top: 24%;
    left: 9%;
}

.margin-notes span:nth-child(2) {
    right: 9%;
    top: 30%;
    transform: rotate(8deg);
}

.margin-notes span:nth-child(3) {
    right: 14%;
    bottom: 18%;
    transform: rotate(-6deg);
}

.hero-copy {
    position: absolute;
    left: 50%;
    top: 66%;
    z-index: 5;
    width: min(820px, calc(100% - 36px));
    opacity: 0;
    text-align: center;
    transform: translate(-50%, -50%);
    will-change: transform, opacity;
    pointer-events: none;
}

.hero-copy.is-interactive {
    pointer-events: auto;
}

.eyebrow,
.section-kicker {
    margin: 0 0 16px;
    color: var(--red);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 16px;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

h2 {
    margin-bottom: 16px;
    font-size: clamp(2.1rem, 5vw, 3.4rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.02em;
}

h3 {
    margin-bottom: 12px;
    font-size: 1.4rem;
    font-weight: 700;
}

.lead,
.section-head p,
.study-layout p,
.about-layout p,
.site-footer {
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.75;
}

.lead {
    max-width: 640px;
    margin-right: auto;
    margin-left: auto;
    margin-bottom: 0;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 26px;
}

.about-layout .button-row {
    justify-content: flex-start;
}

.chalk-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 148px;
    min-height: 48px;
    padding: 12px 20px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.38);
    color: var(--ink);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.96rem;
    font-weight: 700;
    text-decoration: none;
    transition:
        background 0.28s var(--ease-out),
        border-color 0.28s var(--ease-out),
        transform 0.28s var(--ease-out),
        box-shadow 0.28s var(--ease-out);
}

.chalk-button:hover {
    border-color: rgba(41, 91, 141, 0.35);
    background: rgba(41, 91, 141, 0.09);
    box-shadow: 0 10px 28px rgba(21, 32, 43, 0.08);
    transform: translateY(-3px);
}

.chalk-button:active {
    transform: translateY(-1px);
}

.chalk-button.primary {
    border-color: rgba(159, 61, 61, 0.3);
    box-shadow: inset 0 -2px 0 rgba(159, 61, 61, 0.12);
}

.chalk-button.primary:hover {
    border-color: rgba(159, 61, 61, 0.45);
    background: rgba(159, 61, 61, 0.07);
}

.scroll-cue {
    position: absolute;
    bottom: 28px;
    left: 50%;
    z-index: 5;
    display: grid;
    justify-items: center;
    gap: 8px;
    color: var(--muted);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.78rem;
    transform: translateX(-50%);
    opacity: 0;
    will-change: transform, opacity;
}

.scroll-cue span {
    position: relative;
    width: 1px;
    height: 42px;
    overflow: hidden;
    background: rgba(159, 61, 61, 0.15);
}

.scroll-cue span::after {
    content: "";
    position: absolute;
    left: 0;
    top: -40%;
    width: 100%;
    height: 40%;
    background: linear-gradient(to bottom, transparent, var(--red), transparent);
    animation: cue-flow 1.8s var(--ease-soft) infinite;
}

.scroll-cue em {
    font-style: normal;
    letter-spacing: 0.04em;
}

@keyframes cue-flow {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
    100% {
        transform: translateY(220%);
        opacity: 0;
    }
}

/* ─── Content sections ─── */

.paper-section {
    /* base from .page-inner */
}

.section-head {
    max-width: 760px;
    margin-bottom: 36px;
}

.section-head:not(.align-left) {
    margin-right: auto;
    margin-left: auto;
    text-align: center;
}

/* Reveal system — reversible; staggered delays come from data-reveal-delay */
[data-reveal] {
    opacity: 0;
    transform: translateY(32px);
    filter: blur(5px);
    transition:
        opacity 0.95s var(--ease-out),
        transform 0.95s var(--ease-out),
        filter 0.95s var(--ease-out);
}

[data-reveal].is-revealed {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.section-head p {
    margin-bottom: 0;
}

/* ─── Problems page: status + preview ─── */

.problems-layout {
    display: grid;
    grid-template-columns: minmax(300px, 0.95fr) minmax(340px, 1.05fr);
    gap: 36px;
    align-items: center;
}

.problems-desc {
    max-width: 36rem;
    margin-bottom: 0;
}

.problems-actions {
    justify-content: flex-start;
    margin-top: 22px;
}

.problems-actions .chalk-button[disabled] {
    opacity: 0.55;
    pointer-events: none;
}

.status-card {
    margin-top: 28px;
    padding: 22px 22px 18px;
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.42)),
        var(--panel);
    box-shadow: 0 18px 48px rgba(21, 32, 43, 0.06);
}

.status-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.status-label {
    margin: 0 0 4px;
    color: var(--muted);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.status-target {
    margin: 0;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.02rem;
}

.status-live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid rgba(41, 91, 141, 0.18);
    background: rgba(255, 255, 255, 0.55);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.88rem;
    white-space: nowrap;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #9aa3ad;
    box-shadow: 0 0 0 4px rgba(154, 163, 173, 0.18);
}

.status-live.is-up .status-dot {
    background: #2f9e64;
    box-shadow: 0 0 0 4px rgba(47, 158, 100, 0.18);
    animation: pulse-dot 2s ease-in-out infinite;
}

.status-live.is-down .status-dot {
    background: #c92a2a;
    box-shadow: 0 0 0 4px rgba(201, 42, 42, 0.16);
}

.status-live.is-slow .status-dot {
    background: #e0a100;
    box-shadow: 0 0 0 4px rgba(224, 161, 0, 0.18);
}

.status-live.is-up {
    border-color: rgba(47, 158, 100, 0.28);
    color: #1b6b42;
}

.status-live.is-down {
    border-color: rgba(201, 42, 42, 0.28);
    color: #9b2226;
}

.status-live.is-slow {
    border-color: rgba(224, 161, 0, 0.34);
    color: #8a6200;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.12); opacity: 0.85; }
}

.status-uptime-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.status-uptime-num {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
}

.status-uptime-unit {
    margin-left: 6px;
    color: var(--muted);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.95rem;
}

.status-meta {
    margin: 0;
    color: var(--muted);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.82rem;
}

.status-bars {
    display: grid;
    grid-template-columns: repeat(90, minmax(0, 1fr));
    gap: 2px;
    height: 42px;
    padding: 8px;
    border: 1px solid rgba(21, 32, 43, 0.08);
    background: rgba(21, 32, 43, 0.03);
}

.status-bar {
    min-width: 0;
    height: 100%;
    border-radius: 1px;
    background: rgba(21, 32, 43, 0.08);
    transition: transform 0.2s ease, filter 0.2s ease;
}

.status-bar.is-up {
    background: linear-gradient(180deg, #51cf66, #2f9e64);
    box-shadow: 0 0 0 1px rgba(47, 158, 100, 0.08);
}

.status-bar.is-down {
    background: linear-gradient(180deg, #ff8787, #e03131);
}

.status-bar.is-slow {
    background: linear-gradient(180deg, #ffd43b, #e0a100);
    box-shadow: 0 0 0 1px rgba(224, 161, 0, 0.1);
}

.status-state-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 10px;
    color: var(--muted);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.72rem;
}

.status-state-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-state-legend i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-state-legend .is-up { background: #2f9e64; }
.status-state-legend .is-slow { background: #e0a100; }
.status-state-legend .is-down { background: #e03131; }

.status-bar.is-empty {
    background: rgba(21, 32, 43, 0.07);
}

.status-bar:hover {
    transform: scaleY(1.08);
    filter: brightness(1.05);
}

.status-bars-legend {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    color: var(--muted);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.74rem;
}

.status-note {
    margin: 14px 0 0;
    color: var(--muted);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.82rem;
    line-height: 1.55;
}

.problems-preview {
    overflow: hidden;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.55);
    box-shadow: 0 22px 50px rgba(21, 32, 43, 0.08);
}

.preview-chrome {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    background: rgba(247, 245, 238, 0.92);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.78rem;
}

.preview-dots {
    display: inline-flex;
    gap: 5px;
}

.preview-dots i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(21, 32, 43, 0.18);
}

.preview-dots i:nth-child(1) { background: #ff6b6b; }
.preview-dots i:nth-child(2) { background: #fcc419; }
.preview-dots i:nth-child(3) { background: #51cf66; }

.preview-url {
    overflow: hidden;
    color: var(--muted);
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-reload {
    border: 1px solid transparent;
    background: transparent;
    color: var(--blue);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.preview-reload:hover {
    border-color: rgba(41, 91, 141, 0.2);
    background: rgba(41, 91, 141, 0.06);
}

.preview-frame-wrap {
    position: relative;
    height: min(52vh, 460px);
    background: #f3f1ea;
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: white;
}

.preview-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 16px;
    padding: 28px;
    background: rgba(247, 245, 238, 0.94);
    text-align: center;
}

.preview-fallback p {
    max-width: 28rem;
    margin: 0 auto;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.65;
}

.preview-random {
    width: min(100%, 36rem);
    text-align: left;
}

.preview-random[hidden] {
    display: none;
}

.preview-random-meta {
    color: var(--red);
    font-size: 0.82rem;
    font-weight: 700;
}

.preview-random h3 {
    margin: 10px 0 14px;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.55rem;
    line-height: 1.35;
}

.preview-random-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.preview-random-tags span {
    border: 1px solid var(--line);
    padding: 5px 8px;
    color: var(--muted);
    font-size: 0.76rem;
}

.preview-fallback[hidden] {
    display: none;
}

button.chalk-button {
    cursor: pointer;
    font: inherit;
}

.index-list {
    border-top: 1px solid var(--line);
}

.index-row {
    display: grid;
    grid-template-columns: 72px minmax(160px, 0.52fr) minmax(260px, 1fr);
    gap: 26px;
    align-items: baseline;
    padding: 22px 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
    transition:
        color 0.28s var(--ease-out),
        padding-left 0.35s var(--ease-out),
        border-color 0.28s var(--ease-out);
}

.index-row:hover {
    padding-left: 14px;
    border-color: rgba(159, 61, 61, 0.26);
    color: var(--blue);
}

.index-row span {
    color: var(--red);
    font-style: italic;
    transition: transform 0.35s var(--ease-out);
}

.index-row:hover span {
    transform: translateX(4px);
}

.index-row strong {
    font-size: 1.38rem;
    font-weight: 700;
}

.index-row em {
    color: var(--muted);
    font-size: 1.02rem;
    font-style: normal;
    line-height: 1.55;
}

.study-layout {
    display: grid;
    grid-template-columns: minmax(260px, 0.7fr) minmax(380px, 1fr);
    gap: 52px;
    align-items: start;
}

.thesis-columns {
    display: grid;
    gap: 16px;
}

.thesis-columns article {
    position: relative;
    padding: 22px 22px 22px 88px;
    border: 1px solid var(--line);
    background: var(--panel);
    transition:
        transform 0.35s var(--ease-out),
        border-color 0.35s var(--ease-out),
        box-shadow 0.35s var(--ease-out);
}

.thesis-columns article:hover {
    border-color: rgba(41, 91, 141, 0.28);
    box-shadow: 0 16px 40px rgba(21, 32, 43, 0.06);
    transform: translateY(-3px);
}

.thesis-columns article::before {
    content: "";
    position: absolute;
    left: 62px;
    top: 22px;
    bottom: 22px;
    width: 1px;
    background: var(--line);
}

.thesis-columns span {
    position: absolute;
    left: 18px;
    top: 24px;
    color: var(--red);
    font-size: 0.84rem;
    font-style: italic;
}

.thesis-columns p {
    margin-bottom: 0;
}

.about-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(280px, 0.75fr);
    gap: 52px;
    align-items: start;
}

.about-layout a {
    color: var(--blue);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s ease;
}

.about-layout a:hover {
    border-bottom-color: rgba(41, 91, 141, 0.4);
}

.site-footer {
    padding: 22px;
    border: 1px solid var(--line);
    background: var(--panel);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 0.9rem;
}

.site-footer p {
    margin-bottom: 12px;
}

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

.record-links a {
    color: var(--muted);
    text-decoration: none;
    border-bottom: none;
}

.counter {
    display: block;
    max-width: 100%;
}

/* ─── Responsive ─── */

@media (max-width: 980px) {
    .topbar {
        grid-template-columns: 1fr auto;
        gap: 10px;
        min-height: auto;
    }

    .language-switcher {
        justify-self: end;
    }

    .nav-links {
        grid-column: 1 / -1;
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }

    .study-layout,
    .about-layout,
    .problems-layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .index-row {
        grid-template-columns: 56px 1fr;
    }

    .index-row em {
        grid-column: 2;
    }

    .hero-copy {
        top: 70%;
    }

    .preview-frame-wrap {
        height: min(42vh, 360px);
    }

    .page-inner {
        align-items: flex-start;
    }
}

@media (max-width: 820px) {
    :root {
        --mobile-header-space: calc(112px + env(safe-area-inset-top, 0px));
    }

    html,
    body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-x: clip;
        overflow-y: auto;
    }

    .topbar {
        top: max(8px, env(safe-area-inset-top, 0px));
        width: calc(100% - 16px);
        gap: 8px;
        padding: 8px 10px;
    }

    .brand-mark {
        width: 34px;
        height: 34px;
    }

    .brand strong {
        font-size: 0.92rem;
    }

    .brand em {
        display: none;
    }

    .language-switcher {
        font-size: 0.72rem;
    }

    .nav-links {
        justify-content: flex-start;
        gap: 4px;
        flex-wrap: nowrap;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links li {
        flex: 0 0 auto;
    }

    .nav-links a {
        min-height: 32px;
        padding: 0 9px;
        font-size: 0.8rem;
    }

    .page-stack {
        height: auto;
        overflow: visible;
    }

    .page {
        position: relative;
        inset: auto;
        height: auto;
        min-height: 100svh;
        min-height: 100dvh;
        overflow: visible;
        transform: none !important;
        scroll-margin-top: var(--mobile-header-space);
    }

    .page + .page {
        border-top: 1px solid rgba(21, 32, 43, 0.08);
    }

    .hero-stage {
        height: 100svh;
        height: 100dvh;
        min-height: 620px;
    }

    .page-inner {
        width: calc(100% - 28px);
        height: auto;
        min-height: 100svh;
        min-height: 100dvh;
        padding: var(--mobile-header-space) 0 48px;
        align-items: flex-start;
        overflow: visible;
    }

    .page-center {
        margin: 0;
    }

    .problems-layout {
        gap: 22px;
    }

    .status-card {
        margin-top: 20px;
        padding: 18px 16px 16px;
    }

    .status-card-head,
    .status-uptime-row {
        flex-wrap: wrap;
    }

    .status-target {
        overflow-wrap: anywhere;
    }

    .status-uptime-num {
        font-size: 2.1rem;
    }

    .status-bars {
        height: 34px;
        gap: 1px;
        padding: 7px 6px;
        touch-action: pan-y;
    }

    .preview-chrome {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 8px;
        padding: 0 10px;
    }

    .preview-frame-wrap {
        height: clamp(280px, 48svh, 360px);
        height: clamp(280px, 48dvh, 360px);
    }

    .manuscript-field::before {
        inset: 100px 14px 20px;
    }

    .formula-ghost .formula-line {
        font-size: clamp(1.7rem, 9.5vw, 2.8rem);
        letter-spacing: 0.02em;
    }

    .formula-token {
        font-size: 0.78rem;
    }

    .formula-token.major {
        font-size: 0.92rem;
    }

    .hero-copy {
        top: 70%;
        width: calc(100% - 28px);
    }

    .lead,
    .section-head p,
    .study-layout p,
    .about-layout p {
        font-size: 0.98rem;
        line-height: 1.65;
    }

    .button-row {
        gap: 10px;
    }

    .hero-copy .button-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .chalk-button {
        flex: 1 1 140px;
        min-width: 0;
        padding: 11px 14px;
        text-align: center;
    }

    .hero-copy .chalk-button {
        width: 100%;
    }

    .index-row {
        grid-template-columns: 44px 1fr;
        gap: 12px;
        padding: 18px 0;
    }

    .index-row strong {
        font-size: 1.15rem;
    }

    .index-row em {
        font-size: 0.94rem;
    }

    .thesis-columns article {
        padding: 18px 16px 18px 68px;
    }

    .thesis-columns article::before {
        left: 50px;
    }

    .thesis-columns span {
        left: 14px;
        font-size: 0.74rem;
    }

    .margin-notes span {
        font-size: 0.78rem;
    }

    .scroll-cue {
        bottom: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    body,
    .topbar,
    [data-reveal] {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }

    .scroll-cue span::after {
        animation: none;
    }
}
