/* ---------- テーマ（色・線・フォント） ---------- */
body {
  /* シンプル表示（従来の見た目） */
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f5f7fa; --ink: #1f2933; --muted: #616e7c;
  --line: #e4e7eb; --line-w: 1px; --accent: #e2553b; --accent-ink: #ffffff; --link: #b45309;
  --radius: 8px; --shadow: 0 6px 24px rgba(0, 0, 0, .18); --btn-shadow: none;
  --font: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif; --display: var(--font);
  --cold: #3b5fa0;
}
body.theme-craft {
  --bg: #e9dcc0; --surface: #f3e9d3; --surface-2: #fbf5e8; --ink: #2b3426; --muted: #5c5a4a;
  --line: #2b3426; --line-w: 2px; --accent: #c8552b; --accent-ink: #fff8ec; --link: #8f3a1a;
  --radius: 12px; --shadow: 4px 4px 0 #2b3426; --btn-shadow: 3px 3px 0 #2b3426;
  --font: "Zen Kaku Gothic New", -apple-system, "Hiragino Sans", sans-serif; --display: "Yusei Magic", var(--font);
  --cold: #2f4f7a;
}
body.theme-craft.view-night {
  --bg: #0f1630; --surface: #131c3b; --surface-2: #1b2650; --ink: #eef2ff; --muted: #c9d3f5;
  --line: #3a4a80; --accent: #ffd98a; --accent-ink: #131c3b; --link: #ffd98a;
  --shadow: 0 8px 28px rgba(0, 0, 0, .5); --btn-shadow: none; --cold: #9cc4ff;
}

/* ---------- 全体 ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { display: flex; flex-direction: column; font-family: var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--link); }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 10px 18px;
  background: var(--surface); border-bottom: var(--line-w) solid var(--line); z-index: 4; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark .tent-body { fill: var(--accent); stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.brand-mark .tent-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--display); font-size: 22px; }
.brand-sub { font-size: 10px; font-weight: 700; letter-spacing: .24em; color: var(--muted); }
body:not(.theme-craft) .brand-mark, body:not(.theme-craft) .brand-sub { display: none; }
body:not(.theme-craft) .brand-name { font-size: 17px; font-weight: 700; }

.search { position: relative; display: flex; align-items: center; gap: 8px; flex: 1 1 200px; max-width: 300px;
  padding: 7px 14px; background: var(--surface-2); border: var(--line-w) solid var(--line); border-radius: 999px; color: var(--ink); }
.search input { border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--ink); width: 100%; outline-offset: 4px; }
.search input::placeholder { color: var(--muted); }
.results { position: absolute; top: calc(100% + 6px); left: 0; width: 320px; max-width: 90vw; margin: 0; padding: 4px 0; list-style: none;
  background: var(--surface-2); border: var(--line-w) solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 6; }
.results li { padding: 7px 12px; cursor: pointer; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.results li span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.results li.active, .results li[data-i]:hover { background: var(--surface); outline: 1px dashed var(--line); outline-offset: -3px; }
.results li.empty { color: var(--muted); cursor: default; }

.month { display: flex; align-items: center; gap: 8px; }
.month span { font-family: var(--display); font-size: 20px; min-width: 2.8em; font-weight: 700; }
body.theme-craft .month span { font-weight: 400; }
.month input { width: 170px; accent-color: var(--accent); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13px; }
.filter select { margin-left: 4px; padding: 5px 6px; font: inherit; color: var(--ink); background: var(--surface-2);
  border: var(--line-w) solid var(--line); border-radius: 8px; }
.count { color: var(--muted); }
.simple-toggle { display: flex; align-items: center; gap: 4px; color: var(--muted); cursor: pointer; }

/* ---------- 地図 ---------- */
.stage { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }

.modes { position: absolute; top: 12px; left: 12px; display: flex; z-index: 3; overflow: hidden;
  border: var(--line-w) solid var(--line); border-radius: var(--radius); background: var(--surface-2); box-shadow: var(--btn-shadow);
  font-weight: 700; font-size: 14px; }
.modes button { font: inherit; padding: 9px 15px; border: 0; background: transparent; color: var(--ink); cursor: pointer; min-height: 44px; }
.modes button + button { border-left: var(--line-w) solid var(--line); }
.modes button[aria-pressed="true"] { background: var(--ink); color: var(--surface-2); }
body.view-night .modes button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
body:not(.theme-craft) .modes { display: none; }

.legend { position: absolute; left: 12px; bottom: 34px; z-index: 2; display: grid; gap: 3px; padding: 8px 12px; font-size: 12px;
  background: var(--surface-2); border: var(--line-w) solid var(--line); border-radius: var(--radius); box-shadow: var(--btn-shadow); }
.legend b { font-family: var(--display); font-weight: 400; font-size: 14px; }
body:not(.theme-craft) .legend b { font-weight: 700; font-size: 12px; }
.legend i { display: inline-block; width: 11px; height: 11px; margin-right: 6px; vertical-align: -1px; border: 1.5px solid var(--line); border-radius: 50%; }
body.theme-craft .legend i { border-radius: 2px; }

