/* 画面の部品。色と大きさは tokens.css の変数だけを使う。
   白い角丸のカードを地に置き、押せるものは丸いボタン、選んでいる状態は枠で示す */

h1 { font-size: 24px; line-height: 1.45; margin: 0; font-weight: 700; text-wrap: balance; word-break: auto-phrase; letter-spacing: 0.04em; }
h2 { font-size: 18px; line-height: 1.5; margin: 0; font-weight: 700; text-wrap: balance; word-break: auto-phrase; letter-spacing: 0.04em; }
p, li { text-wrap: pretty; }
a { color: var(--primary); text-underline-offset: 3px; text-decoration-thickness: 1px; }

.stack { display: grid; gap: 16px; }

/* 欧文の小見出しは使わない(data-en は残っていても出さない) */
.kicker { display: block; font-size: 18px; font-weight: 700; }
.kicker-line, .kicker-inline, .brand small, .empty .mark { display: none; }

/* ---------------------------------------------------------------- 上部のバー */

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 640px; margin: 0 auto; min-height: 60px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right));
}
.brand { display: inline-flex; align-items: baseline; color: var(--text); text-decoration: none; padding: 0 8px; }
.brand b { font-weight: 700; font-size: 22px; letter-spacing: 0.08em; }
.bar-title { font-weight: 700; font-size: 18px; letter-spacing: 0.06em; }
.bar-link {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: var(--tap); padding: 0 10px;
  color: var(--text); text-decoration: none; font-size: 16px; font-weight: 700;
  background: none; border: 0; font-family: inherit; cursor: pointer; letter-spacing: 0.04em;
}
.bar-link.edit { color: var(--primary); }

/* ---------------------------------------------------------------- 下のタブ */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner {
  max-width: 640px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
.tabbar a {
  display: grid; justify-items: center; gap: 2px; padding: 8px 0 10px;
  color: var(--text-quiet); text-decoration: none; font-size: 12px; letter-spacing: 0.06em;
  -webkit-tap-highlight-color: transparent;
}
.tabbar svg { width: 24px; height: 24px; }
.tab-icon { display: grid; place-items: center; width: 60px; height: 32px; border-radius: 999px; transition: background-color .2s; }
.tabbar a[aria-current="page"] { color: var(--text); font-weight: 700; }
/* 今いるタブは、アイコンの後ろに淡い丸い面を敷く */
.tabbar a[aria-current="page"] .tab-icon { background: var(--mark-soft); color: var(--mark); }
.tab-wrap { position: relative; display: grid; justify-items: center; }
.tab-badge {
  position: absolute; top: -4px; left: 50%; margin-left: 12px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--text); color: var(--card); border: 2px solid var(--card); box-sizing: content-box;
  font-size: 10px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: 0;
}

/* ---------------------------------------------------------------- カードと入力 */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 18px 18px 20px;
  display: grid; gap: 14px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

label { display: grid; gap: 6px; font-size: 14px; font-weight: 700; color: var(--text); }
input, textarea, select {
  font: inherit; font-size: 16px; font-weight: 500;
  color: var(--text);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-field);
  padding: 8px 14px;
  min-height: var(--tap);
  width: 100%; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.card input, .card textarea, .card select { background: var(--bg); }
input::placeholder, textarea::placeholder { color: var(--text-quiet); opacity: .7; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 4px var(--primary-soft); }
textarea { resize: vertical; min-height: 84px; line-height: 1.7; }
:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; }

.btn {
  font: inherit; font-size: 15px; font-weight: 700; letter-spacing: 0.06em; white-space: nowrap;
  min-height: var(--tap);
  border-radius: var(--r-btn);
  padding: 0 22px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
  transition: background-color .15s, color .15s, border-color .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: 0 6px 14px -8px var(--primary); }
.btn.secondary { border-color: var(--primary); color: var(--primary); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--primary); padding: 0 10px; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: transparent; }
.btn.danger.armed { background: var(--danger); color: var(--on-primary); border-color: var(--danger); }
.btn.wide { width: 100%; min-height: 54px; font-size: 16px; }
.btn.small { min-height: 38px; padding: 0 16px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn svg { flex: none; }

/* レシピを足す。親指の届く右下に浮かせる */
.fab {
  position: fixed; z-index: 15; right: max(16px, env(safe-area-inset-right));
  bottom: calc(80px + env(safe-area-inset-bottom));
  min-height: 56px; padding: 0 26px; font-size: 16px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--bg) 80%, transparent), var(--shadow-lg);
}

