:root {
  --bg-page: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f3f4f6;
  --bg-input: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --text-inverse: #0f172a;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;
  --warning: #f59e0b;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 24px rgba(0,0,0,0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 240px;
  --primary-gradient: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
}

:root[data-theme="dark"] {
  --bg-page: #0f172a;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --bg-input: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --primary-soft: rgba(99, 102, 241, 0.15);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info: #60a5fa;
  --info-bg: rgba(59, 130, 246, 0.15);
  --warning: #f59e0b;
  --border: #334155;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 10px 24px rgba(0,0,0,0.45);
  color-scheme: dark;
}


* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* 头部 */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.brand { display: flex; align-items: baseline; gap: 12px; color: var(--text-main); margin-right: auto; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 40px; height: 40px; border-radius: 8px; align-self: center; transition: filter .2s; }
[data-theme="dark"] .brand-logo { filter: brightness(0) invert(1); }
.brand h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 1px;
  line-height: 1;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
[data-theme="dark"] .brand h1 {
  color: var(--text-main);
  background: none;
  -webkit-text-fill-color: inherit;
  background-clip: initial;
}
.brand span { color: var(--text-muted); font-size: 14px; margin-bottom: 3px; }
.header-actions { display: flex; gap: 12px; align-items: center; }
.top-nav { display: flex; gap: 24px; align-items: center; margin: 0 24px 0 0; }
.top-nav a {
  color: var(--text-main);
  font-size: 15px;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: border-color .15s, color .15s;
}
.top-nav a:hover {
  color: var(--primary);
  text-decoration: none;
  border-bottom-color: var(--primary);
}
.user-menu { position: relative; }
.user-menu-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.user-menu-toggle:hover { border-color: var(--primary); color: var(--primary); }
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 150px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 100;
  overflow: hidden;
}
.user-menu-dropdown a,
.user-menu-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.user-menu-dropdown a:hover,
.user-menu-dropdown button:hover { background: var(--bg-hover); color: var(--primary); }
.user-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* 主体布局 */
.app-body { display: flex; flex: 1; }
.app-body.with-header {
  padding-top: 64px;
}
.sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  z-index: 5;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.main {
  flex: 1;
  padding: 12px 24px 24px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.main.with-sidebar {
  margin-left: var(--sidebar-w);
}
.main-wide {
  max-width: 1488px;
}

.main-landing { max-width: none; padding: 0; overflow: hidden; }
.main.main-full { max-width: none; margin-left: 0; margin-right: 0; }
.main.main-full.with-sidebar { margin-left: var(--sidebar-w); }
.app-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.app-footer.with-sidebar { margin-left: var(--sidebar-w); }

/* 侧边栏遮罩（移动端抽屉） */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 6;
}

/* 导航 */
.nav-section { margin-bottom: 20px; }
.nav-title {
  padding: 0 20px;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list li a, .nav-list li .nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  color: var(--text-main);
  cursor: pointer;
}
.nav-list li a:hover, .nav-list li .nav-item:hover { background: var(--bg-hover); }
.nav-list li a.router-link-active { color: var(--primary); background: var(--primary-soft); border-right: 3px solid var(--primary); }
.nav-toggle { font-size: 12px; color: var(--text-muted); width: 18px; text-align: center; }
.nav-children { padding-left: 16px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text-main); cursor: pointer; font-size: 14px;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--bg-hover); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-danger { color: var(--danger); border-color: var(--danger-bg); background: var(--danger-bg); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: var(--text-inverse); }
.btn-small { padding: 4px 10px; font-size: 13px; }

/* 卡片：全局去掉卡片外观，只保留纵向间距（内容直接铺在页面背景上） */
.card {
  padding: 12px 0 24px;
  margin-bottom: 20px;
}
.card-title { margin: 0 0 16px; font-size: 20px; }

/* 文章页内部分区（原多张卡片去掉外观后用顶部分隔线区分） */
.article-section { border-top: 1px solid var(--border); }

/* 列表 */
.list-item {
  padding: 16px 0; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: flex-start;
}
.list-item:last-child { border-bottom: none; }
.list-item h3 { margin: 0 0 6px; font-size: 17px; }
.list-meta { font-size: 13px; color: var(--text-muted); }

.article-list-item { padding: 14px 0; }
.article-list-row { display: flex; align-items: center; gap: 10px; width: 100%; }
.article-list-content {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}
.article-list-title {
  margin: 0;
  font-size: 16px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.article-list-title a { color: var(--text-main); }
.article-list-title a:hover { color: var(--primary); }
.article-list-meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.article-list-meta .tag-list { margin: 0; }
.article-list-meta .list-meta { margin: 0; flex-shrink: 0; }

@media (max-width: 640px) {
  .article-list-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .article-list-title {
    width: 100%;
    white-space: normal;
    overflow: visible;
  }
  .article-list-meta {
    width: 100%;
    justify-content: flex-start;
  }
}

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
input[type="text"], input[type="password"], input[type="date"], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit;
  background: var(--bg-input);
  color: var(--text-main);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; }
