/* ==================== ダンごはん スタイル v3「ビタミンポップ」 ====================
   方向性: 太い輪郭線(3px) / ビビッド配色(オレンジ・イエロー・グリーン・ピンク) /
           大きな角丸 / オフセットシャドウ / ステッカー風装飾 / 水玉背景
   モバイルファースト(375px基準・320pxでも横スクロールなし)
   本文テキストは墨色ベースで可読性最優先。
   manifest.json の theme_color は #ff8a2b（メタ・CSS主色と三者一致） */

:root {
  --ink: #26211c;             /* 墨: 輪郭線・本文 */
  --ink-soft: #4c443a;
  --muted: #6f6247;           /* 補足文（クリーム背景で4.5:1以上） */
  --orange: #ff8a2b;          /* 主役 */
  --orange-deep: #e05f0e;
  --yellow: #ffd93d;
  --yellow-pale: #fff3c9;     /* 背景 */
  --cream: #fff8e2;           /* カード内の面 */
  --green: #3fbf6f;
  --green-deep: #1e8747;
  --green-pale: #d9f3e2;
  --pink: #ff5d8f;
  --pink-pale: #ffe0ea;
  --card: #ffffff;
  --danger: #d63c22;
  --danger-pale: #ffe3dc;
  --bw: 3px;                  /* 輪郭線の太さ */
  --pop: 5px 5px 0 var(--ink);   /* オフセットシャドウ(大) */
  --pop-s: 3px 3px 0 var(--ink); /* オフセットシャドウ(小) */
  --pop-xs: 2px 2px 0 var(--ink);
  --radius-xl: 24px;
  --radius-l: 20px;
  --radius-m: 16px;
  --radius-s: 12px;
}

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

/* ---------- モバイル適合の防御策 ---------- */
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; }
img, svg, table { max-width: 100%; }
img, svg { height: auto; }

body {
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN W3", "Yu Gothic UI", sans-serif;
  background: var(--yellow-pale);
  /* 水玉パターン */
  background-image: radial-gradient(rgba(255, 138, 43, .16) 3px, transparent 3.5px);
  background-size: 34px 34px;
  color: var(--ink);
  line-height: 1.6;
  overflow-wrap: anywhere;
  padding: calc(12px + env(safe-area-inset-top)) 12px
           calc(96px + env(safe-area-inset-bottom));
}

.container { max-width: 1080px; margin: 0 auto; }

/* ---------- タブ表示制御（ボトムナビ3タブ） ---------- */
@media screen {
  body:not([data-tab="menu"]) .tab-menu { display: none !important; }
  body:not([data-tab="shop"]) .tab-shop { display: none !important; }
  body:not([data-tab="prep"]) .tab-prep { display: none !important; }
  /* 買い物タブ: 生成済みならプレースホルダを隠す */
  body[data-generated="1"] .shop-empty { display: none !important; }
}

/* ---------- ボトムナビ ---------- */
.bnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: flex; justify-content: center; gap: 8px;
  background: var(--card);
  border-top: var(--bw) solid var(--ink);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
}
.bnav-btn {
  flex: 1; max-width: 160px; min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; background: none; border: 2px solid transparent; cursor: pointer;
  font-family: inherit; color: var(--ink-soft); border-radius: var(--radius-m);
  padding: 4px 6px; box-shadow: none;
}
.bnav-btn:hover { background: var(--yellow-pale); color: var(--ink); }
.bnav-btn:active { transform: none; box-shadow: none; }
.bnav-icon {
  line-height: 0;
  padding: 4px 14px; border-radius: 999px;
}
.bnav-icon svg { display: inline-block; width: 22px; height: 22px; }
.bnav-label { font-size: .7rem; font-weight: 800; letter-spacing: .04em; }
body[data-tab="menu"] .bnav-btn[data-nav="menu"],
body[data-tab="shop"] .bnav-btn[data-nav="shop"],
body[data-tab="prep"] .bnav-btn[data-nav="prep"] {
  color: var(--ink);
  background: var(--yellow);
  border-color: var(--ink);
  box-shadow: var(--pop-s);
}

/* ---------- ドット絵アイコン（assets/pixel-icons.svg スプライト・SPEC 5.11） ---------- */
.px-icon {
  display: inline-block;
  width: 1.15em; height: 1.15em;
  vertical-align: -0.2em;
  flex-shrink: 0;
  image-rendering: pixelated;
}
/* 見出しはやや大きめの文字なので縦位置を微調整 */
h2 .px-icon, h3 .px-icon, .prep-head h2 .px-icon { vertical-align: -0.18em; }
/* サイズ違いが必要な場合の追加クラス */
.px-icon.lg { width: 1.5em; height: 1.5em; vertical-align: -0.35em; }
/* ボトムナビ: フルカラーのドット絵のため、非アクティブは減光＋グレースケールで表現 */
.bnav-icon .px-icon {
  width: 22px; height: 22px;
  vertical-align: middle;
  opacity: .45;
  filter: grayscale(.6);
  transition: opacity .15s, filter .15s;
}
.bnav-btn:hover .bnav-icon .px-icon { opacity: .8; filter: grayscale(.3); }
body[data-tab="menu"] .bnav-btn[data-nav="menu"] .px-icon,
body[data-tab="shop"] .bnav-btn[data-nav="shop"] .px-icon,
body[data-tab="prep"] .bnav-btn[data-nav="prep"] .px-icon {
  opacity: 1;
  filter: none;
}

