:root {
  color-scheme: light;
  --paper: #f3f0e6;
  --paper-raised: #fbfaf5;
  --ink: #222722;
  --muted: #667067;
  --line: #c9cec1;
  --line-strong: #9da89d;
  --leaf: #2f644b;
  --leaf-dark: #214936;
  --leaf-soft: #dce8df;
  --warm: #a8492d;
  --warm-soft: #f1dfd8;
  --shadow: rgb(34 39 34 / 14%);

  /* ---- 文字の大きさ（design/TOKEN_SHEET.md §2 が正）------------------------
     基準16px・比率およそ1.2の6段＋micro。値を変えるときはコードより先にシートを直す。
     scripts/check-type-scale.mjs が「シートに無い font-size」をCIで止める。 */
  --fs-micro: 0.6875rem;   /* 11px 読まなくても操作できる微小ラベルだけ（シート §2の例外表） */
  --fs-caption: 0.75rem;   /* 12px 注記・eyebrow・状態タグ ← 読ませる文字の下限 */
  --fs-sub: 0.875rem;      /* 14px 補助情報・ナビラベル・行操作 */
  --fs-body: 1rem;         /* 16px 本文・主情報・フォーム部品（iOSの自動拡大を避ける下限） */
  --fs-lead: 1.125rem;     /* 18px カード見出し・節見出し */
  --fs-title: 1.375rem;    /* 22px 画面見出し・注目レシピ名 */
  --fs-display: 1.625rem;  /* 26px タブレットの画面見出し */

  /* ---- 記号・アイコンの大きさ（シート §3）------------------------------------
     読む文字とは別の軸。タップ領域は別途44px以上を保つ。 */
  --icon-sm: 18px;
  --icon-md: 22px;
  --icon-lg: 26px;
  --icon-xl: 32px;
}

* {
  box-sizing: border-box;
}

html {
  background: #d9ddd5;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  color: var(--ink);
}

body {
  margin: 0;
  min-width: 320px;
}

html,
body {
  overscroll-behavior-y: none;
}

button,
input,
select {
  font: inherit;
}

button {
  touch-action: manipulation;
}

button,
select,
input {
  min-height: 44px;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgb(47 100 75 / 35%);
  outline-offset: 2px;
}

.app-shell {
  /* ナビはfixedで画面に固定する。ここは短い画面でも背景を最下段まで伸ばす。 */
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 540px;
  margin: 0 auto;
  background: var(--paper);
  border-inline: 1px solid var(--line);
}

.app-shell > main {
  flex: 1;
  min-height: 0;
  padding-bottom: calc(55px + env(safe-area-inset-bottom));
}

/* 冷蔵庫／パントリーの全体が画面に収まるときだけJSで付く。
   touch-actionまで止めることで、iOSの画面端の小さな縦揺れも起こさない。 */
html.is-inventory-fit,
body.is-inventory-fit {
  height: 100dvh;
  overflow: hidden;
}

body.is-inventory-fit .app-shell {
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
}

.app-version {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-micro);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

/* タイトルを持たない細い帯。バージョンが左、同期と設定が右。
   読み上げにはタイトルを残す（.visually-hidden の h1） */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: max(6px, env(safe-area-inset-top)) 12px 6px 16px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--paper-raised);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.header-sync-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgb(47 100 75 / 30%);
  border-radius: 3px;
  background: #f5faf6;
  color: var(--leaf);
  font-size: var(--fs-caption);
  font-weight: 700;
  line-height: 1;
}

.header-sync-button[hidden] {
  display: none;
}

.header-sync-button.is-pending {
  border-color: rgb(164 105 42 / 35%);
  background: #fff8e9;
  color: #80551f;
}

.header-sync-button:disabled {
  opacity: 0.7;
}

.header-sync-icon {
  font-size: var(--icon-sm);
}

.header-sync-button.is-syncing .header-sync-icon {
  animation: boot-loading-spin 0.9s linear infinite;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.app-header[hidden] {
  display: none;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--leaf);
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.header-line,
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", ui-serif, serif;
}

/* 唯一の h1 は .visually-hidden の読み上げ用タイトルで画面に出ない。
   可変の clamp を持つ意味がないので、スケール上の値にそろえておく。 */
h1 {
  margin-bottom: 0;
  font-size: var(--fs-display);
  line-height: 1.15;
}

h2 {
  margin-bottom: 5px;
  font-size: var(--fs-title);
}

h3 {
  margin-bottom: 4px;
  font-size: var(--fs-lead);
}

/* ホーム右上の設定ボタン。食材追加は在庫画面と各棚の「＋」に入口があるので、
   ここは設定に譲っている。 */
/* シート §3「タップ領域は44×44px以上」。design-lint U1 が38×38で落ちていた。
   見た目の枠は38pxのまま、押せる範囲だけを44pxへ広げる。 */
.header-settings-button {
  flex: none;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid rgb(66 76 68 / 18%);
  border-radius: 3px;
  background: #fff;
  color: var(--leaf);
  font-size: var(--icon-md);
  line-height: 1;
}

.header-settings-button:active {
  background: #f1efe6;
}

.settings-dialog {
  width: min(92vw, 420px);
  padding: 0;
  border: none;
  border-radius: 6px;
  background: #fdfcf7;
}

.settings-dialog::backdrop {
  background: rgb(38 44 39 / 45%);
}

.settings-shell {
  padding: 18px 18px 20px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 6px;
  padding: 12px 0;
  border-top: 1px solid rgb(66 76 68 / 12%);
  border-bottom: 1px solid rgb(66 76 68 / 12%);
}

.settings-row-copy strong {
  display: block;
  font-size: var(--fs-body);
}

.settings-row-copy {
  min-width: 0;
}

.nutrition-settings-row {
  padding-block: 8px;
}

.settings-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-title-line label {
  cursor: pointer;
}

.settings-help-button {
  position: relative;
  display: grid;
  flex: none;
  width: 44px;
  height: 44px;
  min-height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--leaf-dark);
  font-size: var(--fs-sub);
  font-weight: 900;
  line-height: 1;
}

.settings-help-button::before {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 1px solid #87958b;
  border-radius: 50%;
  background: var(--paper-raised);
  content: "";
}

.settings-help-button[aria-expanded="true"]::before {
  border-color: var(--leaf);
  background: var(--leaf-soft);
}

.settings-help-button:focus-visible {
  outline: 3px solid rgb(47 100 75 / 35%);
  outline-offset: 2px;
}

.settings-row-copy small {
  display: block;
  margin-top: 3px;
  font-size: var(--fs-sub);
  color: #6d7a6f;
}

/* 誰でもスイッチと分かる丸いピル型。角のある札の案は「変」との
   本人評だったのでやめた。色だけアプリの葉色に合わせる。 */
.settings-row input[type="checkbox"] {
  flex: none;
  position: relative;
  width: 52px;
  height: 32px;
  /* 全体の input { min-height: 44px }（タップ領域の確保）が当たると
     縦に伸びる。この行は label 全体がタップできるので、見た目は32pxでよい */
  min-height: 0;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgb(66 76 68 / 28%);
  border-radius: 999px;
  background: #dcd9cc;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.settings-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(38 44 39 / 30%);
  transition: transform 160ms ease;
}

.settings-row input[type="checkbox"]:checked {
  border-color: var(--leaf);
  background: var(--leaf);
}

.settings-row input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

.settings-row input[type="checkbox"]:focus-visible {
  outline: 3px solid rgb(47 100 75 / 35%);
  outline-offset: 2px;
}

.settings-note {
  margin: 12px 0 0;
  font-size: var(--fs-sub);
  line-height: 1.6;
  color: #6d7a6f;
}

.nutrition-settings-note {
  margin-top: 6px;
  padding: 8px 10px;
  border-left: 3px solid var(--leaf);
  background: var(--leaf-soft);
  font-size: var(--fs-caption);
  line-height: 1.5;
}

.nutrition-settings-note[hidden] {
  display: none;
}

.device-settings {
  display: grid;
  gap: 8px;
}

.device-name-input {
  margin-top: 2px;
}

.device-settings .settings-note {
  margin-top: 0;
}

.view {
  padding: 12px 14px 26px;
}

.overview-copy {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sub);
}

.button,
.icon-button,
.item-name-button,
.storage-tab,
.cook-serving-button,
.nav-button,
.quantity-button,
.row-action,
.restore-button,
.text-button,
.toast button {
  border: 0;
  cursor: pointer;
}

.button {
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-weight: 700;
}

.button-primary {
  border-color: var(--leaf);
  background: var(--leaf);
  color: #fff;
}

.button-primary:hover {
  background: var(--leaf-dark);
}

.button-secondary {
  background: var(--paper-raised);
  color: var(--ink);
}

.button-consume {
  border-color: var(--leaf);
  background: var(--leaf-soft);
  color: var(--leaf-dark);
}

.button-discard {
  border-color: #9a713f;
  background: #fff7e8;
  color: #765127;
}

.add-button {
  flex: none;
}

.fridge-visual {
  margin: 0 0 14px;
}

.fridge-visual-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}

/* 絵と一覧を行き来する入口。タブに見せると 冷蔵庫／パントリー と紛れるので、
   見出しの右に置く控えめなボタンにする。 */
.mode-switch {
  display: inline-flex;
  flex: none;
  gap: 6px;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid rgb(47 100 75 / 26%);
  border-radius: 4px;
  background: var(--paper-raised);
  color: var(--leaf);
  font-size: var(--fs-sub);
  font-weight: 700;
  line-height: 1;
}

.mode-switch:hover,
.mode-switch:focus-visible {
  border-color: var(--leaf);
  background: var(--leaf-soft);
}

.mode-switch-icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 一覧側の戻り口は見出しの上に置くので、余白の付き方だけ変える */
.mode-switch.is-back {
  margin-bottom: 6px;
  padding-inline: 10px 12px;
}

.fridge-visual-heading h3 {
  margin: 0;
  font-size: var(--fs-lead);
}

.fridge-appliance {
  position: relative;
  width: min(100%, 390px);
  margin: 0 auto;
  padding: 9px;
  border: 5px solid #52675b;
  border-radius: 19px 19px 11px 11px;
  background: #d7dfd8;
  box-shadow:
    inset 0 0 0 2px #f9faf5,
    7px 8px 0 #c6ccc2;
}

.fridge-appliance::before {
  position: absolute;
  z-index: 2;
  top: 38px;
  right: -10px;
  width: 5px;
  height: 68px;
  border-radius: 0 4px 4px 0;
  background: #52675b;
  content: "";
}

.fridge-freezer,
.fridge-chamber {
  position: relative;
  overflow: hidden;
  border: 2px solid #8d9d94;
}

/* 冷凍室は下。角丸は下側を大きくし、上の冷蔵室との間に余白を置く */
.fridge-freezer {
  min-height: 0;
  margin-top: 7px;
  padding: 26px 10px 8px;
  border-color: #7899a6;
  border-radius: 4px 4px 10px 10px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 58%), rgb(175 214 229 / 80%)),
    #c7e2ed;
}

.fridge-freezer .fridge-compartment-label {
  color: #315866;
}

/* 冷蔵室は上。パントリーもこの見た目を使う（1室だけなので上下とも丸い） */
.fridge-chamber {
  min-height: 0;
  padding: 27px 10px 7px;
  border-radius: 10px 10px 4px 4px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 48%), rgb(189 207 196 / 72%)),
    #cfdcd3;
}

