:root {
  /* 無漂白のコーヒーフィルター（茶色い紙）の色。ボタンは深煎りの豆、お湯の量は抽出したコーヒーの色 */
  --bg: #e3d3b6;
  --card: #efe4cf;
  --ink: #2b1a10;
  --sub: #6e5340;
  --line: #c4ad8a;
  --accent: #2b1a10;
  --accent-ink: #efe4cf;
  --chip: #eadcc2;
  --chip-on: #2b1a10;
  --tip: #efe4cf;
  --water: #5a3420;
  --water-2: #8a5634;
  --crema: #b27a33;
  --radius: 10px;
  --fiber: rgba(110, 83, 64, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    /* 暗い画面では、深煎りの豆の焦げ茶にクレマ（泡）の金茶色 */
    --bg: #241812; --card: #2f2119; --ink: #f1e4d3; --sub: #b39a84; --line: #45342a;
    --accent: #d9a35f; --accent-ink: #241812; --chip: #33251c; --chip-on: #d9a35f; --tip: #33251c;
    --water: #d9a35f; --water-2: #a8723c; --crema: #f1e4d3; --fiber: rgba(0, 0, 0, .08);
  }
}
/* 数字（幅の狭い書体。SIL Open Font License 1.1。fonts/OFL-BarlowCondensed.txt） */
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url("../fonts/barlow-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("../fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
.num { font-family: "Barlow Condensed", system-ui, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: 0; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background-color: var(--bg); color: var(--ink);
  /* 紙の繊維（細かい斜めの筋） */
  background-image: repeating-linear-gradient(115deg, var(--fiber) 0 1px, transparent 1px 7px), repeating-linear-gradient(25deg, var(--fiber) 0 1px, transparent 1px 11px);
  font: 16px/1.7 "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  font-feature-settings: "palt"; letter-spacing: .02em;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
main { max-width: 560px; margin: 0 auto; padding: 0 16px 24px; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h2 { font-size: 1.2rem; margin-bottom: 8px; }
small { color: var(--sub); font-weight: normal; }
[hidden] { display: none !important; }

.appbar { padding: 14px 16px 6px; max-width: 560px; margin: 0 auto; }
.appbar h1 { font-size: 1.15rem; letter-spacing: .02em; }

.card {
  /* 枠で囲まず、細い線と余白で区切る */
  background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0;
  padding: 18px 0; margin: 0; min-width: 0;
}
fieldset.card legend { font-weight: 700; font-size: 1.05rem; padding: 0 4px; float: left; width: 100%; margin-bottom: 8px; }
fieldset.card legend + * { clear: both; }
details.card summary { font-weight: 700; cursor: pointer; min-height: 48px; display: flex; align-items: center; gap: 6px; }
.field-label { display: block; font-size: .85rem; color: var(--sub); margin: 14px 0 6px; font-weight: 600; }
.hint { color: var(--sub); font-size: .85rem; margin: 6px 0; }
.tip { background: var(--tip); border-radius: 12px; padding: 10px 12px; font-size: .92rem; }

.input {
  width: 100%; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 44px;
}
.input:focus-visible, .btn:focus-visible, .chip:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: .92rem; color: var(--ink); background: var(--chip);
  border: 1px solid transparent; border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--chip-on); color: var(--accent-ink); font-weight: 700; }
.chips-lg { display: grid; grid-template-columns: 1fr 1fr; }
.chips-lg .chip { border-radius: 14px; padding: 12px 8px; text-align: left; font-size: clamp(.75rem, 3.4vw, .98rem); } /* 狭い画面でも言葉の途中で折り返さない大きさに */
.chip .x { margin-left: 6px; opacity: .6; }
.stamps .chip { font-size: 1rem; }

.ai-card { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.ai-card p { margin: 4px 0; }
.scan-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scan-btns .btn { font-size: .88rem; padding: 10px 6px; white-space: nowrap; }
@media (max-width: 340px) { .scan-btns .btn { font-size: .78rem; padding-inline: 4px; } }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > div { flex: 1 1 auto; } /* 中身の幅で並べ、収まらなければ次の行へ */
.seg { display: inline-flex; background: var(--chip); border-radius: 12px; padding: 3px; }
.seg-wide { display: flex; margin: 8px 0 12px; }
.seg.seg-wide button { flex: 1 1 0; min-width: 0; white-space: pre-line; padding-inline: 8px; font-size: .9rem; line-height: 1.4; } /* 長い文言は2つを同じ幅にし、文言中の改行で2行に分ける */
.seg button {
  font: inherit; border: 0; background: none; color: var(--ink); padding: 8px 14px; border-radius: 10px; cursor: pointer; flex: 1; min-height: 44px; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--card); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.stepper { display: inline-flex; align-items: center; gap: 8px; background: var(--chip); border-radius: 12px; padding: 3px; }
.stepper button { font: inherit; font-size: 1.2rem; width: 48px; height: 48px; border: 0; border-radius: 10px; background: var(--card); color: var(--ink); cursor: pointer; }
.stepper output { min-width: 40px; text-align: center; font-weight: 700; font-size: 1.1rem; }

.btn {
  font: inherit; font-weight: 700; border-radius: 14px; padding: 10px 16px; min-height: 44px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.btn small { display: block; font-size: .72rem; font-weight: normal; color: inherit; opacity: .8; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-ghost { background: var(--chip); border-color: transparent; }
.btn-text { background: none; border: 0; color: var(--sub); }
.btn-block { display: block; width: 100%; margin-top: 12px; }
.btn-lg { font-size: 1.08rem; padding: 14px 18px; }
.btn:disabled { opacity: .5; cursor: default; }

/* レシピ結果 */
.banner { background: var(--tip); border-radius: 12px; padding: 10px 12px; margin-top: 12px; font-size: .92rem; }
.recipe-head h2 { font-size: 1.25rem; }
.recipe-head p { margin: 4px 0 0; color: var(--sub); font-size: .9rem; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: grid; grid-template-columns: 56px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.steps .add { color: var(--sub); font-size: .85rem; }
.prep { margin: 0; padding-left: 1.2em; }
.reasons { margin: 6px 0 0; padding-left: 1.2em; font-size: .9rem; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .btn-primary, .actions .btn-wide { grid-column: 1 / -1; }
.actions .btn-text { white-space: nowrap; }

/* タイマー */
.timer-ctrl { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; margin-top: 16px; }
.timer-ctrl .btn { white-space: nowrap; padding-inline: 12px; }

/* 履歴 */
.view-title { margin: 16px 0 4px; }
.hist { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; }
.hist-main { background: none; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.hist-main b { display: block; }
.hist-main span { font-size: .85rem; color: var(--sub); }
.hist-memo { grid-column: 1 / -1; font-size: .9rem; margin: 0; }
.hist-ctrl { display: flex; gap: 4px; }
.icon-btn { font: inherit; width: 40px; height: 40px; border-radius: 10px; border: 0; background: var(--chip); color: var(--ink); cursor: pointer; }
.empty { text-align: center; color: var(--sub); padding: 40px 0; }

/* 共有 */
.share-preview { width: 100%; border-radius: 12px; margin-top: 12px; border: 1px solid var(--line);
  /* 背景が透明な画像（レシート風）でも透明だと分かるよう、薄い市松模様を敷く */
  background: repeating-conic-gradient(rgba(128,128,128,.14) 0 25%, transparent 0 50%) 0 0 / 20px 20px; }
.share-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.share-actions .btn-primary { grid-column: 1 / -1; }
.share-actions .btn-ghost { white-space: nowrap; padding-inline: 8px; font-size: .92rem; }
@media (max-width: 340px) { .share-actions .btn-ghost { font-size: .85rem; padding-inline: 4px; white-space: normal; line-height: 1.3; } } /* 320px 幅でも枠からはみ出さないように */

.tabbar {
  position: fixed; inset: auto 0 0 0; display: flex; justify-content: center; gap: 8px;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); padding: 6px 16px calc(6px + env(safe-area-inset-bottom));
}
.tabbar button {
  flex: 0 1 160px; font: inherit; border: 0; background: none; color: var(--sub); border-radius: 12px; padding: 6px; cursor: pointer; font-size: 1.2rem;
}
.tabbar button span { display: block; font-size: .75rem; font-weight: 700; }
.tabbar button[aria-current="page"] { color: var(--accent); background: var(--chip); }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .9rem; max-width: calc(100% - 32px);
}
#history-filter { margin: 4px 0 12px; }
/* お店の名前・みんなのきろくへの公開 */
.recipe-head p.shop-line { color: var(--ink); }
.shop-line .shop-label { display: block; color: var(--sub); font-size: .85rem; }
.shop-line .nobreak { display: inline-block; }
.shop-line .shop-name { display: block; font-weight: bold; overflow-wrap: anywhere; }
#share-shop { margin-bottom: 12px; }
.publish { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.publish .hint { margin: 6px 0 0; }
.hist-memo { overflow-wrap: anywhere; }

/* 手動でつくる・編集する */
.hint.center { text-align: center; }
/* 規約・出典・お問い合わせのリンク（画面の下。押しやすいよう高さを取る） */
.site-links { display: flex; flex-wrap: wrap; justify-content: center; column-gap: 4px; margin: 24px 0 8px; font-size: .85rem; }
.site-links a { display: inline-block; padding: 12px 8px; color: var(--sub); text-decoration: underline; text-underline-offset: 3px; }

/* 利用規約・プライバシーポリシー・出典のページ（public/terms/ など。タブバーがない） */
body.doc-page { padding-bottom: env(safe-area-inset-bottom); }
.doc-home { color: inherit; text-decoration: none; }
.doc-back { margin: 4px 0 0; }
.doc-back a { display: inline-block; padding: 10px 0; color: var(--sub); }
.doc h3 { font-size: 1rem; margin: 28px 0 6px; }
.doc p, .doc li { font-size: .95rem; overflow-wrap: anywhere; }
.doc ol, .doc ul { padding-left: 1.6em; margin: 6px 0; }
.doc li + li { margin-top: 4px; }
.doc a { color: inherit; text-underline-offset: 3px; }
.doc-table { overflow-x: auto; margin: 8px 0; }
.doc-table table { border-collapse: collapse; width: 100%; font-size: .88rem; }
.doc-table th, .doc-table td { border-top: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.doc-table th { color: var(--sub); font-weight: 600; white-space: nowrap; }
.doc-license { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .75rem; line-height: 1.5; color: var(--sub); background: var(--card); border-radius: var(--radius); padding: 12px; }
.doc-date { margin-top: 32px; color: var(--sub); font-size: .9rem; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.editor-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--sub); min-width: 0; }
.editor-grid .wide { grid-column: 1 / -1; }
.unit-field { display: flex; align-items: center; gap: 6px; }
.unit-field .input { min-width: 0; flex: 1 1 auto; }
.time-field { display: flex; align-items: center; gap: 4px; color: var(--ink); font-size: .9rem; }
.time-field .input { width: 4.2em; min-width: 0; padding-inline: 6px; text-align: right; }
.pour-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
/* 1行目に「◯投目」と ✕、2行目に入力欄（狭い画面でもカードからはみ出さないように） */
.pour-row > b { grid-row: 1; grid-column: 1; font-size: .9rem; white-space: nowrap; }
.pour-row > :last-child { grid-row: 1; grid-column: 2; }
.pour-row .pour-fields { grid-row: 2; grid-column: 1 / -1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .9rem; }
.pour-fields .break { flex-basis: 100%; height: 0; }
.pour-row .pour-fields .input { width: 5.2em; padding-inline: 6px; text-align: right; }
.editor-section { margin: 16px 0 6px; font-size: 1rem; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.editor-status { color: #b3261e; }
/* 絞り込み・いいね */
.filters { margin: 4px 0 12px; }
.filters summary { cursor: pointer; font-weight: bold; padding: 0; min-height: 48px; display: flex; align-items: center; gap: 6px; }
@media (max-width: 340px) { #history-source button { font-size: .8rem; padding-inline: 4px; } }
.filters .filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--sub); min-width: 0; }
.filters .wide { grid-column: 1 / -1; }
.like-btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: .95rem; min-height: 40px; white-space: nowrap; }
.like-btn.on { color: #c2185b; border-color: #e7a9c1; }
.badge { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--ink); margin-left: 6px; vertical-align: middle; }
@media (max-width: 340px) { .seg.seg-wide.sort-seg button { font-size: .78rem; padding-inline: 2px; white-space: nowrap; } } /* 並び順の3つを1行ずつに収める */


/* ===== 無漂白フィルター紙のデザイン ===== */
/* アプリ名：アイコンを横に並べて大きく見せる */
.appbar h1 { display: flex; align-items: center; gap: 10px; font-size: 1.5rem; font-weight: 700; color: var(--ink); letter-spacing: .04em; }
.app-logo { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; box-shadow: 0 1px 3px rgba(43, 26, 16, .18); }
@media (max-width: 340px) { .appbar h1 { font-size: 1.3rem; } .app-logo { width: 34px; height: 34px; } }
.input { background: var(--card); border-radius: 8px; }
fieldset.card { border-left: 0; border-right: 0; border-bottom: 0; }
fieldset.card legend { font-size: 1rem; }
.btn { border-radius: 10px; }
.btn-ghost { background: var(--card); border-color: var(--line); }
.chip { background: var(--card); border-color: var(--line); }
.banner { background: var(--card); border: 1px solid var(--line); }

/* 気分：文字だけの選択肢。選んだものに丸 */
.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.pick { all: unset; display: flex; gap: 8px; align-items: center; padding: 9px 0; cursor: pointer; font-size: clamp(.82rem, 3.8vw, .95rem); min-height: 26px; }
.pick::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--sub); flex: none; }
.pick[aria-pressed="true"] { font-weight: 700; }
.pick[aria-pressed="true"]::before { background: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 2.5px var(--bg); }
.pick:focus-visible, .roast-strip button:focus-visible, .shape-picks button:focus-visible, .rx-back:focus-visible { outline: 3px solid var(--crema); outline-offset: 2px; border-radius: 4px; }

/* 焙煎度：色の濃さが順に並ぶ帯 */
.roast-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.roast-strip button { all: unset; cursor: pointer; text-align: center; font-size: clamp(.7rem, 3.2vw, .8rem); color: var(--sub); padding-bottom: 2px; white-space: nowrap; }
.roast-strip button::before { content: ""; display: block; height: 22px; margin-bottom: 6px; background: var(--c); border-radius: 3px; }
.roast-strip button[aria-pressed="true"] { color: var(--ink); font-weight: 700; }
.roast-strip button[aria-pressed="true"]::before { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ドリッパーの形：線画 */
.shape-picks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.shape-picks button { all: unset; cursor: pointer; text-align: center; font-size: .8rem; color: var(--sub); padding: 8px 0 6px; border-radius: 8px; }
.shape-picks svg { display: block; margin: 0 auto 4px; width: 44px; height: 34px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linejoin: round; }
.shape-picks button[aria-pressed="true"] { color: var(--ink); font-weight: 700; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); box-shadow: none; }
.stepper output { font-family: "Barlow Condensed", system-ui, sans-serif; font-size: 1.5rem; }

/* レシピの見出し */
.rx-head { padding: 8px 0 18px; }
.rx-back { all: unset; cursor: pointer; font-size: .88rem; color: var(--sub); margin-bottom: 2px; display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-underline-offset: 4px; }
.rx-bean { margin: 0; color: var(--sub); font-size: .92rem; }
.rx-bean b { color: var(--ink); font-size: 1.15rem; font-weight: 700; }
.rx-gear { margin: 2px 0 10px; color: var(--sub); font-size: .85rem; }
.rx-lead { margin: 6px 0 4px; font-size: 1.05rem; line-height: 2; font-weight: 500; }
.rx-lead .num { font-size: 2.3rem; line-height: 1; font-weight: 600; vertical-align: -3px; margin-right: 1px; }
.rx-lead .w { color: var(--water); }
.rx-ice { font-size: .9rem; color: var(--sub); margin-left: 4px; }
.rx-grind { margin: 0; font-size: .95rem; }
.rx-grind .num { font-size: 1.1rem; margin-left: 2px; }
.nowrap { white-space: nowrap; }
.dial { display: inline-flex; gap: 3px; vertical-align: middle; }
.dial i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--sub); }
.dial i.on { background: var(--ink); border-color: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rx-meta { margin: 6px 0 0; font-size: .85rem; color: var(--sub); }

/* 注ぎ方：上から時系列 */
.tl { list-style: none; margin: 8px 0 4px; padding: 0; }
.tl li { display: grid; grid-template-columns: 46px 1fr; column-gap: 10px; }
.tl time { font-size: 1.3rem; color: var(--sub); line-height: 1.5; text-align: right; }
.tl .c { position: relative; padding: 0 0 18px 20px; border-left: 2px solid var(--line); min-width: 0; }
.tl .c::before { content: ""; position: absolute; left: -7px; top: .6em; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--water); }
.tl li.end .c { border-left-color: transparent; padding-bottom: 0; }
.tl li.end .c::before { background: var(--water); }
.tl li.end .amt { font-weight: 700; }
.tl p { margin: 0; }
.tl .amt { font-size: 1rem; line-height: 1.5; }
.tl .amt .num { font-size: 1.6rem; font-weight: 600; margin-right: 2px; }
.tl .what { font-size: .82rem; color: var(--sub); margin-left: 8px; }
.tl .hint { margin: 0; line-height: 1.5; }
.tl .gauge { display: block; height: 4px; background: color-mix(in srgb, var(--sub) 18%, transparent); border-radius: 2px; margin-top: 6px; }
.tl .gauge i { display: block; height: 100%; background: var(--water-2); border-radius: 2px; }

/* タイマー：いまの注ぎを最優先 */
.timer { text-align: left; padding-top: 18px; }
.tm-label { margin: 0; font-size: 1.1rem; }
.tm-label b { font-size: 1.9rem; margin-left: 4px; }
.tm-row { display: grid; grid-template-columns: 1fr 74px; gap: 16px; align-items: end; margin-top: 2px; }
.tm-main { min-width: 0; }
.tm-target { margin: 0; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; min-height: 5.8rem; }
.tm-target .num { font-size: clamp(4.4rem, 26vw, 6.4rem); line-height: .9; font-weight: 600; color: var(--water); }
.tm-target .u { font-size: 1.25rem; font-weight: 700; }
.tm-target .tm-text { font-size: 1.6rem; font-weight: 700; line-height: 1.4; }
.tm-add { margin: 10px 0 0; font-size: 1rem; min-height: 1.6em; }
.tm-add .num { font-size: 1.4rem; font-weight: 600; }
.tm-col { position: relative; height: 180px; border: 2px solid var(--ink); border-top: 0; border-radius: 0 0 10px 10px; overflow: hidden; }
.tm-col-cur, .tm-col-prev { position: absolute; left: 0; right: 0; bottom: 0; transition: height .4s ease-out; }
.tm-col-cur { background: var(--water); }
.tm-col-prev { background: var(--water-2); }
.tm-col-level { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--crema); }
@media (prefers-reduced-motion: reduce) { .tm-col-cur, .tm-col-prev { transition: none; } }
.tm-next { margin-top: 22px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.tm-next p { margin: 0; }
.tm-next-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; }
.tm-next-left .num { font-size: 1.7rem; font-weight: 600; }
.tm-next-body { color: var(--sub); }
.tm-next-body .num { font-size: 1.25rem; color: var(--ink); font-weight: 600; }
.tm-bar { position: relative; height: 4px; background: var(--line); border-radius: 2px; margin: 26px 14px 8px; }
.tm-bar-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ink); border-radius: 2px; transition: width .2s linear; }
#tm-ticks b { position: absolute; top: -4px; width: 2px; height: 12px; margin-left: -1px; background: var(--ink); }
.tm-tick-labels { position: relative; height: 40px; margin: 0 14px; font-size: .72rem; color: var(--sub); }
.tm-tick-labels > span { position: absolute; transform: translateX(-50%); text-align: center; line-height: 1.3; white-space: nowrap; }
.tm-tick-labels > span.first { transform: translateX(-8px); text-align: left; }
.tm-tick-labels > span.last { transform: translateX(calc(-100% + 8px)); text-align: right; }
.tm-tick-labels .num { display: block; font-size: .95rem; }
.tm-tick-labels .cur { color: var(--ink); font-weight: 700; }
.tm-clock { display: flex; justify-content: space-between; font-size: .88rem; color: var(--sub); margin: 4px 0 0; }
.tm-clock .num { font-size: 1.3rem; color: var(--ink); font-weight: 600; }
/* 下のタブ：文字だけ。選んでいるタブに上の線 */
.tabbar { background: color-mix(in srgb, var(--bg) 94%, transparent); }
.tabbar button { font-size: .95rem; padding: 12px 6px; border-radius: 0; }
.tabbar button span { font-size: .95rem; }
.tabbar button[aria-current="page"] { color: var(--ink); background: none; box-shadow: inset 0 3px 0 var(--ink); }

