/* ===== Material Design 3 Theme ===== */
:root {
  --md-source: #6750a4;
  /* Light theme */
  --md-ref-primary: #6750a4;
  --md-ref-on-primary: #ffffff;
  --md-ref-primary-container: #eadfff;
  --md-ref-on-primary-container: #21005d;
  --md-ref-secondary: #625b71;
  --md-ref-on-secondary: #ffffff;
  --md-ref-secondary-container: #e8def8;
  --md-ref-on-secondary-container: #1d192b;
  --md-ref-surface: #fffbfe;
  --md-ref-on-surface: #1c1b1f;
  --md-ref-surface-variant: #e7e0ec;
  --md-ref-on-surface-variant: #49454f;
  --md-ref-outline: #79747e;
  --md-ref-outline-variant: #cac4d0;
  --md-ref-error: #b3261e;
  --md-ref-on-error: #ffffff;
  --md-ref-background: #fffbfe;
  --md-ref-on-background: #1c1b1f;
  --md-ref-surface-container-low: #f7f2fa;
  --md-ref-surface-container: #f3edf7;
  --md-ref-surface-container-high: #ece6f0;
  --md-ref-inverse-surface: #313033;
  --md-ref-inverse-on-surface: #f4eff4;
  --md-shadow: rgba(0,0,0,0.12);
  --md-card-bg: #fffbfe;
}

[data-theme="dark"] {
  --md-ref-primary: #d0bcff;
  --md-ref-on-primary: #381e72;
  --md-ref-primary-container: #4f378b;
  --md-ref-on-primary-container: #eadfff;
  --md-ref-secondary: #ccc2dc;
  --md-ref-on-secondary: #332d41;
  --md-ref-secondary-container: #4a4458;
  --md-ref-on-secondary-container: #e8def8;
  --md-ref-surface: #1c1b1f;
  --md-ref-on-surface: #e6e1e5;
  --md-ref-surface-variant: #49454f;
  --md-ref-on-surface-variant: #cac4d0;
  --md-ref-outline: #938f99;
  --md-ref-outline-variant: #49454f;
  --md-ref-error: #f2b8b5;
  --md-ref-on-error: #601410;
  --md-ref-background: #1c1b1f;
  --md-ref-on-background: #e6e1e5;
  --md-ref-surface-container-low: #211f26;
  --md-ref-surface-container: #25232a;
  --md-ref-surface-container-high: #2b2930;
  --md-ref-inverse-surface: #e6e1e5;
  --md-ref-inverse-on-surface: #313033;
  --md-shadow: rgba(0,0,0,0.32);
  --md-card-bg: #25232a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html { scroll-behavior: smooth; }

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

body {
  font-family: 'Segoe UI', 'Roboto', system-ui, -apple-system, sans-serif;
  background: var(--md-ref-background);
  color: var(--md-ref-on-background);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  animation: pageFadeIn 0.25s ease;
}

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

main.page, .page, .admin-main, .login-page, .register-page, .setup-page, .embed-page, .forum-content, .blog-article, .settings-section {
  animation: contentFadeIn 0.3s ease;
}

@keyframes contentFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--md-ref-outline-variant);
  border-radius: 3px;
}

/* ===== Top App Bar ===== */
.app-bar {
  background: var(--md-ref-surface-container);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--md-ref-outline-variant);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-bar .title {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.5px;
  flex: 1;
}

.app-bar .actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.app-bar .admin-badge {
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
}

/* ===== Buttons ===== */
button, .btn {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;
  border-radius: 100px;
  padding: 0 24px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
  user-select: none;
  position: relative;
  overflow: hidden;
}

/* Ripple effect */
button::after, .btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.3) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

button:active::after, .btn:active::after {
  opacity: 1;
  transition: opacity 0s;
}

/* Button scale on tap */
button:active, .btn:active {
  transform: scale(0.96);
}

.btn-filled:active, .btn-tonal:active, .btn-outline:active, .btn-text:active {
  filter: brightness(0.9);
}

/* 键盘焦点可见（B1）：所有可交互元素 focus-visible 时显示焦点环，补偿上方 outline: none */
button:focus-visible, .btn:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--md-ref-primary);
  outline-offset: 2px;
  border-radius: 100px;
}

/* 屏幕阅读器专用（B6）：只读不出、不占布局的辅助标题 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  margin: -1px;
  padding: 0;
  border: 0;
}

.btn-filled {
  background: var(--md-ref-primary);
  color: var(--md-ref-on-primary);
  box-shadow: 0 1px 3px var(--md-shadow);
}
.btn-filled:hover {
  box-shadow: 0 2px 6px var(--md-shadow);
  filter: brightness(1.05);
}

.btn-tonal {
  background: var(--md-ref-secondary-container);
  color: var(--md-ref-on-secondary-container);
}
.btn-tonal:hover {
  filter: brightness(0.95);
}

.btn-outline {
  background: transparent;
  color: var(--md-ref-primary);
  border: 1px solid var(--md-ref-outline);
}
.btn-outline:hover {
  background: var(--md-ref-primary-container);
  border-color: var(--md-ref-primary);
}

.btn-text {
  background: transparent;
  color: var(--md-ref-primary);
  padding: 0 12px;
}
.btn-text:hover {
  background: var(--md-ref-primary-container);
}

/* Material Icons - 自托管（本地 @font-face，替代 Google Fonts，国内访问稳定） */
@font-face {
  font-family: 'Material Icons';
  src: url('/fonts/MaterialIcons-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Material Icons - ensure perfect centering */
.material-icons {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'liga';
  vertical-align: middle;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--md-ref-on-surface-variant);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background: var(--md-ref-surface-variant);
}

.btn-sm {
  height: 32px;
  padding: 0 16px;
  font-size: 13px;
}

.btn-danger {
  background: var(--md-ref-error);
  color: var(--md-ref-on-error);
}

/* ===== Cards ===== */
.card {
  background: var(--md-card-bg);
  border-radius: 16px;
  border: 1px solid var(--md-ref-outline-variant);
  padding: 24px;
  transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.card-hover:hover {
  border-color: var(--md-ref-primary);
  box-shadow: 0 4px 16px var(--md-shadow);
  transform: translateY(-2px);
}

.card-hover:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px var(--md-shadow);
}

/* Staggered card animation */
.blog-waterfall .blog-card, .forum-post-card, .password-card, .admin-panels .panel-card, .blog-grid .blog-card {
  animation: cardSlideUp 0.35s ease backwards;
}

.blog-waterfall .blog-card:nth-child(1), .forum-post-card:nth-child(1), .password-card:nth-child(1) { animation-delay: 0.02s; }
.blog-waterfall .blog-card:nth-child(2), .forum-post-card:nth-child(2), .password-card:nth-child(2) { animation-delay: 0.04s; }
.blog-waterfall .blog-card:nth-child(3), .forum-post-card:nth-child(3), .password-card:nth-child(3) { animation-delay: 0.06s; }
.blog-waterfall .blog-card:nth-child(4) { animation-delay: 0.08s; }
.blog-waterfall .blog-card:nth-child(5) { animation-delay: 0.10s; }
.blog-waterfall .blog-card:nth-child(6) { animation-delay: 0.12s; }
.blog-waterfall .blog-card:nth-child(7) { animation-delay: 0.14s; }
.blog-waterfall .blog-card:nth-child(8) { animation-delay: 0.16s; }

@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Form Controls ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--md-ref-on-surface-variant);
  letter-spacing: 0.5px;
}

input, select, textarea {
  font-family: inherit;
  font-size: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--md-ref-outline-variant);
  background: var(--md-ref-surface);
  color: var(--md-ref-on-surface);
  outline: none;
  transition: border 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--md-ref-primary);
  box-shadow: 0 0 0 3px rgba(var(--md-ref-primary-rgb, 103, 80, 164), 0.15);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ===== Table ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--md-ref-outline-variant);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
  background: var(--md-ref-surface-container);
  border-bottom: 1px solid var(--md-ref-outline-variant);
  letter-spacing: 0.5px;
}

table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--md-ref-outline-variant);
  vertical-align: middle;
}

table tr:last-child td {
  border-bottom: none;
}

table tr:hover td {
  background: var(--md-ref-surface-container);
}

/* ===== Dialog / Modal ===== */
.dialog-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}

.dialog-overlay.active {
  display: flex;
}

.dialog {
  background: var(--md-ref-surface-container-high);
  border-radius: 28px;
  padding: 24px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px var(--md-shadow);
  animation: scaleIn 0.2s;
}

.dialog h3 {
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 24px;
}

.dialog .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 24px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.92) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ===== Snackbar / Toast ===== */
.snackbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--md-ref-inverse-surface);
  color: var(--md-ref-inverse-on-surface);
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  display: none;
  box-shadow: 0 4px 12px var(--md-shadow);
  white-space: nowrap;
}

