/* 全站主题变量：颜色、阴影等统一放在这里，后面用 var(...) 复用。 */
:root {
  color-scheme: light;
  --paper: #f3f7f8;
  --paper-strong: #fffefd;
  --ink: #10232e;
  --muted: #5c6f78;
  --line: #d5e3e8;
  --teal: #147b91;
  --teal-dark: #0e4e66;
  --coral: #c35d6f;
  --moss: #5b796d;
  --gold: #caa14c;
  --violet: #6761a8;
  --shadow: 0 22px 70px rgba(16, 35, 46, 0.14);
}

:root[data-theme-state="ousia"] {
  color-scheme: dark;
  --paper: #091523;
  --paper-strong: #111d2e;
  --ink: #e8f6fb;
  --muted: #adc4ce;
  --line: #254055;
  --teal: #66d5f0;
  --teal-dark: #a3ecfb;
  --coral: #ef8aa1;
  --moss: #9bc5b2;
  --gold: #e4c36b;
  --violet: #a6a5f5;
  --shadow: 0 24px 76px rgba(0, 0, 0, 0.46);
}

/* 基础重置：让盒模型和默认字体更可控。 */
* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 96px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 16% 12%, rgba(20, 123, 145, 0.14), transparent 28%),
    radial-gradient(circle at 84% 20%, rgba(103, 97, 168, 0.12), transparent 26%),
    linear-gradient(315deg, rgba(195, 93, 111, 0.09), transparent 28%),
    var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

:root[data-theme-state="ousia"] body {
  background:
    radial-gradient(circle at 18% 10%, rgba(102, 213, 240, 0.16), transparent 30%),
    radial-gradient(circle at 84% 18%, rgba(166, 165, 245, 0.18), transparent 28%),
    linear-gradient(315deg, rgba(239, 138, 161, 0.08), transparent 34%),
    var(--paper);
}

button,
input,
textarea,
select {
  font: inherit;
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  display: none;
  -webkit-appearance: none;
}

button {
  cursor: pointer;
}

/* 页面外壳：限制最大宽度，并在小屏幕上保留左右边距。 */
.site-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-footer {
  display: grid;
  gap: 4px;
  width: min(100%, 980px);
  margin: 34px auto 96px;
  border: 1px solid rgba(16, 35, 46, 0.1);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255, 254, 253, 0.62);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  backdrop-filter: blur(16px);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--teal-dark);
  font-weight: 900;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  text-decoration: underline;
  outline: 0;
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--violet), var(--gold));
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 80ms linear;
}

/* 顶部导航：sticky 让导航滚动时吸附在顶部。 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(12px, 1.5vw, 18px);
  min-height: 72px;
  border-bottom: 1px solid rgba(16, 35, 46, 0.08);
  background: rgba(243, 247, 248, 0.82);
  backdrop-filter: blur(18px);
}

.topbar-actions {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  margin-left: auto;
  min-width: 0;
}

/* 品牌区：头像标和 qqqzj@Crane 文本。 */
.brand,
.nav-links a {
  color: var(--ink);
  text-decoration: none;
}

.brand-cluster {
  position: relative;
  z-index: 12;
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: clamp(12px, 1.5vw, 18px);
  min-width: 0;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.topbar-search.discovery-section {
  position: relative;
  flex: 0 1 clamp(190px, 16vw, 260px);
  width: clamp(190px, 16vw, 260px);
  max-width: 260px;
  min-width: 180px;
  padding: 0;
  scroll-margin-top: 86px;
}

.topbar-search .section-heading,
.topbar-search .search-field span,
.topbar-search .filter-status,
.topbar-search .tag-filter {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.topbar-search .search-panel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 1px solid rgba(16, 35, 46, 0.1);
  border-radius: 999px;
  padding: 4px 5px 4px 14px;
  background: rgba(255, 254, 253, 0.54);
  box-shadow:
    0 14px 30px rgba(16, 35, 46, 0.06),
    inset 0 1px 0 rgba(255, 254, 253, 0.64);
  cursor: text;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar-search .search-field {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-search .search-field input {
  width: 100%;
  border: 0;
  padding: 7px 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  outline: 0;
}

.topbar-search .search-field input::placeholder {
  color: rgba(83, 103, 113, 0.76);
}

.topbar-search .search-field input:focus {
  box-shadow: none;
}

.topbar-search .clear-search-button {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(16, 35, 46, 0.08);
  color: rgba(16, 35, 46, 0.58);
  font-size: 0;
  cursor: pointer;
}

.topbar-search .clear-search-button::before {
  content: "×";
  font-size: 16px;
  line-height: 1;
}

.topbar-search .clear-search-button:disabled {
  opacity: 0;
  pointer-events: none;
}

.topbar-search .search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 80;
  width: min(440px, calc(100vw - 24px));
  max-height: min(290px, 48vh);
  overflow: auto;
  border: 1px solid rgba(16, 35, 46, 0.12);
  border-radius: 14px;
  padding: 8px;
  background: rgba(255, 254, 253, 0.96);
  box-shadow: 0 22px 54px rgba(16, 35, 46, 0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand-mark {
  --brand-avatar-size: 70px;
  --brand-avatar-offset-x: 0px;
  --brand-avatar-offset-y: 0px;

  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  width: 52px;
  height: 52px;
  overflow: visible;
  border-radius: 50%;
  border: 1px solid rgba(255, 254, 253, 0.72);
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 254, 253, 0.22), transparent 28%),
    linear-gradient(135deg, var(--teal-dark), var(--violet) 58%, var(--gold));
  box-shadow:
    0 8px 22px rgba(20, 123, 145, 0.24),
    inset 0 0 0 1px rgba(255, 254, 253, 0.2);
}

.brand-mark::after {
  position: absolute;
  inset: -1px;
  z-index: 1;
  border-radius: inherit;
  content: "";
  background:
    radial-gradient(circle at 34% 24%, rgba(102, 213, 240, 0.24), transparent 28%),
    linear-gradient(145deg, rgba(2, 8, 19, 0.54), rgba(87, 78, 173, 0.26));
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms ease;
}

.brand-mark::before {
  position: absolute;
  inset: -8px -6px -10px;
  z-index: 0;
  border-radius: 46% 46% 52% 52%;
  content: "";
  background:
    radial-gradient(circle at 50% 15%, rgba(235, 248, 255, 0.32), transparent 18%),
    linear-gradient(155deg, rgba(5, 9, 20, 0.96), rgba(31, 38, 90, 0.92) 62%, rgba(91, 214, 239, 0.54));
  opacity: 0;
  transform: translateY(2px) scale(0.88);
  transition:
    opacity 420ms ease,
    transform 520ms cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

/* 头像比圆底稍大一点，形成贴纸感，而不是被硬裁成小圆图。 */
.brand-avatar img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--brand-avatar-size);
  height: var(--brand-avatar-size);
  max-width: none;
  object-fit: contain;
  object-position: center center;
  transform: translate(-50%, -50%) translate(var(--brand-avatar-offset-x), var(--brand-avatar-offset-y)) scale(1);
  transform-origin: center center;
  z-index: 2;
  transition:
    opacity 520ms ease,
    filter 760ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 760ms cubic-bezier(0.16, 1, 0.3, 1);
}

.brand:hover .brand-avatar img,
.brand:focus-visible .brand-avatar img {
  animation: avatar-bounce 620ms ease both;
}

/* 主导航胶囊按钮。 */
.nav-links {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(16, 35, 46, 0.12);
  border-radius: 999px;
  padding: 5px;
  background: rgba(255, 253, 248, 0.72);
}

.nav-links a {
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: var(--teal-dark);
  color: var(--paper-strong);
  outline: 0;
}

.theme-switcher {
  position: relative;
  z-index: 4;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  color: var(--muted);
}

.theme-switcher button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(16, 35, 46, 0.12);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(255, 253, 248, 0.78);
  color: inherit;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 10px 22px rgba(16, 35, 46, 0.06);
}

.theme-switcher button span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(20, 123, 145, 0.1);
  color: var(--teal-dark);
  font-size: 11px;
  transition:
    background 240ms ease,
    color 240ms ease,
    transform 240ms ease;
}

.theme-trigger .theme-trigger-icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
}

