/* =====================================================================
   Libit Home アルバムとタグのページ（D-050〜D-055）
   出典：Claude Design「Libit Home アルバムとタグ」2 回目（2026-11-17）の project/album-tag-v2.css
   アプリに入れるときに変えたこと：
   - .is-phone（キャンバスの iPhone の板）を @media (max-width: 767px) に置き換えた
   - 今のアプリの部品と名前がぶつかる .field を .search-field に変え、.empty（空のとき）は今のアプリの #empty を使うので外した
   - いちばん下の「アプリへのつなぎ」を足した（今の画面の枠・一覧の見出しに合わせる所）
   - 色は libit-tokens.css の変数だけ（新しい色はない）
   - 角：丸くするのはアルバムに関する所だけ（アルバムの枠・表紙・場所のカード・地図）。
     写真の一覧と見分けられるよう、アルバムは丸い角の細い枠で囲み、下に 1 枚重なった縁を見せる。
     ボタン・タグ・メニューなど、ほかは今のアプリと同じ四角（2026-11-17 決定）
   - 影は使わない（重なった縁は線で描く）。線は 1px
   - iPhone の幅は .is-phone で表している。アプリでは @media (max-width: 767px) に置き換える
   - 地図の上のボタンと出典は、地図の絵が明るいので、ライト・ダークとも白い地にする（写真の上の重ねと同じ考え）
   ===================================================================== */

/* ---- ページの見出し ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-4) var(--sp-16); }
.page-head h1 { margin: 0; font-family: var(--font-serif); font-size: var(--fs-24); font-weight: var(--fw-normal); line-height: var(--lh-head); letter-spacing: var(--ls-head); }
.page-head .meta { padding-bottom: 5px; font-size: var(--fs-13); color: var(--text-sub); }
.page-head .actions { margin-left: auto; display: flex; gap: var(--sp-8); }

/* ---- 年ごとのまとまり（PC：左に年、右にアルバム） ---- */
.year-row { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: var(--sp-24); padding-top: var(--sp-24); border-top: var(--line-w) solid var(--line-2); }
.year-row + .year-row { margin-top: var(--sp-32); }
.year-label { position: sticky; top: var(--sp-16); align-self: start; display: flex; flex-direction: column; gap: 2px; margin: 0; font-weight: var(--fw-normal); }
.year-label .y { font-family: var(--font-serif); font-size: var(--fs-32); line-height: 1.15; letter-spacing: .02em; }
.year-label .n { font-size: var(--fs-13); color: var(--text-sub); }

/* ---- アルバムの枠（カードと表紙で共通） ----
   丸い角の細い枠＋内側に 8px の余白（台紙）＋下に 1 枚重なった縁（5px）。
   重なった縁は box-shadow の「ぼかしなし」で線だけを描いている（影には見えない） */
.album-frame,
.album-tile,
.hero-cover { border: var(--line-w) solid var(--line); border-radius: var(--radius-m); background: var(--bg); box-shadow: 0 9px 0 -5px var(--bg), 0 9px 0 -4px var(--line); }

