/* 🧠 公主思维成长营 · V2 看板样式 - 暗色系极简 */
:root {
  --bg: #0b0b16;
  --surface: #13132a;
  --surface2: #1c1c38;
  --surface3: #252548;
  --border: #2a2a50;
  --border2: #3a3a60;
  --text: #e8e8f0;
  --text2: #8888aa;
  --text3: #666688;
  --accent: #7c5cfc;
  --accent2: #5c7cfc;
  --accent-light: rgba(124,92,252,0.15);
  --green: #4ade80;
  --green-dim: rgba(74,222,128,0.15);
  --yellow: #fbbf24;
  --yellow-dim: rgba(251,191,36,0.15);
  --orange: #fb923c;
  --red: #f87171;
  --pink: #f472b6;
  --cyan: #22d3ee;
  --radius: 10px;
  --radius-lg: 14px;
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: -apple-system,'PingFang SC','Microsoft YaHei',sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
  font-size: 14px;
}

/* 滚动条 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── 头部 ─── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-logo { font-size: 20px; }
.header h1 { font-size: 17px; font-weight: 600; }
.header .subtitle { font-size: 12px; color: var(--text2); }

/* 菜单按钮 - 手机端显示 */
.menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.header-tabs {
  display: flex;
  gap: 2px;
  margin-left: auto;
  background: var(--surface2);
  border-radius: 8px;
  padding: 2px;
}
.header-tab {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}
.header-tab:hover { color: var(--text); }
.header-tab.active {
  background: var(--accent);
  color: #fff;
}

/* ─── 布局 ─── */
.app {
  display: flex;
  height: calc(100vh - 58px);
  position: relative;
}

.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 12px 10px;
  overflow-y: auto;
  flex-shrink: 0;
}

.panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
/* ═══════════════════════════════════════════════
   错题本专属样式
   ═══════════════════════════════════════════════ */

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

.err-user-switch {
  display: flex;
  gap: 8px;
}

.user-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: all .2s;
}
.user-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}
.user-btn:hover {
  opacity: 0.85;
}

.err-upload-btn {
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  transition: all .2s;
}
.err-upload-btn:hover {
  opacity: 0.85;
}

.err-filter-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  font-size: 11px;
  transition: all .2s;
}
.err-filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* 错题卡片 */
.error-card {
  background: var(--surface1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .2s;
}
.error-card:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}
.error-card.mastered {
  opacity: 0.6;
  border-color: var(--green);
}
.error-card.mastered:hover {
  opacity: 0.8;
}

.error-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.error-card-body p {
  font-size: 12px;
  margin: 2px 0;
  color: var(--text);
}

.err-analysis {
  color: var(--text2);
  line-height: 1.5;
}

.error-card-img {
  margin-top: 6px;
  max-height: 100px;
  overflow: hidden;
  border-radius: 6px;
}
.error-card-img img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* 提醒：只在关闭状态不显示桌面抓取窗口样式 */
@media (max-width: 768px) {
  .menu-btn { display: block; }
  .err-header { flex-direction: column; align-items: stretch; }
  .err-user-switch { justify-content: center; }
  .app { flex-direction: column; }
  .sidebar {
    position: fixed;
    top: 58px;
    left: 0;
    width: 280px;
    min-width: auto;
    max-height: calc(100vh - 58px);
    z-index: 90;
    transform: translateX(-100%);
    transition: transform .25s ease;
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  /* 遮罩层 */
  .sidebar.open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: -1;
  }
  .panel { padding: 12px; }
  .header-tabs { gap: 0; }
  .header-tab { padding: 6px 10px; font-size: 12px; }
}

/* ─── 侧栏 ─── */
.sidebar-section { margin-bottom: 14px; }
.sidebar-title {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text3);
  letter-spacing: 1px;
  padding: 4px 8px;
  margin-bottom: 4px;
}
.sidebar-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  background: transparent;
  border: none;
  color: var(--text2);
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .12s;
}
.sidebar-item:hover { background: var(--surface2); color: var(--text); }
.sidebar-item.active { background: var(--accent-light); color: var(--accent); }
.sidebar-item .count {
  float: right;
  font-size: 10px;
  color: var(--text3);
  background: var(--surface2);
  padding: 0 5px;
  border-radius: 3px;
}