.theme-trigger [data-theme-current-label] {
  display: inline;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.theme-switcher button:hover,
.theme-switcher button:focus-visible {
  background: var(--teal-dark);
  color: var(--paper-strong);
  outline: 0;
}

.theme-trigger {
  min-width: 86px;
  justify-content: center;
}

.theme-options {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 12;
  display: grid;
  gap: 6px;
  min-width: 132px;
  border: 1px solid rgba(16, 35, 46, 0.12);
  border-radius: 16px;
  padding: 7px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 18px 42px rgba(16, 35, 46, 0.16);
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
  transform-origin: 90% 0;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.theme-options::before {
  position: absolute;
  inset: -10px 0 auto;
  height: 10px;
  content: "";
}

.theme-switcher:hover .theme-options,
.theme-switcher:focus-within .theme-options,
.theme-switcher.is-open .theme-options {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.theme-options button {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  padding: 8px 10px;
  background: transparent;
  box-shadow: none;
}

.theme-options button.is-active {
  background: rgba(20, 123, 145, 0.12);
  color: var(--teal-dark);
}

.theme-switcher button.is-active span {
  background: var(--teal-dark);
  color: var(--paper-strong);
  transform: scale(1.04);
}

.theme-trigger.is-active [data-theme-current-label] {
  background: transparent;
  color: inherit;
  transform: none;
}

/* 首页首屏：图片铺满，文字和装饰层叠在上方。 */
.studio-panel {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(360px, 1.18fr);
  width: min(100%, 980px);
  min-height: clamp(340px, 50vh, 520px);
  margin: clamp(10px, 1.8vw, 22px) auto 0;
  overflow: hidden;
  border: 1px solid rgba(16, 35, 46, 0.14);
  border-radius: 28px;
  background: #10232e;
  box-shadow: var(--shadow);
}

/* 叠加深色蒙版，让白色标题在图片上更清楚。 */
.studio-panel::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  background:
    linear-gradient(90deg, rgba(9, 29, 45, 0.94), rgba(14, 78, 102, 0.58) 43%, rgba(16, 35, 46, 0.08)),
    radial-gradient(circle at 38% 24%, rgba(202, 161, 76, 0.22), transparent 22%);
  pointer-events: none;
}

/* 右下角的水滴/剧场感装饰，不影响点击。 */
.studio-panel::before {
  position: absolute;
  right: clamp(8px, 2vw, 28px);
  bottom: clamp(8px, 2vw, 28px);
  z-index: 1;
  width: clamp(82px, 12vw, 140px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 254, 253, 0.5);
  border-radius: 56% 44% 62% 38% / 42% 58% 42% 58%;
  content: "";
  background:
    linear-gradient(135deg, rgba(255, 254, 253, 0.18), transparent 48%),
    radial-gradient(circle at 34% 40%, rgba(255, 254, 253, 0.72) 0 8%, transparent 9%),
    radial-gradient(circle at 66% 40%, rgba(255, 254, 253, 0.72) 0 8%, transparent 9%),
    linear-gradient(135deg, rgba(20, 123, 145, 0.28), rgba(103, 97, 168, 0.22));
  box-shadow: 0 18px 50px rgba(9, 29, 45, 0.28);
  opacity: 0.34;
  pointer-events: none;
  transform: translate(34%, 34%);
}

.studio-panel img {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  grid-column: 1 / -1;
  grid-row: 1;
}

.studio-copy {
  position: absolute;
  inset: auto auto clamp(128px, 17vw, 170px) 0;
  z-index: 2;
  display: block;
  width: min(760px, 100%);
  padding: clamp(28px, 5vw, 60px);
  color: var(--paper-strong);
  pointer-events: none;
}

.studio-copy::before {
  display: block;
  width: 78px;
  height: 5px;
  margin-bottom: 18px;
  border-radius: 999px;
  content: "";
  background: linear-gradient(90deg, var(--gold), var(--teal), var(--violet));
}

/* eyebrow 是每个区块上方的小标签文字。 */
.eyebrow {
  margin: 0 0 8px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

/* 防止长英文、链接或中英混排撑破容器。 */
h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(42px, 5.5vw, 70px);
  line-height: 1.03;
  letter-spacing: 0;
}

.studio-copy h1 {
  max-width: 100%;
  font-size: clamp(30px, 6.5vw, 76px);
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: normal;
}

h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

/* 主内容区：公开站点保持只读，只展示正式文章。 */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr;
  padding: 28px 0 54px;
}

/* 通用区块标题：左侧 eyebrow，右侧主标题。 */
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

/* 内容列：About、News、Notes、Life 从上到下排列。 */
.content-stack {
  display: grid;
  gap: 24px;
  width: min(100%, 980px);
  margin: 0 auto;
}

.recent-section,
.discovery-section,
.about-section,
.timeline-section,
.notes-section,
.video-section,
.archive-section {
  padding: 28px 0 6px;
  scroll-margin-top: 86px;
}

.about-section,
.timeline-section,
.notes-section,
.video-section,
.archive-section {
  content-visibility: auto;
  contain-intrinsic-size: 1px 640px;
}

.discovery-section {
  padding-top: 4px;
}

.discovery-section .section-heading {
  margin-bottom: 10px;
}

.discovery-section .section-heading h2 {
  font-size: clamp(22px, 4vw, 30px);
}

.recent-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.recent-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(84px, 0.34fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  overflow: hidden;
  border: 1px solid rgba(16, 35, 46, 0.12);
  border-radius: 14px;
  padding: 15px;
  background: rgba(255, 254, 253, 0.9);
  box-shadow: 0 12px 28px rgba(16, 35, 46, 0.07);
}

.recent-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
  content: "";
  background: linear-gradient(var(--gold), var(--teal), var(--violet));
}

