/* 写真が主役のレシピ集の形。背景は白、色は前掛けの藍だけ。ピカピカの厨房に合わせて、灰色は少し青みのある明るい色。見出しは明朝、本文はゴシック。
   一覧は写真の格子、作り方は写真つきの画面で開く。教科書は扉の写真と、左に固定の目次。 */
:root {
  --bg: #FFFFFF;
  --ink: #22262B;
  --sub: #5F6770;
  --line: #E6E9ED;
  --soft: #F5F7F9;
  --ai: #233F6E;          /* 前掛けの藍 */
  --ai-ink: #FFFFFF;
  --ai-soft: #EDF2F9;
  --overlay: rgba(20, 20, 20, .5);
  --shade: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .08);
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic Medium", "Yu Gothic", "Meiryo", sans-serif;
  --mincho: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  --top-h: 56px;
  --measure: 38em;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141414; --ink: #EBEAE6; --sub: #A9A8A2; --line: #2E2D2A; --soft: #1D1D1B;
    --ai: #A9C1EA; --ai-ink: #141414; --ai-soft: #1E2735; --overlay: rgba(0, 0, 0, .66);
    --shade: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141414; --ink: #EBEAE6; --sub: #A9A8A2; --line: #2E2D2A; --soft: #1D1D1B;
  --ai: #A9C1EA; --ai-ink: #141414; --ai-soft: #1E2735; --overlay: rgba(0, 0, 0, .66);
  --shade: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 1rem; line-height: 1.75; letter-spacing: .02em;
  text-autospace: normal; text-spacing-trim: trim-start;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ai); text-underline-offset: .2em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ai); outline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.4; letter-spacing: .02em; text-wrap: balance; word-break: auto-phrase; margin: 0; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ai); color: var(--ai-ink); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.ic { width: 1em; height: 1em; flex: none; }
.wrap { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 16px; }

/* ---------- 写真 ---------- */
.ph { display: block; background: var(--soft); aspect-ratio: 4 / 3; width: 100%; }

/* ---------- 読んだ量 ---------- */
.progress { position: fixed; inset: env(safe-area-inset-top, 0px) 0 auto 0; height: 2px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; background: var(--ai); transform-origin: 0 50%; transform: scaleX(0); }
@supports (animation-timeline: scroll()) {
  .progress span { animation: grow linear both; animation-timeline: scroll(root); }
  @keyframes grow { to { transform: scaleX(1); } }
}

/* ---------- 上の帯 ---------- */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  display: flex; align-items: center; gap: 12px; height: var(--top-h); padding-inline: 16px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--mincho); font-weight: 800; font-size: 1.0625rem; color: var(--ink); text-decoration: none; letter-spacing: .06em; white-space: nowrap; margin-right: auto; }
.top-nav { display: none; gap: 4px; }
.top-nav a { color: var(--ink); text-decoration: none; padding: 8px 12px; font-weight: 500; font-size: .9375rem; }
.top-nav a:hover { color: var(--ai); }
.top-search { display: none; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 6px; background: var(--soft); color: var(--sub); width: 280px; }
.top-search input { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: .9375rem; width: 100%; outline: none; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; background: transparent; color: var(--ink); cursor: pointer; border-radius: 6px; font-size: 1.125rem; }
.icon-btn:hover { background: var(--soft); }

/* ---------- 表紙 ---------- */
.hero { margin-bottom: 48px; }
.hero-photo { margin: 0; }
.hero-img, .hero .ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.hero-text { padding-top: 24px; }
.hero h1 { font-family: var(--mincho); font-weight: 800; font-size: clamp(2.125rem, 7vw, 3.5rem); letter-spacing: .08em; line-height: 1.25; }
.hero-lead { margin-top: 16px; max-width: 34em; font-size: 1.0625rem; line-height: 1.85; color: var(--ink); }

/* ---------- 見出し ---------- */
.sec-h { font-family: var(--mincho); font-weight: 800; font-size: 1.5rem; letter-spacing: .06em; }
.sec-sub { margin-top: 6px; color: var(--sub); font-size: .9375rem; }
.sec-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 16px; }