/* 编辑器 */
.editor-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.editor-toolbar {
  background: #f8f9fa; border-bottom: 1px solid var(--border);
  padding: 8px 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.editor-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.editor-panes { display: grid; grid-template-columns: 1fr 1fr; min-height: 500px; }
.editor-panes textarea {
  border: none; border-right: 1px solid var(--border); min-height: 500px;
  width: 100%; box-sizing: border-box; padding: 16px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; line-height: 1.7;
}
.editor-preview {
  padding: 16px; overflow: auto; background: var(--bg-card);
}

/* 预览内容样式 */
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { margin-top: 24px; margin-bottom: 12px; }
.markdown-body p { margin: 0 0 12px; }
.markdown-body img { max-width: 100%; border-radius: 4px; }
.markdown-body pre { background: var(--bg-hover); padding: 16px; border-radius: 6px; overflow: auto; }
.markdown-body code { font-family: "SFMono-Regular", Consolas, monospace; background: var(--bg-hover); padding: 2px 6px; border-radius: 4px; }
.markdown-body blockquote { border-left: 4px solid var(--primary); margin: 0; padding: 0 16px; color: var(--text-muted); }
.markdown-body table { border-collapse: collapse; width: 100%; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 8px; }

/* Tag */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-soft); color: var(--primary); padding: 3px 10px; border-radius: 20px;
  font-size: 13px; cursor: pointer;
}
.tag:hover { background: #dbeafe; text-decoration: none; }
.tag.active { background: var(--primary); color: var(--text-inverse); }
.tag.dim { background: var(--bg-hover); color: var(--text-muted); }
.tag:hover { background: #dbeafe; text-decoration: none; }
.tag.active { background: var(--primary); color: var(--text-inverse); }
.tag.dim { background: var(--bg-hover); color: var(--text-muted); }
.tag.tag-small { padding: 1px 6px; font-size: 11px; border-radius: 12px; }

/* 树 */
.tree-node { padding: 6px 0; }
.tree-row { display: flex; align-items: center; gap: 8px; }
.tree-children { padding-left: 20px; }

/* 标签管理树 */
.tag-tree {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tag-tree li {
  border-bottom: 1px solid var(--border);
}
.tag-tree li:last-child {
  border-bottom: none;
}
.tag-tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
}
.tag-tree-row:hover {
  background: #f8f9fa;
}
.tag-tree-toggle {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: bold;
  border-radius: 4px;
}
.tag-tree-toggle:hover {
  background: var(--border);
}
.tag-tree-spacer {
  width: 18px;
}
.tag-tree-name {
  flex: 1;
}
.tag-tree .tag-tree {
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  margin-left: 24px;
}
.tag-tree .tag-tree li:last-child {
  border-bottom: none;
}
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  user-select: none;
  padding: 0 4px;
  font-size: 12px;
}
.drag-handle:active { cursor: grabbing; }
.tag-tree-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.7;
  transition: opacity .15s;
}
.tag-tree-row:hover .tag-tree-actions { opacity: 1; }
.tag-tree-name {
  flex: 1;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: text;
}
.tag-tree-name:hover { background: var(--bg-hover); }
.tag-edit-input {
  flex: 1;
  padding: 4px 6px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  outline: none;
}
.tag-tree-row.drag-before {
  border-top: 2px solid var(--primary);
}
.tag-tree-row.drag-after {
  border-bottom: 2px solid var(--primary);
}
.tag-tree-row.drag-over-child {
  background: var(--primary-soft);
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
}
.tag-tree-root-drop {
  padding: 8px 12px;
  color: var(--text-muted);
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  margin: 4px 0;
  background: var(--bg-hover);
}
.tag-tree-root-drop.drag-over,
.tag-tree-root-drop:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* 标签搜索选择器 */
.tag-search-selector {
  position: relative;
}
.tag-search-input-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  min-height: 40px;
}
.tag-search-input-wrap:focus-within {
  border-color: var(--primary);
}
.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 12px;
  font-size: 13px;
}
.tag-badge-remove {
  border: none;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}