.icon-btn {
  min-width: var(--tap); min-height: var(--tap); padding: 0; border-radius: 999px;
  border: 0; background: transparent; color: var(--text-quiet);
  font-size: 20px; line-height: 1; cursor: pointer; font-family: inherit;
}
.icon-btn:hover { color: var(--danger); }

.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }

.notice {
  background: var(--warn-bg); color: var(--warn-text);
  border-radius: var(--r-field);
  padding: 12px 16px; font-size: 15px;
}
.notice ul { margin: 0; padding-left: 1.2em; }
.error { color: var(--danger); font-size: 15px; margin: 0; }
.hint { color: var(--text-quiet); font-size: 14px; margin: 0; line-height: 1.75; }
.source { font-size: 13px; color: var(--text-quiet); overflow-wrap: anywhere; margin: 0; text-align: center; }

/* ---------------------------------------------------------------- 切り替え(取り込み/手入力、並べ方) */

.tabs, .sort {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px;
  padding: 3px; border-radius: var(--r-btn); background: var(--sunken);
}
.tabs { display: grid; }
.sort { justify-self: start; }
.tabs button, .sort button {
  font: inherit; font-size: 14px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap;
  min-height: 36px; padding: 0 16px; border: 0; border-radius: var(--r-btn);
  background: transparent; color: var(--text-quiet); cursor: pointer;
}
.tabs button { min-height: 42px; }
.tabs button[aria-selected="true"], .sort button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* ---------------------------------------------------------------- 登録・編集フォーム */

