/* ================================================================
   AI献立プランナー — 全面リデザイン版
   見やすさ・スマホ最適化・モダンUI
   ================================================================ */

:root {
  --primary:        #FF6B35;
  --primary-light:  #FF8C5A;
  --primary-dark:   #E04E1C;
  --primary-pale:   #FFF3EE;
  --secondary:      #2DC768;
  --secondary-dark: #1FAF55;
  --secondary-pale: #E8F9F0;
  --accent:         #FFB347;
  --accent-pale:    #FFF8EC;
  --dislike:        #E74C3C;
  --dislike-pale:   #FEF0EF;
  --like:           #2DC768;
  --like-pale:      #E8F9F0;
  --allergy:        #9B59B6;
  --allergy-pale:   #F4ECF8;
  --blue:           #3498DB;
  --blue-pale:      #EAF4FB;
  --bg:             #F7F8FA;
  --bg2:            #FFFFFF;
  --white:          #FFFFFF;
  --text:           #1A1A2E;
  --text-sub:       #555566;
  --text-muted:     #9999AA;
  --border:         #E8E8F0;
  --border-strong:  #D0D0DF;
  --shadow-sm:      0 2px 8px rgba(0,0,0,.06);
  --shadow:         0 4px 20px rgba(0,0,0,.08);
  --shadow-lg:      0 8px 40px rgba(0,0,0,.12);
  --radius:         16px;
  --radius-sm:      10px;
  --radius-xs:      6px;
  --touch:          48px;
}

/* ================================================================
   リセット & ベース
   ================================================================ */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Hiragino Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: rgba(255,107,53,.12);
  font-size: 15px;
}

/* ================================================================
   PWAインストールバナー
   ================================================================ */
