:root {
  --bg: #faf7f2;
  --fg: #2b2118;
  --muted: #7a6a5c;
  --line: #e4dccf;
  --accent: #7b4a2a;
  --card: #fff;
  --warning: #9a6a00;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1c1713; --fg: #eee5da; --muted: #a89684; --line: #3a3029; --accent: #d49a6a; --card: #251e19; --warning: #e0b34d; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 system-ui, "Hiragino Sans", sans-serif; }
header { border-bottom: 1px solid var(--line); background: var(--card); }
header .inner, main { max-width: 720px; margin: 0 auto; padding: 12px 16px; }
header .inner { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
header .brand { font-weight: 700; font-size: 1.2rem; color: var(--accent); margin-right: auto; }
a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: 16px 0 8px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
.muted { color: var(--muted); font-size: 0.9rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin: 8px 0; }
.card h3 { margin: 0 0 4px; font-size: 1rem; overflow-wrap: anywhere; }
/* 余白を押すと card-link へ飛び、カード内のほかのリンク・ボタンはその上に重ねて優先させる */
.card:has(.card-link) { position: relative; }
.card-link::after { content: ""; position: absolute; inset: 0; }
.card:has(.card-link) :is(a, button):not(.card-link) { position: relative; z-index: 1; }
.hearts svg { width: 1em; height: 1em; vertical-align: -0.125em; margin-right: 1px; }
.rating { margin: 0; padding: 0; border: 0; min-width: 0; }
.rating legend { padding: 0; font-size: 0.9rem; }
.rating > div { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 4px; }
.rating label { display: inline-flex; align-items: center; cursor: pointer; border-radius: 4px; }
.rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating label:has(input:focus-visible) { outline: 2px solid var(--accent); }
.rating .heart svg { width: 1.6rem; height: 1.6rem; color: var(--accent); }
.rating .heart svg:first-of-type, .rating .heart:has(input:checked) svg:last-of-type, .rating .heart:has(input:checked) ~ .heart svg:last-of-type { display: none; }
.rating .heart:has(input:checked) svg:first-of-type, .rating .heart:has(input:checked) ~ .heart svg:first-of-type { display: inline; }
.rating .none { margin-left: 8px; font-size: 0.9rem; color: var(--muted); }
.rating .none:has(input:checked) { color: var(--fg); }
form { display: grid; gap: 8px; }
label { display: grid; gap: 2px; font-size: 0.9rem; }
label[hidden] { display: none; }
/* label の font-size（0.9rem）を継承すると 16px 未満になり iPhone でフォーカス時にズームされるため、明示的に 16px にする */
/* grid/flex アイテムの min-width は初期値 auto（= 中身の最小内容サイズ）になり、
   input[type=file] 等の縮まないコンテンツが .row や form のグリッド幅を押し広げて横スクロールを起こすため 0 にする */
input, select, textarea, button { font: inherit; font-size: 1rem; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); min-width: 0; }
button { background: var(--accent); color: #fff; border: none; cursor: pointer; }
button.link { background: none; color: var(--accent); padding: 0; text-decoration: underline; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
/* 幅が狭いと auto-fit の列数が行ごとにばらつき、入力欄の横幅が不揃いになるため 1 列に固定する */
@media (max-width: 480px) {
  .row { grid-template-columns: 1fr; }
}
.error { color: #c0392b; }
.warning { color: var(--warning); }
details summary { cursor: pointer; color: var(--accent); }
.images { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.images img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; display: block; }
.thumb { display: grid; gap: 4px; justify-items: center; }
.images:empty { display: none; }
.shop-map { height: 260px; border-radius: 8px; margin: 8px 0; }
.shop-map-wrap { position: relative; }
/* Leaflet のペイン（z-index 〜700）より上に出す */
#search-here { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1000; border-radius: 999px; padding: 8px 16px; font-size: 0.9rem; box-shadow: 0 2px 6px rgb(0 0 0 / 0.25); }
#search { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; }
#search svg, .sub-links svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#search svg { width: 18px; height: 18px; color: var(--muted); }
#search input { flex: 1; border: none; background: transparent; padding: 10px 0; outline: none; }
#search:focus-within { outline: 2px solid var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chips button { background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 0.9rem; }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.sub-links { display: flex; gap: 16px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.coffee-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.coffee-grid .card { margin: 0; }
.sub-links a { display: inline-flex; align-items: center; gap: 5px; }
.sub-links svg { width: 14px; height: 14px; }
.sub-links a[aria-current] { font-weight: 700; text-decoration: none; }
.coffee-grid .cover { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; border-radius: 6px; margin-bottom: 8px; overflow: hidden; background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--accent); }
.coffee-grid .cover img { width: 100%; height: 100%; object-fit: cover; }
.coffee-grid .cover:not(:has(img)) { aspect-ratio: auto; height: 64px; }
.coffee-grid .cover svg { width: 26px; height: 26px; }
.coffee-grid > p { grid-column: 1 / -1; }
/* PC でマウスを動かすたびに色が変わるとうるさいので、タップのフィードバックとしてだけ出す */
@media (hover: none) {
  .card:has(.card-link):hover { border-color: var(--accent); }
  .coffee-grid .card:hover .cover:not(:has(img)) { background: var(--accent); color: var(--card); }
}
.lightbox { padding: 0; border: none; background: none; max-width: 100vw; max-height: 100vh; overflow: visible; }
.lightbox::backdrop { background: rgb(0 0 0 / 0.8); }
.lightbox img { display: block; max-width: 92vw; max-height: 88vh; border-radius: 6px; }
.lightbox [data-close] { position: fixed; top: 12px; right: 12px; background: rgb(0 0 0 / 0.5); font-size: 1.6rem; line-height: 1; width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.ad-slot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100; background: var(--bg); border-top: 1px solid var(--line); padding: 8px 16px; }
.ad-slot-box { display: flex; align-items: center; justify-content: center; box-sizing: border-box; max-width: 720px; margin: 0 auto; height: 60px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 0.9rem; overflow: hidden; }
body { padding-bottom: 78px; }