.ing-list { display: grid; gap: 8px; }
.ing-row { display: grid; grid-template-columns: minmax(0, 1fr) 6.5em var(--tap); gap: 6px; }
.group-row { display: grid; grid-template-columns: minmax(0, 1fr) var(--tap); gap: 6px; margin-top: 10px; }
.group-row input { background: transparent; border: 0; border-bottom: 1.5px solid var(--line); border-radius: 0; font-weight: 700; padding-left: 2px; }
.step-row { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) var(--tap); gap: 6px; align-items: start; }
.step-no {
  display: grid; place-items: center; width: 30px; height: 30px; margin-top: 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.add-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.servings-input { display: flex; align-items: center; gap: 10px; color: var(--text); white-space: nowrap; font-size: 15px; }
.servings-input input { width: 4.5em; flex: none; text-align: center; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.attention .servings-input input { background: var(--warn-bg); border-color: var(--warn-text); }

.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice label {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 500;
  border: 1.5px solid var(--line); border-radius: var(--r-btn); padding: 0 18px; min-height: var(--tap);
  cursor: pointer; background: var(--card);
}
.choice label:has(input:checked) { border-color: var(--select); background: var(--select-bg); font-weight: 700; }
.choice input { width: auto; min-height: 0; accent-color: var(--primary); }

/* ---------------------------------------------------------------- 一覧 */

.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.count { color: var(--text-quiet); font-size: 13px; font-variant-numeric: tabular-nums; }
.recipe-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.recipe-list li {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow);
  overflow: hidden;
}
.recipe-list a {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 4px 14px;
  padding: 12px 14px 12px 12px;
  color: var(--text); text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.recipe-list a:active { background: var(--sunken); }
/* 写真は持たないので、料理名の頭文字を色付きの札にして目印にする */
.recipe-list .badge {
  grid-row: 1 / span 2; width: 64px; height: 64px; border-radius: calc(var(--r-card) - 4px);
  display: grid; place-items: center;
  font-size: 28px; font-weight: 700; line-height: 1;
  background: var(--tint-1); color: var(--tint-1-ink);
}
.recipe-list li:nth-child(4n+2) .badge { background: var(--tint-2); color: var(--tint-2-ink); }
.recipe-list li:nth-child(4n+3) .badge { background: var(--tint-3); color: var(--tint-3-ink); }
.recipe-list li:nth-child(4n+4) .badge { background: var(--tint-4); color: var(--tint-4-ink); }
.recipe-list .name { font-size: 17px; font-weight: 700; line-height: 1.5; word-break: auto-phrase; align-self: end; }
.recipe-list .meta { grid-column: 2; display: flex; gap: 4px 6px; flex-wrap: wrap; align-items: center; align-self: start; }
.recipe-list .chev { grid-row: 1 / span 2; grid-column: 3; color: var(--text-quiet); font-size: 20px; }

/* 小さな付記。人数・共有・取り込み元 */
.chip {
  display: inline-flex; align-items: center;
  padding: 1px 10px; border-radius: var(--r-btn);
  background: var(--sunken); color: var(--text-quiet);
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.8;
}
.chip.strong { color: var(--text); }
.chip.accent { background: var(--mark-soft); color: var(--mark); }

.empty {
  text-align: center; padding: 36px 20px; color: var(--text-quiet);
  background: var(--card); border: 1.5px dashed var(--line); border-radius: var(--r-card);
  display: grid; gap: 16px; justify-items: center;
}
.empty p { margin: 0; line-height: 1.9; }

/* 売り場の印。材料の頭の小さな丸と、買い物リストの見出しに使う */
[data-cat="veg"] { --cat: var(--cat-veg); }
[data-cat="meat"] { --cat: var(--cat-meat); }
[data-cat="dairy"] { --cat: var(--cat-dairy); }
[data-cat="season"] { --cat: var(--cat-season); }
[data-cat="other"] { --cat: var(--cat-other); }
.dot { width: 8px; height: 8px; border-radius: 999px; background: var(--cat); flex: none; }

/* ---------------------------------------------------------------- レシピ画面 */

.recipe-head { display: grid; gap: 10px; padding: 8px 2px 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.stepper { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: var(--r-btn); background: var(--sunken); }
.stepper button {
  width: 38px; height: 38px; border: 0; border-radius: 999px; background: var(--card); box-shadow: var(--shadow);
  color: var(--text); font-size: 20px; cursor: pointer; font-family: inherit; line-height: 1;
}
.stepper button:disabled { opacity: .35; cursor: default; box-shadow: none; }
.stepper output { min-width: 4.4em; text-align: center; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

.ing-view { list-style: none; margin: 0; padding: 0; }
.ing-view li { display: flex; align-items: baseline; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.ing-view li:last-child { border-bottom: 0; }
.ing-view .dot { transform: translateY(-2px); }
.ing-view .ing-name { flex: 1; }
.ing-view li.group-label { border-bottom: 0; padding: 16px 0 2px; font-weight: 700; font-size: 15px; color: var(--text-quiet); }
.ing-view .amt { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.ing-view .changed { color: var(--primary); }

.steps-view { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; counter-reset: step; }
.steps-view li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; counter-increment: step; line-height: 1.85; }
.steps-view li::before {
  content: counter(step);
  display: grid; place-items: center; width: 30px; height: 30px; margin-top: 1px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* 手順の中の「20分」。押すとタイマーが動く */
.timer-chip {
  font: inherit; font-size: 0.92em; font-weight: 700;
  display: inline-flex; align-items: center; gap: 4px;
  margin: 0 2px; padding: 0 10px; min-height: 28px; vertical-align: baseline;
  background: var(--primary-soft); color: var(--primary); border: 0; border-radius: var(--r-btn);
  cursor: pointer; line-height: 1.5; font-variant-numeric: tabular-nums;
}
.timer-chip svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- タイマー(画面下に並ぶ) */

.timer-dock {
  position: fixed; left: 0; right: 0; z-index: 30;
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: grid; gap: 8px; justify-items: center; pointer-events: none;
  padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right));
}
body.has-tabs .timer-dock { bottom: calc(78px + env(safe-area-inset-bottom)); }
.timer {
  pointer-events: auto;
  width: min(100%, 560px);
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 10px 10px 14px; border-radius: var(--r-card);
  background: var(--text); color: var(--card); box-shadow: var(--shadow-lg);
}
.timer .ring { width: 36px; height: 36px; }
.timer .ring circle { fill: none; stroke-width: 3.5; stroke-linecap: round; }
.timer .ring .track { stroke: color-mix(in srgb, var(--card) 22%, transparent); }
.timer .ring .bar { stroke: var(--card); transform: rotate(-90deg); transform-origin: 50% 50%; }
.timer .what { min-width: 0; display: grid; line-height: 1.3; }
.timer .left { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.timer .label { font-size: 12px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer .ctrl { display: flex; gap: 6px; }
.timer .ctrl button {
  min-width: 42px; height: 40px; border: 0; border-radius: 999px;
  background: color-mix(in srgb, var(--card) 16%, transparent); color: inherit; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; padding: 0 12px;
}
.timer.done { background: var(--primary); color: var(--on-primary); animation: blink 1s ease-in-out infinite alternate; }
.timer.paused .left { opacity: .55; }
@keyframes blink { from { opacity: 1; } to { opacity: .85; } }
@media (prefers-reduced-motion: reduce) { .timer.done { animation: none; } }

/* ---------------------------------------------------------------- 下から出るシート */

dialog.sheet {
  width: min(100%, 640px); max-width: 100%; max-height: 88vh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 24px 24px 0 0;
  background: var(--bg); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.sheet::backdrop { background: rgb(20 24 31 / .4); }
.sheet-body { display: grid; gap: 14px; padding: 12px 20px calc(18px + env(safe-area-inset-bottom)); }
.sheet-body::before { content: ""; justify-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin-bottom: 6px; }
.pick-list { list-style: none; margin: 0; padding: 0 14px; max-height: 52vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }
.pick-list label {
  display: flex; align-items: center; gap: 12px; padding: 11px 0;
  color: var(--text); font-size: 16px; font-weight: 500; cursor: pointer;
}
.pick-list .ing-name { flex: 1; }
.pick-list .amt { font-variant-numeric: tabular-nums; font-weight: 700; }

/* チェック。丸い枠で、入れると塗りつぶして白い印を出す */
.pick-list input[type=checkbox], .shop-list input[type=checkbox], .check-line input[type=checkbox], .phrase-main input[type=checkbox] {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; min-height: 0; padding: 0; margin: 0; flex: none;
  border: 2px solid var(--select); border-radius: 999px; background: var(--card);
  display: grid; place-items: center; cursor: pointer; transition: background-color .15s, border-color .15s;
}
.pick-list input[type=checkbox]::after, .shop-list input[type=checkbox]::after, .check-line input[type=checkbox]::after, .phrase-main input[type=checkbox]::after {
  content: ""; width: 6px; height: 11px; margin-top: -3px;
  border: solid var(--on-primary); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0); transition: transform .15s;
}
.pick-list input[type=checkbox]:checked, .shop-list input[type=checkbox]:checked, .check-line input[type=checkbox]:checked, .phrase-main input[type=checkbox]:checked { background: var(--primary); border-color: var(--primary); }
.pick-list input[type=checkbox]:checked::after, .shop-list input[type=checkbox]:checked::after, .check-line input[type=checkbox]:checked::after, .phrase-main input[type=checkbox]:checked::after { transform: rotate(45deg) scale(1); }
.shop-list input[type=checkbox] { width: 32px; height: 32px; }

/* ---------------------------------------------------------------- 買い物リスト */

.shop-section { display: grid; gap: 10px; }
.shop-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 0; }
.shop-head .kicker { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.shop-head .kicker::before { content: ""; width: 10px; height: 10px; border-radius: 999px; background: var(--cat, var(--text-quiet)); }
.done-list .card-head .kicker::before { content: none; }
.shop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.shop-list li {
  display: flex; align-items: center; gap: 8px; padding: 8px 6px 8px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow);
}
.shop-list label { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; color: var(--text); font-size: 16px; font-weight: 700; cursor: pointer; min-height: 48px; }
.shop-list .what { display: grid; min-width: 0; line-height: 1.4; }
.shop-list .from { font-size: 12px; font-weight: 500; color: var(--text-quiet); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-list .amt { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-quiet); font-weight: 700; }
.shop-list li.checked { background: transparent; box-shadow: none; }
.shop-list li.checked .what > span:first-child, .shop-list li.checked .amt { text-decoration: line-through; color: var(--text-quiet); }
.add-item { display: grid; grid-template-columns: minmax(0, 1fr) 5.5em auto; gap: 6px; }

/* ---------------------------------------------------------------- 探す・タグ・評価 */

.finder { display: grid; gap: 12px; }
.finder input[type=search] {
  -webkit-appearance: none; appearance: none; border-radius: var(--r-btn); padding-left: 44px; min-height: 50px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239aa3b0' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 16px 50%;
}
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; }
#tag-filter { flex-wrap: nowrap; overflow-x: auto; padding: 2px; scrollbar-width: none; }
#tag-filter::-webkit-scrollbar { display: none; }
.tag-chip {
  font: inherit; font-size: 14px; font-weight: 700; white-space: nowrap;
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 16px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--text);
  text-decoration: none; cursor: pointer; border-radius: var(--r-btn);
}
.tag-chip::before { content: "#"; color: var(--text-quiet); margin-right: 2px; font-weight: 500; }
.tag-chip[aria-pressed="true"] { background: var(--select-bg); border: 2px solid var(--select); padding: 0 15px; }
.tag-chip.suggest { color: var(--text-quiet); border-style: dashed; }
.tag-chip.suggest::before { content: "＋"; }
#tag-filter .tag-chip:first-child::before { content: none; }
.tag-chip .x { opacity: .6; margin-left: 4px; }
.chip.tag::before { content: "#"; opacity: .7; }

.stars-inline { color: var(--mark); font-size: 12px; letter-spacing: 0.04em; }
.rating { display: flex; gap: 2px; }
.star {
  width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer;
  font-size: 30px; line-height: 1; color: var(--line); font-family: inherit; padding: 0;
}
.star.on { color: var(--mark); }

/* ---------------------------------------------------------------- ストック・店 */

.check-line { display: flex; align-items: center; gap: 12px; color: var(--text); font-size: 15px; font-weight: 500; min-height: var(--tap); }

/* 材料の名前の下に、家の様子を小さく添える */
.ing-view .ing-name, .pick-list .ing-name { display: grid; line-height: 1.45; }
.stock-hint { font-size: 12px; color: var(--text-quiet); }
.stock-hint.soon { color: var(--mark); font-weight: 700; }
.pick-list li { display: grid; gap: 4px; border-bottom: 1px solid var(--line-soft); }
.pick-list li:last-child { border-bottom: 0; }
.pick-list select.candidate { min-height: 38px; font-size: 14px; margin: 0 0 10px 38px; width: calc(100% - 38px); }

.stock-section { display: grid; gap: 10px; }
.stock-section > .card-head, .stock-section > .kicker { padding: 4px 4px 0; }
.stock-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.stock-row {
  position: relative; display: grid; gap: 10px; padding: 14px 16px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow);
  overflow: hidden;
}
/* そろそろの品は、左に色の帯を立てる */
.stock-row.soon::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--mark); }
.stock-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.stock-name {
  font: inherit; font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.5;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left; min-height: 30px;
}
.stock-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 13px; color: var(--text-quiet); }
.stock-meta .due { font-variant-numeric: tabular-nums; }
.stock-meta .due.soon { color: var(--mark); font-weight: 700; }
.stock-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
/* 3つの記録は、1本の丸い帯にまとめる */
.stock-actions .seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-btn); background: var(--sunken); }
.stock-actions .seg .btn { border: 0; min-height: 36px; padding: 0 14px; background: transparent; color: var(--text-quiet); font-size: 13px; box-shadow: none; }
.stock-actions .seg .btn.primary { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.stock-row.soon .seg .btn.primary { background: var(--primary); color: var(--on-primary); }
.stock-actions > .btn.ghost { margin-left: auto; font-size: 14px; }

/* 残り日数のメーター。丸い棒の長さで残りを示す */
.meter { position: relative; display: block; height: 6px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.meter-bar { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--cat-veg); transition: width .3s ease; }
.meter.soon .meter-bar { background: var(--mark); }
/* 予定日を過ぎたら、斜線で「たぶん切れている」を示す */
.meter.over { background: repeating-linear-gradient(-45deg, var(--mark-soft) 0 6px, color-mix(in srgb, var(--mark) 45%, transparent) 6px 9px); }
.meter.over .meter-bar { display: none; }
/* まだ記録が少なく、当てずっぽうに近いうちは淡く */
.meter.faint { opacity: .45; }

/* 買い物リスト:上の「そろそろ」と、画面下に常に出す入力欄 */
.notice-line {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 12px 12px 18px; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow);
}
.notice-line::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--mark); }
.notice-line p { margin: 0; font-size: 14px; font-weight: 700; }
.add-dock {
  position: fixed; left: 0; right: 0; z-index: 15;
  bottom: calc(66px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: minmax(0, 1fr) 4em 6.5em auto; gap: 6px;
  padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.add-dock input, .add-dock select { border-radius: var(--r-btn); background: var(--card); }
.add-dock select { width: 100%; font-size: 14px; padding-right: 4px; }
.add-dock .btn { min-height: var(--tap); }
/* 店をまだ登録していなければ、店の欄を出さずに品名を広くとる */
.add-dock:has(select[hidden]) { grid-template-columns: minmax(0, 1fr) 4.5em auto; }
body.has-dock .page { padding-bottom: calc(200px + env(safe-area-inset-bottom)); }
body.has-dock .timer-dock { bottom: calc(134px + env(safe-area-inset-bottom)); }

/* 取り消しなどを添える短い知らせ */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 40;
  bottom: calc(84px + env(safe-area-inset-bottom));
  width: min(calc(100% - 24px), 560px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  padding: 12px 12px 12px 18px; border-radius: var(--r-card);
  background: var(--text); color: var(--card); font-size: 14px; box-shadow: var(--shadow-lg);
}
.toast span { flex: 1 1 12em; }
.toast button { font: inherit; font-size: 13px; font-weight: 700; min-height: 36px; padding: 0 14px; border-radius: var(--r-btn); background: var(--card); color: var(--text); border: 0; cursor: pointer; }
body.has-dock .toast { bottom: calc(140px + env(safe-area-inset-bottom)); }

/* 設定:店と、売り場の回り方 */
.store-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.store-item { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.store-item summary { cursor: pointer; font-size: 14px; color: var(--primary); font-weight: 700; min-height: 32px; display: flex; align-items: center; }
.aisle-list { list-style: none; margin: 6px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-field); overflow: hidden; }
.aisle-row { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line-soft); background: var(--card); }
.aisle-row:last-child { border-bottom: 0; }
.aisle-row .aisle-name { flex: 1; font-size: 15px; }
.aisle-row .handle { width: var(--tap); min-height: var(--tap); display: grid; place-items: center; color: var(--text-quiet); cursor: grab; touch-action: none; font-size: 18px; }
.aisle-row.dragging { background: var(--sunken); box-shadow: var(--shadow-lg); }
.icon-btn.armed { color: var(--danger); font-size: 14px; }

@media (prefers-reduced-motion: reduce) { .meter-bar { transition: none; } .btn { transition: none; } }

/* 作った記録 */
.cooked-list { list-style: none; margin: 0; padding: 0; }
.cooked-list li { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); font-size: 14px; font-variant-numeric: tabular-nums; }
.cooked-list:empty { display: none; }