.recent-card-meta {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.recent-card-meta span {
  width: fit-content;
  border-radius: 999px;
  background: rgba(20, 123, 145, 0.1);
  color: var(--teal-dark);
  padding: 5px 9px;
}

.recent-card-copy {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.recent-card h3,
.recent-card p {
  margin: 0;
}

.recent-card h3 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
}

.recent-card p {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.recent-card .published-badge {
  grid-column: 2;
  width: fit-content;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.2;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(16, 35, 46, 0.12);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 254, 253, 0.92);
  box-shadow: 0 12px 28px rgba(16, 35, 46, 0.07);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.search-field input {
  width: 100%;
  border: 1px solid rgba(16, 35, 46, 0.14);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(248, 251, 251, 0.86);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: 0;
}

.search-field input:focus {
  border-color: rgba(14, 78, 102, 0.42);
  box-shadow: 0 0 0 3px rgba(20, 123, 145, 0.1);
}

.clear-search-button {
  border: 1px solid rgba(20, 123, 145, 0.16);
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(255, 254, 253, 0.78);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.clear-search-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.filter-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
}

.search-results {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(16, 35, 46, 0.1);
  border-radius: 8px;
  padding: 8px;
  background: rgba(248, 251, 251, 0.72);
}

.search-results[hidden] {
  display: none;
}

.search-results a,
.search-results p {
  margin: 0;
}

.search-results a {
  display: grid;
  gap: 3px;
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  text-decoration: none;
}

.search-results a:hover,
.search-results a:focus-visible {
  background: rgba(20, 123, 145, 0.1);
  outline: 0;
}

.search-results span,
.search-results small,
.search-results p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.search-results strong {
  color: var(--teal-dark);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.search-results mark {
  border-radius: 4px;
  padding: 0 3px;
  background: rgba(202, 161, 76, 0.28);
  color: var(--ink);
}

.tag-filter {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 1px;
  scrollbar-width: none;
}

.tag-filter::-webkit-scrollbar {
  display: none;
}

.tag-filter button {
  flex: 0 0 auto;
  border: 1px solid rgba(16, 35, 46, 0.12);
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(248, 251, 251, 0.82);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.tag-filter button:hover,
.tag-filter button:focus-visible,
.tag-filter button.is-active {
  border-color: rgba(14, 78, 102, 0.36);
  background: rgba(20, 123, 145, 0.12);
  color: var(--teal-dark);
  outline: 0;
}

.note-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.note-category-tabs button {
  border: 1px solid rgba(16, 35, 46, 0.12);
  border-radius: 8px;
  padding: 8px 11px;
  background: rgba(255, 254, 253, 0.88);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.note-category-tabs button:hover,
.note-category-tabs button:focus-visible,
.note-category-tabs button.is-active {
  border-color: rgba(195, 93, 111, 0.34);
  background: rgba(195, 93, 111, 0.12);
  color: var(--coral);
  outline: 0;
}

/* About me 卡片。 */
.about-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  gap: 18px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(16, 35, 46, 0.12);
  border-radius: 14px;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(20, 123, 145, 0.12), transparent 48%),
    linear-gradient(315deg, rgba(103, 97, 168, 0.1), transparent 40%),
    rgba(255, 254, 253, 0.92);
  box-shadow: 0 12px 28px rgba(16, 35, 46, 0.07);
}

.about-panel::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
  content: "";
  background: linear-gradient(var(--gold), var(--teal), var(--violet));
}

/* About 文字和标签区；标签会在窄屏自动换行。 */
.about-copy {
  display: grid;
  gap: 12px;
}

.about-copy p {
  margin: 0;
  color: var(--muted);
}

.contact-copy {
  display: grid;
  gap: 4px;
  justify-items: start;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(20, 123, 145, 0.18);
  border-radius: 8px;
  padding: 9px 11px;
  background: rgba(255, 254, 253, 0.72);
  color: var(--teal-dark);
  font: inherit;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(16, 35, 46, 0.06);
}

.contact-copy:hover,
.contact-copy:focus-visible {
  border-color: rgba(14, 78, 102, 0.34);
  outline: 0;
}

.contact-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.about-tags {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  column-gap: 18px;
  row-gap: 9px;
}

.about-tags span {
  display: inline-flex;
  border-left: 2px solid rgba(20, 123, 145, 0.42);
  padding: 2px 0 2px 8px;
  background: transparent;
  color: var(--teal-dark);
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.25;
}

/* 内容卡片的通用外观：白底、细边框、轻阴影。 */
.timeline {
  display: grid;
  gap: 14px;
}

.timeline-item,
.note-card,
.video-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(16, 35, 46, 0.12);
  border-radius: 14px;
  background: rgba(255, 254, 253, 0.92);
  box-shadow: 0 12px 28px rgba(16, 35, 46, 0.07);
}

.post-card {
  color: var(--ink);
  text-decoration: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.post-card:hover,
.post-card:focus-visible {
  border-color: rgba(14, 78, 102, 0.34);
  box-shadow: 0 18px 36px rgba(16, 35, 46, 0.11);
  outline: 0;
  transform: translateY(-2px);
}

.timeline-item::before,
.note-card::before,
.video-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
  content: "";
  background: linear-gradient(var(--teal), var(--violet), var(--gold));
}

/* News 用时间线样式：左边日期，右边正文。 */
.timeline-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.date-pill {
  display: grid;
  align-content: start;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.tag {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: rgba(20, 123, 145, 0.12);
  color: var(--teal-dark);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

/* 文章正文区域，min-width: 0 可以避免网格里的长文本撑破布局。 */
.entry-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.entry-copy p,
.note-card p,
.video-card p {
  margin: 0;
  color: var(--muted);
}

.post-preview {
  display: -webkit-box;
  min-height: 3.4em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  line-height: 1.7;
}

/* Markdown 正式文章会被 app.js 转成 entry-body 里的 HTML。 */
.entry-body {
  display: grid;
  gap: 9px;
  min-width: 0;
  color: var(--muted);
}

.entry-body h4,
.entry-body h5,
.entry-body p,
.entry-body ul,
.entry-body ol,
.entry-body .math-display {
  min-width: 0;
  margin: 0;
}

.entry-body p,
.entry-body li {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.entry-body h4 {
  color: var(--ink);
  font-size: 15px;
}

.entry-body h5 {
  color: var(--ink);
  font-size: 14px;
}

.entry-body ul,
.entry-body ol {
  padding-left: 20px;
}

.entry-body .math-display {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  color: var(--ink);
  white-space: pre-wrap;
}

.entry-body mjx-container[jax="CHTML"],
.post-detail-body mjx-container[jax="CHTML"],
.entry-body .katex,
.post-detail-body .katex {
  max-width: 100%;
}

.entry-body mjx-container[jax="CHTML"][display="true"],
.post-detail-body mjx-container[jax="CHTML"][display="true"],
.entry-body .katex-display,
.post-detail-body .katex-display {
  max-width: 100%;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.entry-body a {
  color: var(--teal-dark);
  font-weight: 850;
}

.entry-body code {
  border-radius: 6px;
  padding: 0.12em 0.32em;
  background: rgba(20, 123, 145, 0.1);
  color: var(--teal-dark);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

.entry-body blockquote {
  margin: 0;
  border-left: 4px solid rgba(20, 123, 145, 0.34);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(20, 123, 145, 0.08);
  color: var(--muted);
}

.entry-body hr {
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(16, 35, 46, 0.12);
  margin: 6px 0;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(16, 35, 46, 0.1);
  border-radius: 8px;
  background: rgba(255, 254, 253, 0.72);
}

.entry-body table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 14px;
}

.entry-body th,
.entry-body td {
  border-bottom: 1px solid rgba(16, 35, 46, 0.1);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.entry-body th {
  color: var(--ink);
  font-weight: 950;
  background: rgba(20, 123, 145, 0.08);
}

.entry-body tr:last-child td {
  border-bottom: 0;
}

.entry-body h4,
.entry-body h5 {
  scroll-margin-top: 92px;
}

.heading-anchor {
  display: inline-flex;
  margin-left: 8px;
  color: rgba(20, 123, 145, 0.5);
  font-size: 0.78em;
  font-weight: 950;
  text-decoration: none;
  opacity: 0;
  transition:
    color 160ms ease,
    opacity 160ms ease;
}

.entry-body h4:hover .heading-anchor,
.entry-body h4:focus-within .heading-anchor,
.entry-body h5:hover .heading-anchor,
.entry-body h5:focus-within .heading-anchor {
  opacity: 1;
}

.heading-anchor:hover,
.heading-anchor:focus-visible {
  color: var(--teal-dark);
  outline: 0;
}

.entry-media {
  display: grid;
  gap: 6px;
  margin: 2px 0;
}

.entry-media img,
.entry-media video {
  display: block;
  width: 100%;
  max-height: 520px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(19, 33, 43, 0.08);
}

.entry-video video {
  aspect-ratio: 16 / 9;
}

.entry-media figcaption {
  color: var(--muted);
  font-size: 12px;
}

.entry-file {
  display: grid;
  gap: 10px;
  margin: 4px 0;
}

.download-button {
  display: inline-grid;
  gap: 3px;
  max-width: 100%;
  border: 1px solid rgba(20, 123, 145, 0.2);
  border-radius: 8px;
  padding: 11px 14px;
  background: linear-gradient(135deg, rgba(20, 123, 145, 0.12), rgba(255, 254, 253, 0.82));
  color: var(--teal-dark);
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(16, 35, 46, 0.07);
}

.download-button:hover,
.download-button:focus-visible {
  border-color: rgba(14, 78, 102, 0.36);
  outline: 0;
}

.download-button span {
  font-weight: 900;
}

.download-button small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.file-preview {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(16, 35, 46, 0.12);
  border-radius: 8px;
  background: rgba(248, 251, 251, 0.78);
}

.file-preview summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 900;
}

.file-preview pre,
.file-preview iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 0;
  border-top: 1px solid rgba(16, 35, 46, 0.1);
  margin: 0;
  background: #fffefd;
}

.file-preview pre {
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.file-preview code {
  white-space: inherit;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.file-preview iframe {
  height: min(70vh, 620px);
}

.note-grid,
.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* Notes 和 Life 在桌面端使用双列网格。 */
.note-card {
  display: grid;
  gap: 14px;
  min-height: 190px;
  padding: 20px;
}

/* 卡片标题区：Notes 和 Life 共用。 */
.note-card header,
.video-card header {
  display: grid;
  gap: 8px;
}

.note-card .tag {
  background: rgba(195, 93, 111, 0.14);
  color: var(--coral);
}

.video-card {
  overflow: hidden;
}

/* Life 视频区域：支持 iframe、video 或外链播放按钮。 */
.video-frame {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(90deg, #10232e 0 8%, #f8fbfb 8% 12%, #10232e 12% 18%, #f8fbfb 18% 25%, #10232e 25% 32%, #f8fbfb 32% 100%),
    radial-gradient(circle at 66% 30%, rgba(20, 123, 145, 0.5), transparent 28%),
    #10232e;
}

.video-frame iframe,
.video-frame video {
  width: 100%;
  height: 100%;
  border: 0;
  background: #111;
}

.video-frame-preview {
  overflow: hidden;
}

.video-preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-frame a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--paper-strong);
  color: var(--ink);
  text-decoration: none;
  font-size: 30px;
  font-weight: 900;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.2);
}

.life-post-mark {
  display: inline-grid;
  place-items: center;
  width: min(50%, 120px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 254, 253, 0.42);
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 32%, rgba(255, 254, 253, 0.75), transparent 8%),
    radial-gradient(circle at 64% 32%, rgba(255, 254, 253, 0.75), transparent 8%),
    linear-gradient(135deg, rgba(20, 123, 145, 0.42), rgba(103, 97, 168, 0.34));
  color: var(--paper-strong);
  font-weight: 900;
}

.video-body {
  display: grid;
  gap: 10px;
  padding: 18px;
}

/* 卡片底部：时间和发布状态。 */
.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.published-badge {
  border-radius: 999px;
  background: rgba(91, 121, 109, 0.14);
  color: var(--moss);
  padding: 5px 9px;
}

.author-chip {
  width: fit-content;
  border-radius: 999px;
  background: rgba(195, 93, 111, 0.12);
  color: var(--coral);
  padding: 5px 9px;
  font-weight: 900;
}

.archive-list {
  display: grid;
  gap: 16px;
}

.archive-group {
  display: grid;
  gap: 10px;
}

.archive-group h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.archive-items {
  display: grid;
  gap: 9px;
}

.archive-items a {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(16, 35, 46, 0.12);
  border-radius: 14px;
  padding: 13px 14px;
  background: rgba(255, 254, 253, 0.9);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(16, 35, 46, 0.06);
}

.archive-items a:hover,
.archive-items a:focus-visible {
  border-color: rgba(14, 78, 102, 0.34);
  outline: 0;
}

.archive-items span,
.archive-items small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.archive-items strong {
  overflow-wrap: anywhere;
}

.post-detail-section {
  padding: 24px 0 64px;
}

.post-detail-shell {
  display: grid;
  gap: 16px;
  width: min(100%, 1360px);
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 1px solid rgba(20, 123, 145, 0.16);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(255, 254, 253, 0.78);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
  border-color: rgba(14, 78, 102, 0.34);
  outline: 0;
}

.post-detail-card {
  position: relative;
  display: grid;
  gap: 18px;
  overflow: hidden;
  border: 1px solid rgba(16, 35, 46, 0.12);
  border-radius: 8px;
  padding: clamp(22px, 5vw, 44px);
  background: rgba(255, 254, 253, 0.94);
  box-shadow: 0 18px 42px rgba(16, 35, 46, 0.1);
}

.post-detail-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
  content: "";
  background: linear-gradient(var(--teal), var(--violet), var(--gold));
}

.post-detail-card h1 {
  max-width: 780px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.06;
}

.post-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.post-detail-meta span,
.post-detail-meta time {
  border-radius: 999px;
  background: rgba(20, 123, 145, 0.1);
  padding: 6px 10px;
}

.post-detail-meta .author-chip {
  background: rgba(195, 93, 111, 0.12);
  color: var(--coral);
}

.post-toc {
  position: relative;
  display: grid;
  gap: 8px;
  max-height: min(340px, 46vh);
  overflow: auto;
  border: 1px solid rgba(20, 123, 145, 0.12);
  border-radius: 18px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(20, 123, 145, 0.07), transparent 58%),
    rgba(248, 251, 251, 0.78);
  box-shadow: 0 14px 30px rgba(16, 35, 46, 0.07);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.post-toc[hidden] {
  display: none;
}

.post-toc strong {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
}

.post-toc div {
  display: grid;
  gap: 3px;
}

.post-toc a {
  position: relative;
  display: block;
  border-radius: 12px;
  padding: 6px 9px 6px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  line-height: 1.32;
  text-decoration: none;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.post-toc a:hover,
.post-toc a:focus-visible,
.post-toc a.is-active {
  background: rgba(20, 123, 145, 0.075);
  outline: 0;
}

.post-toc a.is-active {
  box-shadow: inset 3px 0 0 var(--teal);
  color: var(--ink);
}

.post-toc .toc-level-3 {
  color: var(--teal-dark);
  font-size: 12.5px;
  font-weight: 900;
}

.post-toc .toc-level-4 {
  margin-left: 7px;
  color: var(--ink);
  font-weight: 850;
}

.post-toc .toc-level-5 {
  margin-left: 16px;
  padding-left: 9px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 760;
}

.post-toc .toc-level-6 {
  margin-left: 26px;
  padding-left: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.post-detail-body {
  display: grid;
  gap: 18px;
}

.post-detail-body .entry-body {
  gap: 16px;
  font-size: 16px;
  line-height: 1.85;
}

.post-detail-body .entry-body h4 {
  margin-top: 8px;
  font-size: 22px;
}

.post-detail-body .entry-body h5 {
  margin-top: 4px;
  font-size: 18px;
}

.post-detail-body .entry-body h4,
.post-detail-body .entry-body h5 {
  scroll-margin-top: 92px;
}

.post-detail-body .entry-media {
  gap: 8px;
  margin: 4px 0 10px;
}

.post-detail-body .entry-media img,
.post-detail-body .entry-media video {
  max-height: 680px;
  object-fit: contain;
}

.entry-callout {
  --callout-accent: var(--teal);
  --callout-soft: rgba(20, 123, 145, 0.1);
  display: grid;
  gap: 8px;
  border: 1px solid rgba(20, 123, 145, 0.16);
  border-left: 4px solid var(--callout-accent);
  border-radius: 8px;
  padding: 13px 15px;
  background:
    linear-gradient(135deg, var(--callout-soft), transparent 62%),
    rgba(255, 254, 253, 0.82);
  color: var(--muted);
}

.entry-callout strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
}

.entry-callout p {
  margin: 0;
}

.entry-callout.callout-theorem,
.entry-callout.callout-definition,
.entry-callout.callout-lemma,
.entry-callout.callout-corollary {
  --callout-accent: var(--teal);
  --callout-soft: rgba(20, 123, 145, 0.12);
}

.entry-callout.callout-proof {
  --callout-accent: var(--moss);
  --callout-soft: rgba(91, 121, 109, 0.12);
}

.entry-callout.callout-example,
.entry-callout.callout-tip {
  --callout-accent: var(--gold);
  --callout-soft: rgba(202, 161, 76, 0.14);
}

.entry-callout.callout-warning,
.entry-callout.callout-important {
  --callout-accent: var(--coral);
  --callout-soft: rgba(195, 93, 111, 0.13);
}

@media (min-width: 960px) {
  .post-detail-card {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    overflow: visible;
  }

  .post-detail-card > .eyebrow,
  .post-detail-card > h1,
  .post-detail-card > .post-detail-meta {
    grid-column: 1 / -1;
  }

  .post-toc {
    position: fixed;
    top: max(118px, 22vh);
    right: 0;
    z-index: 920;
    grid-column: auto;
    grid-row: auto;
    width: min(280px, calc(100vw - 72px));
    max-height: min(58vh, 500px);
    overflow: visible;
    margin-right: 0;
    border-color: rgba(20, 123, 145, 0.16);
    border-radius: 18px 0 0 18px;
    padding: 11px 10px 11px 12px;
    background:
      linear-gradient(135deg, rgba(20, 123, 145, 0.08), transparent 58%),
      rgba(248, 251, 251, 0.78);
    box-shadow: 0 16px 38px rgba(16, 35, 46, 0.15);
    opacity: 0.5;
    transform: translateX(100%);
    transition:
      opacity 220ms ease,
      transform 260ms cubic-bezier(0.16, 1, 0.3, 1),
      box-shadow 260ms ease;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .post-toc::before {
    position: absolute;
    top: 50%;
    left: -22px;
    display: grid;
    width: 22px;
    height: 48px;
    place-items: center;
    border: 1px solid rgba(20, 123, 145, 0.14);
    border-right: 0;
    border-radius: 999px 0 0 999px;
    content: "";
    background: rgba(255, 254, 253, 0.6);
    color: var(--teal-dark);
    box-shadow: -6px 10px 20px rgba(16, 35, 46, 0.11);
    transform: translateY(-50%);
    transition: left 260ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .post-toc::after {
    position: absolute;
    top: 50%;
    left: -12px;
    width: 3px;
    height: 11px;
    border-radius: 999px;
    content: "";
    background: var(--teal-dark);
    opacity: 0.68;
    transform: translateY(-50%);
    transition: left 260ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .post-toc > strong,
  .post-toc > div {
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms ease;
  }

  .post-toc:hover,
  .post-toc:focus-within,
  .post-toc.is-open {
    background:
      linear-gradient(135deg, rgba(20, 123, 145, 0.07), transparent 58%),
      rgba(248, 251, 251, 0.98);
    opacity: 1;
    transform: translateX(0);
    box-shadow: 0 20px 48px rgba(16, 35, 46, 0.22);
    outline: 0;
  }

  .post-toc:hover > strong,
  .post-toc:hover > div,
  .post-toc:focus-within > strong,
  .post-toc:focus-within > div,
  .post-toc.is-open > strong,
  .post-toc.is-open > div {
    opacity: 1;
    pointer-events: auto;
  }

  .post-toc:hover::before,
  .post-toc:focus-within::before,
  .post-toc.is-open::before {
    opacity: 0;
  }

  .post-toc:hover::after,
  .post-toc:focus-within::after,
  .post-toc.is-open::after {
    opacity: 0;
  }

  .post-toc div {
    max-height: calc(min(58vh, 500px) - 48px);
    overflow: auto;
    padding-right: 4px;
  }

  :root[data-theme-state="ousia"] .post-toc::before {
    border-color: rgba(129, 218, 242, 0.14);
    border-right: 0;
    background: rgba(13, 27, 45, 0.62);
  }

  .post-detail-body {
    grid-column: 1 / -1;
    grid-row: 4;
    min-width: 0;
  }

  .post-detail-card:not(:has(.post-toc)) .post-detail-body,
  .post-toc[hidden] + .post-detail-body {
    grid-column: 1 / -1;
  }

  .post-neighbor-nav {
    grid-column: 1 / -1;
  }
}

.not-found-page {
  display: grid;
  place-items: center;
  min-height: 58vh;
  padding: 36px 0 64px;
}

.not-found-page .post-detail-card {
  width: min(100%, 720px);
}

.not-found-page p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-video-frame {
  overflow: hidden;
  border-radius: 8px;
  aspect-ratio: 16 / 9;
  background: #10232e;
}

.detail-video-frame iframe,
.detail-video-frame video {
  width: 100%;
  height: 100%;
  border: 0;
  background: #111;
}

.post-neighbor-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border-top: 1px solid rgba(16, 35, 46, 0.1);
  padding-top: 18px;
}

.post-jump-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid rgba(16, 35, 46, 0.08);
  padding-top: 12px;
}

.post-jump-nav button {
  border: 1px solid rgba(20, 123, 145, 0.16);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(248, 251, 251, 0.78);
  color: var(--teal-dark);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.post-jump-nav button:hover,
.post-jump-nav button:focus-visible {
  border-color: rgba(14, 78, 102, 0.36);
  outline: 0;
}

.post-neighbor-nav a {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(20, 123, 145, 0.16);
  border-radius: 8px;
  padding: 13px;
  background: rgba(248, 251, 251, 0.78);
  color: var(--ink);
  text-decoration: none;
}

.post-neighbor-nav a:hover,
.post-neighbor-nav a:focus-visible {
  border-color: rgba(14, 78, 102, 0.36);
  outline: 0;
}

.post-neighbor-nav span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.post-neighbor-nav strong {
  overflow-wrap: anywhere;
}

/* 没有内容时显示的占位状态。 */
.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  border: 1px dashed rgba(16, 35, 46, 0.24);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 254, 253, 0.5);
  text-align: center;
}

.empty-state span {
  display: block;
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--teal), var(--violet));
}

/* 右下角互动小人：fixed 表示永远固定在窗口右下角。 */
.mascot-widget {
  position: fixed;
  right: max(16px, calc((100vw - 1180px) / 2 - 72px));
  bottom: 18px;
  z-index: 10;
  display: grid;
  place-items: center;
  width: clamp(92px, 13vw, 142px);
  aspect-ratio: 0.56;
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 0;
  filter: drop-shadow(0 16px 26px rgba(16, 35, 46, 0.24));
  overflow: visible;
}

.mascot-widget::before {
  position: absolute;
  inset: 22% 18% 10%;
  z-index: 0;
  border-radius: 50%;
  content: "";
  background:
    radial-gradient(circle at 50% 45%, rgba(102, 213, 240, 0.28), transparent 48%),
    radial-gradient(circle at 50% 50%, rgba(166, 165, 245, 0.2), transparent 68%);
  opacity: 0;
  transform: scale(0.72);
  transition:
    opacity 520ms ease,
    transform 520ms ease;
  pointer-events: none;
}

.mascot-widget img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  transform-origin: 50% 92%;
  animation: mascot-float 4s ease-in-out infinite;
  transition:
    opacity 460ms ease,
    filter 760ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 760ms cubic-bezier(0.16, 1, 0.3, 1);
}