/* ---------- ヒーロー（ビビッドオレンジ＋白抜きスタンプ柄＋ステッカー） ---------- */
.hero {
  position: relative;
  background: var(--orange);
  color: var(--ink);
  padding: max(30px, calc(18px + env(safe-area-inset-top))) 20px 30px;
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius-xl);
  box-shadow: var(--pop);
  text-align: center;
  margin-bottom: 22px;
  overflow: hidden;
}
.hero-pattern {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; opacity: .55;
}
.hero > .brand, .hero > h1, .hero > .sub { position: relative; z-index: 1; }
.hero .brand {
  display: inline-block; position: relative;
  background: var(--card);
  padding: 14px 22px 10px;
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius-l);
  box-shadow: var(--pop-s);
  transform: rotate(-2deg);
  margin-bottom: 16px;
}
.hero .brand .logo-svg { display: block; height: auto; }
/* ステッカー（ロゴカードの角に。ロゴには被せない） */
.sticker {
  position: absolute; z-index: 2;
  border: 2px solid var(--ink); border-radius: 999px;
  font-size: .68rem; font-weight: 900; letter-spacing: .04em;
  padding: 4px 11px; box-shadow: var(--pop-xs);
  white-space: nowrap; line-height: 1.4;
}
.sticker.s1 { background: var(--yellow); color: var(--ink); top: -12px; left: -14px; transform: rotate(-9deg); } /* 設定ボタンとの重なり回避で左上へ */
.sticker.s2 { background: var(--pink); color: #fff; bottom: -12px; right: -12px; transform: rotate(8deg); }
.hero h1 {
  font-size: clamp(1.02rem, 5.8vw, 1.45rem); /* 狭い画面では自動縮小して1行目「献立で悩んでた時間を、」を1行に収める */
  line-height: 1.5; margin: 10px 0; font-weight: 900;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
}
.hero .sub { font-size: .84rem; color: #3d2508; line-height: 1.8; font-weight: 700; }
.gear-btn {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 2;
  background: var(--card); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 999px;
  box-shadow: var(--pop-xs);
  padding: 7px 14px; font-size: .82rem; font-weight: 800;
  cursor: pointer; font-family: inherit;
}
.gear-btn:hover { background: var(--yellow); }

/* ---------- ボタン共通（ピル型＋輪郭線＋押し込みアクション） ---------- */
button {
  background: var(--card); border: 2px solid var(--ink); color: var(--ink);
  padding: 11px 21px; border-radius: 999px; font-size: .95rem;
  cursor: pointer; font-weight: 800;
  box-shadow: var(--pop-s);
  transition: background .15s, color .15s, transform .08s, box-shadow .08s;
  font-family: inherit;
}
button:hover { background: var(--yellow-pale); }
button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
button.primary { background: var(--orange); color: #fff; border-width: var(--bw); text-shadow: 1px 1px 0 var(--orange-deep); }
button.primary:hover { background: var(--orange-deep); }
button.big { font-size: 1.1rem; padding: 16px 34px; box-shadow: var(--pop); }
button.big:active { box-shadow: var(--pop-xs); }
button.small { padding: 5px 13px; font-size: .8rem; box-shadow: var(--pop-xs); }
button.ghost {
  background: transparent; color: var(--ink-soft);
  border: 2px solid var(--ink-soft); box-shadow: none;
}
button.ghost:hover { background: var(--cream); color: var(--ink); border-color: var(--ink); }
button.ghost:active { transform: translate(1px, 1px); }

.controls {
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: center; margin-bottom: 20px;
}
.mode-toggle { text-align: center; margin-bottom: 16px; }
.mode-toggle label {
  display: inline-flex; align-items: center; gap: 8px; text-align: left;
  background: var(--card); padding: 12px 18px;
  border: 2px solid var(--ink); border-radius: var(--radius-l);
  box-shadow: var(--pop-s);
  font-size: .85rem; font-weight: 800; cursor: pointer;
  user-select: none; max-width: 100%;
}
.mode-toggle input { width: 18px; height: 18px; accent-color: var(--green-deep); cursor: pointer; flex-shrink: 0; }

/* ---------- 繰越バナー ---------- */
.carry-banner {
  max-width: 720px; margin: 0 auto 16px;
  background: var(--yellow);
  border: 2px solid var(--ink); border-radius: var(--radius-m);
  box-shadow: var(--pop-s);
  padding: 12px 16px; font-size: .84rem; color: var(--ink); font-weight: 700; line-height: 1.7;
}

/* ---------- じゅんびタブ見出し ---------- */
.prep-head { text-align: center; margin: 4px auto 16px; }
.prep-head h2 { font-size: 1.3rem; color: var(--ink); font-weight: 900; }
.prep-head p { font-size: .82rem; color: var(--muted); font-weight: 700; margin-top: 2px; }

/* ---------- 設定パネル（手持ち・お気に入り） ---------- */
.setup-area { max-width: 720px; margin: 0 auto 18px; }
.panel {
  background: var(--card);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius-l); margin-bottom: 14px; overflow: hidden;
  box-shadow: var(--pop-s);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; cursor: pointer; user-select: none;
  font-weight: 800; font-size: .92rem; color: var(--ink);
}
.panel-head:hover { background: var(--yellow-pale); }
.panel-head .count-chip {
  font-size: .72rem; background: var(--pink); color: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px; padding: 0 8px; margin-left: 6px; font-weight: 900;
}
.panel-head .arrow { color: var(--orange); transition: transform .2s; font-weight: 900; }
.panel.open .panel-head .arrow { transform: rotate(180deg); }
.panel-body { display: none; padding: 0 18px 18px; }
.panel.open .panel-body { display: block; }
.panel-hint { font-size: .8rem; color: var(--muted); margin-bottom: 10px; line-height: 1.6; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }

.pantry-cat { margin-bottom: 10px; }
.pantry-cat .cat-name { font-size: .8rem; color: var(--muted); margin-bottom: 5px; font-weight: 800; }
.pantry-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.pantry-tag {
  font-size: .82rem; padding: 5px 12px; border-radius: 999px;
  background: var(--cream); color: var(--ink-soft);
  border: 2px solid #e3d5a8;
  cursor: pointer; user-select: none; transition: all .12s; font-weight: 700;
}
.pantry-tag.on { background: var(--green); color: var(--ink); border-color: var(--ink); font-weight: 800; box-shadow: var(--pop-xs); }
.pantry-tag.on::before { content: "✓ "; }

.pref-heading { font-weight: 900; font-size: .85rem; margin-bottom: 4px; }
.fav-heading { color: #9a6d00; }
.dis-heading { color: var(--danger); margin-top: 12px; }
.pref-empty { font-size: .82rem; color: var(--muted); padding: 4px 0; }
.pref-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; border-bottom: 2px dotted #e8ddb8; font-size: .88rem; font-weight: 600;
}
.pref-row:last-child { border-bottom: none; }
.pref-row .pref-cat { font-size: .7rem; color: var(--muted); margin-left: 6px; }
.pref-row .pref-del {
  background: none; border: none; box-shadow: none;
  color: var(--danger); cursor: pointer;
  font-size: .88rem; padding: 2px 8px; font-weight: 900;
}
.pref-row .pref-del:active { transform: none; }
.pref-warning {
  background: var(--danger-pale); color: #8c2814;
  border: 2px solid var(--danger);
  padding: 10px 14px; border-radius: var(--radius-s); font-size: .82rem; font-weight: 700; margin-top: 8px;
}

/* ---------- 設定再編集カード（じゅんびタブ） ---------- */
.settings-card {
  max-width: 720px; margin: 0 auto 22px;
  background: var(--green-pale);
  border: var(--bw) solid var(--ink); border-radius: var(--radius-l);
  box-shadow: var(--pop-s);
  padding: 18px 18px 20px; text-align: center;
}
.settings-card .settings-copy { font-size: .84rem; color: var(--ink-soft); font-weight: 700; margin-bottom: 14px; line-height: 1.7; }

/* ---------- セクション（白カード・輪郭線＋オフセットシャドウ） ---------- */
section {
  background: var(--card);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius-xl); padding: 20px 16px 22px;
  margin-bottom: 22px;
  box-shadow: var(--pop);
}
section h2 {
  font-size: 1.05rem; color: var(--ink); margin-bottom: 14px;
  background: var(--yellow);
  border: 2px solid var(--ink); border-radius: var(--radius-m);
  box-shadow: var(--pop-xs);
  padding: 10px 16px; font-weight: 900;
}
.section-hint { font-size: .82rem; color: var(--muted); margin-bottom: 12px; line-height: 1.7; }
.hint-strong { color: var(--orange-deep); font-weight: 800; }

.legend { display: flex; flex-direction: column; gap: 8px; font-size: .84rem; font-weight: 600; }
.legend-note { font-size: .82rem; margin-top: 10px; color: var(--muted); }

.empty-state {
  text-align: center; padding: 30px 16px 40px; color: var(--muted);
  background: var(--card);
  border: var(--bw) solid var(--ink); border-radius: var(--radius-xl);
  box-shadow: var(--pop);
}
.empty-illust { display: block; margin: 0 auto 14px; }
.empty-main { font-size: 1.02rem; line-height: 2; color: var(--ink); font-weight: 800; }
.empty-sub { font-size: .82rem; margin-top: 10px; font-weight: 600; }

/* 買い物タブの未生成プレースホルダ */
.shop-empty {
  text-align: center; padding: 36px 16px 44px; color: var(--muted);
  background: var(--card);
  border: var(--bw) solid var(--ink); border-radius: var(--radius-xl);
  box-shadow: var(--pop);
}
.shop-illust { display: block; margin: 0 auto 14px; }
.shop-empty-main { font-size: 1.02rem; font-weight: 800; color: var(--ink); }
.shop-empty-sub { font-size: .82rem; margin-top: 8px; line-height: 1.9; font-weight: 600; }

.saved-info {
  text-align: center; margin: 0 auto 14px;
  background: var(--card); color: var(--muted); font-size: .78rem; font-weight: 700;
  border: 2px solid #e3d5a8;
  padding: 5px 16px; border-radius: 999px; width: fit-content;
}

.summary-box {
  background: var(--cream);
  border: 2px solid var(--ink);
  padding: 14px 16px; border-radius: var(--radius-m);
  font-size: .88rem; font-weight: 600; line-height: 1.9;
}
.summary-box .goal-line { display: block; }

/* ---------- 献立グリッド ---------- */
.menu-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 700px) { .menu-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .menu-grid { grid-template-columns: repeat(3, 1fr); } }

