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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fa;
  color: #333;
  min-height: 100vh;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  font-size: 1.4rem;
  text-align: center;
  margin-bottom: 16px;
  color: #2c3e50;
}

h2 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: #555;
}

/* 日付ナビ */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 1rem;
  font-weight: bold;
  color: #2c3e50;
}

.date-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
  cursor: pointer;
  color: #555;
}

.date-btn:hover {
  background: #e8e8e8;
}

/* 合計カード */
.totals {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.total-item {
  flex: 1;
  border-radius: 10px;
  padding: 14px 8px;
  text-align: center;
  color: #fff;
}

.total-item.protein { background: #4a90d9; }
.total-item.fat     { background: #f5a623; }
.total-item.carbs   { background: #5cb85c; }

.total-label {
  display: block;
  font-size: 0.72rem;
  margin-bottom: 6px;
  opacity: 0.9;
}

.total-value {
  font-size: 1.6rem;
  font-weight: bold;
}

.total-unit {
  font-size: 0.75rem;
  margin-left: 2px;
}

/* フォーム */
.form-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.form-group {
  margin-bottom: 10px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: #666;
  margin-bottom: 4px;
}

.form-group input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
}

.form-group input:focus {
  border-color: #4a90d9;
}

.form-row {
  display: flex;
  gap: 8px;
}

.form-row .form-group {
  flex: 1;
}

.add-btn {
  width: 100%;
  padding: 12px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 4px;
}

.add-btn:hover {
  background: #357abd;
}

/* リスト */
.list-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.meal-list {
  list-style: none;
}

.meal-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 8px;
}

.meal-item:last-child {
  border-bottom: none;
}

.meal-info {
  flex: 1;
}

.meal-name {
  font-weight: bold;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.meal-nutrients {
  display: flex;
  gap: 10px;
  font-size: 0.78rem;
}

.nutrient-tag {
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
  white-space: nowrap;
}

.nutrient-tag.p { background: #4a90d9; }
.nutrient-tag.f { background: #f5a623; }
.nutrient-tag.c { background: #5cb85c; }

.delete-btn {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.delete-btn:hover {
  color: #e74c3c;
  background: #fef0f0;
}

.empty-msg {
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
  padding: 16px 0;
}

@media (max-width: 400px) {
  .total-value {
    font-size: 1.3rem;
  }
  .total-label {
    font-size: 0.65rem;
  }
}
