/* ============================
   切蛋糕实验室 - 专属样式
   ============================ */

/* ===== Layout ===== */
#app {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  background: #f0f2f5;
  overflow: hidden;
}

/* ===== Top Bar ===== */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(255,255,255,0.95);
  border-bottom: 1px solid #e8e8e8;
  z-index: 20;
  min-height: 44px;
  flex-shrink: 0;
}
#top-bar a {
  color: #667eea;
  text-decoration: none;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 10px;
  background: rgba(102,126,234,0.1);
  transition: all 0.15s;
}
#top-bar a:hover { color: #4458b5; background: rgba(102,126,234,0.2); }
#top-bar .title-area {
  color: #333;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
}
#top-bar .title-area .mode-badge {
  font-size: 11px;
  background: rgba(102,126,234,0.15);
  color: #667eea;
  padding: 2px 10px;
  border-radius: 10px;
}

/* ===== Shape Selector ===== */
#shape-selector {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.95);
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.shape-btn {
  padding: 5px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #555;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.shape-btn:hover {
  border-color: #667eea;
  color: #667eea;
}
.shape-btn.active {
  background: #667eea;
  color: #fff;
  border-color: #667eea;
}

/* ===== 3D Canvas ===== */
#canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}
#canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ===== 2D Cross-section Mini-window ===== */
#cross-section-window {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 160px;
  height: 160px;
  background: rgba(255,255,255,0.92);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  z-index: 15;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}
#cross-section-window.show {
  opacity: 1;
  transform: scale(1);
}
#cross-section-window .cs-label {
  font-size: 11px;
  color: #888;
  margin-bottom: 2px;
  font-weight: bold;
}
#cross-section-window .cs-shape-name {
  font-size: 13px;
  color: #ff6b6b;
  font-weight: bold;
  margin-bottom: 4px;
}
#cross-section-window canvas {
  width: 120px;
  height: 100px;
  border-radius: 8px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
}

/* ===== Bottom Controls ===== */
#bottom-controls {
  flex-shrink: 0;
  background: rgba(255,255,255,0.98);
  border-top: 1px solid #e8e8e8;
  padding: 12px 16px 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Step info */
#step-info {
  color: #555;
  font-size: 15px;
  text-align: center;
  line-height: 1.5;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 8px;
}
#step-info .step-title {
  color: #667eea;
  font-weight: bold;
}
#step-info .shape-highlight {
  color: #ff6b6b;
  font-weight: bold;
}
#step-info .analogy-text {
  font-size: 13px;
  color: #888;
}

/* Progress dots */
#progress-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e0e0e0;
  transition: all 0.3s;
}
.progress-dot.done { background: #43e97b; }
.progress-dot.active { background: #ffd93d; box-shadow: 0 0 8px rgba(255,217,61,0.5); }
.progress-dot.pending { background: #d0d0d0; }

/* Analogy card */
#analogy-card {
  background: #f8f9fa;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ===== Navigation Buttons ===== */
#nav-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.nav-btn {
  padding: 10px 28px;
  border: none;
  border-radius: 25px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
  min-width: 100px;
}
.nav-btn:active { transform: scale(0.96); }
.nav-btn--prev {
  background: #f0f2f5;
  color: #666;
  border: 1px solid #ddd;
}
.nav-btn--prev:hover { background: #e8e8e8; color: #333; }
.nav-btn--prev:disabled { opacity: 0.3; cursor: not-allowed; }
.nav-btn--next {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}
.nav-btn--next:hover { box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4); transform: translateY(-2px); }
.nav-btn--next:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ===== Replay button ===== */
#btn-replay {
  display: none;
  padding: 10px 28px;
  border: none;
  border-radius: 25px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
  transition: all 0.2s;
  min-height: 44px;
}
#btn-replay:hover { box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4); transform: translateY(-2px); }
#btn-replay:active { transform: scale(0.96); }

/* ===== CSS2D Label override ===== */
.cross-section-label {
  color: #ff6b6b;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255,107,107,0.5), 0 2px 4px rgba(0,0,0,0.5);
  pointer-events: none;
  background: rgba(0,0,0,0.5);
  padding: 4px 14px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
  border: 2px solid rgba(255,107,107,0.6);
}

/* ===== Responsive (mobile) ===== */
@media (max-width: 768px) {
  #cross-section-window {
    width: 130px;
    height: 130px;
    bottom: 12px;
    right: 12px;
    padding: 6px;
  }
  #cross-section-window canvas {
    width: 100px;
    height: 80px;
  }
  #cross-section-window .cs-shape-name {
    font-size: 11px;
  }

  #step-info {
    font-size: 14px;
    min-height: 36px;
  }
  #step-info .analogy-text {
    font-size: 12px;
  }

  #bottom-controls {
    padding: 8px 12px 12px;
  }

  .nav-btn {
    padding: 8px 20px;
    font-size: 14px;
    min-width: 80px;
  }
}

@media (max-width: 480px) {
  #top-bar .title-area {
    font-size: 12px;
  }
  #top-bar .title-area .mode-badge {
    font-size: 10px;
  }
  #cross-section-window {
    width: 110px;
    height: 110px;
    bottom: 8px;
    right: 8px;
    padding: 4px;
    border-radius: 12px;
  }
  #shape-selector {
    top: 64px;
    gap: 4px;
    padding: 4px 8px;
  }
  .shape-btn {
    font-size: 11px;
    padding: 3px 8px;
  }
  #cross-section-window canvas {
    width: 85px;
    height: 65px;
  }
  #cross-section-window .cs-shape-name {
    font-size: 10px;
  }
  #cross-section-window .cs-label {
    font-size: 9px;
  }

  #step-info {
    font-size: 13px;
  }
  #step-info .analogy-text {
    font-size: 11px;
  }

  .nav-btn {
    padding: 6px 16px;
    font-size: 13px;
    min-width: 70px;
  }
}
