/* ===== 知识地图 ===== */

.km-header {
  text-align: center;
  margin-bottom: var(--space-4);
}
.km-progress-text {
  font-size: var(--text-body);
  font-weight: var(--weight-bold);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.km-progress-bar {
  height: 8px;
  background: var(--surface-dim);
  border-radius: 4px;
  overflow: hidden;
  max-width: 240px;
  margin: 0 auto;
}
.km-progress-fill {
  height: 100%;
  background: var(--warning);
  border-radius: 4px;
  transition: width 0.5s var(--ease-out);
}

.km-graph {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0;
  padding: var(--space-2) 0;
}

.km-layer {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.km-connector {
  color: var(--text-muted);
  font-size: var(--text-body);
  text-align: center;
  padding: var(--space-1) 0;
}

.km-node {
  width: 90px;
  padding: var(--space-2) var(--space-1);
  border-radius: var(--radius-md);
  text-align: center;
  transition: all 0.3s var(--ease-out);
  border: 2px solid transparent;
}

.km-locked {
  background: var(--surface-dim);
  opacity: 0.5;
}
.km-locked .km-node-name { color: var(--text-muted); }

.km-learning {
  background: var(--warning-bg);
  border-color: var(--warning);
  animation: kmPulse 2s ease-in-out infinite;
}

.km-mastered {
  background: var(--correct-bg);
  border-color: var(--correct);
}

.km-just-lit {
  animation: kmLightUp 0.8s var(--ease-bounce);
}

.km-node-icon {
  font-size: var(--text-heading);
  margin-bottom: var(--space-1);
}
.km-node-name {
  font-size: 11px;
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: 1.2;
}
.km-node-formula {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
}
.km-node-dots {
  font-size: 8px;
  color: var(--warning);
  margin-top: 2px;
  letter-spacing: 2px;
}

@keyframes kmPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

@keyframes kmLightUp {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
  30% { transform: scale(1.15); box-shadow: 0 0 20px 10px rgba(22, 163, 74, 0.3); }
  100% { transform: scale(1); box-shadow: none; }
}

/* 点亮庆祝卡 */
.km-celebrate-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.km-celebrate-overlay.show { opacity: 1; }

.km-celebrate-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-8);
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: kmCelebrateIn 0.5s var(--ease-bounce);
}
.km-celebrate-glow {
  position: absolute;
  inset: -20px;
  border-radius: 30px;
  background: radial-gradient(circle, rgba(245,158,11,0.3) 0%, transparent 70%);
  animation: kmGlowPulse 1s ease-in-out infinite;
}
.km-celebrate-icon {
  font-size: 48px;
  margin-bottom: var(--space-2);
  position: relative;
}
.km-celebrate-title {
  font-size: var(--text-title);
  font-family: var(--font-display);
  color: var(--warning);
  position: relative;
}
.km-celebrate-sub {
  font-size: var(--text-body);
  color: var(--correct);
  font-weight: var(--weight-bold);
  margin-top: var(--space-1);
  position: relative;
}

@keyframes kmCelebrateIn {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes kmGlowPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* 响应式 */
@media (max-width: 380px) {
  .km-node { width: 72px; padding: var(--space-1); }
  .km-node-name { font-size: 10px; }
}