.fridge-compartment-label {
  position: absolute;
  top: 7px;
  left: 10px;
  color: #405348;
  font-size: var(--fs-caption);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.fridge-light {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 40px;
  height: 7px;
  border-radius: 8px;
  background: #fff7c5;
  box-shadow: 0 4px 16px #fff3aa;
}

.fridge-shelf {
  min-height: 78px;
  padding: 2px 1px 4px;
  border-bottom: 4px solid #93a69a;
  box-shadow: 0 3px 0 rgb(255 255 255 / 62%);
}

.freezer-shelf {
  min-height: 78px;
  padding: 2px 1px 4px;
  border-bottom: 4px solid #8bafbd;
  box-shadow: 0 3px 0 rgb(255 255 255 / 58%);
}

.fridge-shelf + .fridge-shelf,
.freezer-shelf + .freezer-shelf {
  margin-top: 4px;
}

/* 棚の段数は最初に一度決めるだけの操作。棚と同じ幅の箱で置くと
   食材と同じ強さで目に入るので、右端の控えめな並びへ下げる。
   押せる大きさ（44px）は保つ。 */
.shelf-count-control {
  display: grid;
  grid-template-columns: 44px auto 44px;
  align-items: center;
  justify-content: end;
  min-height: 44px;
  margin-top: 2px;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

/* 段数のボタン。棚の一部ではなく操作なので、丸くして地に溶かす。
   押せる大きさは44pxのまま保つ。 */
.shelf-count-control button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgb(101 121 109 / 45%);
  border-radius: 50%;
  background: rgb(255 255 255 / 55%);
  color: #35483e;
  font-size: var(--icon-md);
  font-weight: 700;
  line-height: 1;
}

.shelf-count-control button:hover,
.shelf-count-control button:focus-visible {
  border-color: #65796d;
  background: rgb(255 255 255 / 88%);
}

.shelf-count-control-freezer button {
  border-color: rgb(82 120 135 / 45%);
  color: #315866;
}

.shelf-count-control-pantry button {
  border-color: rgb(122 92 64 / 45%);
  color: #6d5133;
}

.shelf-count-control button:last-child {
  justify-self: end;
}

.shelf-count-control button:disabled {
  opacity: 0.3;
}

.shelf-count-control span {
  min-width: 36px;
  color: #405348;
  font-size: var(--fs-caption);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
}

.shelf-count-control-pantry span {
  color: #6d5133;
}

/* 列数は棚の中身で変わる（--shelf-cols を renderFridgeShelf が付ける）。
   4品までは4列で大きく、5品・6品は5列・6列にして1行へ収める。
   以前の4列固定だと5品目で折り返して棚が縦に伸び、埋まると厳しかった。 */
.fridge-foods {
  display: grid;
  /* 末尾の auto 列は「＋」の席。＋が無い棚では幅0になる */
  grid-template-columns: repeat(var(--shelf-cols, 4), minmax(0, 1fr)) auto;
  justify-content: start;
  justify-items: center;
  align-items: end;
  max-width: 342px;
  min-height: 64px;
  margin-inline: auto;
  gap: 2px 4px;
}

.fridge-food {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: end;
  width: 100%;
  max-width: 78px;
  min-width: 0;
  min-height: 78px;
  padding: 1px 0 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* 絵の下の1行の名前。列が増えて枠が54pxまで縮んでも1行に収め、
   入りきらない分は「…」で省く（6文字以上は FRIDGE_SHORT_NAMES の略称）。 */
.fridge-food-name {
  max-width: 100%;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink);
  font-size: var(--fs-caption);
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 5列以上に詰まったときだけ11px。1枠が53px前後になり12pxでは4文字が入らない。
   本人が「小さい文字で良い」と明示した箇所（シート §2 の例外表に記載）。 */
.fridge-foods.is-dense .fridge-food-name {
  font-size: var(--fs-micro);
}

.fridge-food::after {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  content: "";
}

.fridge-food:hover::after,
.fridge-food:active::after,
.fridge-food:focus-visible::after {
  border-color: var(--leaf);
  background: rgb(255 255 255 / 28%);
}

.fridge-food.is-expiry-soon::after,
.fridge-food.is-expiry-today::after {
  border-color: #c88b2e;
}

.fridge-food.is-expiry-expired::after {
  border-color: var(--warm);
}

.fridge-food.is-priority::before {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warm);
  content: "";
}

.food-hp-gauge {
  position: absolute;
  z-index: 2;
  top: 1px;
  left: 50%;
  width: min(46px, calc(100% - 8px));
  height: 7px;
  overflow: hidden;
  border: 1px solid #53665b;
  border-radius: 2px;
  background:
    repeating-linear-gradient(90deg, transparent 0 8px, rgb(61 76 67 / 22%) 8px 9px),
    #d9dfda;
  box-shadow: inset 0 1px 1px rgb(255 255 255 / 72%);
  pointer-events: none;
  transform: translateX(-50%);
}

.food-hp-gauge > span {
  display: block;
  width: var(--food-level);
  height: 100%;
  background: linear-gradient(180deg, #79bd75, #3f8d53);
  transition: width 180ms ease;
}

.food-hp-gauge.is-warning > span {
  background: linear-gradient(180deg, #e4be58, #ba812f);
}

.food-hp-gauge.is-critical > span {
  background: linear-gradient(180deg, #df735f, #ae4037);
}

.food-expiry-badge {
  position: absolute;
  z-index: 4;
  right: 1px;
  bottom: 2px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding-inline: 4px;
  border: 1px solid #fff9e7;
  border-radius: 9px;
  background: #c88b2e;
  color: white;
  font-family: sans-serif;
  font-size: var(--fs-micro);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 1px 3px rgb(50 36 20 / 25%);
  pointer-events: none;
}

.food-expiry-badge.is-expired {
  background: var(--warm);
}

.fridge-food .ingredient-illustration,
.fridge-food .ingredient-initial {
  width: min(72px, 100%);
  height: auto;
  aspect-ratio: 1;
}

/* 格子の末尾の細い列に入る。食材と同じ幅を取ると列数の計算を狂わせるので、
   押せる高さ（44px）だけ保って幅は36pxに絞る。 */
.shelf-add-food {
  position: relative;
  display: grid;
  place-items: center;
  align-self: end;
  width: 36px;
  min-height: 44px;
  padding: 1px 0 0;
  border: 0;
  background: transparent;
  color: #52665a;
  touch-action: manipulation;
}

.shelf-add-food span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid #81978a;
  border-radius: 50%;
  background: rgb(247 250 245 / 86%);
  box-shadow: inset 0 -2px 0 rgb(90 112 98 / 8%);
  font-family: sans-serif;
  font-size: var(--icon-sm);
  font-weight: 500;
  line-height: 1;
  transition: transform 120ms ease, background-color 120ms ease;
}

.shelf-add-food-freezer {
  color: #437386;
}

.shelf-add-food-freezer span {
  border-color: #75a5b7;
  background: rgb(225 245 252 / 76%);
}

.shelf-add-food-pantry {
  color: #765d3e;
}

.shelf-add-food-pantry span {
  border-color: #ad8d63;
  background: rgb(249 238 218 / 76%);
}

.shelf-add-food:hover span,
.shelf-add-food:active span,
.shelf-add-food:focus-visible span {
  transform: translateY(-1px) scale(1.06);
  background-color: rgb(255 255 255 / 90%);
}

.shelf-add-food:focus-visible {
  outline: 2px solid var(--leaf);
  outline-offset: -4px;
  border-radius: 8px;
}

.fridge-food.is-dragging {
  opacity: 0.18;
  pointer-events: none;
}

.fridge-foods.is-reordering .fridge-food:not(.is-dragging), {
  transition: transform 170ms cubic-bezier(0.2, 0.75, 0.25, 1);
  will-change: transform;
}

.fridge-food.is-reorder-shifting {
  transform: translate3d(var(--reorder-shift), 0, 0) scale(0.96);
}

.fridge-drag-ghost {
  position: fixed;
  z-index: 100;
  margin: 0;
  border: 1px solid rgb(82 103 91 / 72%);
  border-radius: 10px;
  background: rgb(251 250 245 / 94%);
  box-shadow: 0 12px 25px rgb(54 65 58 / 28%);
  pointer-events: none;
  transform: scale(1.08);
  transform-origin: center;
  will-change: transform;
}

[data-drop-location] {
  transition: background-color 120ms ease, outline-color 120ms ease;
}

[data-drop-location].is-drop-target {
  outline: 2px dashed var(--leaf);
  outline-offset: -4px;
  background-color: rgb(198 219 196 / 48%);
}

body.is-fridge-dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

/* 普段は畳んでおき、食材を持ち上げたときだけ現れる。
   いつも出ていると場所を取るだけで、ドラッグしていない間は使い道が無い。
   表示の判定は body.is-fridge-dragging（ドラッグ開始で付く）に任せる。 */
.food-consume-station {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 122px;
  align-items: center;
  width: min(100%, 390px);
  max-height: 0;
  min-height: 0;
  margin: 0 auto;
  padding: 0 7px 0 15px;
  overflow: hidden;
  border: 0 dashed #b78458;
  border-radius: 12px;
  opacity: 0;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 36%) 1px, transparent 1px),
    #f4ead7;
  background-size: 18px 100%;
  transition:
    max-height 220ms ease,
    margin 220ms ease,
    padding 220ms ease,
    opacity 180ms ease,
    transform 150ms ease,
    border-color 150ms ease,
    background-color 150ms ease,
    box-shadow 150ms ease;
}

/* 食べた直後（did-eat）は、手を離しても畳まずに残す。
   ぱくっの演出が見えないまま消えてしまうため。240ms後の再描画で自然に消える */
body.is-fridge-dragging .food-consume-station,
.food-consume-station.did-eat {
  max-height: 160px;
  min-height: 122px;
  margin: 21px auto 0;
  padding: 9px 7px 5px 15px;
  border-width: 2px;
  opacity: 1;
}

.food-consume-copy {
  display: grid;
  align-self: center;
  gap: 3px;
}

.food-consume-copy p {
  margin: 0;
}

.food-consume-copy strong {
  color: #634a34;
  font-size: var(--fs-body);
}

.food-consume-copy small {
  color: #806c57;
  font-size: var(--fs-caption);
}

.food-child-character {
  position: relative;
  display: grid;
  place-items: end center;
  height: 106px;
}

.food-child-character img {
  width: 108px;
  height: 108px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  transition: transform 150ms ease;
}

.food-child-bubble {
  position: absolute;
  z-index: 2;
  top: 2px;
  left: -5px;
  padding: 4px 7px;
  border: 1px solid #b55d43;
  border-radius: 50%;
  background: #fffaf0;
  color: #b14e39;
  font-size: var(--fs-micro);
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
  transition: opacity 120ms ease, transform 120ms ease;
}

body.is-fridge-dragging .food-consume-station {
  border-color: #c2704e;
}

.food-consume-station.is-ready-to-eat {
  border-style: solid;
  border-color: #b14e39;
  background-color: #fff0d8;
  box-shadow: 0 0 0 4px rgb(177 78 57 / 12%);
  transform: scale(1.02);
}

.food-consume-station.is-ready-to-eat .food-child-character img {
  transform: translateY(-3px) scale(1.07);
}

.food-consume-station.is-ready-to-eat .food-child-bubble {
  opacity: 1;
  transform: scale(1);
}

.fridge-food.is-being-eaten {
  pointer-events: none;
  animation: food-eaten 240ms ease forwards;
}

.food-consume-station.did-eat .food-child-character {
  animation: child-eat-bounce 220ms ease;
}

@keyframes food-eaten {
  to {
    opacity: 0;
    transform: scale(0.25) rotate(8deg);
  }
}

@keyframes child-eat-bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  45% {
    transform: translateY(-5px) scale(1.05);
  }
}

@media (prefers-reduced-motion: reduce) {
  /* もともと食材ドラッグまわりだけを止めていたが、ボタンやカードの
     120msのトランジションが残っていた（design-lint M1 が20件で落ちる）。
     動きを減らす設定にした人には、画面全体で動きを出さない。 */
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .fridge-food.is-being-eaten,
  .food-consume-station.did-eat .food-child-character {
    animation: none;
  }
}

.fridge-empty {
  display: grid;
  place-items: center;
  min-height: 70px;
  margin: 0;
  color: #829087;
  font-size: var(--fs-caption);
}

.fridge-overflow {
  display: block;
  width: max-content;
  margin: 6px 4px 0 auto;
  padding: 3px 6px;
  border: 1px solid #8d9d94;
  background: #f7f8f2;
  color: #52675b;
  font-size: var(--fs-caption);
  font-weight: 800;
}

.management-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.management-actions {
  display: grid;
  flex: none;
  gap: 7px;
}

.management-actions .button {
  min-width: 132px;
  padding-inline: 10px;
}

.management-expiring {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid rgb(174 120 55 / 25%);
  border-radius: 6px;
  background: #fff8e7;
}

.management-expiring[hidden] {
  display: none;
}

.management-expiring h3 {
  margin: 0 0 9px;
  font-size: var(--fs-lead);
  line-height: 1.45;
}

.management-expiring-list {
  display: grid;
  gap: 6px;
}

.management-expiring-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 54px;
  padding: 6px 8px;
  border: 1px solid rgb(174 120 55 / 25%);
  border-radius: 5px;
  background: rgb(255 255 255 / 72%);
  color: var(--ink);
  text-align: left;
}

.management-expiring-item:hover,
.management-expiring-item:focus-within {
  border-color: #aa6c25;
}

.management-expiring-item.is-soon {
  border-color: rgb(174 120 55 / 25%);
  background: rgb(255 255 255 / 72%);
}

.management-expiring-item.is-today {
  border-color: #c88b2e;
  background: #fff8e7;
}

.management-expiring-item.is-expired {
  border-color: rgb(168 73 45 / 34%);
  background: #fff3ef;
}

/* 行の本体（3-c と同じ理由で器から切り出したもの） */
.management-expiring-main {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.management-expiring-discard {
  flex: none;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgb(168 73 45 / 34%);
  border-radius: 4px;
  background: #fff;
  color: var(--warm);
  font-size: var(--fs-sub);
  font-weight: 700;
  white-space: nowrap;
}

.management-expiring-discard:hover,
.management-expiring-discard:focus-visible {
  border-color: var(--warm);
  background: #fff3ef;
}

.management-expiring-item .ingredient-illustration,
.management-expiring-item .ingredient-initial {
  width: 42px;
  height: 42px;
}

.management-expiring-copy {
  min-width: 0;
}

.management-expiring-copy strong,
.management-expiring-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.management-expiring-copy strong {
  font-size: var(--fs-sub);
}

.management-expiring-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--fs-caption);
}

.management-expiring-state {
  padding: 3px 7px;
  border-radius: 12px;
  background: #f0d6a2;
  color: #704814;
  font-size: var(--fs-caption);
  font-weight: 900;
  white-space: nowrap;
}

.management-expiring-item.is-soon .management-expiring-state {
  background: #f0d6a2;
  color: #704814;
}

.management-expiring-item.is-today .management-expiring-state {
  background: #c88b2e;
  color: white;
}

.management-expiring-item.is-expired .management-expiring-state {
  background: var(--warm);
  color: white;
}

.receipt-scan-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-color: var(--leaf);
  color: var(--leaf-dark);
}

.receipt-scan-button span {
  font-size: var(--fs-lead);
}

.storage-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-block: 1px solid var(--line);
  margin-inline: -14px;
  padding-inline: 14px;
}

.storage-tab {
  min-width: 0;
  background: transparent;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  font-weight: 700;
}

.storage-tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--leaf);
}

.inventory-list {
  margin-top: 10px;
  border-bottom: 1px solid var(--line-strong);
}

.empty-state {
  padding: 36px 8px;
  text-align: center;
  color: var(--muted);
}

.inventory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 8px;
  padding: 7px 2px 8px;
  border-top: 1px solid var(--line-strong);
}

.inventory-row.is-priority {
  border-left: 4px solid var(--warm);
  padding-left: 7px;
}