.pwa-banner {
  background: linear-gradient(120deg, #1A1A2E, #2C3E6B);
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 400;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.pwa-banner-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pwa-icon { font-size: 1.6rem; flex-shrink: 0; }
.pwa-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pwa-text b { font-size: .88rem; color: #fff; font-weight: 800; }
.pwa-text small { font-size: .72rem; color: rgba(255,255,255,.7); }
.pwa-install-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 7px 16px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .18s;
  -webkit-appearance: none;
  box-shadow: 0 3px 10px rgba(255,107,53,.4);
}
.pwa-install-btn:active { transform: scale(.95); }
.pwa-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  font-size: .95rem;
  cursor: pointer;
  padding: 4px 6px;
  flex-shrink: 0;
  transition: color .15s;
}
.pwa-close-btn:hover { color: #fff; }

/* ================================================================
   免責バナー
   ================================================================ */
.disclaimer-banner {
  background: linear-gradient(90deg, #FFFBEA, #FEF3CD);
  border-bottom: 2px solid #F0C040;
  padding: 9px 16px;
}
.disclaimer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.disclaimer-inner i {
  color: #C87B00;
  font-size: .95rem;
  flex-shrink: 0;
}
.disclaimer-inner p {
  font-size: .78rem;
  color: #6B4000;
  line-height: 1.55;
  flex: 1;
}
.disclaimer-inner b { color: #C0392B; }
.disclaimer-close {
  background: none; border: none;
  font-size: 1rem; color: #AAA;
  cursor: pointer; padding: 4px 6px;
  border-radius: 50%; flex-shrink: 0;
  line-height: 1; transition: color .2s;
}
.disclaimer-close:hover { color: #555; }

.disclaimer-note {
  font-size: .74rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 7px 12px;
  background: #F5F5FA;
  border-radius: var(--radius-xs);
  border-left: 3px solid var(--border-strong);
}

/* ================================================================
   ヘッダー
   ================================================================ */
.header {
  background: linear-gradient(120deg, #FF6B35 0%, #C94010 100%);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 300;
  box-shadow: 0 3px 20px rgba(200,60,20,.35);
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 18px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon {
  font-size: 2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.2));
  flex-shrink: 0;
}
.logo-text { flex: 1; min-width: 0; }
.logo h1 {
  font-size: 1.15rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: .02em;
  text-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.logo p {
  font-size: .68rem;
  color: rgba(255,255,255,.82);
  margin-top: 1px;
  display: none;
}
.header-badge {
  margin-left: auto;
  background: rgba(255,255,255,.18);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,.45);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: .72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ================================================================
   メイン
   ================================================================ */
.main {
  padding: 20px 14px 100px;
}
.container {
  max-width: 900px;
  margin: 0 auto;
}

/* ================================================================
   ステップナビ
   ================================================================ */
.step-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  padding: 16px 14px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.step-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .88rem;
  transition: all .3s;
  flex-shrink: 0;
}
.step span {
  font-size: .62rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  display: none;
}
.step.active .step-circle {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 3px 12px rgba(255,107,53,.4);
  transform: scale(1.1);
}
.step.active span { color: var(--primary); font-weight: 800; }
.step.done  .step-circle { background: var(--secondary); color: #fff; }
.step.done  span { color: var(--secondary); }
.step-line {
  flex: 1; height: 2px;
  background: var(--border);
  min-width: 18px; max-width: 60px;
  margin-bottom: 18px;
  transition: background .35s;
}
.step-line.done { background: var(--secondary); }

/* ================================================================
   カード
   ================================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 22px 18px;
  margin-bottom: 14px;
  animation: fadeUp .3s ease;
}
.card.hidden { display: none; }

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

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.card-icon { font-size: 1.8rem; }
.card-header h2 {
  font-size: 1.18rem;
  font-weight: 900;
  color: var(--text);
  flex: 1; min-width: 0;
}
.card-desc {
  font-size: .84rem;
  color: var(--text-sub);
  margin-bottom: 18px;
  line-height: 1.75;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-xs);
  border-left: 3px solid var(--primary);
}

/* ================================================================
   食材グループ
   ================================================================ */
.ingredient-sections,
.pref-sections,
.form-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ingredient-group,
.pref-group,
.form-group-block {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1.5px solid var(--border);
}

.group-title {
  font-size: .88rem;
  font-weight: 800;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--text);
}
.group-title i { color: var(--primary); font-size: .9rem; }
.group-title.dislike i { color: var(--dislike); }
.group-title.like    i { color: var(--like); }
.group-title.allergy i { color: var(--allergy); }
.group-tip {
  font-size: .67rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--white);
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-left: 2px;
}

/* ================================================================
   プリセットボタン・タグ
   ================================================================ */
.tag-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.preset-btn {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border-strong);
  background: var(--white);
  color: var(--text-sub);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: .82rem;
  cursor: pointer;
  transition: all .18s;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: var(--shadow-sm);
}
.preset-btn:active { opacity: .72; transform: scale(.94); }
.preset-btn.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 3px 10px rgba(255,107,53,.35);
}
.dislike-preset.selected { background: var(--dislike); border-color: var(--dislike); }
.like-preset.selected    { background: var(--like);    border-color: var(--like); }
.allergy-preset.selected { background: var(--allergy); border-color: var(--allergy); }

@media (hover: hover) {
  .preset-btn:not(.selected):hover {
    border-color: var(--primary); color: var(--primary); background: var(--primary-pale);
  }
  .dislike-preset:not(.selected):hover { border-color: var(--dislike); color: var(--dislike); background: var(--dislike-pale); }
  .like-preset:not(.selected):hover    { border-color: var(--like);    color: var(--like);    background: var(--like-pale); }
  .allergy-preset:not(.selected):hover { border-color: var(--allergy); color: var(--allergy); background: var(--allergy-pale); }
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
  min-height: 4px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  animation: tagPop .18s ease;
}
@keyframes tagPop { from { transform: scale(.7); opacity:0; } to { transform: scale(1); opacity:1; } }
.tag.dislike { background: var(--dislike); }
.tag.like    { background: var(--like); }
.tag.allergy { background: var(--allergy); }

.tag-remove {
  background: none; border: none;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  font-size: .9rem; padding: 0 0 0 2px;
  min-width: 20px; min-height: 20px;
  display: flex; align-items: center; justify-content: center;
}
.tag-remove:active { color: #fff; }

.custom-input-row { display: flex; gap: 8px; }
.custom-input {
  flex: 1; min-width: 0;
  padding: 10px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 16px;
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
}
.custom-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,53,.12);
}
.custom-input::placeholder { color: var(--text-muted); }

.add-btn {
  width: var(--touch); height: var(--touch);
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all .18s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  -webkit-appearance: none;
  box-shadow: 0 3px 10px rgba(255,107,53,.3);
}
.add-btn:active { transform: scale(.92); }
.dislike-add { background: var(--dislike); box-shadow: 0 3px 10px rgba(231,76,60,.3); }
.like-add    { background: var(--like);    box-shadow: 0 3px 10px rgba(45,199,104,.3); }
.allergy-add { background: var(--allergy); box-shadow: 0 3px 10px rgba(155,89,182,.3); }

/* ================================================================
   フォーム
   ================================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.form-item label {
  display: block;
  font-size: .82rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-sub);
}

.number-input {
  display: flex;
  align-items: center;
  gap: 12px;
}
.number-input button {
  width: var(--touch); height: var(--touch);
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: var(--white);
  color: var(--primary);
  font-size: 1.25rem;
  cursor: pointer;
  font-weight: 900;
  transition: all .18s;
  display: flex; align-items: center; justify-content: center;
  -webkit-appearance: none;
  flex-shrink: 0;
}
.number-input button:active { background: var(--primary); color: #fff; transform: scale(.92); }
.number-input span {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary);
  min-width: 36px;
  text-align: center;
}

.select-input {
  width: 100%;
  padding: 12px 40px 12px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 16px;
  background: var(--white);
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.select-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,53,.12);
}

.age-info-box {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--blue-pale);
  border-radius: var(--radius-sm);
  border: 1.5px solid #AED6F1;
}
.age-info-inner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .82rem;
  color: #1A5276;
  line-height: 1.65;
  font-weight: 600;
}
.age-info-inner i { color: #2980B9; margin-top: 2px; flex-shrink: 0; }

/* ================================================================
   家族情報 - 子ども個別設定
   ================================================================ */
.family-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  gap: 12px;
}
.family-label {
  font-size: .85rem;
  font-weight: 800;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 7px;
}
.family-label i { color: var(--primary); }

