/*
 * マチベース トップページ（リニューアル案）
 * 本番移植先の想定：assets/css/top-v2.css（.mbt 配下にスコープ）
 * 色・書体・ボタンは area-archive.css（.mba）/ mypage.css（.mbmp）と同じトークン。
 * 赤（--mbt-hanko）は「完成」印だけに使う。
 */

:root {
  --mbt-bg: #f5f7fa;
  --mbt-paper: #fff;
  --mbt-ink: #1c395d;
  --mbt-ink2: #3c536f;
  --mbt-muted: #5b6b80;
  --mbt-line: #dce4ed;
  --mbt-pale: #eaf0f7;
  --mbt-pale2: #f4f7fb;
  --mbt-blue: #2a578e;
  --mbt-blue-d: #20446e;
  --mbt-kinari: #faf1e8;
  --mbt-hanko: #c4532e;
  --mbt-r: 12px;
  --mbt-gut: 24px;
  --mbt-max: 1200px;
  --mbt-head-h: 64px;
  --mbt-font: 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, sans-serif;
}
@media (max-width: 639px) { :root { --mbt-gut: 16px; --mbt-head-h: 56px; } }

/* ---------- 基本 ---------- */
.mbt, .mbt *, .mbt *::before, .mbt *::after { box-sizing: border-box; }
.mbt [hidden], .mbt-dialog[hidden], .mbt-dialog [hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--mbt-head-h) + 12px); -webkit-text-size-adjust: 100%; }
.mbt-v2-site { margin: 0; background: var(--mbt-bg); color: var(--mbt-ink); font-family: var(--mbt-font); font-weight: 400; font-size: 16px; line-height: 1.7; overflow-x: clip; }
.mbt img { display: block; max-width: 100%; }
.mbt a { color: inherit; }
.mbt button, .mbt input, .mbt select { font: inherit; color: inherit; }
.mbt ul, .mbt ol { margin: 0; padding: 0; list-style: none; }
.mbt h1, .mbt h2, .mbt h3, .mbt p { margin: 0; }
.mbt svg { flex: none; }
:focus-visible { outline: 3px solid var(--mbt-blue); outline-offset: 3px; border-radius: 6px; }
.mbt-vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mbt-ico { width: 1.1em; height: 1.1em; vertical-align: -.18em; }
.mbt-skip { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--mbt-blue); color: #fff; border-radius: 8px; }
.mbt-skip:focus { top: 8px; }
.mbt-only-narrow { display: none; }
@media (max-width: 639px) { .mbt-only-narrow { display: inline; } .mbt-only-wide { display: none; } }

/* ログイン状態で出し分け（本番では PHP の is_user_logged_in で出し分け）
   out=未ログイン / guest=未ログインだがこのブラウザで作成済み / in・in0=ログイン中 */
body[data-login="out"] .mbt-only-member, body[data-login="guest"] .mbt-only-member { display: none !important; }
body[data-login="in"] .mbt-only-out, body[data-login="in0"] .mbt-only-out { display: none !important; }
html { scroll-behavior: smooth; }

.mbt-wrap { width: 100%; max-width: calc(var(--mbt-max) + var(--mbt-gut) * 2); margin: 0 auto; padding: 0 var(--mbt-gut); }
.mbt-sec { padding: 72px 0; }
.mbt-sec--pale { background: var(--mbt-paper); }
@media (max-width: 639px) { .mbt-sec { padding: 44px 0; } }

/* ---------- 見出し・ボタン（.mba と同じ） ---------- */
.mbt-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 28px; }
.mbt-eyebrow { margin: 0 0 6px; font-size: .8125rem; font-weight: 500; letter-spacing: .08em; color: var(--mbt-blue); }
.mbt-h2 { font-size: 1.75rem; line-height: 1.45; font-weight: 700; letter-spacing: .03em; }
.mbt-h3 { font-size: 1rem; font-weight: 500; margin-bottom: 12px; }
.mbt-head__note { margin-top: 6px; font-size: .875rem; color: var(--mbt-muted); line-height: 1.6; }
@media (max-width: 639px) { .mbt-h2 { font-size: 1.375rem; } .mbt-head { margin-bottom: 18px; } }

