@import url('/css/library-background.css');

:root {
  --bg: #f4f2ec;
  --paper: #f4f2ec;
  --paper-2: #ffffff;
  --ink: #1a1a17;
  --muted: #6b6960;
  --line: rgba(58,92,66,0.12);
  --line-strong: rgba(58,92,66,0.20);
  --accent: #1f7a55;
  --accent-deep: #15573b;
  --navy: #1a1a17;
  --link: #1f7a55;
  --shadow: none;
  --radius: 0px;
  --radius-sm: 0px;
  --content-width: 980px;
  --surface: #f4f2ec;
  --surface2: #ffffff;
  --text: #1a1a17;
  --gold: #1a1a17;
  --gold-dim: #1f7a55;
  --sidebar-w: 260px;
  --titlebar-h: 38px;
  --notes-w: 440px;
  --gl-notes-open-width: 0px;
  --gl-sidebar-current-width: var(--sidebar-w);
  --content-max: 1320px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: "LXGW WenKai TC", "Noto Serif SC", "STKaiti", "KaiTi", serif;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
}

#gl-titlebar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--titlebar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 10000;
  display: flex;
  align-items: center;
  user-select: none;
  backdrop-filter: blur(16px);
}

.titlebar-left {
  display: flex;
  align-items: center;
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100%;
  padding: 0 .5rem;
  gap: .15rem;
  transition: width .3s cubic-bezier(.16,1,.3,1);
  overflow: hidden;
}

.titlebar-left.collapsed {
  width: 44px;
}

.titlebar-center {
  flex: 1;
  display: flex;
  align-items: stretch;
  height: 100%;
  overflow: hidden;
  min-width: 0;
}

#titlebar-tabs {
  display: flex;
  align-items: stretch;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  gap: 0;
  min-width: 0;
}

#titlebar-tabs::-webkit-scrollbar {
  display: none;
}

.tb-tab {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 .55rem 0 .65rem;
  gap: .32rem;
  border-right: 1px solid var(--line);
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  transition: background .15s;
  max-width: 220px;
  min-width: 72px;
}

.tb-tab:first-child {
  border-left: 1px solid var(--line);
}

.tb-tab:hover {
  background: var(--surface2);
}

.tb-tab.active {
  background: color-mix(in srgb, var(--surface2) 68%, transparent);
  border-bottom: 2px solid var(--accent);
}

.tb-tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.tb-tab.active .tb-tab-dot {
  background: var(--accent);
}

.tb-tab-title {
  font-size: .78rem;
  color: var(--muted);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  line-height: 1;
}

.tb-tab.active .tb-tab-title {
  color: var(--ink);
}

.tb-tab-title:hover {
  color: var(--accent-deep);
}

.tb-tab-close {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 3px;
  color: var(--muted);
  cursor: pointer;
  font-size: .82rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
  padding: 0;
}

.tb-tab:hover .tb-tab-close {
  opacity: .7;
}

.tb-tab-close:hover {
  opacity: 1 !important;
  background: rgba(200,80,80,.16);
  color: #d06262;
}

.titlebar-right {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 .4rem;
  gap: .15rem;
  flex-shrink: 0;
  width: auto;
  justify-content: flex-end;
  transition: opacity .2s ease;
  overflow: visible;
}

.titlebar-right.notes-collapsed {
  width: auto;
}

body.lecture-entry-page #gl-membership-btn {
  display: none !important;
}

.titlebar-btn,
#sidebar-focus-btn {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  padding: 0 .55rem;
  font-size: .72rem;
  letter-spacing: .1em;
  white-space: nowrap;
  flex-shrink: 0;
}

.titlebar-btn:hover,
#sidebar-focus-btn:hover {
  background: var(--surface2);
  color: var(--ink);
}

#sidebar-focus-btn {
  width: 28px;
  padding: 0;
}

#sidebar-focus-btn.collapsed {
  color: #4ade80;
}

body.has-titlebar .page-top-stripe {
  display: none;
}