/* ---- アルバムのカード ---- */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: var(--sp-32) var(--sp-24); margin: 0; padding: 0; list-style: none; }
.album-grid > li { min-width: 0; }
.album-tile { display: flex; flex-direction: column; gap: var(--sp-12); min-width: 0; padding: var(--sp-8) var(--sp-8) var(--sp-12); color: inherit; text-decoration: none; transition: background-color var(--dur-fast) var(--ease); }
.album-tile:hover { background: var(--surface); }
.collage { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 3px; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius-s); }
.collage > * { min-width: 0; min-height: 0; background-color: var(--tile-bg); }
.collage > :first-child { grid-row: 1 / span 2; }
.collage > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.collage.is-2 { grid-template-rows: 1fr; }
.collage.is-2 > :first-child { grid-row: auto; }
.collage.is-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.collage.is-1 > :first-child { grid-row: auto; }
.tile-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 0 var(--sp-4); }
.tile-date { font-size: var(--fs-12); letter-spacing: .06em; color: var(--accent-strong); }
.tile-title { margin: 0; font-family: var(--font-serif); font-size: var(--fs-18); font-weight: var(--fw-normal); line-height: var(--lh-head); letter-spacing: .04em; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-meta { display: flex; align-items: center; gap: var(--sp-12); min-width: 0; font-size: var(--fs-13); line-height: var(--lh-ui); color: var(--text-sub); }
.tile-meta .count { flex: none; }

/* 場所（1 行。長いときは「…」。ないときは出さないだけで、ほかは動かない） */
.place-inline { display: inline-flex; align-items: center; gap: 3px; min-width: 0; }
.place-inline .icon { width: 14px; height: 14px; flex: none; stroke-width: 1.5; }
.place-inline > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 写真がまだない所（仮の絵） */
.pending { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-8); padding: var(--sp-8); background-color: var(--tile-bg); color: var(--text-sub); font-size: var(--fs-12); line-height: var(--lh-ui); text-align: center; }
.pending .mark { width: 32px; height: 32px; fill: currentColor; opacity: .55; }
.collage > .pending:not(:first-child) .mark { width: 20px; height: 20px; }

/* ---- 表紙の見出し（アルバムの中・タグの中） ---- */
.hero { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--sp-32); align-items: end; }
.hero-cover { padding: var(--sp-8); }
.hero-cover > * { display: block; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--radius-s); background-color: var(--tile-bg); }
.hero-cover > img { object-fit: cover; }
.hero-info { display: flex; flex-direction: column; gap: var(--sp-8); min-width: 0; }
.kicker { font-size: var(--fs-13); letter-spacing: .06em; color: var(--accent-strong); }
.hero-title { margin: 0; font-family: var(--font-serif); font-size: var(--fs-32); font-weight: var(--fw-normal); line-height: var(--lh-head); letter-spacing: var(--ls-head); overflow-wrap: anywhere; }
.hero-meta { font-size: var(--fs-14); line-height: var(--lh-ui); color: var(--text-sub); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin-top: var(--sp-8); }
.hero-actions .more { width: var(--btn-h); padding: 0; }
.hero-actions .more .icon { width: var(--icon-l); height: var(--icon-l); }