.children-section { margin-bottom: 12px; }
.children-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
}
.btn-add-child {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--primary);
  background: var(--white);
  color: var(--primary);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: .8rem;
  font-weight: 800;
  cursor: pointer;
  transition: all .18s;
  -webkit-appearance: none;
  white-space: nowrap;
}
.btn-add-child:active,
.btn-add-child:hover { background: var(--primary); color: #fff; }

.children-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.child-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  animation: tagPop .2s ease;
}
.child-item-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.child-item-body {
  flex: 1;
  min-width: 0;
}
.child-item-name {
  font-size: .78rem;
  font-weight: 800;
  color: var(--text-sub);
  margin-bottom: 4px;
}
.child-item-select {
  width: 100%;
  padding: 8px 32px 8px 10px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-xs);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color .18s;
}
.child-item-select:focus { border-color: var(--primary); }
.child-item-nut {
  font-size: .7rem;
  color: var(--blue);
  font-weight: 700;
  margin-top: 3px;
}
.btn-remove-child {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--dislike);
  background: var(--white);
  color: var(--dislike);
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .18s;
  -webkit-appearance: none;
}
.btn-remove-child:active,
.btn-remove-child:hover { background: var(--dislike); color: #fff; }

.children-empty {
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
}

/* ================================================================
   栄養チェック */
.nutrition-checks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--white);
  transition: all .18s;
  min-height: var(--touch);
  -webkit-tap-highlight-color: transparent;
}
.check-item:active { background: var(--primary-pale); border-color: var(--primary); }
@media (hover: hover) {
  .check-item:hover { border-color: var(--primary); background: var(--primary-pale); }
}
.check-item input[type="checkbox"] { display: none; }
.check-box {
  width: 24px; height: 24px;
  min-width: 24px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  transition: all .18s;
}
.check-item input:checked + .check-box {
  background: var(--primary);
  border-color: var(--primary);
}
.check-item input:checked + .check-box::after {
  content: '✓';
  color: #fff;
  font-size: .88rem;
  font-weight: 900;
}
.check-label { display: flex; flex-direction: column; gap: 2px; }
.check-label b     { font-size: .85rem; font-weight: 800; }
.check-label small { font-size: .72rem; color: var(--text-muted); }

.textarea-input {
  width: 100%;
  min-height: 80px;
  padding: 12px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 16px;
  background: var(--white);
  color: var(--text);
  resize: vertical;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  line-height: 1.7;
  -webkit-appearance: none;
}
.textarea-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,53,.12);
}
.textarea-input::placeholder { color: var(--text-muted); }