body.has-titlebar #theme-toggle,
body.has-titlebar #sidebar-toggle {
  position: static;
  top: auto;
  left: auto;
  right: auto;
  z-index: auto;
  box-shadow: none;
  backdrop-filter: none;
}

body.has-titlebar #theme-toggle {
  width: auto;
  min-width: 58px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(200,169,110,.24);
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(250,245,234,.98));
  color: #554537;
  box-shadow:
    0 1px 0 rgba(255,255,255,.8) inset,
    0 8px 20px rgba(85,69,55,.08);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .08em;
}

body.has-titlebar #sidebar-toggle {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(200,169,110,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(247,241,229,.96));
  color: #6a5949;
  box-shadow:
    0 1px 0 rgba(255,255,255,.75) inset,
    0 6px 18px rgba(85,69,55,.06);
}

body.has-titlebar #theme-toggle:hover,
body.has-titlebar #sidebar-toggle:hover {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,238,224,1));
  border-color: rgba(200,169,110,.34);
  color: #2f261f;
}

[data-theme="dark"] body.has-titlebar #theme-toggle,
[data-theme="dark"] body.has-titlebar #sidebar-toggle {
  background: linear-gradient(180deg, rgba(26,35,29,.96), rgba(18,24,20,.98));
  border-color: rgba(200,169,110,.20);
  color: #e8dcc3;
  box-shadow:
    0 1px 0 rgba(255,255,255,.05) inset,
    0 10px 24px rgba(0,0,0,.22);
}

[data-theme="dark"] body.has-titlebar #theme-toggle:hover,
[data-theme="dark"] body.has-titlebar #sidebar-toggle:hover {
  background: linear-gradient(180deg, rgba(32,43,35,.98), rgba(20,27,22,1));
  border-color: rgba(200,169,110,.32);
  color: #f3ebdc;
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: color-mix(in srgb, var(--accent) 70%, white); }
img { max-width: 100%; display: block; }

.page-top-stripe {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #19344f 0%, var(--accent) 55%, #19344f 100%);
  z-index: 90;
}

#theme-toggle,
#sidebar-toggle {
  position: fixed;
  top: 16px;
  z-index: 95;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(16,29,21,.72);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0,0,0,.16);
  backdrop-filter: blur(12px);
}
[data-theme="light"] #theme-toggle,
[data-theme="light"] #sidebar-toggle {
  background: rgba(255,255,255,.88);
  box-shadow: 0 8px 24px rgba(20,16,12,.08);
}
#theme-toggle { left: 10px; font-size: 18px; }
#sidebar-toggle { left: 58px; font-size: 19px; }

body.has-titlebar > #theme-toggle,
body.has-titlebar > #sidebar-toggle {
  display: none;
}

#gl-workspace {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  padding-top: var(--titlebar-h);
  position: relative;
  transition: padding-right .18s cubic-bezier(.16,1,.3,1);
}

#gl-workspace.notes-docked-open {
  padding-right: var(--gl-notes-open-width);
}

#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  position: sticky;
  top: var(--titlebar-h);
  height: calc(100vh - var(--titlebar-h));
  align-self: flex-start;
  transition: width .3s cubic-bezier(.16,1,.3,1), opacity .3s, border-color .3s;
  z-index: 100;
  backdrop-filter: blur(16px);
}

#sidebar.collapsed,
#sidebar.study-force-collapsed {
  width: 0 !important;
  overflow: hidden;
  border-right-color: transparent !important;
  opacity: 0;
  pointer-events: none;
}

#sidebar-inner {
  padding: 1.2rem 1rem 3rem;
  min-width: var(--sidebar-w);
}

.sidebar-logo {
  display: block;
  text-decoration: none;
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.sidebar-logo-en {
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .18em;
  text-transform: uppercase;
  display: block;
  margin-bottom: .3rem;
}

.sidebar-logo-zh {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-deep);
  letter-spacing: .05em;
}

.sidebar-home-link,
.sidebar-section-body a,
.sidebar-links a {
  display: block;
  text-decoration: none;
  font-size: .8rem;
  color: var(--muted);
  padding: .34rem .45rem;
  border-radius: 8px;
  transition: color .2s, background .2s;
  border-left: 2px solid transparent;
  line-height: 1.5;
}