.snackbar.show {
  display: block;
  animation: slideUp 0.35s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.snackbar.show.hide {
  animation: slideDown 0.25s ease forwards;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(24px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes slideDown {
  from { transform: translateX(-50%) translateY(0); opacity: 1; }
  to { transform: translateX(-50%) translateY(24px); opacity: 0; }
}

/* ===== Layout ===== */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
  /* 内容区撑满视口剩余高度（导航 56px），页脚落在视口之外需滚动可见；
     内容超出一屏时页脚自然跟随文档末尾 */
  min-height: calc(100vh - 56px);
}

.page-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

.page-title {
  font-size: 28px;
  font-weight: 400;
  margin-bottom: 24px;
}

/* ===== Category Chips ===== */
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.chip {
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  background: var(--md-ref-surface-container);
  color: var(--md-ref-on-surface-variant);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  /* div/span → button 后补偿：不被 button 全局样式的固定高度/字体/对齐影响 */
  font-family: inherit;
  height: auto;
  text-align: left;
}

.chip.active {
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
  animation: chipPop 0.2s ease;
}

.chip:hover {
  background: var(--md-ref-surface-variant);
  border-color: var(--md-ref-outline);
  transform: translateY(-1px);
}

/* 选中态优先级：hover 不覆盖 active（保持 primary-container 底） */
.chip.active:hover {
  background: var(--md-ref-primary-container);
  border-color: transparent;
}

.chip:active {
  transform: translateY(0);
}

/* 装饰性静态徽标（替代内联样式）：不可点、紧凑尺寸；
   static=描边中性，tonal=次级色容器（均无交互态） */
.chip.chip-static {
  background: transparent;
  border: 1px solid var(--md-ref-outline-variant);
  color: var(--md-ref-on-surface-variant);
  cursor: default;
  font-size: 12px;
  padding: 1px 8px;
}

.chip.chip-tonal {
  background: var(--md-ref-secondary-container);
  color: var(--md-ref-on-secondary-container);
  border-color: transparent;
  cursor: default;
  font-size: 12px;
  padding: 1px 8px;
}

/* 工单状态：独立命名空间，兼容明暗主题。 */
.ticket-status.ticket-status--warning { background: #fff1d6; color: #6b4300; border-color: transparent; }
.ticket-status.ticket-status--primary { background: var(--md-ref-primary-container); color: var(--md-ref-on-primary-container); border-color: transparent; }
.ticket-status.ticket-status--secondary { background: var(--md-ref-secondary-container); color: var(--md-ref-on-secondary-container); border-color: transparent; }
.ticket-status.ticket-status--success { background: #d9f2df; color: #1b5e20; border-color: transparent; }
.ticket-status.ticket-status--neutral { background: transparent; color: var(--md-ref-on-surface-variant); border-color: var(--md-ref-outline-variant); }
[data-theme="dark"] .ticket-status.ticket-status--warning { background: #5a420d; color: #ffdda0; }
[data-theme="dark"] .ticket-status.ticket-status--success { background: #214d29; color: #b8efbd; }

.ticket-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 280px); gap: 20px; }
.ticket-detail-main { min-width: 0; }
@media (max-width: 720px) {
  .ticket-detail-layout { display: block; }
  .ticket-detail-layout > aside { margin-top: 20px; }
}

/* 工单详情页：紧凑的主内容与窄信息栏，避免复用通用页面间距造成空洞。 */
.ticket-detail-page { max-width: 1080px; margin: 0 auto; }
.ticket-detail-back { margin-bottom: 8px; }
.ticket-detail-layout { align-items: start; }
.ticket-detail-header, .ticket-detail-description, .ticket-detail-message, .ticket-detail-reply, .ticket-detail-sidebar { padding: 20px; }
.ticket-detail-header { margin-bottom: 14px; }
.ticket-detail-kicker { color: var(--md-ref-on-surface-variant); font-size: 13px; letter-spacing: .04em; }
.ticket-detail-title { margin: 5px 0 10px; font-size: clamp(22px, 3vw, 30px); line-height: 1.25; overflow-wrap: anywhere; }
.ticket-detail-tags { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ticket-detail-tags .ticket-status { font-weight: 600; }
.ticket-detail-progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; list-style: none; padding: 0; margin: 22px 0 0; }
.ticket-detail-progress-item { position: relative; min-width: 0; text-align: center; color: var(--md-ref-on-surface-variant); }
.ticket-detail-progress-line { position: absolute; top: 13px; left: 0; right: 0; height: 2px; background: var(--md-ref-outline-variant); z-index: 0; }
.ticket-detail-progress-item:first-child .ticket-detail-progress-line { left: 50%; }
.ticket-detail-progress-item:last-child .ticket-detail-progress-line { right: 50%; }
.ticket-detail-progress-dot { position: relative; z-index: 1; display: inline-flex; width: 27px; height: 27px; align-items: center; justify-content: center; border: 2px solid var(--md-ref-outline-variant); border-radius: 50%; background: var(--md-ref-surface); font-size: 12px; }
.ticket-detail-progress-label { display: block; margin-top: 6px; font-size: 12px; white-space: nowrap; }
.ticket-detail-progress-item.is-done .ticket-detail-progress-line, .ticket-detail-progress-item.is-current .ticket-detail-progress-line { background: var(--md-ref-primary); }
.ticket-detail-progress-item.is-done .ticket-detail-progress-dot { border-color: var(--md-ref-primary); background: var(--md-ref-primary); color: var(--md-ref-on-primary); }
.ticket-detail-progress-item.is-current { color: var(--md-ref-on-surface); font-weight: 700; }
.ticket-detail-progress-item.is-current .ticket-detail-progress-dot { width: 33px; height: 33px; margin-top: -3px; border-color: var(--md-ref-primary); background: var(--md-ref-primary-container); color: var(--md-ref-on-primary-container); box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-ref-primary) 18%, transparent); }
.ticket-detail-description { margin-bottom: 20px; }
.ticket-detail-description h2, .ticket-detail-events h2 { margin-bottom: 9px; font-size: 17px; }
.ticket-detail-description p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.ticket-detail-source { display: flex; gap: 9px; align-items: baseline; margin-top: 15px !important; font-size: 13px; }
.ticket-detail-source a { min-width: 0; overflow-wrap: anywhere; }
.ticket-detail-section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 9px; }
.ticket-detail-section-heading h2 { margin: 0; font-size: 19px; }
.ticket-detail-section-heading span { font-size: 13px; }
.ticket-detail-messages { display: grid; gap: 9px; list-style: none; padding: 0; margin: 0; }
.ticket-detail-message { padding: 15px 17px; }
.ticket-detail-message-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.ticket-detail-message p { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.ticket-detail-empty { display: flex; align-items: center; gap: 9px; padding: 13px 16px; color: var(--md-ref-on-surface-variant); }
.ticket-detail-empty .material-icons { font-size: 19px; }
.ticket-detail-empty p { margin: 0; font-size: 14px; }
.ticket-detail-events { margin: 17px 0 0; padding: 14px 17px; border: 1px solid var(--md-ref-outline-variant); border-radius: 12px; }
.ticket-detail-events ol { list-style: none; padding: 0; margin: 0; }
.ticket-detail-events li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--md-ref-outline-variant); font-size: 13px; }
.ticket-detail-events li:last-child { border-bottom: 0; }
.ticket-detail-reply { margin-top: 14px; }
.ticket-detail-reply label { display: block; margin-bottom: 7px; font-weight: 600; }
.ticket-detail-reply textarea { display: block; width: 100%; min-height: 120px; }
.ticket-detail-reply-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.ticket-detail-reply-footer p { margin: 0; font-size: 13px; }
.ticket-detail-sidebar { position: sticky; top: 76px; }
.ticket-detail-sidebar-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 15px; border-bottom: 1px solid var(--md-ref-outline-variant); font-size: 13px; }
.ticket-detail-sidebar dl { display: grid; gap: 13px; margin: 16px 0 0; font-size: 13px; }
.ticket-detail-sidebar dt { color: var(--md-ref-on-surface-variant); }
.ticket-detail-sidebar dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.ticket-detail-actions { display: grid; gap: 8px; margin-top: 18px; }
.ticket-detail-error { margin-top: 14px; color: var(--md-ref-error); }
.ticket-detail-guard { max-width: 460px; margin: 48px auto; }
.ticket-detail-guard h1 { font-size: 22px; margin-bottom: 8px; }
.ticket-detail-guard .btn { margin-top: 16px; }

@media (max-width: 720px) {
  .ticket-detail-page { max-width: none; }
  .ticket-detail-header, .ticket-detail-description, .ticket-detail-message, .ticket-detail-reply, .ticket-detail-sidebar { padding: 16px; }
  .ticket-detail-title { font-size: 24px; }
  .ticket-detail-progress { margin-top: 18px; }
  .ticket-detail-progress-label { font-size: 11px; }
  .ticket-detail-sidebar { position: static; }
  .ticket-detail-reply-footer { align-items: flex-start; flex-direction: column; }
  .ticket-detail-reply-footer .btn { width: 100%; }
}

@media (max-width: 420px) {
  .ticket-detail-progress-label { font-size: 10px; }
  .ticket-detail-progress-dot { width: 24px; height: 24px; }
  .ticket-detail-progress-item.is-current .ticket-detail-progress-dot { width: 29px; height: 29px; }
  .ticket-detail-events li { display: block; }
  .ticket-detail-events time { display: block; margin-top: 3px; }
}

@keyframes chipPop {
  from { transform: scale(0.92); }
  50% { transform: scale(1.06); }
  to { transform: scale(1); }
}

/* ===== Link Grid ===== */
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.link-card {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
}

.link-card .link-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.link-card .link-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
}

.link-card .link-info {
  flex: 1;
  min-width: 0;
}

.link-card .link-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--md-ref-on-surface);
  margin-bottom: 2px;
}

.link-card .link-desc {
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card .link-arrow {
  color: var(--md-ref-on-surface-variant);
  font-size: 20px;
  flex-shrink: 0;
}

/* ===== Announcement ===== */
.announcement-bar {
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
  padding: 12px 24px;
  border-radius: 16px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.announcement-bar .ann-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.announcement-bar .ann-content {
  flex: 1;
}

.announcement-bar .ann-title {
  font-weight: 600;
  margin-bottom: 2px;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--md-ref-on-surface-variant);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 16px;
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 48px;
  color: var(--md-ref-on-surface-variant);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--md-ref-outline-variant);
  border-top-color: var(--md-ref-primary);
  border-radius: 50%;
  animation: spin 0.6s cubic-bezier(0.4, 0.0, 0.2, 1) infinite;
  margin: 0 auto 12px;
  transition: border-color 0.3s;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Skeleton loading */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--md-ref-surface-container) 25%, var(--md-ref-surface-container-high) 50%, var(--md-ref-surface-container) 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-card {
  height: 120px;
  border-radius: 16px;
}

/* Loading dots animation */
.loading-dots::after {
  content: '';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* ===== Admin Layout ===== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 260px;
  background: var(--md-ref-surface-container);
  border-right: 1px solid var(--md-ref-outline-variant);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-sidebar .sidebar-title {
  font-size: 18px;
  font-weight: 500;
  padding: 8px 16px;
  margin-bottom: 12px;
}

.admin-sidebar a {
  padding: 10px 16px;
  border-radius: 100px;
  color: var(--md-ref-on-surface-variant);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}

.admin-sidebar a:hover {
  background: var(--md-ref-surface-variant);
}

.admin-sidebar a.active {
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
}

.admin-sidebar .spacer {
  flex: 1;
}

.admin-main {
  flex: 1;
  padding: 24px 32px;
  max-width: 100%;
  overflow-x: hidden;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-header h2 {
  font-size: 28px;
  font-weight: 400;
}

/* ===== Login Page ===== */
.login-page, .register-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: transparent; /* 完全透明，透出壁纸 */
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px 32px;
}

.login-card h1 {
  font-size: 28px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 8px;
}

.login-card .subtitle {
  text-align: center;
  color: var(--md-ref-on-surface-variant);
  margin-bottom: 32px;
  font-size: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 12px;
    border-right: none;
    border-bottom: 1px solid var(--md-ref-outline-variant);
  }
  .admin-sidebar .sidebar-title { display: none; }
  .admin-sidebar a { white-space: nowrap; }
  .admin-main { padding: 16px; }
  .app-bar { padding: 0 12px; }
  .link-grid { grid-template-columns: 1fr; }
  .page { padding: 16px; }
}

@media (max-width: 480px) {
  .login-card { padding: 24px 16px; }
  .dialog { padding: 16px; border-radius: 16px; width: 95%; }
  .app-bar .title { font-size: 18px; }
}

/* ===== Misc ===== */
.mr-8 { margin-right: 8px; }
.ml-8 { margin-left: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--md-ref-on-surface-variant); }
.w-full { width: 100%; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Module Grid (Dashboard) ===== */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.module-card {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 16px;
  gap: 12px;
}

.module-card .module-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.module-card .module-icon .material-icons { font-size: 32px; }

.module-card .module-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--md-ref-on-surface);
}

.module-card .module-desc {
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
}

/* ===== Embed Button ===== */
.btn-embed {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--md-ref-surface-variant);
  color: var(--md-ref-on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.2s;
}

.btn-embed:hover {
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
}

/* ===== Embed Page ===== */
.embed-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.embed-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--md-ref-surface-container);
  border-bottom: 1px solid var(--md-ref-outline-variant);
  flex-shrink: 0;
}

.embed-toolbar .embed-title {
  font-size: 16px;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.embed-container {
  flex: 1;
  width: 100%;
  border: none;
}

/* ===== Forum ===== */
.forum-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  min-height: calc(100vh - 100px);
}

.forum-sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
}

.forum-cat-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.forum-cat-item {
  padding: 10px 16px;
  border-radius: 100px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--md-ref-on-surface-variant);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  /* div/span → button 后补偿：保持块级填充、左对齐与自然高度 */
  font-family: inherit;
  min-height: 40px;
  height: auto;
  justify-content: flex-start;
  text-align: inherit;
  /* B2 div→button 后补偿：清除 UA 默认浅色按钮底/描边；同时基础态保留
     主题化底色（surface-container）而非透明——否则深色模式下非选中按钮
     与页面暗底融为一体，点击切换分类后"背景消失"（沿用 .chip 的既有模式） */
  background: var(--md-ref-surface-container);
  border: 1px solid transparent;
}

.forum-cat-item:hover { background: var(--md-ref-surface-variant); }

.forum-cat-item.active {
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
}

.forum-post-list { display: flex; flex-direction: column; gap: 12px; }

.forum-post-card {
  padding: 16px 20px;
  cursor: pointer;
}

.forum-post-card .post-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--md-ref-on-surface);
}

.forum-post-card .post-meta {
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
  display: flex;
  gap: 16px;
}

/* ===== Forum Post Detail ===== */
.post-detail .post-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--md-ref-outline-variant);
}

