* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #fefefe;
  color: #1f2937;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 20px;
  color: #1f2937;
}

.graph-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.graph-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.graph-panel h3 {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 10px;
  text-align: center;
}

.graph-panel .function-label {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.graph-panel .function-label .katex {
  font-size: 1.1em;
}

.graph-panel .inner-label {
  color: #3b82f6;
}

.graph-panel .outer-label {
  color: #10b981;
}

canvas {
  display: block;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
}

.formula-board {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-radius: 12px;
  padding: 20px 30px;
  text-align: center;
  min-width: 200px;
}

.formula-board .formula {
  font-family: 'Times New Roman', serif;
  font-size: 20px;
  color: #1f2937;
  margin-bottom: 8px;
}

.formula-board .formula .highlight {
  color: #8b5cf6;
  font-weight: bold;
}

.formula-board .value {
  font-size: 14px;
  color: #6b7280;
}

.connection-line {
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #10b981);
  border-radius: 2px;
  align-self: center;
}

.derivative-container {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.derivative-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  flex: 1 1 280px;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.derivative-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.derivative-label.dudx-label { color: #3b82f6; }
.derivative-label.dydu-label { color: #10b981; }
.derivative-label.dydx-label { color: #ef4444; }

.derivative-label .katex {
  font-size: 1.05em;
}

.derivative-value {
  margin-top: 6px;
  font-size: 13px;
  font-family: 'Times New Roman', serif;
  color: #1f2937;
  min-height: 18px;
}

.control-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.control-row:last-child {
  margin-bottom: 0;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group label {
  font-size: 14px;
  color: #6b7280;
}

.control-group select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
  outline: none;
}

.control-group select:focus {
  border-color: #3b82f6;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-group label {
  font-size: 14px;
  color: #6b7280;
  min-width: 60px;
}

.slider-group input[type="range"] {
  width: 150px;
  height: 6px;
  -webkit-appearance: none;
  background: #e5e7eb;
  border-radius: 3px;
  outline: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: #f59e0b;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: #3b82f6;
  color: #fff;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-primary.playing {
  background: #ef4444;
}

.btn-primary.playing:hover {
  background: #dc2626;
}

.speed-select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
  outline: none;
}

.value-display {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 15px 20px;
  font-size: 14px;
  line-height: 1.8;
}

.value-display .row {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 15px 30px;
}

.value-display .item {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.value-display .label {
  color: #6b7280;
}

.value-display .val {
  color: #1f2937;
  font-family: 'Times New Roman', monospace;
}

.value-display .inner-val {
  color: #3b82f6;
}

.value-display .outer-val {
  color: #10b981;
}