.mbt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 26px; border-radius: 10px; font-size: 1rem; font-weight: 700; letter-spacing: .04em; text-decoration: none; border: 1.5px solid transparent; cursor: pointer; transition: background-color .15s, color .15s, transform .15s; white-space: nowrap; }
.mbt-btn svg { width: 1.2rem; height: 1.2rem; }
.mbt-btn--primary { background: var(--mbt-blue); color: #fff; }
.mbt-btn--primary:hover { background: var(--mbt-blue-d); }
.mbt-btn--line { background: var(--mbt-paper); color: var(--mbt-blue); border-color: var(--mbt-blue); }
.mbt-btn--line:hover { background: var(--mbt-pale2); }
.mbt-btn--sm { min-height: 44px; padding: 0 18px; font-size: .9375rem; }
.mbt-btn:active { transform: translateY(1px); }

.mbt-textlink { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--mbt-blue); font-size: .9375rem; font-weight: 500; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.mbt-textlink:hover { text-decoration-thickness: 2px; }
.mbt-textlink svg { width: 1.1em; height: 1.1em; flex: none; }

/* ---------- ① 表紙 ---------- */
.mbt-hero { position: relative; background: var(--mbt-paper); }
.mbt-hero__photo { position: relative; height: clamp(600px, 48vw, 700px); background: #cfd9e4; overflow: hidden; }
.mbt-hero__slide { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity 1.2s ease; }
.mbt-hero__slide.is-on { opacity: 1; }
.mbt-hero__slide img { width: 100%; height: 100%; object-fit: cover; }
.mbt-hero__photo::after { content: ''; position: absolute; inset: auto 0 0 0; height: 120px; background: linear-gradient(to top, rgba(10, 22, 38, .45), rgba(10, 22, 38, 0)); pointer-events: none; }
.mbt-hero__ctrl { position: absolute; right: var(--mbt-gut); bottom: 14px; z-index: 2; display: flex; align-items: center; gap: 10px; }
.mbt-hero__dots { display: inline-flex; gap: 6px; }
.mbt-hero__dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .5); }
.mbt-hero__dots i.is-on { background: #fff; }
.mbt-hero__pause { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(10, 22, 38, .35); color: #fff; cursor: pointer; }
.mbt-hero__pause svg { width: 18px; height: 18px; }
.mbt-hero__pause:hover { background: rgba(10, 22, 38, .55); }
.mbt-hero__inner { position: absolute; inset: 0 0 auto 0; height: clamp(600px, 48vw, 700px); max-width: calc(var(--mbt-max) + var(--mbt-gut) * 2); margin: 0 auto; padding: 0 var(--mbt-gut); display: flex; align-items: center; pointer-events: none; }
.mbt-hero__label { pointer-events: auto; width: min(560px, 50%); padding: 36px 40px 30px; background: var(--mbt-paper); border-radius: 16px; box-shadow: 0 18px 40px -24px rgba(10, 22, 38, .45); }
.mbt-hero__title { font-size: 2.5rem; font-weight: 700; line-height: 1.35; letter-spacing: .03em; }
.mbt-hero__title em { font-style: normal; color: var(--mbt-blue); }
.mbt-hero__lead { margin-top: 12px; font-size: .9375rem; line-height: 1.85; color: var(--mbt-ink2); }
/* 行動2：つくる（線のボタン＝副。主ボタンは「まちノートとは」） */
.mbt-hero__make { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--mbt-line); }
.mbt-hero__make-note { display: flex; flex-direction: column; font-size: .8125rem; color: var(--mbt-muted); line-height: 1.5; }
.mbt-hero__make-note > span { color: var(--mbt-ink); font-weight: 500; }
.mbt-textlink--sm { min-height: 36px; font-size: .8125rem; }
.mbt-hero__facts { margin-top: 14px; font-size: .8125rem; color: var(--mbt-muted); }
.mbt-hero__facts b { font-size: 1rem; color: var(--mbt-ink); margin: 0 2px; font-weight: 700; }
.mbt-hero__facts span { margin: 0 6px; color: #9aabbf; }

/* 検索 */
.mbt-search { margin-top: 20px; }
.mbt-search__tabs { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 10px; border-radius: 999px; background: var(--mbt-pale); }
.mbt-search__tabs button { min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: none; font-size: .875rem; font-weight: 500; color: var(--mbt-ink2); cursor: pointer; }
.mbt-search__tabs button[aria-selected="true"] { background: #fff; color: var(--mbt-blue); font-weight: 700; box-shadow: 0 1px 3px rgba(28, 57, 93, .16); }
.mbt-search__field { position: relative; display: flex; align-items: center; }
.mbt-search__icon { position: absolute; left: 16px; width: 20px; height: 20px; color: var(--mbt-muted); pointer-events: none; }
.mbt-search__input { width: 100%; height: 56px; padding: 0 64px 0 46px; border: 1.5px solid var(--mbt-line); border-radius: 12px; background: #fff; font-size: 1rem; -webkit-appearance: none; appearance: none; }
.mbt-search__input::placeholder { color: #8a9ab0; }
.mbt-search__input:focus { outline: none; border-color: var(--mbt-blue); box-shadow: 0 0 0 3px rgba(42, 87, 142, .18); }
.mbt-search__input::-webkit-search-cancel-button { display: none; }
.mbt-search__field .mbt-search__input { padding-right: 104px; }
.mbt-search__submit { position: absolute; right: 6px; top: 6px; height: 44px; padding: 0 16px 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 9px; background: var(--mbt-blue); color: #fff; font-weight: 700; font-size: .9375rem; letter-spacing: .06em; cursor: pointer; }
.mbt-search__submit:hover { background: var(--mbt-blue-d); }
.mbt-search__submit svg { width: 18px; height: 18px; }

/* 公開中の都道府県：地方ごとに1行 */
.mbt-regions { display: grid; gap: 4px; margin-top: 10px; }
.mbt-regions__head { display: flex; align-items: center; justify-content: space-between; font-size: .75rem; color: var(--mbt-muted); }
.mbt-regions__row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.mbt-regions__name { flex: none; width: 2.6em; font-size: .75rem; font-weight: 500; color: var(--mbt-muted); }
.mbt-regions__row button { min-height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--mbt-pale2); color: var(--mbt-ink2); font-size: .8125rem; cursor: pointer; }
.mbt-regions__row button:hover { background: var(--mbt-pale); color: var(--mbt-blue); }
.mbt-regions__row button[aria-pressed="true"] { background: var(--mbt-blue); color: #fff; }
.mbt-regions__map { margin-left: auto; }
.mbt-search__opts { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; margin-top: 6px; }
.mbt-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: .875rem; cursor: pointer; }
.mbt-check input { width: 18px; height: 18px; accent-color: var(--mbt-blue); }

/* 候補 */
.mbt-search__panel { position: relative; }
.mbt-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; max-height: 320px; overflow-y: auto; padding: 6px; background: #fff; border: 1px solid var(--mbt-line); border-radius: 12px; box-shadow: 0 16px 32px -12px rgba(10, 22, 38, .28); }
.mbt-suggest li { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.mbt-suggest li[aria-selected="true"], .mbt-suggest li:hover { background: var(--mbt-pale2); }
.mbt-suggest__name { font-weight: 500; }
.mbt-suggest__name mark { background: none; color: var(--mbt-blue); font-weight: 700; }
.mbt-suggest__pref { font-size: .8125rem; color: var(--mbt-muted); }
.mbt-suggest__count { margin-left: auto; font-size: .75rem; color: var(--mbt-muted); white-space: nowrap; }
.mbt-suggest__empty { color: var(--mbt-muted); font-size: .875rem; cursor: default !important; background: none !important; }
.mbt-suggest__head { min-height: 28px !important; padding: 4px 10px 0 !important; font-size: .75rem; color: var(--mbt-muted); cursor: default !important; background: none !important; }

/* SP・タブレット：見出しを写真に重ね、白いシートは「探す」から始める */
@media (max-width: 899px) {
  .mbt-hero { display: grid; grid-template-columns: 100%; }
  .mbt-hero__inner, .mbt-hero__label { display: contents; }
  /* 写真の高さ：通常のスマホは幅の82%、画面の低い機種（SE等）は画面高の40%まで縮める */
  .mbt-hero__photo { grid-area: 1 / 1; height: min(82vw, 400px, 40svh); min-height: 240px; }
  .mbt-hero__photo::after { height: 78%; background: linear-gradient(to top, rgba(10, 22, 38, .72) 0%, rgba(10, 22, 38, .38) 45%, rgba(10, 22, 38, 0) 100%); }
  .mbt-hero__ctrl { top: 10px; bottom: auto; right: 10px; }
  .mbt-hero__head { grid-area: 1 / 1; align-self: end; position: relative; z-index: 2; padding: 0 var(--mbt-gut) 34px; color: #fff; pointer-events: none; }
  .mbt-hero__title { font-size: 1.75rem; line-height: 1.3; text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
  .mbt-hero__title em { color: #cfe6ff; }
  .mbt-hero__lead { margin-top: 6px; font-size: .875rem; line-height: 1.6; color: rgba(255, 255, 255, .92); text-shadow: 0 1px 8px rgba(0, 0, 0, .4); }
  .mbt-hero__body { grid-row: 2; position: relative; z-index: 3; margin-top: -18px; padding: 16px var(--mbt-gut) 24px; background: var(--mbt-paper); border-radius: 18px 18px 0 0; pointer-events: auto; }
  .mbt-search { margin-top: 0; }
  .mbt-search__tabs { display: flex; }
  .mbt-search__tabs button { flex: 1; }
  .mbt-hero__make .mbt-btn { flex: 1 1 auto; }
  .mbt-hero__make-note { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0 12px; width: 100%; justify-content: center; }
  .mbt-hero__facts { text-align: center; }
}
@media (max-width: 899px) and (min-width: 640px) {
  .mbt-hero__photo { height: 420px; }
  .mbt-hero__head, .mbt-hero__body { padding-left: 40px; padding-right: 40px; }
  .mbt-hero__title { font-size: 2.25rem; }
  .mbt-hero__make .mbt-btn { flex: 0 0 auto; }
  .mbt-hero__make-note { width: auto; justify-content: flex-start; }
}
@media (max-width: 359px) { .mbt-hero__title { font-size: 1.5rem; } .mbt-hero__lead { font-size: .8125rem; } }

/* ---------- ② わたしの本棚 ---------- */
.mbt-shelfband { padding: 32px 0 36px; background: var(--mbt-pale); }
.mbt-shelfband__inner { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 24px 48px; align-items: end; }
.mbt-shelfband__title { font-size: 1.375rem; font-weight: 700; }
.mbt-next { display: flex; gap: 14px; align-items: center; margin-top: 14px; padding: 14px; background: #fff; border-radius: var(--mbt-r); }
.mbt-next__thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
.mbt-next__body { flex: 1; min-width: 0; }
.mbt-next__name { font-weight: 700; }
.mbt-next__meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: .8125rem; color: var(--mbt-muted); }
.mbt-next .mbt-btn { margin-top: 10px; width: 100%; }
.mbt-next__empty { font-size: .875rem; color: var(--mbt-ink2); }
.mbt-shelfband__books { min-width: 0; }
.mbt-books { display: flex; align-items: flex-end; gap: 8px; overflow-x: auto; padding: 12px 4px 0; margin: 0 -4px; scrollbar-width: none; -ms-overflow-style: none; scroll-behavior: smooth; overscroll-behavior-x: contain; }
/* 見た目だけスクロールバーを消す。横スクロール・タッチ・キーボード操作は維持。 */
.mbt .mbt-books::-webkit-scrollbar { display: none; width: 0; height: 0; }
.mbt .mbt-books:focus-visible { outline: 2px solid var(--mbt-blue); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .mbt-books { scroll-behavior: auto; } }
.mbt-book { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; width: var(--thick, 72px); height: 172px; padding: 7px 6px 10px; border-radius: 5px 5px 2px 2px; border: none; background: var(--spine, #425b76); color: #fff; text-decoration: none; box-shadow: inset 5px 0 0 rgba(255, 255, 255, .08), inset -6px 0 0 rgba(0, 0, 0, .15), 0 10px 18px rgba(28, 57, 93, .18); cursor: pointer; transition: transform .2s ease; }
.mbt-book:hover, .mbt-book:focus-visible { transform: translateY(-8px); }
.mbt-book img, .mbt-book__noimg { width: 42px; height: 42px; object-fit: cover; border-radius: 3px; border: 2px solid rgba(255, 255, 255, .88); background: rgba(255, 255, 255, .16); display: flex; align-items: center; justify-content: center; }
.mbt-book__noimg svg { width: 20px; height: 20px; }
.mbt-book__name { flex: 1; margin-top: 10px; writing-mode: vertical-rl; white-space: nowrap; font-size: 15px; line-height: 1; letter-spacing: .14em; font-weight: 500; }
.mbt-book__state { font-size: 11px; font-weight: 700; opacity: .9; }
.mbt-book__stamp { position: absolute; right: 6px; top: 36px; width: 26px; height: 26px; background: var(--spine, #425b76); border-radius: 50%; border: 2px solid #ffc6b0; color: #ffd9cb; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; transform: rotate(-12deg); }
.mbt-book--blank { --thick: 64px; background: #fff; color: var(--mbt-blue); border: 1.5px dashed #9fb4cc; box-shadow: none; }
.mbt-book--blank .mbt-book__noimg { border: 1.5px dashed #9fb4cc; background: var(--mbt-pale2); }
.mbt-shelf-board { height: 10px; margin: 0 -8px; border-radius: 3px; background: linear-gradient(#c9d6e4, #b3c4d7); box-shadow: 0 6px 12px rgba(28, 57, 93, .12); }
@media (max-width: 799px) {
  .mbt-shelfband { padding: 26px 0 28px; }
  .mbt-shelfband__inner { grid-template-columns: 1fr; }
  .mbt-book { height: 150px; }
}

/* ---------- ノート（3×3）共通 ---------- */
.mbt-note { position: relative; display: block; background: #fff; border-radius: 14px; padding: 10px; text-decoration: none; box-shadow: 0 1px 2px rgba(28, 57, 93, .06), 0 10px 24px -16px rgba(28, 57, 93, .35); }
.mbt-note__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; border-radius: 8px; overflow: hidden; }
.mbt-note__grid > * { aspect-ratio: 1; width: 100%; height: 100%; object-fit: cover; background: var(--mbt-pale2); }
.mbt-note__grid > .is-empty { display: flex; align-items: center; justify-content: center; color: #a9b8ca; font-size: .75rem; background: repeating-linear-gradient(135deg, var(--mbt-pale2) 0 6px, #eef3f8 6px 12px); }
.mbt-note__foot { display: flex; align-items: center; gap: 10px; padding: 10px 4px 2px; }
.mbt-note__name { font-weight: 700; font-size: 1rem; }
.mbt-note__count { margin-left: auto; font-size: .8125rem; color: var(--mbt-muted); white-space: nowrap; }
.mbt-note__count b { color: var(--mbt-ink); font-size: 1rem; }
.mbt-dots { display: inline-flex; gap: 4px; }
.mbt-dots i { width: 7px; height: 7px; border-radius: 50%; background: #d6e0ea; }
.mbt-dots i.is-on { background: var(--mbt-blue); }
.is-done .mbt-dots i.is-on { background: var(--mbt-hanko); }
.mbt-hanko { position: absolute; right: 18px; top: 18px; display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; border: 3px solid var(--mbt-hanko); color: var(--mbt-hanko); background: rgba(255, 255, 255, .9); font-size: 1.125rem; font-weight: 700; letter-spacing: .1em; transform: rotate(-12deg) scale(1.6); opacity: 0; transition: transform .35s cubic-bezier(.2, 1.4, .4, 1), opacity .2s; pointer-events: none; }
.is-done .mbt-hanko { opacity: 1; transform: rotate(-12deg) scale(1); }

/* ---------- ③ まちノートとは ---------- */
.mbt-about__grid { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 40px 72px; align-items: center; }
.mbt-note--demo { padding: 12px; }
.mbt-note--demo .mbt-note__grid > * { transition: opacity .3s, transform .3s; }
.mbt-note--demo .mbt-note__grid > .is-pop { animation: mbt-pop .4s ease; }
@keyframes mbt-pop { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
.mbt-demo-ctrl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.mbt-demo-ctrl button { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 56px; border: 1.5px solid var(--mbt-line); border-radius: 10px; background: #fff; font-weight: 700; cursor: pointer; line-height: 1.3; }
.mbt-demo-ctrl small { font-size: .75rem; font-weight: 400; color: var(--mbt-muted); }
.mbt-demo-ctrl button[aria-pressed="true"] { border-color: var(--mbt-blue); background: var(--mbt-pale2); color: var(--mbt-blue); }
.mbt-about__sample { margin-top: 10px; font-size: .75rem; color: var(--mbt-muted); }
.mbt-about__lead { margin-top: 14px; color: var(--mbt-ink2); line-height: 1.9; }
.mbt-steps { margin-top: 28px; display: grid; gap: 18px; counter-reset: s; }
.mbt-steps li { display: flex; gap: 16px; align-items: flex-start; }
.mbt-steps__no { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--mbt-pale); color: var(--mbt-blue); font-weight: 700; }
.mbt-steps b { display: block; font-weight: 700; }
.mbt-steps span:not(.mbt-steps__no) { display: block; font-size: .875rem; color: var(--mbt-muted); line-height: 1.7; }
.mbt-about__act { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin-top: 32px; }
.mbt-about__help { font-size: .8125rem; color: var(--mbt-muted); }
@media (max-width: 899px) {
  .mbt-about__grid { grid-template-columns: 1fr; }
  .mbt-about__demo { order: 2; max-width: 440px; width: 100%; margin: 0 auto; }
  .mbt-about__act .mbt-btn { width: 100%; }
  .mbt-about__help { width: 100%; text-align: center; }
}

/* ---------- ④ みんなのまちノート ---------- */
.mbt-rail { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 3 * 20px) / 4); gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0; padding: 4px 2px 18px; margin: -4px -2px 0; scrollbar-width: thin; scrollbar-color: #c3d0de transparent; }
.mbt-rail > * { scroll-snap-align: start; }
.mbt-rail:focus-visible { outline-offset: 4px; }
.mbt-people .mbt-note { transition: transform .2s; }
.mbt-people a.mbt-note:hover { transform: translateY(-3px); }
.mbt-note__who { display: flex; align-items: center; gap: 8px; padding: 10px 4px 0; }
.mbt-ava { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; border-radius: 50%; color: #fff; font-size: .8125rem; font-weight: 700; }
.mbt-note__title { font-weight: 700; font-size: .9375rem; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbt-note__title small { display: block; font-size: .75rem; font-weight: 400; color: var(--mbt-muted); }
.mbt-note__quote { margin: 8px 4px 2px; padding: 8px 12px; border-radius: 8px; background: var(--mbt-kinari); font-size: .8125rem; line-height: 1.6; color: #5a4632; }
.mbt-note--invite { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 100%; padding: 24px 18px; background: var(--mbt-pale2); border: 1.5px dashed #9fb4cc; box-shadow: none; text-align: center; color: var(--mbt-blue); cursor: pointer; font-family: inherit; }
.mbt-note--invite:hover { background: var(--mbt-pale); }
.mbt-rail > .mbt-note--invite { grid-column: span var(--span, 1); }
@media (max-width: 1023px) { .mbt-rail > .mbt-note--invite { grid-column: auto; } }
.mbt-note--invite .mbt-invite__plus { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; background: #fff; }
.mbt-note--invite .mbt-invite__plus svg { width: 24px; height: 24px; }
.mbt-note--invite b { font-size: 1rem; color: var(--mbt-ink); }
.mbt-note--invite span { font-size: .8125rem; color: var(--mbt-muted); }
.mbt-scrollbtns { display: flex; gap: 8px; }
.mbt-scrollbtns button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1.5px solid var(--mbt-line); border-radius: 50%; background: #fff; color: var(--mbt-blue); cursor: pointer; }
.mbt-scrollbtns button:hover:not(:disabled) { border-color: var(--mbt-blue); }
.mbt-scrollbtns button:disabled { opacity: .35; cursor: default; }
.mbt-scrollbtns svg { width: 20px; height: 20px; }
.mbt-scrollbtns[hidden] { display: none; }
@media (max-width: 1023px) { .mbt-rail { grid-auto-columns: calc((100% - 2 * 16px) / 3); gap: 16px; } }
@media (max-width: 719px) {
  .mbt-rail { grid-auto-columns: 74%; gap: 12px; margin-right: calc(var(--mbt-gut) * -1); padding-right: var(--mbt-gut); scroll-padding-left: 0; }
  .mbt-scrollbtns { display: none; }
}

/* 投稿ゼロ：最初の1冊を待っているまち */
.mbt-waiting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px 40px; align-items: center; padding: 28px; border-radius: 16px; background: var(--mbt-pale2); }
.mbt-waiting__text b { display: block; font-size: 1.25rem; font-weight: 700; line-height: 1.5; }
.mbt-waiting__text p { margin-top: 8px; font-size: .875rem; color: var(--mbt-ink2); }
.mbt-waiting__text .mbt-btn { margin-top: 18px; }
.mbt-waiting__list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mbt-note__done { margin-left: auto; padding: 1px 8px; border: 1.5px solid var(--mbt-hanko); border-radius: 4px; color: var(--mbt-hanko); font-size: .75rem; font-weight: 700; letter-spacing: .1em; transform: rotate(-4deg); }
.mbt-waiting__item { display: block; text-decoration: none; text-align: left; border: 0; padding: 0; background: none; cursor: pointer; font-family: inherit; }
.mbt-waiting__item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; }
.mbt-waiting__item b { display: block; margin-top: 8px; font-weight: 700; }
.mbt-waiting__item span { display: block; font-size: .8125rem; color: var(--mbt-muted); }
.mbt-waiting__item:hover b { color: var(--mbt-blue); text-decoration: underline; }
@media (max-width: 799px) {
  .mbt-waiting { grid-template-columns: 1fr; padding: 20px 16px; }
  .mbt-waiting__list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .mbt-waiting__item b { font-size: .875rem; }
  .mbt-waiting__text .mbt-btn { width: 100%; }
}

/* ---------- ⑤ まちをめぐる ---------- */
.mbt-towns__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px 40px; align-items: start; }
.mbt-today__photos { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 6px; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; text-decoration: none; }
.mbt-today__photos img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.mbt-today__photos a, .mbt-today__photos span { position: relative; overflow: hidden; display: block; }
.mbt-today__photos > :first-child { grid-row: 1 / 3; }
.mbt-today__photos a:hover img { transform: scale(1.04); }
.mbt-today__more { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10, 22, 38, .5); color: #fff; font-weight: 700; }
.mbt-today__badge { position: absolute; left: 12px; top: 12px; padding: 4px 12px; border-radius: 999px; background: #fff; color: var(--mbt-blue); font-size: .8125rem; font-weight: 700; }
.mbt-today__body { margin-top: 18px; }
.mbt-today__name { font-size: 1.75rem; font-weight: 700; line-height: 1.3; }
.mbt-today__name small { margin-left: 10px; font-size: .875rem; font-weight: 400; color: var(--mbt-muted); }
.mbt-today__q { margin-top: 2px; font-size: 1rem; font-weight: 500; color: var(--mbt-blue); }
.mbt-today__intro { margin-top: 8px; font-size: .9375rem; color: var(--mbt-ink2); }
.mbt-today__act { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.mbt-tabs { display: flex; gap: 0; border-bottom: 1.5px solid var(--mbt-line); margin-bottom: 14px; }
.mbt-tabs button { position: relative; min-height: 48px; padding: 0 16px; border: 0; background: none; font-size: .9375rem; font-weight: 500; color: var(--mbt-muted); cursor: pointer; }
.mbt-tabs button[aria-selected="true"] { color: var(--mbt-ink); font-weight: 700; }
.mbt-tabs button[aria-selected="true"]::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1.5px; height: 3px; border-radius: 3px; background: var(--mbt-blue); }
.mbt-tabs button:hover { color: var(--mbt-blue); }
.mbt-tabs button { white-space: nowrap; }
.mbt-tabs--compact { margin-bottom: 0; border-bottom: 0; }
@media (max-width: 719px) { .mbt-tabs--compact { width: 100%; border-bottom: 1.5px solid var(--mbt-line); } .mbt-tabs--compact button { flex: 1; } }
.mbt-townlist { display: grid; gap: 4px; }
.mbt-town { display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 8px; border-radius: 12px; text-decoration: none; }
.mbt-town:hover { background: var(--mbt-paper); }
.mbt-town img { width: 84px; height: 60px; flex: none; border-radius: 8px; object-fit: cover; }
.mbt-town__name { font-weight: 700; line-height: 1.4; }
.mbt-town__meta { font-size: .8125rem; color: var(--mbt-muted); }
.mbt-town__meta em { font-style: normal; color: var(--mbt-blue); font-weight: 500; }
.mbt-town__go { margin-left: auto; color: #9aabbf; width: 20px; height: 20px; }
.mbt-town:hover .mbt-town__go { color: var(--mbt-blue); }
.mbt-meter { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: 1px; }
.mbt-meter i { width: 6px; height: 6px; border-radius: 1px; background: #d6e0ea; }
.mbt-meter i.is-on { background: var(--mbt-blue); }

.mbt-prefs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 4px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--mbt-line); }
.mbt-prefs__label { margin-right: 10px; font-size: .875rem; font-weight: 500; color: var(--mbt-muted); }
.mbt-prefs ul { display: flex; flex-wrap: wrap; gap: 2px; }
.mbt-prefs ul a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; font-weight: 500; text-decoration: none; }
.mbt-prefs ul a:hover { background: var(--mbt-paper); color: var(--mbt-blue); }
.mbt-prefs__map { margin-left: auto; }
@media (max-width: 899px) {
  .mbt-towns__grid { grid-template-columns: 1fr; }
  .mbt-today__photos { grid-template-columns: 2fr 1fr; aspect-ratio: 4 / 3; }
  .mbt-today__photos > :nth-child(n+4) { display: none; }
  .mbt-today__name { font-size: 1.5rem; }
  .mbt-today__act .mbt-btn { flex: 1 1 100%; }
  .mbt-prefs { margin-top: 28px; }
  .mbt-prefs__label { width: 100%; }
  .mbt-prefs__map { margin-left: 0; }
  .mbt-tabs button { flex: 1; padding: 0 8px; }
}

/* ---------- ⑥ スポットを見つける ---------- */
.mbt-spotgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 20px; }
.mbt-spot { display: block; text-decoration: none; }
.mbt-spot__img { position: relative; overflow: hidden; border-radius: 12px; aspect-ratio: 4 / 3; background: var(--mbt-pale); }
.mbt-spot__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.mbt-spot:hover .mbt-spot__img img { transform: scale(1.04); }
.mbt-spot__rank { position: absolute; left: 0; top: 0; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 0 0 10px 0; background: rgba(255, 255, 255, .94); color: var(--mbt-blue); font-weight: 700; }
.mbt-spot__name { margin-top: 10px; font-weight: 500; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mbt-spot:hover .mbt-spot__name { color: var(--mbt-blue); text-decoration: underline; }
.mbt-spot__place { font-size: .8125rem; color: var(--mbt-muted); }
.mbt-spot__picked { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: .75rem; color: var(--mbt-blue); }
.mbt-spot__picked svg { width: 14px; height: 14px; }
.mbt-spotgrid--rank > :first-child { grid-column: span 2; grid-row: span 2; }
.mbt-spotgrid--rank > :first-child .mbt-spot__img { aspect-ratio: auto; height: calc(100% - 70px); min-height: 220px; }
.mbt-spotgrid--rank > :first-child .mbt-spot__name { font-size: 1.125rem; font-weight: 700; }
.mbt-genres { margin-top: 44px; }
.mbt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mbt-chips a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--mbt-pale2); font-size: .9375rem; text-decoration: none; }
.mbt-chips a:hover { background: var(--mbt-pale); color: var(--mbt-blue); }
@media (max-width: 1023px) { .mbt-spotgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 719px) {
  .mbt-spotgrid, .mbt-spotgrid--rank { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .mbt-spotgrid--rank > :first-child .mbt-spot__img { aspect-ratio: 16 / 10; height: auto; min-height: 0; }
  .mbt-spotgrid--rank > :first-child { grid-row: auto; }
  .mbt-spot__name { font-size: .9375rem; }
  .mbt-genres { margin-top: 32px; }
  .mbt-chips { flex-wrap: nowrap; overflow-x: auto; margin-right: calc(var(--mbt-gut) * -1); padding-right: var(--mbt-gut); padding-bottom: 4px; scrollbar-width: none; }
  .mbt-chips li { flex: none; }
}

/* ---------- ⑦ マチベースから ---------- */
.mbt-news { padding: 48px 0; }
.mbt-news__inner { display: grid; grid-template-columns: 180px 1fr auto; gap: 8px 32px; align-items: start; }
.mbt-news .mbt-h3 { margin: 10px 0 0; }
.mbt-news__list li { display: flex; gap: 20px; padding: 10px 0; border-bottom: 1px solid var(--mbt-line); font-size: .9375rem; }
.mbt-news__list li:first-child { padding-top: 10px; }
.mbt-news__list time { flex: none; color: var(--mbt-muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
@media (max-width: 799px) {
  .mbt-news__inner { grid-template-columns: 1fr; }
  .mbt-news__list li { flex-direction: column; gap: 0; }
}

/* ---------- ダイアログ ---------- */
.mbt-dialog { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.mbt-dialog[hidden] { display: none; }
.mbt-dialog__backdrop { position: absolute; inset: 0; background: rgba(10, 22, 38, .5); }
.mbt-dialog__panel { position: relative; display: flex; flex-direction: column; width: min(560px, 100%); max-height: min(720px, calc(100dvh - 32px)); padding: 24px; background: #fff; border-radius: 16px; box-shadow: 0 24px 60px -20px rgba(10, 22, 38, .5); }
.mbt-dialog__panel:focus { outline: none; }
.mbt-dialog__head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.mbt-dialog__head h2 { font-size: 1.375rem; font-weight: 700; }
.mbt-dialog__head p { margin-top: 4px; font-size: .875rem; color: var(--mbt-muted); }
.mbt-dialog__close { flex: none; margin: -6px -6px 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--mbt-ink); cursor: pointer; }
.mbt-dialog__close:hover { background: var(--mbt-pale2); }
.mbt-dialog__close svg { width: 22px; height: 22px; }
.mbt-dialog__search .mbt-search__input { padding-right: 16px; height: 52px; }
.mbt-dialog__list { margin: 12px -8px 0; padding: 0 8px; overflow-y: auto; flex: 1; min-height: 120px; }
.mbt-dialog__group { margin-top: 8px; }
.mbt-dialog__group > h3 { position: sticky; top: 0; padding: 8px 4px 4px; background: #fff; font-size: .8125rem; font-weight: 500; color: var(--mbt-muted); }
.mbt-pick { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 10px; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; text-decoration: none; }
.mbt-pick:hover, .mbt-pick:focus-visible { background: var(--mbt-pale2); }
.mbt-pick__name { font-weight: 500; }
.mbt-pick__tag { padding: 1px 8px; border-radius: 999px; background: var(--mbt-pale); color: var(--mbt-blue); font-size: .75rem; font-weight: 500; }
.mbt-pick__tag--mine { background: var(--mbt-kinari); color: #8a5a2e; }
.mbt-pick__count { margin-left: auto; font-size: .75rem; color: var(--mbt-muted); }
.mbt-pick svg { width: 18px; height: 18px; color: #9aabbf; }
.mbt-dialog__none { padding: 20px 4px; color: var(--mbt-muted); font-size: .875rem; }
@media (max-width: 639px) {
  .mbt-dialog { align-items: flex-end; padding: 0; }
  .mbt-dialog__panel { width: 100%; max-height: 88dvh; border-radius: 18px 18px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); }
}

/* ---------- トースト（モックでの遷移先表示） ---------- */
.mbt-toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 10px; background: var(--mbt-ink); color: #fff; font-size: .875rem; box-shadow: 0 12px 30px -10px rgba(10, 22, 38, .5); }
.mbt-toast code { font-family: ui-monospace, Consolas, monospace; color: #bcd3ee; word-break: break-all; }

/* ---------- モック専用パネル ---------- */
.mock-panel { position: fixed; right: 12px; bottom: 12px; z-index: 70; width: 230px; font-size: 12px; background: #fffbe8; border: 1px solid #e8d48a; border-radius: 10px; box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .3); color: #4a3c00; }
.mock-panel__toggle { width: 100%; min-height: 36px; padding: 0 12px; border: 0; background: none; text-align: left; font-weight: 700; cursor: pointer; }
.mock-panel__toggle::after { content: '－'; float: right; }
.mock-panel__toggle[aria-expanded="false"]::after { content: '＋'; }
.mock-panel__body { padding: 0 12px 12px; display: grid; gap: 8px; }
.mock-panel__body[hidden] { display: none; }
.mock-panel label { display: grid; gap: 2px; }
.mock-panel select { min-height: 32px; border: 1px solid #d9c57a; border-radius: 6px; background: #fff; padding: 0 6px; font-size: 12px; }
.mock-panel p { margin: 0; color: #7a6a2a; }
body.is-shot .mock-panel { display: none; }

/* ==========================================================
   v2 追加分
   ========================================================== */

/* ② わたしのまち（本棚）見出し */
.mbt-shelfband .mbt-eyebrow { display: flex; align-items: center; gap: 4px; }
.mbt-shelfband__shelfhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: -4px; }
.mbt-shelfband__shelfname { font-size: .875rem; font-weight: 700; }
.mbt-shelfband__shelfname small { margin-left: 6px; font-weight: 400; color: var(--mbt-muted); }
.mbt-shelfband .mock-note { margin: 14px 0 0; }

/* ③ ことばの関係（わたしのまち ⊃ わたしの本棚 ⊃ まちノート） */
.mbt-words { margin: 28px 0 0; }
.mbt-words__cap { margin-bottom: 8px; font-size: .8125rem; font-weight: 500; color: var(--mbt-muted); }
.mbt-words__page { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "page page" "shelf book"; gap: 10px 18px; align-items: end; padding: 14px 18px 16px; border: 1.5px solid var(--mbt-line); border-radius: 14px; background: var(--mbt-paper); }
.mbt-words b { display: block; font-size: .9375rem; font-weight: 700; line-height: 1.4; }
.mbt-words span { display: block; font-size: .75rem; color: var(--mbt-muted); }
.mbt-words__pagename { grid-area: page; display: flex; align-items: baseline; gap: 8px; }
.mbt-words__pagename span { display: inline; }
.mbt-words__shelf { grid-area: shelf; display: flex; align-items: flex-end; gap: 12px; padding: 10px 12px 0; border-radius: 10px; background: var(--mbt-pale2); }
.mbt-words__books { display: flex; align-items: flex-end; gap: 3px; padding-bottom: 0; border-bottom: 5px solid #b9c9db; }
.mbt-words__books i { display: block; width: 14px; height: 46px; border-radius: 2px 2px 0 0; background: var(--c); }
.mbt-words__books i:nth-child(2) { height: 52px; width: 18px; }
.mbt-words__books i.is-new { background: #fff; border: 1.5px dashed #9fb4cc; border-bottom: 0; }
.mbt-words__shelfname { padding-bottom: 10px; }
.mbt-words__book { grid-area: book; position: relative; padding: 0 0 10px 14px; border-left: 3px solid #736041; }
@media (max-width: 479px) {
  .mbt-words__page { grid-template-columns: 1fr; grid-template-areas: "page" "shelf" "book"; }
  .mbt-words__book { padding-bottom: 0; }
}
.mbt-about__act { margin-top: 26px; }
.mbt-about__help { font-size: .8125rem; line-height: 1.7; color: var(--mbt-muted); }
@media (max-width: 899px) { .mbt-about__help { text-align: center; } }
/* SP：見出し → 見本（体験）→ 手順 → ことばの関係 → ボタン の順に並べ替える */
@media (max-width: 899px) {
  .mbt-about__grid { display: flex; flex-direction: column; gap: 0; }
  .mbt-about__text { display: contents; }
  .mbt-about__text > .mbt-eyebrow { order: 1; }
  .mbt-about__text > .mbt-h2 { order: 2; }
  .mbt-about__text > .mbt-about__lead { order: 3; }
  .mbt-about__demo { order: 4; margin-top: 22px; }
  .mbt-about__text > .mbt-steps { order: 5; }
  .mbt-about__text > .mbt-words { order: 6; }
  .mbt-about__text > .mbt-about__act { order: 7; }
}

/* ④ みんなのまちノート：カード */
.mbt-pnote { display: flex; flex-direction: column; background: #fff; border-radius: 14px; overflow: hidden; text-decoration: none; box-shadow: 0 1px 2px rgba(28, 57, 93, .06), 0 12px 28px -18px rgba(28, 57, 93, .4); transition: transform .2s; }
a.mbt-pnote:hover { transform: translateY(-3px); }
a.mbt-pnote:hover .mbt-pnote__town { color: var(--mbt-blue); }
.mbt-pnote__body { display: flex; flex-direction: column; flex: 1; padding: 14px 16px 14px; }
.mbt-pnote__pref { font-size: .75rem; color: var(--mbt-muted); }
.mbt-pnote__town { font-size: 1.25rem; font-weight: 700; line-height: 1.35; }
.mbt-pnote__quote { margin-top: 8px; font-size: .875rem; line-height: 1.7; color: var(--mbt-ink2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mbt-pnote__quote { text-indent: -.5em; }
.mbt-pnote__open { display: none; align-items: center; gap: 4px; margin-top: 14px; font-size: .875rem; font-weight: 700; color: var(--mbt-blue); }
.mbt-pnote__open svg { width: 1em; height: 1em; }
.mbt-rail.is-feature .mbt-pnote__open { display: inline-flex; }
.mbt-rail.is-single .mbt-cover { flex-basis: 46%; }
.mbt-pnote__by { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 12px; font-size: .8125rem; color: var(--mbt-muted); }
.mbt-pnote__by .mbt-ava { width: 24px; height: 24px; font-size: .75rem; }
.mbt-pnote__user { color: var(--mbt-ink2); font-weight: 500; }
.mbt-pnote__n { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; white-space: nowrap; }
.mbt-pnote__n .mbt-dots i { width: 6px; height: 6px; }
.mbt-pnote__done { color: var(--mbt-hanko); font-weight: 700; }

/* 表紙：選んだ枚数でレイアウトを変える（空きマスを見せない） */
.mbt-cover { position: relative; display: grid; gap: 2px; aspect-ratio: 1; background: #fff; overflow: hidden; }
.mbt-cover img { width: 100%; height: 100%; object-fit: cover; min-height: 0; min-width: 0; }
.mbt-cover.c-3 { grid-template: repeat(2, minmax(0, 1fr)) / minmax(0, 1.4fr) minmax(0, 1fr); } .mbt-cover.c-3 img:first-child { grid-row: span 2; }
.mbt-cover.c-4 { grid-template: repeat(2, minmax(0, 1fr)) / repeat(2, minmax(0, 1fr)); }
.mbt-cover.c-5 { grid-template: minmax(0, 1.3fr) minmax(0, 1fr) / repeat(6, minmax(0, 1fr)); } .mbt-cover.c-5 img:nth-child(-n+2) { grid-column: span 3; } .mbt-cover.c-5 img:nth-child(n+3) { grid-column: span 2; }
.mbt-cover.c-6, .mbt-cover.c-7, .mbt-cover.c-8, .mbt-cover.c-9 { grid-template: repeat(3, minmax(0, 1fr)) / repeat(3, minmax(0, 1fr)); }
.mbt-cover.c-6 img:first-child { grid-column: span 2; grid-row: span 2; }
.mbt-cover.c-7 img:first-child, .mbt-cover.c-7 img:nth-child(6) { grid-column: span 2; }
.mbt-cover.c-8 img:first-child { grid-column: span 2; }
.mbt-cover__stamp { position: absolute; right: 10px; top: 10px; display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; border: 2.5px solid var(--mbt-hanko); background: rgba(255, 255, 255, .92); color: var(--mbt-hanko); font-size: .875rem; font-weight: 700; letter-spacing: .08em; transform: rotate(-12deg); }

/* 多数：最後の小さな誘い */
.mbt-pnote--invite { justify-content: center; gap: 16px; padding: 24px 20px; background: var(--mbt-pale2); box-shadow: none; text-align: left; }
.mbt-pnote--invite b { display: block; font-size: 1.0625rem; line-height: 1.5; }
.mbt-pnote--invite span { display: block; margin-top: 6px; font-size: .8125rem; color: var(--mbt-muted); }
.mbt-pnote--invite .mbt-btn { align-self: flex-start; }

/* 少数（1〜3冊）：ノートを大きく、横長で */
.mbt-rail.is-feature { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-columns: auto; gap: 24px; overflow: visible; scroll-snap-type: none; margin: 0; padding: 0; }
.mbt-rail.is-feature .mbt-pnote { flex-direction: row; }
.mbt-rail.is-feature .mbt-cover { flex: 0 0 52%; }
.mbt-rail.is-feature .mbt-pnote__body { padding: 20px 22px; }
.mbt-rail.is-feature .mbt-pnote__town { font-size: 1.5rem; }
.mbt-rail.is-feature .mbt-pnote__quote { font-size: .9375rem; -webkit-line-clamp: 4; }
.mbt-rail.is-single { grid-template-columns: minmax(0, 760px); }
.mbt-rail.is-single .mbt-cover { flex-basis: 50%; }
.mbt-people__more { display: flex; align-items: center; flex-wrap: wrap; gap: 0 14px; margin-top: 18px; color: var(--mbt-ink2); font-size: .9375rem; }
.mbt-people__more .mbt-textlink { border: 0; background: none; cursor: pointer; padding: 0; font-family: inherit; }
@media (max-width: 1023px) {
  .mbt-rail.is-feature { grid-template-columns: 1fr; }
}
@media (max-width: 719px) {
  .mbt-rail.is-feature .mbt-pnote { flex-direction: column; }
  .mbt-rail.is-feature .mbt-cover { flex-basis: auto; }
  .mbt-rail.is-feature .mbt-pnote__body { padding: 14px 16px; }
  .mbt-rail.is-feature .mbt-pnote__town { font-size: 1.25rem; }
  .mbt-people__more { flex-direction: column; align-items: flex-start; }
}

/* ⑤ 地図から探す（見出しの右） */
.mbt-towns .mbt-head .mbt-btn svg { width: 1.1rem; height: 1.1rem; }

/* ---------- モック専用：データの出どころ ---------- */
.mock-note { display: inline-block; margin: 0 0 10px; padding: 2px 8px; border-radius: 4px; font-size: .6875rem; line-height: 1.6; font-weight: 500; vertical-align: middle; }
.mock-note[data-kind="real"] { background: #e3effc; color: #1f4f86; }
.mock-note[data-kind="fake"] { background: #fff3d1; color: #6b4e00; }
.mock-note[data-kind="todo"] { background: #fde6d8; color: #8a3a12; }
.mbt-hero__photo > .mock-note { position: absolute; left: 10px; top: 10px; z-index: 3; }
#mbt-spanel-town > .mock-note { margin: 6px 0 0; }
.mbt-genres .mock-note { margin-top: 8px; }
body.notes-off .mock-note, body.is-shot.notes-off .mock-note { display: none !important; }
.mock-panel__check { display: flex !important; align-items: center; gap: 6px; }
.mock-panel i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 3px; }
.mock-panel .k-real { background: #cfe2f7; } .mock-panel .k-fake { background: #ffe39a; } .mock-panel .k-todo { background: #f8c6a8; }

/* ---------- 動きを減らす ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* WordPress theme wrapper, only the administrator preview */
body.mbt-top-preview #page, body.mbt-top-preview .site-main--top-v2 { margin:0!important; padding:0!important; max-width:none!important; width:100%; }
body.mbt-top-preview .mbt-v2-site {max-width:none!important; margin:0!important; padding:0!important; width:100%;}
body.mbt-top-preview .mbt-v2-site ul {padding-left:0;}
.mbt-v2-preview-label {font-size:12px; text-align:center; background:#fff1db; color:#6b4c24; padding:8px 16px;}
.mbt-v2-preview-label a {text-decoration:underline; margin-left:8px;}
.mbt-dialog {z-index:9999;}
.mbt-v2-site .mbt-hero__slide img {width:100%;height:100%;object-fit:cover;}
/* No demo-only annotations, no mock panel */
.mbt .mock-note, .mock-panel, .mbt-v2-site .mbt-news {display:none!important;}

/* v1.1: one public notebook, strong but balanced presence (no fabricated filler). */
@media (min-width: 1024px) {
  .mbt-v2-site .mbt-rail.is-single {
    grid-template-columns: minmax(0, 900px);
    justify-content: center;
    width: 100%;
    margin-inline: auto;
  }
  .mbt-v2-site .mbt-rail.is-single .mbt-pnote {
    width: 100%;
    min-width: 0;
  }
  .mbt-v2-site .mbt-rail.is-single .mbt-cover { flex-basis: 54%; }
  .mbt-v2-site .mbt-rail.is-single .mbt-pnote__body { flex: 1; min-width: 0; }
}


/* === v1.2 theme-style compatibility: buttons / icons === */
/* Avoid inherited theme colors taking precedence over local button variants.
   The earlier `.mbt button { color:inherit; }` is more specific than
   `.mbt-btn--primary` and `.mbt-search__submit`. */
.mbt-v2-site button.mbt-btn--primary,
.mbt-v2-site a.mbt-btn--primary,
.mbt-v2-site button.mbt-search__submit,
.mbt-v2-site .mbt-regions__row button[aria-pressed="true"] {
  color: #fff;
  -webkit-text-fill-color: #fff;
}
.mbt-v2-site button.mbt-btn--line,
.mbt-v2-site a.mbt-btn--line {
  color: var(--mbt-blue);
  -webkit-text-fill-color: var(--mbt-blue);
}
.mbt-v2-site button.mbt-btn--primary:hover,
.mbt-v2-site a.mbt-btn--primary:hover,
.mbt-v2-site button.mbt-search__submit:hover { color: #fff; }
/* Keep embedded glyphs on the same foreground color as their button. */
.mbt-v2-site .mbt-btn svg,
.mbt-v2-site .mbt-search__submit svg { color: inherit; fill: none; }
/* Explicitly center inline SVG symbols in search fields, including the picker. */
.mbt-v2-site .mbt-search__field { position: relative; }
.mbt-v2-site .mbt-search__field > .mbt-search__icon {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  display: block;
  width: 20px;
  height: 20px;
  margin: 0;
  z-index: 1;
  pointer-events: none;
}
.mbt-v2-site .mbt-search__field > .mbt-search__input { padding-left: 46px; }
.mbt-v2-site .mbt-search__field > .mbt-search__submit {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.mbt-v2-site .mbt-search__submit svg { display: block; width: 18px; height: 18px; }
.mbt-v2-site .mbt-btn { align-items: center; justify-content: center; }
.mbt-v2-site .mbt-btn svg { display: block; flex: none; }
/* Utility controls in the hero should not inherit theme icon positioning. */
.mbt-v2-site .mbt-hero__pause svg,
.mbt-v2-site .mbt-scrollbtns svg,
.mbt-v2-site .mbt-dialog__close svg { position: static; margin: 0; transform: none; }
@media (max-width: 639px) {
  .mbt-v2-site .mbt-search__field > .mbt-search__icon { left: 12px; }
  .mbt-v2-site .mbt-search__field > .mbt-search__input { padding-left: 40px; }
  .mbt-v2-site .mbt-search__field > .mbt-search__submit { right: 5px; }
}

/* v1.3: town-specific images, with a neutral state for no registered photo */
.mbt-town__noimg { width:84px; height:60px; flex:none; display:flex; align-items:center;
  justify-content:center; border-radius:8px; background:#e9eef4; color:#65788e;
  font-size:11px; letter-spacing:.02em; text-align:center; }
/* The picker is a sibling of <main>, so rules scoped to .mbt-v2-site do not apply. */
.mbt-dialog .mbt-dialog__search { position:relative; display:flex; align-items:center; }
.mbt-dialog .mbt-dialog__search > .mbt-search__icon {
  position:absolute; top:50%; left:14px; transform:translateY(-50%);
  width:20px; height:20px; min-width:20px; margin:0; padding:0;
  z-index:1; pointer-events:none; color:#71849a;
}
.mbt-dialog .mbt-dialog__search > .mbt-search__input {
  display:block; width:100%; height:52px; min-height:52px;
  padding:0 18px 0 44px; margin:0; line-height:normal;
  border:1.5px solid #dce4ed; border-radius:10px; background:#fff;
  box-sizing:border-box;
}
.mbt-dialog .mbt-dialog__search > .mbt-search__input:focus { border-color:#2a578e; outline:2px solid rgba(42,87,142,.13); }
.mbt-dialog .mbt-dialog__close {position:relative; flex:0 0 44px; padding:0;}
.mbt-dialog .mbt-dialog__close > svg {position:static; transform:none; display:block; margin:0; width:22px; height:22px;}
/* Intro stays quiet, so the top still prioritizes discovery and notes. */
.mbt-intro { background:#fff; border-top:1px solid #e2e8ef; padding:34px 0 40px; }
.mbt-intro__inner {display:flex; align-items:center; justify-content:space-between; gap:24px;}
.mbt-intro__title {font-size:1.125rem; font-weight:700; color:#1c395d;}
.mbt-intro__desc {font-size:.875rem; color:#5b6b80; margin-top:5px !important;}
.mbt-intro__link {flex:none; display:inline-flex; align-items:center; text-decoration:none; font-weight:700; font-size:.875rem; color:#2a578e !important; border-bottom:1px solid currentColor;}
@media(max-width:639px) {.mbt-intro {padding:26px 0 32px;} .mbt-intro__inner {display:block;} .mbt-intro__link {margin-top:14px;}}

/* v1.4: Single purpose hero search (the working town finder). */
.mbt-v2-site .mbt-search__heading {
  margin: 0 0 10px !important;
  color: #1c395d;
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.5;
}
/* The picker lives OUTSIDE the .mbt-v2-site wrapper.  Do not reuse hero input
   classes: the theme's generic search styles caused the double-outline box. */
#mbt-picker .mbt-picker-search {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#mbt-picker .mbt-picker-search__input {
  appearance: none !important;
  -webkit-appearance: none !important;
  display: block !important;
  width: 100% !important;
  height: 52px !important;
  min-height: 52px !important;
  margin: 0 !important;
  padding: 0 16px 0 48px !important;
  box-sizing: border-box !important;
  border: 1.5px solid #dce4ed !important;
  border-radius: 12px !important;
  background: #fff !important;
  color: #1c395d !important;
  font: inherit !important;
  font-size: 16px !important;
  line-height: normal !important;
  box-shadow: none !important;
  outline: none !important;
}
#mbt-picker .mbt-picker-search__input:focus {
  border-color: #2a578e !important;
  outline: 2px solid rgba(42,87,142,.16) !important;
  outline-offset: 2px !important;
  box-shadow: none !important;
}
#mbt-picker .mbt-picker-search__icon {
  position: absolute !important;
  top: 50% !important;
  left: 16px !important;
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: translateY(-50%) !important;
  color: #71849a !important;
  pointer-events: none !important;
  z-index: 2 !important;
}
#mbt-picker .mbt-dialog__panel { box-sizing: border-box !important; overflow: hidden; }
#mbt-picker .mbt-dialog__list { min-width: 0; }


/* =============================================================
 * v1.5: modal layout isolation + genre chips spacing
 * All rules intentionally scoped to the top-page picker / genre list.
 * ============================================================= */
#mbt-picker.mbt-dialog {
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
}
#mbt-picker .mbt-dialog__panel {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 0 !important;
  width: min(560px, 100%) !important;
  max-height: min(720px, calc(100dvh - 32px)) !important;
  padding: 24px !important;
  margin: 0 !important;
  position: relative !important;
  background: #fff !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}
#mbt-picker .mbt-dialog__head {
  position: relative !important;
  display: flex !important;
  flex: 0 0 auto !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  width: 100% !important;
  min-height: 0 !important;
  margin: 0 0 18px !important;
  padding: 0 !important;
  gap: 12px !important;
  background: transparent !important;
}
#mbt-picker .mbt-dialog__head > div {
  display: block !important;
  position: static !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}
#mbt-picker #mbt-picker-title {
  position: static !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 1.375rem !important;
  line-height: 1.45 !important;
  color: #1c395d !important;
}
#mbt-picker .mbt-dialog__head p {
  position: static !important;
  display: block !important;
  margin: 6px 0 0 !important;
  line-height: 1.6 !important;
}
#mbt-picker .mbt-dialog__close {
  position: static !important;
  flex: 0 0 44px !important;
  width: 44px !important;
  height: 44px !important;
  margin: -6px -6px 0 0 !important;
}
#mbt-picker .mbt-picker-search {
  position: relative !important;
  display: block !important;
  flex: 0 0 52px !important;
  align-self: stretch !important;
  height: 52px !important;
  min-height: 52px !important;
  margin: 0 0 12px !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#mbt-picker .mbt-picker-search__input,
#mbt-picker .mbt-picker-search__input:focus {
  position: relative !important;
  inset: auto !important;
  display: block !important;
  float: none !important;
  width: 100% !important;
  height: 52px !important;
  min-height: 52px !important;
  max-height: 52px !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 16px 0 48px !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: none !important;
  transform: none !important;
  opacity: 1 !important;
}
#mbt-picker .mbt-picker-search__input {
  border: 1.5px solid #dce4ed !important;
  outline: none !important;
}
#mbt-picker .mbt-picker-search__input:focus {
  border-color: #2a578e !important;
  outline: 2px solid rgba(42,87,142,.14) !important;
  outline-offset: 2px !important;
}
#mbt-picker .mbt-picker-search__icon {
  position: absolute !important;
  inset: 16px auto auto 16px !important;
  transform: none !important;
  z-index: 3 !important;
  pointer-events: none !important;
}
#mbt-picker .mbt-dialog__list {
  position: relative !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 6px 0 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}
/* Match the mockup: visually distinct genre pills with row and column spacing. */
.mbt-v2-site .mbt-genres .mbt-chips {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  column-gap: 14px !important;
  row-gap: 14px !important;
  margin: 14px 0 0 !important;
  padding: 0 !important;
  list-style: none !important;
}
.mbt-v2-site .mbt-genres .mbt-chips > li {
  display: block !important;
  flex: 0 0 auto !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}
.mbt-v2-site .mbt-genres .mbt-chips > li > a {
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
  min-height: 44px !important;
  padding: 8px 20px !important;
  margin: 0 !important;
  line-height: 1.4 !important;
  text-decoration: none !important;
  border-radius: 999px !important;
}
@media (max-width: 639px) {
  #mbt-picker .mbt-dialog__panel {
    width: 100% !important;
    max-height: 88dvh !important;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom)) !important;
    border-radius: 18px 18px 0 0 !important;
  }
  #mbt-picker.mbt-dialog { align-items: flex-end !important; }
  .mbt-v2-site .mbt-genres .mbt-chips {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    margin: 12px 0 0 !important;
    padding: 0 !important;
    column-gap: 10px !important;
    row-gap: 10px !important;
  }
  .mbt-v2-site .mbt-genres .mbt-chips > li > a {
    padding: 8px 14px !important;
    min-height: 40px !important;
  }
}

/* v1.6 本人専用本棚：公開HTMLでは非表示のまま。 */
.mbt .mbt-shelfband[hidden] { display: none !important; }
.mbt .mbt-shelfband__sub { margin-top: 8px; color: var(--mbt-muted); font-size: .875rem; }
.mbt .mbt-shelfband__mypage { display: inline-block; margin-top: 14px; color: var(--mbt-blue); font-size: .875rem; font-weight: 700; }
.mbt .mbt-shelfband .mbt-book, .mbt .mbt-shelfband .mbt-book:visited { color: #fff; }
.mbt .mbt-shelfband .mbt-book--blank, .mbt .mbt-shelfband .mbt-book--blank:visited { color: var(--mbt-blue); }
.mbt .mbt-shelfband .mbt-next .mbt-btn--primary, .mbt .mbt-shelfband .mbt-next .mbt-btn--primary:visited { color: #fff; }

/* v1.8 — スマホ本棚の「新しいまちをつくる」背表紙を読みやすい追加カードに。
   既存ノートの背表紙やPC表示には影響させない。 */
@media (max-width: 639px) {
  .mbt .mbt-shelfband .mbt-books {
    align-items: flex-end;
    padding-bottom: 4px;
  }
  .mbt .mbt-shelfband .mbt-book--blank {
    flex: 0 0 96px;
    width: 96px;
    min-width: 96px;
    max-width: 96px;
    height: 150px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 14px 8px;
    border-radius: 8px 8px 3px 3px;
    text-align: center;
    white-space: normal;
    overflow: hidden;
    color: var(--mbt-blue);
    background: #fff;
    border: 1.5px dashed #9fb4cc;
    box-shadow: none;
  }
  .mbt .mbt-shelfband .mbt-book--blank .mbt-book__noimg {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--mbt-pale2);
  }
  .mbt .mbt-shelfband .mbt-book--blank .mbt-book__name {
    display: block;
    flex: 0 0 auto;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--mbt-blue);
    white-space: nowrap;
  }
  .mbt .mbt-shelfband .mbt-book--blank .mbt-book__state {
    display: block;
    flex: 0 0 auto;
    font-size: 12px;
    line-height: 1.2;
    color: var(--mbt-blue);
    opacity: 1;
    white-space: nowrap;
  }
}


/* v1.9 — PC本棚の追加用カードのみ調整。既存の本とスマホ版は変更しない。 */
@media (min-width: 800px) {
  .mbt .mbt-shelfband .mbt-book--blank {
    --thick: 104px;
    flex: 0 0 104px;
    width: 104px;
    min-width: 104px;
    max-width: 104px;
    height: 172px;
    min-height: 172px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 14px 8px;
    border-radius: 7px 7px 3px 3px;
    text-align: center;
    overflow: hidden;
    box-sizing: border-box;
  }
  .mbt .mbt-shelfband .mbt-book--blank .mbt-book__noimg {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 7px;
  }
  .mbt .mbt-shelfband .mbt-book--blank .mbt-book__name {
    flex: 0 0 auto;
    display: block;
    margin: 0;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    white-space: nowrap;
    font-size: 12px;
    line-height: 1.4;
    letter-spacing: 0;
    font-weight: 700;
    color: var(--mbt-blue);
  }
  .mbt .mbt-shelfband .mbt-book--blank .mbt-book__state {
    flex: 0 0 auto;
    display: block;
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
    opacity: 1;
    color: var(--mbt-blue);
  }
}