.item-identity {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.inventory-row .ingredient-illustration,
.inventory-row .ingredient-initial {
  width: 44px;
  height: 44px;
}

.ingredient-illustration,
.ingredient-initial {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 56px;
  flex: none;
}

@media (max-width: 359px) {
  .fridge-appliance {
    padding: 7px;
    border-width: 4px;
  }

  .fridge-freezer,
  .fridge-chamber {
    padding-inline: 6px;
  }

  .fridge-food .ingredient-illustration,
  .fridge-food .ingredient-initial {
    width: min(45px, 100%);
    height: auto;
  }
}

.ingredient-illustration {
  background-image: url("assets/ingredient-atlas.webp?v=31a19d9e");
  background-repeat: no-repeat;
  background-position: var(--atlas-x) var(--atlas-y);
  background-size: 440% 330%;
}

.ingredient-illustration-everyday {
  background-image: url("assets/ingredient-atlas-everyday.webp?v=da41f84f");
}

.ingredient-illustration-recipe {
  background-image: url("assets/ingredient-atlas-recipe.webp?v=e4f11e2b");
}

.ingredient-illustration-expanded {
  background-image: url("assets/ingredient-atlas-expanded.webp?v=7be4e337");
}

/* 5枚目以降の受け口。画像を assets/ へ置き、app.js の INGREDIENT_ILLUSTRATIONS へ
   `id: [列, 行, "s05"]` の形で登録すると有効になる。
   新しいシートは 1254 × 940 px で作る（1254×1254 だと縦へ約33%潰れる）。
   寸法と品目は assets/ATLAS_SPEC.md と assets/ATLAS_GENERATION_BRIEF.md を参照。 */
.ingredient-illustration-s05 { background-image: url("assets/ingredient-atlas-05.webp?v=3328fdf6"); }
.ingredient-illustration-s06 { background-image: url("assets/ingredient-atlas-06.webp?v=c4dca465"); }
.ingredient-illustration-s07 { background-image: url("assets/ingredient-atlas-07.webp?v=54722a37"); }
.ingredient-illustration-s08 { background-image: url("assets/ingredient-atlas-08.webp?v=2719b3e9"); }
.ingredient-illustration-s09 { background-image: url("assets/ingredient-atlas-09.webp?v=a68a4d32"); }
.ingredient-illustration-s10 { background-image: url("assets/ingredient-atlas-10.webp?v=1b238fc8"); }
.ingredient-illustration-s11 { background-image: url("assets/ingredient-atlas-11.webp?v=82bbdcf1"); }
.ingredient-illustration-s12 { background-image: url("assets/ingredient-atlas-12.webp?v=ec09a536"); }
.ingredient-illustration-s13 { background-image: url("assets/ingredient-atlas-13.webp?v=9bd2a61a"); }
.ingredient-illustration-s14 { background-image: url("assets/ingredient-atlas-14.webp?v=d6cd91f0"); }
.ingredient-illustration-s15 { background-image: url("assets/ingredient-atlas-15.webp?v=be44d487"); }
.ingredient-illustration-s16 { background-image: url("assets/ingredient-atlas-16.webp?v=549a9ffe"); }
.ingredient-illustration-s17 { background-image: url("assets/ingredient-atlas-17.webp?v=ae572c8c"); }
.ingredient-illustration-s18 { background-image: url("assets/ingredient-atlas-18.webp?v=cfb90865"); }
.ingredient-illustration-s19 { background-image: url("assets/ingredient-atlas-19.webp?v=0e15b5ee"); }
.ingredient-illustration-s20 { background-image: url("assets/ingredient-atlas-20.webp?v=bd6bbc6a"); }
.ingredient-illustration-s21 { background-image: url("assets/ingredient-atlas-21.webp?v=89c36bb8"); }
.ingredient-illustration-s22 { background-image: url("assets/ingredient-atlas-22.webp?v=5d8049c9"); }
.ingredient-illustration-s23 { background-image: url("assets/ingredient-atlas-23.webp?v=dfd2ee98"); }
.ingredient-illustration-s24 { background-image: url("assets/ingredient-atlas-24.webp?v=7353a216"); }
.ingredient-illustration-s25 { background-image: url("assets/ingredient-atlas-25.webp?v=d7e5098e"); }
.ingredient-illustration-s26 { background-image: url("assets/ingredient-atlas-26.webp?v=d9f6ae75"); }
.ingredient-illustration-s27 { background-image: url("assets/ingredient-atlas-27.webp?v=bd855679"); }
.ingredient-illustration-s28 { background-image: url("assets/ingredient-atlas-28.webp?v=eb3f85b4"); }
.ingredient-illustration-s29 { background-image: url("assets/ingredient-atlas-29.webp?v=01fc96a5"); }
.ingredient-illustration-s30 { background-image: url("assets/ingredient-atlas-30.webp?v=9a15f4fb"); }
.ingredient-illustration-s31 { background-image: url("assets/ingredient-atlas-31.webp?v=28701d5c"); }
.ingredient-illustration-s32 { background-image: url("assets/ingredient-atlas-32.webp?v=7ef50cd2"); }

.ingredient-initial {
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper-raised);
  color: var(--leaf);
  font-family: serif;
  font-size: var(--icon-sm);
  font-weight: 800;
}

.ingredient-illustration-small,
.ingredient-initial.ingredient-illustration-small {
  width: 30px;
  height: 30px;
}

.item-name-button {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.item-name {
  display: block;
  overflow: hidden;
  font-size: var(--fs-body);
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta.is-stale {
  color: var(--warm);
  font-weight: 700;
}

.item-meta strong {
  color: var(--warm);
}

.item-expiry {
  display: block;
  margin-top: 2px;
  color: #78827c;
  font-size: var(--fs-caption);
  font-weight: 650;
  line-height: 1.35;
}

.item-expiry.is-soon,
.item-expiry.is-today {
  color: #996819;
}

.item-expiry.is-expired {
  color: var(--warm);
  font-weight: 800;
}

.change-attribution {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #718078;
  font-size: var(--fs-caption);
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-entry .change-attribution {
  margin-top: 3px;
}

.quantity-control {
  display: grid;
  grid-template-columns: 44px minmax(58px, auto) 44px;
  align-items: stretch;
  gap: 2px;
  margin: 0;
}

.quantity-button {
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
  color: var(--ink);
  font-size: var(--icon-md);
  font-weight: 800;
}

.quantity-output {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding-inline: 4px;
  border-block: 1px solid var(--line);
  font-size: var(--fs-sub);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

/* 量が未確認の在庫は、数字を確定値として見せない。−／＋を押すと
   本人が実物を見たことになるので、そのとき通常の表示へ戻る。 */
.quantity-output.is-unknown {
  color: var(--muted);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.row-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  margin: 0;
}

.row-action {
  min-width: 0;
  padding: 4px 2px;
  border-bottom: 2px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sub);
  font-weight: 700;
}

.row-action:hover,
.row-action:active {
  border-bottom-color: var(--leaf);
  color: var(--ink);
}

.row-action.is-priority {
  border-bottom-color: var(--warm);
  color: var(--warm);
}

.finished-section {
  margin-top: 20px;
  border-block: 1px solid var(--line);
}

.finished-section summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px;
  cursor: pointer;
  font-weight: 700;
}

.finished-count {
  color: var(--muted);
  font-size: var(--fs-sub);
}

.finished-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px;
  border-top: 1px solid var(--line);
}

.restore-button {
  flex: none;
  background: transparent;
  color: var(--leaf);
  font-weight: 800;
}

.privacy-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: var(--fs-sub);
  line-height: 1.6;
}

.today-ingredient-control {
  display: grid;
  gap: 8px;
}

.today-ingredient-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-height: 76px;
  padding: 2px 5px 2px 12px;
  border: 2px solid #6e8b78;
  border-left-width: 7px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 42%) 1px, transparent 1px),
    #e8efe7;
  background-size: 18px 100%;
  color: var(--ink);
  text-align: left;
}

.today-ingredient-trigger:active {
  background-color: #dee9df;
}

.today-ingredient-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.today-ingredient-copy strong {
  font-size: var(--fs-body);
  line-height: 1.25;
}

.today-ingredient-copy em {
  overflow: hidden;
  color: #52675b;
  font-size: var(--fs-caption);
  font-style: normal;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-ingredient-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 80px;
  height: 70px;
  justify-self: end;
}

.today-ingredient-art-piece {
  position: absolute;
  display: grid;
  place-items: center;
  transform: translateX(calc((var(--priority-art-index) - 1) * 14px))
    rotate(calc((var(--priority-art-index) - 1) * 6deg));
}

.today-ingredient-art-piece:only-child {
  transform: none;
}

.today-ingredient-art-piece .ingredient-illustration,
.today-ingredient-art-piece .ingredient-initial {
  width: 70px;
  height: 70px;
  filter: drop-shadow(0 2px 2px rgb(37 52 43 / 18%));
}

.today-ingredient-empty-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 45px;
  height: 55px;
  border: 3px solid #70897b;
  border-radius: 7px;
  background:
    linear-gradient(#9baea2, #9baea2) center 19px / 100% 2px no-repeat,
    #f8faf4;
  color: #476456;
  box-shadow: 3px 4px 0 rgb(63 82 70 / 12%);
}

.today-ingredient-empty-art span {
  position: absolute;
  right: -7px;
  bottom: -5px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #f8faf4;
  border-radius: 50%;
  background: var(--leaf);
  color: white;
  font-family: sans-serif;
  font-size: var(--icon-sm);
  font-weight: 900;
  line-height: 1;
}

.today-ingredient-control label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 800;
}

.today-ingredient-control .recipe-sort-control {
  grid-template-columns: minmax(0, 1fr) minmax(140px, 0.85fr);
  align-items: center;
  padding: 0 2px;
}

.today-ingredient-control .recipe-sort-control select {
  min-height: 40px;
  padding-block: 7px;
}

select,
input[type="text"],
input[type="number"],
input[type="date"] {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--paper-raised);
  color: var(--ink);
  font-size: var(--fs-body);
}

.recipe-list {
  display: grid;
  gap: 17px;
  margin-top: 18px;
}

.seasonal-guide {
  margin-top: 12px;
  padding: 10px 11px;
  border: 1px solid #c7b98e;
  border-radius: 7px;
  background: #fff9e8;
}

/* 文字を12px以上へ上げたぶん1行へ収まらなくなった。縮めずに、
   注記（旬は地域や品種で〜）を次の行へ落として逃がす。 */
.seasonal-guide-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 10px;
}

.seasonal-guide-heading > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.seasonal-guide-heading span {
  flex: none;
  color: var(--warm);
  font-size: var(--fs-caption);
  font-weight: 900;
  white-space: nowrap;
}

.seasonal-guide-heading strong {
  font-size: var(--fs-body);
}

.seasonal-guide-heading small {
  flex: 1 0 100%;
  color: var(--muted);
  font-size: var(--fs-caption);
}

.seasonal-food-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 8px;
  padding-bottom: 2px;
}

.seasonal-food {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 1px;
  padding: 4px 1px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--leaf-dark);
  font-size: var(--fs-caption);
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.seasonal-food.is-stocked {
  border-color: rgb(47 100 75 / 28%);
  background: var(--leaf-soft);
}

.seasonal-food .ingredient-illustration,
.seasonal-food .ingredient-initial {
  width: 38px;
  height: 38px;
}

.seasonal-food em {
  color: var(--leaf);
  font-size: var(--fs-caption);
  font-style: normal;
}

.recipe-season-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 5px;
  border: 1px solid #c7b98e;
  border-radius: 999px;
  background: #fff9e8;
  color: #7a5e20;
  font-size: var(--fs-caption);
  font-weight: 800;
}

.recipe-more {
  margin-top: 17px;
}

.recipe-more[hidden] {
  display: none;
}

.recipe-more button {
  display: grid;
  width: 100%;
  min-height: 58px;
  place-items: center;
  gap: 1px;
  padding: 8px 12px;
  border: 2px dashed #718779;
  border-radius: 6px;
  background: #f2f3ea;
  color: #405448;
}

.recipe-more button:active,
.recipe-more button:focus-visible {
  border-style: solid;
  border-color: var(--leaf);
  outline: 2px solid var(--leaf);
  outline-offset: 2px;
  background: #e8efe7;
}

.recipe-more span {
  font-size: var(--fs-sub);
  font-weight: 900;
}

.recipe-more small {
  color: var(--muted);
  font-size: var(--fs-caption);
}

.recipe {
  padding: 17px 2px 18px;
  border-block: 1px solid var(--line-strong);
}

.recipe.is-featured {
  margin-inline: -4px;
  padding: 21px 14px 18px;
  border: 2px solid var(--leaf);
  background:
    linear-gradient(90deg, rgb(47 100 75 / 8%) 1px, transparent 1px),
    var(--paper-raised);
  background-size: 20px 100%;
  box-shadow: 5px 6px 0 rgb(47 100 75 / 13%);
}

.recipe.is-featured h3 {
  font-size: var(--fs-title);
}

.recipe.is-alternative {
  margin-inline: 5px;
}

.recipe.is-alternative h3 {
  font-size: var(--fs-lead);
}

.recipe-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* 完成イラストがあるときは、名前の左に置く。無ければ今までどおり */
.recipe-heading-row > div {
  flex: 1;
  min-width: 0;
}

.recipe-heading-row > div {
  min-width: 0;
}

.recipe-heading-row h3 {
  margin: 0;
}

.recipe-search-links {
  display: flex;
  flex: none;
  gap: 5px;
}

.recipe-search-link {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper-raised);
  color: var(--ink);
  text-decoration: none;
}

.recipe-search-link.is-google {
  border-color: #829288;
  color: var(--leaf-dark);
}

.recipe-search-link.is-youtube {
  border-color: #d49a96;
  background: #fff9f7;
}

.recipe-search-icon {
  position: relative;
  display: block;
  pointer-events: none;
}

.recipe-search-icon.is-magnifier {
  width: 17px;
  height: 17px;
  margin: -3px 0 0 -3px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.recipe-search-icon.is-magnifier::after {
  position: absolute;
  right: -7px;
  bottom: -4px;
  width: 8px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
  transform: rotate(45deg);
  transform-origin: left center;
}

.recipe-search-icon.is-youtube-play {
  width: 28px;
  height: 20px;
  border-radius: 5px;
  background: #e53935;
  box-shadow: inset 0 0 0 1px rgb(138 27 24 / 18%);
}

.recipe-search-icon.is-youtube-play::after {
  position: absolute;
  top: 5px;
  left: 11px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid #fff;
  content: "";
}

.recipe-search-link:hover,
.recipe-search-link:active,
.recipe-search-link:focus-visible {
  outline: 2px solid var(--leaf);
  outline-offset: 2px;
}

.recipe-rank {
  margin: 0 0 3px;
  color: var(--leaf);
  font-size: var(--fs-sub);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.recipe-meta {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sub);
}

/* 手順は3つに絞っているので、詳しく知りたい人を検索へ送る。
   加熱時間を全レシピへ書く方針は取らない（2026-08-08 決定） */
.recipe-steps-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.55;
}

