@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #ffffff;
  --fg: #111111;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #eaeaea;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-800: #262626;
  --gray-900: #171717;
  --accent: #0070f3;
  --accent-light: rgba(0, 112, 243, 0.1);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, Menlo, monospace;
  /* 页面环境色 — JS 根据天空动态更新 */
  --page-ambient: #f3f5f9;
}

/* ====== Reset ====== */
* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow-y: scroll;
  -webkit-tap-highlight-color: transparent;
}

/* 全局禁用移动端点击蓝色高亮 + 焦点环 */
html, body, a, button, [role="button"], input, textarea, select {
  -webkit-tap-highlight-color: transparent;
}

:focus {
  outline: none;
}
:focus-visible {
  outline: none;
}

body {
  margin: 0;
  padding: 0;
  background: var(--page-ambient, #f3f5f9);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  font-size: 15px;
}

/* ====== Layout: mobile-first (single column) ====== */
.app-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ====== Sidebar ====== */
.sidebar {
  width: 100%;
  flex-shrink: 0;
  position: static;
}

.profile {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.avatar-wrap {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  line-height: 0;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--sky-top, #87CEEB);
  display: block;
  transition: border-color 1s ease;
}

/* 头像环日月点：SVG */
.avatar-celestial {
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 2;
  transition: none;
  overflow: visible;
}

.author-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--gray-900);
}

.author-bio {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin: 0;
  line-height: 1.45;
  overflow-wrap: break-word;
  word-break: break-word;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--gray-500);
  text-decoration: none;
  font-weight: 500;
}

.social-links a:hover {
  color: var(--fg);
}

.social-links svg {
  width: 14px;
  height: 14px;
}

/* keep backwards compat with class-based links */
.social-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--gray-500);
  text-decoration: none;
  transition: color 0.2s, transform 0.15s ease;
}

.social-link:hover {
  color: var(--fg);
}

.social-link:active {
  transform: scale(0.92);
}

/* ====== Main Content ====== */
.main-content {
  flex: 1;
  min-width: 0;
  width: 100%;
}

/* ====== Nav Tabs ====== */
.nav-tabs {
  display: flex;
  gap: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--page-accent, var(--gray-200));
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.tab-btn {
  background: none;
  border: none;
  padding: 0 0 10px 0;
  font-size: 0.95rem;
  color: var(--gray-500);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  font-family: inherit;
  flex-shrink: 0;
  transition: transform 0.15s ease;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

.tab-btn:hover {
  color: var(--gray-900);
}

.tab-btn:active {
  transform: scale(0.92);
}

.tab-btn.active {
  color: var(--gray-900);
  font-weight: 600;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--page-accent, var(--gray-400));
}

/* ====== Post List ====== */
.post-list {
  display: flex;
  flex-direction: column;
}

.post-item {
  padding: 20px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(0,0,0,0.06);
  display: block;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  opacity: 0;
}

.post-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
  border-color: var(--page-accent, var(--gray-300));
}

.post-item:active {
  transform: translateY(-2px) scale(0.97);
}

.post-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
  color: var(--gray-900);
  line-height: 1.3;
  word-break: break-word;
}

.post-excerpt {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin: 0 0 14px 0;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--gray-400);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-item svg {
  color: var(--gray-400);
  width: 13px;
  height: 13px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: rgba(0,0,0,0.04);
  color: var(--gray-600);
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid rgba(0,0,0,0.05);
}

/* ====== Page Transition ====== */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-transition {
  animation: fadeSlideUp 0.5s ease forwards;
}

/* ====== Collections ====== */
.collection-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 28px 0 16px 0;
  color: var(--gray-900);
  font-size: 1.05rem;
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--page-accent, var(--gray-200));
  opacity: 0;
}

.collection-header:first-child {
  margin-top: 0;
}

.collection-header svg {
  color: var(--gray-600);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.collection-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 32px;
  padding-left: 14px;
  border-left: 2px solid var(--page-accent, var(--gray-100));
}