.sidebar-home-link:hover,
.sidebar-section-body a:hover,
.sidebar-links a:hover {
  color: var(--ink);
  background: var(--surface2);
}

.sidebar-section-body a.active,
.sidebar-links a.active {
  color: var(--accent-deep);
  border-left-color: var(--accent);
  background: var(--surface2);
}

.sidebar-section-title {
  font-size: .68rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.2rem 0 .6rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--line);
}

.sidebar-section {
  margin-bottom: .35rem;
}

.sidebar-section-btn {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-size: .86rem;
  font-weight: 600;
  letter-spacing: .06em;
  padding: .45rem .5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: .5rem;
  text-align: left;
  transition: background .2s;
}

.sidebar-section-btn:hover {
  background: var(--surface2);
}

.sidebar-era-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  flex-shrink: 0;
}

.sidebar-chevron {
  margin-left: auto;
  font-size: 1rem;
  line-height: 1;
  transition: transform .2s;
  color: var(--muted);
}

.sidebar-section.open .sidebar-chevron {
  transform: rotate(90deg);
}

.sidebar-section-body {
  padding-left: .8rem;
}

.sidebar-subgroup {
  margin-bottom: .5rem;
}

.sidebar-subgroup-label {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .3rem .4rem .2rem;
  opacity: .75;
}

.main-content {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: min(1520px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 86px 28px 72px;
  position: relative;
  z-index: 1;
}

#gl-workspace.notes-docked-open .main-content {
  max-width: none;
  margin: 0;
}

#gl-workspace.notes-docked-open .page-header,
#gl-workspace.notes-docked-open .backlinks-section,
#gl-workspace.notes-docked-open .page-footer {
  max-width: none;
}

.main-content::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 18px;
  height: 440px;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 14%, rgba(28, 92, 61, 0.28), transparent 30%),
    radial-gradient(circle at 84% 18%, rgba(22, 74, 50, 0.24), transparent 28%),
    linear-gradient(180deg, rgba(6, 18, 12, 0.38), rgba(6, 18, 12, 0));
  filter: blur(18px);
  opacity: .94;
  z-index: 0;
}
[data-theme="light"] .main-content::before { opacity: .24; }

/* 右侧笔记面板的外框和进出场由全局 CSS 承担，notes.js 只负责内部控件 */
#gl-note-panel {
  width: var(--notes-w);
  max-width: min(92vw, var(--notes-w));
  background: var(--surface);
  border-left: 1px solid var(--line);
  position: fixed;
  top: var(--titlebar-h);
  right: 0;
  bottom: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform .28s cubic-bezier(.16,1,.3,1), opacity .22s ease, border-color .22s ease;
  z-index: 10012;
  box-shadow: -12px 0 34px rgba(0,0,0,.18);
}

#gl-note-panel.notes-docked-panel {
  max-width: none;
  box-shadow: -10px 0 24px rgba(43, 34, 24, .08);
}

#gl-note-panel.notes-collapsed {
  transform: translateX(calc(100% + 8px));
  border-left-color: transparent;
  opacity: 0;
  pointer-events: none;
}

#gl-note-panel.notes-docked-panel #gl-resize-handle {
  width: 12px;
  left: -6px;
  cursor: col-resize;
  z-index: 5;
}

#gl-note-panel.notes-docked-panel #gl-resize-handle::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 5px;
  width: 1px;
  background: color-mix(in srgb, var(--line-strong) 72%, transparent);
}

#gl-note-panel.notes-docked-panel #gl-resize-handle:hover,
#gl-note-panel.notes-docked-panel #gl-resize-handle:active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.notes-panel-intro {
  padding: .85rem 1rem .8rem;
  border-bottom: 1px solid rgba(200,220,255,.08);
  background: linear-gradient(180deg, rgba(90,154,106,.08), rgba(90,154,106,0));
}

.notes-panel-kicker {
  font-size: .66rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .35rem;
}