.recipe-nutrition {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 9px;
  margin: 5px 0 0;
  color: #5c685f;
  font-family: sans-serif;
  font-size: var(--fs-caption);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.recipe-nutrition span:first-child {
  color: var(--leaf-dark);
}

.recipe-ingredient-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 12px;
}

.recipe-ingredient-summary > span {
  display: inline-grid;
  grid-template-columns: 30px auto;
  align-items: center;
  gap: 5px;
  color: var(--leaf-dark);
  font-size: var(--fs-sub);
  font-weight: 800;
}

.recipe-ingredient-summary > span.is-missing {
  color: var(--warm);
  opacity: 0.72;
}

.recipe-status {
  margin: 10px 0 0;
  font-weight: 800;
}

.recipe-status.is-missing {
  color: var(--warm);
}

.ingredient-groups {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.quick-recipe {
  margin-top: 14px;
  border-block: 1px solid var(--line);
}

.quick-recipe summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 2px;
  cursor: pointer;
  color: var(--leaf-dark);
  font-size: var(--fs-sub);
  font-weight: 800;
  list-style: none;
}

.quick-recipe summary::-webkit-details-marker {
  display: none;
}

.quick-recipe summary::before {
  width: 18px;
  color: var(--leaf);
  content: "＋";
  font-size: var(--icon-sm);
}

.quick-recipe[open] summary::before {
  content: "−";
}

.quick-recipe summary > span {
  flex: 1;
}

.quick-recipe summary small {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 600;
}

.quick-recipe ol {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 4px 4px 14px 30px;
  color: var(--ink);
  font-size: var(--fs-sub);
  line-height: 1.55;
}

.ingredient-group {
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.ingredient-group h4 {
  margin: 0 0 7px;
  font-size: var(--fs-sub);
}

.ingredient-group ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ingredient-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--fs-body);
}

/* 総称の材料を別の部位・商品で埋めたときの注記（例「鶏もも肉で代用」） */
.ingredient-substitute {
  display: block;
  font-size: var(--fs-caption);
  line-height: 1.3;
  color: var(--muted);
}

.ingredient-with-icon {
  display: inline-grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.ingredient-state {
  flex: none;
  color: var(--muted);
  font-size: var(--fs-sub);
}

.ingredient-state.is-ready {
  color: var(--leaf);
  font-weight: 800;
}

/* 量が未確認のものは断定しない。カード見出しの「材料あり」と
   ボタンの「量を見て作る」に合わせた3つ目の状態。 */
.ingredient-state.is-unknown {
  color: var(--muted);
}

.ingredient-state.is-short {
  color: var(--warm);
  font-weight: 800;
}

.optional-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.optional-choice input {
  min-height: 0;
  margin: 0;
}

.optional-choice small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.cook-button {
  width: 100%;
  margin-top: 15px;
}

.cook-button:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  background: var(--line);
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.shopping-view {
  padding-bottom: 38px;
}

.shopping-heading,
.shopping-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.shopping-heading {
  align-items: flex-start;
  margin-bottom: 18px;
}

.shopping-accordion {
  margin-bottom: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgb(251 250 245 / 58%);
}

.shopping-accordion-summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 9px 42px 9px 12px;
  cursor: pointer;
  list-style: none;
}

.shopping-accordion-summary::-webkit-details-marker {
  display: none;
}

.shopping-accordion-summary::after {
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--leaf);
  content: "⌄";
  font-family: sans-serif;
  font-size: var(--icon-sm);
  font-weight: 900;
  transform: translateY(-54%);
}

.shopping-accordion[open] > .shopping-accordion-summary::after {
  content: "⌃";
}

.shopping-accordion-summary > span {
  display: grid;
  gap: 2px;
}

.shopping-accordion-summary .eyebrow {
  margin: 0;
}

.shopping-accordion-summary strong {
  font-size: var(--fs-body);
}

.shopping-accordion-summary small {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 800;
}

.shopping-accordion-body {
  padding: 0 10px 11px;
}

.shopping-illustration-picker {
  padding: 0;
  border: 2px solid #718a7a;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 35%) 1px, transparent 1px),
    #e5ede5;
  background-size: 18px 100%;
}

.shopping-picker-heading,
.shopping-item-layer-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.shopping-picker-heading {
  margin-bottom: 9px;
}

.shopping-picker-heading p,
.shopping-picker-heading h3 {
  margin-bottom: 0;
}

.shopping-picker-heading h3 {
  margin-top: 2px;
  font-size: var(--fs-lead);
}

.shopping-picker-heading > small,
.shopping-item-layer-heading > small {
  padding-bottom: 2px;
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 800;
}

.shopping-category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.shopping-category-button {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 2px;
  min-width: 0;
  min-height: 83px;
  padding: 4px 2px 6px;
  border: 1px solid #9ca99f;
  border-bottom: 4px solid #789072;
  border-radius: 7px;
  background: rgb(255 255 255 / 62%);
  color: var(--ink);
}

.shopping-category-button:nth-child(2) {
  border-bottom-color: #6f9eb0;
}

.shopping-category-button:nth-child(3) {
  border-bottom-color: #b77d64;
}

.shopping-category-button:nth-child(4) {
  border-bottom-color: #b89e65;
}

.shopping-category-button:nth-child(5) {
  border-bottom-color: #987f66;
}

.shopping-category-button:nth-child(6) {
  border-bottom-color: #a57265;
}

.shopping-category-button:nth-child(7) {
  border-bottom-color: #7f8d80;
}

.shopping-category-button:active {
  transform: translateY(1px);
  border-bottom-width: 2px;
}

.shopping-category-art {
  position: relative;
  display: block;
  width: 58px;
  height: 51px;
}

.shopping-category-art .ingredient-illustration,
.shopping-category-art .ingredient-initial {
  position: absolute;
  top: 3px;
  width: 45px;
  height: 45px;
  filter: drop-shadow(0 2px 1px rgb(40 52 43 / 14%));
}

.shopping-category-art .ingredient-illustration:first-child,
.shopping-category-art .ingredient-initial:first-child {
  left: 0;
}

.shopping-category-art .ingredient-illustration:nth-child(2),
.shopping-category-art .ingredient-initial:nth-child(2) {
  right: -1px;
  transform: scale(0.82) rotate(5deg);
}

.shopping-category-button strong {
  max-width: 100%;
  font-size: var(--fs-caption);
  line-height: 1.2;
  text-align: center;
}

.shopping-item-layer {
  display: grid;
  gap: 8px;
}

.shopping-item-layer[hidden],
.shopping-category-layer[hidden] {
  display: none;
}

.shopping-picker-back {
  justify-self: start;
  min-height: 34px;
  padding: 0 4px;
  background: transparent;
  color: var(--leaf);
  font-size: var(--fs-caption);
  font-weight: 800;
}

.shopping-item-layer-heading {
  padding-bottom: 5px;
  border-bottom: 2px solid #91a396;
}

.shopping-item-layer-heading strong {
  font-size: var(--fs-body);
}

.shopping-food-grid {
  display: block;
}

.shopping-food-group + .shopping-food-group {
  margin-top: 12px;
}

.shopping-food-group-title {
  margin: 0 0 5px;
  font-size: var(--fs-caption);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #5d6b5f;
}

.shopping-food-group-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.shopping-food-button {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0;
  min-width: 0;
  min-height: 82px;
  padding: 2px 2px 5px;
  border: 1px solid #a7b2a9;
  border-radius: 7px;
  background: rgb(255 255 255 / 64%);
  color: var(--ink);
}

.shopping-food-button .ingredient-illustration,
.shopping-food-button .ingredient-initial {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 2px 1px rgb(40 52 43 / 14%));
}

.shopping-food-button strong,
.shopping-food-button small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopping-food-button strong {
  font-size: var(--fs-micro);
  line-height: 1.2;
}

.shopping-food-button small {
  color: var(--muted);
  font-size: var(--fs-micro);
  font-weight: 800;
}

.shopping-food-button.is-added {
  border-color: var(--leaf);
  background: #dbe8dd;
  color: var(--leaf-dark);
  opacity: 1;
}

.shopping-food-button.is-added::after {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--leaf);
  color: #fff;
  content: "✓";
  font-family: sans-serif;
  font-size: var(--fs-micro);
  font-weight: 900;
}

.shopping-manual {
  margin-bottom: 10px;
  border-bottom: 1px solid #c9c3af;
}

.shopping-manual > summary {
  min-height: 42px;
  padding: 11px 4px;
  color: var(--leaf);
  font-size: var(--fs-caption);
  font-weight: 800;
  list-style-position: inside;
}

.shopping-manual[open] > summary {
  border-bottom: 1px solid #c9c3af;
}

.shopping-add-form {
  display: grid;
  grid-template-columns: minmax(60px, 0.7fr) minmax(76px, 0.8fr) minmax(116px, 1.25fr);
  gap: 9px;
  margin-bottom: 0;
  padding: 15px 14px 14px 23px;
  border: 1px solid #c9c3af;
  border-left: 4px solid #c47868;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 31px,
      rgb(99 126 150 / 18%) 32px,
      transparent 33px
    ),
    #fffdf5;
  box-shadow: 4px 5px 0 rgb(139 124 92 / 12%);
}

.shopping-add-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 800;
}

.shopping-add-form input,
.shopping-add-form select {
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: rgb(255 255 255 / 82%);
  color: var(--ink);
  font-size: var(--fs-body);
}

.quantity-editor {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: stretch;
  gap: 4px;
}

.quantity-editor .quantity-adjust {
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #eef2eb;
  color: var(--leaf-dark);
  font-family: sans-serif;
  font-size: var(--icon-sm);
  font-weight: 900;
}

.quantity-editor input {
  min-width: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.quantity-range,
.shopping-add-form .quantity-range {
  width: 100%;
  min-height: 28px;
  padding: 0;
  accent-color: var(--leaf);
  background: transparent;
}

.shopping-name-field {
  grid-column: 1 / -1;
}

.shopping-quantity-field {
  grid-column: 1 / 3;
}

.shopping-unit-field {
  grid-column: 3;
}

.shopping-add-button {
  grid-column: 1 / -1;
  align-self: end;
  min-width: 0;
  padding-inline: 8px;
}

.shopping-recommendations {
  margin-bottom: 10px;
}

.shopping-section-heading h3 {
  margin-bottom: 0;
  font-size: var(--fs-lead);
}

.shopping-section-heading > span {
  padding-bottom: 2px;
  color: var(--muted);
  font-size: var(--fs-caption);
}

.shopping-intro {
  margin: 7px 0 11px;
  color: var(--muted);
  font-size: var(--fs-sub);
  line-height: 1.55;
}

.shopping-recommendation-list {
  border-bottom: 1px solid var(--line-strong);
}

.shopping-recommendation {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 11px 2px;
  border-top: 1px solid var(--line-strong);
}

.shopping-recommendation.is-added {
  background: linear-gradient(90deg, var(--leaf-soft), transparent 65%);
}

.shopping-recommendation h4,
.shopping-recommendation p {
  margin: 0;
}

.shopping-recommendation h4 {
  font-size: var(--fs-body);
}

.shopping-recommendation h4 span {
  color: var(--muted);
  font-weight: 600;
}

.shopping-recommendation p {
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.4;
}

.recommend-add-button {
  min-height: 38px;
  padding: 6px 9px;
  border: 1px solid var(--leaf);
  border-radius: 3px;
  background: transparent;
  color: var(--leaf);
  font-size: var(--fs-caption);
  font-weight: 800;
}

.recommend-add-button:disabled {
  cursor: default;
  border-color: transparent;
  color: var(--muted);
}

.shopping-note {
  position: relative;
  margin-bottom: 12px;
  padding: 14px 12px 12px 25px;
  border: 1px solid #c9c3af;
  background:
    linear-gradient(90deg, transparent 17px, rgb(190 102 86 / 36%) 18px, transparent 19px),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 48px,
      rgb(99 126 150 / 17%) 49px,
      transparent 50px
    ),
    #fffdf5;
  box-shadow: 4px 5px 0 rgb(139 124 92 / 12%);
}

.shopping-note .shopping-section-heading {
  margin-bottom: 3px;
}

.shopping-list {
  min-width: 0;
}

.shopping-check-hint {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.4;
}

/* 店内で見る一覧なので、絵だけでは豚こまか豚バラか分からない。
   名前と数量を常に出す。1枚が広くなるぶん2列にする。 */
.shopping-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line-strong);
}

.shopping-check-item {
  min-width: 0;
}

.shopping-check-item > summary {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 60px;
  padding: 6px 8px;
  border: 1px solid rgb(126 146 132 / 48%);
  border-radius: 8px;
  background: rgb(255 255 255 / 66%);
  cursor: pointer;
  list-style: none;
}

.shopping-check-item > summary::-webkit-details-marker {
  display: none;
}

.shopping-check-item > summary:focus-visible {
  outline: 3px solid rgb(47 100 75 / 35%);
  outline-offset: 2px;
}

.shopping-check-item > summary .ingredient-illustration,
.shopping-check-item > summary .ingredient-initial {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 2px 1px rgb(40 52 43 / 14%));
}

.shopping-check-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  text-align: left;
}