.post-detail .post-body {
  font-size: 16px;
  line-height: 1.8;
  white-space: pre-wrap;
  margin-bottom: 32px;
  padding: 16px;
  border-radius: 12px;
  background: var(--md-ref-surface-container-low);
}

/* 壁纸模式：楼主正文与楼层一致走玻璃半透材质 */
.has-wallpaper .post-detail .post-body {
  background: var(--glass-bg, rgba(255,251,254,0.55));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.reply-item {
  padding: 16px;
  border-radius: 12px;
  background: var(--md-ref-surface-container-low);
  margin-bottom: 12px;
}

.reply-item .reply-meta {
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
  margin-bottom: 8px;
}

.reply-item .reply-body {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ===== Blog ===== */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.blog-card {
  padding: 20px;
  cursor: pointer;
}

.blog-card .blog-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--md-ref-on-surface);
}

.blog-card .blog-excerpt {
  font-size: 14px;
  color: var(--md-ref-on-surface-variant);
  line-height: 1.5;
  margin-bottom: 12px;
}

.blog-card .blog-meta {
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
}

.blog-article {
  max-width: 720px;
  margin: 0 auto;
}

.blog-article .article-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

.blog-article .article-meta {
  font-size: 14px;
  color: var(--md-ref-on-surface-variant);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--md-ref-outline-variant);
}

.blog-article .article-body {
  font-size: 16px;
  line-height: 1.8;
  white-space: pre-wrap;
}

/* ===== Password Manager ===== */
.pin-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 48px 24px;
  text-align: center;
}

.pin-overlay .pin-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.pin-input {
  font-size: 28px;
  letter-spacing: 12px;
  text-align: center;
  max-width: 200px;
  padding: 12px;
}

.password-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* 密码卡片的外层定位容器：复制按钮与卡片同级（避免 button 嵌套 button），
   用绝对定位贴在卡片右上角 */
.password-card-wrap {
  position: relative;
}

.password-card {
  padding: 16px;
  cursor: pointer;
  position: relative;
  /* div/span → button 后补偿：卡片保留块级布局、继承文字色与左对齐 */
  font-family: inherit;
  color: inherit;
  height: auto;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  width: 100%;
}

.password-card .pw-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.password-card .pw-username {
  font-size: 14px;
  color: var(--md-ref-on-surface-variant);
}

.password-card .pw-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
}

.password-detail {
  display: grid;
  gap: 12px;
}

.password-detail .pw-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--md-ref-surface-container);
}

.password-detail .pw-field .pw-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--md-ref-on-surface-variant);
  min-width: 60px;
}

.password-detail .pw-field .pw-value {
  flex: 1;
  font-size: 15px;
  font-family: monospace;
}

.password-detail .pw-field .pw-copy {
  cursor: pointer;
  color: var(--md-ref-primary);
  padding: 4px;
  border-radius: 50%;
  /* span → button 后补偿：保持小图标按钮外观（不被 button 全局样式撑高） */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: auto;
  font-family: inherit;
}

.password-detail .pw-field .pw-copy:hover { background: var(--md-ref-primary-container); }

/* ===== Navigation Bar ===== */
.nav-bar {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 16px;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s;
  /* Default style */
  background: var(--md-ref-surface-container);
  border-bottom: 1px solid var(--md-ref-outline-variant);
  margin: 0;
  border-radius: 0;
  max-width: 100%;
}

/* Glass nav */
.nav-bar.nav-glass {
  background: var(--glass-bg, rgba(255,251,254,0.65));
  backdrop-filter: blur(var(--glass-blur, 20px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 20px));
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.2));
}

/* Capsule nav */
.nav-bar.nav-capsule {
  margin: 8px 16px 0;
  max-width: calc(100% - 32px);
  border-radius: 100px;
  border-bottom: 1px solid var(--md-ref-outline-variant);
  box-shadow: 0 2px 12px var(--md-shadow);
  padding: 0 12px;
  height: 48px;
  background: var(--md-ref-surface-container);
}

/* Capsule + Glass */
.nav-bar.nav-capsule.nav-glass {
  background: var(--glass-bg, rgba(255,251,254,0.75));
  backdrop-filter: blur(var(--glass-blur, 20px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 20px));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.25));
}

/* Nav with wallpaper */
.has-wallpaper .nav-bar.nav-default {
  background: var(--glass-bg, rgba(255,251,254,0.7));
  backdrop-filter: blur(var(--glass-blur, 15px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 15px));
  border-bottom-color: var(--glass-border, rgba(255,255,255,0.15));
}

.nav-left { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.nav-brand {
  font-size: 18px;
  font-weight: 600;
  color: var(--md-ref-primary);
  text-decoration: none;
  padding: 0 12px;
  margin-right: 4px;
  white-space: nowrap;
}

.nav-version {
  font-size: 11px;
  color: var(--md-ref-on-surface-variant);
  margin-right: 8px;
  white-space: nowrap;
  align-self: flex-end;
  padding-bottom: 2px;
}

.nav-tabs { display: flex; gap: 2px; overflow-x: auto; }

/* 顶栏个人中心链接：桌面显示头像+用户名，移动端仅头像（用户名由 .nav-user-name 隐藏） */
.nav-user { flex-shrink: 0; }
.nav-user-name { margin-left: 4px; white-space: nowrap; }

.nav-tab {
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  color: var(--md-ref-on-surface-variant);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s;
}

.nav-tab:hover { background: var(--md-ref-surface-variant); transform: translateY(-1px); }
.nav-tab:active { transform: translateY(0); }
.nav-tab.active {
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
  animation: tabActivate 0.2s ease;
}

@keyframes tabActivate {
  from { transform: scale(0.95); }
  50% { transform: scale(1.05); }
  to { transform: scale(1); }
}

/* ===== Blog Waterfall (Masonry) ===== */
.blog-waterfall {
  column-count: 3;
  column-gap: 16px;
  padding: 0;
}

.blog-waterfall .blog-card {
  break-inside: avoid;
  margin-bottom: 16px;
  cursor: pointer;
  padding: 20px;
  display: inline-block;
  width: 100%;
}

.blog-waterfall .blog-card .blog-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--md-ref-on-surface);
  line-height: 1.3;
}

.blog-waterfall .blog-card .blog-excerpt {
  font-size: 14px;
  color: var(--md-ref-on-surface-variant);
  line-height: 1.6;
  margin-bottom: 12px;
}

.blog-waterfall .blog-card .blog-meta {
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
}

.blog-waterfall .blog-card .blog-featured {
  width: 100%;
  height: 4px;
  background: var(--md-ref-primary);
  border-radius: 2px;
  margin-bottom: 12px;
}

/* Markdown rendered content */
.md-body { font-size: 15px; line-height: 1.7; word-wrap: break-word; }
.md-body h1, .md-body h2, .md-body h3 { margin: 20px 0 10px; font-weight: 600; }
.md-body h1 { font-size: 24px; }
.md-body h2 { font-size: 20px; }
.md-body h3 { font-size: 17px; }
.md-body p { margin: 10px 0; }
.md-body ul, .md-body ol { padding-left: 24px; margin: 10px 0; }
.md-body li { margin: 4px 0; }
.md-body code {
  background: var(--md-ref-surface-variant);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Consolas', 'Courier New', monospace;
}
.md-body pre {
  background: var(--md-ref-surface-container);
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.5;
  tab-size: 2;
}
.md-body pre code { background: none; padding: 0; font-size: inherit; }
.md-body pre::-webkit-scrollbar { height: 4px; }
.md-body pre::-webkit-scrollbar-thumb { background: var(--md-ref-outline-variant); border-radius: 2px; }
.md-body table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.md-body th, .md-body td { padding: 8px 12px; border: 1px solid var(--md-ref-outline-variant); text-align: left; }
.md-body th { background: var(--md-ref-surface-container); font-weight: 600; }
.md-body tr:nth-child(even) td { background: var(--md-ref-surface-container-low); }
.md-body ul.task-list { list-style: none; padding-left: 0; }
.md-body .task-list-item { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.md-body .task-list-item input[type="checkbox"] { pointer-events: none; }
.md-body blockquote {
  border-left: 3px solid var(--md-ref-primary);
  padding: 8px 16px;
  margin: 16px 0;
  background: var(--md-ref-surface-container-low);
  border-radius: 0 8px 8px 0;
  color: var(--md-ref-on-surface-variant);
}
.md-body a { color: var(--md-ref-primary); }
.md-body img { max-width: 100%; border-radius: 8px; margin: 12px 0; }
.md-body hr { border: none; border-top: 1px solid var(--md-ref-outline-variant); margin: 24px 0; }

/* ===== Blog Detail ===== */
.blog-article { max-width: 720px; margin: 0 auto; }
.blog-article .article-title { font-size: 28px; font-weight: 600; margin-bottom: 8px; }
.blog-article .article-meta { font-size: 14px; color: var(--md-ref-on-surface-variant); margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--md-ref-outline-variant); }

/* ===== Admin Panel Dashboard ===== */
.admin-panels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.panel-card {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
}

.panel-card .panel-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.panel-card .panel-icon .material-icons { font-size: 24px; }

.panel-card .panel-info { flex: 1; min-width: 0; }
.panel-card .panel-title { font-size: 15px; font-weight: 600; color: var(--md-ref-on-surface); margin-bottom: 2px; }
.panel-card .panel-desc { font-size: 13px; color: var(--md-ref-on-surface-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-card .panel-embed { color: var(--md-ref-primary); font-size: 20px; flex-shrink: 0; }

/* ===== Settings Page ===== */
.settings-section { max-width: 600px; }
.settings-section h3 { font-size: 18px; font-weight: 500; margin: 24px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--md-ref-outline-variant); }
.settings-card { margin-bottom: 20px; }
.settings-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--md-ref-outline-variant); }
.settings-card h4 { font-size: 14px; font-weight: 500; margin: 16px 0 8px; color: var(--md-ref-on-surface-variant); }
.settings-card .btn-filled { margin-top: 4px; }
.color-input { width: 48px; height: 48px; padding: 4px; border-radius: 12px; cursor: pointer; }

/* ===== Markdown toggle ===== */
.toggle-group { display: flex; gap: 8px; margin-bottom: 16px; }
.toggle-btn { padding: 6px 16px; border-radius: 100px; font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid var(--md-ref-outline-variant); background: transparent; color: var(--md-ref-on-surface-variant); }
.toggle-btn:hover { background: var(--md-ref-surface-variant); }
.toggle-btn.active { background: var(--md-ref-primary-container); color: var(--md-ref-on-primary-container); border-color: transparent; }

/* ===== Captcha ===== */
.g-recaptcha { margin: 16px 0; display: flex; justify-content: center; }
.captcha-wrapper { margin: 16px 0; }
.captcha-image { background: var(--md-ref-surface-container-low); border-radius: 8px; padding: 4px; display: flex; justify-content: center; }
.captcha-image svg { max-width: 240px; border-radius: 6px; display: block; }

/* ===== Wallpaper & Glass Effects ===== */
:root {
  --glass-bg: rgba(255,251,254,0.65);
  --glass-bg-heavy: rgba(255,251,254,0.8);
  --glass-border: rgba(255,255,255,0.2);
  --glass-blur: 20px;
  --wallpaper: none;
}

[data-theme="dark"] {
  --glass-bg: rgba(28,27,31,0.6);
  --glass-bg-heavy: rgba(28,27,31,0.78);
  --glass-border: rgba(255,255,255,0.08);
}

/* Glass background (semi-transparent overlay) */
.bg-glass body, body.bg-glass {
  background: linear-gradient(135deg, var(--md-ref-primary-container) 0%, var(--md-ref-background) 50%, var(--md-ref-surface-container) 100%) !important;
}

/* Glass style for buttons and controls */
button.glass-card, .btn.glass-card, .nav-tab.glass-card, .chip.glass-card {
  background: var(--glass-bg, rgba(255,251,254,0.5)) !important;
  backdrop-filter: blur(var(--glass-blur, 12px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 12px));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.15));
}