.mascot-widget .theme-asset-ghost {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  animation: mascot-wardrobe-ghost 760ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* 键盘聚焦或点击时切换成反馈动画，避免悬停时打扰阅读。 */
.mascot-widget:focus-visible img,
.mascot-widget.is-excited img {
  animation: mascot-pop 520ms ease both;
}

.mascot-widget.is-quick-tap img {
  animation: mascot-quick-tap 320ms ease both;
}

.mascot-widget.is-twirl img {
  animation: mascot-sway 720ms ease both;
}

.mascot-widget.is-bow img {
  animation: mascot-bow 680ms ease both;
}

.mascot-widget.is-wave img {
  animation: mascot-nod 720ms ease both;
}

.mascot-widget.is-curtain-call img {
  animation: mascot-encore 900ms ease both;
}

.mascot-widget:focus-visible {
  outline: 3px solid rgba(20, 123, 145, 0.34);
  outline-offset: 6px;
}

.mascot-bubble {
  position: absolute;
  z-index: 3;
  right: 58%;
  bottom: 80%;
  width: max-content;
  max-width: min(220px, calc(100vw - 156px));
  border: 1px solid rgba(20, 123, 145, 0.18);
  border-radius: 18px;
  padding: 8px 11px 9px;
  background:
    linear-gradient(135deg, rgba(255, 254, 253, 0.96), rgba(238, 249, 251, 0.9)),
    rgba(255, 254, 253, 0.92);
  color: var(--teal-dark);
  font-size: 12.5px;
  font-weight: 860;
  line-height: 1.32;
  opacity: 0;
  transform: translate(4px, 8px) scale(0.96);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  pointer-events: none;
  box-shadow: 0 12px 26px rgba(16, 35, 46, 0.12);
}

.mascot-bubble::after {
  position: absolute;
  right: 18px;
  bottom: -5px;
  width: 10px;
  aspect-ratio: 1;
  border-right: 1px solid rgba(20, 123, 145, 0.18);
  border-bottom: 1px solid rgba(20, 123, 145, 0.18);
  content: "";
  background: rgba(238, 249, 251, 0.92);
  transform: rotate(45deg);
}

.hello-burst {
  position: absolute;
  left: 8px;
  top: 7px;
  z-index: 4;
  width: 86px;
  height: 34px;
  pointer-events: none;
}

.hello-spark {
  position: absolute;
  left: 0;
  top: 0;
  border: 1px solid rgba(20, 123, 145, 0.28);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 254, 253, 0.96);
  color: var(--teal-dark);
  font-size: 15px;
  font-weight: 950;
  letter-spacing: 0;
  white-space: nowrap;
  opacity: 0;
  box-shadow: 0 16px 34px rgba(16, 35, 46, 0.18);
  animation: hello-float 1400ms cubic-bezier(0.16, 1, 0.3, 1) var(--delay) both;
}