.notes-panel-copy {
  font-size: .8rem;
  color: var(--text);
  line-height: 1.7;
}

.notes-panel-copy strong {
  color: var(--gold);
}

.page-header {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
    linear-gradient(135deg, rgba(90,154,106,0.10), rgba(200,169,110,0.06));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 34px 34px 22px;
  margin-bottom: 28px;
  overflow: hidden;
  backdrop-filter: blur(16px);
}
.page-header::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 18%, rgba(51, 140, 95, 0.20), transparent 28%),
    radial-gradient(circle at 78% 22%, rgba(14, 62, 40, 0.28), transparent 32%),
    linear-gradient(135deg, rgba(7, 18, 12, 0.18), rgba(7, 18, 12, 0.03) 58%, rgba(200,169,110,0.05));
  opacity: .78;
  mix-blend-mode: screen;
}
[data-theme="light"] .page-header::after {
  opacity: .32;
  mix-blend-mode: multiply;
}
[data-theme="light"] .page-header {
  background:
    linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.9)),
    linear-gradient(135deg, rgba(200,169,110,.12), rgba(34,54,74,.06));
}
.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(200,169,110,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200,169,110,.08) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: .12;
  pointer-events: none;
}
[data-theme="light"] .page-header::before { opacity: .35; }
.page-header > * { position: relative; z-index: 1; }
.page-era-badge {
  font-size: 14px;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 12px;
  font-weight: 600;
}
.page-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.18;
  color: #f0ece4;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", "DFKai-SB", serif;
}
[data-theme="light"] .page-title { color: #17110d; }
.page-meta {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.lecture-layout {
  display: block;
  position: relative;
  min-height: 0;
  z-index: 1;
}

.lecture-side-controls {
  position: static;
}

.lecture-side-toggle {
  position: fixed;
  top: calc(var(--titlebar-h) + 56px);
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(16, 29, 21, 0.84);
  box-shadow: 0 12px 28px rgba(0,0,0,.14);
  backdrop-filter: blur(12px);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
  z-index: 2147483000;
  pointer-events: auto;
}

[data-theme="light"] .lecture-side-toggle {
  background: rgba(255,255,255,.9);
}

.lecture-side-toggle-left {
  left: calc(var(--sidebar-w) + 18px);
}

.lecture-side-toggle-right {
  right: 18px;
}

.lecture-side-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(200,169,110,.34);
}

.lecture-side-toggle[aria-expanded="true"] {
  background: linear-gradient(135deg, rgba(33, 100, 67, 0.28), rgba(18, 49, 34, 0.18));
  border-color: rgba(92, 170, 118, 0.34);
}

[data-theme="light"] .lecture-side-toggle[aria-expanded="true"] {
  background: linear-gradient(135deg, rgba(164, 212, 180, 0.34), rgba(232, 239, 234, 0.82));
}

.lecture-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 14, 10, 0.18);
  backdrop-filter: blur(2px);
  z-index: 2147482990;
}

[data-theme="light"] .lecture-drawer-backdrop {
  background: rgba(30, 26, 18, 0.08);
}

.lecture-left-rail,
.lecture-right-rail {
  position: fixed;
  top: calc(var(--titlebar-h) + 108px);
  bottom: 24px;
  width: min(320px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: transform .22s ease, opacity .22s ease;
  z-index: 2147482995;
}

.lecture-left-rail {
  left: calc(var(--sidebar-w) + 18px);
  transform: translateX(-18px);
}

.lecture-right-rail {
  right: 18px;
  transform: translateX(18px);
}

.lecture-right-rail[hidden] {
  display: none !important;
}

.lecture-left-rail.is-open,
.lecture-right-rail.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.lecture-drawer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.lecture-drawer-label {
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

.lecture-drawer-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(16,29,21,.82);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

[data-theme="light"] .lecture-drawer-close {
  background: rgba(255,255,255,.92);
}

.lecture-drawer-close:hover {
  border-color: rgba(200,169,110,.34);
}

.lecture-rail-card,
.lecture-right-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
    rgba(16,29,21,.78);
  box-shadow: 0 14px 32px rgba(0,0,0,.14);
  backdrop-filter: blur(16px);
}

[data-theme="light"] .lecture-rail-card,
[data-theme="light"] .lecture-right-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,.84), rgba(255,255,255,.92)),
    rgba(255,255,255,.9);
  box-shadow: 0 10px 28px rgba(43,34,24,.06);
}