[data-theme="dark"] button.glass-card,
[data-theme="dark"] .btn.glass-card {
  background: var(--glass-bg, rgba(28,27,31,0.45)) !important;
}

/* Wallpaper on body */
.has-wallpaper {
  background: var(--wallpaper) center/cover fixed no-repeat !important;
}

/* Wallpaper overlay for text readability */
.has-wallpaper::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--wallpaper-overlay, rgba(0,0,0,0.3));
  z-index: -1;
  pointer-events: none;
}

/* Adjust text color on wallpaper backgrounds */
.has-wallpaper .card,
.has-wallpaper .forum-post-card,
.has-wallpaper .blog-card,
.has-wallpaper .panel-card,
.has-wallpaper .password-card,
.has-wallpaper .link-card {
  background: var(--glass-bg, rgba(255,251,254,0.75));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
}

.has-wallpaper .nav-bar {
  background: var(--glass-bg, rgba(255,251,254,0.8));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.has-wallpaper .dialog {
  background: var(--glass-bg-heavy, rgba(255,251,254,0.9));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.has-wallpaper input,
.has-wallpaper select,
.has-wallpaper textarea {
  background: var(--glass-bg, rgba(255,251,254,0.6));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

[data-theme="dark"] .has-wallpaper::before {
  background: var(--wallpaper-overlay, rgba(0,0,0,0.4));
}

/* 壁纸开启时整体提高玻璃不透明度（内容可读性）：
   --glass-bg / --glass-bg-heavy 的所有使用者（玻璃卡/导航/表格/弹窗）自动加强；
   无壁纸时保持原有半透明质感不受影响 */
body.has-wallpaper {
  --glass-bg: rgba(255,251,254,0.82);
  --glass-bg-heavy: rgba(255,251,254,0.92);
}
[data-theme="dark"] body.has-wallpaper {
  --glass-bg: rgba(28,27,31,0.74);
  --glass-bg-heavy: rgba(28,27,31,0.84);
}

/* Glass card style */
.card.glass-card,
.glass-card {
  background: var(--glass-bg, rgba(255,251,254,0.6)) !important;
  backdrop-filter: blur(var(--glass-blur, 16px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 16px));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.2));
  box-shadow: 0 4px 24px var(--md-shadow);
}

.card.glass-card:hover {
  background: var(--glass-bg-heavy, rgba(255,251,254,0.75)) !important;
  border-color: var(--md-ref-primary);
  box-shadow: 0 8px 32px var(--md-shadow);
}

/* Main content area glass when wallpaper */
.has-wallpaper .page .card:not(.glass-card) {
  background: var(--glass-bg-heavy, rgba(255,251,254,0.75));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* 壁纸下内容区统一磨砂背景（可读性核心）：
   用 .page::before 实现而不是直接在 .page 上 backdrop-filter——
   直接加会使 .page 成为 position:fixed 后代的包含块，
   破坏详情页悬浮目录（.article-toc-side）的视口定位。
   半透明 + 模糊给文字稳固底色，壁纸在面板边缘仍清晰可见 */

/* 壁纸下页脚同源加强（页脚在 .page 之外，单独覆盖） */
body.has-wallpaper .footer-classic {
  background: rgba(255, 251, 254, 0.82);
}
[data-theme="dark"] body.has-wallpaper .footer-classic {
  background: rgba(28, 27, 31, 0.75);
}

/* 壁纸下详情页正文卡 / 目录卡加强：阅读面需要更高不透明度（其余卡片由
   body.has-wallpaper 的 --glass-bg 变量统一加强） */
body.has-wallpaper .blog-article,
body.has-wallpaper .article-toc-side {
  background: rgba(255, 251, 254, 0.78);
}
[data-theme="dark"] body.has-wallpaper .blog-article,
[data-theme="dark"] body.has-wallpaper .article-toc-side {
  background: rgba(28, 27, 31, 0.74);
}

/* 壁纸下论坛侧栏玻璃底（B9）：仿 .blog-article 的半透明 + 模糊 + 圆角，
   保证壁纸下分类文字可读（深色主题用深色底） */
.has-wallpaper .forum-sidebar {
  background: rgba(255, 251, 254, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 12px;
}
[data-theme="dark"] .has-wallpaper .forum-sidebar {
  background: rgba(28, 27, 31, 0.55);
}

/* Blog waterfall cards with wallpaper */
.has-wallpaper .blog-waterfall .blog-card {
  background: var(--glass-bg-heavy, rgba(255,251,254,0.75));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
}

/* Dialog glass */
.has-wallpaper .dialog {
  background: var(--glass-bg-heavy, rgba(40,38,45,0.85));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* Table glass with wallpaper */
.has-wallpaper .table-wrapper {
  background: var(--glass-bg-heavy, rgba(255,251,254,0.7));
  backdrop-filter: blur(8px);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) { .blog-waterfall { column-count: 2; } }
@media (max-width: 720px) {
  .blog-waterfall { column-count: 1; }
  .forum-layout { grid-template-columns: 1fr; }
  .forum-sidebar { position: static; }
  .password-grid { grid-template-columns: 1fr; }
  .nav-bar.nav-capsule { margin: 4px 8px 0; max-width: calc(100% - 16px); border-radius: 16px; height: auto; padding: 6px 10px; flex-wrap: wrap; }
  .nav-bar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 4px; }
  .nav-left { width: 100%; }
  .nav-tabs { flex: 1; }
  .nav-brand { font-size: 16px; padding: 0 8px; }
  .admin-panels { grid-template-columns: 1fr; }
  .theme-presets { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .blog-waterfall .blog-card { padding: 16px; }
  .nav-tab { font-size: 13px; padding: 8px 12px; }
}

/* ===== Homepage Layout ===== */
.homepage-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.homepage-sidebar {
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 88px;
}
.homepage-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--md-ref-surface-container);
  border: 3px solid var(--md-ref-primary);
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.homepage-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.homepage-bio {
  font-size: 14px;
  color: var(--md-ref-on-surface-variant);
  line-height: 1.6;
  white-space: pre-wrap;
}
.homepage-contacts {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.hp-contact-link {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--md-ref-surface-container);
  color: var(--md-ref-on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.2s;
}
.hp-contact-link {
  position: relative;
}
.hp-contact-link:hover {
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
  transform: translateY(-2px);
}
.hp-contact-link .material-icons {
  font-size: 18px;
}
/* Tooltip */
.hp-contact-link::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: var(--md-ref-inverse-surface);
  color: var(--md-ref-inverse-on-surface);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s;
}
.hp-contact-link:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
.homepage-content {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  line-height: 1.8;
}
.homepage-recent-header {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--md-ref-on-surface);
}
.homepage-recent-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.homepage-recent-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  text-decoration: none;
  border-bottom: 1px solid var(--md-ref-outline-variant);
  transition: opacity 0.2s;
}
.homepage-recent-item:last-child {
  border-bottom: none;
}
.homepage-recent-item:hover {
  opacity: 0.7;
}
.homepage-recent-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--md-ref-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.homepage-recent-date {
  font-size: 12px;
  color: var(--md-ref-on-surface-variant);
}
@media (max-width: 768px) {
  .homepage-layout {
    flex-direction: column;
    align-items: center;
  }
  .homepage-sidebar {
    flex: none;
    width: 100%;
    position: static;
  }
  .homepage-avatar {
    width: 80px;
    height: 80px;
  }
}

/* ===== Music Embed ===== */
.music-embed {
  position: fixed;
  bottom: 24px;
  z-index: 100;
  line-height: 0;
  transition: all 0.3s ease;
}
/* 折叠触发按钮：div → button 后补偿，保持 48×48 圆角矩形图标样式 */
.music-embed-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  color: var(--md-ref-on-surface-variant);
}
.music-embed.right { right: 24px; }
.music-embed.left { left: 24px; }
.music-embed iframe {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.music-embed.collapsed {
  width: 48px;
  height: 48px;
}
.music-embed.collapsed .music-embed-player { display: none; }
.music-embed.collapsed .music-embed-icon {
  display: flex !important;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: background 0.2s;
}
.music-embed.collapsed .music-embed-icon:hover {
  background: var(--md-ref-primary);
  color: var(--md-ref-on-primary);
}

/* ===== 页脚（footer_style: classic / columns / glass，视觉对齐 footer-demo 02/03/04） ===== */
/* ---- 经典左右 ---- */
.footer-classic {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px 28px 28px;
  border-top: 1px solid var(--md-ref-outline-variant);
  /* 磨砂玻璃：半透明底 + 模糊，壁纸下增强可读性 */
  background: rgba(255, 251, 254, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
[data-theme="dark"] .footer-classic {
  background: rgba(28, 27, 31, 0.6);
}
.footer-classic .fc-left {
  font-size: 13px;
  letter-spacing: 0.3px;
  color: var(--md-ref-on-surface-variant);
}
.footer-classic .fc-left .sep {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin: 0 10px;
  vertical-align: middle;
  background: linear-gradient(135deg, var(--md-ref-primary), #d0bcff);
  box-shadow: 0 0 8px rgba(103, 80, 164, 0.7);
}
.footer-classic .fc-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--md-ref-on-primary-container);
  background: var(--md-ref-primary-container);
  border-radius: 100px;
  padding: 5px 14px;
  box-shadow: 0 1px 3px var(--md-shadow);
}
.footer-classic .fc-version {
  font-size: 11px;
  font-weight: 500;
  color: var(--md-ref-on-surface-variant);
  opacity: 0.7;
}

/* ---- 分栏导航 ---- */
.footer-columns {
  /* 磨砂玻璃：半透明底 + 模糊，壁纸下增强可读性 */
  background: rgba(255, 251, 254, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--md-ref-outline-variant);
}
[data-theme="dark"] .footer-columns {
  background: rgba(28, 27, 31, 0.6);
}
.footer-columns .fc-grid {
  display: grid;
  /* 品牌列保底 220px 视觉权重（2fr）；栏目列自适应 1-3 个，栏目少时自然放大、不塌陷 */
  grid-template-columns: minmax(220px, 2fr) repeat(auto-fit, minmax(0, 1fr));
  gap: 32px;
  padding: 36px 28px 28px;
  max-width: 1080px;
  margin: 0 auto;
}
.fc-brand .brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.fc-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--md-ref-primary);
  color: var(--md-ref-on-primary);
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fc-brand .brand-name { font-size: 17px; font-weight: 600; letter-spacing: 0.3px; }
.fc-brand .brand-version { font-size: 12px; font-weight: 500; color: var(--md-ref-outline); }
.fc-brand .brand-desc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--md-ref-on-surface-variant);
  max-width: 300px;
}
.fc-col .col-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--md-ref-on-surface-variant);
  margin-bottom: 12px;
}
.fc-col { min-width: 0; } /* 防止超长标题/链接撑破自适应列 */
.fc-col .col-links { display: flex; flex-direction: column; gap: 8px; }
.fc-col .col-links a {
  font-size: 14px;
  color: var(--md-ref-on-surface-variant);
  text-decoration: none;
  transition: color 0.2s;
}
.fc-col .col-links a:hover { color: var(--md-ref-primary); }
.footer-columns .fc-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-top: 1px solid var(--md-ref-outline-variant);
  padding: 16px 28px;
  font-size: 12.5px;
  letter-spacing: 0.3px;
  color: var(--md-ref-on-surface-variant);
  background: var(--md-ref-surface-container-low);
}
.footer-columns .fc-bottom .sep {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin: 0 10px;
  vertical-align: middle;
  background: linear-gradient(135deg, var(--md-ref-primary), #d0bcff);
  box-shadow: 0 0 8px rgba(103, 80, 164, 0.7);
}

/* ---- 玻璃卡片 ---- */
.footer-glass-wrap {
  position: relative;
  overflow: hidden;
  padding: 28px;
  background: linear-gradient(135deg,
    var(--md-ref-primary-container) 0%,
    var(--md-ref-secondary-container) 45%,
    var(--md-ref-background) 100%);
}
.footer-glass-wrap .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(12px);
  opacity: 0.5;
  pointer-events: none;
}
.footer-glass-wrap .blob-1 { width: 240px; height: 240px; top: -80px; left: -40px; background: var(--md-ref-primary); }
.footer-glass-wrap .blob-2 { width: 280px; height: 280px; top: -60px; right: 6%; background: var(--md-ref-secondary); }
.footer-glass-wrap .blob-3 { width: 200px; height: 200px; bottom: -90px; left: 40%; background: var(--md-ref-primary); opacity: 0.35; }
.footer-glass {
  position: relative;
  z-index: 2;
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-radius: 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px var(--md-shadow);
  transition: background 0.3s, border-color 0.3s;
}
.footer-glass:hover {
  background: var(--glass-bg-heavy);
  border-color: var(--md-ref-primary);
}
.fg-left { display: flex; align-items: center; gap: 12px; }
.fg-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--md-ref-primary);
  color: var(--md-ref-on-primary);
  font-size: 19px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px var(--md-shadow);
  flex-shrink: 0;
}
.fg-name { font-size: 15px; font-weight: 600; letter-spacing: 0.2px; }
.fg-tag { font-size: 12px; color: var(--md-ref-on-surface-variant); margin-top: 2px; }
.fg-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-size: 12.5px;
  line-height: 1.6;
  letter-spacing: 0.3px;
  color: var(--md-ref-on-surface-variant);
  text-align: right;
}
.fg-right .fg-powered { color: var(--md-ref-primary); font-weight: 500; }