/* 小人的气泡文案，默认隐藏，点击或键盘聚焦时显示。 */
.mascot-widget:focus-visible .mascot-bubble,
.mascot-widget.is-speaking .mascot-bubble {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* 点击小人时出现的水波反馈。 */
.mascot-widget::after {
  position: absolute;
  z-index: 2;
  inset: auto 16% 8% auto;
  width: 18px;
  aspect-ratio: 1;
  border-radius: 50%;
  content: "";
  background: rgba(20, 123, 145, 0.45);
  transform: scale(0);
  pointer-events: none;
}

.mascot-widget.is-excited::after {
  animation: ripple 620ms ease-out;
}

.mascot-widget.is-combo::before {
  opacity: 0.62;
  transform: scale(1);
}

.mascot-sparkle {
  position: absolute;
  z-index: 2;
  width: 8px;
  aspect-ratio: 1;
  border-radius: 999px;
  background: var(--gold);
  box-shadow:
    0 0 0 4px rgba(202, 161, 76, 0.14),
    0 0 16px rgba(102, 213, 240, 0.42);
  opacity: 0;
  pointer-events: none;
  animation: mascot-sparkle 820ms cubic-bezier(0.16, 1, 0.3, 1) var(--delay) both;
}

.mascot-widget.is-theme-striking {
  z-index: 1001;
}

.mascot-widget.is-theme-striking::before {
  inset: 16% 10% 1%;
  border-radius: 48% 48% 44% 44%;
  background:
    radial-gradient(circle at 52% 58%, rgba(111, 222, 248, 0.46), transparent 42%),
    radial-gradient(circle at 48% 42%, rgba(255, 244, 205, 0.28), transparent 24%);
  filter: blur(2px) saturate(1.02);
  animation: mascot-soft-aura 760ms ease both;
}

.mascot-widget.is-theme-striking::after {
  inset: 14% 5% 0%;
  z-index: 2;
  width: auto;
  height: auto;
  aspect-ratio: auto;
  border: 0;
  border-radius: 48%;
  background: linear-gradient(100deg, transparent 32%, rgba(255, 254, 253, 0.42) 48%, transparent 64%);
  box-shadow: none;
  opacity: 0;
  transform: translateX(-12%);
  animation: mascot-soft-sheen 760ms ease both;
}

.mascot-widget.is-theme-striking img {
  filter: drop-shadow(0 0 16px rgba(110, 218, 246, 0.38));
}

/* 动画定义区。 */
@keyframes mascot-float {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }

  50% {
    transform: translateY(-7px) rotate(1deg);
  }
}