.tag-badge-remove:hover { color: var(--danger); }
.tag-search-input {
  flex: 1;
  min-width: 120px;
  border: none;
  outline: none;
  background: transparent;
  padding: 4px;
  font-size: 14px;
}
.tag-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
}
.tag-search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  gap: 8px;
}
.tag-search-item:hover { background: var(--bg-hover); }
.tag-search-path {
  color: var(--text-muted);
  font-size: 12px;
}
.tag-search-empty {
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Vditor 编辑器 */
.vditor-editor { min-height: 360px; }

/* 介绍页 */
.intro-page { margin: 0 auto; }
.intro-title {
  font-size: 42px;
  margin: 0 0 8px;
  color: var(--primary);
}
.page-title {
  font-size: 32px;
  margin: 0 0 12px;
  color: var(--primary);
  font-weight: 600;
}
@media (max-width: 768px) {
  .page-title { font-size: 26px; }
}
.intro-lead {
  font-size: 18px;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.intro-note {
  background: var(--primary-soft);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 15px;
  margin: 0 0 24px;
}
.intro-page h3 { margin-top: 28px; }
.intro-list { padding-left: 20px; }
.intro-list li { margin-bottom: 10px; line-height: 1.7; }
.intro-actions { margin-top: 28px; display: flex; gap: 12px; }

.btn-large {
  padding: 12px 28px;
  font-size: 16px;
}

/* 侧边栏日历 */
.calendar-widget {
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
}
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  position: relative;
  transition: background .15s;
}
.calendar-day:hover { background: var(--bg-hover); }
.calendar-day.out-month { color: #c0c4cc; cursor: default; }
.calendar-day:not(.has-article):not(.has-event):not(.has-contest):not(.out-month) { cursor: default; }
.calendar-day:not(.has-article):not(.has-event):not(.has-contest):not(.out-month):hover { background: transparent; }
.calendar-day.today { background: var(--primary-soft); font-weight: bold; color: var(--primary); }
.calendar-day-num { line-height: 1; }
.calendar-dots {
  display: flex;
  gap: 3px;
  margin-top: 2px;
  height: 5px;
  align-items: center;
  justify-content: center;
}
.calendar-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.calendar-dot.event { background: var(--danger); }
.calendar-dot.contest { background: var(--info); }
.calendar-dot.article { background: var(--success); }
.calendar-countdowns {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.calendar-countdown {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.calendar-countdown strong { color: var(--primary); }
.calendar-contests {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.calendar-contests-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}
.calendar-contest {
  display: block;
  padding: 5px 8px;
  margin-bottom: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.calendar-contest:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
  text-decoration: none;
}
.calendar-contest-header {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
}
.calendar-contest-platform {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}
.calendar-contest-platform-text {
  font-size: 9px;
  font-weight: 600;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--primary-gradient);
  color: var(--text-inverse);
  line-height: 1.4;
  flex-shrink: 0;
}
.calendar-contest-name {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-contest-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.calendar-contest-time {
  font-size: 11px;
  color: var(--text-muted);
}
.calendar-contest-countdown {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* 日程表页面 */
.calendar-page-card {
  padding: 20px;
}
.calendar-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.calendar-page-header .page-title {
  margin-bottom: 0;
}
.calendar-page-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.calendar-page-view-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.calendar-page-view-switch .btn {
  border: none;
  border-radius: 0;
  background: var(--bg-card);
}
.calendar-page-view-switch .btn.active {
  background: var(--primary);
  color: #fff;
}
.calendar-page-view-switch .btn + .btn {
  border-left: 1px solid var(--border);
}
.calendar-page-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.calendar-page-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
  min-width: 140px;
  text-align: center;
}
.calendar-page-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.calendar-page-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.calendar-page-day {
  min-height: 80px;
  max-height: 120px;
  background: var(--bg-card);
  padding: 6px;
  cursor: pointer;
  transition: background .15s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.calendar-page-day:hover { background: var(--bg-hover); }
.calendar-page-day.out-month { color: rgba(0,0,0,0.5); cursor: default; }
.calendar-page-day.out-month .calendar-page-day-num { color: rgba(0,0,0,0.5); }
[data-theme="dark"] .calendar-page-day.out-month,
[data-theme="dark"] .calendar-page-day.out-month .calendar-page-day-num { color: rgba(255,255,255,0.45); }
.calendar-page-day.rest-day { background: #f5f5f5; }
[data-theme="dark"] .calendar-page-day.rest-day { background: rgba(255,255,255,0.08); }
.calendar-page-day.today { background: var(--primary-soft); }
.calendar-page-day-num {
  font-size: 13px;
  font-weight: 500;
  display: block;
  margin-bottom: 4px;
  color: var(--text-main);
  flex-shrink: 0;
}
.calendar-page-day-holiday {
  float: right;
  font-size: 10px;
  padding: 0 4px;
  border-radius: 3px;
  line-height: 1.5;
  font-weight: 600;
}
.calendar-page-day-holiday.holiday { background: #fee2e2; color: #dc2626; }
.calendar-page-day-holiday.workday { background: #dbeafe; color: #2563eb; }
[data-theme="dark"] .calendar-page-day-holiday.holiday { background: rgba(220,38,38,0.2); color: #fca5a5; }
[data-theme="dark"] .calendar-page-day-holiday.workday { background: rgba(37,99,235,0.2); color: #93c5fd; }
.calendar-page-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  min-height: 0;
}
.calendar-page-event {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-main);
  overflow: hidden;
  flex-shrink: 0;
}
.calendar-page-event.contest { background: var(--info-bg); color: var(--info); }
.calendar-page-event.countdown { background: var(--danger-bg); color: var(--danger); }
.calendar-page-event-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.calendar-page-event-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-page-event-time {
  font-size: 10px;
  opacity: 0.85;
  flex-shrink: 0;
}
.calendar-page-more {
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  padding: 0 4px;
  flex-shrink: 0;
}
.calendar-page-week-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--bg-card);
}
.calendar-page-week-header-row {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(110px, 1fr));
  min-width: max-content;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.calendar-page-week-time-label-col {
  border-right: 1px solid var(--border);
}
.calendar-page-week-day-header {
  padding: 6px 4px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.calendar-page-week-day-header:last-child { border-right: none; }
.calendar-page-week-day-header.today { background: var(--primary-soft); }
.calendar-page-week-day-header.rest-day:not(.today) { background: #f5f5f5; }
[data-theme="dark"] .calendar-page-week-day-header.rest-day:not(.today) { background: rgba(255,255,255,0.08); }
.calendar-page-week-date-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.calendar-page-week-holiday-badge {
  font-size: 9px;
  padding: 0 3px;
  border-radius: 3px;
  line-height: 1.4;
  font-weight: 600;
}
.calendar-page-week-holiday-badge.holiday { background: #fee2e2; color: #dc2626; }
.calendar-page-week-holiday-badge.workday { background: #dbeafe; color: #2563eb; }
[data-theme="dark"] .calendar-page-week-holiday-badge.holiday { background: rgba(220,38,38,0.2); color: #fca5a5; }
[data-theme="dark"] .calendar-page-week-holiday-badge.workday { background: rgba(37,99,235,0.2); color: #93c5fd; }
.calendar-page-week-weekday {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
}
.calendar-page-week-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}
.calendar-page-week-all-day-row {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(110px, 1fr));
  min-width: max-content;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.calendar-page-week-all-day-row .calendar-page-week-time-label-col {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-size: 10px;
  color: var(--text-muted);
}
.calendar-page-week-day-all-day {
  padding: 4px;
  border-right: 1px solid var(--border);
  min-height: 28px;
}
.calendar-page-week-day-all-day:last-child { border-right: none; }
.calendar-page-week-all-day-event {
  font-size: 10px;
  padding: 2px 4px;
  margin-bottom: 2px;
  border-radius: 3px;
  background: var(--danger-bg);
  color: var(--danger);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-page-week-body {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(110px, 1fr));
  min-width: max-content;
  position: relative;
  min-height: 180px;
}
.calendar-page-week-time-col {
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
}
.calendar-page-week-time-slot {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-right: 6px;
  padding-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-main);
  box-sizing: border-box;
  border-bottom: 1px dashed var(--border);
}
.calendar-page-week-day-col {
  border-right: 1px solid var(--border);
  position: relative;
}
.calendar-page-week-day-col:last-child { border-right: none; }
.calendar-page-week-day-col.today { background: var(--primary-soft); }
.calendar-page-week-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}
.calendar-page-week-grid-line {
  box-sizing: border-box;
  border-bottom: 1px dashed var(--border);
}
.calendar-page-week-event {
  position: absolute;
  left: 2px;
  right: 2px;
  padding: 2px 4px;
  border-radius: 3px;
  background: var(--bg-hover);
  color: var(--text-main);
  font-size: 10px;
  overflow: hidden;
  box-sizing: border-box;
  z-index: 1;
  display: flex;
  flex-direction: column;
}
.calendar-page-week-event.contest { background: var(--info-bg); color: var(--info); }
.calendar-page-week-event.countdown { background: var(--danger-bg); color: var(--danger); }
.calendar-page-week-event-main { position: relative; width: 100%; height: 100%; min-height: 0; }
.calendar-page-week-event-start {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.9;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
}
.calendar-page-week-event-title-row {
  display: flex;
  align-items: center;
  gap: 3px;
  padding-top: 14px;
  padding-bottom: 10px;
  overflow: hidden;
}
.calendar-page-week-event-logo {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
  object-fit: contain;
}
.calendar-page-week-event-title {
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-page-week-event-end {
  position: absolute;
  bottom: 0;
  right: 0;
  font-size: 9px;
  font-weight: 600;
  opacity: 0.85;
  padding-left: 4px;
  background: inherit;
  z-index: 2;
}
.calendar-page-week-event-time {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.9;
}
.calendar-page-event-logo {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
  object-fit: contain;
}
.calendar-tooltip {
  position: fixed;
  z-index: 101;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 10px 12px;
  max-width: 260px;
  pointer-events: none;
  font-size: 12px;
}
.calendar-tooltip-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.calendar-tooltip-title {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 3px;
}
.calendar-tooltip-time {
  color: var(--text-muted);
  font-size: 11px;
  margin-bottom: 4px;
}
.calendar-tooltip-desc {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}
.calendar-page-year {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.calendar-page-year-month {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--bg-card);
}
.calendar-page-year-month-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text-main);
}
.calendar-page-year-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.calendar-page-year-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.calendar-page-year-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border-radius: 4px;
  color: var(--text-main);
}
.calendar-page-year-holiday {
  margin-left: 2px;
  font-size: 9px;
  padding: 0 2px;
  border-radius: 2px;
  vertical-align: top;
  font-weight: 600;
}
.calendar-page-year-holiday.holiday { background: #fee2e2; color: #dc2626; }
.calendar-page-year-holiday.workday { background: #dbeafe; color: #2563eb; }
[data-theme="dark"] .calendar-page-year-holiday.holiday { background: rgba(220,38,38,0.2); color: #fca5a5; }
[data-theme="dark"] .calendar-page-year-holiday.workday { background: rgba(37,99,235,0.2); color: #93c5fd; }
.calendar-page-year-day.out-month { color: var(--text-muted); opacity: 0.4; }
.calendar-page-year-day.today { background: var(--primary-soft); font-weight: 600; color: var(--primary); }
.calendar-page-year-day.has-event { background: var(--info-bg); color: var(--info); font-weight: 500; }
.calendar-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
}
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overscroll-behavior: none;
}
body.modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}
.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  position: relative;
  margin: auto;
}
.modal-card h3 {
  margin: 0 0 16px;
  font-size: 18px;
  color: var(--text-main);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.events-table-compact th,
.events-table-compact td {
  padding: 4px 6px;
  font-size: 12px;
}
.events-table-compact th {
  font-weight: 600;
}
.events-table-compact .btn-small {
  padding: 2px 6px;
  font-size: 11px;
}
.events-table-compact .toggle-switch {
  width: 30px;
  height: 16px;
}
.events-table-compact .toggle-slider:before {
  width: 12px;
  height: 12px;
}
.events-table-compact input:checked + .toggle-slider:before {
  transform: translateX(14px);
}
.events-table-compact tr.event-hidden {
  opacity: 0.7;
  background: rgba(0, 0, 0, 0.02);
}
.events-table-compact tr.event-hidden td {
  color: var(--text-muted);
}
.events-table-compact tr.events-hidden-separator td {
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
}
  .calendar-page-year { grid-template-columns: repeat(3, 1fr); }
  .calendar-page-week { grid-template-columns: repeat(7, 1fr); }
}
@media (max-width: 768px) {
  .calendar-page-card { padding: 16px; }
  .calendar-page-header { gap: 8px; }
  .calendar-page-title { min-width: auto; font-size: 13px; }
  .calendar-page-day { min-height: 60px; max-height: 90px; }
  .calendar-page-event { font-size: 10px; }
  .calendar-page-week { grid-template-columns: 1fr; }
  .calendar-page-week-day { min-height: auto; }
  .calendar-page-year { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .calendar-page-year { grid-template-columns: 1fr; }
}

/* 日期详情页 */
.day-event-list { padding-left: 20px; }
.day-event-list li { margin-bottom: 8px; }

/* 登录：全局去掉卡片外观后，登录页单独保留盒子 */
.login-box {
  max-width: 360px;
  margin: 80px auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* 消息 */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 100;
  padding: 12px 18px; border-radius: var(--radius); color: var(--text-inverse);
  box-shadow: var(--shadow);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* 移动端头部菜单 */
.mobile-menu-toggle,
.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-main);
}
.theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mobile-menu-toggle {
  margin-left: 12px;
}
.sidebar-toggle {
  padding: 0;
  margin-right: 8px;
}
.sidebar-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.mobile-menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.app-header.menu-open .mobile-menu-toggle span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.app-header.menu-open .mobile-menu-toggle span:nth-child(2) {
  opacity: 0;
}
.app-header.menu-open .mobile-menu-toggle span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}
.mobile-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 8px 0;
  z-index: 9;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.mobile-nav.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.mobile-nav a {
  display: block;
  padding: 12px 24px;
  color: var(--text-main);
  font-size: 15px;
  font-weight: 500;
  border-bottom: 1px solid transparent;
}
.mobile-nav a:hover { color: var(--primary); text-decoration: none; background: var(--bg-hover); }
/* 系统设置 Tab */
.settings-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  flex-wrap: wrap;
}

/* 文章详情上一篇/下一篇 */
.article-top-nav {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.article-top-nav-side {
  flex: 1;
  display: flex;
  min-width: 0;
}
.article-top-nav a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text-main);
  max-width: 100%;
}
.article-top-nav a:hover { text-decoration: none; color: var(--primary); }
.article-top-nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.article-nav-prev { align-items: flex-start; }
.article-nav-next { align-items: flex-end; text-align: right; }

/* AtCoder 数据展示（关于我页面） */
.atcoder-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.atcoder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.atcoder-title {
  margin: 0;
  font-size: 18px;
  color: var(--text-main);
}

.atcoder-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--primary);
  font-weight: 500;
}

.atcoder-loading,
.atcoder-error {
  padding: 16px;
  border-radius: var(--radius);
  font-size: 14px;
  text-align: center;
}

.atcoder-loading {
  background: var(--primary-soft);
  color: var(--primary);
}

.atcoder-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.atcoder-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.atcoder-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 6px;
  text-align: center;
  transition: box-shadow .15s ease;
}

.atcoder-stat:hover { box-shadow: var(--shadow); }

.atcoder-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  word-break: break-word;
}

