/* 献立アプリの見た目。手本は Healthy_Meals/toshi_gohan.html（スマホ1列・カード・緑の差し色・量と時間に色）。
   いちばん下に2つのボタン（献立・買い物）、右上に設定（plan/00 2026-10-25）。日の画面の見本は research/09 の6番。 */
:root {
  --bg: #f6f8f4;
  --surface: #ffffff;
  --fg: #1f2a22;
  --muted: #5c6b60;
  --line: #dde4dc;
  --accent: #2f6b45;
  --accent-soft: #e3efe6;
  --salmon: #c8553d;
  --salmon-soft: #fbe9e4;
  --ice: #2b6cb0;
  --ice-soft: #e2eefb;
  --done: #9aa59d;
  --font-display: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Noto Sans JP", sans-serif;
  --font-body: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141a16; --surface: #1d2520; --fg: #e8efe9; --muted: #a3b2a7; --line: #2e3a32;
    --accent: #7cc395; --accent-soft: #233a2b; --salmon: #f08e76; --salmon-soft: #3a2420;
    --ice: #8cc0f2; --ice-soft: #1d2d40; --done: #6b776f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141a16; --surface: #1d2520; --fg: #e8efe9; --muted: #a3b2a7; --line: #2e3a32;
  --accent: #7cc395; --accent-soft: #233a2b; --salmon: #f08e76; --salmon-soft: #3a2420;
  --ice: #8cc0f2; --ice-soft: #1d2d40; --done: #6b776f;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 16px; line-height: 1.75;
}
.wrap {
  max-width: 680px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: 8px;
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); /* 下のボタンに隠れないぶん */
}
header.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 0 4px; }
header.top h1 {
  font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; line-height: 1.3;
  margin: 0; color: var(--accent); text-wrap: balance;
}
header.top p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
header.top p[hidden] { display: none; }
/* 右上の設定 */
.gear {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; padding: 0; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.gear[aria-pressed="true"] { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* 今週・来週 */
.weekbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 0 2px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); }
.weekbar[hidden] { display: none; }
.weekbar button {
  font: 700 1rem var(--font-body); padding: 8px 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); line-height: 1.3; text-align: left;
}
.weekbar button small { display: block; font-weight: 400; font-size: .78rem; color: var(--muted); }
.weekbar button[aria-pressed="true"] { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.weekbar button[aria-pressed="true"] small { color: var(--bg); }

/* いちばん下の2つのボタン */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  max-width: 680px; margin: 0 auto;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--bg); border-top: 1px solid var(--line);
}
nav.tabs button {
  font: 700 1.05rem var(--font-body); padding: 12px 2px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer;
}
nav.tabs button[aria-selected="true"] { background: var(--accent); color: var(--bg); border-color: var(--accent); }
nav.tabs button[aria-disabled="true"] { opacity: .45; }
button:focus-visible, label:focus-within, summary:focus-visible, input:focus-visible { outline: 3px solid var(--salmon); outline-offset: 2px; }