@keyframes mascot-pop {
  0% {
    transform: translateY(0) scale(1) rotate(0);
  }

  38% {
    transform: translateY(-5px) scale(1.035) rotate(-1.5deg);
  }

  70% {
    transform: translateY(1px) scale(0.995) rotate(0.8deg);
  }

  100% {
    transform: translateY(0) scale(1) rotate(0);
  }
}

@keyframes mascot-quick-tap {
  0%,
  100% {
    transform: translateY(0) scale(1) rotate(0);
  }

  45% {
    transform: translateY(-2px) scale(1.018) rotate(-0.8deg);
  }
}

@keyframes mascot-sway {
  0% {
    transform: translateY(0) scale(1) rotate(0);
  }

  30% {
    transform: translateY(-4px) scale(1.025) rotate(-2.2deg);
  }

  62% {
    transform: translateY(-3px) scale(1.02) rotate(1.6deg);
  }

  100% {
    transform: translateY(0) scale(1) rotate(0);
  }
}

@keyframes mascot-encore {
  0%,
  100% {
    transform: translateY(0) scale(1) rotate(0);
  }

  26% {
    transform: translateY(-5px) scale(1.035) rotate(-2.8deg);
  }

  52% {
    transform: translateY(-6px) scale(1.035) rotate(2.4deg);
  }

  78% {
    transform: translateY(1px) scale(0.99) rotate(0);
  }
}

@keyframes mascot-bow {
  0%,
  100% {
    transform: translateY(0) scale(1) rotate(0);
  }

  45% {
    transform: translateY(2px) scale(0.982) rotate(1.4deg);
  }
}

@keyframes mascot-nod {
  0%,
  100% {
    transform: translateY(0) scale(1) rotate(0);
  }

  32% {
    transform: translateY(2px) scale(0.99) rotate(-1deg);
  }

  64% {
    transform: translateY(-4px) scale(1.02) rotate(1.2deg);
  }
}

@keyframes mascot-sparkle {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.3);
  }

  24% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(1.12);
  }
}

@keyframes mascot-soft-aura {
  0% {
    opacity: 0;
  }

  38% {
    opacity: 0.62;
  }

  100% {
    opacity: 0;
  }
}

@keyframes mascot-soft-sheen {
  0% {
    opacity: 0;
    transform: translateX(-14%);
  }

  42% {
    opacity: 0.48;
  }

  100% {
    opacity: 0;
    transform: translateX(14%);
  }
}

@keyframes mascot-wardrobe-ghost {
  0% {
    opacity: 1;
    filter: blur(0) saturate(1) brightness(1);
  }

  38% {
    opacity: 0.62;
    filter: blur(0.8px) saturate(1.04) brightness(1.05);
  }

  100% {
    opacity: 0;
    filter: blur(3px) saturate(0.82) brightness(1.08);
  }
}

@keyframes ripple {
  from {
    opacity: 0.55;
    transform: scale(0.2);
  }

  to {
    opacity: 0;
    transform: scale(5);
  }
}

@keyframes hello-float {
  0% {
    opacity: 0;
    transform: translate(4px, 4px) scale(0.72) rotate(-2deg);
  }

  18% {
    opacity: 1;
  }

  62% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(1.08) rotate(2deg);
  }
}

@keyframes avatar-bounce {
  0%,
  100% {
    transform: translate(-50%, -50%) translate(var(--brand-avatar-offset-x), var(--brand-avatar-offset-y)) translateY(0) scale(1);
  }

  45% {
    transform: translate(-50%, -50%) translate(var(--brand-avatar-offset-x), var(--brand-avatar-offset-y)) translateY(-3px) scale(1.08);
  }
}

/* 芒/荒主题切换：JS 只改 data-theme-state，视觉由 CSS 接管。 */
html.theme-transitioning body,
html.theme-transitioning .topbar,
html.theme-transitioning .topbar-actions,
html.theme-transitioning .nav-links,
html.theme-transitioning .theme-switcher,
html.theme-transitioning .theme-trigger,
html.theme-transitioning .theme-options,
html.theme-transitioning .studio-panel,
html.theme-transitioning .studio-panel::after,
html.theme-transitioning .studio-panel img,
html.theme-transitioning .site-footer,
html.theme-transitioning .search-panel,
html.theme-transitioning .about-panel,
html.theme-transitioning .post-card,
html.theme-transitioning .archive-items a,
html.theme-transitioning .post-detail-card,
html.theme-transitioning .post-toc,
html.theme-transitioning .back-link,
html.theme-transitioning .contact-copy,
html.theme-transitioning .mascot-widget,
html.theme-transitioning .brand-mark,
html.theme-transitioning .brand-mark::before,
html.theme-transitioning .brand-mark::after {
  transition:
    background 960ms cubic-bezier(0.16, 1, 0.3, 1),
    background-color 960ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 960ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 960ms cubic-bezier(0.16, 1, 0.3, 1),
    color 760ms ease,
    filter 1040ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 760ms ease,
    transform 1040ms cubic-bezier(0.16, 1, 0.3, 1);
}

html.theme-transitioning::before {
  position: fixed;
  inset: 0;
  z-index: 999;
  content: "";
  pointer-events: none;
  animation: theme-gradient-wash 1160ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

html.theme-transitioning::after {
  position: fixed;
  inset: -18%;
  z-index: 1000;
  content: "";
  pointer-events: none;
  opacity: 0;
  transform: translateX(-10%) rotate(-5deg);
  animation: theme-soft-sheen 1160ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

html.theme-enter-ousia::before {
  background:
    linear-gradient(135deg, rgba(246, 253, 255, 0.24), rgba(87, 193, 219, 0.22) 34%, rgba(9, 21, 35, 0.9) 100%),
    radial-gradient(circle at 72% 92%, rgba(102, 213, 240, 0.34), transparent 30%);
}

html.theme-enter-pneuma::before {
  background:
    linear-gradient(135deg, rgba(9, 21, 35, 0.22), rgba(126, 219, 236, 0.26) 38%, rgba(255, 254, 253, 0.88) 100%),
    radial-gradient(circle at 72% 92%, rgba(255, 232, 175, 0.34), transparent 30%);
}

html.theme-enter-ousia::after {
  background: linear-gradient(100deg, transparent 18%, rgba(132, 224, 247, 0.24) 44%, rgba(8, 18, 31, 0.18) 62%, transparent 82%);
}

html.theme-enter-pneuma::after {
  background: linear-gradient(100deg, transparent 18%, rgba(255, 254, 253, 0.4) 44%, rgba(115, 218, 237, 0.16) 62%, transparent 82%);
}

@keyframes theme-gradient-wash {
  0% {
    opacity: 0;
    transform: scale(1.02);
  }

  44% {
    opacity: 0.74;
  }

  100% {
    opacity: 0;
    transform: scale(1);
  }
}

@keyframes theme-soft-sheen {
  0% {
    opacity: 0;
    transform: translateX(-12%) rotate(-5deg);
  }

  36% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateX(12%) rotate(-5deg);
  }
}

:root[data-theme-state="ousia"] .topbar {
  border-bottom-color: rgba(129, 218, 242, 0.16);
  background: rgba(7, 18, 31, 0.78);
}

:root[data-theme-state="ousia"] .nav-links,
:root[data-theme-state="ousia"] .theme-trigger,
:root[data-theme-state="ousia"] .theme-options {
  border-color: rgba(129, 218, 242, 0.18);
  background: rgba(12, 26, 43, 0.72);
}

:root[data-theme-state="ousia"] .theme-options {
  background: rgba(12, 26, 43, 0.96);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.42);
}

:root[data-theme-state="ousia"] .theme-switcher button span,
:root[data-theme-state="ousia"] .tag-filter button,
:root[data-theme-state="ousia"] .note-category-tabs button {
  background: rgba(102, 213, 240, 0.1);
}

:root[data-theme-state="ousia"] .theme-trigger [data-theme-current-label] {
  background: transparent;
  color: inherit;
}