.atcoder-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 统计槽位占位格子：仅保留格子外形，内容透明 */
.atcoder-stat.is-spacer {
  border: 1px dashed var(--border);
  background: transparent;
  box-shadow: none;
}

.atcoder-stat.is-spacer:hover {
  box-shadow: none;
}

.atcoder-stat.is-spacer .atcoder-stat-value,
.atcoder-stat.is-spacer .atcoder-stat-label {
  color: transparent;
}

.atcoder-chart-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}

.atcoder-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
}

.atcoder-chart {
  width: 100%;
  cursor: crosshair;
  -webkit-tap-highlight-color: transparent;
}

.atcoder-chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

.atcoder-chart-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.atcoder-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.atcoder-cache-badge,
.luogu-cache-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
}

.atcoder-tooltip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 10px 14px;
  max-width: 260px;
}

.atcoder-tooltip-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
  word-break: break-word;
  line-height: 1.35;
}

.atcoder-tooltip-row {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.atcoder-tooltip-rating {
  font-size: 18px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .atcoder-stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .atcoder-stat-value {
    font-size: 14px;
  }
}

/* 洛谷数据展示（关于我页面） */
.luogu-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.luogu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.luogu-title {
  margin: 0;
  font-size: 18px;
  color: var(--text-main);
}

.luogu-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--primary);
  font-weight: 500;
}