section.panel { display: flex; flex-direction: column; gap: 16px; padding-top: 16px; }
section.panel[hidden] { display: none; }
.menu-body { display: flex; flex-direction: column; gap: 16px; }
h2 { font-family: var(--font-display); font-size: 1.3rem; margin: 0; line-height: 1.4; text-wrap: balance; }
h3 { font-size: 1.05rem; margin: 0 0 6px; line-height: 1.5; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; }
.card > *:last-child { margin-bottom: 0; }
.note { color: var(--muted); font-size: .9rem; }
.warn { background: var(--salmon-soft); border-radius: 10px; padding: 10px 12px; font-size: .92rem; }
.warn b { color: var(--salmon); }
.info { background: var(--ice-soft); border-radius: 10px; padding: 10px 12px; font-size: .92rem; }
.card.info { border-color: var(--ice); }
ul, ol { margin: 0; padding-left: 1.3em; }
li + li { margin-top: 4px; }
.pill { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .04em; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: 2px; }
.amt { background: var(--accent-soft); color: var(--accent); font-weight: 700; padding: 0 5px; border-radius: 6px; }
.ng { color: var(--salmon); font-weight: 700; }
.btn {
  font: 700 .95rem var(--font-body); padding: 10px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg);
}
.btn.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn.danger { color: var(--salmon); border-color: var(--salmon); }
.btn.back { align-self: flex-start; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag-today { display: inline-block; font-size: .75rem; font-weight: 700; padding: 0 8px; margin-left: 6px; border-radius: 999px; background: var(--salmon); color: var(--bg); vertical-align: 2px; }

/* 日の画面：日付 */
.dayhead { text-align: center; line-height: 1.3; }
.dayhead b { font-family: var(--font-display); font-size: 1.45rem; color: var(--fg); }
.dayhead small { display: block; color: var(--muted); font-size: .8rem; }
/* 日付の帯（選んだ週の7日） */
.band { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.band button {
  display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 0 4px; border-radius: 12px; cursor: pointer; line-height: 1.2;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-family: var(--font-body);
}
.band button small { font-size: .7rem; color: var(--muted); }
.band button b { font-size: 1.05rem; }
.band button i { display: block; width: 6px; height: 6px; border-radius: 50%; margin-top: 3px; background: transparent; }
.band button.made i { background: var(--accent); }
.band button.today { border: 2px solid var(--salmon); }
.band button.sel { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.band button.sel.today { border-color: var(--salmon); }
.band button.sel small { color: var(--bg); }
.band button.sel.made i { background: var(--bg); }
/* 朝のうちに */
.prep { display: flex; flex-direction: column; gap: 2px; }
.prep > b { color: var(--ice); }
/* 3食 */
.meals { padding: 4px 16px; }
.meal { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.meal:first-child { border-top: 0; }
.meal .lab { align-self: flex-start; font-family: var(--font-display); font-weight: 700; font-size: .82rem; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 10px; line-height: 1.5; margin-bottom: 2px; }
.meal .body { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.meal .sub { color: var(--muted); font-size: .85rem; line-height: 1.6; }
.meal.done .lab { background: var(--accent); color: var(--bg); }
button.name {
  display: inline; max-width: 100%; text-align: left;
  font: 700 1.02rem var(--font-body); line-height: 1.5; padding: 2px 0; margin: 0; border: 0; background: transparent; color: var(--fg); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px;
}
button.name .go { color: var(--accent); font-weight: 700; margin-left: 3px; }
.made-btn {
  font: 700 .9rem var(--font-body); padding: 8px 10px; border-radius: 10px; cursor: pointer; white-space: nowrap; margin-top: 2px;
  border: 1px solid var(--accent); background: var(--surface); color: var(--accent);
}
.made-btn[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
.made-btn:disabled { opacity: .35; cursor: default; }
/* レシピの画面 */
.rcp .facts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .9rem; color: var(--muted); }
.rcp .facts span { white-space: nowrap; }
.rcp .facts b { color: var(--fg); margin-left: 2px; }
ol.flow { counter-reset: n; list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
ol.flow li { counter-increment: n; background: var(--accent-soft); border-radius: 999px; padding: 2px 10px 2px 6px; font-size: .9rem; margin: 0; }
ol.flow li::before { content: counter(n); display: inline-block; min-width: 1.4em; text-align: center; border-radius: 999px; background: var(--accent); color: var(--bg); font-weight: 700; font-size: .8rem; margin-right: 5px; }
ol.flow li small { color: var(--muted); font-size: .78rem; margin-left: 4px; }
ul.ings { list-style: none; padding: 0; }
ul.ings li { padding: 6px 0; border-top: 1px solid var(--line); margin: 0; }
ul.ings li:first-child { border-top: 0; }
ul.ings li small { color: var(--muted); margin-left: 4px; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin: 4px 6px 0 0; }
.badge.freeze { background: var(--ice-soft); color: var(--ice); }
.badge.sub { background: var(--salmon-soft); color: var(--salmon); }
.badge.opt { background: var(--accent-soft); color: var(--accent); }
.tools { margin: 10px 0 0; font-size: .9rem; color: var(--muted); }
.tools b { color: var(--fg); margin-right: 8px; }
details.step { border-top: 1px solid var(--line); padding: 8px 0; }
details.step > summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: 2em 1fr auto; gap: 8px; align-items: center; }
details.step > summary::-webkit-details-marker { display: none; }
details.step > summary .n { display: inline-block; width: 2em; height: 2em; line-height: 2em; text-align: center; border-radius: 50%; background: var(--accent); color: var(--bg); font-weight: 700; }
details.step > summary .t { font-weight: 700; font-size: 1.05rem; }
details.step > summary small { color: var(--muted); font-size: .8rem; white-space: nowrap; }
details.step:not([open]) > summary .t { color: var(--muted); }
details.step > ul, details.step > p { margin: 6px 0 0 2.5em; }
details.step .uses { font-size: .88rem; color: var(--muted); }
details.step .ok { color: var(--accent); font-weight: 700; font-size: .95rem; }
details.step .caution { background: var(--salmon-soft); border-radius: 8px; padding: 6px 10px; font-size: .92rem; }
details.step .dont { color: var(--salmon); font-weight: 700; font-size: .95rem; }
ul.trouble { list-style: none; padding: 0; }
ul.trouble li { padding: 6px 0; border-top: 1px solid var(--line); margin: 0; }
ul.trouble li:first-child { border-top: 0; }
ul.trouble li b { display: block; }
ul.trouble li span { color: var(--muted); font-size: .92rem; }

/* 買い物リスト */
.shop-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.progress { font-weight: 700; color: var(--accent); white-space: nowrap; }
.shop-group h3 { display: flex; justify-content: space-between; align-items: baseline; }
.shop-group h3 small { color: var(--muted); font-weight: 400; font-size: .8rem; }
.shop-group.all-done { opacity: .6; }
.item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; padding: 10px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.item:first-of-type { border-top: 0; }
.item input { width: 24px; height: 24px; margin: 4px 0 0; accent-color: var(--accent); }
.item .name { font-weight: 700; }
.item .qty { color: var(--accent); font-weight: 700; }
.item .how { display: block; color: var(--muted); font-size: .88rem; line-height: 1.6; }
.item.checked .name, .item.checked .qty { text-decoration: line-through; color: var(--done); }
.only-left .item.checked { display: none; }
.freeze-card { border-color: var(--ice); }
.freeze-card h3 { color: var(--ice); }

/* 設定 */
.field { padding: 12px 0; border-top: 1px solid var(--line); }
.field:first-of-type { border-top: 0; padding-top: 0; }
.field > b { display: block; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: .88rem; margin: 0 0 6px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: .95rem;
}
.choices input { position: absolute; opacity: 0; width: 0; height: 0; }
.choices label.on { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.choices label.on.off-choice { background: var(--salmon); border-color: var(--salmon); }
input[type="text"] {
  font: 1rem var(--font-body); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); width: 100%; max-width: 20em;
}
.msg { margin-top: 10px; }