:root[data-theme-state="ousia"] .brand-mark {
  border-color: rgba(232, 246, 251, 0.34);
  background:
    radial-gradient(circle at 28% 22%, rgba(232, 246, 251, 0.18), transparent 28%),
    linear-gradient(135deg, #050a16, #26316f 58%, #6ed7f1);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(232, 246, 251, 0.14);
}

:root[data-theme-state="ousia"] .brand-mark::after {
  opacity: 0.46;
}

.brand-avatar.is-theme-asset-shell-swapping::before {
  opacity: 0.72;
  transform: translateY(2px) scale(0.96);
}

:root[data-theme-state="ousia"] .brand-avatar.is-theme-fallback::before {
  opacity: 0.95;
  transform: translateY(4px) scale(1.02);
}

:root[data-theme-state="ousia"] .brand-avatar img.is-theme-fallback {
  filter: brightness(0.74) saturate(0.72) hue-rotate(18deg) contrast(1.12);
}

.brand-avatar img[data-asset-state="pneuma"] {
  --brand-avatar-offset-x: 0px;
  --brand-avatar-offset-y: 0px;
}

.brand-avatar img[data-asset-state="ousia"] {
  --brand-avatar-offset-x: 0px;
  --brand-avatar-offset-y: -2px;
}

:root[data-theme-state="pneuma"] .brand-avatar img[data-asset-state="pneuma"] {
  filter: drop-shadow(0 7px 10px rgba(20, 123, 145, 0.2));
}

:root[data-theme-state="ousia"] .brand-avatar img[data-asset-state="ousia"] {
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.28));
}

:root[data-theme-state="ousia"] .mascot-widget {
  filter: drop-shadow(0 20px 34px rgba(0, 0, 0, 0.46));
}

:root[data-theme-state="ousia"] .mascot-widget::before {
  opacity: 1;
  transform: scale(1);
}

:root[data-theme-state="ousia"] .mascot-widget.is-theme-fallback::before {
  inset: 2% 17% -5%;
  border-radius: 48% 48% 42% 42%;
  background:
    radial-gradient(circle at 50% 10%, rgba(238, 249, 255, 0.28), transparent 18%),
    radial-gradient(circle at 52% 36%, rgba(48, 59, 134, 0.86), transparent 42%),
    linear-gradient(165deg, rgba(3, 8, 18, 0.96), rgba(14, 22, 57, 0.94) 58%, rgba(89, 212, 239, 0.38));
  box-shadow:
    0 28px 54px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(224, 246, 255, 0.16);
  opacity: 0.96;
  transform: translateY(7px) scale(1.04);
}

:root[data-theme-state="ousia"] .mascot-widget img.is-theme-fallback {
  filter: brightness(0.7) saturate(0.78) hue-rotate(18deg) contrast(1.15);
}

.brand-avatar img.is-theme-asset-swapping,
.mascot-widget img.is-theme-asset-swapping {
  opacity: 0;
  filter: blur(5px) saturate(0.78) brightness(0.92);
}

.brand-avatar img.is-theme-asset-swapping {
  opacity: 0.28;
  filter: blur(3px) saturate(1.08) brightness(1.12);
  transform: translate(-50%, -50%) translate(var(--brand-avatar-offset-x), var(--brand-avatar-offset-y)) scale(1);
}

.mascot-widget img.is-theme-asset-swapping {
  opacity: 0;
  filter: blur(4px) saturate(0.76) brightness(1.18) drop-shadow(0 0 12px rgba(110, 218, 246, 0.45));
}

.mascot-widget img.is-theme-asset-swapping.is-theme-asset-entering {
  opacity: 1;
  filter: blur(0) saturate(1) brightness(1) drop-shadow(0 0 8px rgba(110, 218, 246, 0.22));
}

:root[data-theme-state="ousia"] .studio-panel {
  background: #050a16;
}

:root[data-theme-state="ousia"] .studio-panel img {
  filter: brightness(0.9) saturate(0.92) hue-rotate(8deg);
}

:root[data-theme-state="ousia"] .studio-panel::after {
  background:
    linear-gradient(90deg, rgba(3, 8, 18, 0.86), rgba(8, 28, 48, 0.58) 48%, rgba(8, 16, 34, 0.14)),
    radial-gradient(circle at 40% 24%, rgba(102, 213, 240, 0.18), transparent 24%);
}

:root[data-theme-state="ousia"] .studio-copy {
  color: #f4fbff;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.38);
}

:root[data-theme-state="ousia"] .studio-copy h1 {
  color: #f7fcff;
}

:root[data-theme-state="ousia"] .studio-copy .eyebrow {
  color: #ffadc2;
}

:root[data-theme-state="ousia"] .studio-panel::before,
:root[data-theme-state="ousia"] .life-post-mark,
:root[data-theme-state="ousia"] .empty-state span {
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

:root[data-theme-state="ousia"] .site-footer,
:root[data-theme-state="ousia"] .search-panel,
:root[data-theme-state="ousia"] .about-panel,
:root[data-theme-state="ousia"] .post-card,
:root[data-theme-state="ousia"] .archive-items a,
:root[data-theme-state="ousia"] .post-detail-card,
:root[data-theme-state="ousia"] .back-link,
:root[data-theme-state="ousia"] .contact-copy,
:root[data-theme-state="ousia"] .post-neighbor-nav a,
:root[data-theme-state="ousia"] .empty-state {
  border-color: rgba(129, 218, 242, 0.18);
  background:
    linear-gradient(135deg, rgba(102, 213, 240, 0.08), transparent 52%),
    rgba(13, 27, 45, 0.88);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
}

:root[data-theme-state="ousia"] .about-tags span {
  border-left-color: rgba(129, 218, 242, 0.46);
  background: transparent;
  color: rgba(205, 245, 255, 0.86);
}

:root[data-theme-state="ousia"] .post-toc,
:root[data-theme-state="ousia"] .search-results,
:root[data-theme-state="ousia"] .search-field input,
:root[data-theme-state="ousia"] .file-preview,
:root[data-theme-state="ousia"] .file-preview pre,
:root[data-theme-state="ousia"] .entry-callout {
  border-color: rgba(129, 218, 242, 0.18);
  background:
    linear-gradient(135deg, rgba(102, 213, 240, 0.08), transparent 62%),
    rgba(8, 20, 34, 0.82);
}

:root[data-theme-state="ousia"] .post-toc:hover,
:root[data-theme-state="ousia"] .post-toc:focus-within,
:root[data-theme-state="ousia"] .post-toc.is-open {
  background:
    linear-gradient(135deg, rgba(102, 213, 240, 0.1), transparent 58%),
    rgba(8, 20, 34, 0.94);
}

:root[data-theme-state="ousia"] .entry-body code,
:root[data-theme-state="ousia"] .download-button,
:root[data-theme-state="ousia"] .clear-search-button {
  border-color: rgba(129, 218, 242, 0.2);
  background: rgba(102, 213, 240, 0.09);
}

:root[data-theme-state="ousia"] .topbar-search .search-panel {
  border-color: rgba(129, 218, 242, 0.16);
  background: rgba(13, 27, 45, 0.54);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 254, 253, 0.06);
}

:root[data-theme-state="ousia"] .topbar-search .search-field input {
  border: 0;
  background: transparent;
  color: #eefbff;
}

:root[data-theme-state="ousia"] .topbar-search .search-field input::placeholder {
  color: rgba(215, 245, 255, 0.62);
}

:root[data-theme-state="ousia"] .topbar-search .clear-search-button {
  border: 0;
  background: rgba(215, 245, 255, 0.12);
}

:root[data-theme-state="ousia"] .topbar-search .search-results {
  border-color: rgba(129, 218, 242, 0.16);
  background: rgba(13, 27, 45, 0.96);
}

:root[data-theme-state="ousia"] .entry-body blockquote {
  background: rgba(102, 213, 240, 0.08);
}

:root[data-theme-state="ousia"] .entry-body table {
  background: rgba(8, 20, 34, 0.72);
}

:root[data-theme-state="ousia"] .entry-body th,
:root[data-theme-state="ousia"] .entry-body td {
  border-color: rgba(129, 218, 242, 0.16);
}

:root[data-theme-state="ousia"] .entry-body th {
  background: rgba(102, 213, 240, 0.1);
}

:root[data-theme-state="ousia"] .post-detail-meta span,
:root[data-theme-state="ousia"] .post-detail-meta time,
:root[data-theme-state="ousia"] .author-chip,
:root[data-theme-state="ousia"] .published-badge {
  background: rgba(102, 213, 240, 0.11);
}

:root[data-theme-state="ousia"] .post-jump-nav button {
  border-color: rgba(129, 218, 242, 0.16);
  background: rgba(13, 27, 45, 0.62);
}