.collection-list .post-item {
  margin-bottom: 0;
}

/* ====== Footer ====== */
.footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--page-accent, var(--gray-200));
  color: var(--gray-400);
  font-size: 0.8rem;
}

/* ====== 有顶部进度条的页面 ====== */
.app-wrapper.has-header {
  padding-top: 64px;
}

/* ====== 固定返回按钮（文章页左上角） ====== */
/* ====== 返回按钮（header内左上角） ====== */
.back-btn-fixed {
  display: none;  /* 移动端隐藏 */
}

.back-btn-fixed:hover {
  background: rgba(255,255,255,0.4);
}

.back-btn-label {
  display: none;
}

/* ====== 纯净阅读按钮 ====== */
.pure-toggle {
  position: fixed;
  top: 8px;
  right: 12px;
  z-index: 1100;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.15);
  color: var(--gray-700);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.15s ease;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

body:not(.pure-reading) .pure-toggle {
  display: inline-flex !important;
}

.pure-toggle:hover {
  box-shadow: 0 3px 12px rgba(0,0,0,0.2);
}

.pure-toggle:active {
  transform: scale(0.88);
}

.pure-toggle.active {
  background: var(--gray-900);
  color: #ffffff;
  border-color: var(--gray-900);
}

.pure-toggle-label {
  display: none;
}

/* ====== 纯净阅读模式 ====== */
body.pure-reading .pure-toggle {
  display: inline-flex !important;
  background: var(--gray-900);
  color: #ffffff;
  border-color: var(--gray-900);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

body.pure-reading .scroll-header {
  display: none;
}

body.pure-reading {
  --page-ambient: #ffffff !important;
  --page-accent: #eaeaea !important;
  background: #ffffff;
}

body.pure-reading .post-item {
  background: #ffffff;
  border-color: var(--gray-200);
}

body.pure-reading .profile-clock {
  border-color: var(--gray-200);
}

body.pure-reading .sun-container,
body.pure-reading .moon-container,
body.pure-reading .stars-layer,
body.pure-reading .scroll-water,
body.pure-reading .scroll-boat-horizontal,
body.pure-reading .water-splash {
  display: none;
}

@media (min-width: 768px) {
  .back-btn-fixed {
    display: inline-flex;
    position: absolute;
    top: 10px;
    right: auto;
    left: 120px;
    width: auto;
    height: auto;
    padding: 4px 14px;
    border-radius: 14px;
    font-size: 0.82rem;
    background: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    align-items: center;
    gap: 4px;
    z-index: 20;
    transition: transform 0.15s ease;
  }
  .back-btn-fixed:active {
    transform: scale(0.9);
  }
  .back-btn-label {
    display: inline;
  }
  .pure-toggle {
    top: 70px;
    right: 24px;
    width: auto;
    height: auto;
    padding: 7px 16px;
    border-radius: 18px;
    font-size: 0.85rem;
  }
  .pure-toggle.active {
    background: var(--gray-900);
    color: #ffffff;
  }
  .pure-toggle-label {
    display: inline;
  }
}

/* 旧的 back-btn 保留兼容 */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-500);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 28px;
  transition: color 0.2s, transform 0.15s ease;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

.back-btn:hover {
  color: var(--gray-900);
}

.back-btn:active {
  transform: scale(0.9);
}

.article-header {
  margin-bottom: 32px;
}

.article-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--gray-900);
  word-break: break-word;
}

.article-header .post-meta {
  font-size: 0.82rem;
  color: var(--gray-500);
}

/* ====== Markdown Content ====== */
.markdown-body {
  font-size: 0.95rem;
  line-height: 1.8;
  color: #333333;
  word-break: break-word;
  overflow-wrap: break-word;
}

.markdown-body h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 2em 0 0.8em;
  letter-spacing: -0.01em;
  color: var(--gray-900);
  border-bottom: 1px solid var(--page-accent, var(--gray-200));
  padding-bottom: 0.3em;
}

.markdown-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.8em 0 0.6em;
  color: var(--gray-900);
}

