/* ============================================
   🍼 宝宝辅食规划 APP - 主样式表
   天青色可爱主题 (Celadon Kawaii Theme)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

/* ── Design Tokens ── */
:root {
  --primary: #7EC8C8;
  --primary-light: #B5E8E0;
  --primary-dark: #5BA8A8;
  --primary-bg: #F0FAFA;
  --primary-glass: rgba(126, 200, 200, 0.12);
  --accent-warm: #FFD93D;
  --accent-pink: #FFB8C6;
  --card-bg: #FFFFFF;
  --text-primary: #4A5568;
  --text-secondary: #8A9BB5;
  --text-light: #C4D0E0;
  --danger: #FF6B6B;
  --warning: #FFA94D;
  --success: #69DB7C;
  --info: #87CEEB;
  --fruit-green: #98D8A0;
  --border-radius: 16px;
  --border-radius-sm: 10px;
  --border-radius-xs: 6px;
  --card-shadow: 0 4px 15px rgba(126, 200, 200, 0.15);
  --card-shadow-hover: 0 8px 25px rgba(126, 200, 200, 0.25);
  --font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --nav-height: 65px;
  --header-height: 70px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  background: var(--primary-bg);
  color: var(--text-primary);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

body::-webkit-scrollbar { display: none; }
body { -ms-overflow-style: none; scrollbar-width: none; }

input, textarea, button, select {
  font-family: var(--font-family);
  outline: none;
  border: none;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }

/* ── Page System ── */
.page {
  display: none;
  min-height: 100vh;
  padding-top: calc(var(--header-height) + var(--safe-top));
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.page.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: fadeInUp 0.4s ease;
}

/* ── Header ── */
.header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 100;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  background: rgba(240, 250, 250, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(126, 200, 200, 0.15);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-baby {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 2px 8px rgba(126, 200, 200, 0.3);
}

.header-info h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.header-info .age-text {
  font-size: 12px;
  color: var(--primary-dark);
  font-weight: 600;
}

.header-date {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: right;
}

/* ── Registration Page ── */
.register-page {
  display: none;
  min-height: 100vh;
  padding: 0 24px;
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary-bg) 50%);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
}

.register-page.active {
  display: flex;
  opacity: 1;
  transform: none;
  animation: fadeIn 0.6s ease;
}

.register-emoji-area {
  font-size: 80px;
  margin-bottom: 8px;
  animation: bounceSmall 2s ease infinite;
}

.register-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 4px;
}

.register-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.register-form {
  width: 100%;
  max-width: 320px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-left: 4px;
}

.form-group label .label-emoji {
  margin-right: 4px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--primary-light);
  border-radius: var(--border-radius-sm);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--card-bg);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(126, 200, 200, 0.15);
}

.form-input::placeholder {
  color: var(--text-light);
}

.btn-register {
  width: 100%;
  padding: 16px;
  border-radius: var(--border-radius);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  margin-top: 8px;
  box-shadow: 0 4px 15px rgba(91, 168, 168, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-register:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(91, 168, 168, 0.3);
}

.register-decor {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
  pointer-events: none;
}

.register-decor-1 {
  width: 120px; height: 120px;
  background: var(--accent-warm);
  top: 10%; left: -30px;
  animation: float 6s ease-in-out infinite;
}

.register-decor-2 {
  width: 80px; height: 80px;
  background: var(--accent-pink);
  top: 20%; right: -20px;
  animation: float 5s ease-in-out infinite 1s;
}

.register-decor-3 {
  width: 60px; height: 60px;
  background: var(--primary);
  bottom: 25%; left: 10%;
  animation: float 7s ease-in-out infinite 0.5s;
}

/* ── Texture Banner ── */
.texture-banner {
  margin: 12px 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(126, 200, 200, 0.15), rgba(181, 232, 224, 0.2));
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(126, 200, 200, 0.2);
}

.texture-banner .texture-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.texture-banner .texture-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.texture-banner .texture-text strong {
  color: var(--primary-dark);
}