:root[data-theme-state="ousia"] .hello-spark {
  border-color: rgba(129, 218, 242, 0.2);
  background: rgba(13, 27, 45, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

:root[data-theme-state="ousia"] .mascot-bubble {
  border-color: rgba(129, 218, 242, 0.24);
  background:
    linear-gradient(135deg, rgba(17, 42, 66, 0.96), rgba(9, 23, 40, 0.92)),
    rgba(13, 27, 45, 0.94);
  color: rgba(219, 248, 255, 0.92);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
}

:root[data-theme-state="ousia"] .mascot-bubble::after {
  border-color: rgba(129, 218, 242, 0.24);
  background: rgba(9, 23, 40, 0.94);
}

/* 平板宽度：首屏变成单列。 */
@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .brand-cluster {
    flex: 1 1 100%;
  }

  .topbar-search.discovery-section {
    width: min(420px, 48vw);
    max-width: 420px;
  }

  .studio-panel {
    grid-template-columns: 1fr;
    min-height: clamp(300px, 58vw, 420px);
  }

  .studio-panel::after {
    background: linear-gradient(0deg, rgba(9, 29, 45, 0.94), rgba(14, 78, 102, 0.5), rgba(16, 35, 46, 0.12));
  }

  :root[data-theme-state="ousia"] .studio-panel::after {
    background: linear-gradient(0deg, rgba(3, 8, 18, 0.84), rgba(8, 28, 48, 0.5), rgba(8, 16, 34, 0.08));
  }

  .studio-copy {
    inset: auto 0 clamp(118px, 20vw, 164px);
    width: 100%;
    padding: clamp(28px, 6vw, 46px);
  }

  .studio-copy h1 {
    max-width: 100%;
    font-size: clamp(38px, 8vw, 58px);
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .recent-list {
    grid-template-columns: 1fr;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .filter-status {
    text-align: left;
  }
}

/* 手机宽度：导航、统计卡片和内容卡片都改成更窄的布局。 */
@media (max-width: 680px) {
  .site-shell {
    width: min(100% - 20px, 1180px);
  }

  html {
    scroll-padding-top: 190px;
  }

  .topbar {
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
    padding: 12px 0;
  }

  .brand-cluster {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }

  .topbar-search.discovery-section {
    flex-basis: 100%;
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .topbar-search .search-results {
    width: 100%;
  }

  .topbar-actions {
    width: 100%;
    align-items: center;
    gap: 8px;
  }

  .recent-section,
  .discovery-section,
  .about-section,
  .timeline-section,
  .notes-section,
  .video-section,
  .archive-section {
    scroll-margin-top: 190px;
  }

  .nav-links {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

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

  .nav-links a {
    flex: 1;
    min-width: fit-content;
    padding: 8px 9px;
    font-size: 12px;
    text-align: center;
  }

  .theme-switcher {
    width: auto;
  }

  .theme-trigger {
    width: 40px;
    min-width: 40px;
    height: 40px;
    justify-content: center;
    padding: 0;
  }

  .theme-trigger [data-theme-current-label] {
    display: none;
  }

  .theme-trigger .theme-trigger-icon {
    width: 20px;
    height: 20px;
  }

  .theme-switcher button {
    padding: 8px 10px;
  }

  .theme-options button {
    padding: 8px 10px;
  }

  .theme-options {
    left: auto;
    right: 0;
    min-width: 116px;
    transform-origin: 100% 0;
  }

  .studio-panel {
    aspect-ratio: 16 / 10.5;
    min-height: 0;
    border-radius: 18px;
  }

  .studio-copy {
    inset: auto 0 clamp(58px, 17vw, 82px);
    padding: 28px;
  }

  .studio-copy::before {
    width: 78px;
    height: 4px;
    margin-bottom: 14px;
  }

  .studio-copy .eyebrow {
    margin-bottom: 6px;
    font-size: 10px;
    line-height: 1.15;
  }

  .studio-copy h1 {
    font-size: clamp(29px, 9.6vw, 39px);
  }

  .search-panel {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 8px;
  }

  .search-field span,
  .filter-status {
    display: none;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .note-grid,
  .video-grid {
    grid-template-columns: 1fr;
  }

  .about-panel {
    grid-template-columns: 1fr;
  }

  .post-detail-section {
    padding-bottom: 42px;
  }

  .post-detail-card {
    gap: 14px;
    padding: 20px 18px 24px;
  }

  .post-detail-card h1 {
    font-size: clamp(27px, 10vw, 36px);
    overflow-wrap: anywhere;
  }

  .post-detail-body {
    gap: 14px;
    min-width: 0;
  }

  .post-detail-body .entry-body {
    gap: 13px;
    font-size: 15px;
    line-height: 1.78;
  }

  .post-detail-body .entry-body h4 {
    font-size: 19px;
  }

  .post-detail-body .entry-body h5 {
    font-size: 16px;
  }

  .heading-anchor {
    opacity: 1;
  }

  .post-toc {
    position: fixed;
    top: max(136px, 22vh);
    right: 0;
    z-index: 920;
    width: min(82vw, 330px);
    max-height: min(56vh, 420px);
    overflow: visible;
    border-radius: 18px 0 0 18px;
    padding: 11px 10px 11px 12px;
    background:
      linear-gradient(135deg, rgba(20, 123, 145, 0.08), transparent 58%),
      rgba(248, 251, 251, 0.78);
    box-shadow: 0 16px 38px rgba(16, 35, 46, 0.15);
    opacity: 0.5;
    transform: translateX(100%);
    transition:
      opacity 220ms ease,
      transform 260ms cubic-bezier(0.16, 1, 0.3, 1),
      box-shadow 260ms ease;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .post-toc::before {
    position: absolute;
    top: 50%;
    left: -22px;
    display: grid;
    width: 22px;
    height: 48px;
    place-items: center;
    border: 1px solid rgba(20, 123, 145, 0.14);
    border-right: 0;
    border-radius: 999px 0 0 999px;
    content: "";
    background: rgba(255, 254, 253, 0.56);
    color: var(--teal-dark);
    box-shadow: -6px 10px 20px rgba(16, 35, 46, 0.11);
    transform: translateY(-50%);
    transition: left 260ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .post-toc::after {
    position: absolute;
    top: 50%;
    left: -12px;
    width: 3px;
    height: 11px;
    border-radius: 999px;
    content: "";
    background: var(--teal-dark);
    opacity: 0.68;
    transform: translateY(-50%);
    transition: left 260ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .post-toc > strong,
  .post-toc > div {
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms ease;
  }

  .post-toc:hover,
  .post-toc:focus-within,
  .post-toc.is-open {
    background:
      linear-gradient(135deg, rgba(20, 123, 145, 0.07), transparent 58%),
      rgba(248, 251, 251, 0.98);
    opacity: 1;
    transform: translateX(0);
    box-shadow: 0 20px 48px rgba(16, 35, 46, 0.22);
    outline: 0;
  }

  .post-toc:hover > strong,
  .post-toc:hover > div,
  .post-toc:focus-within > strong,
  .post-toc:focus-within > div,
  .post-toc.is-open > strong,
  .post-toc.is-open > div {
    opacity: 1;
    pointer-events: auto;
  }

  .post-toc:hover::before,
  .post-toc:focus-within::before,
  .post-toc.is-open::before {
    opacity: 0;
  }

  .post-toc:hover::after,
  .post-toc:focus-within::after,
  .post-toc.is-open::after {
    opacity: 0;
  }

  .post-toc div {
    max-height: calc(min(56vh, 420px) - 48px);
    overflow: auto;
    padding-right: 4px;
  }

  :root[data-theme-state="ousia"] .post-toc {
    border-color: rgba(129, 218, 242, 0.2);
    background:
      linear-gradient(135deg, rgba(102, 213, 240, 0.12), transparent 56%),
      rgba(8, 20, 34, 0.82);
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.34);
  }

  :root[data-theme-state="ousia"] .post-toc:hover,
  :root[data-theme-state="ousia"] .post-toc:focus-within,
  :root[data-theme-state="ousia"] .post-toc.is-open {
    background:
      linear-gradient(135deg, rgba(102, 213, 240, 0.1), transparent 58%),
      rgba(8, 20, 34, 0.98);
  }

  :root[data-theme-state="ousia"] .post-toc::before {
    border-color: rgba(129, 218, 242, 0.14);
    border-right: 0;
    background: rgba(13, 27, 45, 0.62);
  }

  .file-preview pre {
    max-height: 58vh;
    padding: 12px;
    font-size: 11px;
    line-height: 1.6;
  }

  .file-preview iframe {
    height: min(62vh, 460px);
  }

  .archive-items a,
  .recent-card,
  .post-neighbor-nav {
    grid-template-columns: 1fr;
  }

  .recent-card .published-badge {
    grid-column: 1;
  }

  .mascot-widget {
    width: 56px;
    right: 10px;
    bottom: 10px;
    opacity: 0.84;
  }

  .post-detail-section ~ .mascot-widget,
  body:has(.post-detail-section:not([hidden])) .mascot-widget {
    width: 48px;
    opacity: 0.68;
  }

  .mascot-bubble {
    right: 54%;
    bottom: 82%;
    max-width: min(180px, calc(100vw - 96px));
    padding: 7px 9px 8px;
    font-size: 11.5px;
  }

  .hello-burst {
    left: 6px;
    top: 6px;
    width: 74px;
    height: 30px;
  }

  .hello-spark {
    padding: 5px 9px;
    font-size: 12px;
  }
}