.day-card {
  border: 2px solid var(--ink);
  border-radius: var(--radius-l);
  padding: 14px 12px; background: var(--cream);
  box-shadow: var(--pop-s);
  display: flex; flex-direction: column;
}
.day-label {
  text-align: center; font-weight: 900; font-size: .95rem;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid var(--ink); border-radius: 999px;
  padding: 2px 16px;
}
.day-head { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 10px; }
.meal-block { margin-bottom: 10px; }
.meal-block:last-of-type { margin-bottom: 6px; }
.meal-title {
  font-size: .78rem; color: var(--ink-soft); margin-bottom: 5px; font-weight: 800;
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
}
.meal-title .bento-note {
  font-size: .68rem; color: var(--ink); background: var(--yellow);
  border: 1.5px solid var(--ink); font-weight: 800;
  padding: 0 8px; border-radius: 999px; white-space: nowrap; flex-shrink: 1;
}
.meal-title button.small { background: var(--card); padding: 3px 10px; }

.dish {
  background: var(--card); padding: 10px 12px;
  border: 2px solid var(--ink); border-radius: var(--radius-m);
  margin-bottom: 8px; font-size: .86rem; font-weight: 700; cursor: pointer;
  transition: background .15s, transform .08s;
}
.dish:hover { background: var(--yellow-pale); }
.dish .time {
  color: var(--green-deep); font-size: .7rem; font-weight: 800; margin-left: 4px;
}
.dish.shortage {
  background: var(--pink-pale); color: var(--ink);
  border-style: dashed;
  cursor: default; font-size: .8rem; font-weight: 600; line-height: 1.6;
}
.dish.guide {
  background: var(--green-pale); color: var(--ink);
  border-style: dashed;
  cursor: default; font-size: .8rem; font-weight: 600; line-height: 1.6;
}
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.tag {
  font-size: .65rem; padding: 1px 8px; border-radius: 999px;
  background: var(--cream); color: var(--ink-soft); font-weight: 800;
  border: 1.5px solid var(--ink);
}
.tag.fiber   { background: #c9f0d6; color: #14562c; }
.tag.protein { background: #cfe4fb; color: #1d4570; }
.tag.lowfat  { background: var(--pink-pale); color: #96214a; }
.tag.ferment { background: var(--yellow); color: #6e4a00; }
.tag.kids    { background: #f3ddf8; color: #6a3579; }
.bento-badge {
  display: inline-block; background: var(--yellow); color: var(--ink);
  border: 1.5px solid var(--ink); transform: rotate(-2deg);
  padding: 1px 8px; border-radius: 999px; font-size: .65rem;
  margin-left: 4px; font-weight: 900;
}
.dish-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pref-btn {
  font-size: .72rem; padding: 3px 10px; border-radius: 999px;
  border: 1.5px solid var(--ink); background: var(--card); color: var(--ink-soft);
  box-shadow: var(--pop-xs);
  cursor: pointer; font-weight: 800; line-height: 1.6; font-family: inherit;
}
.pref-btn:hover { background: var(--yellow-pale); color: var(--ink); }
.pref-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.pref-btn.fav.on { background: var(--yellow); color: var(--ink); }
.pref-btn.dis.on { background: var(--danger); color: #fff; }

.eatout-btn {
  margin-top: auto; align-self: center;
  background: var(--card); color: var(--ink-soft);
  font-size: .76rem; padding: 6px 15px;
}
.eatout-btn:hover { background: var(--yellow-pale); color: var(--ink); }
.eatout-day {
  text-align: center; padding: 24px 8px; color: var(--ink-soft);
  font-size: .92rem; font-weight: 700; line-height: 1.8;
}
.eatout-day .big-icon { font-size: 1.8rem; display: block; }

/* ---------- 買い物リスト ---------- */
.shopping-grid {
  display: grid; grid-template-columns: 1fr; gap: 14px;
}
@media (min-width: 640px) {
  .shopping-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
}
#shopCount { font-size: .8rem; color: var(--ink); font-weight: 700; margin-left: 6px; }
.shop-category {
  background: var(--cream);
  border: 2px solid var(--ink); border-radius: var(--radius-m);
  box-shadow: var(--pop-s);
  padding: 14px;
}
.shop-category h3 {
  font-size: .92rem; color: var(--ink); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
  background: var(--green); border: 2px solid var(--ink);
  border-radius: 999px; padding: 2px 14px; width: fit-content; font-weight: 900;
}
.shop-category ul { list-style: none; }
.shop-category li {
  padding: 8px 2px; font-size: .88rem; font-weight: 600;
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  border-bottom: 2px dotted #e0d2a4; cursor: pointer;
}
.shop-category li > span:last-child { white-space: nowrap; flex-shrink: 0; }
.shop-category li:last-child { border-bottom: none; }
.shop-category li.checked { text-decoration: line-through; opacity: .45; }
.shop-category li.owned {
  background: var(--yellow);
  border: 1.5px solid var(--ink);
  border-radius: 10px; padding-left: 8px; padding-right: 8px; margin: 2px 0;
}
.shop-category li.owned + li.owned { margin-top: 4px; }
.own-mark {
  font-size: .64rem; color: var(--ink); margin-left: 6px; font-weight: 900;
  background: var(--card); border: 1.5px solid var(--ink);
  padding: 0 7px; border-radius: 999px; white-space: nowrap;
}
.shop-category li.owned.checked .own-mark { opacity: .5; }

/* ---------- PR枠（グリーン） ---------- */
.pr-box {
  margin-top: 20px; background: var(--green-pale);
  border: var(--bw) solid var(--ink); border-radius: var(--radius-l);
  box-shadow: var(--pop-s);
  padding: 16px 18px; position: relative;
}
.pr-label {
  display: inline-block; font-size: .68rem; font-weight: 900;
  color: var(--ink); background: var(--card);
  border: 2px solid var(--ink); border-radius: 8px;
  padding: 0 7px; margin-bottom: 6px; letter-spacing: .08em;
}
.pr-copy { font-size: .88rem; color: var(--ink); margin-bottom: 12px; font-weight: 800; }
.pr-links { display: flex; flex-wrap: wrap; gap: 10px; }
.pr-links a {
  font-size: .82rem; text-decoration: none; color: var(--ink);
  background: var(--card); border: 2px solid var(--ink); border-radius: 999px;
  box-shadow: var(--pop-xs);
  padding: 7px 15px; font-weight: 800;
}
.pr-links a:hover { background: var(--yellow-pale); }
.pr-links a:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }

/* ---------- モーダル ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(38, 33, 28, .6);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--card);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius-xl); padding: 22px 20px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, .35);
  max-width: 520px; width: 100%; max-height: 85vh; overflow-y: auto;
}
.modal h3 { color: var(--ink); font-weight: 900; margin-bottom: 8px; padding-right: 28px; }
.modal .close-btn {
  float: right; cursor: pointer; font-size: 1rem; color: var(--ink);
  background: var(--yellow); border: 2px solid var(--ink);
  box-shadow: var(--pop-xs);
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 900;
}
.recipe-meta {
  display: flex; gap: 10px; font-size: .84rem; color: var(--muted); font-weight: 700;
  margin: 8px 0 10px; flex-wrap: wrap; align-items: center;
}
.recipe-desc { color: var(--ink-soft); font-size: .88rem; margin-bottom: 4px; }
.recipe-allergens {
  font-size: .78rem; color: #8c2814; background: var(--danger-pale);
  border: 2px solid var(--danger); border-radius: var(--radius-s);
  padding: 8px 12px; margin-top: 10px; font-weight: 700; line-height: 1.6;
}
.recipe-section { margin-top: 14px; }
.recipe-section h4 {
  font-size: .9rem; color: var(--ink); margin-bottom: 8px;
  background: var(--yellow); border: 2px solid var(--ink);
  border-radius: 999px; display: inline-block; font-weight: 900;
  padding: 2px 14px;
}
.recipe-section ul, .recipe-section ol { padding-left: 22px; font-size: .9rem; }
.recipe-section li { margin-bottom: 4px; }
.video-link {
  display: inline-block; margin-top: 10px; padding: 9px 18px;
  background: var(--orange); color: #fff;
  border: 2px solid var(--ink); border-radius: 999px;
  box-shadow: var(--pop-s);
  text-decoration: none; font-size: .84rem; font-weight: 800;
  text-shadow: 1px 1px 0 var(--orange-deep);
}
.video-link:hover { background: var(--orange-deep); }
.video-link:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.privacy-body { font-size: .86rem; line-height: 1.8; }
.privacy-body h4 { margin: 12px 0 4px; color: var(--ink); font-weight: 900; font-size: .9rem; }

/* ---------- フッター ---------- */
.site-footer {
  text-align: center; padding: 12px 12px 20px; color: var(--muted);
  font-size: .78rem; line-height: 1.9;
}
.footer-links a { color: var(--ink); font-weight: 800; text-decoration: underline; }
.footer-disclaimer {
  max-width: 620px; margin: 12px auto; text-align: left;
  background: var(--card); border: 2px solid var(--ink);
  border-radius: var(--radius-m);
  padding: 10px 14px; color: var(--ink);
}
.footer-pr { margin-top: 4px; }
.footer-copy { margin-top: 6px; color: #a08f66; }

/* ---------- オンボーディングウィザード ----------
   注意: app.js が #wizard に style.display="block" を直接設定するため、
   flexレイアウトは .wizard-inner 側に置く（インラインstyleに壊されない） */
.wizard {
  position: fixed; inset: 0; z-index: 200;
  background: var(--yellow-pale);
  background-image: radial-gradient(rgba(255, 138, 43, .16) 3px, transparent 3.5px);
  background-size: 34px 34px;
  overflow: hidden;
  height: 100vh; height: 100dvh;
  padding: calc(10px + env(safe-area-inset-top)) 12px 0;
}
.wizard-inner {
  height: 100%; max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; min-height: 0;
}
.wizard-head { text-align: center; margin-bottom: 6px; flex-shrink: 0; }
.wizard-brand {
  display: inline-block; margin-bottom: 4px;
  background: var(--card); border: 2px solid var(--ink);
  border-radius: var(--radius-m); box-shadow: var(--pop-xs);
  padding: 6px 14px 2px; transform: rotate(-1deg);
}
.wizard-brand .logo-svg { display: block; height: auto; }
.wizard-step-label { font-size: 1.05rem; font-weight: 900; color: var(--ink); }
.wizard-dots { display: flex; justify-content: center; gap: 8px; margin: 8px 0 12px; flex-shrink: 0; }
.wizard-dots .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--ink);
  transition: all .2s;
}
.wizard-dots .dot.active { background: var(--orange); transform: scale(1.3); }
.wizard-dots .dot.done { background: var(--yellow); }
.wizard-body {
  background: var(--card);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius-xl); padding: 18px 16px;
  box-shadow: var(--pop-s);
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  margin-bottom: 12px;
}
.wizard-nav {
  display: flex; justify-content: space-between; gap: 10px;
  flex-shrink: 0;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.wizard-nav button { flex: 1; max-width: 200px; white-space: nowrap; padding-left: 10px; padding-right: 10px; }
.wizard-nav .primary { margin-left: auto; }

/* 小さい画面ではウィザード内を詰めて1画面の情報量を確保 */
@media (max-height: 660px) {
  .wizard { padding-top: calc(6px + env(safe-area-inset-top)); }
  .wizard-brand .logo-svg { width: 84px; height: 64px; }
  .wizard-step-label { font-size: .95rem; }
  .wizard-dots { margin: 6px 0 8px; }
  .wizard-dots .dot { width: 8px; height: 8px; }
  .wizard-body { padding: 13px 13px; margin-bottom: 8px; }
  .wiz-desc { font-size: .8rem; margin-bottom: 10px; line-height: 1.55; }
  .wizard-nav button { padding: 10px 16px; font-size: .9rem; }
  .wizard-nav { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .allergy-chips { gap: 6px; }
  .allergy-chip { font-size: .78rem; padding: 5px 11px; }
  .allergy-disclaimer { padding: 9px 11px; font-size: .74rem; margin-top: 10px; }
  .goal-list { gap: 6px; }
  .goal-card { padding: 10px 12px; }
  .days-seg button { padding: 11px 4px; }
  .bento-opt { padding: 10px 12px; }
  .member-row { padding: 6px 0; }
  .member-add-btns button { padding: 9px 8px; }
  .matrix-table th, .matrix-table td { padding: 6px 3px; }
  .mx-btn { height: 36px; }
}
.wiz-desc { font-size: .84rem; color: var(--muted); margin-bottom: 14px; line-height: 1.7; }

.member-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 2px dotted #e8ddb8;
}
.member-row .m-type {
  font-size: .78rem; font-weight: 800; padding: 2px 10px; border-radius: 999px;
  border: 1.5px solid var(--ink);
  white-space: nowrap;
}
.member-row .m-type.adult { background: #cfe4fb; color: #1d4570; }
.member-row .m-type.child { background: var(--pink-pale); color: #96214a; }
.member-row input {
  flex: 1; min-width: 0; border: 2px solid var(--ink); border-radius: var(--radius-s);
  padding: 9px 11px; font-size: .9rem; font-family: inherit;
  background: var(--card); color: var(--ink); font-weight: 600;
}
.member-row input:focus { outline: none; border-color: var(--orange-deep); box-shadow: var(--pop-xs); }
.member-row .m-del {
  background: none; border: none; box-shadow: none;
  color: var(--danger); font-size: 1rem;
  cursor: pointer; padding: 4px 8px;
}
.member-row .m-del:active { transform: none; }
.member-add-btns { display: flex; gap: 10px; margin-top: 14px; }
.member-add-btns button { flex: 1; font-size: .85rem; padding: 10px 8px; }

.matrix-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.matrix-table th, .matrix-table td {
  padding: 8px 4px; text-align: center; border-bottom: 2px dotted #e8ddb8;
}
.matrix-table th { color: var(--muted); font-size: .78rem; font-weight: 800; }
.matrix-table td:first-child { text-align: left; font-weight: 800; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-btn {
  width: 44px; height: 40px; border-radius: var(--radius-s);
  border: 2px solid #d9caa0; box-shadow: none;
  background: var(--cream); color: #b3a06e; font-size: 1rem; font-weight: 900; padding: 0;
}
.mx-btn:active { transform: translate(1px, 1px); }
.mx-btn.on { background: var(--orange); color: var(--ink); border-color: var(--ink); box-shadow: var(--pop-xs); }

.allergy-group-label { font-size: .82rem; font-weight: 900; margin: 10px 0 6px; }
.allergy-group-label.major { color: var(--danger); }
.allergy-group-label.minor { color: var(--muted); }
.allergy-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.allergy-chip {
  font-size: .84rem; padding: 6px 13px; border-radius: 999px;
  background: var(--cream); color: var(--ink-soft);
  border: 2px solid #e3d5a8; font-weight: 700;
  cursor: pointer; user-select: none;
}
.allergy-chip.major { background: var(--danger-pale); color: #8c2814; border-color: #f0b4a5; }
.allergy-chip.on { background: var(--danger); color: #fff; border-color: var(--ink); font-weight: 800; box-shadow: var(--pop-xs); }
.allergy-chip.on::before { content: "✓ "; }
.allergy-disclaimer {
  margin-top: 14px; font-size: .8rem; color: var(--ink);
  background: var(--card); border: 2px solid var(--danger);
  border-radius: var(--radius-m);
  padding: 12px 14px; line-height: 1.7;
}

.goal-list { display: flex; flex-direction: column; gap: 10px; }
.goal-card {
  background: var(--cream); border: 2px solid #e3d5a8; border-radius: var(--radius-m);
  padding: 13px 15px; cursor: pointer; user-select: none; transition: all .15s;
}
.goal-card .g-title { font-weight: 800; font-size: .92rem; }
.goal-card .g-desc { font-size: .78rem; color: var(--muted); }
.goal-card.on { border-color: var(--ink); background: var(--yellow); box-shadow: var(--pop-xs); }
.goal-card.on .g-title::before { content: "✓ "; color: var(--orange-deep); }

.days-seg { display: flex; gap: 10px; margin-bottom: 18px; }
.days-seg button {
  flex: 1; border-radius: var(--radius-m); font-size: 1rem; padding: 14px 4px;
  background: var(--cream); color: var(--muted);
  border: 2px solid #e3d5a8; box-shadow: none;
}
.days-seg button.on {
  background: var(--orange); color: var(--ink); font-weight: 900;
  border-color: var(--ink); box-shadow: var(--pop-xs);
}
.bento-opt {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--cream); border: 2px solid #e3d5a8; border-radius: var(--radius-m);
  padding: 13px 15px; cursor: pointer; user-select: none;
}
.bento-opt.on { border-color: var(--ink); background: var(--yellow); box-shadow: var(--pop-xs); }
.bento-opt input { width: 20px; height: 20px; accent-color: var(--orange-deep); margin-top: 3px; flex-shrink: 0; }
.bento-opt .b-title { font-weight: 800; font-size: .92rem; }
.bento-opt .b-desc { font-size: .78rem; color: var(--muted); }
.wiz-error { color: var(--danger); font-size: .82rem; font-weight: 800; margin-top: 10px; display: none; }
.wiz-error.show { display: block; }

/* ---- 入れ替え機能（日単位⇅・料理単位⇄） ---- */
.day-swap-btn { flex-shrink: 0; background: var(--card); }
.day-swap-btn.on { background: var(--pink); color: #fff; border-color: var(--ink); }
.swap-banner {
  background: var(--yellow); border: 2px dashed var(--ink); border-radius: var(--radius-m);
  box-shadow: var(--pop-s);
  padding: 10px 14px; margin-bottom: 14px; font-size: .88rem; font-weight: 800;
  color: var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.swap-banner button {
  background: var(--card); border: 2px solid var(--ink); color: var(--ink);
  border-radius: 999px; padding: 4px 12px; font-size: .8rem; cursor: pointer; font-family: inherit;
  box-shadow: var(--pop-xs);
}
.swap-here {
  display: block; width: 100%; margin: 6px 0 10px; padding: 11px;
  background: var(--pink); color: #fff;
  border: 2px solid var(--ink); border-radius: var(--radius-m);
  box-shadow: var(--pop-s);
  font-size: .9rem; font-weight: 900; cursor: pointer; font-family: inherit;
}
.swap-here:hover { background: #e94b7d; }
.dish.swap-target { outline: 2px dashed var(--pink); outline-offset: 2px; cursor: pointer; }
.dish.swap-origin { outline: 3px solid var(--pink); outline-offset: 2px; }
.day-card.swap-origin { outline: 3px solid var(--pink); outline-offset: 2px; }
.swap-hint { font-size: .74rem; color: #c22b60; font-weight: 800; margin-top: 4px; }
.swap-hint.center { text-align: center; margin-bottom: 8px; }
.pref-btn.swap.on { background: var(--pink); color: #fff; }

/* ---------- 印刷 ---------- */
@media print {
  body { background: #fff; background-image: none; padding: 0; }
  .controls, button, .hero, .setup-area, .mode-toggle, .pr-box, .site-footer,
  .bnav, .shop-empty, .prep-head, .settings-card { display: none !important; }
  section { border: 1px solid #ddd; box-shadow: none; page-break-inside: avoid; }
  .modal-bg, .wizard { display: none !important; }
}

/* ---------- 家族共有（SPEC 5.9） ---------- */
.share-row { text-align: center; margin: 18px 0; } /* 上の買い物リスト枠と密着しないよう上下に余白 */
.share-btn { background: var(--green); color: var(--ink); border: 2px solid var(--ink); }
.share-btn:hover { background: #35a95f; }
.share-banner {
  max-width: 720px; margin: 0 auto 16px;
  background: var(--green-pale); border: var(--bw) solid var(--ink);
  border-radius: var(--radius-m); padding: 14px 16px;
  box-shadow: var(--pop-s);
  font-size: .9rem; color: var(--ink); font-weight: 700; line-height: 1.7;
}
.share-banner-note { font-size: .76rem; color: var(--ink-soft); font-weight: 600; }
.share-banner-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.share-banner-actions button { flex: 1 1 120px; min-width: 0; }

/* ---------- 調味料の補充コーナー（SPEC 5.10・v1.3追加・新規クラスのみ） ---------- */
/* パネルの器は既存 .panel を流用。ここでは配置と中身のみ定義（ビタミンポップのトーンに統一） */
.seasoning-panel { margin: 0 0 22px; }
section.tab-shop .seasoning-panel { margin: 20px 0; } /* 生成後: 買い物リストとPR枠の間 */
.ssn-pr {
  margin: 0 0 0 8px; vertical-align: 1px;
}
.ssn-section-label {
  font-size: .85rem; font-weight: 900; color: var(--ink);
  background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px;
  display: inline-block; padding: 2px 14px; margin: 12px 0 8px;
  box-shadow: var(--pop-xs);
}
.ssn-placeholder { font-size: .82rem; color: var(--muted); font-weight: 600; padding: 2px 0 4px; }
.ssn-group { margin-bottom: 10px; }
.ssn-group-label { font-size: .8rem; color: var(--muted); font-weight: 800; margin-bottom: 5px; }
.ssn-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.ssn-chip {
  font-size: .82rem; padding: 5px 12px; border-radius: 999px;
  background: var(--cream); color: var(--ink-soft);
  border: 2px solid #e3d5a8;
  cursor: pointer; user-select: none; transition: all .12s; font-weight: 700;
}
.ssn-chip.out {
  background: var(--pink); color: #fff; border-color: var(--ink);
  font-weight: 800; box-shadow: var(--pop-xs);
}
.ssn-chip.out::before { content: "✕ "; }
.ssn-buy {
  margin-top: 14px; background: var(--pink-pale);
  border: 2px solid var(--ink); border-radius: var(--radius-m);
  box-shadow: var(--pop-xs); padding: 12px 14px;
}
.ssn-buy-title { font-size: .9rem; font-weight: 900; color: var(--ink); margin-bottom: 6px; }
.ssn-buy-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex-wrap: wrap;
  padding: 7px 0; border-bottom: 2px dotted #f0b8c9; font-size: .86rem; font-weight: 700;
}
.ssn-buy-row:last-of-type { border-bottom: none; }
.ssn-buy-name { color: var(--ink); }
.ssn-links { display: flex; gap: 8px; flex-wrap: wrap; }
.ssn-links a {
  font-size: .76rem; text-decoration: none; color: var(--ink);
  background: var(--card); border: 2px solid var(--ink); border-radius: 999px;
  box-shadow: var(--pop-xs); padding: 4px 11px; font-weight: 800; white-space: nowrap;
}
.ssn-links a:hover { background: var(--yellow-pale); }
.ssn-links a:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.ssn-buy-note { font-size: .74rem; color: var(--ink-soft); font-weight: 600; margin-top: 8px; }

/* 印刷時は非表示（既存 @media print には触れず新規ブロックで追加） */
@media print {
  .seasoning-panel { display: none !important; }
}

/* ---- 空状態: つかいこなしのコツ（v2.5・イラスト廃止の代替） ---- */
.empty-tips {
  margin: 18px auto 0; max-width: 420px; text-align: left;
  background: var(--cream, #fff3c9); border: 3px solid var(--sumi, #26211c);
  border-radius: 16px; padding: 14px 16px;
}
.empty-tips .tips-title {
  font-weight: 800; font-size: .95rem; margin: 0 0 10px;
  display: flex; align-items: center; gap: 6px;
}
.empty-tips ul { list-style: none; margin: 0; padding: 0; }
.empty-tips li {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: .84rem; line-height: 1.65; padding: 6px 0;
  border-bottom: 2px dotted rgba(38,33,28,.18);
}
.empty-tips li:last-child { border-bottom: none; }
.empty-tips li .px-icon { margin-top: .18em; }

/* ---- 日本語の改行制御（v2.5.1・スマホでの読みやすさ） ---- */
.np { display: inline-block; }               /* 文節のかたまりでのみ折り返す */
.hero .sub, .empty-main { text-wrap: balance; }  /* 複数行を均等に（対応ブラウザのみ） */
.wiz-desc, .section-hint, .empty-sub, .shop-empty-sub { word-break: auto-phrase; } /* Chrome系は自動文節改行 */

/* ---- 買い物チェック一括リセット（v1.7） ---- */
.check-reset-row { text-align: right; margin: 0 0 10px; }
.check-reset-row button { font-size: .8rem; padding: 7px 14px; }

/* ---- 補充コーナーのティザー文（v1.7.2・閉じた状態でも便利さが伝わるように） ---- */
.ssn-teaser {
  margin: -6px 16px 12px; padding: 0 2px;
  font-size: .78rem; color: var(--muted); line-height: 1.6;
  cursor: pointer;
}
.panel.open .ssn-teaser { display: none; } /* 開いたら詳しいヒント文があるので隠す */

/* ==================== v1.9 献立セット＆料理一覧ピッカー（SPEC 5.12・新規クラスのみ追加） ==================== */
/* ---- 献立セットパネル（献立タブ・生成ボタン下・器は既存 .panel 流用） ---- */
.menuset-panel { max-width: 720px; margin: 0 auto 16px; }
.set-save-btn { background: var(--yellow); color: var(--ink); margin-left: 8px; }
.set-save-btn:hover { background: #f2c81c; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; padding: 10px 0;
  border-bottom: 2px dotted rgba(38, 33, 28, .2);
}
.set-row:last-child { border-bottom: none; }
.set-info { display: flex; flex-direction: column; min-width: 0; }
.set-name { font-weight: 900; font-size: .9rem; color: var(--ink); overflow-wrap: anywhere; }
.set-meta { font-size: .72rem; color: var(--muted); font-weight: 700; }
.set-actions { display: flex; gap: 8px; flex-shrink: 0; }
.set-actions button { font-size: .78rem; padding: 6px 14px; box-shadow: var(--pop-xs); white-space: nowrap; }
.set-actions .set-load { background: var(--green); color: var(--ink); }
.set-actions .set-load:hover { background: #35a95f; }
.set-actions .set-del { color: var(--danger); }
.set-actions .set-del:hover { background: var(--danger-pale); color: var(--danger); }

/* ---- 料理の一覧ピッカー（既存モーダル #modalBg/#modalBody 内） ---- */
.picker-hint {
  font-size: .78rem; color: var(--muted); font-weight: 600; line-height: 1.7;
  margin: 2px 0 12px; word-break: auto-phrase;
}
.picker-list { display: flex; flex-direction: column; gap: 8px; }
.picker-row {
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius-m);
  padding: 10px 12px; font-size: .86rem; font-weight: 700; cursor: pointer;
  transition: background .15s;
}
.picker-row:hover { background: var(--yellow-pale); }
.picker-row.current { background: var(--yellow-pale); border-color: var(--orange-deep); outline: 2px solid var(--orange); }
.picker-row.dis { opacity: .72; }
.picker-mark {
  display: inline-block; font-size: .64rem; font-weight: 800; margin-left: 6px;
  padding: 1px 8px; border-radius: 999px; border: 1.5px solid var(--ink); vertical-align: 1px;
}
.picker-mark.fav { background: var(--yellow); color: var(--ink); }
.picker-mark.dis { background: var(--danger-pale); color: #8a2415; }
.picker-mark.cur { background: var(--orange); color: #fff; }

/* ---- 盛りモードのクイック切替（じゅんびタブ・v1.9.1） ---- */
.portion-quick {
  background: var(--card); border: var(--bw) solid var(--ink);
  border-radius: var(--radius-m); box-shadow: var(--pop-s);
  padding: 14px 16px; margin: 0 auto 14px; max-width: 760px;
}
.portion-quick-label { font-weight: 800; font-size: .92rem; margin: 0 0 10px; }
.portion-quick-note { font-weight: 600; font-size: .74rem; color: var(--muted); margin-left: 6px; }