/* 選択中のキャンプ場（A案の大きなテント＋名札） */
.selected-marker { display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.selected-marker .tag { padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; white-space: nowrap;
  background: var(--accent); color: var(--accent-ink); border: 2px solid var(--line); margin-bottom: 4px; }
.selected-marker svg { overflow: visible; }

/* ---------- 詳細パネル ---------- */
.panel { position: absolute; top: 12px; right: 12px; width: 370px; max-height: calc(100% - 24px); overflow-y: auto; z-index: 5;
  padding: 16px 18px; background: var(--surface); border: var(--line-w) solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel h2 { font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.25; margin: 2px 26px 4px 0; }
body:not(.theme-craft) .panel h2 { font-weight: 700; font-size: 19px; }
.close { position: absolute; top: 6px; right: 8px; min-width: 44px; min-height: 44px; border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--muted); }
.meta { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; color: #7c2d12; background: #ffedd5; border-radius: 4px; padding: 2px 6px; }
.temps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.temps div { background: var(--surface-2); border: var(--line-w) solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.temps span { display: block; font-size: 12px; color: var(--muted); }
.temps strong { font-family: var(--display); font-weight: 400; font-size: 28px; }
body:not(.theme-craft) .temps strong { font-weight: 700; font-size: 24px; }
.temps .cold strong { color: var(--cold); }
.compare { font-size: 13px; margin: 8px 0 0; }
.chart { width: 100%; margin: 10px 0 2px; }
.chart .bar-cur { fill: var(--accent); }
.chart .bar { fill: #c9c59f; }
body:not(.theme-craft) .chart .bar { fill: #9cb7d4; }
body.view-night .chart .bar { fill: #3a4a80; }
.chart rect { stroke: var(--line); stroke-width: 1; }
body:not(.theme-craft) .chart rect { stroke: none; }
.chart text { fill: var(--muted); }
.chart line { stroke: var(--muted); }
.items h3 { font-family: var(--display); font-weight: 400; font-size: 18px; margin: 14px 0 4px; }
body:not(.theme-craft) .items h3 { font-weight: 700; font-size: 15px; }
.items h3 small { font-family: var(--font); font-size: 12px; color: var(--muted); }
.items p { font-size: 13px; margin: 0 0 8px; }
.items ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.items a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; text-decoration: none; color: inherit;
  background: var(--surface-2); border: var(--line-w) solid var(--line); border-radius: var(--radius); }
.items a:hover { background: var(--bg); }
.items a span { display: block; flex: 1; }
.items a strong { display: block; font-size: 14px; }
.items a small { display: block; font-size: 12px; color: var(--muted); }
.items a em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--link); white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 6px; }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
  text-decoration: none; color: var(--ink); background: var(--surface-2); border: var(--line-w) solid var(--line); border-radius: var(--radius); box-shadow: var(--btn-shadow); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.note { font-size: 11px; color: var(--muted); }

.credit { display: flex; flex-wrap: wrap; gap: 2px 14px; padding: 6px 16px; font-size: 11px; color: var(--muted);
  background: var(--surface); border-top: var(--line-w) solid var(--line); }

/* 地図のズームボタン・帰属表示をテーマに合わせる */
body.theme-craft .maplibregl-ctrl-group { border: 2px solid var(--line); border-radius: 10px; box-shadow: var(--btn-shadow); background: var(--surface-2); }
body.view-night .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
body.view-night .maplibregl-ctrl-attrib { background: rgba(19, 28, 59, .8); color: var(--muted); }
body.view-night .maplibregl-ctrl-attrib a { color: var(--muted); }

@media (max-width: 640px) {
  /* ヘッダーは3行に収めて地図を広く取る: ロゴ＋月 / 検索 / 絞り込み（横スクロール） */
  .bar { padding: 8px 12px; gap: 6px 12px; }
  .brand-mark { width: 26px; height: 22px; }
  .brand-name { font-size: 16px; }
  .brand-sub { display: none; }
  .month { margin-left: auto; gap: 4px; }
  .month span { font-size: 16px; min-width: 2.4em; }
  .month input { width: 96px; }
  .legend { grid-template-columns: repeat(2, auto); column-gap: 10px; font-size: 11px; padding: 6px 8px; }
  .legend b { grid-column: 1 / -1; font-size: 12px; }
  .credit { font-size: 10px; padding: 4px 10px; }
  .search { max-width: none; flex-basis: 100%; order: 3; padding: 6px 12px; }
  .controls { order: 4; flex-wrap: nowrap; overflow-x: auto; width: 100%; font-size: 12px; white-space: nowrap; padding-bottom: 2px; }
  .filter select { font-size: 12px; padding: 4px; }
  .panel { top: auto; bottom: 0; right: 0; left: 0; width: auto; max-height: 62%; border-radius: var(--radius) var(--radius) 0 0; }
  .legend { bottom: 30px; }
  .modes { top: 8px; left: 8px; }
}