.shopping-check-copy strong {
  overflow: hidden;
  font-size: var(--fs-sub);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopping-check-copy small {
  color: var(--muted);
  font-size: var(--fs-caption);
}

.shopping-check-item[open] {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 8px;
  border: 1px solid #879b8d;
  border-radius: 9px;
  background: rgb(239 245 238 / 92%);
}

.shopping-check-item[open] > summary {
  min-height: 60px;
  border-color: transparent;
  background: rgb(255 255 255 / 78%);
}

.shopping-check-detail {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.shopping-check-detail-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
}

.shopping-check-detail-copy > strong {
  overflow: hidden;
  font-size: var(--fs-body);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopping-check-detail-copy > span:not(.change-attribution) {
  color: var(--muted);
  font-size: var(--fs-sub);
  font-weight: 700;
}

.shopping-check-detail-copy > small,
.shopping-check-detail-copy > .change-attribution {
  grid-column: 1 / -1;
}

.shopping-check-detail-copy > small {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopping-check-detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.shopping-purchase-button {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  color: var(--leaf-dark);
  cursor: pointer;
  font-size: var(--fs-caption);
  font-weight: 800;
}

.shopping-purchase-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.shopping-purchase-button input:focus-visible + .check-mark {
  outline: 3px solid rgb(47 100 75 / 35%);
  outline-offset: 2px;
}

.shopping-detail-delete {
  min-width: 44px;
  min-height: 44px;
  padding: 4px;
  background: transparent;
  color: var(--warm);
  font-size: var(--fs-caption);
  font-weight: 800;
  text-decoration: underline;
}

.shopping-completed {
  margin-top: 10px;
  border-top: 1px solid var(--line-strong);
}

.shopping-completed > summary {
  min-height: 44px;
  padding: 11px 2px;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-caption);
  font-weight: 800;
  list-style-position: inside;
}

.shopping-completed-list {
  border-top: 1px solid rgb(157 168 157 / 55%);
}

.shopping-item {
  display: grid;
  grid-template-columns: 30px 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 66px;
  padding: 8px 0;
  border-bottom: 1px solid rgb(157 168 157 / 55%);
}

.shopping-check {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 44px;
  cursor: pointer;
}

.shopping-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.check-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--line-strong);
  background: #fffdf5;
}

.shopping-check input:focus-visible + .check-mark {
  outline: 3px solid rgb(47 100 75 / 35%);
  outline-offset: 2px;
}

.shopping-check input:checked + .check-mark {
  border-color: var(--leaf);
  background: var(--leaf);
}

.shopping-check input:checked + .check-mark::after {
  color: #fff;
  content: "✓";
  font-weight: 900;
}

.shopping-item-copy {
  min-width: 0;
}

.shopping-item-copy strong,
.shopping-item-copy small {
  display: block;
}

.shopping-item-copy strong {
  font-size: var(--fs-body);
}

.shopping-item-copy strong span {
  color: var(--muted);
  font-weight: 600;
}

.shopping-item-copy small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopping-item.is-checked .shopping-item-copy {
  opacity: 0.58;
  text-decoration: line-through;
}

.shopping-item-actions {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.shopping-item-actions button {
  min-height: 30px;
  padding: 3px 2px;
  border: 0;
  background: transparent;
  color: var(--leaf);
  font-size: var(--fs-caption);
  font-weight: 800;
  text-decoration: underline;
}

.shopping-item-actions .shopping-delete {
  color: var(--warm);
}

.shopping-empty-list,
.shopping-empty-recommendation {
  margin: 0;
  padding: 24px 8px;
  color: var(--muted);
  font-size: var(--fs-sub);
  line-height: 1.6;
  text-align: center;
}

.history-heading,
.history-entry-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.history-heading {
  padding-bottom: 17px;
  border-bottom: 3px double var(--line-strong);
}

.cooking-history-list {
  margin-top: 8px;
}

.history-month {
  margin-top: 12px;
}

.history-month-title {
  margin: 0;
  padding: 7px 2px;
  border-bottom: 2px solid var(--leaf);
  color: var(--leaf-dark);
  font-size: var(--fs-sub);
  letter-spacing: 0.04em;
}

.history-entry {
  padding: 12px 2px 14px;
  border-bottom: 1px solid var(--line-strong);
}

.history-entry.is-undone {
  color: var(--muted);
}

.history-entry-heading > div {
  min-width: 0;
}

.history-entry-heading h3 {
  margin: 2px 0 0;
  font-size: var(--fs-body);
}

.history-time {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 700;
}

.history-state {
  flex: none;
  padding: 4px 6px;
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
  color: var(--leaf-dark);
  font-size: var(--fs-caption);
  font-weight: 800;
}

.history-entry.is-undone .history-state {
  color: var(--muted);
}

.history-changes {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin: 9px 0 11px;
  padding: 0;
  list-style: none;
}

.history-changes li {
  display: grid;
  grid-template-columns: 30px auto auto;
  align-items: center;
  gap: 5px;
  color: var(--leaf-dark);
  font-size: var(--fs-sub);
}

.history-entry.is-undone .history-changes li {
  color: var(--muted);
  text-decoration: line-through;
}

.history-changes strong {
  color: var(--warm);
}

.history-entry.is-undone .history-changes strong {
  color: inherit;
}

.history-undo-button {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--warm);
  border-radius: 3px;
  background: transparent;
  color: var(--warm);
  cursor: pointer;
  font-weight: 800;
}

.history-entry-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.history-edit-button {
  min-height: 44px;
  border: 1px solid var(--leaf);
  border-radius: 3px;
  background: var(--leaf-soft);
  color: var(--leaf-dark);
  font-weight: 800;
}

.history-summary {
  margin: 8px 0 10px;
  color: var(--leaf-dark);
  font-size: var(--fs-sub);
  line-height: 1.55;
}

.history-entry.is-adjustment .history-state {
  border-color: rgb(47 100 75 / 24%);
  background: var(--leaf-soft);
}

.history-entry.is-discard .history-state {
  border-color: rgb(154 113 63 / 35%);
  background: #fff7e8;
  color: #765127;
}

.history-undo-button:hover,
.history-undo-button:active,
.history-undo-button:focus-visible {
  background: var(--warm-soft);
}

.history-undo-button:disabled {
  border-color: var(--line);
  color: var(--muted);
  cursor: default;
}

.history-empty {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 45px 16px;
  color: var(--muted);
  text-align: center;
}

.history-empty .empty-mark {
  width: var(--icon-xl);
  height: var(--icon-xl);
  fill: none;
  stroke: var(--leaf);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-empty p {
  margin: 0;
  font-size: var(--fs-sub);
  line-height: 1.7;
}

.history-more-button {
  display: grid;
  width: 100%;
  min-height: 52px;
  place-items: center;
  gap: 1px;
  margin-top: 14px;
  padding: 7px 12px;
  border: 2px dashed #718779;
  border-radius: 6px;
  background: #f2f3ea;
  color: #405448;
  font-weight: 800;
}

.history-more-button small,
.history-count-note {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 600;
}

.history-count-note {
  margin: 12px 0 0;
  text-align: center;
}

/* display を持つ要素は hidden 属性だけでは消えないので明示する */
.bottom-nav[hidden] {
  display: none;
}

.bottom-nav {
  position: fixed;
  z-index: 5;
  right: auto;
  bottom: 0;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 540px);
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line-strong);
  background: rgb(251 250 245 / 96%);
  box-shadow: 0 -5px 16px var(--shadow);
  transform: translateX(-50%);
}

.nav-button {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 6px 7px;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sub);
  font-weight: 800;
}

.nav-button span {
  display: inline-flex;
  line-height: 1;
}

/* 文字記号をやめてSVGにした。太さは1.7で、食材の水彩イラストと競わない細さにする。
   大きさは --icon-* のみで決め、font-size では決めない（記号は読む文字と別の軸）。 */
.nav-icon {
  width: var(--icon-md);
  height: var(--icon-md);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-button .nav-icon-with-count {
  position: relative;
}

.nav-icon-with-count small {
  position: absolute;
  top: -7px;
  right: -13px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--warm);
  color: #fff;
  font-family: sans-serif;
  font-size: var(--fs-micro);
  line-height: 1;
}

.nav-icon-with-count small[hidden] {
  display: none;
}

.nav-button.is-active {
  color: var(--leaf);
  box-shadow: inset 0 3px 0 var(--leaf);
}

.today-ingredient-dialog {
  width: min(calc(100% - 20px), 500px);
  max-height: 90dvh;
  margin: auto auto 10px;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 13px;
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: 0 -12px 36px var(--shadow);
}

.today-ingredient-dialog::backdrop {
  background: rgb(20 25 21 / 52%);
}

.today-ingredient-dialog-shell {
  display: grid;
  gap: 12px;
  padding: 18px 14px calc(15px + env(safe-area-inset-bottom));
}

.today-ingredient-dialog-intro {
  margin: -3px 0 0;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.5;
}

.priority-fridge-mock {
  display: grid;
  gap: 5px;
  padding: 7px;
  border: 5px solid #587064;
  border-radius: 13px;
  background: #bcc8c0;
  box-shadow:
    inset 0 0 0 2px rgb(255 255 255 / 45%),
    5px 6px 0 rgb(55 73 63 / 14%);
}

.priority-fridge-compartment {
  padding: 7px 7px 8px;
  border: 2px solid #86998e;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 54%), transparent 72%),
    #d4ded7;
}

.priority-fridge-compartment.is-freezer {
  border-color: #79a3b3;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 58%), transparent 72%),
    #c7e5f0;
}

.priority-fridge-compartment.is-pantry {
  border-color: #aa9370;
  background:
    repeating-linear-gradient(90deg, rgb(125 97 57 / 7%) 0 1px, transparent 1px 18px),
    #eee3cb;
}

.priority-fridge-compartment h3 {
  margin: 0 0 4px;
  color: #3f5c4d;
  font-size: var(--fs-caption);
  letter-spacing: 0.08em;
}

.priority-fridge-compartment.is-freezer h3 {
  color: #37687a;
}

.priority-fridge-compartment.is-pantry h3 {
  color: #6c5534;
}

.priority-fridge-foods {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 4px;
  min-height: 63px;
  padding-top: 4px;
  border-top: 3px solid rgb(86 111 97 / 45%);
}

.priority-fridge-compartment.is-freezer .priority-fridge-foods {
  border-top-color: rgb(70 127 148 / 42%);
}

.priority-fridge-compartment.is-pantry .priority-fridge-foods {
  border-top-color: rgb(132 102 61 / 42%);
}

.priority-food-option {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0;
  min-width: 0;
  min-height: 62px;
  padding: 0 2px 3px;
  border: 2px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
}

.priority-food-option .ingredient-illustration,
.priority-food-option .ingredient-initial {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 2px 1px rgb(37 52 43 / 14%));
}

.priority-food-option > span:last-child {
  max-width: 100%;
  overflow: hidden;
  font-size: var(--fs-caption);
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.priority-food-option.is-selected {
  border-color: var(--leaf);
  background: rgb(255 255 255 / 62%);
  box-shadow: 0 0 0 2px rgb(47 100 75 / 14%);
}

.priority-food-option.is-selected::after {
  position: absolute;
  top: 1px;
  right: 1px;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--leaf);
  color: white;
  content: "✓";
  font-family: sans-serif;
  font-size: var(--fs-micro);
  font-weight: 900;
}

.priority-fridge-empty {
  grid-column: 1 / -1;
  align-self: center;
  justify-self: center;
  color: rgb(70 86 76 / 62%);
  font-size: var(--fs-caption);
  font-weight: 700;
}

.today-ingredient-clear {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sub);
  font-weight: 800;
}

.today-ingredient-clear.is-active {
  border-color: #6e8b78;
  background: var(--leaf-soft);
  color: var(--leaf-dark);
}

.ingredient-dialog {
  width: min(100%, 540px);
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 12px 12px 0 0;
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: 0 -12px 36px var(--shadow);
}

.ingredient-dialog::backdrop {
  background: rgb(20 25 21 / 48%);
}

.ingredient-dialog form {
  display: grid;
  gap: 12px;
  padding: 17px 16px calc(18px + env(safe-area-inset-bottom));
}

.ingredient-dialog label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: var(--fs-sub);
  font-weight: 700;
}

.ingredient-add-shortcuts {
  display: grid;
  gap: 7px;
}

.ingredient-add-shortcuts[hidden] {
  display: none;
}

.ingredient-add-shortcut {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 9px;
  min-height: 56px;
  padding: 6px 10px 6px 9px;
  border: 1px solid #9aac9f;
  border-left: 4px solid #557766;
  border-radius: 7px;
  background: #edf3ed;
  color: var(--ink);
  text-align: left;
}

.ingredient-refine-shortcut {
  border-color: #b3aa90;
  border-left-color: #8a7950;
  background: #f4f1e7;
}

.ingredient-add-shortcut:active,
.ingredient-add-shortcut:focus-visible {
  border-color: var(--leaf);
  outline: 2px solid var(--leaf);
  outline-offset: 2px;
  background: #e3eee5;
}

.ingredient-shortcut-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ingredient-shortcut-copy strong,
.ingredient-shortcut-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ingredient-shortcut-copy strong {
  font-size: var(--fs-sub);
}

.ingredient-shortcut-copy small {
  color: var(--muted);
  font-size: var(--fs-caption);
}

.ingredient-receipt-icon {
  justify-self: center;
  width: 24px;
  height: 32px;
  border: 1px solid #6c7b72;
  background:
    linear-gradient(#b85f49, #b85f49) 5px 23px / 13px 2px no-repeat,
    repeating-linear-gradient(180deg, #89978e 0 1px, transparent 1px 5px) 5px 6px / 13px 13px no-repeat,
    #fffdf6;
  box-shadow: 2px 2px 0 rgb(75 91 82 / 14%);
  clip-path: polygon(0 0, 100% 0, 100% 92%, 84% 100%, 67% 92%, 50% 100%, 33% 92%, 16% 100%, 0 92%);
}

.ingredient-refine-icon {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 30px;
  height: 30px;
  border: 1px solid #8a7950;
  border-radius: 50%;
  background: #fffdf6;
  color: #6c5e3c;
  font-size: var(--icon-sm);
  font-weight: 900;
}

.ingredient-shortcut-arrow {
  color: #557766;
  font-family: sans-serif;
  font-size: var(--icon-md);
  line-height: 1;
}

.ingredient-picker[hidden],
.ingredient-picker-layer[hidden],
.ingredient-details[hidden],
.selected-ingredient-preview[hidden],
#ingredient-name-field[hidden] {
  display: none;
}

.ingredient-picker,
.ingredient-picker-layer,
.ingredient-details {
  display: grid;
  gap: 11px;
}

.ingredient-picker-lead {
  display: grid;
  gap: 1px;
  padding-left: 10px;
  border-left: 4px solid #7a9a75;
}

.ingredient-picker-lead p {
  margin: 0;
}

.ingredient-picker-lead strong {
  color: var(--ink);
  font-size: var(--fs-body);
}

.ingredient-picker-lead small {
  color: var(--muted);
  font-size: var(--fs-caption);
}

.ingredient-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ingredient-category-card {
  position: relative;
  display: grid;
  grid-template-rows: 45px auto;
  min-height: 100px;
  padding: 8px 20px 8px 9px;
  overflow: hidden;
  border: 1px solid #aab4aa;
  border-bottom: 4px solid #789072;
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 82%), rgb(224 232 219 / 76%)),
    #edf1e8;
  color: var(--ink);
  text-align: left;
}