.luogu-loading,
.luogu-error {
  padding: 16px;
  border-radius: var(--radius);
  font-size: 14px;
  text-align: center;
}

.luogu-loading {
  background: var(--primary-soft);
  color: var(--primary);
}

.luogu-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.luogu-stats {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

/* 第一行为共同指标（比赛分/CCF 等级），2 列；第二行其余 9 项 3 列 */
.luogu-stats-row1 {
  grid-template-columns: repeat(2, 1fr);
}

.luogu-stats-row2 {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 16px;
}

.luogu-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 6px;
  text-align: center;
  transition: box-shadow .15s ease;
}

.luogu-stat:hover { box-shadow: var(--shadow); }

.luogu-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  word-break: break-word;
}

.luogu-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

@media (max-width: 640px) {
  .luogu-stats-row1 {
    grid-template-columns: repeat(3, 1fr);
  }
  .luogu-stats-row2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .luogu-stat-value {
    font-size: 14px;
  }
}

.luogu-chart-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}

.luogu-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
}

.luogu-chart {
  width: 100%;
}

.luogu-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.luogu-chart-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.luogu-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.luogu-cache-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
}

.luogu-tooltip {
  max-width: 220px;
}

@media (max-width: 640px) {
  .luogu-stats-row1 {
    grid-template-columns: repeat(4, 1fr);
  }
  .luogu-stats-row2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .luogu-stat-value {
    font-size: 14px;
  }
}