/* ===== 博客列表页移动端首屏修复：内容优先，侧栏移到底部 ===== */
@media (max-width: 768px) {
  .blog-layout .homepage-content { order: 1; width: 100%; }
  .blog-layout .homepage-sidebar { order: 2; width: 100%; }
}

/* ===== 博客增强：搜索 / 标签云 / 归档 / 点赞 / 目录 / 嵌套评论（B2） ===== */
/* ---- 列表页工具条 + 搜索框 ---- */
.blog-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 8px 0 14px;
  border-radius: 100px;
  border: 1px solid var(--md-ref-outline-variant);
  background: var(--md-ref-surface-container-low);
  color: var(--md-ref-on-surface-variant);
  transition: border 0.2s, box-shadow 0.2s;
}
.search-box:focus-within {
  border-color: var(--md-ref-primary);
  box-shadow: 0 0 0 3px rgba(103, 80, 164, 0.15);
}
.search-box .material-icons { font-size: 20px; flex-shrink: 0; }
.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 14px;
  color: var(--md-ref-on-surface);
  outline: none;
  box-shadow: none !important;
}
.search-clear {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--md-ref-on-surface-variant);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.search-clear:hover { background: var(--md-ref-surface-variant); }
.search-clear .material-icons { font-size: 18px; }

/* ---- 搜索结果 ---- */
.search-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--md-ref-on-surface);
  margin-bottom: 12px;
}
.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.search-result-item {
  display: block;
  text-decoration: none;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--md-ref-outline-variant);
  background: var(--md-card-bg);
  transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}
.search-result-item:hover {
  border-color: var(--md-ref-primary);
  box-shadow: 0 4px 16px var(--md-shadow);
  transform: translateY(-2px);
}
.sri-title { font-size: 16px; font-weight: 600; color: var(--md-ref-on-surface); margin-bottom: 4px; }
.sri-excerpt {
  font-size: 13px;
  line-height: 1.6;
  color: var(--md-ref-on-surface-variant);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.sri-meta { font-size: 12px; color: var(--md-ref-on-surface-variant); display: flex; gap: 6px; flex-wrap: wrap; }
.sri-meta .sep { color: var(--md-ref-outline-variant); }
.sri-tags { color: var(--md-ref-primary); }

/* ---- 标签云 ---- */
.tag-cloud { padding: 14px 18px; margin-bottom: 16px; }
.tag-cloud-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--md-ref-on-surface-variant);
  margin-bottom: 10px;
}
.tag-cloud-title .material-icons { font-size: 16px; color: var(--md-ref-primary); }
.tag-cloud-body { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; }
.tag-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: var(--md-ref-primary);
  text-decoration: none;
  line-height: 1.6;
  transition: color 0.2s, transform 0.2s;
}
.tag-chip:hover { color: var(--md-ref-on-primary-container); text-decoration: none; transform: translateY(-1px); }
.tag-chip .tag-count { font-size: 10px; color: var(--md-ref-outline); }
.tag-title-count { font-size: 14px; font-weight: 400; color: var(--md-ref-on-surface-variant); margin-left: 8px; }

/* ---- 详情页 meta / 标签 / 点赞 ---- */
.meta-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--md-ref-on-surface-variant);
}
.article-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.article-tag-chip { text-decoration: none; transition: all 0.2s; }
.article-tag-chip:hover { border-color: var(--md-ref-primary); background: var(--md-ref-surface-variant); }
.article-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.like-btn {
  height: 34px;
  padding: 0 16px;
  border-radius: 100px;
  border: 1px solid var(--md-ref-outline-variant);
  background: transparent;
  color: var(--md-ref-on-surface-variant);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}
.like-btn:hover { border-color: var(--md-ref-error); color: var(--md-ref-error); background: color-mix(in srgb, var(--md-ref-error) 10%, transparent); }
.like-btn .material-icons { font-size: 18px; }
.like-btn.liked {
  border-color: var(--md-ref-error);
  color: var(--md-ref-error);
  background: color-mix(in srgb, var(--md-ref-error) 10%, transparent);
}
.like-btn:active { transform: scale(0.94); }

/* ---- 目录 TOC ---- */
.toc-block {
  margin: 16px 0 20px;
  border: 1px solid var(--md-ref-outline-variant);
  border-radius: 16px;
  background: var(--md-ref-surface-container-low);
  overflow: hidden;
}
.toc-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--md-ref-on-surface);
  cursor: pointer;
  text-align: left;
}
.toc-toggle:hover { background: var(--md-ref-surface-variant); }
.toc-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--md-ref-on-primary-container);
  background: var(--md-ref-primary-container);
  border-radius: 100px;
  padding: 2px 8px;
}
.toc-arrow { margin-left: auto; transition: transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1); }
.toc-arrow.open { transform: rotate(180deg); }
.toc-list {
  list-style: none;
  padding: 4px 16px 14px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toc-item a {
  display: block;
  padding: 6px 10px;
  border-radius: 100px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--md-ref-on-surface-variant);
  text-decoration: none;
  transition: all 0.2s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toc-item a:hover { background: var(--md-ref-surface-variant); color: var(--md-ref-primary); }
.toc-lv3 a { padding-left: 26px; font-size: 13px; }
.md-body h2, .md-body h3 { scroll-margin-top: 76px; }

/* ---- 上一篇 / 下一篇 ---- */
.prevnext-nav {
  display: flex;
  gap: 12px;
  margin: 28px 0 8px;
}
.pn-col { flex: 1; min-width: 0; }
.pn-col a, .pn-col .pn-disabled {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--md-ref-outline-variant);
  background: var(--md-ref-surface-container-low);
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}
.pn-col a:hover {
  border-color: var(--md-ref-primary);
  box-shadow: 0 4px 16px var(--md-shadow);
}
.pn-label { font-size: 12px; font-weight: 500; color: var(--md-ref-on-surface-variant); }
.pn-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--md-ref-on-surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pn-col a:hover .pn-title { color: var(--md-ref-primary); }
.pn-col .pn-disabled { opacity: 0.5; cursor: default; }
.pn-next a, .pn-next .pn-disabled { align-items: flex-end; text-align: right; }

/* ---- 嵌套评论 ---- */
.comment-list { display: flex; flex-direction: column; gap: 12px; }
.reply-children {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  margin-left: 26px;
  padding-left: 14px;
  border-left: 2px solid var(--md-ref-primary-container);
}
.reply-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--md-ref-on-primary-container);
  background: var(--md-ref-primary-container);
  border-radius: 100px;
  padding: 1px 8px;
  margin-left: 8px;
}
.reply-btn {
  margin-top: 8px;
  height: 40px;
  padding: 0 10px;
  font-size: 12px;
  color: var(--md-ref-on-surface-variant);
}
.reply-btn:hover { color: var(--md-ref-primary); background: var(--md-ref-primary-container); }
.comment-form { margin-top: 12px; }
.reply-to-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
  border-radius: 12px;
  padding: 8px 12px;
}
.reply-to-hint .btn { color: inherit; font-size: 12px; margin-left: auto; height: 26px; padding: 0 8px; }
.reply-to-hint strong { color: var(--md-ref-primary); }

/* ---- 归档页 ---- */
.archive-list { display: flex; flex-direction: column; }
.archive-month { padding: 18px 0 6px; border-bottom: 1px solid var(--md-ref-outline-variant); }
.archive-month:first-child { padding-top: 8px; }
.archive-month-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  color: var(--md-ref-on-surface);
  margin-bottom: 12px;
}
.archive-month-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--md-ref-on-primary-container);
  background: var(--md-ref-primary-container);
  border-radius: 100px;
  padding: 2px 10px;
}
.archive-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 8px;
  border-radius: 12px;
  text-decoration: none;
  transition: background 0.2s;
}
.archive-item:hover { background: var(--md-ref-surface-container); }
.archive-item-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--md-ref-on-surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-item:hover .archive-item-title { color: var(--md-ref-primary); }
.archive-item-date { font-size: 12px; color: var(--md-ref-on-surface-variant); flex-shrink: 0; }

/* ===== 博客增强响应式 ===== */
@media (max-width: 720px) {
  .reply-children { margin-left: 12px; padding-left: 10px; }
  .prevnext-nav { flex-direction: column; }
  .pn-next a, .pn-next .pn-disabled { align-items: flex-start; text-align: left; }
  .archive-item-title { white-space: normal; }
}

/* ===== 页脚响应式 ===== */
@media (max-width: 720px) {
  .footer-columns .fc-grid { grid-template-columns: 1fr; gap: 22px; }
  .footer-glass-wrap { padding: 20px; }
  .fg-right { align-items: flex-start; text-align: left; }
  .footer-classic { padding: 20px 20px 24px; }
  .footer-columns .fc-bottom { padding: 14px 20px; }
}



/* ===== 炫酷版权发光（footer_copyright 用 <span class="copyright-glow">…</span>） ===== */
.copyright-glow {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  padding: 8px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(103, 80, 164, 0.16), rgba(224, 163, 255, 0.09) 50%, rgba(255, 138, 171, 0.10));
  border: 1px solid var(--md-ref-outline-variant);
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--md-ref-on-surface);
  backdrop-filter: blur(8px);
  animation: copyrightGlow 3s ease-in-out infinite;
}
.copyright-glow b,
.copyright-glow .grad {
  background: linear-gradient(90deg, var(--md-ref-primary), #d0bcff, #ff8fab);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@keyframes copyrightGlow {
  0%, 100% {
    box-shadow: 0 0 14px rgba(103, 80, 164, 0.30), 0 0 32px rgba(208, 188, 255, 0.12), inset 0 0 10px rgba(255, 255, 255, 0.05);
    border-color: var(--md-ref-outline-variant);
  }
  50% {
    box-shadow: 0 0 22px rgba(103, 80, 164, 0.55), 0 0 48px rgba(208, 188, 255, 0.25), inset 0 0 14px rgba(255, 255, 255, 0.08);
    border-color: rgba(208, 188, 255, 0.5);
  }
}

/* ===== 炫酷 Powered by 徽章（footer_powered 用 <span class="powered-glow">…</span>） ===== */
.powered-glow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  font-weight: 700;
  letter-spacing: 1.2px;
  font-size: 13px;
  color: #fff;
  text-shadow: 0 0 10px rgba(208, 188, 255, 0.8), 0 0 20px rgba(103, 80, 164, 0.5);
  background: linear-gradient(135deg, #6750a4, #7c4dff 40%, #b388ff 70%, #ff8fab);
  background-size: 200% 200%;
  animation: poweredFlow 4s ease infinite, poweredPulse 2.4s ease-in-out infinite;
  box-shadow: 0 0 16px rgba(124, 77, 255, 0.45), 0 0 36px rgba(103, 80, 164, 0.25);
}
.powered-glow::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.15) 40%, rgba(255, 138, 171, 0.8));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: poweredBorder 3.2s linear infinite;
}
.powered-glow::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  transform: rotate(20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: poweredShine 3.2s ease-in-out infinite;
}
@keyframes poweredFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes poweredPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(124, 77, 255, 0.45), 0 0 36px rgba(103, 80, 164, 0.25); }
  50% { box-shadow: 0 0 24px rgba(124, 77, 255, 0.7), 0 0 56px rgba(103, 80, 164, 0.4); }
}
@keyframes poweredBorder {
  0% { filter: hue-rotate(0deg); opacity: 0.7; }
  50% { filter: hue-rotate(40deg); opacity: 1; }
  100% { filter: hue-rotate(0deg); opacity: 0.7; }
}
@keyframes poweredShine {
  0%, 55% { left: -60%; }
  100% { left: 130%; }
}