.lecture-rail-card::before,
.lecture-right-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 16%, rgba(42, 126, 84, 0.18), transparent 28%),
    radial-gradient(circle at 84% 16%, rgba(10, 46, 30, 0.20), transparent 34%),
    linear-gradient(180deg, rgba(13, 38, 26, 0.18), rgba(13, 38, 26, 0.02));
  opacity: .82;
}

[data-theme="light"] .lecture-rail-card::before,
[data-theme="light"] .lecture-right-card::before {
  opacity: .16;
}

.lecture-rail-card > *,
.lecture-right-card > * {
  position: relative;
  z-index: 1;
}

.lecture-rail-card,
.lecture-right-card {
  padding: 16px;
}

.lecture-rail-title,
.lecture-right-title {
  margin: 0 0 10px;
  font-size: .82rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.lecture-toc {
  display: grid;
  gap: 8px;
}

.lecture-toc a {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.55;
  background: rgba(255,255,255,0.02);
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.lecture-toc a:hover {
  transform: translateX(2px);
  border-color: rgba(200,169,110,.30);
  background: rgba(255,255,255,0.05);
}

[data-theme="light"] .lecture-toc a {
  background: rgba(34,54,74,.03);
}

[data-theme="light"] .lecture-toc a:hover {
  background: rgba(255,255,255,.96);
}

.lecture-toc strong,
.lecture-toc span {
  display: block;
}

.lecture-toc strong {
  font-size: 14px;
  color: var(--ink);
}

.lecture-toc span {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.lecture-toc-footnote,
.lecture-note-hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.lecture-center-column {
  min-width: 0;
  width: min(100%, 980px);
  margin: 0 auto;
}

.lecture-note-shell {
  position: relative;
  padding: 16px 0 0;
}

.lecture-note-shell::before {
  content: '';
  position: absolute;
  top: 52px;
  bottom: 18px;
  left: 50%;
  width: min(1360px, calc(100vw - var(--sidebar-w) - 72px));
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(18, 58, 40, 0.92), rgba(9, 26, 18, 0.94)),
    rgba(13, 39, 27, 0.92);
  box-shadow:
    0 28px 70px rgba(3, 15, 9, 0.48),
    0 0 0 1px rgba(74, 135, 93, 0.18) inset;
  transform: translateX(-50%) translate(10px, 10px);
  filter: blur(.2px);
  z-index: 0;
}

.lecture-note-shell::after {
  content: '';
  position: absolute;
  top: 62px;
  bottom: 22px;
  left: 50%;
  width: min(1320px, calc(100vw - var(--sidebar-w) - 112px));
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 18%, rgba(58, 150, 97, 0.22), transparent 30%),
    radial-gradient(circle at 82% 12%, rgba(27, 88, 58, 0.20), transparent 28%),
    linear-gradient(180deg, rgba(10, 36, 24, 0.10), rgba(10, 36, 24, 0));
  opacity: .9;
  pointer-events: none;
  transform: translateX(-50%);
  z-index: 0;
}

[data-theme="light"] .lecture-note-shell::before {
  background:
    linear-gradient(135deg, rgba(210, 229, 214, 0.88), rgba(193, 216, 201, 0.94)),
    rgba(206, 224, 211, 0.9);
  box-shadow:
    0 18px 42px rgba(66, 87, 72, 0.10),
    0 0 0 1px rgba(88, 120, 96, 0.08) inset;
}

[data-theme="light"] .lecture-note-shell::after {
  opacity: .34;
}

.lecture-note-shell > * {
  position: relative;
  z-index: 1;
}

.lecture-right-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.lecture-note-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(92, 170, 118, 0.28);
  background: linear-gradient(135deg, rgba(33, 100, 67, 0.28), rgba(18, 49, 34, 0.18));
  color: #e8f2eb;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.lecture-note-trigger:hover {
  transform: translateY(-1px);
  border-color: rgba(200,169,110,.34);
  background: linear-gradient(135deg, rgba(42, 120, 81, 0.34), rgba(20, 58, 40, 0.22));
}

