/* 宿の検索ページの見た目。スマホを先に書き、広い画面は最後の @media で2列にする */

/* 色の役割:
   --accent（赤茶）＝押してほしいもの・選んでいるもの。予約のボタンと、地図で選んでいる宿のピンだけに使う
   地図の札: 1軒のピン＝--ink（黒）、選んでいるピン＝--accent（赤）、まとめた札・地域の札＝--sub（灰）（著者 2026-11-20）
   --station（青）＝駅。地図の駅の印と、駅の名前
   --ink・--sub ＝文字。値段は --ink の太字（赤にしない）
   地図の絵の色は mapstyle.js にある（ここの色に合わせてある） */
:root {
  color-scheme: light dark;
  --bg: #f7f4ef; --card: #fff; --ink: #1f1d1a; --sub: #6b655c; --line: #e3ddd2; --seg: #ebe6dc;
  --accent: #c4452d; --on-accent: #fff; --sel: #fff7f3;
  --station: #2f5d86; --on-station: #fff;
  --yes: #1b6b46; --yes-bg: #e2f1e8;
  --no: #6b655c; --no-bg: #efebe4;
  --unk: #7a5200; --unk-bg: #fff4d6; --unk-line: #d9a93a;
  --map: #f0ebe2;
  --shadow: 0 1px 2px rgba(31, 29, 26, .06), 0 2px 8px rgba(31, 29, 26, .06);
  --font: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}
:root:lang(ja) { --font: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif; }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614; --card: #22201d; --ink: #f0ece4; --sub: #a8a196; --line: #3a362f; --seg: #2b2824;
    --accent: #ff8468; --on-accent: #1b1210; --sel: #2c2320;
    --station: #9cc3e6; --on-station: #10202c;
    --yes: #84d6aa; --yes-bg: #183526;
    --no: #a8a196; --no-bg: #2e2b26;
    --unk: #f2c462; --unk-bg: #3a2e10; --unk-line: #8f6f1f;
    --map: #34312c;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  /* 列を minmax(0, 1fr) にしないと、横に流れる条件の列の幅でページ全体が広がる */
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr);
  height: 100vh; height: 100dvh; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font); -webkit-text-size-adjust: 100%;
}
button, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.panel { display: contents; }
.top { grid-row: 1; }
.filters { grid-row: 2; }
.mapwrap { grid-row: 3; }
#list { grid-row: 4; }
.sub { color: var(--sub); font-size: 12px; }
.msg { margin: 0; padding: 16px; color: var(--sub); font-size: 13px; }

/* ---- 上の帯 */
.top {
  display: flex; align-items: center; gap: 8px; min-height: 40px;
  padding: 4px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
.top h1 { margin: 0; font-size: 16px; line-height: 1.2; white-space: nowrap; }
.pr { margin: 0; flex: 1; min-width: 0; color: var(--sub); font-size: 11px; line-height: 1.2; }
#about-open { flex: none; min-height: 36px; padding: 0 6px; border: 0; background: none; color: var(--sub); font-size: 12px; text-decoration: underline; cursor: pointer; }
.langs a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 2px; color: var(--sub); font-size: 12px; white-space: nowrap; }

/* ---- 絞り込み */
.filters { padding: 4px 0 10px; }
.areas {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(64px, 1fr); overflow-x: auto;
  margin: 0 16px; padding: 3px; border-radius: 12px; background: var(--seg); scrollbar-width: none;
}
.areas button {
  height: 36px; border: 0; border-radius: 9px; background: none; font-weight: 600; font-size: 14px; cursor: pointer;
}
.areas button[aria-pressed="true"] { background: var(--card); box-shadow: var(--shadow); }
/* ここにしかない条件（大浴場・洗濯機・空港直通）と♡は、いつも見える段に置く。
   前は予算などと同じ列で横に流れていて、最初の画面に出ていなかった（2026-11-21） */