/* ===== 博客文章详情页壁纸下磨砂背景（增强可读性） ===== */
.blog-article {
  background: rgba(255, 251, 254, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 24px;
}
[data-theme="dark"] .blog-article {
  background: rgba(28, 27, 31, 0.55);
}

/* ===== 文章详情页布局：正文卡片（居中固定宽）+ 右侧悬浮目录 =====
 * 注意：.blog-article 带 backdrop-filter，会成为 position:fixed 后代的包含块，
 * 因此目录卡片必须放在 .article-layout 层（磨砂卡片的兄弟），
 * 其 fixed 才相对视口定位。正文宽 720 居中，目录左缘 = 50% + 388px（360+28）。 */
.article-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.article-main {
  flex: 0 0 auto;
  width: 720px;
  max-width: 100%;
}
.article-toc-side {
  width: 220px;
  /* 独立悬浮卡片：相对视口 fixed，锚定在正文右缘 + 28px 处，
     不占文档流、不挤压正文，任何视口下都不会与阅读区重叠 */
  position: fixed;
  top: 88px;
  left: calc(50% + 388px); /* 正文半宽 360px + 间距 28px */
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: rgba(255, 251, 254, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--md-ref-outline-variant);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 20px var(--md-shadow);
}
[data-theme="dark"] .article-toc-side {
  background: rgba(28, 27, 31, 0.6);
}
.article-toc-side .toc-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--md-ref-on-surface);
}
.article-toc-side .toc-count {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.65;
}
.article-toc-side .toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.article-toc-side .toc-item a {
  display: block;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--md-ref-on-surface-variant);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.article-toc-side .toc-item a:hover {
  background: var(--md-ref-surface-container-high);
  color: var(--md-ref-primary);
}
/* 小屏隐藏：视口容不下「正文 720 + 目录 220 + 间距 28 + 边距」时收起，
   内容区不受影响（目录 fixed 不占文档流） */
@media (max-width: 1299px) {
  .article-toc-side { display: none; }
}

/* ===== 文章 meta 间距（作者 · 时间 · 阅读 · 字数） ===== */
.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
}
.article-meta .meta-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ============================================================
   Markdown Indigo 定制（.md-body）
   —— 只做文本级渲染；除代码块（okaidia 暗底）外全部背景透明，
      由卡片磨砂玻璃接管；颜色全部走主题 CSS 变量，
      浅/深色随 data-theme 自动切换。
   ============================================================ */

/* 正文基调：透明背景，文字色走主题变量 */
.md-body {
  color: var(--md-ref-on-surface);
  line-height: 1.75;
}

/* 标题：Indigo 排版（字重 500 / 行高 1.3），h1/h2 带左侧竖线 + 下边框 */
.md-body h1, .md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 {
  color: var(--md-ref-on-surface);
  font-weight: 500;
  line-height: 1.3;
  margin: 1.5em 0 .6em;
}
.md-body h1, .md-body h2 {
  padding: .25em 0 .25em .75em;
  border-left: 6px solid var(--md-ref-primary);
  border-bottom: 1px solid var(--md-ref-outline-variant);
}

/* 加粗 / 删除线：不加 Indigo 的「」引号，仅保留字重；删除线走主题灰 */
.md-body strong { font-weight: 700; }
.md-body del, .md-body s { color: var(--md-ref-outline); }

/* 链接：主题主色 + Indigo 下边框式下划线 */
.md-body a {
  color: var(--md-ref-primary);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--md-ref-primary) 40%, transparent);
}
.md-body a:hover { border-bottom-color: var(--md-ref-primary); }

/* 行内代码：主题容器色背景（可换肤），透明背景不出现 */
.md-body code {
  background: var(--md-ref-surface-container);
  color: var(--md-ref-on-surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace;
}

/* 引用块：Indigo 左粗线（主题主色）+ 主题浅底 */
.md-body blockquote {
  margin: 1em 0;
  padding: .5em 1em;
  border-left: 4px solid var(--md-ref-primary);
  background: var(--md-ref-surface-container-low);
  border-radius: 0 8px 8px 0;
  color: color-mix(in srgb, var(--md-ref-primary) 70%, var(--md-ref-on-surface));
}
.md-body blockquote > :last-child { margin-bottom: 0; }
.md-body blockquote > :first-child { margin-top: 0; }

/* 代码块：唯一保留背景的元素 —— okaidia 暗色主题 */
.md-body pre {
  background: #272822;
  color: #f8f8f2;
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 1em 0;
  font-size: 13px;
  line-height: 1.6;
  text-shadow: 0 1px rgba(0, 0, 0, .3);
  tab-size: 4;
}
.md-body pre code {
  background: none;
  color: #f8f8f2;
  padding: 0;
  font-size: inherit;
  text-shadow: 0 1px rgba(0, 0, 0, .3);
}
.md-body pre::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 2px; }