/* 段階 B:ひとこと追加・写真・スクショ */
.phrase-dock { grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; }
.add-dock:has(select[hidden]).phrase-dock { grid-template-columns: minmax(0, 1fr) auto auto auto; }
.dock-icon { color: var(--text); background: var(--card); border: 1.5px solid var(--line); }
.dock-icon.listening { color: var(--on-primary); background: var(--primary); border-color: var(--primary); }
.phrase-list { list-style: none; margin: 0; padding: 0 14px; max-height: 50vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }
.phrase-list li { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.phrase-list li:last-child { border-bottom: 0; }
.phrase-main { display: grid; grid-template-columns: 26px minmax(0, 1fr) 5em; gap: 10px; align-items: center; }
.phrase-sub { display: flex; gap: 6px; flex-wrap: wrap; padding-left: 36px; }
.phrase-sub select { width: auto; min-height: 36px; font-size: 14px; border-radius: var(--r-btn); }
.photo-preview { max-height: 30vh; width: auto; max-width: 100%; justify-self: start; border: 1px solid var(--line); border-radius: var(--r-field); }
.photo-preview:not([src]) { display: none; }
.image-previews { display: flex; gap: 8px; flex-wrap: wrap; }
.image-previews img { height: 96px; width: auto; border: 1px solid var(--line); border-radius: var(--r-field); }
