/* Kurashi ウェブ。台所の棚のラベルのような、落ち着いた緑と、栄養素ごとの色 */
:root {
  --bg: #f2f5f1;
  --surface: #ffffff;
  --surface-2: #e8ede6;
  --ink: #17201b;
  --muted: #5b675f;
  --line: #d8dfd8;
  --accent: #2c6a4e;
  --accent-ink: #ffffff;
  --warn: #9a5b00;
  /* 栄養素の色：ビタミンD（日なた）、鉄（赤さび）、亜鉛（鋼）、マグネシウム（若葉）、カルシウム（海の石） */
  --vitd: #c08410;
  --fe: #b0452d;
  --zn: #3d6c9b;
  --mg: #4c8737;
  --ca: #4f8a95;
  --font-body: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  --font-num: "Inter", "Zen Kaku Gothic New", system-ui, sans-serif;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111613; --surface: #1a211d; --surface-2: #232c26; --ink: #e6ece7; --muted: #9aa79f; --line: #2e3832;
    --accent: #6fbf95; --accent-ink: #0d1a13; --warn: #e0a24a;
    --vitd: #e3ac3a; --fe: #e07a62; --zn: #79a6d6; --mg: #86c06f; --ca: #7cbcc6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111613; --surface: #1a211d; --surface-2: #232c26; --ink: #e6ece7; --muted: #9aa79f; --line: #2e3832;
  --accent: #6fbf95; --accent-ink: #0d1a13; --warn: #e0a24a;
  --vitd: #e3ac3a; --fe: #e07a62; --zn: #79a6d6; --mg: #86c06f; --ca: #7cbcc6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
}
.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding-block: 12px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ヘッダーとタブ */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-block: 8px 16px; }
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand h1 { margin: 0; font-size: 1.35rem; letter-spacing: 0.02em; }
.brand .date { color: var(--muted); font-size: 0.9rem; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.tabs a {
  padding: 6px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.92rem;
}
.tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.tabs a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 面 */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.panel h2 { margin: 0 0 12px; font-size: 1rem; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 8px; }
.panel h2 .sub { color: var(--muted); font-size: 0.82rem; font-weight: 400; }
.note { color: var(--muted); font-size: 0.82rem; margin: 10px 0 0; }
.notice { border-radius: var(--radius); padding: 14px 16px; background: var(--surface); border: 1px solid var(--warn); color: var(--warn); }
.demo-flag {
  display: inline-block; font-size: 0.72rem; letter-spacing: 0.04em; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); vertical-align: middle;
}

/* 栄養の棒：0〜150%。100% に目盛り */
.bars { display: grid; gap: 12px; }
.bar { display: grid; gap: 4px; }
.bar .label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 0.92rem; }
.bar .value { color: var(--muted); font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 0.82rem; white-space: nowrap; }
.track { position: relative; height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--c); opacity: 0.55; }
.fill.reached { opacity: 1; }
.goal { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); opacity: 0.35; }
.bars.compact { gap: 8px; }
.bars.compact .track { height: 7px; }
.bars.compact .bar .label { font-size: 0.82rem; }

/* おすすめ */
.advice { font-size: 1rem; margin: 0; }
.picks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pick { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.pick strong { font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 0.72rem; padding: 1px 8px; border-radius: 999px; color: var(--ink); background: color-mix(in srgb, var(--c) 28%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); }

/* 今日食べたもの */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.timeline li { display: grid; grid-template-columns: 3.4rem 1fr; gap: 8px; align-items: baseline; }
.timeline time { color: var(--muted); font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.empty { color: var(--muted); }

/* 7日の表：行が栄養素、列が日。色の濃さが目安にくらべた割合 */
.week { overflow-x: auto; }
.week table { border-collapse: separate; border-spacing: 3px; width: 100%; min-width: 380px; }
.week th { font-weight: 400; color: var(--muted); font-size: 0.75rem; text-align: center; }
.week th.name { text-align: left; color: var(--ink); font-size: 0.82rem; white-space: nowrap; }
.week td { height: 26px; border-radius: 6px; background: var(--surface-2); text-align: center; font-size: 0.7rem; font-family: var(--font-num); color: var(--ink); }
/* 色は最大でも7割までにして、文字（ink）が読める濃さにとどめる */
.week td.cell { background: color-mix(in srgb, var(--c) calc(var(--p) * 0.7%), var(--surface-2)); }
.week:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.week td.none { background: transparent; border: 1px dashed var(--line); }
.week td.avg { font-weight: 700; }

/* カテゴリ */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cat { padding: 14px; border-radius: 12px; border: 1px dashed var(--line); color: var(--muted); }
.cat strong { display: block; color: var(--ink); font-size: 1rem; }
.cat .soon { display: inline-block; margin-top: 6px; font-size: 0.72rem; padding: 0 8px; border-radius: 999px; background: var(--surface-2); }
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover .panel { border-color: var(--accent); }

/* 設定 */
form.prefs { display: grid; gap: 14px; max-width: 420px; }
form.prefs label { display: grid; gap: 4px; font-size: 0.9rem; }
select, input[type="text"] { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
button { font: inherit; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 14px; cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.check:not([hidden]) { display: flex; align-items: center; gap: 8px; }

footer.demo:not([hidden]) { margin-top: 28px; color: var(--muted); font-size: 0.8rem; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

@media (prefers-reduced-motion: no-preference) {
  .fill { transition: width 400ms ease-out; }
}