.ingredient-category-card:nth-child(2) {
  border-bottom-color: #6f9eb0;
  background-color: #e5f2f6;
}

.ingredient-category-card:nth-child(3) {
  border-bottom-color: #b77d64;
  background-color: #f4e5df;
}

.ingredient-category-card:active,
.ingredient-category-card:focus-visible {
  border-color: var(--leaf);
  outline: 2px solid var(--leaf);
  outline-offset: 1px;
  transform: translateY(1px);
}

.ingredient-category-pictures {
  display: flex;
  align-items: center;
  min-width: 0;
}

.ingredient-category-pictures .ingredient-illustration {
  width: 42px;
  height: 42px;
  margin-right: -10px;
  filter: drop-shadow(0 2px 1px rgb(66 76 68 / 12%));
}

.ingredient-category-copy {
  display: grid;
  align-content: end;
  gap: 1px;
}

.ingredient-category-copy strong {
  font-size: var(--fs-sub);
}

.ingredient-category-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ingredient-category-arrow {
  position: absolute;
  right: 8px;
  bottom: 13px;
  color: #637267;
  font-family: sans-serif;
  font-size: var(--icon-sm);
  line-height: 1;
}

.ingredient-manual-button,
.ingredient-picker-back {
  justify-self: start;
  min-height: 36px;
  padding: 4px 2px;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: #596b60;
  font-size: var(--fs-caption);
  font-weight: 800;
}

.ingredient-manual-button {
  justify-self: center;
  margin-top: 2px;
  color: var(--muted);
}

/* 小分類ごとに見出し＋グリッドを積む。見出しは数が増えたときだけ出る。 */
.ingredient-item-grid {
  display: block;
}

.ingredient-item-group + .ingredient-item-group {
  margin-top: 14px;
}

.ingredient-item-group-title {
  margin: 0 0 6px;
  font-size: var(--fs-sub);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #5d6b5f;
}

.ingredient-item-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.ingredient-item-card {
  display: grid;
  justify-items: center;
  align-content: end;
  gap: 3px;
  min-height: 102px;
  padding: 5px 2px 8px;
  border: 1px solid #b1bbb2;
  border-bottom: 3px solid #82947f;
  border-radius: 6px;
  background: #f6f7f1;
  color: var(--ink);
}

.ingredient-item-card .ingredient-illustration {
  width: 66px;
  height: 66px;
  transition: transform 120ms ease;
}

.ingredient-item-card strong {
  max-width: 100%;
  overflow: hidden;
  font-size: var(--fs-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ingredient-item-card:active,
.ingredient-item-card:focus-visible {
  border-color: var(--leaf);
  outline: 2px solid var(--leaf);
  outline-offset: 1px;
}

.ingredient-item-card:active .ingredient-illustration,
.ingredient-item-card:focus-visible .ingredient-illustration {
  transform: translateY(-2px) scale(1.05);
}

.selected-ingredient-preview {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 82px;
  padding: 5px 12px 5px 7px;
  border: 1px solid #9cad9d;
  border-left: 5px solid var(--leaf);
  background: #eef3e9;
}

.selected-ingredient-preview .ingredient-illustration {
  width: 72px;
  height: 72px;
}

.selected-ingredient-preview span {
  display: grid;
  gap: 2px;
}

.selected-ingredient-preview small {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 800;
}

.selected-ingredient-preview strong {
  color: var(--ink);
  font-size: var(--fs-lead);
}

.name-suggestion {
  padding: 12px;
  border: 1px solid #b48a46;
  border-left-width: 4px;
  border-radius: 4px;
  background: #fff7df;
  color: #5b492b;
}

.name-suggestion p {
  margin: 0;
  font-size: var(--fs-sub);
  line-height: 1.55;
}

.name-suggestion strong {
  color: var(--ink);
}

.name-suggestion > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.name-suggestion .button {
  min-height: 40px;
  font-size: var(--fs-sub);
}

.cook-confirm-dialog {
  width: min(calc(100% - 24px), 440px);
  margin-bottom: 12px;
  border-radius: 14px;
}

.cook-confirm-recipe {
  margin: -5px 0 0;
  color: var(--ink);
  font-size: var(--fs-lead);
  font-weight: 900;
  text-align: center;
}

.cook-serving-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.cook-serving-fieldset legend {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: var(--fs-sub);
  font-weight: 800;
}

.cook-serving-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.cook-serving-button {
  display: grid;
  place-items: center;
  gap: 1px;
  min-height: 64px;
  padding: 7px 2px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--paper-raised);
  color: var(--ink);
}

.cook-serving-button strong {
  font-family: sans-serif;
  font-size: var(--fs-title);
  line-height: 1;
}

.cook-serving-button span {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 800;
}

.cook-serving-button.is-active {
  border-color: var(--leaf);
  background: var(--leaf);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 28%);
}

.cook-serving-button.is-active span {
  color: #fff;
}

.cook-confirm-ingredients {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f4ed;
}

.cook-confirm-ingredients-head {
  display: grid;
  gap: 2px;
}

.cook-confirm-ingredients-head h3,
.cook-confirm-ingredients h4 {
  margin: 0;
}

.cook-confirm-ingredients-head h3 {
  font-size: var(--fs-body);
}

.cook-confirm-ingredients-head > small {
  color: var(--leaf-dark);
  font-family: sans-serif;
  font-size: var(--fs-caption);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.cook-confirm-ingredients h4 {
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--fs-caption);
}

.cook-confirm-ingredients h4 small {
  margin-left: 5px;
  font-weight: 500;
}

.cook-extra-section {
  display: grid;
  gap: 8px;
  margin-top: 7px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
}

/* summary になったので、開閉できることが分かる見た目にする */
.cook-extra-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 8px;
  min-height: 44px;
  padding-block: 8px;
  cursor: pointer;
  list-style: none;
}

.cook-extra-heading::-webkit-details-marker {
  display: none;
}

.cook-extra-heading::after {
  flex: none;
  align-self: center;
  color: var(--leaf);
  content: "＋";
  font-size: var(--icon-sm);
  font-weight: 700;
  line-height: 1;
}

.cook-extra-section[open] > .cook-extra-heading::after {
  content: "−";
}

.cook-extra-heading:focus-visible {
  outline: 3px solid rgb(47 100 75 / 35%);
  outline-offset: 2px;
}

/* いま無い「あるとより良い」。選べないので既定では畳む */
.cook-optional-missing > summary {
  min-height: 44px;
  padding-block: 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-caption);
  font-weight: 700;
}

.cook-optional-missing > summary:focus-visible {
  outline: 3px solid rgb(47 100 75 / 35%);
  outline-offset: 2px;
}

/* 見出しと注記を1行へ押し込むと、どちらも1〜2文字で折り返す。
   注記は次の行へ落とす。 */
.cook-extra-heading h4 {
  flex: none;
}

.cook-extra-heading small {
  flex: 1 0 100%;
  color: var(--muted);
  font-size: var(--fs-caption);
}

.cook-extra-add {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(86px, 0.8fr) auto;
  align-items: end;
  gap: 7px;
}

.cook-extra-add label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 800;
}

.cook-extra-add select,
.cook-extra-add input {
  width: 100%;
  min-height: 42px;
  margin: 0;
  font-size: var(--fs-body);
}

.cook-extra-add .button {
  min-height: 42px;
  padding-inline: 10px;
}

.quantity-with-unit {
  position: relative;
  display: block;
}

.quantity-with-unit input {
  padding-right: 31px;
}

.quantity-with-unit > span {
  position: absolute;
  top: 50%;
  right: 8px;
  color: var(--muted);
  font-size: var(--fs-caption);
  transform: translateY(-50%);
}

.cook-extra-list,
.history-edit-ingredients {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cook-extra-row,
.history-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px 34px;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  padding-top: 6px;
  border-top: 1px solid rgb(157 168 157 / 40%);
}

.cook-extra-row > span:first-child,
.history-edit-row > span:first-child {
  min-width: 0;
  color: var(--ink);
  font-size: var(--fs-caption);
  font-weight: 800;
}

.cook-extra-row input,
.history-edit-row input {
  min-height: 40px;
  margin: 0;
}

.cook-extra-remove,
.history-edit-remove {
  min-height: 36px;
  padding: 0;
  border: 1px solid rgb(168 73 45 / 30%);
  border-radius: 3px;
  background: transparent;
  color: var(--warm);
  font-size: var(--icon-sm);
}

.history-edit-dialog {
  width: min(calc(100% - 24px), 440px);
  margin-bottom: 12px;
  border-radius: 14px;
}

.history-edit-recipe {
  margin: -4px 0 3px;
  font-size: var(--fs-lead);
  font-weight: 900;
  text-align: center;
}

.history-edit-add {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
}

.history-edit-add h3 {
  margin: 0;
  font-size: var(--fs-body);
}

@media (max-width: 380px) {
  .cook-extra-add {
    grid-template-columns: minmax(0, 1fr) 100px;
  }

  .cook-extra-add .button {
    grid-column: 1 / -1;
  }
}

.cook-confirm-ingredients ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cook-ingredient-row {
  min-width: 0;
  border-top: 1px solid rgb(157 168 157 / 45%);
}

.cook-ingredient-row:first-child {
  border-top: 0;
}

.cook-ingredient-row:not(.is-optional):not(.is-unconfirmed),
.cook-optional-choice,
.cook-amount-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 45px;
  padding: 3px 1px;
}

.cook-ingredient-main {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.cook-ingredient-main .ingredient-illustration,
.cook-ingredient-main .ingredient-initial {
  width: 36px;
  height: 36px;
}

.cook-ingredient-main strong,
.cook-ingredient-main small {
  display: block;
}

.cook-ingredient-main strong {
  color: var(--ink);
  font-size: var(--fs-caption);
}

.cook-ingredient-main small {
  margin-top: 1px;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.3;
}

.cook-ingredient-state,
.cook-optional-state {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 800;
}

.cook-ingredient-state.is-ready {
  color: var(--leaf);
}

.cook-ingredient-state.is-missing {
  color: var(--warm);
}

.cook-optional-choice {
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto;
  cursor: pointer;
}

.cook-optional-choice > input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.cook-optional-choice:has(input:checked) {
  padding-inline: 4px;
  border-radius: 5px;
  background: var(--leaf-soft);
}

.cook-optional-choice:has(input:focus-visible) {
  outline: 3px solid rgb(47 100 75 / 35%);
  outline-offset: 1px;
}

.cook-optional-choice:has(input:disabled) {
  cursor: default;
  opacity: 0.48;
}

/* 量がまだ確認できていない材料。ここだけは聞いている行なので、
   状態表示を押せる見た目にしておく。既定は「ある」なので、
   本人が外したものだけ色を変える（毎回タップさせない作りにしている）。 */
.cook-amount-choice {
  position: relative;
  cursor: pointer;
}

.cook-amount-choice > input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.cook-amount-choice .cook-ingredient-state {
  padding: 5px 9px;
  border: 1px solid rgb(66 76 68 / 26%);
  border-radius: 3px;
  background: #fff;
}

.cook-amount-choice:has(input:not(:checked)) {
  padding-inline: 4px;
  border-radius: 5px;
  background: var(--warm-soft);
}

.cook-amount-choice:has(input:not(:checked)) .cook-ingredient-state {
  border-color: rgb(168 73 45 / 42%);
}

.cook-amount-choice:has(input:focus-visible) .cook-ingredient-state {
  outline: 3px solid rgb(47 100 75 / 35%);
  outline-offset: 1px;
}

/* 量が足りないと分かったときの逃げ道。行き止まりにしない */
.cook-fallback {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.cook-fallback[hidden] {
  display: none;
}

.cook-fallback .button {
  flex: 1;
}

.cook-optional-choice:has(input:checked) .cook-optional-state {
  color: var(--leaf-dark);
}

.cook-confirm-message {
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid var(--leaf);
  background: rgb(47 100 75 / 8%);
  color: var(--muted);
  font-size: var(--fs-sub);
  line-height: 1.55;
}

.cook-confirm-message.is-missing {
  border-left-color: var(--warm);
  background: rgb(177 76 46 / 8%);
  color: var(--warm);
}

.cook-confirm-button:disabled {
  opacity: 0.42;
}

.dialog-head {
  align-items: center;
}

.dialog-head h2 {
  margin-bottom: 0;
}

.icon-button {
  width: 44px;
  background: transparent;
  color: var(--ink);
  font-size: var(--icon-lg);
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, 0.7fr);
  gap: 10px;
}

.ingredient-expiry-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ingredient-expiry-label em {
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--leaf-soft);
  color: var(--leaf-dark);
  font-size: var(--fs-caption);
  font-style: normal;
  line-height: 1.2;
}

.ingredient-expiry-field small {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 400;
  line-height: 1.5;
}

.check-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  padding: 12px 0;
  border-block: 1px solid var(--line);
}

.check-row input {
  min-height: 0;
  margin-top: 3px;
}

.check-row strong,
.check-row small {
  display: block;
}

.check-row strong {
  color: var(--ink);
}

.check-row small {
  margin-top: 3px;
  font-weight: 400;
}

.dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dialog-actions .button-consume:not([hidden]),
.dialog-actions .button-discard:not([hidden]) {
  grid-column: 1 / -1;
}

/* 履歴を残さない消し方。取り返しがつかないぶん頻度も低いので、
   ボタンの見た目をやめて最下段の小さなリンクにする。 */
.dialog-danger-link {
  grid-column: 1 / -1;
  justify-self: center;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--warm);
  font-size: var(--fs-caption);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dialog-danger-link[hidden] {
  display: none;
}

