/* 基础重置 */
html, body, main, header, footer {
  padding: 0px;
  margin: 0px;
}

/* 应用容器 */
#app {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #333;
}

/* 标题区域 */
#app-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: #2e7d32;
  margin-bottom: 8px;
}

#app-subtitle {
  text-align: center;
  font-size: 15px;
  color: #666;
  margin-bottom: 32px;
}

/* 输入区域 */
#input-section {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  padding: 24px;
  margin-bottom: 24px;
}

#input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
}

.input-group label {
  font-size: 14px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.input-group input,
.input-group select {
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
  background: #fafafa;
  box-sizing: border-box;
  width: 100%;
}

.input-group input:focus,
.input-group select:focus {
  border-color: #4caf50;
  background: #fff;
}

#calculate-btn-wrapper {
  text-align: center;
  margin-top: 20px;
}

#calculate-btn {
  padding: 12px 48px;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #4caf50, #2e7d32);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

#calculate-btn:hover {
  opacity: 0.9;
}

#calculate-btn:active {
  transform: scale(0.97);
}

/* 结果区域 */
#result-section {
  display: none;
}

#result-section.show {
  display: block;
}

/* 热量卡片 */
#calorie-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.result-card {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  padding: 20px 16px;
  text-align: center;
}

.result-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: #888;
  margin: 0 0 8px 0;
}

.result-value {
  font-size: 36px;
  font-weight: 700;
  color: #2e7d32;
  margin: 0;
  line-height: 1.2;
}

.result-unit {
  font-size: 13px;
  color: #999;
  margin: 4px 0 0 0;
}

/* 碳水区域 */
#carb-section {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  padding: 24px;
  margin-bottom: 24px;
}

#carb-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  margin: 0 0 16px 0;
  text-align: center;
}

#carb-slider-wrapper {
  margin-bottom: 20px;
}

#carb-ratio-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
  text-align: center;
}

#carb-ratio-value {
  color: #2e7d32;
  font-weight: 700;
}

#carb-ratio {
  display: block;
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, #a5d6a7, #4caf50, #2e7d32);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

#carb-ratio::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #2e7d32;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

#carb-ratio::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #2e7d32;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

#carb-grams-card {
  max-width: 280px;
  margin: 0 auto;
}

/* 食物换算区域 */
#food-conversion-section {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  padding: 24px;
  margin-bottom: 24px;
}

#food-conversion-title {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  margin: 0 0 4px 0;
  text-align: center;
}

#food-conversion-desc {
  font-size: 13px;
  color: #999;
  text-align: center;
  margin: 0 0 20px 0;
}

#food-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.food-card {
  background: #f9fafb;
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  transition: transform 0.15s;
}

.food-card:hover {
  transform: translateY(-2px);
}

.food-icon {
  display: block;
  font-size: 28px;
  margin-bottom: 6px;
}

.food-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  margin-bottom: 4px;
}

.food-amount {
  display: inline;
  font-size: 22px;
  font-weight: 700;
  color: #2e7d32;
}

.food-unit {
  display: inline;
  font-size: 13px;
  color: #999;
  margin-left: 2px;
}

/* 内容区域 */
#features,
#scenarios,
#FAQ {
  max-width: 800px;
  margin: 0 auto 24px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  padding: 24px;
}

#features h2,
#scenarios h2,
#FAQ h2 {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  margin: 0 0 12px 0;
}

#features p {
  font-size: 14px;
  color: #555;
  line-height: 1.8;
  margin: 0;
}

#scenarios ul {
  padding-left: 20px;
  margin: 0;
}

#scenarios li {
  font-size: 14px;
  color: #555;
  line-height: 1.8;
}

#FAQ dl {
  margin: 0;
}

#FAQ dt {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin-top: 16px;
  margin-bottom: 4px;
}

#FAQ dt:first-child {
  margin-top: 0;
}

#FAQ dd {
  font-size: 14px;
  color: #666;
  line-height: 1.7;
  margin: 0 0 0 0;
  padding: 0;
}

/* 改编按钮 */
#__fork {
  text-align: center;
  margin-bottom: 24px;
}

#__fork button {
  padding: 10px 32px;
  font-size: 14px;
  color: #2e7d32;
  background: #fff;
  border: 2px solid #4caf50;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

#__fork button:hover {
  background: #4caf50;
  color: #fff;
}

/* 响应式：平板端 */
@media (max-width: 768px) {
  #calorie-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .result-value {
    font-size: 28px;
  }

  #food-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  #app-title {
    font-size: 24px;
  }
}

/* 响应式：手机端 */
@media (max-width: 480px) {
  #input-grid {
    grid-template-columns: 1fr;
  }

  #calorie-cards {
    grid-template-columns: 1fr;
  }

  #food-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .result-value {
    font-size: 26px;
  }

  #app-title {
    font-size: 22px;
  }

  #app-subtitle {
    font-size: 13px;
  }

  #input-section {
    padding: 16px;
  }

  #calculate-btn {
    width: 100%;
    padding: 14px 0;
  }
}