/* ---------- 食材のタイル ---------- */
.quick { margin-bottom: 64px; }
.quick .sec-h { margin-bottom: 16px; }
.ings { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 10px; }
.ing { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.ing-photo { display: block; border-radius: 6px; overflow: hidden; background: var(--soft); }
.ing-img, .ing .ph { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; transition: transform .3s ease; }
.ing:hover .ing-img { transform: scale(1.04); }
.ing-name { display: block; margin-top: 6px; font-weight: 700; font-size: .9375rem; }
.ing-n { display: block; color: var(--sub); font-size: .75rem; }
.quick-more { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 20px; }
.link-btn { border: 0; background: none; padding: 8px 0; min-height: 44px; color: var(--ai); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: .25em; text-decoration-thickness: 1px; }

/* ---------- 教科書の目次（扉の写真つき） ---------- */
.book-index { margin-bottom: 56px; }
.chcards { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.chc { display: grid; grid-template-columns: 120px minmax(0, 1fr); column-gap: 14px; align-items: start; color: var(--ink); text-decoration: none; }
.chc-photo { grid-row: 1 / 4; border-radius: 6px; overflow: hidden; background: var(--soft); }
.chc-img, .chc .ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .3s ease; }
.chc:hover .chc-img { transform: scale(1.04); }
.chc-num { color: var(--ai); font-weight: 700; font-size: .75rem; letter-spacing: .1em; }
.chc-title { font-family: var(--mincho); font-weight: 800; font-size: 1.1875rem; line-height: 1.4; }
.chc:hover .chc-title { color: var(--ai); }
.chc-lead { margin-top: 4px; color: var(--sub); font-size: .8125rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.about { margin-top: 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.about > summary { cursor: pointer; padding: 14px 0; min-height: 44px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; }
.about > summary::after { content: "＋"; color: var(--sub); }
.about[open] > summary::after { content: "－"; }
.about-grid { display: grid; gap: 8px 40px; padding-bottom: 20px; font-size: .9375rem; }
.about-grid h3 { font-size: 1rem; margin: 12px 0 6px; }
.about-grid ul { padding-left: 1.2em; margin: 0; }

/* ---------- 読む（左に目次） ---------- */
.reading { display: grid; grid-template-columns: minmax(0, 1fr); }
.toc { display: none; }
.toc-h { font-size: .75rem; font-weight: 700; letter-spacing: .14em; color: var(--sub); margin: 0 0 8px; }
.toc-list { list-style: none; margin: 0 0 16px; padding: 0; }
.toc-ch > a { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; min-height: 36px; color: var(--ink); text-decoration: none; font-size: .9375rem; }
.toc-ch > a:hover { color: var(--ai); }
.toc-n { width: 1.2em; flex: none; color: var(--sub); font-weight: 700; font-variant-numeric: tabular-nums; }
.toc-ch.is-current > a { color: var(--ai); font-weight: 700; }
.toc-ch.is-current .toc-n { color: var(--ai); }
.toc-sub { list-style: none; margin: 0 0 8px; padding: 0 0 0 1.6em; display: none; border-left: 1px solid var(--line); margin-left: .45em; }
.toc-ch.is-current .toc-sub { display: block; }
.toc-sub a { display: block; padding: 5px 0 5px 12px; color: var(--sub); text-decoration: none; font-size: .8125rem; line-height: 1.5; position: relative; }
.toc-sub a:hover { color: var(--ink); }
.toc-sub a.is-active { color: var(--ai); font-weight: 700; }
.toc-sub a.is-active::before { content: ""; position: absolute; left: -1px; top: 6px; bottom: 6px; width: 2px; background: var(--ai); }

.chapter { padding-bottom: 56px; margin-bottom: 56px; border-bottom: 1px solid var(--line); }
.ch-photo { margin: 0 0 24px; border-radius: 6px; overflow: hidden; background: var(--soft); }
.ch-img, .ch-photo .ph { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.ch-head { max-width: var(--measure); margin-bottom: 32px; }
.ch-num { color: var(--ai); font-weight: 700; letter-spacing: .14em; font-size: .8125rem; }
.ch-title { font-family: var(--mincho); font-weight: 800; font-size: 2rem; letter-spacing: .06em; margin-top: 4px; }
.ch-lead { margin-top: 16px; font-size: 1.0625rem; line-height: 1.85; font-weight: 500; }

.prose { max-width: var(--measure); }
.prose p { margin-bottom: 1.2em; }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.prose li::marker { color: var(--sub); }
.prose strong { font-weight: 700; background: linear-gradient(transparent 62%, var(--ai-soft) 62%); }
.prose h4 { font-size: 1.0625rem; margin: 28px 0 10px; }
.pr { display: flex; gap: 12px; align-items: flex-start; margin: 48px 0 16px; font-family: var(--mincho); font-weight: 800; font-size: 1.375rem; scroll-margin-top: calc(var(--top-h) + 20px); }
.pr-n { flex: none; min-width: 1.75em; height: 1.75em; padding: 0 .4em; margin-top: .05em; border-radius: 1em; background: var(--ai); color: var(--ai-ink); font-family: var(--sans); font-size: .8em; font-weight: 700; display: grid; place-items: center; letter-spacing: 0; }
.pr-t { min-width: 0; }
.why { margin: 4px 0 1.4em; padding: 16px 18px 2px; background: var(--soft); border-radius: 6px; }
.why-h { font-weight: 700; font-size: .875rem; color: var(--ai); margin-bottom: 6px !important; letter-spacing: .06em; }
.uses { margin: 8px 0 1.4em; }
.uses-h { font-size: .8125rem; font-weight: 700; color: var(--sub); letter-spacing: .06em; margin-bottom: 8px !important; }
.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.mini { display: flex; gap: 12px; align-items: center; min-height: 64px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); text-decoration: none; background: var(--bg); }
.mini:hover { border-color: var(--ai); }
.mini-img, .mini .ph { width: 72px; height: 54px; aspect-ratio: auto; object-fit: cover; border-radius: 4px; flex: none; }
.mini-txt { display: flex; flex-direction: column; min-width: 0; }
.mini-kind { font-size: .6875rem; color: var(--sub); font-weight: 700; letter-spacing: .08em; }
.mini-tip .mini-kind { color: var(--ai); }
.mini-name { font-weight: 700; font-size: .875rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-sub { font-size: .75rem; color: var(--sub); }
.inref { font-weight: 500; }
.source { font-size: .8125rem; color: var(--sub); margin-top: 8px; overflow-wrap: anywhere; }
.source a, .src-link { color: var(--sub); }
.guess, .note { display: inline-block; margin: 0 .2em; padding: 0 .45em; border: 1px solid var(--line); border-radius: 3px; color: var(--sub); font-size: .72em; line-height: 1.6; vertical-align: .1em; letter-spacing: 0; font-weight: 400; background: none; }
.repo { color: var(--sub); }
code { font-size: .9em; background: var(--soft); padding: 0 .3em; border-radius: 3px; }
.summary { margin-top: 40px; padding: 20px 0 4px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); }
.summary .pr { margin-top: 0; font-size: 1.125rem; }
.summary .pr-n { display: none; }
.table-wrap { overflow-x: auto; margin: 0 0 1.4em; border-top: 2px solid var(--ink); }
table { border-collapse: collapse; width: 100%; font-size: .875rem; line-height: 1.6; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
th { font-weight: 700; white-space: nowrap; color: var(--sub); font-size: .8125rem; }
.prose .table-wrap { max-width: none; }
.pager { display: grid; gap: 10px; max-width: var(--measure); margin-top: 40px; }
.pg { display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--ink); }
.pg:hover { border-color: var(--ai); }
.pg-l { font-size: .75rem; color: var(--sub); }
.pg-t { font-weight: 700; color: var(--ai); }
.pg-next { text-align: right; }

/* ---------- まかないの一覧 ---------- */
.cards-sec, .tips-sec { padding-top: 16px; margin-bottom: 72px; }
.finder { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
.filters { display: none; }
.filters.open { display: block; position: fixed; inset: 0; z-index: 80; background: var(--bg); overflow-y: auto; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
.filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.filters-head p { font-weight: 700; }
.fgroup { padding: 12px 0; border-bottom: 1px solid var(--line); }
.fgroup-h { font-weight: 700; font-size: .8125rem; color: var(--sub); letter-spacing: .08em; margin-bottom: 4px !important; }
.chk { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; font-size: .9375rem; }
.chk input { width: 18px; height: 18px; margin: 0; accent-color: var(--ai); flex: none; }
.chk-l { flex: 1; }
.chk-n { color: var(--sub); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.filters-foot { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--bg); border-top: 1px solid var(--line); }
.filters:not(.open) .filters-foot { position: static; padding: 12px 0 0; border: 0; }
.done-btn { min-height: 44px; padding: 0 20px; border: 0; border-radius: 6px; background: var(--ai); color: var(--ai-ink); font-weight: 700; cursor: pointer; }
.bar { display: flex; gap: 10px; align-items: center; }
.search { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; color: var(--sub); background: var(--bg); }
.search:focus-within { border-color: var(--ai); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1rem; outline: none; padding: 10px 0; }
.filter-open { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); cursor: pointer; font-weight: 700; white-space: nowrap; }
.applied { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 14px 0 18px; min-height: 32px; }
.count { font-weight: 700; font-variant-numeric: tabular-nums; }
.applied-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.atag { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 0; border-radius: 3px; background: var(--ai-soft); color: var(--ai); font-size: .8125rem; font-weight: 700; cursor: pointer; }
.grid, .tgrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
.tile a, .ttile a { display: block; color: var(--ink); text-decoration: none; }
.tile-photo { display: block; border-radius: 6px; overflow: hidden; background: var(--soft); }
.tile-img, .tile-photo .ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .35s ease; }
.tile a:hover .tile-img, .ttile a:hover .tile-img { transform: scale(1.04); }
.tile-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 8px; font-weight: 700; font-size: 1rem; line-height: 1.45; }
.tile a:hover .tile-name, .ttile a:hover .tile-name { color: var(--ai); }
.meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; color: var(--sub); font-size: .8125rem; }
.m { display: inline-flex; align-items: center; gap: 4px; }
.meta-big { font-size: .9375rem; gap: 6px 18px; margin-top: 12px; color: var(--ink); }
.meta-big .ic { color: var(--ai); }
.tile-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; color: var(--sub); font-size: .8125rem; line-height: 1.55; }
.tips-sec .bar { margin-bottom: 20px; }
.tips-sec .bar .count { white-space: nowrap; }
.empty { padding: 32px 0; color: var(--sub); }