/* ---- 場所のカード（小さい地図＋場所の名前。押すと大きな地図） ---- */
.place-card { width: 100%; display: flex; align-items: center; gap: var(--sp-12); margin-top: var(--sp-8); padding: var(--sp-8); border: 0; border-radius: var(--radius-m); background: var(--surface); color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.place-card:hover { background: var(--line-2); }
.place-card .map { width: 104px; height: 104px; flex: none; border-radius: var(--radius-s); }
.place-card .text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.place-card .name { font-size: var(--fs-14); font-weight: var(--fw-bold); line-height: var(--lh-head); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.place-card .addr { font-size: var(--fs-12); line-height: var(--lh-ui); color: var(--text-sub); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.place-card .go { display: inline-flex; align-items: center; gap: 2px; margin-top: 2px; font-size: var(--fs-13); color: var(--accent-strong); }
.place-card .go .icon { width: 14px; height: 14px; stroke-width: 1.6; }
/* 場所がないとき（編集できる人だけ。見るだけの人には何も出さない） */
.place-add { width: 100%; min-height: var(--tap); display: flex; align-items: center; justify-content: center; gap: var(--sp-8); margin-top: var(--sp-8); border: var(--line-w) dashed var(--line); border-radius: var(--radius-m); background: none; color: var(--text-sub); font: inherit; font-size: var(--fs-14); cursor: pointer; }
.place-add:hover { background: var(--surface); }
.place-add .icon { width: var(--icon-s); height: var(--icon-s); stroke-width: 1.6; }

/* ---- 地図（小さい地図・大きな地図で共通） ---- */
.map { position: relative; display: block; overflow: hidden; background-color: var(--tile-bg); }
.map > svg.art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map-pin { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -26px 0 0 -13px; border: 3px solid #ffffff; border-radius: 50% 50% 50% 0; background: var(--accent); transform: rotate(-45deg); }
.map-pin::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #ffffff; }
.map-credit { position: absolute; right: 0; bottom: 0; padding: 1px 6px; background: rgba(255, 255, 255, .85); color: #3a2e33; font-size: var(--fs-10); line-height: 1.4; letter-spacing: 0; }
.map-btn { width: var(--tap); height: var(--tap); display: inline-flex; align-items: center; justify-content: center; border: var(--line-w) solid rgba(0, 0, 0, .12); border-radius: 50%; background: #ffffff; color: #3a2e33; cursor: pointer; }
.map-btn .icon { width: var(--icon-l); height: var(--icon-l); stroke-width: 1.5; }
.map-zoom { position: absolute; right: var(--sp-12); display: flex; flex-direction: column; overflow: hidden; border: var(--line-w) solid rgba(0, 0, 0, .12); border-radius: var(--radius-s); background: #ffffff; }
.map-zoom button { width: var(--tap); height: var(--tap); display: flex; align-items: center; justify-content: center; border: 0; background: none; color: #3a2e33; cursor: pointer; }
.map-zoom button + button { border-top: var(--line-w) solid rgba(0, 0, 0, .12); }
.map-zoom .icon { width: var(--icon-m); height: var(--icon-m); stroke-width: 1.6; }

/* 大きな地図（iPhone：画面いっぱい＋下のカード） */
.map-screen { position: relative; height: 100%; display: flex; flex-direction: column; }
.map-screen > .map { flex: 1; }
.map-screen .map-top { position: absolute; top: var(--sp-12); left: var(--sp-12); right: var(--sp-12); display: flex; justify-content: space-between; }
.map-sheet { position: relative; margin-top: -20px; display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-12) var(--sp-16) var(--sp-24); border-radius: var(--radius-l) var(--radius-l) 0 0; background: var(--bg); }
.grab { width: 36px; height: 4px; margin: 0 auto var(--sp-8); border-radius: 2px; background: var(--line); }
.map-sheet .from { font-size: var(--fs-13); letter-spacing: .06em; color: var(--accent-strong); }
.map-sheet .name { margin: 0; font-family: var(--font-serif); font-size: var(--fs-24); font-weight: var(--fw-normal); line-height: var(--lh-head); letter-spacing: .04em; overflow-wrap: anywhere; }
.map-sheet .addr { font-size: var(--fs-14); color: var(--text-sub); }
.map-sheet .actions { display: flex; gap: var(--sp-8); margin-top: var(--sp-12); }
.map-sheet .actions .btn { flex: 1; height: var(--tap); padding: 0 var(--sp-12); }

/* 大きな地図（PC：窓） */
.map-dialog { width: min(880px, 100%); display: flex; flex-direction: column; overflow: hidden; border: var(--line-w) solid var(--line); border-radius: var(--radius-l); background: var(--bg); }
.map-dialog > header { display: flex; align-items: center; gap: var(--sp-12); padding: var(--sp-8) var(--sp-8) var(--sp-8) var(--sp-24); }
.map-dialog > header h2 { flex: 1; margin: 0; font-family: var(--font-serif); font-size: var(--fs-18); font-weight: var(--fw-normal); letter-spacing: .04em; }
.map-dialog > .map { height: 440px; }
.map-dialog > footer { display: flex; align-items: center; gap: var(--sp-16); padding: var(--sp-16) var(--sp-24); }
.map-dialog > footer .text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.map-dialog > footer .name { font-size: var(--fs-16); font-weight: var(--fw-bold); }
.map-dialog > footer .addr { font-size: var(--fs-13); color: var(--text-sub); }

/* ---- 日・月の区切り（今の .grid-section の見た目をこれに合わせる） ---- */
.day-sec + .day-sec { margin-top: var(--sp-32); }
.sec-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 var(--sp-12); padding-bottom: var(--sp-8); }
.sec-head .label { font-family: var(--font-serif); font-size: var(--fs-18); letter-spacing: .04em; }
.sec-head .date { font-size: var(--fs-14); }
.sec-head .sub { font-size: var(--fs-12); color: var(--text-sub); }
.sec-head .sec-select { margin-left: auto; align-self: center; height: 28px; padding: 0 var(--sp-8); border: 0; background: none; color: var(--accent-strong); font: inherit; font-size: var(--fs-13); cursor: pointer; }

/* ---- タグの一覧：開け閉め（Notion のトグルのように、押すと開く・閉じる） ----
   「人」はグループではない（人の印 kind = person のタグ）。いちばん上に置き、開け閉めの形だけ同じ。
   その下に「グループ」の帯、季節・場所・イベントなどのグループ、最後に「そのほか」 */
.group { border-top: var(--line-w) solid var(--line-2); }
.group.is-people { border-top: 0; }
.group-head { display: flex; align-items: center; gap: var(--sp-8); }
.group-toggle { flex: 1; min-width: 0; min-height: 52px; display: flex; align-items: center; gap: var(--sp-8); padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.group-toggle .tri { width: 18px; height: 18px; flex: none; fill: currentColor; stroke: none; color: var(--text-sub); transition: transform var(--dur-fast) var(--ease); }
.group-toggle[aria-expanded="true"] .tri { transform: rotate(90deg); }
.group-toggle .label { flex: none; font-family: var(--font-serif); font-size: var(--fs-18); letter-spacing: .04em; }
.group-toggle .n { flex: none; font-size: var(--fs-13); color: var(--text-sub); }
.group-toggle .summary { min-width: 0; margin-left: var(--sp-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-13); color: var(--text-sub); }
.group-toggle[aria-expanded="true"] .summary { display: none; }
.group-head .more { flex: none; display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--sp-4); color: var(--accent-strong); font-size: var(--fs-13); text-decoration: none; }
.group-body { padding: var(--sp-4) 0 var(--sp-24); }
.group-body[hidden] { display: none; }
/* 「グループ」の帯（人とグループを分ける） */
.groups-bar { display: flex; align-items: center; gap: var(--sp-12); margin-top: var(--sp-24); padding: var(--sp-8) 0; border-top: var(--line-w) solid var(--line); }
.groups-bar .label { font-size: var(--fs-12); font-weight: var(--fw-bold); letter-spacing: .12em; color: var(--text-sub); }
.groups-bar .btn { margin-left: auto; }
.groups-bar + .group { border-top: 0; }

/* 人の丸い写真の並び（多いときは横に送る） */
.people { display: flex; gap: var(--sp-16); margin: 0 calc(-1 * var(--sp-32)); padding: 0 var(--sp-32) var(--sp-4); overflow-x: auto; list-style: none; scrollbar-width: none; }
.people::-webkit-scrollbar { display: none; }
.people > li { flex: none; display: flex; }
.person { width: calc(var(--face-l) + var(--sp-16)); display: flex; flex-direction: column; align-items: center; gap: var(--sp-8); color: inherit; text-decoration: none; text-align: center; }
.face { width: var(--face-l); height: var(--face-l); flex: none; border-radius: 50%; overflow: hidden; background-color: var(--tile-bg); }
.face > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.person .text { display: flex; flex-direction: column; align-items: center; min-width: 0; max-width: 100%; }
.person .name { font-size: var(--fs-14); line-height: 1.35; letter-spacing: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.person .count { font-size: var(--fs-12); line-height: var(--lh-ui); color: var(--text-sub); }
.person:hover .face { outline: 2px solid var(--accent); outline-offset: 2px; }
.person.is-unnamed .face { display: flex; align-items: center; justify-content: center; border: var(--line-w) dashed var(--text-sub); background-color: transparent; color: var(--text-sub); }
.person.is-unnamed .face svg { width: 40%; height: 40%; fill: none; stroke: currentColor; stroke-width: 1.3; }

/* タグのカード（グループの中。正方形の表紙＋名前＋枚数。四角） */
.tag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: var(--sp-20) var(--sp-16); margin: 0; padding: 0; list-style: none; }
.tag-grid > li { min-width: 0; }
.tag-tile { display: flex; flex-direction: column; gap: var(--sp-8); min-width: 0; color: inherit; text-decoration: none; }
.tag-tile .cover { aspect-ratio: 1 / 1; overflow: hidden; background-color: var(--tile-bg); }
.tag-tile .text { display: flex; flex-direction: column; min-width: 0; }
.tag-tile .name { font-size: var(--fs-14); font-weight: var(--fw-bold); line-height: 1.4; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag-tile .count { font-size: var(--fs-12); color: var(--text-sub); }
.tag-tile:hover .name { text-decoration: underline; text-underline-offset: 3px; }

/* ---- 戻る（iPhone） ---- */
.back { display: inline-flex; align-items: center; gap: 2px; height: var(--tap); padding: 0 var(--sp-8) 0 0; color: var(--accent-strong); font-size: var(--fs-14); text-decoration: none; }
.back .icon { width: var(--icon-l); height: var(--icon-l); }

/* ---- メニュー・下から出る画面・選ぶ行（四角） ---- */
.menu { min-width: 220px; margin: 0; padding: var(--sp-4) 0; list-style: none; border: var(--line-w) solid var(--line); background: var(--bg); }
.menu button { width: 100%; min-height: var(--tap); display: flex; align-items: center; gap: var(--sp-12); padding: 0 var(--sp-16); border: 0; background: none; color: var(--text); font: inherit; font-size: var(--fs-14); text-align: left; cursor: pointer; }
.menu button:hover { background: var(--surface); }
.menu button.is-danger { color: var(--danger); }
.menu .sep { height: var(--line-w); margin: var(--sp-4) 0; background: var(--line-2); }

.sheet { display: flex; flex-direction: column; padding: var(--sp-8) var(--sp-16) var(--sp-16); border: var(--line-w) solid var(--line); border-bottom: 0; background: var(--bg); }
.sheet-head { display: flex; align-items: center; gap: var(--sp-8); min-height: 48px; }
.sheet-head h2 { flex: 1; margin: 0; font-family: var(--font-serif); font-size: var(--fs-18); font-weight: var(--fw-normal); letter-spacing: .04em; }
.sheet-head .done { min-height: var(--tap); padding: 0 var(--sp-4); border: 0; background: none; color: var(--accent-strong); font: inherit; font-size: var(--fs-16); font-weight: var(--fw-bold); cursor: pointer; }
.sheet-note { margin: 0 0 var(--sp-8); font-size: var(--fs-13); line-height: var(--lh-text); color: var(--text-sub); }
.rows { margin: 0; padding: 0; list-style: none; }
.rows > li { min-height: 52px; display: flex; align-items: center; gap: var(--sp-12); border-bottom: var(--line-w) solid var(--line-2); }
.rows .grow { flex: 1; min-width: 0; }
.rows .main { display: block; font-size: var(--fs-16); }
.rows .sub { display: block; font-size: var(--fs-12); color: var(--text-sub); }
.rows .handle { width: var(--icon-l); height: var(--icon-l); color: var(--text-sub); }
.rows .check { width: var(--icon-l); height: var(--icon-l); color: var(--accent-strong); stroke-width: 2; }
.rows .link { min-height: var(--tap); display: inline-flex; align-items: center; color: var(--accent-strong); font-size: var(--fs-14); text-decoration: none; }
.rows .add { color: var(--accent-strong); font-size: var(--fs-16); }

.search-field { display: flex; align-items: center; gap: var(--sp-8); height: 48px; padding: 0 var(--sp-12); border: var(--line-w) solid var(--line); background: var(--bg); }
.search-field:focus-within { border-color: var(--accent-strong); }
.search-field .icon { width: var(--icon-l); height: var(--icon-l); color: var(--text-sub); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: var(--fs-16); }


/* =====================================================================
   iPhone の幅（キャンバスの .is-phone）
   ===================================================================== */
@media (max-width: 767px) {
  .page-head { align-items: center; }
  .page-head .meta { order: 3; flex-basis: 100%; margin-top: -6px; padding: 0; }
  .page-head .actions .btn { height: var(--tap); }
  .year-row { grid-template-columns: minmax(0, 1fr); gap: var(--sp-12); padding-top: var(--sp-16); }
  .year-row + .year-row { margin-top: var(--sp-24); }
  .year-label { position: static; flex-direction: row; align-items: baseline; gap: var(--sp-12); }
  .year-label .y { font-size: var(--fs-24); }
  .album-grid { grid-template-columns: minmax(0, 1fr); gap: var(--sp-24); }
  .collage { aspect-ratio: 2 / 1; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: var(--sp-20); }
  .hero-cover > * { aspect-ratio: 4 / 3; }
  .hero-title { font-size: var(--fs-24); }
  .hero-actions .btn { height: var(--tap); }
  .hero-actions .btn.is-primary,
  .hero-actions .btn.is-wide { flex: 1; }
  .hero-actions .more { width: var(--tap); }
  .place-card .map { width: 88px; height: 88px; }
  .place-card .name { font-size: var(--fs-16); }
  .sec-head .label { font-size: var(--fs-16); }
  .sec-head .sec-select { height: var(--tap); margin-right: calc(-1 * var(--sp-8)); }
  .groups-bar .btn { height: var(--tap); }
  .people { gap: var(--sp-12); margin: 0 calc(-1 * var(--sp-16)); padding: 0 var(--sp-16) var(--sp-4); }
  .person { width: calc(var(--face-m) + var(--sp-12)); }
  .face { width: var(--face-m); height: var(--face-m); }
  .person .name { font-size: var(--fs-13); }
  .tag-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-16) var(--sp-8); }
}

/* =====================================================================
   アプリへのつなぎ（キャンバスにはない。今の画面の枠・部品に合わせる所）
   ===================================================================== */
/* アルバム・タグの一覧のページ（#page.is-at）：キャンバスの余白（見出しの下 32px）を使うため、今の .page の間（16px）を外す */
.page.is-at { display: block; max-width: 1200px; }
.page.is-at > .page-head + * { margin-top: var(--sp-32); }

/* アルバム・タグの中の見出し（#hero）。下の写真の一覧との間はキャンバスと同じ 48px（.content の間 24px＋24px） */
.hero-box { flex: none; max-width: 1200px; margin-bottom: var(--sp-24); }
.hero-box[hidden] { display: none; }
.hero-box > .back { display: none; }
.hero-cover > .pending { display: flex; }
.hero-cover > img { height: auto; }

/* タグの中の表紙：角は四角・枠なし（丸くするのはアルバムに関する所だけ。D-054） */
.tag-cover { display: block; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; background-color: var(--tile-bg); }
.tag-cover > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tag-cover > .pending { height: 100%; }

/* タグのカード・人の丸い写真の画像 */
.tag-tile .cover > img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 場所のカードの小さい地図（Google は画像、国土地理院は動かない地図）。印と出典は地図の上に重ねる */
.place-card .map > .static-map,
.place-card .map > .map-tiles { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.place-card .map > .static-map { object-fit: cover; display: block; }
.place-card .map .map-pin,
.place-card .map .map-credit { z-index: 1; }
.map-none { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--accent); }
.map-none .icon { width: 36px; height: 36px; stroke-width: 1.2; }
button.place-card { line-height: inherit; }

/* 大きな地図：iPhone は画面いっぱい＋下のカード、PC は窓 */
.map-screen.is-overlay { position: fixed; inset: 0; z-index: var(--z-dialog); height: auto; background: var(--bg); }
.map-screen.is-overlay > .map { flex: 1; min-height: 0; isolation: isolate; } /* 国土地理院の地図（Leaflet）の部品は z-index 1000 まで使う。地図の中に閉じ込めて、左上の「閉じる」を隠さない */
.map-screen.is-overlay .map-top { z-index: 2; top: calc(var(--sp-12) + env(safe-area-inset-top)); }
.map-screen.is-overlay .leaflet-top.leaflet-left { top: calc(var(--tap) + var(--sp-12)); } /* 「＋／−」は「閉じる」の下へ */
.map-screen.is-overlay .map-sheet { z-index: 2; padding-bottom: calc(var(--sp-24) + env(safe-area-inset-bottom)); }
/* 地図の下の端には Google・国土地理院の表記がある。下のカードを重ねると隠れるので、アプリでは重ねない（Google の決まり：表記を隠さない） */
.map-screen.is-overlay .map-sheet { margin-top: 0; }
.map-backdrop { position: fixed; inset: 0; z-index: var(--z-dialog); display: flex; align-items: flex-start; justify-content: center; padding: max(48px, 10vh) var(--sp-24) var(--sp-24); background: var(--scrim); overflow-y: auto; }
.map-dialog > .map { flex: none; }
.map-dialog > footer .btn { flex: none; }
.map-dialog a.btn,
.map-sheet a.btn { text-decoration: none; }

/* ⋯ のメニュー（押した所の近くに出す） */
.menu.is-pop { position: fixed; z-index: calc(var(--z-dialog) + 1); max-width: calc(100vw - 16px); }
.menu button .t { flex: 1; min-width: 0; }
.menu button > .icon { width: var(--icon-m); height: var(--icon-m); flex: none; stroke-width: 1.4; }
.menu button > .check { color: var(--accent-strong); stroke-width: 2; }
.menu button[aria-checked="true"] { font-weight: var(--fw-bold); }
.hero-actions .btn.is-wide > .icon:last-child { width: var(--icon-s); height: var(--icon-s); }

/* タグの一覧 */
.group-empty { margin: 0; padding: var(--sp-4) 0 var(--sp-8); display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-4) var(--sp-12); font-size: var(--fs-13); line-height: var(--lh-text); color: var(--text-sub); }
.group-head button.more { border: 0; background: none; font: inherit; font-size: var(--fs-13); cursor: pointer; }
.group-head .more[hidden],
.group-head .scroll-btn[hidden] { display: none; }
.group-head .scroll-btn { width: 32px; height: 32px; flex: none; border: var(--line-w) solid var(--line); }
.group-head .scroll-btn .icon { width: var(--icon-s); height: var(--icon-s); }
.people.is-all { flex-wrap: wrap; overflow: visible; row-gap: var(--sp-16); }

/* グループを編集・タグを選ぶ（今のダイアログの中に、キャンバスの .rows を使う） */
.dialog-body.groups-editor { gap: var(--sp-8); }
.groups-editor .rows > li { gap: var(--sp-8); }
.groups-editor .drag { width: 36px; height: var(--tap); flex: none; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; background: none; color: var(--text-sub); cursor: grab; touch-action: none; }
.groups-editor .drag-space { width: 36px; flex: none; }
.groups-editor li.is-dragging { background: var(--surface); }
.groups-editor .link { flex: none; padding: 0 var(--sp-4); border: 0; background: none; font: inherit; font-size: var(--fs-14); cursor: pointer; }
.groups-editor .add { min-height: var(--tap); display: inline-flex; align-items: center; gap: var(--sp-8); padding: 0; border: 0; background: none; font: inherit; font-size: var(--fs-16); cursor: pointer; }
.groups-editor .add .icon { width: var(--icon-l); height: var(--icon-l); }
.check-rows { max-height: min(56vh, 520px); overflow-y: auto; border-top: var(--line-w) solid var(--line-2); }
.check-rows label { flex: 1; min-width: 0; min-height: 52px; display: flex; align-items: center; gap: var(--sp-12); cursor: pointer; }
.check-rows input { width: 20px; height: 20px; flex: none; margin: 0 0 0 var(--sp-4); accent-color: var(--accent-strong); }

/* タグの編集のページ（/photo/tags/edit）。読みやすい幅にし、まとまりごとに見出しと行を並べる（四角） */
.page.tag-edit { max-width: 820px; }
.page.tag-edit > .back { display: none; }
.page.tag-edit > .page-head + * { display: flex; flex-direction: column; gap: var(--sp-16); }
.edit-note { margin: 0; font-size: var(--fs-13); line-height: var(--lh-text); color: var(--text-sub); }
.tag-edit .search-field { max-width: 420px; }
.tag-edit .search-field input::-webkit-search-cancel-button { cursor: pointer; }
.edit-sec { margin-top: var(--sp-16); }
.edit-sec[hidden] { display: none; }
.edit-head { display: flex; align-items: center; gap: var(--sp-8) var(--sp-12); flex-wrap: wrap; min-height: 52px; border-bottom: var(--line-w) solid var(--line); }
.edit-head .label { margin: 0; font-family: var(--font-serif); font-size: var(--fs-18); font-weight: var(--fw-normal); letter-spacing: .04em; }
.edit-head .n { font-size: var(--fs-13); color: var(--text-sub); }
.edit-head .note { font-size: var(--fs-12); color: var(--text-sub); }
.edit-head .grow { flex: 1; }
.edit-rows > li { min-height: 52px; gap: var(--sp-8); }
.edit-rows > li[hidden] { display: none; }
.edit-rows a.grow { min-height: 52px; display: flex; align-items: center; gap: var(--sp-12); color: inherit; text-decoration: none; }
.edit-rows a.grow .main { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-rows a.grow .sub { display: block; flex: none; }
.edit-rows a.grow:hover .main { text-decoration: underline; text-underline-offset: 3px; }
.edit-rows .empty-row { min-height: 52px; }
.edit-rows .empty-row .sub { font-size: var(--fs-13); line-height: var(--lh-text); }
.row-more { flex: none; }
.row-more .icon { stroke-width: 2.6; }
.edit-select { width: 100%; height: var(--tap); padding: 0 var(--sp-12); border: var(--line-w) solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit; font-size: var(--fs-16); }
.menu.is-pop { max-height: calc(100vh - 16px); overflow-y: auto; }
.menu .menu-heading { padding: var(--sp-8) var(--sp-16) var(--sp-4); font-size: var(--fs-12); font-weight: var(--fw-bold); letter-spacing: .08em; color: var(--text-sub); }

/* 「表紙を変える」で写真を選んでいるとき */
body.picking-cover .grid .tile { cursor: cell; }
body.picking-cover .grid .tile:hover { outline: 3px solid var(--accent); outline-offset: -3px; }

/* 一覧の区切りの見出し：今の .grid-section をキャンバスの .sec-head に合わせる（日付の後ろに枚数、右に「この日を選ぶ」） */
.grid-section { flex-wrap: wrap; align-content: flex-end; align-items: baseline; gap: 0 var(--sp-12); }
.grid-section .label { letter-spacing: .04em; }
.grid-section .date { font-size: var(--fs-14); color: var(--text); }
.grid-section .sec-select { align-self: center; }

@media (max-width: 767px) {
  .page.is-at > .page-head + * { margin-top: var(--sp-16); }
  .hero-box { margin-bottom: var(--sp-16); }
  .hero-box > .back,
  .page.tag-edit > .back { display: inline-flex; margin: -8px 0 4px; }
  .page.tag-edit .page-head .actions { order: 4; flex-basis: 100%; margin: var(--sp-4) 0 0; }
  .page.tag-edit .page-head .actions .btn { flex: 1; }
  /* 表紙のある画面では、上のパンくずの代わりに「‹ アルバム」で戻る */
  .main:has(#hero:not([hidden])) .breadcrumb,
  .main:has(.page.is-at:not([hidden])) .breadcrumb { display: none; }
  .tag-cover { aspect-ratio: 4 / 3; }
  .group-head .scroll-btn { display: none; }
  .map-backdrop { padding: 0; }
}
