/* =========================================================
   拾脉 · 学习脑图
   目录 → XMind 文件 → 在线预览
   ========================================================= */

body {
  font-family: Inter, 'Noto Sans SC', -apple-system, 'PingFang SC', sans-serif;
}
main#article {
  max-width: 1180px;
  padding-top: clamp(84px, 11vh, 112px);
  padding-bottom: 80px;
}
.read-progress,
.toc { display: none; }

.mm {
  max-width: 1120px;
  margin: 0 auto;
}

/* ---------- 头部 ---------- */
.mm-head { text-align: center; margin-bottom: 4px; }
.mm-head-left { text-align: left; }
.mm-eyebrow {
  margin: 0 0 14px;
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .26em;
}
.mm-eyebrow span { margin-right: 8px; color: var(--gold); font-size: 10px; }
.mm-head h1 {
  margin: 0 0 12px;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: clamp(1.9rem, 4.2vw, 2.8rem);
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: .01em;
  text-wrap: balance;
}
.mm-head-left h1 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); }
.mm-head h1 em {
  font-style: normal;
  color: var(--accent);
  background-image: linear-gradient(transparent 68%, var(--accent-soft) 68%);
  padding: 0 .08em;
}
.mm-sub {
  max-width: 620px;
  margin: 0 auto;
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1.9;
}
.mm-head-left .mm-sub { margin-left: 0; }
.mm-map-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.mm-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- 面包屑 ---------- */
.mm-crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  color: var(--ink-faint);
  font-size: 11.5px;
}
.mm-crumbs a { color: var(--ink-faint); text-decoration: none; transition: color .18s ease; }
.mm-crumbs a:hover { color: var(--accent); }
.mm-crumbs .is-current { color: var(--ink-soft); }

/* ---------- 解锁条 ---------- */
.mm-lock {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 26px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.mm-lock-dot {
  width: 7px; height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--ink-faint);
  opacity: .6;
}
.mm-lock.is-open .mm-lock-dot {
  background: #6b8f71;
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(107, 143, 113, .18);
}
.mm-lock-text { color: var(--ink-soft); font-size: 12px; }
.mm-lock.is-open .mm-lock-text { color: #5d7f63; }
:root[data-theme="dark"] .mm-lock.is-open .mm-lock-text { color: #8fc096; }
.mm-unlock { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.mm-unlock input {
  width: 150px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  outline: none;
}
.mm-unlock input:focus {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.mm-lock > .mm-btn { margin-left: auto; }
.mm-lock-hint { color: var(--ink-faint); font-size: 10.5px; }
.mm-error {
  margin-top: 10px;
  padding: 9px 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  line-height: 1.7;
}

/* ---------- 按钮 ---------- */
.mm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: all .18s ease;
}
.mm-btn:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.mm-btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 10px 22px -14px var(--accent);
}
.mm-btn-primary:hover {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent));
}
.mm-btn-ghost { border-color: transparent; background: transparent; color: var(--ink-faint); }
.mm-btn-ghost:hover { background: var(--paper-soft); }
.mm-btn-danger {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
  background: transparent;
  color: var(--accent);
}
.mm-btn-danger:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- 统计 / 工具条 ---------- */
.mm-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 520px;
  margin: 20px auto 0;
}
.mm-stat {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.mm-stat b {
  display: block;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.2;
}
.mm-stat span { color: var(--ink-faint); font-size: 10px; letter-spacing: .05em; }

.mm-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin: 22px 0 14px;
}
.mm-toolbar-hint { color: var(--ink-faint); font-size: 10.5px; }

/* ---------- 面板 / 表单 ---------- */
.mm-panel {
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  animation: mm-rise .3s ease both;
}
.mm-panel[hidden] { display: none; }
.mm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.mm-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--ink-faint);
  font-size: 10.5px;
  letter-spacing: .04em;
}
.mm-form-grid label.wide { grid-column: 1 / -1; }
.mm-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.65;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.mm-input:focus {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.mm-input { resize: vertical; }
.mm-file {
  width: 100%;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 11.5px;
}
.mm-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.mm-delete-row { margin-top: 26px; }

/* ---------- 区块 ---------- */
.mm-section { margin-top: 30px; }
.mm-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.mm-section-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .06em;
}
.mm-section-head h2::before {
  content: '✦';
  color: var(--gold);
  font-size: 10px;
}
.mm-section-head > span {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink-faint);
  font-size: 9.5px;
}