/* okaidia 语法高亮（token 出现时生效，如后续接入 highlight.js/prism） */
.md-body .token.cdata, .md-body .token.comment, .md-body .token.doctype, .md-body .token.prolog { color: #8292a2; }
.md-body .token.punctuation { color: #f8f8f2; }
.md-body .token.namespace { opacity: .7; }
.md-body .token.constant, .md-body .token.deleted, .md-body .token.property, .md-body .token.symbol, .md-body .token.tag { color: #f92672; }
.md-body .token.boolean, .md-body .token.number { color: #ae81ff; }
.md-body .token.attr-name, .md-body .token.builtin, .md-body .token.char, .md-body .token.inserted, .md-body .token.selector, .md-body .token.string { color: #a6e22e; }
.md-body .token.entity, .md-body .token.operator, .md-body .token.url, .md-body .token.variable { color: #f8f8f2; }
.md-body .token.atrule, .md-body .token.attr-value, .md-body .token.class-name, .md-body .token.function { color: #e6db74; }
.md-body .token.keyword { color: #66d9ef; }
.md-body .token.important, .md-body .token.regex { color: #fd971f; }
.md-body .token.bold, .md-body .token.important { font-weight: 700; }
.md-body .token.italic { font-style: italic; }

/* 深色模式：文本色跟随 on-surface 浅色变体；代码块保持 okaidia 暗底不变 */
[data-theme="dark"] .md-body { color: var(--md-ref-on-surface); }
[data-theme="dark"] .md-body blockquote { background: var(--md-ref-surface-container); }

/* ===== Markdown Editor（共用组件 MarkdownEditor.jsx：左编辑 + 右防抖预览）===== */
.md-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.md-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.md-editor-toolbar .btn-icon {
  width: 34px;
  height: 34px;
}

.md-editor-toolbar .btn-icon .material-icons {
  font-size: 20px;
}

.md-editor-upload-status {
  font-size: 12px;
  color: var(--md-ref-primary);
  margin-left: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.md-editor-panes {
  display: flex;
  gap: 12px;
  align-items: stretch;
  min-height: 360px;
}

.md-editor-pane {
  flex: 1 1 50%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--md-ref-outline-variant);
  border-radius: 12px;
  overflow: hidden;
  background: var(--md-ref-surface);
}

.md-editor-pane-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--md-ref-on-surface-variant);
  background: var(--md-ref-surface-container);
  border-bottom: 1px solid var(--md-ref-outline-variant);
}

.md-editor-sync {
  margin-left: auto;
  font-weight: 400;
}

.md-editor-sync.pending {
  color: var(--md-ref-primary);
}

.md-editor-input {
  position: relative;
}

.md-editor-input textarea {
  flex: 1;
  width: 100%;
  border: none;
  border-radius: 0;
  resize: none;
  padding: 12px 14px;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  background: var(--md-ref-surface);
  color: var(--md-ref-on-surface);
  outline: none;
  min-height: 0;
}

.md-editor-input textarea:focus {
  border-color: transparent;
  box-shadow: none;
}

.md-editor-input.dragover {
  outline: 2px dashed var(--md-ref-primary);
  outline-offset: -2px;
}

/* 键盘可达：输入区聚焦时显示明显的焦点环 */
.md-editor-input:focus-within {
  outline: 2px solid var(--md-ref-primary);
  outline-offset: -2px;
}

.md-editor-drop-hint {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--md-ref-on-primary-container);
  background: var(--md-ref-primary-container);
  border-radius: 12px;
  pointer-events: none;
}

.md-editor-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}

.md-editor-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 120px;
  color: var(--md-ref-outline);
  font-size: 13px;
  text-align: center;
}

/* 紧凑模式（弹窗内使用） */
.md-editor.compact .md-editor-panes {
  min-height: 220px;
}

.md-editor.compact .md-editor-input textarea {
  padding: 8px 10px;
  font-size: 13px;
}

.md-editor.compact .md-editor-preview-body {
  padding: 8px 10px;
}

.md-editor.compact .md-editor-pane-head {
  padding: 4px 8px;
}

.md-editor.compact .md-editor-toolbar .btn-icon {
  width: 30px;
  height: 30px;
}

/* 窄屏堆叠：左右分栏收窄后改为上下排布 */
@media (max-width: 720px) {
  .md-editor-panes {
    flex-direction: column;
    min-height: 0;
  }
  .md-editor-pane {
    flex: none;
  }
  .md-editor-input textarea {
    min-height: 200px;
  }
  .md-editor-preview-body {
    min-height: 200px;
    max-height: 320px;
  }
}

/* ===== Forum v2（版块索引 / 版块页 / 详情楼层） ===== */

/* ── 版块图标（ForumIcon 组件）── */
/* 12 色 MD3 container/onContainer 对：从 --md-ref-primary/secondary-container 派生，
   不硬编码 hex；深浅色模式分别覆盖，自适应。老浏览器不支持 color-mix 时回退 primary-container。 */
:root {
  --fi-0-bg: var(--md-ref-primary-container);   --fi-0-fg: var(--md-ref-on-primary-container);
  --fi-1-bg: var(--md-ref-secondary-container); --fi-1-fg: var(--md-ref-on-secondary-container);
  --fi-2-bg: color-mix(in srgb, var(--md-ref-primary-container) 72%, #000000);   --fi-2-fg: var(--md-ref-on-primary-container);
  --fi-3-bg: color-mix(in srgb, var(--md-ref-secondary-container) 72%, #000000); --fi-3-fg: var(--md-ref-on-secondary-container);
  --fi-4-bg: color-mix(in srgb, var(--md-ref-primary-container) 82%, #ffffff);   --fi-4-fg: var(--md-ref-on-primary-container);
  --fi-5-bg: color-mix(in srgb, var(--md-ref-secondary-container) 82%, #ffffff); --fi-5-fg: var(--md-ref-on-secondary-container);
  --fi-6-bg: color-mix(in srgb, var(--md-ref-primary-container) 62%, var(--md-ref-secondary-container));
  --fi-6-fg: color-mix(in srgb, var(--md-ref-on-primary-container) 62%, var(--md-ref-on-secondary-container));
  --fi-7-bg: color-mix(in srgb, var(--md-ref-primary-container) 38%, var(--md-ref-secondary-container));
  --fi-7-fg: color-mix(in srgb, var(--md-ref-on-primary-container) 38%, var(--md-ref-on-secondary-container));
  --fi-8-bg: color-mix(in srgb, var(--md-ref-primary-container) 50%, #000000);   --fi-8-fg: var(--md-ref-on-primary-container);
  --fi-9-bg: color-mix(in srgb, var(--md-ref-secondary-container) 50%, #000000); --fi-9-fg: var(--md-ref-on-secondary-container);
  --fi-10-bg: color-mix(in srgb, var(--md-ref-primary-container) 68%, #ffffff);  --fi-10-fg: var(--md-ref-on-primary-container);
  --fi-11-bg: color-mix(in srgb, var(--md-ref-secondary-container) 68%, #ffffff);--fi-11-fg: var(--md-ref-on-secondary-container);
}
/* 深色模式：容器色整体偏暗，提亮组改向黑微调（保持深底浅字强对比，层次靠混合比例区分） */
[data-theme="dark"] {
  --fi-4-bg: color-mix(in srgb, var(--md-ref-primary-container) 85%, #000000);
  --fi-5-bg: color-mix(in srgb, var(--md-ref-secondary-container) 85%, #000000);
  --fi-10-bg: color-mix(in srgb, var(--md-ref-primary-container) 70%, #000000);
  --fi-11-bg: color-mix(in srgb, var(--md-ref-secondary-container) 70%, #000000);
}

.forum-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
}
.forum-icon.tone-0 { background: var(--md-ref-primary-container); color: var(--md-ref-on-primary-container); }
.forum-icon.tone-1 { background: var(--md-ref-secondary-container); color: var(--md-ref-on-secondary-container); }
.forum-icon.tone-2 { background: var(--fi-2-bg); color: var(--fi-2-fg); }
.forum-icon.tone-3 { background: var(--fi-3-bg); color: var(--fi-3-fg); }
.forum-icon.tone-4 { background: var(--fi-4-bg); color: var(--fi-4-fg); }
.forum-icon.tone-5 { background: var(--fi-5-bg); color: var(--fi-5-fg); }
.forum-icon.tone-6 { background: var(--fi-6-bg); color: var(--fi-6-fg); }
.forum-icon.tone-7 { background: var(--fi-7-bg); color: var(--fi-7-fg); }
.forum-icon.tone-8 { background: var(--fi-8-bg); color: var(--fi-8-fg); }
.forum-icon.tone-9 { background: var(--fi-9-bg); color: var(--fi-9-fg); }
.forum-icon.tone-10 { background: var(--fi-10-bg); color: var(--fi-10-fg); }
.forum-icon.tone-11 { background: var(--fi-11-bg); color: var(--fi-11-fg); }
.forum-icon.forum-icon-img img {
  width: 62%;
  height: 62%;
  object-fit: contain;
}

/* ── 论坛首页（L1）── */
.forum-home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.forum-home-head .page-title { margin: 0; }

.forum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.board-card {
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.board-card:hover {
  transform: translateY(-2px);
  border-color: var(--md-ref-primary);
  box-shadow: 0 6px 20px var(--md-shadow);
}
.board-card-top { display: flex; align-items: center; gap: 12px; }
.board-card-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.board-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--md-ref-on-surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-badge { font-size: 14px; flex-shrink: 0; }
.board-desc {
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.board-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--md-ref-on-surface-variant);
  margin-top: auto;
}
.board-today { color: var(--md-ref-primary); font-weight: 500; }
.board-mods {
  font-size: 12px;
  color: var(--md-ref-outline);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 面包屑（L2/L3）── */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.breadcrumbs a { color: var(--md-ref-primary); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { color: var(--md-ref-outline); }
.breadcrumbs .breadcrumb-title {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--md-ref-on-surface);
}

/* ── 版块页头（L2）── */
.category-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.category-head-main { flex: 1; min-width: 220px; }
.category-head-main h1 { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.category-head-desc {
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
  line-height: 1.5;
  margin-bottom: 8px;
}
.category-head-stats {
  font-size: 12px;
  color: var(--md-ref-on-surface-variant);
  display: flex;
  gap: 12px;
}
.category-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
}

/* ── 分区标题（置顶/精华/最新）── */
.forum-section { margin-bottom: 4px; }
.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-ref-on-surface-variant);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 14px 0 8px;
}
.section-label:first-child { margin-top: 0; }

/* ── 帖子徽章 / 楼主 / 楼层 ── */
.post-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 8px;
  margin-left: 6px;
  vertical-align: middle;
}
.post-badge.pin { background: var(--md-ref-secondary-container); color: var(--md-ref-on-secondary-container); }
.post-badge.essence { background: var(--md-ref-primary-container); color: var(--md-ref-on-primary-container); }
.lz-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 8px;
  background: var(--md-ref-secondary-container);
  color: var(--md-ref-on-secondary-container);
  vertical-align: middle;
}
.floor-num { font-size: 12px; color: var(--md-ref-outline); font-weight: 500; }

/* ── 详情楼层（L3）── */
.floor-item {
  padding: 16px;
  border-radius: 12px;
  background: var(--md-ref-surface-container-low);
  margin-bottom: 12px;
}
.floor-item .floor-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.floor-item .floor-time { color: var(--md-ref-outline); font-size: 12px; }
.floor-item .floor-del {
  margin-left: auto;
  color: var(--md-ref-error);
  cursor: pointer;
  font-size: 13px;
  background: none;
  border: none;
  font-family: inherit;
}
.floor-item .floor-body {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ── 管理操作区（置顶/加精/删除）── */
.post-admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ── 分页条 ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.pagination .page-info { font-size: 13px; color: var(--md-ref-on-surface-variant); }
.pagination .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 壁纸下玻璃适配：新卡片与既有卡片同源 */
.has-wallpaper .board-card,
.has-wallpaper .category-head,
.has-wallpaper .forum-post-card {
  background: var(--glass-bg, rgba(255,251,254,0.75));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
}
.has-wallpaper .floor-item {
  background: var(--glass-bg, rgba(255,251,254,0.55));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

@media (max-width: 720px) {
  .forum-home-head { flex-direction: column; align-items: flex-start; }
  .category-head { padding: 16px; }
  .category-head-actions { margin-left: 0; }
}

/* ===== 版主子管理台（/forum/manage*） ===== */

/* 论坛首页操作区（发帖 + 管理入口） */
.forum-home-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Tab 栏：MD3 次级标签栏（胶囊选中态） */
.manage-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--md-ref-surface-container);
  border-radius: 24px;
  width: fit-content;
  max-width: 100%;
}
.manage-tab {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--md-ref-on-surface-variant);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.manage-tab:hover { background: var(--md-ref-surface-variant); }
.manage-tab.active {
  background: var(--md-ref-secondary-container);
  color: var(--md-ref-on-secondary-container);
}
.manage-tab .material-icons { font-size: 16px; }
.manage-tab-count {
  font-size: 11px;
  font-weight: 600;
  padding: 0 7px;
  border-radius: 10px;
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
}

/* 管理面板卡 */
.manage-card { padding: 20px; margin-bottom: 16px; }
.manage-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--md-ref-on-surface);
}

/* 搜索行 */
.manage-search {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.manage-search input[type="text"] { flex: 1; min-width: 200px; }

/* 帖子管理行 */
.manage-post-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--md-ref-surface-container-low);
  margin-bottom: 10px;
  transition: background 0.2s;
}
.manage-post-row:hover { background: var(--md-ref-surface-container); }
.manage-post-main { flex: 1; min-width: 0; }
.manage-post-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--md-ref-on-surface);
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.manage-post-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.manage-post-meta {
  font-size: 12px;
  color: var(--md-ref-on-surface-variant);
  margin-top: 4px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.manage-post-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* 行内操作按钮（置顶/加精/删除） */
.manage-action {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: var(--md-ref-surface-container);
  color: var(--md-ref-on-surface-variant);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-family: inherit;
}
.manage-action:hover { background: var(--md-ref-surface-variant); }
.manage-action.on {
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
}
.manage-action.danger { color: var(--md-ref-error); }
.manage-action.danger:hover { background: var(--md-ref-error-container, #f9dedc); }
.manage-action:disabled { opacity: 0.5; cursor: not-allowed; }

/* 禁言表单 + 列表 */
.mute-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
}
.mute-form input[type="text"] { flex: 1; min-width: 180px; }
.mute-form select { max-width: 130px; }
.mute-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--md-ref-surface-container-low);
  margin-bottom: 8px;
}
.mute-main { flex: 1; min-width: 0; }
.mute-user { font-size: 14px; font-weight: 600; color: var(--md-ref-on-surface); }
.mute-expiry { font-size: 12px; color: var(--md-ref-on-surface-variant); margin-top: 2px; }
.mute-expiry.permanent { color: var(--md-ref-error); font-weight: 500; }

/* 壁纸下管理页玻璃适配（与既有卡片同源） */
.has-wallpaper .manage-card,
.has-wallpaper .manage-post-row,
.has-wallpaper .mute-row {
  background: var(--glass-bg, rgba(255,251,254,0.7));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

@media (max-width: 480px) {
  .manage-tabs { width: 100%; }
  .manage-tab { flex: 1; justify-content: center; }
  .manage-post-row { flex-direction: column; align-items: stretch; }
  .manage-post-actions { justify-content: flex-end; }
}

/* ===== 版块设置 Tab（管理台） ===== */
.profile-form { max-width: 560px; }

.profile-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--md-ref-surface-container-low);
}
.profile-preview-hint {
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
  min-width: 0;
}

/* 底色色板：单选 + 自动配色 */
.profile-palette {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.profile-swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  padding: 0;
  transition: transform 0.15s, border-color 0.15s;
}
.profile-swatch:hover { transform: scale(1.12); }
.profile-swatch.selected {
  border-color: var(--md-ref-on-surface);
  outline: 2px solid var(--md-ref-surface-container-low);
}
/* 自动配色（留空）按钮 */
.profile-swatch.clear {
  background: var(--md-ref-surface-container);
  color: var(--md-ref-on-surface-variant);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.profile-swatch.clear.selected {
  border-color: var(--md-ref-primary);
  color: var(--md-ref-primary);
}

/* 壁纸下玻璃适配 */
.has-wallpaper .profile-preview {
  background: var(--glass-bg, rgba(255,251,254,0.6));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* 图标输入行（上传按钮 + 文本输入） */
.icon-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.icon-input-row input[type="text"] { flex: 1; min-width: 0; }
.icon-upload-btn { flex-shrink: 0; }

@media (max-width: 480px) {
  .icon-input-row { flex-direction: column; align-items: stretch; }
}

/* 帖子编辑标记（已编辑 → 更新时间/次数） */
.post-edit-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--md-ref-on-surface-variant);
  background: var(--md-ref-surface-container-low);
  border-radius: 10px;
  padding: 6px 12px;
  margin: 12px 0 16px;
  width: fit-content;
  max-width: 100%;
}
.has-wallpaper .post-edit-info {
  background: var(--glass-bg, rgba(255,251,254,0.55));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ===== 移动端汉堡菜单（抽屉导航） ===== */
.nav-hamburger { display: none; }

/* 遮罩 + 抽屉（默认移出视口且不拦截点击） */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 85vw);
  background: var(--md-ref-surface-container-low);
  color: var(--md-ref-on-surface);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  box-shadow: 4px 0 24px var(--md-shadow);
  pointer-events: none;
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); pointer-events: auto; }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--md-ref-outline-variant);
  flex-shrink: 0;
}
.drawer-brand { font-size: 17px; font-weight: 600; }

.drawer-menu {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 2px;
  flex: 1;
}
.drawer-item {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--md-ref-on-surface-variant);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  font-family: inherit;
  transition: background 0.2s, color 0.2s;
}
.drawer-item:hover { background: var(--md-ref-surface-variant); }
.drawer-item.active {
  background: var(--md-ref-secondary-container);
  color: var(--md-ref-on-secondary-container);
}
.drawer-item-btn { width: 100%; }

.drawer-section {
  padding: 8px;
  border-top: 1px solid var(--md-ref-outline-variant);
}
.drawer-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--md-ref-outline);
  padding: 4px 14px 6px;
}
.drawer-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--md-ref-outline-variant);
  flex-shrink: 0;
}

