html, body, main, header, footer {
  padding: 0;
  margin: 0;
}

/* 主应用区域 */
#app {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
}

#app-title {
  text-align: center;
  font-size: 28px;
  color: #2E7D32;
  margin-bottom: 8px;
}

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

/* 分类 Tab */
#category-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.category-tab {
  padding: 8px 20px;
  border: 1px solid #4CAF50;
  background: #fff;
  color: #4CAF50;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.category-tab:hover {
  background: #E8F5E9;
}

.category-tab.active {
  background: #4CAF50;
  color: #fff;
}

/* 食物选择区 */
#food-selector {
  margin-bottom: 20px;
}

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

.food-btn {
  padding: 12px 8px;
  border: 1px solid #ddd;
  background: #fafafa;
  color: #333;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
  text-align: center;
}

.food-btn:hover {
  border-color: #4CAF50;
  background: #E8F5E9;
}

.food-btn.selected {
  border-color: #4CAF50;
  background: #4CAF50;
  color: #fff;
}

/* 输入区域 */
#input-area {
  margin-bottom: 20px;
  padding: 16px;
  background: #f9f9f9;
  border-radius: 8px;
}

#weight-label {
  display: block;
  font-size: 14px;
  color: #555;
  margin-bottom: 8px;
}

#input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#weight-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s ease;
}

#weight-input:focus {
  border-color: #4CAF50;
}

#weight-unit {
  font-size: 14px;
  color: #666;
  white-space: nowrap;
}

#add-btn {
  padding: 10px 28px;
  background: #4CAF50;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}

#add-btn:hover {
  background: #388E3C;
}

.food-info {
  margin-top: 10px;
  padding: 8px 12px;
  background: #E8F5E9;
  border-radius: 6px;
  font-size: 13px;
  color: #2E7D32;
}

/* 食物列表区域 */
#food-list-area {
  margin-bottom: 20px;
}

#food-list-title {
  font-size: 18px;
  color: #333;
  margin-bottom: 12px;
}

#food-list-container {
  overflow-x: auto;
}

#food-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#food-table thead th {
  background: #4CAF50;
  color: #fff;
  padding: 10px 8px;
  text-align: center;
  font-weight: 500;
  white-space: nowrap;
}

#food-table tbody td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid #eee;
}

#food-table tbody tr:hover {
  background: #F1F8E9;
}

#empty-tip {
  text-align: center;
  color: #999;
  padding: 24px 0;
  font-size: 14px;
}

.delete-btn {
  padding: 4px 12px;
  background: #f44336;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s ease;
}

.delete-btn:hover {
  background: #d32f2f;
}

/* 汇总区域 */
#summary-area {
  margin-bottom: 20px;
}

#summary-title {
  font-size: 18px;
  color: #333;
  margin-bottom: 12px;
}

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

.summary-card {
  padding: 16px 12px;
  border-radius: 8px;
  text-align: center;
}

#summary-calorie {
  background: #FFF3E0;
}

#summary-protein {
  background: #E8F5E9;
}

#summary-carb {
  background: #E3F2FD;
}

#summary-fat {
  background: #FCE4EC;
}

.summary-label {
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
}

.summary-value {
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

#total-calorie {
  color: #E65100;
}

#total-protein {
  color: #2E7D32;
}

#total-carb {
  color: #1565C0;
}

#total-fat {
  color: #C62828;
}

/* 操作区域 */
#action-area {
  text-align: center;
  margin-bottom: 20px;
}

#clear-btn {
  padding: 10px 40px;
  background: #fff;
  color: #f44336;
  border: 1px solid #f44336;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#clear-btn:hover {
  background: #f44336;
  color: #fff;
}

/* 响应式设计 */
@media (max-width: 768px) {
  #food-buttons {
    grid-template-columns: repeat(3, 1fr);
  }

  #summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .summary-value {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  #food-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

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

  #app {
    padding: 16px 12px;
  }

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

  #input-row {
    flex-wrap: wrap;
  }

  #add-btn {
    width: 100%;
  }

  .summary-card {
    padding: 12px 8px;
  }

  .summary-value {
    font-size: 16px;
  }
}