/* 三张趋势图对比区（关于我页面）：统一时间轴、公用横坐标、三图贴紧排列 */
.oj-charts-compare {
  margin-top: 24px;
  padding: 8px 10px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.oj-chart-item {
  padding: 0;
}

.oj-chart-svg {
  display: block;
  width: 100%;
  cursor: crosshair;
  -webkit-tap-highlight-color: transparent;
}

.oj-chart-svg svg {
  display: block;
  width: 100%;
  height: auto;
}

.oj-chart-empty {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* 统计数据汇总区（图表下方） */
.oj-stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* 窄屏时三卡折为单列 */
@media (max-width: 960px) {
  .oj-stats-summary {
    grid-template-columns: 1fr;
  }
}

.oj-stats-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.oj-stats-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

/* 统计卡左上角 OJ 图标链接 */
.oj-stats-icon-link {
  display: inline-flex;
  align-items: center;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.oj-stats-icon-link:hover {
  opacity: 1;
}

.oj-stats-icon {
  width: 24px;
  height: 24px;
  display: block;
}



.oj-stats-block .atcoder-stats,
.oj-stats-block .luogu-stats {
  margin-bottom: 10px;
}

/* 本地做题趋势热度图 */
.practice-heatmap-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.practice-heatmap-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 14px;
}

.practice-heatmap-loading,
.practice-heatmap-error,
.practice-heatmap-empty {
  padding: 16px;
  border-radius: var(--radius);
  font-size: 14px;
  text-align: center;
}

.practice-heatmap-loading {
  background: var(--primary-soft);
  color: var(--primary);
}

.practice-heatmap-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.practice-heatmap-empty {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.practice-heatmap {
  background: var(--bg-card);
  padding: 8px 0 0;
  overflow-x: auto;
  cursor: inherit;
}

.practice-heatmap-svg {
  display: block;
  width: 100%;
  min-width: 260px;
  height: auto;
}

/* 做题趋势图时间范围滑块（鼠标悬停时出现） */
.practice-heatmap-wrap {
  position: relative;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.practice-heatmap-wrap.dragging {
  cursor: grabbing;
}

.practice-heatmap-slider {
  margin-top: 2px;
  padding: 0 10px;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.practice-heatmap-wrap:hover .practice-heatmap-slider {
  opacity: 1;
  pointer-events: auto;
}

.practice-heatmap-slider input[type='range'] {
  display: block;
  width: 100%;
  height: 14px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: grab;
}

.practice-heatmap-slider input[type='range']:active {
  cursor: grabbing;
}

.practice-heatmap-slider input[type='range']::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

.practice-heatmap-slider input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.practice-heatmap-slider input[type='range']::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

.practice-heatmap-slider input[type='range']::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.practice-heat-cell {
  transition: opacity .15s ease;
}

.practice-heat-cell:hover {
  opacity: .7;
  stroke: var(--text-main);
  stroke-width: 1;
}

.practice-tooltip {
  max-width: 220px;
}

/* 难度标签统一样式 */
.vditor-diff-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;           /* 统一高度 24px */
  border-radius: 0;       /* 色块无圆角 */
  padding: 0 6px;         /* 左右边距固定，宽度由内容自适应 */
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
  font-size: 17px;
  font-weight: 500;
  line-height: 23px;      /* 减小行高，配合下 padding 让文字上移 0.5px */
  box-sizing: border-box;
  vertical-align: middle;
  padding: 0 6px 1px 6px;  /* 下 padding 增加 1px，把文字往上顶 0.5px */
  position: relative;
  top: -2px;                /* 整个标签向上移 2px */
  white-space: nowrap;
}

.vditor-diff-tag--unknown {
  background-color: #9ca3af;
  color: var(--text-inverse);
  width: auto;
}

/* 难度标签自定义下拉菜单 */
.vditor-diff-tag-dropdown {
  position: fixed;
  z-index: 1000;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 130px;
}

.vditor-diff-tag-dropdown-item {
  padding: 5px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background .15s ease;
}

.vditor-diff-tag-dropdown-item:hover {
  background: var(--primary-soft);
}

.vditor-diff-tag-dropdown-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  border-radius: 0;
  padding: 0 10px;
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

/* CF 自定义标签 */
/* CF 自定义标签 */
.vditor-cf-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  border-radius: 0;
  padding: 0 6px 1px 6px;
  background-color: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
  font-size: 17px;
  font-weight: 500;
  line-height: 21px;
  box-sizing: border-box;
  vertical-align: middle;
  position: relative;
  top: -2px;
  white-space: nowrap;
}

.vditor-cf-tag-dropdown-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  border-radius: 0;
  padding: 0 10px;
  background-color: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

/* AC/UNAC 状态标签 */
.vditor-ac-tag,
.vditor-unac-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  border-radius: 0;
  padding: 0 6px 1px 6px;
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
  font-size: 17px;
  font-weight: 500;
  line-height: 23px;
  box-sizing: border-box;
  vertical-align: middle;
  position: relative;
  top: -2px;
  white-space: nowrap;
}

.vditor-ac-tag { background-color: var(--success); color: #fff; }
.vditor-unac-tag { background-color: var(--danger); color: #fff; }

.vditor-ac-tag-dropdown-badge,
.vditor-unac-tag-dropdown-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  border-radius: 0;
  padding: 0 10px;
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.vditor-ac-tag-dropdown-badge { background-color: var(--success); color: #fff; }
.vditor-unac-tag-dropdown-badge { background-color: var(--danger); color: #fff; }

.crawl-status-pending,
.crawl-status-success,
.crawl-status-failed {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.crawl-status-pending { background-color: #fef3c7; color: #92400e; }
.crawl-status-success { background-color: #dcfce7; color: #166534; }
.crawl-status-failed { background-color: #fee2e2; color: #991b1b; }

.oj-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  margin-right: 4px;
}

.oj-badge-luogu { background-color: #22c55e; color: var(--text-inverse) !important; }
.oj-badge-luogu:hover { background-color: #16a34a; }

.oj-badge-atcoder { background-color: #eff6ff; color: #2563eb !important; }
.oj-badge-atcoder:hover { background-color: #dbeafe; }

.oj-badge-codeforces { background-color: #fef2f2; color: #dc2626 !important; }
.oj-badge-codeforces:hover { background-color: #fecaca; }
/* AC 档案 */
/* AC 档案 */
.ac-archive-group { margin-bottom: 16px; }
.ac-archive-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.ac-archive-group-header:hover .vditor-diff-tag {
  filter: brightness(0.94);
}
.ac-archive-arrow {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.ac-archive-group-header.expanded .ac-archive-arrow {
  transform: rotate(90deg);
}
.ac-archive-group-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.ac-archive-group-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--primary);
  color: var(--text-main);
}
.ac-archive-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}
.ac-archive-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin-bottom: 6px;
  line-height: 1.6;
}
.ac-archive-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: middle;
}
/* 无图标的 OJ（LOJ/QOJ 等）：文字缩写徽标 */
.ac-archive-icon-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.ac-archive-problems {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  flex: 1;
}
.ac-archive-problem {
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  white-space: nowrap;
}
.ac-archive-problem:hover { text-decoration: underline; }
/* 文章预览区题号标签渲染 */
.problem-link-badge {
  text-decoration: none;
}

.problem-link-badge:hover {
  opacity: 0.9;
}

.problem-tag-link {
  color: var(--primary);
  text-decoration: none;
  font-size: inherit;
  vertical-align: middle;
}

.problem-tag-link:hover {
  text-decoration: underline;
}

/* 开关 */
/* 开关 */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #d1d5db;
  border-radius: 20px;
  transition: .2s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: .2s;
}

.toggle-switch input:checked + .toggle-slider { background-color: var(--success); }

.toggle-switch input:checked + .toggle-slider:before { transform: translateX(16px); }

.toggle-switch.disabled { cursor: not-allowed; opacity: .6; }

/* 题目通过开关：未通过时显示红色 */
.passed-toggle .toggle-slider { background-color: var(--danger); }

.public-toggle input:checked + .toggle-slider { background-color: var(--primary); }

.problemset-progress {
  position: relative;
  width: 100%;
  height: 18px;
  background: var(--bg-hover);
  border-radius: 9px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.problemset-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--primary);
  border-radius: 9px;
  z-index: 1;
}
.problemset-progress-text {
  position: relative;
  z-index: 2;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 0 2px rgba(0,0,0,0.8), 0 1px 1px rgba(0,0,0,0.6);
  line-height: 1;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
.spinning { animation: spin 1s linear infinite; }
/* 通用表格横向溢出保护（桌面端也生效，防止长内容撑破容器） */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
}

/* OJ 题目管理表格 */
/* OJ 题目管理表格 */
.oj-problems-table { border-collapse: collapse; }

.oj-problems-table th,
.oj-problems-table td {
  border-left: none;
  border-right: none;
  padding: 10px 12px;
  vertical-align: middle;
}

.oj-problems-table thead tr { border-top: none; }
.oj-problems-table tbody tr:last-child td { border-bottom: none; }

.oj-problems-table .oj-problem-id-cell {
  cursor: pointer;
  min-width: 100px;
}

.oj-problems-table .oj-problem-id-cell.clickable {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-style: dotted;
}

.oj-problems-table .oj-problem-id-cell:hover { background-color: var(--primary-soft); }

.oj-problems-table .oj-problem-id-cell input {
  padding: 4px 6px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  font-size: 13px;
}

/* 表头排序与筛选 */
.oj-problems-table th { position: relative; }

.oj-problems-table .th-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 80px;
}

.oj-problems-table .sortable {
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.oj-problems-table .sort-icon {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
}

.oj-problems-table .filter-btn {
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1.4;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.oj-problems-table .filter-btn:hover,
.oj-problems-table .filter-btn.active {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--primary);
}

.filter-dropdown {
  position: fixed;
  max-height: 70vh;
  overflow-y: auto;
  min-width: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  z-index: 1200;
  padding: 4px 0;
}

.filter-dropdown-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: background 0.1s;
}

.filter-dropdown-item:hover { background-color: var(--bg-hover); }

.filter-dropdown-item.active {
  color: var(--primary);
  font-weight: 500;
}

.filter-divider {
  height: 1px;
  margin: 4px 10px;
  background: var(--border);
}

.filter-dropdown-section-title {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: none;
  text-align: center;
  cursor: default;
}
.filter-dropdown-cols {
  display: flex;
  align-items: stretch;
}
.filter-col {
  min-width: 150px;
}
.filter-col + .filter-col {
  border-left: 1px solid var(--border);
}
/* AC 档案难度柱状图 */
/* AC 档案难度柱状图 */
.ac-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 160px;
  padding: 16px 4px 0;
  border-bottom: 1px solid var(--border);
}

.ac-bar-chart-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  height: 100%;
  text-align: center;
}

.ac-bar-chart-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.2;
  margin-bottom: 2px;
}

.ac-bar-chart-track {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.ac-bar-chart-bar-wrap {
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.ac-bar-chart-bar {
  flex: 1;
  width: 100%;
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
  opacity: 0.9;
}

.ac-bar-chart-bar:hover { opacity: 1; }

/* UOJ/LOJ/QOJ 专用列：左上黑、右下紫，与做题趋势热度图的双色方块一致 */
.ac-bar-chart-bar--special {
  background: linear-gradient(135deg, #000000 50%, #9C3DCF 50%);
}

.ac-archive-special-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
  background: linear-gradient(135deg, #000000 50%, #9C3DCF 50%);
}

.ac-bar-chart-labels {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  padding: 6px 4px 0;
}

.ac-bar-chart-labels .ac-bar-chart-label {
  flex: 1;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
  white-space: normal;
  word-break: keep-all;
}

@media (max-width: 640px) {
  .ac-bar-chart { height: 120px; }
  .ac-bar-chart-labels .ac-bar-chart-label { font-size: 10px; }
}

/* 响应式布局：平板和手机 */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .app-header { padding: 0 12px; height: 56px; }
  .app-body.with-header { padding-top: 56px; }

  .brand h1 { display: none; }
  .brand span { display: none; }
  .brand-logo { width: 32px; height: 32px; }

  .header-actions { gap: 8px; }
  .top-nav { display: none; }
  .mobile-menu-toggle,
  .sidebar-toggle { display: flex; }

  .mobile-nav {
    display: flex;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    z-index: 9;
  }

  .sidebar {
    top: 56px;
    width: 80%;
    max-width: 280px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 20;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .main,
  .main.with-sidebar,
  .main.main-full,
  .main.main-full.with-sidebar {
    margin-left: 0;
    padding: 16px;
  }
  .app-footer,
  .app-footer.with-sidebar { margin-left: 0; padding: 16px; }

  .card {
    padding: 16px;
    border-radius: var(--radius-sm);
  }
  .card-title { font-size: 18px; }

  .article-top-nav {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
  }
  .article-top-nav-side { flex: 1; min-width: 0; }
  .article-nav-prev,
  .article-nav-next { align-items: flex-start; text-align: left; }

  /* 头部 flex 栏在移动端自动堆叠（文章标题/按钮等） */
  .page-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .page-header > div[style*="display:flex"] {
    justify-content: flex-start !important;
  }
  .modal-header {
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
  }
  .modal-header h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .form-group input,
  .form-group select,
  .form-group textarea,
  .form-group .vditor-editor {
    width: 100%;
  }

  .vditor-editor { height: calc(100vh - 220px) !important; min-height: 320px !important; }
  .vditor-sv .vditor-preview { display: none !important; }
  .vditor-sv .vditor-editor { width: 100% !important; }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }
  .table-responsive table {
    width: 100%;
    min-width: max-content;
  }

  .btn { padding: 8px 12px; font-size: 13px; }
  .btn-small { padding: 4px 8px; font-size: 12px; }

  .user-menu-dropdown { min-width: 140px; }

  .modal-overlay { padding: 12px; }
  .modal-card {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 24px);
    padding: 16px;
    border-radius: var(--radius-sm);
  }
  .modal-card h3 { font-size: 16px; margin-bottom: 12px; }
  .modal-actions { margin-top: 16px; gap: 8px; }

  .toast {
    top: 12px;
    right: 12px;
    left: 12px;
    max-width: calc(100% - 24px);
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* 题目列表卡片式响应式布局 */
.problem-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.problem-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-card);
}
.problem-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.problem-card-id {
  font-family: monospace;
  font-weight: 600;
  color: var(--text-muted);
  word-break: break-all;
}
.problem-card-title {
  font-weight: 500;
  flex: 1;
  min-width: 120px;
  word-break: break-word;
}
.problem-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--text-main);
}
.problem-card-body > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.problem-card-body > div > strong {
  flex-shrink: 0;
  color: var(--text-muted);
  font-weight: 500;
}
.problem-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* 更小屏幕的额外收紧 */
@media (max-width: 480px) {
  .main { padding: 12px; }
  .card { padding: 12px; }
  .article-top-nav a { font-size: 13px; }
  .mobile-nav a { padding: 12px 16px; }
}

/* AI 分析侧边栏 */
.article-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.article-main {
  flex: 0 0 1100px;
  min-width: 0;
}
.article-ai-sidebar {
  flex: 1 1 0;
  min-width: 280px;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.article-ai-sidebar::-webkit-scrollbar {
  display: none;
}
.article-ai-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.article-ai-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
}
.article-ai-status {
  font-size: 11px;
  color: var(--text-muted);
}
.article-ai-login,
.article-ai-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
}
.article-ai-empty p { margin: 0 0 10px; }
.article-ai-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 10px;
}
.article-ai-stale {
  background: var(--warning-bg);
  color: var(--warning);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.article-ai-content {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-main);
}
.article-ai-content.vditor-reset h1,
.article-ai-content.vditor-reset h2,
.article-ai-content.vditor-reset h3,
.article-ai-content.vditor-reset h4,
.article-ai-content.vditor-reset h5,
.article-ai-content.vditor-reset h6 {
  font-size: 1.15em;
  margin: 0.6em 0;
}
.article-ai-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 1700px) {
  .article-layout {
    flex-direction: column;
  }
  .article-main {
    flex: 0 0 auto;
    width: 100%;
  }
  .article-ai-sidebar {
    flex: 0 0 auto;
    width: 100%;
    min-width: auto;
    position: static;
    max-height: none;
    overflow: visible;
    order: 0;
  }
}

/* ================= Tag Treemap ================= */
.tag-treemap-card {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 220px);
}
.tag-treemap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.tag-treemap-stage {
  flex: 1;
  position: relative;
  min-height: 360px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: var(--bg-card, #ffffff);
  overflow: hidden;
  margin-top: 12px;
}
.tag-treemap-svg {
  display: block;
  width: 100%;
  height: 100%;
}
.tag-treemap-cell {
  cursor: pointer;
}
.tag-treemap-cell rect {
  transition: filter 0.15s ease;
}
.tag-treemap-cell:hover rect {
  filter: brightness(1.1);
}
.tag-treemap-label {
  pointer-events: none;
  user-select: none;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}
.tag-treemap-tooltip {
  position: absolute;
  z-index: 30;
  display: none;
  pointer-events: none;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.92);
  color: #f9fafb;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.tag-treemap-tip-name {
  font-weight: 600;
  margin-bottom: 2px;
}