.markdown-body p {
  margin-bottom: 1.2em;
}

.markdown-body ul,
.markdown-body ol {
  margin-bottom: 1.2em;
  padding-left: 1.2em;
}

.markdown-body li {
  margin-bottom: 0.4em;
}

.markdown-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.markdown-body a:hover {
  border-bottom-color: var(--accent);
}

/* ====== Table: horizontal scroll on mobile ====== */
.markdown-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.85rem;
}

.markdown-body table thead {
  display: table-header-group;
}

.markdown-body table tr {
  display: table-row;
}

.markdown-body th,
.markdown-body td {
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  text-align: left;
  white-space: nowrap;
}

.markdown-body th {
  background: rgba(0,0,0,0.02);
  font-weight: 600;
}

/* ====== Code Blocks ====== */
.markdown-body pre {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5em 0;
  font-size: 0.8rem;
  line-height: 1.6;
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.markdown-body p code,
.markdown-body li code {
  background: var(--gray-100);
  color: #d63384;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
  border: 1px solid var(--gray-200);
  word-break: break-all;
}

.markdown-body pre code {
  color: #f5f5f5;
  background: transparent;
  padding: 0;
  border: none;
  white-space: pre;
}

/* ====== Blockquote ====== */
.markdown-body blockquote {
  background: rgba(0,0,0,0.02);
  border-left: 3px solid var(--page-accent, var(--accent));
  margin: 1.5em 0;
  padding: 12px 16px;
  color: var(--gray-600);
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
}

.markdown-body blockquote p:last-child {
  margin-bottom: 0;
}

/* ====== Images ====== */
.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  margin: 2em auto;
  display: block;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.markdown-body img:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
  transform: scale(1.01);
}

/* 图片横排容器 — JS 自动包裹连续两张图片 */
.image-row {
  display: flex;
  gap: 16px;
  margin: 2em 0;
  align-items: flex-start;
}

.image-row img {
  flex: 1;
  min-width: 0;
  margin: 0;
}

/* 单张居中：普通图片不撑满全宽，保持视觉轻盈 */
.markdown-body img:not(.image-row img) {
  max-width: min(100%, 680px);
}

/* 手机上图片横排改回竖排 */
@media (max-width: 767px) {
  .image-row {
    flex-direction: column;
    gap: 12px;
  }
  .markdown-body img:not(.image-row img) {
    max-width: 100%;
  }
}

/* ====== Horizontal Rule ====== */
.markdown-body hr {
  border: none;
  border-top: 1px solid var(--page-accent, var(--gray-200));
  margin: 2em 0;
}