[data-theme="light"] .lecture-note-trigger {
  color: #183225;
  background: linear-gradient(135deg, rgba(164, 212, 180, 0.34), rgba(232, 239, 234, 0.82));
}

.lecture-note-list,
.lecture-memory-list {
  margin: 12px 0 0;
  padding-left: 1.2em;
}

.lecture-note-list li,
.lecture-memory-list li {
  margin: .45em 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.75;
}

.lecture-memory-kicker {
  margin: 0;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.lecture-memory-text {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink);
}

.obs-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.03);
  color: var(--navy);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.obs-btn:hover {
  background: rgba(255,255,255,0.06);
  color: #f3e2ba;
}
[data-theme="light"] .obs-btn {
  background: rgba(255,255,255,.84);
}
[data-theme="light"] .obs-btn:hover {
  background: #fff;
  color: var(--accent-deep);
}

.lecture-overview,
.lecture-jumpnav {
  max-width: var(--content-width);
  margin: 0 auto 22px;
  position: relative;
  z-index: 1;
}

.lecture-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  max-width: none;
}

.lecture-panel,
.lecture-sidecard {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
    rgba(16,29,21,.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

[data-theme="light"] .lecture-panel,
[data-theme="light"] .lecture-sidecard {
  background:
    linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.9)),
    rgba(255,255,255,.88);
}

.lecture-panel::before,
.lecture-sidecard::before,
.lecture-jumpnav a::before,
.table-wrap::before,
.portrait-wrap::before,
.author-card::before,
.chuanji-block::before,
.backlinks-section::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(42, 126, 84, 0.16), transparent 26%),
    radial-gradient(circle at 82% 22%, rgba(10, 46, 30, 0.24), transparent 30%),
    linear-gradient(180deg, rgba(13, 38, 26, 0.18), rgba(13, 38, 26, 0.03));
  opacity: .82;
}
[data-theme="light"] .lecture-panel::before,
[data-theme="light"] .lecture-sidecard::before,
[data-theme="light"] .lecture-jumpnav a::before,
[data-theme="light"] .table-wrap::before,
[data-theme="light"] .portrait-wrap::before,
[data-theme="light"] .author-card::before,
[data-theme="light"] .chuanji-block::before,
[data-theme="light"] .backlinks-section::before {
  opacity: .16;
}

.lecture-panel > *,
.lecture-sidecard > *,
.lecture-jumpnav a > *,
.table-wrap > *,
.portrait-wrap > *,
.author-card > *,
.chuanji-block > *,
.backlinks-section > * {
  position: relative;
  z-index: 1;
}

.lecture-panel {
  padding: 26px 28px;
}

.lecture-kicker {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.lecture-lead {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.95;
}

.lecture-points {
  margin: 16px 0 0;
  padding-left: 1.2em;
  color: var(--muted);
}

.lecture-points li { margin: .45em 0; }

.lecture-sidecard {
  padding: 20px 22px 18px;
  display: grid;
  gap: 12px;
}

.lecture-sidecard-title {
  margin: 0;
  color: var(--ink);
  font-size: .95rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.lecture-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  align-content: flex-start;
}

.lecture-chip {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  max-width: 100%;
}

[data-theme="light"] .lecture-chip {
  background: rgba(255,255,255,.72);
}

.lecture-jumpnav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: none;
}