/* ---------- 目录卡 ---------- */
.mm-folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.mm-folder {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.mm-folder:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  box-shadow: var(--shadow);
}
.mm-folder-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
}
.mm-folder-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mm-folder-name {
  overflow: hidden;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 14.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mm-folder-desc {
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.6;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mm-folder-meta { color: var(--ink-faint); font-size: 10px; }
.mm-folder-arrow { flex: none; color: var(--ink-faint); font-size: 13px; transition: transform .2s ease, color .2s ease; }
.mm-folder:hover .mm-folder-arrow { color: var(--accent); transform: translateX(3px); }

/* ---------- 脑图卡 ---------- */
.mm-maps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.mm-map-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.mm-map-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--c5) 32%, var(--line));
  box-shadow: var(--shadow);
}
.mm-map-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px; height: 38px;
  border-radius: 11px;
  background: rgba(141, 90, 131, .12);
  color: var(--c5);
  font-size: 15px;
}
.mm-map-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.mm-map-title {
  overflow: hidden;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mm-map-desc {
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.6;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mm-map-meta { color: var(--ink-faint); font-size: 10px; }
.mm-empty-line {
  margin: 0;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--ink-faint);
  font-size: 12px;
}

/* ---------- 详情 ---------- */
.mm-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
  align-items: start;
  margin-top: 18px;
}
.mm-preview-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.mm-preview-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.mm-view-title {
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 12.5px;
  font-weight: 700;
}
.mm-view-meta { color: var(--ink-faint); font-size: 10px; }
.mm-view-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: auto;
}
.mm-view-actions button {
  min-width: 28px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 10.5px;
  cursor: pointer;
  transition: all .16s ease;
}
.mm-view-actions button:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.mm-canvas {
  position: relative;
  height: min(70vh, 720px);
  min-height: 480px;
  overflow: hidden;
  background: #fff;
  touch-action: none;
}
.mm-canvas svg { width: 100% !important; height: 100% !important; }
.mm-canvas:fullscreen { width: 100vw; height: 100vh; background: #fff; }
.mm-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: #8a8279;
  font-size: 12px;
}
.mm-fallback {
  margin: 0;
  padding: 12px 15px;
  border-top: 1px solid var(--line);
  background: var(--paper-soft);
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.8;
}

.mm-side { display: flex; flex-direction: column; gap: 12px; }
.mm-meta-card,
.mm-outline-card {
  padding: 16px 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.mm-meta-card h2 {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
}
.mm-meta-card dl { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.mm-meta-card dl > div { display: flex; gap: 12px; align-items: baseline; }
.mm-meta-card dt { flex: none; width: 64px; color: var(--ink-faint); font-size: 10.5px; }
.mm-meta-card dd { margin: 0; min-width: 0; color: var(--ink-soft); font-size: 11.5px; word-break: break-word; }
.mm-meta-card dd a { color: var(--accent); text-decoration: none; }
.mm-meta-card .mm-file-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-faint);
}
.mm-meta-card .mm-btn { width: 100%; margin-top: 10px; }

.mm-outline-card summary {
  cursor: pointer;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
}
.mm-outline-card summary::marker { color: var(--gold); }
.mm-outline { margin-top: 10px; max-height: 420px; overflow: auto; padding-right: 4px; }
.mm-outline ul { margin: 0; padding-left: 15px; }
.mm-outline li { margin: 3px 0; color: var(--ink-soft); font-size: 11.5px; line-height: 1.7; }
.mm-outline li > span { display: inline-block; padding: 1px 0; }
.mm-outline ul ul { margin-top: 2px; border-left: 1px dashed var(--line); padding-left: 12px; }
.mm-muted { margin: 0; color: var(--ink-faint); font-size: 11px; }

.mm-note {
  margin: 30px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--ink-faint);
  font-size: 10.5px;
  line-height: 1.9;
}

/* JS 提示 */
.mm-js-toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 1100;
  max-width: min(90vw, 460px);
  padding: 9px 15px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  line-height: 1.7;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .2s ease, transform .2s ease;
}
.mm-js-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes mm-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
  .mm-detail-grid { grid-template-columns: 1fr; }
  .mm-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
}

@media (max-width: 720px) {
  .mm-head h1 { font-size: 1.85rem; }
  .mm-map-head { align-items: flex-start; }
  .mm-head-actions { width: 100%; }
  .mm-stats { max-width: none; }
  .mm-form-grid { grid-template-columns: 1fr; }
  .mm-unlock { width: 100%; margin-left: 0; }
  .mm-unlock input { flex: 1; width: auto; }
  .mm-lock > .mm-btn { margin-left: 0; }
  .mm-lock-hint { width: 100%; }
  .mm-folders, .mm-maps { grid-template-columns: 1fr; }
  .mm-canvas { height: 58vh; min-height: 380px; }
  .mm-view-actions { width: 100%; margin-left: 0; }
}

@media (max-width: 420px) {
  .mm-stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .mm-stat { padding: 9px 8px; }
  .mm-stat b { font-size: 18px; }
  .mm-folder, .mm-map-card { padding: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .mm-panel { animation: none; }
  .mm-folder, .mm-map-card { transition: none; }
}