/* ====== Scroll Header (post page) ====== */
.scroll-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 52px;
  /* 天空色自然消融到底部：上 60% 纯天空，下 40% 渐变到白 */
  background: linear-gradient(
    to bottom,
    var(--sky-top, #e8f4f8) 0%,
    var(--sky-top, #e8f4f8) 58%,
    rgba(255,255,255,0.85) 100%
  );
  z-index: 1000;
  overflow: hidden;
}

/* 左上角时间 + 日期 */
.header-time {
  position: absolute;
  top: 4px;
  left: 12px;
  z-index: 10;
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 3px rgba(0,0,0,0.25);
  pointer-events: none;
}

.header-date {
  position: absolute;
  top: 22px;
  left: 12px;
  z-index: 10;
  font-size: 0.65rem;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  pointer-events: none;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .header-time {
    top: 4px;
    left: 16px;
    font-size: 0.9rem;
  }
  .header-date {
    top: 24px;
    left: 16px;
    font-size: 0.7rem;
  }
}

/* 天空画布 — 容纳日月星辰 */
.sky-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* ---- 太阳 ---- */
.sun-container {
  position: absolute;
  width: 22px; height: 22px;
  left: 10%;
  top: 14px;
  opacity: 0;
  transition: opacity 0.8s ease;
  will-change: left, top, opacity;
  filter: blur(0.5px);
}

.sun-core {
  width: 22px; height: 22px;
  background: radial-gradient(circle at 40% 40%, #fffde7, #fbbf24);
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.55), 0 0 32px rgba(251, 180, 36, 0.25);
}

/* ---- 月亮 ---- */
.moon-container {
  position: absolute;
  width: 18px; height: 18px;
  right: 8%;
  top: 10px;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.moon-lit {
  fill: #fef9c3;
  filter: drop-shadow(0 0 3px rgba(254, 249, 195, 0.5));
}

/* ---- 星星 ---- */
.stars-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 80%;
  opacity: 0;
  transition: opacity 1s ease;
  pointer-events: none;
}

.star {
  position: absolute;
  width: 2px; height: 2px;
  background: #ffffff;
  border-radius: 50%;
  animation: twinkle var(--twinkle-dur, 2.5s) ease-in-out infinite;
  animation-delay: var(--twinkle-delay, 0s);
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ---- 水波 ---- */
.scroll-water {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 6'%3E%3Cpath d='M0 3 Q15 0 30 3 Q45 6 60 3 Q75 0 90 3 Q105 6 120 3' fill='none' stroke='rgba(56,189,248,0.25)' stroke-width='1.2'/%3E%3Cpath d='M0 4.5 Q20 1.5 40 4.5 Q60 7.5 80 4.5 Q100 1.5 120 4.5' fill='none' stroke='rgba(56,189,248,0.12)' stroke-width='0.8'/%3E%3C/svg%3E");
  background-size: 120px 6px;
  background-repeat: repeat-x;
  animation: wave-flow 16s ease-in-out infinite;
}

@keyframes wave-flow {
  0%   { background-position: 0 0;   transform: translateY(0); }
  20%  { transform: translateY(-0.6px); }
  40%  { background-position: -48px 0; transform: translateY(0); }
  60%  { transform: translateY(0.6px); }
  80%  { background-position: -96px 0; transform: translateY(0); }
  100% { background-position: -120px 0; transform: translateY(0); }
}

/* 水花飞溅粒子 */
.water-splash {
  position: absolute;
  bottom: 4px;
  width: 2px;
  height: 2px;
  background: rgba(56,189,248,0.5);
  border-radius: 50%;
  pointer-events: none;
  animation: splash-up 1s ease-out forwards;
}

@keyframes splash-up {
  0%   { transform: translateY(0) scale(1); opacity: 0.6; }
  100% { transform: translateY(-12px) scale(0); opacity: 0; }
}

.scroll-boat-horizontal {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 22px;
  height: 22px;
  color: var(--gray-800);
  transform: translateX(-50%);
  transition: left 0.1s linear;
  will-change: left;
  animation: bob 4s ease-in-out infinite;
}

@keyframes bob {
  0% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-3px); }
  100% { transform: translateX(-50%) translateY(0); }
}

/* ====== Downloads Page ====== */
.download-section {
  margin-bottom: 40px;
}

.download-section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 8px;
}

.download-section-title svg {
  color: var(--gray-500);
  flex-shrink: 0;
}

.subcategory-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-600);
  margin: 20px 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subcategory-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 12px;
  background: var(--gray-300);
  border-radius: 2px;
  flex-shrink: 0;
}

.downloads-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.download-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--bg);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