.dialog-danger-link:hover,
.dialog-danger-link:focus-visible {
  color: #8f3d26;
}

.receipt-dialog {
  max-height: 96dvh;
}

.receipt-privacy {
  margin: 0;
  padding: 10px 11px;
  border-left: 4px solid var(--leaf);
  background: var(--leaf-soft);
  color: var(--leaf-dark);
  font-size: var(--fs-sub);
  line-height: 1.55;
}

.receipt-processing {
  display: grid;
  gap: 12px;
}

.receipt-preview {
  width: 100%;
  height: 150px;
  object-fit: contain;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgb(201 206 193 / 32%) 1px, transparent 1px),
    linear-gradient(rgb(201 206 193 / 32%) 1px, transparent 1px),
    #fff;
  background-size: 12px 12px;
}

.receipt-status {
  margin: 0 0 8px;
  color: var(--ink);
  font-weight: 800;
}

.receipt-processing progress {
  width: 100%;
  height: 10px;
  accent-color: var(--leaf);
}

.receipt-model-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.45;
}

.receipt-results {
  display: grid;
  gap: 10px;
}

.receipt-results[hidden],
.receipt-error[hidden] {
  display: none;
}

.receipt-results-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.receipt-results-heading h3,
.receipt-results-heading p,
.receipt-error h3,
.receipt-error p {
  margin-bottom: 0;
}

.receipt-results-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--fs-sub);
}

.text-button {
  min-height: 32px;
  padding: 0;
  background: transparent;
  color: var(--leaf);
  font-size: var(--fs-sub);
  font-weight: 800;
  text-decoration: underline;
}

.receipt-review-note {
  margin: 0;
  color: var(--warm);
  font-size: var(--fs-caption);
  font-weight: 700;
}

.receipt-candidates {
  border-bottom: 1px solid var(--line-strong);
}

.receipt-candidate {
  display: grid;
  grid-template-columns: auto 38px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line-strong);
}

.receipt-candidate.is-unselected {
  opacity: 0.52;
}

.receipt-candidate > input {
  min-height: 0;
  margin: 13px 0 0;
}

.receipt-candidate .ingredient-illustration,
.receipt-candidate .ingredient-initial {
  width: 38px;
  height: 38px;
  margin-top: 4px;
}

.receipt-candidate-fields {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.receipt-candidate-fields label {
  gap: 4px;
  font-size: var(--fs-caption);
}

.receipt-candidate-fields input,
.receipt-candidate-fields select {
  min-height: 40px;
  padding: 7px 8px;
  font-size: var(--fs-body);
}

.receipt-candidate-meta {
  display: grid;
  grid-template-columns: minmax(74px, 0.7fr) minmax(90px, 0.9fr) minmax(90px, 1fr);
  gap: 6px;
}

.receipt-source-line {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-needs-review {
  color: var(--warm);
  font-weight: 800;
}

.receipt-raw {
  border-block: 1px solid var(--line);
}

.receipt-raw summary {
  padding: 10px 0;
  cursor: pointer;
  color: var(--muted);
  font-size: var(--fs-sub);
  font-weight: 700;
}

.receipt-raw pre {
  max-height: 160px;
  margin: 0 0 10px;
  overflow: auto;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.55;
  white-space: pre-wrap;
}

.receipt-error {
  padding: 14px;
  border: 1px solid var(--warm);
  background: var(--warm-soft);
}

.receipt-error p {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--fs-sub);
  line-height: 1.55;
}

.receipt-error .button {
  width: 100%;
  margin-top: 12px;
}

.receipt-dialog-actions {
  padding-top: 10px;
  border-top: 1px solid var(--line-strong);
  background: var(--paper-raised);
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(calc(100% - 28px), 500px);
  padding: 12px 14px;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper-raised);
  box-shadow: 0 8px 24px var(--shadow);
}

.toast[hidden] {
  display: none;
}

.toast button {
  min-height: 0;
  padding: 4px;
  background: transparent;
  color: #fff;
  font-weight: 800;
  text-decoration: underline;
}

@media (min-width: 460px) {
  .view {
    padding-inline: 22px;
  }

  /* 幅が取れるところでは旬の食材を1行（6列）へ戻す */
  .seasonal-food-list {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .storage-tabs {
    margin-inline: -22px;
    padding-inline: 22px;
  }

  .ingredient-groups {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 359px) {
  .management-heading {
    gap: 9px;
  }

  .management-actions .button {
    min-width: 122px;
    padding-inline: 7px;
    font-size: var(--fs-sub);
  }

  .receipt-candidate-meta {
    grid-template-columns: 0.72fr 0.9fr;
  }

  .receipt-candidate-meta label:last-child {
    grid-column: 1 / -1;
  }

  .shopping-add-form {
    grid-template-columns: minmax(56px, 0.7fr) minmax(72px, 0.8fr) minmax(105px, 1.15fr);
    padding-inline: 18px 10px;
  }

  .shopping-add-button {
    font-size: var(--fs-sub);
  }

  .shopping-item {
    grid-template-columns: 28px 32px minmax(0, 1fr);
  }

  .shopping-item-actions {
    grid-column: 3;
    grid-row: 2;
    display: flex;
    gap: 14px;
  }

  .nav-button {
    padding-inline: 2px;
    font-size: var(--fs-sub);
  }

  .recipe.is-featured {
    padding-inline: 11px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .ingredient-dialog[open],
  .today-ingredient-dialog[open] {
    animation: dialog-rise 160ms ease-out;
  }

  @keyframes dialog-rise {
    from {
      opacity: 0;
      transform: translateY(14px);
    }
  }
}

/* ---- 初回登録 ---------------------------------------------------------- */
/* 最初の一食を決める過程をそのまま登録にする画面。冷蔵庫の絵はまだ空なので
   見せず、食材そのものを大きく並べて「選ぶ」ことに集中させる。 */
.onboarding-view {
  padding-bottom: 40px;
}

.onboarding-head {
  margin-bottom: 18px;
}

.onboarding-head h2 {
  margin: 2px 0 0;
  font-size: var(--fs-title);
  line-height: 1.35;
}

.onboarding-lead {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: var(--fs-sub);
  line-height: 1.7;
}

.onboarding-group + .onboarding-group {
  margin-top: 20px;
}

.onboarding-group h3 {
  margin: 0 0 8px;
  color: var(--leaf);
  font-size: var(--fs-sub);
  letter-spacing: 0.08em;
}

.onboarding-tile-grid,
.onboarding-extra-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

/* 押した食材は、枠が締まって紙が沈む。選んだ実感を出すため */
.onboarding-tile {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 10px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper-raised);
  color: var(--ink);
  font-size: var(--fs-caption);
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.onboarding-tile .ingredient-illustration,
.onboarding-tile .ingredient-initial {
  width: 54px;
  height: 54px;
}

.onboarding-tile.is-selected {
  border-color: var(--leaf);
  background: var(--leaf-soft);
  box-shadow: inset 0 1px 3px rgb(33 73 54 / 18%);
  transform: translateY(1px);
}

.onboarding-tile:focus-visible {
  outline: 3px solid rgb(47 100 75 / 35%);
  outline-offset: 1px;
}

/* 選ぶたびに候補が入れ替わるのが見えるよう、質問より上に置く */
.onboarding-preview {
  margin-bottom: 16px;
  padding: 12px 13px;
  border-radius: 5px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
}

.onboarding-candidate + .onboarding-candidate {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgb(157 168 157 / 40%);
}

.onboarding-candidate strong {
  display: block;
  font-size: var(--fs-body);
}

.onboarding-candidate.is-top strong {
  font-size: var(--fs-body);
}

.onboarding-candidate small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--fs-caption);
}

.onboarding-empty {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sub);
  line-height: 1.7;
}

.onboarding-actions {
  display: flex;
  gap: 9px;
  margin-top: 24px;
}

.onboarding-actions .button {
  flex: 1;
}

/* ---- はじめに入っていた食材の片付け ------------------------------------ */
/* 保存済みデータを勝手に消せないので、何を消すのかを並べて一度だけ聞く */
.sample-notice {
  margin-bottom: 18px;
  padding: 14px 14px 13px;
  border: 1px solid rgb(168 73 45 / 30%);
  border-radius: 5px;
  background: var(--warm-soft);
}

.sample-notice[hidden] {
  display: none;
}

.sample-notice h3 {
  margin: 2px 0 7px;
  font-size: var(--fs-lead);
  line-height: 1.45;
}

.sample-notice p {
  margin: 0;
  font-size: var(--fs-sub);
  line-height: 1.65;
}

.sample-notice-note {
  margin-top: 7px !important;
  color: #7d5a4b;
  font-size: var(--fs-caption) !important;
}

.sample-notice-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.sample-notice-actions .button {
  flex: 1;
}

/* ---- 賞味期限のお知らせ -------------------------------------------------- */
.expiry-alert {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgb(184 107 36 / 32%);
  border-left: 5px solid #c17a2a;
  border-radius: 6px;
  background: #fff8e7;
}

.expiry-alert[hidden] {
  display: none;
}

.expiry-alert-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.expiry-alert-heading h3 {
  margin: 2px 0 0;
  font-size: var(--fs-lead);
  line-height: 1.45;
}

.expiry-alert-heading > span {
  flex: none;
  padding: 3px 8px;
  border-radius: 12px;
  background: #f0d6a2;
  color: #704814;
  font-size: var(--fs-caption);
  font-weight: 900;
}

.expiry-alert-list {
  display: grid;
  gap: 6px;
  margin-top: 11px;
}

.expiry-alert-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 5px 8px;
  border: 1px solid rgb(174 120 55 / 25%);
  border-radius: 5px;
  background: rgb(255 255 255 / 72%);
  color: var(--ink);
  text-align: left;
}

.expiry-alert-item:hover,
.expiry-alert-item:focus-within {
  border-color: #aa6c25;
  outline: 2px solid rgb(193 122 42 / 24%);
  outline-offset: 1px;
}

.expiry-alert-item.is-expired {
  border-color: rgb(168 73 45 / 34%);
  background: #fff3ef;
}

/* 行の本体。もとは行そのものがボタンだったが、中に「捨てる」を置くため
   器を div にして、タップで編集を開くところだけをボタンに残した。 */
.expiry-alert-main {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

/* 使いきれなかったものを、編集ダイアログを開かずにその場で捨てる。
   確認は出さない。廃棄として履歴に残り、トーストの「戻す」で取り消せるため。 */
.expiry-alert-discard {
  flex: none;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgb(168 73 45 / 34%);
  border-radius: 4px;
  background: #fff;
  color: var(--warm);
  font-size: var(--fs-sub);
  font-weight: 700;
  white-space: nowrap;
}

.expiry-alert-discard:hover,
.expiry-alert-discard:focus-visible {
  border-color: var(--warm);
  background: #fff3ef;
}

.expiry-alert-item .ingredient-illustration,
.expiry-alert-item .ingredient-initial {
  width: 38px;
  height: 38px;
}

.expiry-alert-copy {
  min-width: 0;
}

.expiry-alert-copy strong,
.expiry-alert-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expiry-alert-copy strong {
  font-size: var(--fs-sub);
}

.expiry-alert-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--fs-caption);
}

.expiry-alert-state {
  color: #996819;
  font-size: var(--fs-caption);
  font-weight: 900;
}

.expiry-alert-item.is-expired .expiry-alert-state {
  color: var(--warm);
}

.expiry-alert-note {
  margin: 8px 0 0;
  color: #775c33;
  font-size: var(--fs-caption);
}

/* ---- 翌日の在庫確認 ------------------------------------------------------ */
/* グラム数を思い出させず、3つのどれかを押すだけで実物へ寄せる。
   境目は残量ゲージと同じなので、押した直後の見た目と食い違わない。 */
.day-after-check {
  margin-bottom: 18px;
  padding: 14px 14px 13px;
  border: 1px solid rgb(47 100 75 / 26%);
  border-radius: 5px;
  background: var(--leaf-soft);
}

.day-after-check[hidden] {
  display: none;
}

.day-after-check h3 {
  margin: 2px 0 6px;
  font-size: var(--fs-lead);
}

.day-after-lead {
  margin: 0;
  color: #3d5748;
  font-size: var(--fs-sub);
  line-height: 1.65;
}

.day-after-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.day-after-row {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid rgb(47 100 75 / 18%);
}

.day-after-row:first-child {
  border-top: 0;
  padding-top: 2px;
}

.day-after-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.day-after-item .ingredient-illustration,
.day-after-item .ingredient-initial {
  width: 30px;
  height: 30px;
}

.day-after-item strong {
  display: block;
  font-size: var(--fs-sub);
}

.day-after-item small {
  display: block;
  margin-top: 1px;
  color: #55705f;
  font-size: var(--fs-caption);
}

/* 3つを等幅で並べる。どれかを選ぶまで既定はない */
.day-after-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.day-after-choices button {
  min-height: 40px;
  border: 1px solid rgb(47 100 75 / 32%);
  border-radius: 3px;
  background: #fff;
  color: var(--leaf-dark);
  font-size: var(--fs-sub);
  font-weight: 800;
}

.day-after-choices button:active {
  background: var(--leaf);
  color: #fff;
}

.day-after-choices button:focus-visible {
  outline: 3px solid rgb(47 100 75 / 35%);
  outline-offset: 1px;
}

.day-after-skip {
  margin-top: 12px;
  width: 100%;
}

.refine-view {
  padding-bottom: 40px;
}

.refine-head h2 {
  margin: 2px 0 0;
  font-size: var(--fs-title);
}

.refine-lead {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: var(--fs-sub);
  line-height: 1.7;
}

.refine-group + .refine-group {
  margin-top: 18px;
}

.refine-group h3 {
  margin: 0 0 8px;
  color: var(--leaf);
  font-size: var(--fs-caption);
  letter-spacing: 0.08em;
}

.refine-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

/* すでに冷蔵庫にあるものは選んだ形で出し、押せなくする。
   この画面で入れたものだけ、もう一度押して取り消せる */
.refine-tile-grid .onboarding-tile:disabled {
  opacity: 0.72;
}