/* ── Swap All Button ── */
.btn-swap-all {
  margin: 12px 16px;
  padding: 14px;
  width: calc(100% - 32px);
  border-radius: var(--border-radius);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(91, 168, 168, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-swap-all:active {
  transform: scale(0.97);
  animation: bounceSmall 0.4s ease;
}

/* ── Meal Cards ── */
.meals-container {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.meal-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  border-left: 4px solid var(--primary);
  transition: transform 0.3s, box-shadow 0.3s, opacity 0.3s;
  animation: fadeInUp 0.5s ease backwards;
}

.meal-card:nth-child(1) { animation-delay: 0.05s; }
.meal-card:nth-child(2) { animation-delay: 0.1s; }
.meal-card:nth-child(3) { animation-delay: 0.15s; }
.meal-card:nth-child(4) { animation-delay: 0.2s; }
.meal-card:nth-child(5) { animation-delay: 0.25s; }
.meal-card:nth-child(6) { animation-delay: 0.3s; }
.meal-card:nth-child(7) { animation-delay: 0.35s; }

.meal-card[data-type="breakfast"] { border-left-color: var(--accent-warm); }
.meal-card[data-type="morning_snack"] { border-left-color: var(--accent-pink); }
.meal-card[data-type="lunch"] { border-left-color: var(--primary); }
.meal-card[data-type="afternoon_snack"] { border-left-color: var(--accent-pink); }
.meal-card[data-type="dinner"] { border-left-color: var(--primary-dark); }
.meal-card[data-type="drink"] { border-left-color: var(--info); }
.meal-card[data-type="fruit"] { border-left-color: var(--fruit-green); }

.meal-card.swapping {
  animation: flipCard 0.5s ease;
}

.meal-card-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.meal-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.meal-emoji {
  font-size: 28px;
  flex-shrink: 0;
}

.meal-info {
  flex: 1;
  min-width: 0;
}

.meal-type-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meal-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-all;
}

.btn-swap {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-glass);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.3s, background 0.3s;
  flex-shrink: 0;
}

.btn-swap:hover {
  background: var(--primary-light);
  transform: rotate(180deg);
}

.btn-swap:active {
  transform: rotate(360deg) scale(0.9);
}

/* Card Body */
.meal-card-body {
  padding: 0 16px 14px;
}

.meal-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.ingredient-tag {
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(126, 200, 200, 0.1);
  font-size: 12px;
  color: var(--primary-dark);
  font-weight: 600;
}

.meal-texture {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.allergen-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.retry-warning-card {
  background: rgba(255, 217, 61, 0.1);
  border: 1px solid rgba(255, 217, 61, 0.3);
  border-radius: var(--border-radius-xs);
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 12px;
  color: #B8860B;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.retry-warning-card .retry-icon {
  flex-shrink: 0;
  font-size: 14px;
}

/* Expandable Detail */
.meal-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.meal-detail.expanded {
  max-height: 600px;
}

.meal-detail-inner {
  padding: 14px 16px;
  border-top: 1px solid rgba(126, 200, 200, 0.1);
  background: rgba(240, 250, 250, 0.5);
}

.detail-section {
  margin-bottom: 14px;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.detail-ingredients-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-ingredient-item {
  font-size: 13px;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(126, 200, 200, 0.15);
}

.detail-ingredient-item .amount {
  color: var(--primary-dark);
  font-weight: 600;
}

.detail-steps {
  counter-reset: step;
}

.detail-step {
  counter-increment: step;
  font-size: 13px;
  color: var(--text-primary);
  padding: 6px 0 6px 28px;
  position: relative;
  line-height: 1.6;
}

.detail-step::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-tips {
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(126, 200, 200, 0.08);
  padding: 10px 12px;
  border-radius: var(--border-radius-xs);
  line-height: 1.6;
}

.detail-nutrition {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

.detail-prep-time {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Shopping List ── */
.shopping-section {
  margin: 20px 16px;
}

.shopping-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: box-shadow 0.3s;
}

.shopping-header h3 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shopping-toggle {
  font-size: 14px;
  transition: transform 0.3s;
}

.shopping-toggle.expanded {
  transform: rotate(180deg);
}

.shopping-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.shopping-list.expanded {
  max-height: 2000px;
}

.shopping-category {
  margin-top: 10px;
  background: var(--card-bg);
  border-radius: var(--border-radius-sm);
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(126, 200, 200, 0.08);
}

.shopping-category-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.shopping-item {
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed rgba(126, 200, 200, 0.1);
}

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

.shopping-item .item-amount {
  color: var(--text-secondary);
  font-size: 12px;
}

/* ── Weekly Inspiration ── */
.weekly-section {
  margin: 24px 0 16px;
  padding: 0 16px;
}

.weekly-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.weekly-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
}

.weekly-scroll::-webkit-scrollbar { display: none; }

.weekly-card {
  min-width: 145px;
  max-width: 145px;
  background: var(--card-bg);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--card-shadow);
  scroll-snap-align: start;
  padding: 14px 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.weekly-card:active {
  transform: scale(0.97);
}

.weekly-card-emoji {
  font-size: 32px;
  text-align: center;
  margin-bottom: 8px;
}

.weekly-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weekly-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.weekly-card-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(126, 200, 200, 0.12);
  color: var(--primary-dark);
  font-weight: 600;
}

/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(126, 200, 200, 0.15);
  padding-bottom: var(--safe-bottom);
  display: flex;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px 6px;
  cursor: pointer;
  transition: color 0.3s;
  border: none;
  background: none;
  color: var(--text-secondary);
  -webkit-tap-highlight-color: transparent;
}