/* ─── Tab内容 ─── */
.tab-pane { display: none; }
.tab-pane.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ─── 日历 ─── */
.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.cal-header h2 { font-size: 15px; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  gap: 4px;
  flex: 1;
  align-content: start;
  min-height: 0;
}
.cal-label {
  text-align: center;
  font-size: 10px;
  color: var(--text3);
  padding: 4px 0;
}
.cal-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  min-height: 58px;
  cursor: pointer;
  transition: all .12s;
  position: relative;
}
.cal-cell:hover { border-color: var(--accent); background: var(--surface2); }
.cal-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell .day { font-size: 11px; font-weight: 600; color: var(--text2); margin-bottom: 2px; }
.cal-cell.today { border-color: var(--accent); }
.cal-cell.today .day { color: var(--accent); }
.cal-cell .cal-label-sm {
  font-size: 8px;
  padding: 1px 3px;
  border-radius: 2px;
  display: block;
  margin: 1px 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cl-36ji { background: rgba(124,92,252,0.25); color: #a78bfa; }
.cl-bias { background: rgba(244,114,182,0.25); color: #f9a8d4; }
.cl-math { background: rgba(74,222,128,0.2); color: #86efac; }
.cl-eng { background: rgba(34,211,238,0.2); color: #67e8f9; }
.cl-proj { background: rgba(251,191,36,0.2); color: #fde68a; }

/* ─── 内容卡片网格 ─── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all .15s;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.card-tag {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: 6px;
}
.card h4 { font-size: 14px; margin-bottom: 4px; }
.card p { font-size: 12px; color: var(--text2); line-height: 1.5; }
.card .meta {
  font-size: 10px;
  color: var(--text3);
  margin-top: 8px;
  display: flex;
  gap: 8px;
}
.status-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 4px;
}
.s-done { background: var(--green); }
.s-progress { background: var(--yellow); }
.s-pending { background: var(--border); }
.s-active { background: var(--accent); }

/* ─── 内容详情面板（右侧） ─── */
.detail-panel {
  display: none;
  position: fixed;
  top: 58px;
  right: 0;
  width: 480px;
  max-width: 90vw;
  height: calc(100vh - 58px);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 100;
  overflow-y: auto;
  padding: 24px;
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
}
.detail-panel.open { display: block; }
.detail-panel .close-btn {
  float: right;
  width: 28px; height: 28px;
  background: var(--surface2);
  border: none;
  color: var(--text2);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-panel .close-btn:hover { color: var(--text); }
.detail-panel .detail-tag { font-size: 10px; margin-bottom: 8px; display: inline-block; }
.detail-panel h2 { font-size: 20px; margin-bottom: 16px; }
.detail-panel .detail-body { font-size: 14px; line-height: 1.8; }
.detail-panel .detail-body h3 {
  font-size: 15px;
  margin: 20px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.detail-panel .detail-body p { margin-bottom: 8px; }
.detail-panel .detail-body ul { padding-left: 20px; margin-bottom: 8px; }
.detail-panel .detail-body li { margin-bottom: 4px; }
.detail-panel .detail-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--text2);
  margin: 8px 0;
}

/* ─── 知识图谱树 ─── */
.tree-node { margin: 1px 0; }
.tree-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background .1s;
}
.tree-header:hover { background: var(--surface2); }
.tree-toggle {
  width: 14px;
  text-align: center;
  color: var(--text3);
  font-size: 9px;
}
.tree-children { padding-left: 18px; display: none; }
.tree-children.open { display: block; }
.tree-leaf {
  padding: 3px 8px 3px 20px;
  font-size: 11px;
  color: var(--text2);
  border-radius: 4px;
  cursor: pointer;
}
.tree-leaf:hover { color: var(--text); background: var(--surface2); }

/* ─── 错题统计 ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-card .num { font-size: 26px; font-weight: 700; }
.stat-card .label { font-size: 11px; color: var(--text2); margin-top: 4px; }

/* ─── 模态框 ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  justify-content: center;
  align-items: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 680px;
  width: 92%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal h2 { font-size: 18px; margin-bottom: 12px; }
.modal-body { font-size: 13px; line-height: 1.7; }
.modal-body p { margin-bottom: 8px; }
.modal .close-btn {
  float: right;
  background: var(--surface2);
  border: none;
  color: var(--text2);
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}

/* ─── 搜索 ─── */
.search-box {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  margin-bottom: 10px;
}
.search-box:focus { border-color: var(--accent); }

/* ─── 按钮 ─── */
.btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all .12s;
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { opacity: .85; }

/* ─── 卡片增强 ─── */
.card-excerpt {
  font-size: 11px;
  color: var(--text2);
  line-height: 1.5;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text2);
  font-size: 13px;
}

/* ─── 树形叶子有内容高亮 ─── */
.tree-leaf.has-content { color: var(--accent); }

/* ─── 用户按钮 ─── */
.user-btn { transition: all .15s; }
.user-btn:hover { opacity: 0.85; }