.download-card:hover {
  border-color: var(--gray-300);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.download-card:active {
  transform: scale(0.97);
}

.download-info h3 {
  margin: 0 0 6px 0;
  font-size: 1rem;
  color: var(--gray-900);
}

.download-info p {
  margin: 0;
  color: var(--gray-500);
  font-size: 0.82rem;
  line-height: 1.5;
}

.download-btn {
  display: inline-block;
  padding: 8px 18px;
  background: var(--gray-900);
  color: var(--bg);
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  text-align: center;
  align-self: flex-start;
  transition: transform 0.15s ease, background 0.2s;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

.download-btn:hover {
  background: var(--gray-800);
}

.download-btn:active {
  transform: scale(0.93);
}

/* ====== Desktop (>= 768px) ====== */
@media (min-width: 768px) {
  body {
    font-size: 16px;
  }

  .app-wrapper {
    flex-direction: row;
    padding: 60px 32px;
    gap: 64px;
  }

  .sidebar {
    width: 220px;
    position: sticky;
    top: 60px;
    flex-shrink: 0;
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin: 0;
  }

  .profile {
    flex-direction: column;
    gap: 18px;
  }

  .profile-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .avatar {
    width: 100px;
    height: 100px;
  }

  .avatar-celestial {
    width: 18px;
    height: 18px;
  }

  .author-name {
    font-size: 1.3rem;
  }

  .author-bio {
    font-size: 0.85rem;
  }

  .social-links {
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
  }

  .social-links a {
    font-size: 0.82rem;
  }

  .main-content {
    max-width: 750px;
  }

  .post-item {
    padding: 28px;
    margin-bottom: 20px;
    border-radius: 18px;
  }

  .post-title {
    font-size: 1.35rem;
  }

  .post-excerpt {
    font-size: 1rem;
  }

  .post-meta {
    font-size: 0.82rem;
    gap: 14px;
  }

  .tag {
    font-size: 0.73rem;
  }

  .nav-tabs {
    gap: 28px;
    margin-bottom: 36px;
  }

  .tab-btn {
    font-size: 1rem;
  }

  .collection-header {
    font-size: 1.15rem;
    margin: 32px 0 20px 0;
  }

  .collection-list {
    padding-left: 18px;
    gap: 16px;
  }

  .article-header h1 {
    font-size: 2.2rem;
  }

  .markdown-body {
    font-size: 1.05rem;
  }

  .markdown-body h2 {
    font-size: 1.6rem;
  }

  .markdown-body h3 {
    font-size: 1.25rem;
  }

  .markdown-body pre {
    padding: 18px 22px;
    font-size: 0.85rem;
    border-radius: 10px;
  }

  .markdown-body table {
    font-size: 0.9rem;
  }

  .markdown-body th,
  .markdown-body td {
    padding: 10px 16px;
  }

  .scroll-header {
    height: 60px;
  }

  .sun-container {
    width: 26px; height: 26px;
  }

  .sun-core {
    width: 26px; height: 26px;
    box-shadow: 0 0 18px rgba(251, 191, 36, 0.55), 0 0 40px rgba(251, 180, 36, 0.25);
  }

  .moon-container {
    width: 22px; height: 22px;
    top: 12px;
  }

  .scroll-boat-horizontal {
    width: 26px;
    height: 26px;
  }

  .app-wrapper.has-header {
    padding-top: 80px;
  }

  .download-card {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 22px;
  }

  .download-btn {
    align-self: center;
    flex-shrink: 0;
  }

  .footer {
    margin-top: 64px;
  }
}

/* ====== Large Desktop (>= 1024px) ====== */
@media (min-width: 1024px) {
  .app-wrapper {
    padding: 80px 32px;
    gap: 80px;
  }

  .sidebar {
    width: 240px;
  }

  .main-content {
    max-width: 850px;
  }

  .article-header h1 {
    font-size: 2.5rem;
  }

  .markdown-body {
    font-size: 1.125rem;
  }
}

/* ====== 回到顶部按钮 ====== */
.back-to-top {
  position: fixed;
  bottom: 36px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--gray-200);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 1001;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
  -webkit-appearance: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  color: var(--gray-900);
  border-color: var(--gray-300);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.back-to-top:active {
  transform: scale(0.88);
}

.back-to-top:focus,
.back-to-top:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.92);
}

@media (min-width: 768px) {
  .back-to-top {
    bottom: 40px;
    right: 32px;
    width: 48px;
    height: 48px;
  }
}

/* ====== 所有可点击元素以中心缩放 ====== */
.social-link,
.tab-btn,
.post-item,
.back-btn-fixed,
.back-btn,
.pure-toggle,
.download-card,
.download-btn,
.back-to-top {
  transform-origin: center;
}