.conds { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px 0; }
.conds .chip { height: 34px; padding: 0 11px; font-size: 13px; }
.conds .chip[hidden] { display: none; }
.favchip { margin-left: auto; }
.conds .favchip[aria-pressed="true"]::before { content: none; }
/* 予算・日・駅・部屋は横に流す。右端を薄くして、続きがあることを見せる */
.chips {
  position: relative; display: flex; gap: 8px; overflow-x: auto; padding: 8px 28px 0 16px; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.chips::-webkit-scrollbar, .areas::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 19px;
  background: var(--card); font-size: 14px; white-space: nowrap; cursor: pointer;
}
select.chip {
  appearance: none; -webkit-appearance: none; padding-right: 30px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
}
.chip.on, .chip[aria-pressed="true"] { border-color: var(--ink); background-color: var(--ink); color: var(--bg); }
.chip[aria-pressed="true"]::before { content: "✓ "; }
.chip.small { height: 32px; padding-left: 12px; font-size: 13px; }
/* 泊まる日。見た目は他の札と同じにし、透明の日付入力を上に重ねて、押すと端末の日付選びが開く */
.chip.date { position: relative; display: inline-flex; align-items: center; }
.chip.date input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; cursor: pointer; }
.chip.date input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }

/* ---- 地図 */
.mapwrap {
  position: relative; height: 34vh; height: 34dvh; min-height: 170px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
body.bigmap .mapwrap { height: 62vh; height: 62dvh; }
body.nomap .mapwrap { height: auto; min-height: 0; }
body.nomap #map { position: static; }
#map { position: absolute; inset: 0; z-index: 0; background: var(--map); font: inherit; }
#mapsize {
  position: absolute; z-index: 1; left: 10px; bottom: 10px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 17px; background: var(--card); color: var(--ink);
  font-size: 13px; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); cursor: pointer;
}
#mapsize[hidden] { display: none; }
/* 地図を動かしたあとに出る「この範囲の○軒だけ並べる」 */
#inview {
  position: absolute; z-index: 2; left: 50%; top: 10px; transform: translateX(-50%); height: 36px; padding: 0 14px;
  border: 0; border-radius: 18px; background: var(--ink); color: var(--bg);
  font-size: 13px; font-weight: 700; white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); cursor: pointer;
}
#inview[hidden] { display: none; }
/* 地図の出典（右下の i）。サイトの色に合わせる */
.maplibregl-ctrl-attrib { font: 11px/1.4 var(--font); }
.maplibregl-ctrl-attrib.maplibregl-compact { background: var(--card); color: var(--sub); }
.maplibregl-ctrl-attrib a { color: inherit; }
/* 出典が開いているとき、左下の「地図を大きく」のボタンに重ならないようにする */
.maplibregl-ctrl-bottom-right { max-width: calc(100% - 124px); }