/* ================================================================
   フッターボタン
   ================================================================ */
.card-footer {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.card-footer.between {
  justify-content: space-between;
  align-items: center;
}

.btn-next, .btn-generate {
  min-height: var(--touch);
  padding: 0 24px;
  border-radius: 30px;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: .92rem;
  font-weight: 800;
  cursor: pointer;
  transition: all .2s;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 16px rgba(255,107,53,.38);
  -webkit-appearance: none;
}
.btn-next:active, .btn-generate:active {
  transform: scale(.95);
  box-shadow: 0 2px 8px rgba(255,107,53,.28);
}
.btn-generate {
  font-size: 1rem;
  font-weight: 900;
  padding: 0 28px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 6px 24px rgba(255,107,53,.42);
}

.btn-back {
  min-height: var(--touch);
  padding: 0 18px;
  border-radius: 30px;
  border: 1.5px solid var(--border-strong);
  background: var(--white);
  color: var(--text-sub);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  display: flex; align-items: center; gap: 8px;
  -webkit-appearance: none;
}
.btn-back:active { border-color: var(--primary); color: var(--primary); }

.btn-regenerate {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1.5px solid var(--primary);
  background: var(--white);
  color: var(--primary);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: .8rem;
  font-weight: 800;
  cursor: pointer;
  transition: all .18s;
  display: flex; align-items: center; gap: 6px;
  margin-left: auto;
  -webkit-appearance: none;
}
.btn-regenerate:active { background: var(--primary); color: #fff; }

.btn-print {
  min-height: var(--touch);
  padding: 0 20px;
  border-radius: 30px;
  border: 1.5px solid var(--secondary);
  background: var(--white);
  color: var(--secondary-dark);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: .88rem;
  font-weight: 800;
  cursor: pointer;
  transition: all .18s;
  display: flex; align-items: center; gap: 8px;
  -webkit-appearance: none;
}
.btn-print:active { background: var(--secondary); color: #fff; }

@media (hover: hover) {
  .btn-next:hover, .btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(255,107,53,.45);
  }
  .btn-back:hover      { border-color: var(--primary); color: var(--primary); }
  .btn-regenerate:hover { background: var(--primary); color: #fff; }
  .btn-print:hover     { background: var(--secondary); color: #fff; }
}

/* ================================================================
   ローディング
   ================================================================ */
.loading-box {
  text-align: center;
  padding: 40px 16px;
}
.spinner {
  width: 52px; height: 52px;
  border: 4px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin .85s linear infinite;
  margin: 0 auto 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 1.05rem; font-weight: 800; margin-bottom: 6px; }
.loading-sub  { font-size: .8rem; color: var(--text-muted); margin-bottom: 20px; line-height: 1.65; }
.loading-steps { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.lstep {
  padding: 7px 14px;
  border-radius: 20px;
  background: var(--border);
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 700;
  transition: all .4s;
}
.lstep.active { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(255,107,53,.3); }
.lstep.done   { background: var(--secondary); color: #fff; }

/* ================================================================
   サマリーカード
   ================================================================ */
.summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}
.summary-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  background: var(--primary-pale);
  border: 1.5px solid rgba(255,107,53,.18);
  font-size: .79rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.45;
}
.summary-item i { color: var(--primary); font-size: .92rem; flex-shrink: 0; }
.score-item {
  background: var(--secondary-pale);
  border-color: rgba(45,199,104,.25);
  color: #1A6B3C;
}
.score-item i { color: var(--secondary); }

/* ================================================================
   週間カレンダー
   ================================================================ */
.menu-calendar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}
.day-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.day-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 11px 16px;
  background: linear-gradient(120deg, var(--primary), var(--primary-dark));
  color: #fff;
}
.day-name  { font-size: .98rem; font-weight: 900; }
.day-date  { font-size: .75rem; opacity: .9; }
.day-theme {
  font-size: .72rem;
  background: rgba(255,255,255,.22);
  padding: 3px 9px;
  border-radius: 10px;
  font-weight: 700;
  margin-left: auto;
}

.day-nutrition-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 8px 14px;
  background: #FAFAFA;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.day-nut-label {
  font-size: .74rem;
  font-weight: 700;
  color: var(--text-sub);
}

/* 食事セル */
.meals-row { display: flex; flex-direction: column; }
.meal-cell {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.meal-cell:last-child { border-bottom: none; }
.meal-type {
  font-size: .7rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.meal-type i { font-size: .75rem; }
.meal-main {
  font-size: .95rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.4;
}
.meal-sub  {
  font-size: .78rem;
  color: var(--text-sub);
  line-height: 1.5;
}
.meal-kcal {
  font-size: .75rem;
  font-weight: 800;
  color: var(--primary);
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.meal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.meal-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: .68rem;
  font-weight: 800;
}
.badge-fav   { background: var(--secondary-pale); color: var(--secondary-dark); }
.badge-stock { background: var(--primary-pale);   color: var(--primary-dark); }
.badge-fish  { background: var(--blue-pale);       color: #1A6094; }
.badge-iron  { background: #FEF5E7;                color: #C0570B; }
.badge-ca    { background: var(--blue-pale);       color: #1A5276; }

/* 調理ポイント */
.meal-point { margin-top: 10px; }
.point-toggle {
  font-size: .76rem;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-pale);
  border: 1px solid rgba(255,107,53,.2);
  padding: 7px 13px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  min-height: 36px;
  user-select: none;
  transition: background .15s;
}
.point-toggle:active { background: rgba(255,107,53,.18); }
.point-detail {
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: .79rem;
  line-height: 1.8;
}
.point-detail p { margin-bottom: 7px; }
.point-detail p:last-child { margin-bottom: 0; }
.point-detail.hidden { display: none; }

/* ================================================================
   セクションタイトル
   ================================================================ */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-title h3 {
  font-size: 1rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 7px;
}
.section-title h3 i { color: var(--secondary); }

/* ================================================================
   買い物リスト
   ================================================================ */
.btn-copy {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1.5px solid var(--secondary);
  background: var(--white);
  color: var(--secondary-dark);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: .8rem;
  font-weight: 800;
  cursor: pointer;
  transition: all .18s;
  display: flex; align-items: center; gap: 6px;
  -webkit-appearance: none;
}
.btn-copy:active { background: var(--secondary); color: #fff; }
@media (hover: hover) {
  .btn-copy:hover { background: var(--secondary); color: #fff; }
}

.shopping-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.shopping-category {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1.5px solid var(--border);
}
.shopping-cat-name {
  font-size: .75rem;
  font-weight: 800;
  color: var(--text-sub);
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}
.shopping-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: .84rem;
  cursor: pointer;
  min-height: 36px;
  transition: opacity .15s;
}
.shopping-item input[type="checkbox"] { display: none; }
.shop-check {
  width: 20px; height: 20px; min-width: 20px;
  border-radius: 5px;
  border: 2px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  transition: all .18s;
  flex-shrink: 0;
}
.shopping-item.checked .shop-check {
  background: var(--secondary);
  border-color: var(--secondary);
}
.shopping-item.checked .shop-check::after {
  content: '✓'; color: #fff; font-size: .7rem; font-weight: 900;
}
.shopping-item.checked span { text-decoration: line-through; color: var(--text-muted); }

/* ================================================================
   栄養バランス
   ================================================================ */
.nutrition-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.nut-bar-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
}
.nut-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.nut-label-block {
  display: flex;
  align-items: center;
  gap: 9px;
}
.nut-icon  { font-size: 1.3rem; }
.nut-name  { font-size: .86rem; font-weight: 800; }
.nut-desc  { font-size: .68rem; color: var(--text-muted); margin-top: 1px; }
.nut-status {
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(0,0,0,.05);
}

.nut-bar-area { width: 100%; }
.nut-bar-bg {
  height: 14px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.nut-bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
  width: 0%;
}
.nut-values {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 600;
}
.nut-rate { font-weight: 800; font-size: .78rem; }

/* ================================================================
   PFCバランス
   ================================================================ */
.pfc-chart {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  border: 1.5px solid var(--border);
  margin-bottom: 12px;
}
.pfc-title { font-size: .9rem; font-weight: 900; margin-bottom: 12px; }
.pfc-bar-wrapper {
  display: flex;
  height: 38px;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.06);
}
.pfc-seg {
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 900; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.22);
  transition: width .8s ease;
  min-width: 26px;
}
.pfc-legend {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.pfc-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 700;
  border: 1.5px solid var(--border);
}
.pfc-item.ok   { background: var(--secondary-pale); border-color: #A8DFBC; color: #1A6B3C; }
.pfc-item.warn { background: var(--accent-pale);    border-color: #FADA80; color: #7A5000; }
.pfc-item i    { font-size: .75rem; }

/* ================================================================
   アドバイス
   ================================================================ */
.advice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 22px;
}
.advice-item {
  background: var(--white);
  border: 1.5px solid #AED6F1;
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  animation: slideIn .35s ease both;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.advice-item p { font-size: .84rem; line-height: 1.8; color: var(--text); }

/* ================================================================
   ボトムナビ（スマホ専用）
   ================================================================ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1.5px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,.1);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-inner {
  display: flex;
  align-items: stretch;
}
.bottom-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 6px;
  background: none; border: none;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: .6rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .18s;
  -webkit-tap-highlight-color: transparent;
  min-height: 56px;
}
.bottom-nav-btn i { font-size: 1.25rem; transition: transform .18s; }
.bottom-nav-btn.active { color: var(--primary); }
.bottom-nav-btn.active i { color: var(--primary); transform: scale(1.1); }
.bottom-nav-btn:active { background: rgba(255,107,53,.08); }

/* ================================================================
   トースト
   ================================================================ */
.toast {
  position: fixed;
  bottom: calc(68px + env(safe-area-inset-bottom, 0));
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: rgba(26,26,46,.9);
  color: #fff;
  padding: 11px 22px;
  border-radius: 30px;
  font-size: .88rem;
  font-weight: 700;
  opacity: 0;
  transition: all .28s;
  z-index: 999;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.hidden { display: none; }

/* ================================================================
   印刷
   ================================================================ */
@media print {
  .header, .step-nav, .card-footer, .btn-regenerate,
  .advice-section, #shopping-section .btn-copy,
  #loading-area, .meal-point, .bottom-nav,
  .disclaimer-banner { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .day-header {
    background: #FF6B35 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ================================================================
   タブレット (600px+)
   ================================================================ */
@media (min-width: 600px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .nutrition-checks { grid-template-columns: repeat(2, 1fr); }
  .step span { display: block; }
  .step-circle { width: 36px; height: 36px; }
}

/* ================================================================
   デスクトップ (900px+)
   ================================================================ */
@media (min-width: 900px) {
  .main { padding: 30px 20px 60px; }
  .card { padding: 28px 32px; }
  .logo h1 { font-size: 1.3rem; }
  .logo p { display: block; }
  .form-grid { grid-template-columns: repeat(3, 1fr); }
  .nutrition-checks { grid-template-columns: repeat(3, 1fr); }
  .meals-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    flex-direction: unset;
  }
  .meal-cell { border-bottom: none; border-right: 1.5px solid var(--border); }
  .meal-cell:last-child { border-right: none; }
  .nut-bar-row { flex-direction: row; align-items: center; gap: 14px; }
  .nut-label-block { width: 160px; min-width: 160px; }
  .nut-bar-area { flex: 1; }
  .nut-status { white-space: nowrap; }
  .pfc-legend { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .pfc-item { flex: 1; min-width: 200px; }
  .summary-cards { display: flex; flex-wrap: wrap; }
  .summary-item { flex: 1; min-width: 200px; }
  .shopping-list { grid-template-columns: repeat(3, 1fr); }
}

/* ================================================================
   スマホ専用 (<600px)
   ================================================================ */
@media (max-width: 599px) {
  .bottom-nav { display: block; }
  .header-badge { display: none; }
  .logo p { display: none; }
  .day-theme { display: none; }
  .card { padding: 18px 14px; }
  .ingredient-group, .pref-group, .form-group-block { padding: 12px; }
}

/* ================================================================
   iPhone SE (≤375px)
   ================================================================ */
@media (max-width: 375px) {
  .card { padding: 14px 12px; }
  .shopping-list { grid-template-columns: 1fr; }
  .summary-cards { grid-template-columns: 1fr; }
  .step-line { min-width: 8px; }
  .btn-generate { font-size: .88rem; padding: 0 18px; }
}