.nav-tab.active {
  color: var(--primary-dark);
}

.nav-tab-icon {
  font-size: 22px;
  transition: transform 0.3s;
  line-height: 1;
}

.nav-tab.active .nav-tab-icon {
  transform: scale(1.15);
}

.nav-tab-label {
  font-size: 10px;
  font-weight: 700;
  margin-top: 2px;
}

/* ── Allergy Management Page ── */
.allergy-page .section-title {
  font-size: 18px;
  font-weight: 800;
  padding: 16px 16px 8px;
  color: var(--text-primary);
}

.allergy-form {
  margin: 8px 16px 16px;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 16px;
  box-shadow: var(--card-shadow);
}

.allergy-form .form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.allergy-form .form-row .form-input {
  flex: 1;
}

.allergy-type-select {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.type-option {
  flex: 1;
  padding: 10px;
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--primary-light);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  background: white;
  color: var(--text-secondary);
}

.type-option.active {
  border-color: var(--danger);
  background: rgba(255, 107, 107, 0.08);
  color: var(--danger);
}

.type-option.dislike-active {
  border-color: var(--text-secondary);
  background: rgba(138, 155, 181, 0.08);
  color: var(--text-secondary);
}

.btn-add-allergy {
  width: 100%;
  padding: 12px;
  border-radius: var(--border-radius-sm);
  background: var(--danger);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
}

.btn-add-allergy:active {
  opacity: 0.85;
}

.allergy-records {
  padding: 0 16px;
}

.allergy-record-card {
  background: var(--card-bg);
  border-radius: var(--border-radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: fadeInUp 0.3s ease;
}

.allergy-record-info {
  flex: 1;
}

.allergy-record-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.allergy-record-detail {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.allergy-record-actions {
  display: flex;
  gap: 8px;
}

.btn-delete-allergy {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 107, 107, 0.1);
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.btn-delete-allergy:active {
  background: rgba(255, 107, 107, 0.25);
}

/* Retry reminder */
.retry-section {
  margin: 16px 16px 0;
}

.retry-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-warm);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.retry-card {
  background: var(--card-bg);
  border: 2px solid rgba(255, 217, 61, 0.3);
  border-radius: var(--border-radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 10px rgba(255, 217, 61, 0.1);
}

.retry-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.retry-card-header .bell-icon {
  font-size: 18px;
  animation: pulse 2s ease infinite;
}

.retry-card-header .food-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.retry-card-message {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
}

.retry-card-actions {
  display: flex;
  gap: 8px;
}

.btn-retry-continue,
.btn-retry-try {
  flex: 1;
  padding: 8px;
  border-radius: var(--border-radius-xs);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
}

.btn-retry-continue {
  background: rgba(138, 155, 181, 0.15);
  color: var(--text-secondary);
}

.btn-retry-try {
  background: var(--accent-warm);
  color: #7A6200;
}

/* ── Matcher Page ── */
.matcher-page .section-title {
  font-size: 18px;
  font-weight: 800;
  padding: 16px 16px 8px;
  color: var(--text-primary);
}

.matcher-input-area {
  margin: 8px 16px;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 16px;
  box-shadow: var(--card-shadow);
}

.matcher-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 2px solid var(--primary-light);
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  resize: vertical;
  background: var(--primary-bg);
  transition: border-color 0.3s;
}

.matcher-textarea:focus {
  border-color: var(--primary);
}

.matcher-textarea::placeholder {
  color: var(--text-light);
}

.quick-tags {
  margin-top: 12px;
}

.quick-tags-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.quick-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-tag {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--primary-light);
  background: white;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-dark);
  cursor: pointer;
  transition: all 0.2s;
}