/* チェキに入る範囲：写真の上に白い枠。枠の外は暗くする */
.crop { margin-top: 12px; }
.crop-stage { position: relative; overflow: hidden; border-radius: 8px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; background: #000; }
.crop-stage img { display: block; width: 100%; height: auto; max-height: none; pointer-events: none; }
.crop-frame { position: absolute; border: 3px solid #fff; border-radius: 2px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); pointer-events: none; }
.crop-size { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .88rem; color: var(--sub); }
.crop-size input { flex: 1 1 140px; min-width: 0; accent-color: var(--ink); min-height: 44px; }

/* チェキ用のカメラ */
.cam { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.cam[hidden] { display: none; }
.cam-stage { position: relative; overflow: hidden; border-radius: 8px; }
.cam-stage video { display: block; width: 100%; height: 100%; object-fit: cover; }
.cam-guide { position: absolute; border: 3px solid #fff; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); pointer-events: none; }
.cam-hint { margin: 0; font-size: .95rem; }
.cam-btns { display: grid; grid-template-columns: auto 1fr; gap: 10px; width: min(100%, 420px); }
.cam .btn-ghost { background: #333; color: #fff; border-color: #555; }
.cam .btn-primary { background: #fff; color: #111; border-color: #fff; }

/* ===== ui-ux-pro-max の見直し（2026-11） ===== */
/* 補足の小さい文字も 13px 以上に */
.field-label small, label small, legend small, summary small { font-size: .8125rem; }
.tm-tick-labels { font-size: .8125rem; height: 44px; }
/* 押している間は少し沈んで暗くなる（押せたことが分かるように） */
:is(.btn, .chip, .seg button, .pick, .roast-strip button, .shape-picks button, .stepper button, .icon-btn, .like-btn, .tabbar button, .rx-back, summary) {
  transition: transform .08s ease-out, filter .08s ease-out, background-color .12s ease-out;
  -webkit-tap-highlight-color: transparent;
}
:is(.btn, .chip, .seg button, .stepper button, .icon-btn, .like-btn, .shape-picks button):active:not(:disabled) { transform: translateY(1px) scale(.98); filter: brightness(.9); }
:is(.pick, .roast-strip button, .tabbar button, .rx-back, summary):active { filter: brightness(.85); }
@media (prefers-reduced-motion: reduce) {
  :is(.btn, .chip, .seg button, .stepper button, .icon-btn, .like-btn, .shape-picks button):active:not(:disabled) { transform: none; }
}
/* 線画のアイコン（絵文字の代わり）。文字のあるボタンでは読み上げない */
.ico { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -4px; }
.btn .ico, .seg button .ico { margin-right: 6px; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-content: center; }
.icon-btn .ico { margin: 0; }
.icon-btn.on .ico { fill: currentColor; }
summary .ico { width: 18px; height: 18px; }
/* チェキの枠をボタンでも動かす */
.crop-nudge { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.crop-nudge .btn { margin: 0; min-height: 48px; display: grid; place-content: center; padding: 0; }
.crop-nudge .ico { margin: 0; }
/* 「レシピをつくる」は画面の下（タブのすぐ上）にいつも出す */
.form-cta { position: sticky; bottom: calc(var(--tabbar-h, 64px) + 8px); z-index: 5; padding-top: 12px; margin-top: 4px;
  background: linear-gradient(to bottom, transparent, var(--bg) 14px); }
.form-cta .btn { margin-top: 0; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
body.typing .form-cta { position: static; background: none; }
.btn small { font-size: .8125rem; }
.chip { min-height: 44px; }
/* チェック欄は文字ごと押せるので、行の高さを 44px 以上に */
.check { min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
/* 開閉できる見出しには右端に矢印（開くと上向き） */
details.card > summary, .filters > summary { list-style: none; }
details.card > summary::-webkit-details-marker, .filters > summary::-webkit-details-marker { display: none; }
details.card > summary::after, .filters > summary::after {
  content: ""; margin-left: auto; margin-right: 6px; width: 9px; height: 9px; flex: none;
  border-right: 2px solid var(--sub); border-bottom: 2px solid var(--sub); transform: translateY(-2px) rotate(45deg); transition: transform .15s ease-out;
}
details[open].card > summary::after, details[open].filters > summary::after { transform: translateY(2px) rotate(-135deg); }
@media (prefers-reduced-motion: reduce) { details.card > summary::after, .filters > summary::after { transition: none; } }
/* シェアへの入口：レシピの右上・タイマーの下・感想のあと・きろくの各行 */
.rx-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.rx-top .rx-back { margin-bottom: 0; }
.btn-share-mini { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border: 1.5px solid var(--ink); background: var(--card); border-radius: 999px; font-size: .92rem; }
.btn-share-mini .ico { width: 18px; height: 18px; }
.btn-share { border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); padding: 10px 16px; }
.btn-share small, .btn-primary small { margin-top: 2px; }
/* ホーム画面に追加の案内 */
.install-hint { margin: 12px 0 4px; padding: 14px 16px; border: 1.5px solid var(--ink); border-radius: 10px; background: var(--card); }
.install-hint p { margin: 0; }
.install-title { font-weight: 700; }
.install-text { font-size: .9rem; color: var(--sub); margin-top: 4px !important; }
.install-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.install-btns .btn { margin: 0; }
.install-btns .btn-primary { flex: 1 1 auto; }
/* 豆の袋の読み取り：読み取り中・結果を太字の枠で目立たせる */
.scan-status:empty { display: none; }
.scan-status.busy, .scan-status.done, .scan-status.none {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 10px 0 4px; padding: 10px 12px;
  border: 1.5px solid var(--ink); border-radius: 10px; background: var(--card); color: var(--ink); font-size: .95rem;
}
.scan-status.none { border-style: dashed; }
.scan-status b { font-weight: 700; }
.scan-head { font-size: .8125rem; color: var(--sub); flex-basis: 100%; }
.scan-got { display: flex; flex-wrap: wrap; gap: 6px; }
.scan-got b { font-size: 1.05rem; padding: 2px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.scan-note { flex-basis: 100%; font-size: .8125rem; color: var(--sub); }
.spinner { width: 16px; height: 16px; border: 2.5px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; border-top-color: var(--line); border-right-color: var(--ink); } }
.scan-status.busy { flex-wrap: nowrap; align-items: flex-start; }
.scan-status.busy .spinner { margin-top: 3px; }
.scan-status.busy b { flex: 1 1 0; min-width: 0; }

/* ---------- 豆を探す（shop.html） ---------- */
.shop-page { padding-bottom: calc(24px + env(safe-area-inset-bottom)); } /* 下のタブがないページ */
.shop-back { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 0; }
.shop-back .ico { margin-right: 4px; }
.shop-notice, .shop-sample { margin: 8px 0; }
.shop-sample { border: 1px dashed var(--sub); }
.shop-item { display: grid; gap: 2px; }
.shop-name { font-size: 1.05rem; }
.shop-roaster { font-size: .85rem; color: var(--sub); }
.shop-meta { margin: 4px 0 0; font-size: .9rem; }
.shop-price { font-size: 1.15rem; }
.shop-offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); /* 狭い画面では1列にして、文言が途中で折り返さないように */ gap: 8px; margin-top: 10px; }
.shop-offers .btn { text-align: center; text-decoration: none; }
#shop-filter button { white-space: nowrap; padding-inline: 4px; font-size: .85rem; min-height: 44px; }
/* Shopify の部品（Storefront Web Components）。カートの見た目は ::part で合わせる */
.shopify-offer { grid-column: 1 / -1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.shopify-price { margin: 0 0 6px; font-weight: 700; }
.shopify-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.shopify-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-size: .85rem; color: var(--sub); }
.shopify-link .ico { width: 16px; height: 16px; }
.shop-cart-btn { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 5; display: inline-flex; align-items: center; box-shadow: 0 2px 8px rgba(43, 26, 16, .25); }
body:has(.shop-cart-btn:not([hidden])) main { padding-bottom: 88px; } /* 右下のカートのボタンで一覧の最後が隠れないように */
.cart-title { font-size: 1.3rem; font-weight: 700; }
shopify-cart::part(dialog) { border-radius: var(--radius); max-width: min(480px, calc(100vw - 32px)); background: var(--card); color: var(--ink); }
shopify-cart::part(primary-button) { background: var(--accent); color: var(--accent-ink); border-radius: var(--radius); font-weight: 700; }
/* ---------- 器具を探す（gear.html） ---------- */
#gear-tabs button { white-space: nowrap; padding-inline: 4px; font-size: .85rem; min-height: 44px; }
.gear-cat-title { margin: 12px 0 4px; font-size: 1rem; }
.gear-cat-text { margin: 0 0 12px; font-size: .9rem; line-height: 1.7; color: var(--sub); }
.gear-item { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: start; position: relative; margin-bottom: 10px; }
.gear-item.gear-noimg { grid-template-columns: 1fr; }
.gear-item img.gear-img { width: 120px; height: 120px; object-fit: contain; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.gear-body { display: grid; gap: 4px; min-width: 0; }
.gear-name { font-size: 1.05rem; overflow-wrap: anywhere; }
.gear-comment { margin: 0; font-size: .9rem; color: var(--sub); overflow-wrap: anywhere; }
.gear-selected { display: inline-block; justify-self: start; padding: 1px 8px; border: 1px solid var(--ink); border-radius: 999px; font-size: .75rem; font-weight: 700; color: var(--ink); }
.gear-assoc { font-size: .75rem; }
.gear-pr-mark { font-size: .7rem; color: var(--sub); text-align: center; }
.gear-offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 6px; }
.gear-offers .btn { text-align: center; text-decoration: none; }
.gear-offer { display: grid; gap: 2px; }
.gear-imp { position: absolute; width: 1px; height: 1px; opacity: 0; }
/* 狭い幅では6つのタブを3列×2段に折り返し、文字が切れないようにする */
@media (max-width: 480px) { #gear-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; } }
@media (max-width: 360px) { .gear-item { grid-template-columns: 1fr; } .gear-item img.gear-img { justify-self: center; } }
/* きろく・感想のあとの「似た豆を探す」「次の豆を探す」 */
.hist-shop { grid-column: 1 / -1; justify-self: start; display: inline-flex; align-items: center; min-height: 44px; padding: 4px 0; font-size: .88rem; }
.hist-shop .ico { width: 18px; height: 18px; margin-right: 4px; }
/* 入力・レシピ・評価の各画面の「豆を探す」 */
.shop-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; grid-column: 1 / -1; }
.shop-row > :only-child { grid-column: 1 / -1; } /* 豆と器具のどちらか片方だけのときは横いっぱいに */
.shop-entry { padding-inline: 8px; }
.shop-entry .ttl { white-space: nowrap; } /* 「豆を探す（予定）」は1行に収める */
.shop-entry .plan { font-size: .85em; }
@media (max-width: 400px) { .shop-entry .ico { display: none; } } /* スマホ幅ではアイコンを省いて、2つとも文言を1行に */
.shop-entry small { white-space: nowrap; }
@media (max-width: 340px) { .shop-entry { font-size: .85rem; padding-inline: 4px; } }
#form-shop { margin: 20px 0 4px; }
#fb-shop { margin-top: 16px; }

/* 紹介ページ（about/）。初めて来た人向け。アプリの色・ボタンをそのまま使う。
   .doc は使わない（.doc a が色を親に合わせるので、古い CSS が残った端末で「アプリをひらく」の文字が背景と同じ色になる） */
.lp p, .lp li { overflow-wrap: anywhere; }
.lp a:not(.btn) { color: inherit; text-underline-offset: 3px; }
.lp-hero { text-align: center; padding: 28px 0 8px; }
.lp .lp-catch { font-size: 1.6rem; font-weight: 700; line-height: 1.45; letter-spacing: .04em; margin: 0 0 10px; }
.lp-lead { color: var(--sub); margin: 0 0 18px; }
.lp-cta { display: block; max-width: 320px; margin: 0 auto; text-decoration: none; text-align: center; }
.lp a.lp-cta { color: var(--accent-ink); }
.lp-note { color: var(--sub); font-size: .85rem; margin: 10px 0 0; }
.lp-section { margin-top: 36px; }
.lp-points { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.lp .lp-points { padding-left: 0; }
.lp-point { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.lp li.lp-point + li.lp-point { margin-top: 0; }
.lp-point strong, .lp-steps strong { display: block; }
.lp-point span, .lp-steps span { display: block; color: var(--sub); font-size: .9rem; }
.lp .lp-steps { list-style: none; counter-reset: lp-step; padding-left: 0; margin-top: 12px; }
.lp-steps li { counter-increment: lp-step; position: relative; padding: 0 0 0 44px; min-height: 32px; }
.lp .lp-steps li + li { margin-top: 16px; }
.lp-steps li::before {
  content: counter(lp-step); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; display: grid; place-items: center; font-size: .95rem;
}
.lp-story { background: var(--card); border-radius: var(--radius); padding: 4px 18px 12px; border-left: 4px solid var(--crema); }
.lp-faq { margin-top: 12px; border-top: 1px solid var(--line); }
.lp-faq details { border-bottom: 1px solid var(--line); }
.lp-faq summary { cursor: pointer; padding: 14px 28px 14px 0; font-weight: 600; position: relative; list-style: none; min-height: 44px; }
.lp-faq summary::-webkit-details-marker { display: none; }
.lp-faq summary:focus-visible { outline: 3px solid var(--crema); outline-offset: 2px; border-radius: 4px; } /* 既定の三角を消したので、キーボードで選んだ位置を見えるように */
.lp-faq summary::after { content: "＋"; position: absolute; right: 4px; top: 14px; color: var(--sub); }
.lp-faq details[open] summary::after { content: "−"; }
.lp-faq details p { margin: 0 0 14px; color: var(--ink); }
.lp-end { margin-top: 40px; }
@media (max-width: 340px) { .lp .lp-catch { font-size: 1.3rem; } }