/* 地図の上の部品。.mk は大きさ0の箱で、地図の点に置かれる。中身を点の上や下にずらす */
.mk { width: 0; height: 0; }
.pin, .bubble {
  position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% - 8px));
  margin: 0; padding: 6px 9px; border: 2px solid var(--card); border-radius: 15px; appearance: none; -webkit-appearance: none;
  background: var(--ink); color: var(--bg); font: 700 13px/1 var(--font); white-space: nowrap;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .35); cursor: pointer;
}
.pin::after, .bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; width: 10px; height: 10px;
  background: inherit; border: inherit; border-width: 0 2px 2px 0; transform: translateX(-50%) rotate(45deg);
}
.pin.unknown, .bubble.unknown { background: var(--unk-bg); color: var(--unk); border: 2px dashed var(--unk-line); }
.pin.unknown::after, .bubble.unknown::after { border-style: dashed; }
.pin.sel { background: var(--accent); color: var(--on-accent); border: 2px solid var(--card); transform: translate(-50%, calc(-100% - 8px)) scale(1.15); transform-origin: 50% 100%; }
/* 近いピンをまとめた札。1軒のピンと見分けられるように、灰色の地にする */
.pin.group { background: var(--sub); color: var(--bg); }
.pin.group.unknown { background: var(--unk-bg); color: var(--unk); }
/* もう寄れない札を押して縦に並べたとき、いちばん下のピンだけが点を指す */
.pin.stack::after, .bubble.stack::after { display: none; }
.bubble { padding: 7px 11px; background: var(--sub); color: var(--bg); font-size: 14px; }
.bubble { text-align: center; line-height: 1.15; }
.bubble small { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; opacity: .85; }
.bubble.zero { background: var(--line); color: var(--sub); }
.pin.down, .bubble.down { transform: translate(-50%, 8px); }
.pin.down::after, .bubble.down::after { bottom: auto; top: -7px; border-width: 2px 0 0 2px; }
.pin.sel.down { transform: translate(-50%, 8px) scale(1.15); transform-origin: 50% 0; }
/* 駅（出口）の印。選んだ宿の駅には、名前と歩く分数を添える */
.stn {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  display: block; width: 14px; height: 14px;
  border: 3px solid var(--card); border-radius: 50%; background: var(--station); color: var(--on-station);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); pointer-events: none;
}
.stn b {
  position: absolute; left: 50%; transform: translateX(-50%); padding: 4px 8px; border-radius: 7px;
  background: var(--station); color: var(--on-station); font: 700 12px/1.2 var(--font); white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
.stn.up b { bottom: calc(100% + 5px); }
.stn.down b { top: calc(100% + 5px); }
.stn.right b { left: calc(100% + 5px); transform: none; }
.stn.left b { left: auto; right: calc(100% + 5px); transform: none; }

/* ---- 一覧 */
#list {
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 10px max(16px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.count { margin: 0; font-size: 14px; }
.count b { font-size: 18px; }
.clear { padding: 6px 0; border: 0; background: none; color: var(--accent); font-size: 13px; text-decoration: underline; cursor: pointer; }
#sort { margin-left: auto; }
.cards { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }

/* 宿のカード。上から: 写真と名前・駅・確かめたこと → 確かめていないこと（小さく） → 値段と予約のボタン → 値段の日付 */
.card {
  padding: 12px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); box-shadow: var(--shadow); cursor: pointer; scroll-margin: 8px;
}
.card.sel { border-color: var(--accent); background: var(--sel); box-shadow: 0 0 0 1px var(--accent); }
.main { display: flex; align-items: flex-start; gap: 12px; }
.photo { flex: none; width: 112px; margin: 0; }
.photo img { display: block; width: 112px; height: 75px; object-fit: cover; border-radius: 8px; background: var(--seg); }
.photo figcaption { margin-top: 2px; color: var(--sub); font-size: 10px; line-height: 1.3; }
.body { flex: 1; min-width: 0; }
.body h2 { margin: 0; font-size: 16px; line-height: 1.35; }
.name { padding: 0; border: 0; background: none; font-weight: 700; text-align: left; cursor: pointer; }
.where { margin: 3px 0 0; color: var(--sub); font-size: 13px; line-height: 1.45; }
.where b { color: var(--ink); font-weight: 600; word-break: keep-all; overflow-wrap: anywhere; }  /* 「走路2分」の途中で折り返さない */
.where span { margin: 0 2px; opacity: .5; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0 0; padding: 0; list-style: none; }
.tag { padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.tag b { margin-left: 2px; }
.tag.yes { background: var(--yes-bg); color: var(--yes); }
.tag.no, .tag.info { background: var(--no-bg); color: var(--no); }
.tag.info b { color: var(--ink); }
.memo { margin: 8px 0 0; font-size: 14px; }
.unk { margin: 8px 0 0; color: var(--sub); font-size: 12px; }
.unk span { margin: 0 4px; opacity: .5; }
.buy {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
}
.price { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.price small { color: var(--sub); font-size: 13px; font-weight: 600; }
.cta {
  display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: 8px; max-width: 230px; min-height: 44px; margin-left: auto;
  padding: 0 16px; border-radius: 22px; background: var(--accent); color: var(--on-accent);
  font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.badge { padding: 0 4px; border: 1px solid currentColor; border-radius: 4px; font-size: 10px; font-weight: 600; line-height: 1.5; }
.basis { margin: 6px 0 0; color: var(--sub); font-size: 12px; }
/* カードの下の段: 保存（♡）・共有・くわしく */
.foot { display: flex; align-items: center; gap: 4px; margin: 2px 0 -8px; }
.act { flex: none; min-height: 40px; padding: 0 10px 0 0; border: 0; background: none; color: var(--sub); font-size: 13px; cursor: pointer; }
.act.heart::before { content: "♡ "; }
.act.heart[aria-pressed="true"] { color: var(--accent); font-weight: 700; }
.act.heart[aria-pressed="true"]::before { content: "♥ "; }
.act.share::before { content: "↗ "; }
.toggle { flex: none; min-height: 40px; margin-left: auto; padding: 0 0 0 8px; border: 0; background: none; color: var(--sub); font-size: 13px; cursor: pointer; }
.toggle::after { content: " ▾"; }
.toggle[aria-expanded="true"]::after { content: " ▴"; }
.more { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.more[hidden] { display: none; }
.more dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.gmap { display: inline-flex; align-items: center; min-height: 40px; margin-top: 4px; color: var(--station); font-weight: 600; }
.more dt { color: var(--sub); white-space: nowrap; }
.more dd { margin: 0; }
.none { padding: 22px 12px; border: 1px dashed var(--line); border-radius: 14px; text-align: center; }
.none p { margin: 0; }
.none .sub { margin-top: 4px; }
.unsure { margin-top: 22px; }
.unsure h2 { margin: 0; font-size: 14px; }
.unsure .sub { margin: 2px 0 8px; }
.unsure .card { border-style: dashed; box-shadow: none; }
.unsure[hidden], .morebtn[hidden] { display: none; }
.morebtn { display: block; width: 100%; min-height: 44px; margin-top: 12px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); font-size: 14px; cursor: pointer; }
.clear.back { color: var(--ink); }
/* 「リンクをコピーしました」などの短い知らせ */
#toast {
  position: fixed; z-index: 50; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  margin: 0; padding: 10px 16px; border-radius: 20px; background: var(--ink); color: var(--bg); font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.show { opacity: 1; }
/* 「この地図について」 */
#about {
  width: min(92vw, 440px); max-height: 82vh; max-height: 82dvh; padding: 18px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); color: var(--ink); font-size: 14px; line-height: 1.6;
}
#about::backdrop { background: rgba(0, 0, 0, .45); }
#about h2 { margin: 0 0 8px; font-size: 16px; }
#about ul { margin: 0 0 10px; padding-left: 1.2em; }
#about li { margin-bottom: 6px; }
#about a { color: var(--accent); }
#about p { margin: 0 0 10px; }
.notes { margin-top: 22px; color: var(--sub); font-size: 12px; }
.notes p { margin: 0 0 6px; }
.notes a { color: var(--accent); }

/* ---- 広い画面: 左に上の帯・絞り込み・一覧、右に地図 */
@media (min-width: 900px), (orientation: landscape) and (min-width: 600px) and (max-height: 560px) {
  body { grid-template-columns: clamp(320px, 42vw, 460px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .panel { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-area: 1 / 1; min-height: 0; }
  .top, .filters, #list { grid-row: auto; }
  .mapwrap, body.bigmap .mapwrap, body.nomap .mapwrap { grid-area: 1 / 2; height: auto; min-height: 0; border: 0; border-left: 1px solid var(--line); }
  #mapsize { display: none; }
}
@media (min-width: 900px) {
  .chips { flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  #inview { top: 14px; }
  .top { min-height: 48px; }
}
/* ---- 横向きのスマホ: 高さが足りないので、左の列をまるごと流す */
@media (orientation: landscape) and (min-width: 600px) and (max-height: 560px) {
  .panel { display: block; overflow-y: auto; overscroll-behavior: contain; }
  #list { overflow: visible; }
}
