:root {
  --bg: #faf7f2;
  --fg: #2b2118;
  --muted: #7a6a5c;
  --line: #e4dccf;
  --accent: #7b4a2a;
  --card: #fff;
  --steam: color-mix(in srgb, var(--accent) 35%, var(--bg));
  --warning: #9a6a00;
  --heart: #b8532e;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1c1713; --fg: #eee5da; --muted: #a89684; --line: #3a3029; --accent: #d49a6a; --card: #251e19; --steam: #eee5da; --warning: #e0b34d; --heart: #e88a62; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 system-ui, "Hiragino Sans", sans-serif; }
header { background: transparent; }
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 { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 700; font-size: 1.2rem; color: var(--accent); margin-right: auto; }
a { color: var(--accent); }
/* href の無い a（お店未選択時の表示など）は普通のテキストとして見せる */
a:not([href]) { color: inherit; text-decoration: none; cursor: default; }
h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.01em; margin: 16px 0 12px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
.muted { color: var(--muted); font-size: 0.9rem; }
/* .card: 一覧の1件分。.editing: フォームが開いて編集・入力中であることを示す枠（見た目は同じでも別の意味なのでクラスは分ける） */
.card, .editing { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 2px 8px rgb(43 33 24 / 0.08); 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 { color: var(--fg); text-decoration: none; }
.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; color: var(--heart); 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(--heart); }
.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; }
form hr { border: 0; border-top: 1px dashed var(--line); width: 100%; margin: 0; }
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; }
.review-actions { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.review-actions button[data-edit] { padding: 8px 20px; }
.card.mine { border-color: var(--accent); }
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); }
.back-link { display: inline-block; margin-bottom: 4px; text-decoration: none; }
.shop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.shop-list button { display: block; width: 100%; text-align: left; background: var(--card); color: var(--fg); }
.shop-list small { color: var(--muted); }
.search-row { grid-template-columns: 1fr auto; align-items: end; }
/* 「手入力で登録」「お店を追加」など、ページ内で展開するフォームの入口（details の summary や単体の a/button で使う） */
.dashed-btn { display: block; list-style: none; text-align: center; border: 1px dashed var(--line); border-radius: 8px; padding: 10px 16px; margin: 8px 0; color: var(--fg); text-decoration: none; cursor: pointer; }
.dashed-btn::-webkit-details-marker, .dashed-btn::marker { display: none; content: ""; }
details[open] > .dashed-btn { margin-bottom: 8px; }
.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: 999px; padding: 0 18px; box-shadow: 0 3px 10px rgb(43 33 24 / 0.08); }
#search svg, .find-by svg, header .brand 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); }
/* main の左右の余白（16px）まで広げ、スクロール中のチップが画面の端で切れるようにする。先頭・末尾は余白ぶん内側から始まる */
.chips { display: flex; gap: 8px; margin: 12px -16px; padding: 2px 16px; overflow-x: auto; scrollbar-width: none; }
.chips button { flex: none; white-space: nowrap; background: var(--card); color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 6px 14px; font-size: 0.9rem; }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--card); }
.find-by { position: relative; display: flex; gap: 2px; margin: 12px 0; padding: 4px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 10%, var(--card)); font-size: 0.9rem; }
/* 選択中の塗りはタブとは別の 1 枚にして、切り替えたときに横へスライドさせる（タブは同じ幅で 3 つ、間は 2px） */
.find-by::before { content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 12px) / 3); border-radius: 999px; background: var(--accent); }
.find-by:not(:has([aria-current]))::before { opacity: 0; }
.find-by:has(a:nth-child(2)[aria-current])::before { transform: translateX(calc(100% + 2px)); }
.find-by:has(a:nth-child(3)[aria-current])::before { transform: translateX(calc(200% + 4px)); }
@media (prefers-reduced-motion: no-preference) {
  .find-by::before { transition: transform 0.2s ease-out; }
  .find-by a { transition: color 0.2s; }
}
.coffee-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.coffee-grid .card { margin: 0; }
.log-line { display: flex; align-items: center; gap: 4px; }
.log-line svg { width: 14px; height: 14px; color: var(--heart); }
.log-badge { padding: 1px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.find-by a { position: relative; flex: 1; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 6px 4px; white-space: nowrap; border-radius: 999px; text-decoration: none; }
.find-by svg { width: 14px; height: 14px; }
header .brand svg { width: 22px; height: 22px; }
header .brand svg { overflow: visible; }
header .brand .steam.icon { stroke: var(--steam); stroke-width: 1.6; }
header .brand .steam.veil { color: var(--steam); stroke: none; opacity: 0.5; }
/* icon: 3本が少しずつずれて、ふわっと現れて浮き、薄れて消える。
   veil: 低く湧いて伸び上がり、少し広がって消える。透明度をちょうど 0 にすると Chrome がフィルターの範囲を黒く塗るため 0.01 で止める */
@media (prefers-reduced-motion: no-preference) {
  header .brand .steam.icon path { animation: steam-icon 4s ease-in-out infinite both; }
  header .brand .steam.icon path:nth-child(2) { animation-delay: 0.5s; }
  header .brand .steam.icon path:nth-child(3) { animation-delay: 1s; }
  header .brand .steam.veil { opacity: 1; }
  header .brand .steam.veil path { transform-box: fill-box; transform-origin: bottom; animation: steam-veil 5s ease-out infinite; }
}
@keyframes steam-icon {
  0% { opacity: 0; transform: translateY(1px); }
  30%, 50% { opacity: 1; }
  80%, 100% { opacity: 0; transform: translateY(-1.5px); }
}
@keyframes steam-veil {
  0% { opacity: 0.01; transform: translateY(0) scale(0.9, 0.3); }
  25% { opacity: 0.55; }
  64%, 100% { opacity: 0.01; transform: translateY(-2px) scale(1.2, 1.1); }
}
.find-by a[aria-current] { font-weight: 700; color: var(--card); }
.coffee-grid .cover { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; border-radius: 10px; 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 (prefers-reduced-motion: no-preference) {
  .card { transition: transform 0.15s, box-shadow 0.15s; }
  .card:has(.card-link):is(:hover, :active) { transform: translateY(-3px); box-shadow: 0 8px 18px rgb(43 33 24 / 0.16); }
}
.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; }
header .menu { position: relative; }
header .menu summary { list-style: none; display: flex; padding: 4px; cursor: pointer; color: var(--accent); }
header .menu summary::-webkit-details-marker { display: none; }
header .menu summary svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
header .menu nav { position: absolute; right: 0; top: 100%; z-index: 10; display: flex; flex-direction: column; min-width: 12em; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 8px rgb(43 33 24 / 0.12); padding: 4px 0; }
header .menu nav a { padding: 10px 16px; text-decoration: none; white-space: nowrap; }
.policy table { width: 100%; border-collapse: collapse; font-size: 0.9rem; display: block; overflow-x: auto; }
.policy th, .policy td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