.quick-tag:active {
  background: var(--primary-light);
  border-color: var(--primary);
}

.quick-tag.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-analyze {
  width: 100%;
  padding: 14px;
  border-radius: var(--border-radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  margin-top: 14px;
  box-shadow: 0 4px 12px rgba(91, 168, 168, 0.3);
  transition: transform 0.2s;
}

.btn-analyze:active {
  transform: scale(0.97);
}

/* Matcher Results */
.matcher-results {
  padding: 12px 16px;
}

.result-group {
  margin-bottom: 16px;
  background: var(--card-bg);
  border-radius: var(--border-radius-sm);
  padding: 14px 16px;
  box-shadow: var(--card-shadow);
}

.result-group.safe { border-left: 4px solid var(--success); }
.result-group.caution { border-left: 4px solid var(--warning); }
.result-group.forbidden { border-left: 4px solid var(--danger); }

.result-group-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-group.safe .result-group-title { color: #2B8A3E; }
.result-group.caution .result-group-title { color: #E8590C; }
.result-group.forbidden .result-group-title { color: var(--danger); }

.result-item {
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px dashed rgba(126, 200, 200, 0.1);
}

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

.result-item .result-reason {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.matched-recipes-title {
  font-size: 16px;
  font-weight: 700;
  margin: 16px 0 10px;
  padding: 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.matched-recipe-card {
  background: var(--card-bg);
  border-radius: var(--border-radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--card-shadow);
}

.matched-recipe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.matched-recipe-name {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-add-to-today {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-add-to-today:active {
  transform: scale(0.95);
}

.matched-ingredients-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.matched-tag {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.matched-tag.used {
  background: rgba(105, 219, 124, 0.15);
  color: #2B8A3E;
}

.matched-tag.extra {
  background: rgba(138, 155, 181, 0.1);
  color: var(--text-secondary);
}

/* ── Nutrition Guide Page ── */
.nutrition-page .section-title {
  font-size: 18px;
  font-weight: 800;
  padding: 16px 16px 4px;
  color: var(--text-primary);
}

.nutrition-page .section-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 0 16px 12px;
}

.nutrition-categories {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nutrition-card {
  background: var(--card-bg);
  border-radius: var(--border-radius-sm);
  padding: 14px 16px;
  box-shadow: var(--card-shadow);
  animation: fadeInUp 0.4s ease backwards;
}

.nutrition-card:nth-child(1) { animation-delay: 0.05s; }
.nutrition-card:nth-child(2) { animation-delay: 0.1s; }
.nutrition-card:nth-child(3) { animation-delay: 0.15s; }
.nutrition-card:nth-child(4) { animation-delay: 0.2s; }
.nutrition-card:nth-child(5) { animation-delay: 0.25s; }
.nutrition-card:nth-child(6) { animation-delay: 0.3s; }

.nutrition-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.nutrition-card-name {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nutrition-card-amount {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-dark);
}

.nutrition-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
}

.progress-bar {
  height: 8px;
  background: rgba(126, 200, 200, 0.12);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  animation: progressFill 1s ease forwards;
  width: 0;
}

/* Milk info card */
.milk-info-card {
  margin: 12px 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(255, 184, 198, 0.15), rgba(255, 217, 61, 0.1));
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 184, 198, 0.2);
}

.milk-info-card h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.milk-info-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Seasoning Guide */
.seasoning-section {
  margin-top: 20px;
  padding: 0 16px;
}

.seasoning-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.seasoning-card {
  background: var(--card-bg);
  border-radius: var(--border-radius-sm);
  padding: 14px 16px;
  box-shadow: var(--card-shadow);
  margin-bottom: 10px;
}

.seasoning-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.seasoning-card-header .seasoning-icon {
  font-size: 24px;
}

.seasoning-card-header .seasoning-name {
  font-size: 15px;
  font-weight: 700;
}

.seasoning-guidelines {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.seasoning-rule {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(126, 200, 200, 0.1);
}

.seasoning-rule:last-child {
  border-bottom: none;
}

.seasoning-level {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  min-width: 52px;
  text-align: center;
}

.seasoning-level.forbidden {
  background: rgba(255, 107, 107, 0.12);
  color: var(--danger);
}

.seasoning-level.caution {
  background: rgba(255, 169, 77, 0.12);
  color: var(--warning);
}

.seasoning-level.ok {
  background: rgba(105, 219, 124, 0.12);
  color: #2B8A3E;
}

.seasoning-rule-text {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.5;
}

.seasoning-rule-text .age-label {
  font-weight: 700;
  color: var(--primary-dark);
}

/* ── Settings Page ── */
.settings-page .section-title {
  font-size: 18px;
  font-weight: 800;
  padding: 16px 16px 12px;
  color: var(--text-primary);
}

.settings-form {
  margin: 0 16px;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 16px;
  box-shadow: var(--card-shadow);
}

.settings-form .form-group {
  margin-bottom: 16px;
}

.btn-save-settings {
  width: 100%;
  padding: 14px;
  border-radius: var(--border-radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 12px rgba(91, 168, 168, 0.3);
  transition: transform 0.2s;
}

.btn-save-settings:active {
  transform: scale(0.97);
}

.settings-info {
  margin: 20px 16px;
  padding: 16px;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  text-align: center;
}

.settings-info .app-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 4px;
}

.settings-info .app-version {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: bounceIn 0.4s ease;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(138, 155, 181, 0.1);
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.2s;
}

.modal-close:active {
  background: rgba(138, 155, 181, 0.2);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: center;
}

.modal-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.modal-meal-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.modal-meal-option {
  padding: 12px 14px;
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--primary-light);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  background: white;
  color: var(--text-primary);
}

.modal-meal-option:active {
  border-color: var(--primary);
  background: rgba(126, 200, 200, 0.08);
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.badge-danger {
  background: rgba(255, 107, 107, 0.12);
  color: var(--danger);
}

.badge-warning {
  background: rgba(255, 169, 77, 0.12);
  color: var(--warning);
}

.badge-success {
  background: rgba(105, 219, 124, 0.12);
  color: #2B8A3E;
}

.badge-info {
  background: rgba(126, 200, 200, 0.12);
  color: var(--primary-dark);
}

.badge-allergy {
  background: rgba(255, 107, 107, 0.12);
  color: var(--danger);
}

.badge-dislike {
  background: rgba(138, 155, 181, 0.12);
  color: var(--text-secondary);
}

/* ── Buttons ── */
.btn {
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: transform 0.2s, opacity 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 3px 10px rgba(91, 168, 168, 0.3);
}

.btn-outline {
  background: white;
  color: var(--primary-dark);
  border: 2px solid var(--primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--border-radius-xs);
}

/* ── Tags ── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(126, 200, 200, 0.1);
  color: var(--primary-dark);
}

.tag-sm {
  padding: 2px 8px;
  font-size: 10px;
}

/* ── Utility Classes ── */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.gap-md { gap: 12px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }

.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 10px; }

.hidden { display: none !important; }
.visible { display: block; }

/* ── Cute Decorations ── */
.cute-dots {
  background-image: radial-gradient(circle, rgba(126, 200, 200, 0.12) 1px, transparent 1px);
  background-size: 20px 20px;
}

.cute-wave {
  position: relative;
}

.cute-wave::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1113-14.29,1200,52.47V0Z' fill='%237EC8C8' opacity='.08'/%3E%3C/svg%3E") no-repeat bottom;
  background-size: 100%;
}

.emoji-float {
  animation: float 4s ease-in-out infinite;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state .empty-emoji {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-state .empty-text {
  font-size: 14px;
  font-weight: 600;
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 600px; }
}

@keyframes slideUp {
  from { opacity: 1; max-height: 600px; }
  to { opacity: 0; max-height: 0; }
}

@keyframes flipCard {
  0% { transform: perspective(400px) rotateY(0); opacity: 1; }
  50% { transform: perspective(400px) rotateY(90deg); opacity: 0.5; }
  100% { transform: perspective(400px) rotateY(0); opacity: 1; }
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.8); }
  60% { opacity: 1; transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes bounceSmall {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes rotate360 {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes progressFill {
  from { width: 0; }
  to { width: var(--fill-width, 50%); }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33% { transform: translateY(-6px) rotate(1deg); }
  66% { transform: translateY(3px) rotate(-1deg); }
}

/* ── Responsive fine-tuning ── */
@media (max-width: 360px) {
  .meal-name { font-size: 14px; }
  .meal-emoji { font-size: 24px; }
  .header-info h2 { font-size: 13px; }
}

/* ── Loading state ── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: var(--border-radius-sm);
}