.lecture-jumpnav a {
  position: relative;
  display: block;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(16,29,21,.72);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(0,0,0,.10);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

[data-theme="light"] .lecture-jumpnav a {
  background: rgba(255,255,255,.82);
}

.lecture-jumpnav a:hover {
  transform: translateY(-1px);
  border-color: rgba(200,169,110,.44);
  background: rgba(255,255,255,.06);
}

[data-theme="light"] .lecture-jumpnav a:hover {
  background: #fff;
}

.lecture-jumpnav strong {
  display: block;
  font-size: 15px;
  color: var(--ink);
}

.lecture-jumpnav span {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.article-body {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 6px;
  font-size: 18px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", "DFKai-SB", serif;
}
.article-body > :first-child { margin-top: 0; }
.article-body p,
.article-body ul,
.article-body ol,
.article-body blockquote,
.article-body .table-wrap,
.article-body .portrait-wrap,
.article-body .author-card-grid,
.article-body .chuanji-block,
.article-body .backlinks-section {
  margin-top: 1rem;
  margin-bottom: 1.2rem;
}
.article-body h2,
.article-body h3,
.article-body h4 {
  color: #f0ece4;
  line-height: 1.35;
  scroll-margin-top: 90px;
}
[data-theme="light"] .article-body h2,
[data-theme="light"] .article-body h3,
[data-theme="light"] .article-body h4 {
  color: #17110d;
}
.article-body h2 {
  margin-top: 2.6rem;
  margin-bottom: 1rem;
  font-size: clamp(1.55rem, 2vw, 2.1rem);
  padding-top: .4rem;
  border-top: 1px solid rgba(200,169,110,.45);
}
.article-body h3 {
  margin-top: 1.8rem;
  margin-bottom: .7rem;
  font-size: 1.28rem;
}
.article-body h4 {
  margin-top: 1.2rem;
  margin-bottom: .5rem;
  font-size: 1.05rem;
}
.article-body ul,
.article-body ol { padding-left: 1.4em; }
.article-body li { margin: .28em 0; }
.article-body strong { color: #1a1a17; }
[data-theme="light"] .article-body strong { color: #1a1a17; }
.article-body hr { border: none; border-top: 1px solid var(--line); margin: 2rem 0; }
.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .92em;
  padding: .1em .35em;
  border-radius: 6px;
  background: #efe7da;
}
[data-theme="light"] .article-body code { background: #efe7da; }
.article-body blockquote {
  margin-left: 0;
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--accent);
  background: rgba(255,255,255,.72);
  color: #4b4037;
  border-radius: 0 14px 14px 0;
}
[data-theme="light"] .article-body blockquote {
  background: rgba(255,255,255,.72);
  color: #4b4037;
}
.wiki-link {
  color: var(--link);
  font-weight: 600;
}

#gl-textarea,
.gl-panel-title,
.gl-tab,
.gl-tbtn,
.gl-tool-btn,
.notes-panel-copy,
.notes-panel-kicker {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", "DFKai-SB", serif !important;
}

.table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(16,29,21,.82);
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  backdrop-filter: blur(14px);
}
[data-theme="light"] .table-wrap {
  background: rgba(255,255,255,.72);
  box-shadow: 0 10px 30px rgba(43,34,24,.05);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  min-width: 520px;
}
thead tr { background: rgba(200,169,110,.10); }
th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
th { font-weight: 700; color: #f0ece4; }
[data-theme="light"] th { color: #2a211b; }

.portrait-wrap {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 1.25rem 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16,29,21,.82);
  box-shadow: 0 10px 28px rgba(0,0,0,.12);
}
[data-theme="light"] .portrait-wrap {
  background: rgba(255,255,255,.78);
  box-shadow: 0 10px 28px rgba(43,34,24,.06);
}
.author-portrait {
  width: min(280px, 100%);
  border-radius: 12px;
  object-fit: cover;
}
.author-portrait-caption {
  display: block;
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}
.portrait-source { color: #8e847b; }

.author-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.author-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.5fr .9fr;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(16,29,21,.84);
  box-shadow: 0 10px 28px rgba(0,0,0,.12);
}
[data-theme="light"] .author-card {
  background: rgba(255,255,255,.78);
  box-shadow: 0 10px 28px rgba(43,34,24,.06);
}
.author-card-compact { align-items: start; }
.author-card-main > :first-child { margin-top: 0; }
.author-card-kicker {
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 8px;
  font-weight: 700;
}
.author-card-title {
  margin: 0 0 10px;
  font-size: 1.35rem;
  color: #f0ece4;
}
[data-theme="light"] .author-card-title { color: inherit; }
.author-card-points { margin: .8rem 0 0; padding-left: 1.2em; }
.author-card-media.portrait-wrap { margin: 0; width: 100%; }

.chuanji-block,
.backlinks-section {
  position: relative;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  backdrop-filter: blur(14px);
}
[data-theme="light"] .chuanji-block,
[data-theme="light"] .backlinks-section {
  border: 1px solid rgba(34,54,74,.16);
  background: linear-gradient(180deg, rgba(34,54,74,.04), rgba(255,255,255,.76));
}
.backlinks-title {
  margin: 0 0 .5rem;
  font-size: .9rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.backlinks-list {
  margin: 0;
  padding-left: 1.2em;
}

#sidebar ul,
#sidebar ol { padding-left: 1.2em; }

@media (max-width: 960px) {
  .main-content { padding: 84px 18px 56px; }
  .page-header { padding: 26px 22px 18px; }
  .lecture-side-toggle {
    top: calc(var(--titlebar-h) + 46px);
  }
  .lecture-side-toggle-left { left: 14px; }
  .lecture-side-toggle-right { right: 14px; }
  .lecture-left-rail,
  .lecture-right-rail {
    top: calc(var(--titlebar-h) + 94px);
    width: min(360px, calc(100vw - 28px));
  }
  .lecture-left-rail { left: 14px; }
  .lecture-right-rail { right: 14px; }
  .lecture-note-shell {
    padding: 10px 0 0;
  }
  .lecture-note-shell::before,
  .lecture-note-shell::after {
    transform: none;
    border-radius: 24px;
  }
  .lecture-note-shell::before {
    inset: 8px 0 0;
  }
  .lecture-note-shell::after {
    inset: 16px 12px 8px;
  }
  .lecture-overview,
  .lecture-jumpnav { grid-template-columns: 1fr; }
  .article-body { font-size: 17px; }
  .author-card-grid,
  .author-card { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  #theme-toggle,
  #sidebar-toggle {
    top: 10px;
    width: 40px;
    height: 40px;
  }
  #sidebar-toggle { left: 56px; }
  #sidebar { width: 82vw; padding-top: 74px; }
  body.lecture-entry-page #sidebar {
    position: fixed;
    left: 0;
    top: var(--titlebar-h);
    height: calc(100dvh - var(--titlebar-h));
    box-shadow: 18px 0 44px rgba(0,0,0,.26);
  }
  body.lecture-entry-page .main-content {
    max-width: 100%;
  }
  .main-content { padding: 72px 14px 44px; }
  .page-title { font-size: 2.15rem; }
  .lecture-side-toggle {
    top: calc(var(--titlebar-h) + 42px);
    min-width: 62px;
    height: 38px;
    padding: 0 14px;
  }
  .lecture-side-toggle-left { left: 10px; }
  .lecture-side-toggle-right { right: 10px; }
  .lecture-left-rail,
  .lecture-right-rail {
    top: calc(var(--titlebar-h) + 88px);
    bottom: 16px;
    width: calc(100vw - 20px);
  }
  .lecture-left-rail { left: 10px; }
  .lecture-right-rail { right: 10px; }
  .lecture-rail-card,
  .lecture-right-card,
  .lecture-panel,
  .lecture-sidecard,
  .lecture-jumpnav a {
    border-radius: 18px;
  }
  .article-body { font-size: 16px; }
  th, td { padding: 12px 12px; font-size: 14px; }
  .obs-btn { width: 100%; justify-content: center; }
}

/* 经典 dropcap 首字下沉效果 */
.gl-dropcap::first-letter,
.article-body p:first-of-type::first-letter {
  font-family: 'LXGW WenKai TC', 'Noto Serif SC', serif;
  font-weight: 700;
  font-size: 3.4em;
  float: left;
  line-height: 0.82;
  margin: 0.05em 0.14em 0 0;
  color: #1f7a55;
}