.refine-actions {
  display: flex;
  gap: 9px;
  margin-top: 24px;
}

.refine-actions .button {
  flex: 1;
}

/* ---- データの持ち出し ---------------------------------------------------- */
.settings-block {
  margin-top: 6px;
  padding: 12px 0 0;
  border-top: 1px solid rgb(66 76 68 / 12%);
}

.settings-data-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.settings-data-actions .button {
  flex: 1;
}

/* 読み込みは置き換えなので、確かめる帯を出してから実行する */
.import-preview {
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid rgb(168 73 45 / 30%);
  border-radius: 4px;
  background: var(--warm-soft);
}

.import-preview[hidden] {
  display: none;
}

.import-preview p {
  margin: 0;
  font-size: var(--fs-sub);
  line-height: 1.65;
}

.import-preview-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.import-preview-actions .button {
  flex: 1;
}

.import-error {
  color: var(--warm);
}

.import-error[hidden] {
  display: none;
}

/* ---- 二人で共有する ------------------------------------------------------ */
.share-off[hidden],
.share-on[hidden],
.share-message[hidden] {
  display: none;
}

.share-start,
.share-stop {
  width: 100%;
  margin-top: 10px;
}

.share-join {
  margin-top: 12px;
}

.share-join summary {
  color: var(--leaf);
  font-size: var(--fs-sub);
  font-weight: 800;
  cursor: pointer;
}

.share-join .button {
  width: 100%;
  margin-top: 10px;
}

.share-link-label {
  margin: 10px 0 4px;
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 700;
}

/* リンクは長いので、折り返さず横に流して選びやすくする */
.share-link {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font-size: var(--fs-sub);
}

.share-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.share-actions .button {
  flex: 1;
}

.share-message.is-error {
  color: var(--warm);
}

/* 招待リンクを開いただけでは同期しない。端末にある内容を送るかどうかを
   本人が読んで選んでから、初めて共有サーバーへつなぐ。 */
.share-join-dialog {
  width: min(92vw, 420px);
  padding: 0;
  border: none;
  border-radius: 6px;
  background: #fdfcf7;
}

.share-join-dialog::backdrop {
  background: rgb(38 44 39 / 52%);
}

.share-join-dialog-shell {
  padding: 18px 18px 20px;
}

.share-join-intro {
  margin: 12px 0 0;
  color: var(--ink);
  font-size: var(--fs-body);
  line-height: 1.7;
}

.share-join-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.share-join-counts li {
  padding: 5px 8px;
  border: 1px solid rgb(66 76 68 / 16%);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 700;
}

.share-join-options {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.share-join-option {
  width: 100%;
  padding: 12px;
  border: 1px solid rgb(66 76 68 / 22%);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.share-join-option.is-recommended {
  border-color: rgb(47 100 75 / 52%);
  background: #f1f7f2;
}

.share-join-option strong,
.share-join-option small {
  display: block;
}

.share-join-option strong {
  font-size: var(--fs-body);
}

.share-join-option small {
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.55;
}

.share-join-option:disabled,
.share-join-cancel:disabled {
  opacity: 0.55;
}

.share-join-warning {
  margin-top: 12px;
}

.share-join-status {
  color: var(--leaf);
  font-weight: 700;
}

.share-join-status.is-error {
  color: var(--warm);
}

.share-join-cancel {
  width: 100%;
  margin-top: 12px;
}


/* ---- 収納の切り替え（冷蔵庫／パントリー） -------------------------------- */
/* 縦に2台並べず、同じ筐体を色違いで切り替える（本人の指定）。
   パントリーは木の色にして、開いた瞬間にどちらを見ているか分かるようにする */
.fridge-unit-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: min(100%, 390px);
  margin: 0 auto 9px;
}

.fridge-unit-tabs button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper-raised);
  color: var(--muted);
  font-size: var(--fs-sub);
  font-weight: 800;
}

.fridge-unit-tabs button.is-active {
  border-color: #52675b;
  background: #52675b;
  color: #fff;
}

.fridge-unit-tabs button.is-pantry-tab.is-active {
  border-color: #7a5c40;
  background: #7a5c40;
}

.fridge-unit-tabs small {
  margin-left: 5px;
  font-size: var(--fs-caption);
  font-weight: 700;
  opacity: 0.85;
}

/* パントリー＝冷蔵庫と同じ筐体の木調。枠・影・取っ手・庫内を暖色にする */
.fridge-appliance.is-pantry {
  border-color: #7a5c40;
  background: #e6d5bc;
  box-shadow:
    inset 0 0 0 2px #f9f2e3,
    7px 8px 0 #cec0a9;
}

.fridge-appliance.is-pantry::before {
  background: #7a5c40;
}

.pantry-chamber {
  margin-top: 0;
  border-color: #b3946f;
  border-radius: 10px 10px 4px 4px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 48%), rgb(228 205 172 / 72%)),
    #eddcc2;
}

.pantry-chamber .fridge-compartment-label {
  color: #6d5133;
}

.pantry-chamber .fridge-shelf {
  border-bottom-color: #b3946f;
  box-shadow: 0 3px 0 rgb(255 255 255 / 55%);
}

/* ---- 料理の完成イラスト -------------------------------------------------- */
/* 食材アトラスと同じ切り出し方（440% 330%）。おすすめは大きく、候補は控えめに */
.recipe-illustration {
  flex: none;
  display: block;
  width: 76px;
  height: 76px;
  background-repeat: no-repeat;
  background-size: 440% 330%;
  background-position: var(--atlas-x) var(--atlas-y);
}

.recipe-illustration-fallback {
  display: grid;
  flex: none;
  width: 74px;
  height: 74px;
  place-items: center;
  border: 1px solid rgb(47 100 75 / 18%);
  border-radius: 50%;
  background: var(--leaf-soft);
}

.recipe-illustration-fallback .ingredient-illustration,
.recipe-illustration-fallback .ingredient-initial {
  width: 66px;
  height: 66px;
}

.recipe.is-featured .recipe-illustration {
  width: 108px;
  height: 108px;
}

.recipe-illustration-r01 { background-image: url("assets/recipe-atlas-01.webp?v=87ecc0ee"); }
.recipe-illustration-r02 { background-image: url("assets/recipe-atlas-02.webp?v=ae6b989c"); }
.recipe-illustration-r03 { background-image: url("assets/recipe-atlas-03.webp?v=bbd2c4c6"); }
.recipe-illustration-r04 { background-image: url("assets/recipe-atlas-04.webp?v=ac461af4"); }
.recipe-illustration-r05 { background-image: url("assets/recipe-atlas-05.webp?v=9ad89654"); }
.recipe-illustration-r06 { background-image: url("assets/recipe-atlas-06.webp?v=ae43cada"); }
.recipe-illustration-r07 { background-image: url("assets/recipe-atlas-07.webp?v=bd9a9c07"); }

/* ---- iPad mini / タブレット ------------------------------------------------
   スマホのUIをそのまま中央へ置くと左右が空くだけになるため、700px以上では
   幅を情報量へ戻す。縦向きは下部ナビを残して2列、横向きは左ナビ＋3列にする。 */
@media (min-width: 700px) {
  /* タブレットは幅が余る。筐体を広げ（既定390px）、格子も広げる。
     列数はスマホと同じく中身で決める */
  .fridge-unit-tabs,
  .fridge-appliance,
  .food-consume-station {
    width: min(100%, 640px);
  }

  .fridge-foods {
    max-width: 560px;
  }

  .app-shell {
    max-width: 900px;
    box-shadow: 0 0 34px rgb(34 39 34 / 12%);
  }

  .app-header {
    padding: max(8px, env(safe-area-inset-top)) 24px 8px 28px;
  }

  .bottom-nav {
    width: min(100%, 900px);
  }

  .view {
    padding: 20px 28px 38px;
  }

  h2 {
    font-size: var(--fs-display);
  }

  .storage-tabs {
    margin-inline: -28px;
    padding-inline: 28px;
  }

  .fridge-unit-tabs,
  .fridge-appliance,
  .food-consume-station {
    width: min(100%, 680px);
  }

  .fridge-appliance {
    padding: 12px;
  }

  .fridge-food .ingredient-illustration,
  .fridge-food .ingredient-initial {
    width: min(57px, 100%);
    height: auto;
  }

  .today-ingredient-control {
    grid-template-columns: minmax(0, 1fr) 220px;
    align-items: stretch;
  }

  .today-ingredient-control .recipe-sort-control {
    grid-template-columns: 1fr;
    align-content: center;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--paper-raised);
  }

  .recipe-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 20px;
  }

  .recipe.is-featured {
    grid-column: 1 / -1;
  }

  .recipe.is-alternative {
    height: 100%;
    margin-inline: 0;
    padding-inline: 14px;
    border: 1px solid var(--line-strong);
    background: rgb(251 250 245 / 58%);
  }

  .inventory-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
    border-bottom: 0;
  }

  .expiry-alert-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-list > .empty-state {
    grid-column: 1 / -1;
  }

  .inventory-row {
    align-content: start;
    border-bottom: 1px solid var(--line-strong);
  }

  .history-month-entries {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 0 24px;
  }

  .history-more-button,
  .history-count-note {
    grid-column: 1 / -1;
  }

  .history-entry {
    height: 100%;
  }

  .history-empty {
    grid-column: 1 / -1;
  }

  .shopping-category-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .shopping-food-group-grid,
  .ingredient-item-group-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .ingredient-category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ingredient-add-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .onboarding-leads,
  .onboarding-extra-grid,
  .refine-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .ingredient-dialog,
  .today-ingredient-dialog {
    width: min(calc(100% - 56px), 680px);
    max-height: 88dvh;
    margin: auto;
    border-radius: 14px;
  }

  .ingredient-dialog form {
    padding: 20px 24px;
  }

  .cook-confirm-dialog,
  .history-edit-dialog {
    width: min(calc(100% - 64px), 640px);
    margin: auto;
  }

  .receipt-dialog {
    width: min(calc(100% - 56px), 760px);
  }

  .settings-dialog {
    width: min(calc(100% - 64px), 540px);
  }
}

@media (min-width: 900px) {
  .app-shell {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    max-width: 1180px;
  }

  .app-header {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .app-shell > main {
    grid-column: 2;
    grid-row: 2;
    padding-bottom: 0;
  }

  .bottom-nav {
    position: fixed;
    top: max(55px, calc(47px + env(safe-area-inset-top)));
    right: auto;
    bottom: 0;
    left: max(0px, calc(50% - 590px));
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(78px, auto));
    align-self: start;
    width: 112px;
    height: calc(100dvh - max(55px, calc(47px + env(safe-area-inset-top))));
    padding: 12px 0 env(safe-area-inset-bottom);
    border-top: 0;
    border-right: 1px solid var(--line-strong);
    background: rgb(251 250 245 / 92%);
    box-shadow: 5px 0 16px var(--shadow);
    transform: none;
  }

  .nav-button {
    align-content: center;
    gap: 7px;
    padding: 10px 7px;
    font-size: var(--fs-sub);
  }

  .nav-icon {
    width: var(--icon-lg);
    height: var(--icon-lg);
  }

  .nav-button.is-active {
    box-shadow: inset 4px 0 0 var(--leaf);
  }

  .view {
    padding: 24px 32px 42px;
  }

  .storage-tabs {
    margin-inline: -32px;
    padding-inline: 32px;
  }

  .fridge-unit-tabs,
  .fridge-appliance,
  .food-consume-station {
    width: min(100%, 800px);
  }


  .recipe-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .recipe.is-featured {
    grid-column: auto;
    height: 100%;
  }

  /* 3列では1カードが約300px。イラスト・料理名・検索ボタンを横一列に置くと
     料理名に80pxしか残らず、1文字ずつ折り返していた。検索ボタンを次の行へ
     落とし、おすすめのイラストもほかの候補と同じ76pxにする。 */
  .recipe-heading-row {
    flex-wrap: wrap;
  }

  .recipe-heading-row > div {
    flex: 1 1 140px;
  }

  .recipe-heading-row .recipe-search-links {
    flex: 0 0 100%;
    justify-content: flex-end;
  }

  .recipe.is-featured .recipe-illustration {
    width: 76px;
    height: 76px;
  }

  .recipe.is-featured .ingredient-groups,
  .recipe.is-alternative .ingredient-groups {
    grid-template-columns: 1fr;
  }

  .shopping-view:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
    align-items: start;
    gap: 18px 26px;
  }

  .shopping-heading,
  .shopping-view > .privacy-note {
    grid-column: 1 / -1;
  }

  .shopping-heading {
    margin-bottom: 0;
  }

  .shopping-illustration-picker {
    grid-column: 1;
    grid-row: 3;
    margin-bottom: 0;
  }

  .shopping-manual {
    grid-column: 1;
    grid-row: 4;
    margin-top: 0;
  }

  .shopping-recommendations {
    grid-column: 2;
    grid-row: 3;
    margin-top: 0;
  }

  .shopping-note {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 0;
  }

  .shopping-view > .privacy-note {
    grid-row: 5;
    margin-top: 0;
  }

  .ingredient-category-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ingredient-item-group-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .cook-confirm-dialog {
    width: min(calc(100% - 72px), 860px);
  }

  #cook-confirm-form {
    grid-template-columns: minmax(230px, 0.72fr) minmax(0, 1.28fr);
    align-items: start;
    column-gap: 20px;
  }

  #cook-confirm-form > .dialog-head,
  #cook-confirm-form > .cook-confirm-recipe {
    grid-column: 1 / -1;
  }

  #cook-confirm-form > .cook-serving-fieldset {
    grid-column: 1;
    grid-row: 3;
  }

  #cook-confirm-form > .cook-confirm-ingredients {
    grid-column: 2;
    grid-row: 3 / span 4;
  }

  #cook-confirm-form > .cook-confirm-message {
    grid-column: 1;
    grid-row: 4;
  }

  #cook-confirm-form > .cook-fallback {
    grid-column: 1;
    grid-row: 5;
    margin-top: 0;
  }

  #cook-confirm-form > .dialog-actions {
    grid-column: 1;
    grid-row: 6;
  }
}