@media (max-width: 768px) {
  .tag-treemap-stage {
    min-height: 360px;
  }
}

/* ==================== 首页仪表盘 ==================== */
.dash-greet {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.dash-date { color: var(--text-muted); font-size: 13px; }
.dash-title { margin: 0; font-size: 24px; }
.dash-actions { display: flex; gap: 8px; }
.dash-loading { color: var(--text-muted); padding: 40px 0; text-align: center; }

/* 统计条：扁平分区，细边框分隔 */
.dash-stats {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.dash-stat {
  flex: 1 1 120px;
  padding: 16px 12px;
  text-align: center;
}
.dash-stat + .dash-stat { border-left: 1px solid var(--border); }
.dash-stat-num { font-size: 28px; font-weight: 700; line-height: 1.2; }
.dash-stat-unit { font-size: 13px; font-weight: 400; color: var(--text-muted); margin-left: 2px; }
.dash-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* 主栏 + 侧栏 */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 40px;
}
.dash-section { margin-bottom: 28px; }
.dash-sec-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.dash-sec-head h2 { margin: 0; font-size: 16px; }
.dash-sec-head a { font-size: 12px; color: var(--text-muted); }
.dash-sec-head a:hover { color: var(--primary); }

/* 迷你热力图：限制最大宽度，避免格子被拉伸过大 */
.dash-heatmap { overflow-x: auto; }
.dash-heatmap .practice-heatmap-svg {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

/* 最近复盘 */
.dash-article {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.dash-article:last-child { border-bottom: none; }
.dash-article-title {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-article-date { flex-shrink: 0; font-size: 12px; color: var(--text-muted); }

/* 近期比赛 */
.dash-contest {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.dash-contest:last-child { border-bottom: none; }
.dash-contest-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-contest-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Rating sparkline */
.dash-rating {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.dash-rating:last-child { border-bottom: none; }
.dash-rating-icon { width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0; }
.dash-rating-info { flex: 1; min-width: 0; }
.dash-rating-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}
.dash-rating-label { font-size: 12px; color: var(--text-muted); }
.dash-rating-num { font-size: 16px; font-weight: 700; }
.dash-rating-diff { font-size: 12px; font-weight: 500; }
.dash-sparkline-svg { width: 100%; height: 36px; display: block; }

.dash-empty { color: var(--text-muted); font-size: 13px; padding: 12px 0; }

/* 响应式：窄屏侧栏降到主栏下方 */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; gap: 0; }
}

/* 响应式：统计条窄屏 3 列排布 */
@media (max-width: 560px) {
  .dash-stat { flex: 1 1 33%; padding: 12px 8px; }
  .dash-stat:nth-child(3n+1) { border-left: none; }
  .dash-stat-num { font-size: 22px; }
  .dash-title { font-size: 20px; }
}