/* 壁纸下抽屉玻璃底 */
.has-wallpaper .drawer {
  background: var(--glass-bg-heavy, rgba(255,251,254,0.9));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* 移动端：显示汉堡、隐藏桌面导航标签（与现有 720px 响应式并存）
   登录态顶栏只留 主题按钮 + 头像（退出入口在抽屉/个人中心） */
@media (max-width: 768px) {
  .nav-hamburger { display: inline-flex; flex-shrink: 0; }
  .nav-tabs { display: none; }
  .nav-version { display: none; }
  .nav-right { gap: 4px; }
  .nav-user-name { display: none; }
  .nav-user { padding: 0 6px; }
}

/* ===== markdown 锁定块（[lock:login/reply/password]） ===== */
.lock-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 20px;
  margin: 18px 0;
  border-radius: 16px;
  background: var(--md-ref-surface-container-low);
  border: 1px dashed var(--md-ref-outline-variant);
  text-align: center;
}
.lock-icon {
  font-size: 40px;
  color: var(--md-ref-on-surface-variant);
  opacity: 0.85;
  line-height: 1;
}
.lock-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--md-ref-on-surface);
}
.lock-desc {
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
}
.lock-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.lock-pwd-input {
  width: 180px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--md-ref-outline);
  background: var(--md-ref-surface);
  color: var(--md-ref-on-surface);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.lock-pwd-input:focus {
  outline: none;
  border-color: var(--md-ref-primary);
  box-shadow: 0 0 0 2px var(--md-ref-primary-container);
}
.lock-pwd-input.error {
  border-color: var(--md-ref-error);
}
.lock-pwd-input.error:focus {
  box-shadow: 0 0 0 2px var(--md-ref-error-container, #f9dedc);
}
.lock-error {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--md-ref-error);
  margin-top: 2px;
}
/* 解锁成功内容淡入 */
.lock-reveal {
  animation: lockReveal 0.35s ease;
}
@keyframes lockReveal {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 编辑器锁定插入弹窗：可见条件单选 */
.lock-type-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.lock-type-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 12px;
  border: 1px solid var(--md-ref-outline-variant);
  background: var(--md-ref-surface-container);
  color: var(--md-ref-on-surface-variant);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.lock-type-option:hover { background: var(--md-ref-surface-variant); }
.lock-type-option.active {
  background: var(--md-ref-secondary-container);
  color: var(--md-ref-on-secondary-container);
  border-color: transparent;
}

/* 壁纸下玻璃适配 */
.has-wallpaper .lock-placeholder {
  background: var(--glass-bg, rgba(255,251,254,0.55));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.has-wallpaper .lock-pwd-input {
  background: var(--glass-bg, rgba(255,251,254,0.6));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ===== 用户头像（Avatar 组件，MD3 圆形） ===== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  vertical-align: middle;
  background: var(--md-ref-surface-container-high);
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-fallback {
  font-weight: 700;
  user-select: none;
}
/* 首字兜底底色：复用 ForumIcon 的 12 色 MD3 变量（--fi-*），深浅色自适应 */
.avatar-fallback.tone-0  { background: var(--fi-0-bg);  color: var(--fi-0-fg); }
.avatar-fallback.tone-1  { background: var(--fi-1-bg);  color: var(--fi-1-fg); }
.avatar-fallback.tone-2  { background: var(--fi-2-bg);  color: var(--fi-2-fg); }
.avatar-fallback.tone-3  { background: var(--fi-3-bg);  color: var(--fi-3-fg); }
.avatar-fallback.tone-4  { background: var(--fi-4-bg);  color: var(--fi-4-fg); }
.avatar-fallback.tone-5  { background: var(--fi-5-bg);  color: var(--fi-5-fg); }
.avatar-fallback.tone-6  { background: var(--fi-6-bg);  color: var(--fi-6-fg); }
.avatar-fallback.tone-7  { background: var(--fi-7-bg);  color: var(--fi-7-fg); }
.avatar-fallback.tone-8  { background: var(--fi-8-bg);  color: var(--fi-8-fg); }
.avatar-fallback.tone-9  { background: var(--fi-9-bg);  color: var(--fi-9-fg); }
.avatar-fallback.tone-10 { background: var(--fi-10-bg); color: var(--fi-10-fg); }
.avatar-fallback.tone-11 { background: var(--fi-11-bg); color: var(--fi-11-fg); }

/* 列表小头像（24px 档） */
.avatar-sm { width: 24px; height: 24px; font-size: 12px; }

/* ===== RainID 个人中心提示卡片（Profile 页） ===== */
.rainid-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-top: 16px;
  border-radius: 14px;
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
}
.rainid-notice-body { flex: 1; min-width: 0; }
.rainid-notice-title { font-size: 14px; font-weight: 600; }
.rainid-notice-desc { font-size: 12px; opacity: 0.8; margin-top: 2px; }

/* 已解锁锁块容器：复用 .lock-placeholder 同款背景/圆角/虚线边框，内部改头部+内容区 */
.lock-revealed {
  align-items: stretch;      /* 覆盖 .lock-placeholder 的居中对齐 */
  padding: 0;                /* 内边距交给 head/body */
  gap: 0;
  text-align: left;
}
.lock-revealed-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--md-ref-on-surface-variant);
  border-bottom: 1px dashed var(--md-ref-outline-variant);
}
.lock-revealed-type {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 8px;
  background: var(--md-ref-secondary-container);
  color: var(--md-ref-on-secondary-container);
}
.lock-revealed-body {
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.7;
}

/* ===== 联系链接品牌图标（BrandIcon） ===== */
.contact-icon {
  vertical-align: middle;
  flex-shrink: 0;
  object-fit: contain; /* 防止非正方形 viewBox 图标在圆形容器内拉伸 */
}

/* ===== 公开个人主页（/u/:id） ===== */
.profile-page { max-width: 1080px; margin: 0 auto; }

/* Banner 渐变封面条 */
.profile-banner {
  height: 180px;
  border-radius: 0 0 20px 20px;
  margin-bottom: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 0 24px 16px;
}

/* Banner 装饰：右下角半透明首字水印 + 左下角用户名（让纯渐变条"有内容感"） */
.profile-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.16));
}
.profile-banner-char {
  position: absolute;
  right: 16px;
  bottom: -34px;
  font-size: 96px;
  font-weight: 800;
  line-height: 1;
  color: rgba(255, 255, 255, 0.16);
  user-select: none;
  pointer-events: none;
}
.profile-banner-name {
  position: relative;
  z-index: 1;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 桌面双列 */
.profile-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
  padding: 20px 16px 40px;
}

/* 身份卡 */
.profile-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.profile-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--md-ref-on-surface);
  margin: 0;
  word-break: break-all;
}
.profile-role-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--md-ref-secondary-container);
  color: var(--md-ref-on-secondary-container);
  white-space: nowrap;
}
.profile-bio {
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.profile-meta-line {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 12px;
  color: var(--md-ref-outline);
}
.profile-meta-line a {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--md-ref-primary);
  text-decoration: none;
}
.profile-meta-line a:hover { text-decoration: underline; }

/* 统计 2×2 */
.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}
.profile-stat {
  background: var(--md-ref-surface-container);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.profile-stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--md-ref-on-surface);
  font-variant-numeric: tabular-nums;
}
.profile-stat-label {
  font-size: 12px;
  color: var(--md-ref-on-surface-variant);
  margin-top: 2px;
}

/* 本人视角 */
.profile-self-area { width: 100%; margin-top: 4px; }
.profile-self-notice {
  font-size: 12px;
  color: var(--md-ref-on-surface-variant);
  margin-bottom: 10px;
}

/* 右列：Tab + 列表 */
.profile-content { min-width: 0; }
.profile-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--md-ref-outline-variant);
  padding-bottom: 2px;
}

/* 个人主页 Tab 选中态与顶栏解耦：纯 primary-container 填充、无内嵌下划线 */
.profile-tabs .nav-tab.active {
  background: var(--md-ref-primary-container);
  color: var(--md-ref-on-primary-container);
  box-shadow: none;
}

.profile-list-item {
  display: block;
  padding: 12px 16px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s, border-color 0.2s;
}
.profile-list-item:hover {
  background: var(--md-ref-surface-variant);
  border-color: var(--md-ref-outline);
}
.profile-item-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--md-ref-on-surface);
}
.profile-item-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-item-preview {
  font-size: 13px;
  color: var(--md-ref-on-surface-variant);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
}
.profile-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 12px;
  color: var(--md-ref-on-surface-variant);
}
.profile-reply-at {
  color: var(--md-ref-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.profile-load-more { text-align: center; margin-top: 16px; }
.profile-end-hint {
  text-align: center;
  font-size: 13px;
  color: var(--md-ref-outline);
  padding: 20px 0 8px;
}

/* 骨架 */
@keyframes profilePulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
.profile-skel {
  background: var(--md-ref-surface-container);
  animation: profilePulse 1.4s ease-in-out infinite;
}
.profile-item-skeleton { padding: 14px 16px; }
.profile-card-skeleton { min-height: 300px; }

/* 头像可点击（公开主页跳转） */
.avatar-link {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s, transform 0.2s;
}
.avatar-link:hover { opacity: 0.85; transform: translateY(-1px); }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .profile-grid { grid-template-columns: 280px 1fr; }
}
@media (max-width: 720px) {
  .profile-banner { height: 120px; border-radius: 0; }
  .profile-grid {
    grid-template-columns: 1fr;
    padding: 0 12px 32px;
  }
  .profile-card {
    padding-top: 56px;
    margin-top: -40px;      /* 头像上浮叠在 banner 下沿 */
  }
  .profile-card .avatar {
    width: 72px !important;
    height: 72px !important;
    border: 4px solid var(--md-card-bg);
    box-shadow: 0 2px 10px var(--md-shadow);
    margin-top: -76px;      /* 让头像超出卡片顶部叠到 banner */
  }
  .profile-card .avatar img { width: 100%; height: 100%; }
  .profile-tabs {
    position: sticky;
    top: 64px;
    z-index: 20;
    background: var(--md-card-bg);
    padding: 6px 4px;
    margin: 0 -12px 12px;
  }
  .profile-tabs .nav-tab { flex: 1; text-align: center; }
  .profile-stats { margin-top: 8px; }
}

/* ===== 全站作者名（UserName 组件）：名字 + 系统身份 chip + 自定义头衔 chip + UID 后缀 ===== */
.username {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
  min-width: 0;
}
.username-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.username-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
}
/* 系统身份 chip：固定 MD3 容器色，不随用户自定义变色 */
.username-chip-role {
  background: var(--md-ref-secondary-container);
  color: var(--md-ref-on-secondary-container);
}
.username-chip-moderator {
  background: var(--md-ref-tertiary-container);
  color: var(--md-ref-on-tertiary-container);
}
/* 自定义头衔 chip：titleColor 背景（白字 + 内描边保证可读），无色时用中性容器 */
.title-chip {
  background: var(--md-ref-surface-variant);
  color: var(--md-ref-on-surface-variant);
}
.title-chip-colored {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}
.username-uid {
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--md-ref-outline);
  flex-shrink: 0;
}