/* ---------- 技術（やり方の記事） ---------- */
.gijutsu-sec { padding-top: 16px; margin-bottom: 72px; }
.gchips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.gchip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--bg); color: var(--ink); font: inherit; font-size: .9375rem; cursor: pointer; }
.gchip[aria-pressed="true"] { background: var(--ai); border-color: var(--ai); color: var(--ai-ink); }
.gchip-n { font-size: .8125rem; opacity: .75; }
.tile-kicker { display: block; margin-top: 10px; font-size: .75rem; font-weight: 700; color: var(--ai); }
.gtile .tile-kicker + .tile-name { margin-top: 2px; }
.g-lead { margin: 16px 0 4px; padding: 14px 16px; border-radius: 8px; background: var(--ai-soft); }
.g-lead ul { margin: 0; padding-left: 1.2em; }
.g-lead p:last-child, .g-lead li:last-child { margin-bottom: 0; }
.g-safe { border: 1px solid #E8B4A8; border-radius: 8px; padding: 4px 16px 12px; background: #FDF4F1; }
.d-sec.g-safe h3 { color: #A33A22; border-bottom: 0; }
:root[data-theme="dark"] .g-safe { border-color: #6B3326; background: #2A1915; }
:root[data-theme="dark"] .d-sec.g-safe h3 { color: #F0A592; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .g-safe { border-color: #6B3326; background: #2A1915; }
  :root:not([data-theme="light"]) .d-sec.g-safe h3 { color: #F0A592; }
}
/* ---------- 作り方の画面 ---------- */
.modal { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; background: var(--bg); color: var(--ink); overflow-y: auto; overscroll-behavior: contain; }
.modal::backdrop { background: var(--overlay); }
.modal-close { position: sticky; top: calc(8px + env(safe-area-inset-top, 0px)); float: right; margin: 8px 8px -52px 0; z-index: 2; background: var(--bg); box-shadow: var(--shade); border-radius: 50%; }
.detail { padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
.d-photo { background: var(--soft); }
.d-img, .d-photo .ph { width: 100%; aspect-ratio: 4 / 3; max-height: 56vh; object-fit: cover; }
.d-body { padding: 20px 16px 0; max-width: 760px; margin-inline: auto; }
.d-kicker { color: var(--sub); font-size: .8125rem; font-weight: 700; letter-spacing: .06em; }
.d-title { font-family: var(--mincho); font-weight: 800; font-size: 1.75rem; margin-top: 4px; letter-spacing: .04em; }
.d-lead { margin-top: 12px; font-weight: 700; }
.facts { margin: 18px 0 8px; display: grid; gap: 8px; font-size: .875rem; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fact { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 12px; }
.fact dt { color: var(--sub); font-weight: 700; }
.fact dd { margin: 0; overflow-wrap: anywhere; }
.d-sec { margin-top: 28px; }
.d-sec h3, .d-prose h2 { font-size: 1.0625rem; font-weight: 700; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.d-sec ul, .d-prose ul { padding-left: 1.3em; margin: 0; }
.d-sec li, .d-prose li { margin-bottom: .5em; }
.d-sec li::marker, .d-prose li::marker { color: var(--sub); }
.d-prose { margin-top: 8px; }
.d-prose h2 { margin-top: 28px; }
.d-prose h3 { font-size: 1rem; margin: 20px 0 8px; }
.d-prose p { margin-bottom: 1em; }
ol.steps { list-style: none; padding: 0; margin: 0; counter-reset: st; }
ol.steps > li { counter-increment: st; position: relative; padding-left: 2.4em; margin-bottom: .9em; }
ol.steps > li::before { content: counter(st); position: absolute; left: 0; top: .2em; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--ai-soft); color: var(--ai); font-size: .8125rem; font-weight: 700; display: grid; place-items: center; line-height: 1; }
/* 丸の中の数字を、字の高さ（上端〜下端）で上下中央にそろえる。フォントの余白に左右されない */
@supports (text-box: trim-both cap alphabetic) {
  .pr-n, ol.steps > li::before { display: block; height: auto; line-height: 1; text-align: center; text-box: trim-both cap alphabetic; }
  .pr-n { padding: calc((1.75em - 1cap) / 2) .4em; }
  ol.steps > li::before { padding-block: calc((1.6em - 1cap) / 2); }
}
.d-more { margin-top: 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.d-more > summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; list-style: none; }
.d-more > summary::after { content: "＋"; color: var(--sub); }
.d-more[open] > summary::after { content: "－"; }
.d-more ul { padding-left: 1.2em; font-size: .875rem; color: var(--ink); }
.d-more li { margin-bottom: .6em; }
.tag { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 3px; font-size: .875rem; }
.detail .minis { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ---------- 出典・足もと ---------- */
.notes { margin-bottom: 40px; padding-top: 32px; border-top: 2px solid var(--ink); }
.notes-grid { display: grid; gap: 24px 48px; margin-top: 16px; font-size: .9375rem; }
.notes h3 { font-size: 1rem; margin-bottom: 8px; }
.notes p { margin-bottom: .9em; }
.notes ul { padding-left: 1.2em; margin: 0 0 .9em; }
.foot { padding-block: 24px 120px; color: var(--sub); font-size: .8125rem; border-top: 1px solid var(--line); }

/* ---------- スマホの目次ボタン・シート ---------- */
.toc-fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border: 0; border-radius: 24px; background: var(--ai); color: var(--ai-ink); font-weight: 700; cursor: pointer; box-shadow: var(--shade);
}
.toc-fab.is-away { visibility: hidden; opacity: 0; transform: translateY(12px); pointer-events: none; }
.toc-fab { transition: opacity .2s ease, transform .2s ease, visibility .2s; }
.to-top { position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 40; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 22px; background: var(--bg); color: var(--ink); text-decoration: none; font-weight: 700; font-size: .875rem; box-shadow: var(--shade); }
.sheet { width: 100%; max-width: 100%; max-height: 84vh; margin: auto 0 0; padding: 0; border: 0; border-radius: 14px 14px 0 0; background: var(--bg); color: var(--ink); }
.sheet::backdrop { background: var(--overlay); }
.sheet-in { padding: 0 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.sheet-bar { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; background: var(--bg); border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.sheet-top { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; text-decoration: none; color: var(--ink); }
.toc-sheet { display: block; }
.toc-sheet .toc-ch > a { min-height: 44px; font-size: 1rem; }
.toc-sheet .toc-sub a { padding-block: 9px; font-size: .875rem; }

/* ---------- 広い画面 ---------- */
@media (min-width: 640px) {
  .wrap { padding-inline: 24px; }
  .ings { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .chcards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 20px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 18px; }
  .tgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 18px; }
  .hero-img, .hero .ph { aspect-ratio: 21 / 9; max-height: 560px; }
  .about-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pager { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal { width: min(920px, calc(100% - 48px)); height: auto; max-height: calc(100vh - 48px); margin: auto; border-radius: 8px; }
  .d-body { padding: 28px 40px 0; }
  .d-title { font-size: 2rem; }
}
@media (min-width: 1024px) {
  body { font-size: 1.0625rem; line-height: 1.85; }
  .top { padding-inline: 32px; gap: 20px; }
  .brand { margin-right: 8px; font-size: 1.125rem; }
  .top-nav { display: flex; margin-right: auto; }
  .top-search { display: flex; }
  .wrap { padding-inline: 32px; }
  .hero-text { padding-top: 36px; }
  .sec-h { font-size: 1.75rem; }
  .ings { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 20px 14px; }
  .chcards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chc { grid-template-columns: minmax(0, 1fr); row-gap: 2px; }
  .chc-photo { grid-row: auto; margin-bottom: 10px; }
  .reading { grid-template-columns: 220px minmax(0, 1fr); column-gap: 64px; }
  .toc { display: block; position: sticky; top: calc(var(--top-h) + 24px); align-self: start; max-height: calc(100vh - var(--top-h) - 48px); overflow-y: auto; padding-right: 8px; overscroll-behavior: contain; }
  .chapters { min-width: 0; }
  .ch-title { font-size: 2.375rem; }
  .pr { font-size: 1.5rem; }
  .finder { grid-template-columns: 220px minmax(0, 1fr); }
  .filters { display: block; position: sticky; top: calc(var(--top-h) + 16px); align-self: start; max-height: calc(100vh - var(--top-h) - 32px); overflow-y: auto; }
  .filters-head, .filter-open, .done-btn { display: none; }
  .filters-foot { position: static; padding: 12px 0 0; border: 0; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .toc-fab { display: none; }
  .to-top { right: 32px; bottom: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .progress span { animation: none; }
  * { transition: none !important; }
}
@media print {
  .top, .toc, .toc-fab, .to-top, .progress, .filters, .bar, .applied, .quick, .pager, .modal, .sheet { display: none !important; }
  .reading { display: block; }
  body { font-size: 10.5pt; }
  .chapter { break-before: page; }
}
