/* 駒カレ — 将棋イベントカレンダー
   木目・金色・墨色のテーマ。画像が無くてもCSSだけで成立する作り。 */

:root {
  --ink: #2c1f12;
  --ink-soft: #6b5238;
  --paper: #fbf6ea;
  --paper-2: #f2e7cf;
  --line: rgba(90, 60, 25, .22);
  --wood-hi: #e9c877;
  --wood: #d3a552;
  --wood-lo: #a87a2c;
  --gold: #b8860b;
  --gold-hi: #f4d675;
  --gold-lo: #8a5a18;
  --red: #a8433a;
  --blue: #2f5d9f;
  --green: #3d6b4a;
  --radius: 16px;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --sans: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  --tabbar-h: 64px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .75) inset, 0 12px 28px rgba(60, 35, 10, .2);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.65;
  background-color: #d8b25e;
  background-image: url("../assets/board.jpg"), linear-gradient(180deg, #efd48f 0%, #dcb865 45%, #bd8f38 100%);
  background-size: cover, cover;
  background-position: center top;
  background-attachment: fixed, fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, .28), transparent 60%),
    linear-gradient(rgba(60, 35, 10, .06), rgba(60, 35, 10, .26));
}

a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding: 20px 0 8px; }

/* ---------- ヘッダー ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(#3a2a19, #2c1f12);
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 6px 18px rgba(30, 18, 6, .35);
}
.header-in { display: flex; align-items: center; gap: 16px; min-height: 64px; }
/* トップページ以外の共通ヘッダー：左上に駒カレのロゴ画像（従来通り）を残しつつ、
   「みんなで作ろう将棋イベントカレンダー！駒カレ」のテキストを、ロゴとナビの間の
   残り幅いっぱいに中央寄せで配置する（flex:1のテキスト領域内でtext-align:center） */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand-logo { height: 50px; width: auto; }
.brand-text-link {
  flex: 1 1 auto; min-width: 0; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-decoration: none; font-family: var(--serif); font-weight: 900; letter-spacing: .02em;
  color: #f6e7bd; text-shadow: 0 2px 0 rgba(0, 0, 0, .4);
  font-size: clamp(9px, calc(2.7vw - 0.8px), 16px);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; color: #f6e7bd; }
.brand-text b { font-family: var(--serif); font-size: 26px; letter-spacing: .08em; color: var(--gold-hi); text-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
.brand-text small { font-size: 11px; letter-spacing: .12em; opacity: .85; }
.brand-text[hidden] { display: none; }
.head-right { display: flex; align-items: center; gap: 10px; }
.gnav { display: flex; gap: 6px; }
.gnav a {
  text-decoration: none; padding: 8px 16px; border-radius: 999px;
  color: #f6e7bd; font-weight: 800; font-size: 14px;
}
.gnav a:hover { background: rgba(255, 255, 255, .1); }
.gnav a[aria-current="page"] { background: linear-gradient(#e6c47a, #cfa04c); color: var(--ink); }

.sample-banner {
  background: repeating-linear-gradient(-45deg, #7a2e27 0 12px, #8a362e 12px 24px);
  color: #fff; text-align: center; font-size: 13px; font-weight: 700; padding: 6px 12px;
}

/* ---------- 共通パーツ ---------- */
.panel {
  position: relative;
  background: linear-gradient(rgba(255, 250, 240, .93), rgba(242, 231, 207, .93)), url("../assets/paper.jpg");
  background-size: cover, cover;
  background-position: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

/* 巻物風の額縁（角の飾り金具） */
.scroll {
  border: 2px solid rgba(120, 78, 28, .55);
  box-shadow: var(--shadow), inset 0 0 0 5px rgba(255, 253, 246, .55), inset 0 0 0 6px rgba(120, 78, 28, .35);
  padding: 22px;
}
.scroll::before, .scroll::after,
.scroll .corner-l::before, .scroll .corner-r::before { content: none; }
.scroll-corner {
  position: absolute; width: 26px; height: 26px; pointer-events: none; z-index: 1;
}
.scroll-corner::before, .scroll-corner::after {
  content: ""; position: absolute; background: linear-gradient(135deg, var(--gold-hi), var(--gold-lo, #8a5a18));
}
.scroll-corner::before { width: 100%; height: 4px; top: 0; left: 0; }
.scroll-corner::after { width: 4px; height: 100%; top: 0; left: 0; }
.scroll-corner { border-radius: 3px 0 0 0; }
.scroll-corner.tl { top: 6px; left: 6px; }
.scroll-corner.tr { top: 6px; right: 6px; transform: scaleX(-1); }
.scroll-corner.bl { bottom: 6px; left: 6px; transform: scaleY(-1); }
.scroll-corner.br { bottom: 6px; right: 6px; transform: scale(-1, -1); }
.scroll-corner span {
  position: absolute; top: -3px; left: -3px; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-hi), var(--gold) 70%, #7a4f16);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
.sec-title {
  margin: 0 0 14px; font-family: var(--serif); font-size: 18px; font-weight: 900; letter-spacing: .04em;
  display: flex; align-items: center; gap: 10px;
}
.sec-title::before {
  content: ""; width: 14px; height: 18px; flex: none;
  clip-path: polygon(50% 0, 96% 14%, 100% 100%, 0 100%, 4% 14%);
  background: linear-gradient(#e6c47a, #b8860b);
}
.sec-title .sec-more { flex: none; margin-left: auto; font-family: var(--sans); font-size: 13px; font-weight: 800; white-space: nowrap; }
.sec-title span { min-width: 0; overflow-wrap: break-word; }
.ic { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.18em; }

.wood {
  background:
    linear-gradient(rgba(255, 255, 255, .28), rgba(0, 0, 0, .07)),
    repeating-linear-gradient(90deg, rgba(125, 85, 50, .28) 0 2px, transparent 2px 7px),
    linear-gradient(#e6c47a, #cfa04c);
  color: var(--ink); font-weight: 900;
  border: 1px solid rgba(90, 55, 20, .5); border-radius: 12px;
  box-shadow: 0 2px 0 rgba(90, 55, 20, .55), 0 6px 12px rgba(60, 35, 10, .18), inset 0 1px 0 rgba(255, 255, 255, .55);
  text-decoration: none; transition: transform .08s, filter .15s;
}
.wood:hover { filter: brightness(1.06); }
.wood:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(0, 0, 0, 0), inset 0 2px 4px rgba(60, 35, 10, .3); }
.wood[aria-pressed="true"], .wood.is-on {
  filter: brightness(.9) saturate(1.15);
  box-shadow: inset 0 0 0 2px #fff4c8, inset 0 0 0 4px rgba(90, 55, 20, .55), 0 2px 0 rgba(90, 55, 20, .55);
}
/* フッターの「イベントを追加する」だけ目立つ配色にする */
.wood.wood-accent {
  background:
    linear-gradient(rgba(255, 255, 255, .3), rgba(0, 0, 0, .08)),
    repeating-linear-gradient(90deg, rgba(20, 80, 40, .28) 0 2px, transparent 2px 7px),
    linear-gradient(#5fb87a, #2f8a52);
  color: #fff; border-color: rgba(20, 70, 35, .55);
  box-shadow: 0 2px 0 rgba(20, 70, 35, .55), 0 6px 14px rgba(20, 70, 35, .3), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.wood.wood-accent:hover { filter: brightness(1.08); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 4px 14px; border-radius: 999px; font-size: 14px; font-weight: 800;
  background: rgba(255, 255, 255, .8); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.chip small { font-size: 11px; font-weight: 800; opacity: .7; }
button.chip[aria-pressed="true"], a.chip.is-on {
  background: linear-gradient(#e6c47a, #cfa04c); border-color: rgba(90, 55, 20, .5);
  box-shadow: inset 0 0 0 2px #fff4c8;
}
.chip.is-empty { opacity: .4; cursor: default; }

/* しょうぎ駒型のタグ・バッジ */
.piece { display: block; flex: none; width: 56px; height: 66px; filter: drop-shadow(0 2px 2px rgba(60, 35, 10, .35)); }
.piece-face {
  display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%;
  padding-top: 8px; line-height: 1.1;
  clip-path: polygon(50% 0, 96% 14%, 100% 100%, 0 100%, 4% 14%);
  background:
    repeating-linear-gradient(90deg, rgba(125, 85, 50, .18) 0 1px, transparent 1px 6px),
    linear-gradient(#f3d98d, #d9ae5a);
}
.pm { font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.pd { font-family: var(--serif); font-size: 26px; font-weight: 900; }
.pw { font-size: 11px; font-weight: 900; }
.sun { color: var(--red); }
.sat { color: var(--blue); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 800; line-height: 1;
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .75);
}
.tag-kind { background: #f6e6bd; border-color: rgba(168, 122, 44, .5); }
.tag-online { background: #e3edf9; border-color: rgba(47, 93, 159, .45); color: var(--blue); }
.tag-free { background: #e3f0e6; border-color: rgba(61, 107, 74, .45); color: var(--green); }
.tag-full { background: var(--red); border-color: var(--red); color: #fff; }
.tag-sample { border-style: dashed; color: var(--ink-soft); }
.tag-submitted { background: #eee3f6; border-color: rgba(110, 70, 160, .4); color: #6e46a0; }

/* ---------- イベントカード ---------- */
.ev-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ev-btn {
  width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; text-align: left;
  padding: 12px 14px 12px 12px; border-radius: 14px;
  background: rgba(255, 255, 255, .9); border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(60, 35, 10, .12);
  transition: transform .12s, box-shadow .12s;
}
.ev-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(60, 35, 10, .2); }
.ev-lead { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ev-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); box-shadow: 0 2px 6px rgba(60, 35, 10, .18); }
.ev-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ev-title { font-family: var(--serif); font-size: 17px; font-weight: 900; line-height: 1.4; overflow-wrap: anywhere; }
.ev-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; color: var(--ink-soft); }
.ev-meta span { display: inline-flex; align-items: center; gap: 4px; }
.ev-go { color: var(--gold); }
.ev-btn.is-full .ev-title { color: var(--ink-soft); }
.ev-btn.is-past { opacity: .66; }
.ev-btn.is-past .piece { filter: grayscale(.6) drop-shadow(0 2px 2px rgba(60, 35, 10, .25)); }

/* ---------- ホーム ---------- */
.hero { margin-bottom: 16px; }
.hero h1 {
  margin: 0 0 10px; font-family: var(--serif); font-size: 22px; font-weight: 900; color: #fff8e0;
  text-shadow: 0 2px 6px rgba(40, 22, 6, .7);
}
.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] {
  flex: 1; min-width: 0; height: 50px; padding: 0 16px; border-radius: 14px;
  border: 1px solid rgba(90, 55, 20, .45); background: #fffdf6; font-size: 16px;
  box-shadow: inset 0 2px 4px rgba(60, 35, 10, .12);
}
.search-form button { min-width: 88px; height: 50px; font-size: 16px; }

/* home-wrap の gap はカレンダーカードと地図カードの間の隙間のみに影響する
   （地図と「近日開催のイベント」の間は home-grid 側の gap）。
   ユーザー指示によりこの隙間を無くす。 */
.home-wrap { display: flex; flex-direction: column; gap: 0; }
.home-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }

/* ---------- ホーム上部：巻物フレーム一体型ヒーロー ---------- */
/* 以前はロゴが小さかったため上部に余分な padding-top:20px を足していたが、
   ロゴを大きくした今は他のパネルと同じ内側余白（.scrollのpadding:22px）で十分。
   ユーザー指示により上部の余分な隙間を無くす。 */
.hero-top { text-align: center; margin: 0 0 6px; }
.hero-tagline-line {
  margin: 0 16px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
}
/* ロゴ画像に「みんなで作ろう！将棋イベントカレンダー」の文字が焼き込み済みのため、
   別出しのテキストは廃止し、ロゴ単体を大きく表示する。少し下にずらして配置。 */
.hero-tagline-logo { width: min(460px, 88%); height: auto; display: block; margin: 10px auto 0; }
.hero-logo { width: min(360px, 78%); height: auto; display: block; }
@media (max-width: 480px) {
  .hero-logo { width: min(280px, 84%); }
}

/* ロゴをページ下部（フッター直前）に移動。トップは「みんなで作ろう将棋イベントカレンダー！」の
   タグラインのみとし、縦方向の余白を節約する */
.page-brand { display: flex; justify-content: center; padding: 24px 0 4px; }
.hero-brand { display: flex; justify-content: center; margin: 0; text-decoration: none; }

.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-title { flex: 1; min-width: 0; text-align: center; margin: 0; font-family: var(--serif); font-size: 21px; font-weight: 900; cursor: pointer; border-radius: 10px; }
.cal-title:hover, .cal-title:focus-visible { background: var(--surface-2, rgba(0,0,0,.04)); }
.cal-title:focus-visible { outline: 2px solid var(--accent, #2563eb); outline-offset: 2px; }
.cal-title small { display: block; font-family: var(--sans); font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.cal-nav { height: 40px; padding: 0 14px; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.cal-today { height: 34px; padding: 0 12px; font-size: 13px; }

/* 台帳風カレンダー：罫線のみで、セルの背景は敷かない */
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid rgba(90, 60, 25, .28); border-left: 1px solid rgba(90, 60, 25, .28);
  border-radius: 8px; overflow: hidden;
}
.cal-dow {
  text-align: center; font-size: 12px; font-weight: 900; padding: 6px 0;
  border-right: 1px solid rgba(90, 60, 25, .28); border-bottom: 1px solid rgba(90, 60, 25, .4);
  background: rgba(120, 78, 28, .08);
}
.day {
  position: relative; min-height: 40px; padding: 5px 4px; border-radius: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: transparent; border: 0; border-right: 1px solid rgba(90, 60, 25, .18); border-bottom: 1px solid rgba(90, 60, 25, .18);
}
.day.blank { background: rgba(120, 78, 28, .04); }
button.day:hover { background: rgba(184, 134, 11, .1); }
.day-n { font-family: var(--serif); font-size: 18px; font-weight: 900; line-height: 1.2; }
.day.is-today .day-n {
  background: var(--ink); color: #fff; border-radius: 999px; min-width: 26px; text-align: center; padding: 0 4px;
}
.day.has-ev .day-n {
  display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 3px 3px 0;
  color: var(--ink); background: linear-gradient(#f3d98d, #d9ae5a);
  clip-path: polygon(50% 0, 94% 18%, 100% 100%, 0 100%, 6% 18%);
  box-shadow: 0 1px 0 rgba(90, 55, 20, .45);
}
.day.has-ev.many .day-n { background: linear-gradient(#e3866f, var(--red)); color: #fff; }
/* 「今日」かつ「イベントあり」の重なり：以前は駒の周りに黒い縁取りを付けて区別していたが、
   outline・box-shadow・filter:drop-shadow のいずれも実機（モバイルブラウザ）で駒の下に
   黒い影のような汚れが出てしまうため廃止。今日の日付は既定で選択状態（.is-sel、セル全体に
   金色の枠）になるため、それだけで十分「今日」と分かる。駒自体には縁取りを付けない。 */
.day.is-sel { box-shadow: inset 0 0 0 3px var(--gold); }
.day.past .day-n { opacity: .55; }
.cal-legend { margin: 10px 2px 0; font-size: 12px; color: var(--ink-soft); }

/* 日付・地域/都道府県クリックの結果を表示する、カレンダー上部のパネル。
   タグライン（.hero-top）と同じ場所に表示され、カレンダー本体は常に隠さない。
   件数が多いときはこのパネル内だけがスクロールする（カレンダーはスクロールしない）。 */
.cal-overlay {
  display: flex; flex-direction: column; scroll-margin-top: 10px;
  max-height: 430px; overflow-y: auto;
  margin: 0 0 14px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .4);
}
.cal-overlay.is-hidden { display: none; }
.cal-overlay .ov-head { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: 0 0 10px; }
/* 日付の見出し（例:「9月22日(火)」）と件数表示は、カレンダー側で既に選択状態が示されていて
   重複する／不要なため画面上は出さない（日付のみスクリーンリーダー向けに残す。閉じるボタンを右上に配置） */
.cal-overlay .ov-head h2 { margin: 0; font-family: var(--serif); font-size: 18px; font-weight: 900; }
/* パネル内のカードは同じ日付のイベントのみのため、カードごとの日付駒バッジは省略して横幅を広く使う */
.cal-overlay .ev-lead .piece { display: none; }
.cal-overlay .ev-btn { padding: 10px 12px; gap: 10px; }
.cal-overlay .ev-title { font-size: 15px; line-height: 1.3; }
.cal-overlay .ev-meta { font-size: 12.5px; gap: 2px 12px; }
.cal-overlay .ev-list { gap: 8px; }
.hero-top.is-hidden { display: none; }
.overlay-close {
  flex: none; width: 36px; height: 36px; padding: 0; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
}
.overlay-close .ic { width: 18px; height: 18px; }
.empty {
  padding: 18px 14px; border: 2px dashed rgba(90, 55, 20, .3); border-radius: 12px;
  background: rgba(255, 255, 255, .55); text-align: center; color: var(--ink-soft); font-size: 14px;
}
.empty p { margin: 0 0 10px; }
.btn-sm { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; font-size: 14px; }
.panel-foot { margin-top: 12px; text-align: right; }

.finder-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .finder-grid { grid-template-columns: 270px 1fr; align-items: start; } }

/* 地域選択（日本地図・実写イラスト＋当たり判定オーバーレイ） */
.region-picker { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.region-picker .chip-all {
  align-self: stretch; min-height: 44px; padding: 6px 14px; font-size: 15px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.region-picker .chip-all small { font-size: 11px; opacity: .75; }

.map-stage {
  position: relative; width: 100%; max-width: 270px; aspect-ratio: 1 / 1; margin: 4px auto 0;
  scroll-margin-top: 12px;
}
.map-base { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; filter: drop-shadow(0 6px 14px rgba(60, 35, 10, .3)); }
.region-map { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.region-shape { cursor: pointer; outline: none; }
.region-shape path {
  fill: rgba(255, 255, 255, .001); stroke: none; pointer-events: all;
  transition: fill .15s, stroke-width .15s, filter .15s;
}
.region-shape .region-hit { fill: rgba(255, 255, 255, .001); stroke: none; pointer-events: all; }
.region-shape .region-label {
  font-family: var(--serif); font-size: 58px; font-weight: 900; fill: #fffdf6;
  text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: rgba(44, 26, 12, .82); stroke-width: 20px; stroke-linejoin: round;
  opacity: .92; transition: opacity .15s;
}
.region-shape .region-count {
  font-family: var(--sans); font-size: 46px; font-weight: 800; fill: #fff4c8;
  text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: rgba(44, 26, 12, .82); stroke-width: 15px; stroke-linejoin: round;
  opacity: .92; transition: opacity .15s;
}
.region-shape .region-label-sm { font-size: 42px; }
.region-shape .region-count-sm { font-size: 34px; }
.region-shape:hover path, .region-shape:focus-visible path {
  fill: rgba(255, 214, 122, .28); stroke: #fff4c8; stroke-width: 18px;
  filter: drop-shadow(0 0 32px rgba(255, 196, 64, .95));
}
.region-shape:focus-visible path { stroke: var(--gold-hi); }
.region-shape:hover .region-label, .region-shape:hover .region-count,
.region-shape:focus-visible .region-label, .region-shape:focus-visible .region-count { opacity: 1; }
.region-shape.is-on path {
  fill: rgba(255, 214, 122, .4); stroke: #fff; stroke-width: 22px;
  filter: drop-shadow(0 0 40px rgba(255, 196, 64, 1));
}
.region-shape.is-on .region-label, .region-shape.is-on .region-count { opacity: 1; }
.region-shape.is-empty { cursor: default; }
.region-shape.is-empty path, .region-shape.is-empty .region-hit { pointer-events: none; }
.region-shape.is-empty .region-label, .region-shape.is-empty .region-count { opacity: .45; }
.region-picker .chip-all[aria-pressed="true"] {
  filter: brightness(.9) saturate(1.15);
  box-shadow: inset 0 0 0 2px #fff4c8, inset 0 0 0 4px rgba(90, 55, 20, .55), 0 2px 0 rgba(90, 55, 20, .55);
}
@media (max-width: 719px) { .map-stage { max-width: 300px; } }

.pref-panel {
  position: relative; overflow: hidden;
  padding: 14px; border-radius: 14px; border: 1px solid var(--line);
  background: radial-gradient(ellipse at 30% 20%, #fffbe8, #f7e8bd 80%);
}
.pref-panel .hint { margin: 0; color: var(--ink-soft); font-size: 14px; position: relative; z-index: 2; }
.pref-panel .pref-title { margin: 0 0 10px; font-weight: 900; font-family: var(--serif); font-size: 16px; position: relative; z-index: 2; }
.pref-chips { display: flex; flex-wrap: wrap; gap: 8px; position: relative; z-index: 2; }
.pref-chips .chip.is-on { scroll-margin-top: 12px; }

/* 右下に常駐するマスコット（フロート）。全ページ共通で common.js が開閉を制御 */
.mascot-float {
  position: fixed; right: 14px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 55;
  width: 126px; transition: opacity .25s ease, transform .25s ease;
}
.mascot-float img {
  display: block; width: 100%; height: auto; cursor: pointer;
  filter: drop-shadow(0 6px 14px rgba(60, 35, 10, .4));
}
.mascot-float.is-hidden { opacity: 0; transform: translateY(18px) scale(.92); pointer-events: none; }
@media (min-width: 640px) { .mascot-float { width: 168px; right: 24px; bottom: 24px; } }
/* 下部タブバーは常時表示ではなくなった（最下部スクロール時のみ表示）ため、
   マスコットの下に確保していたタブバー分の余白は不要。基準の下端位置（16px+セーフエリア）まで下げる */

/* ---------- 一覧ページ ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-head h1 { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 900; color: #fff8e0; text-shadow: 0 2px 6px rgba(40, 22, 6, .7); }
.filter-toggle { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; font-size: 15px; }
.filter-toggle .badge {
  min-width: 22px; height: 22px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 12px;
  display: none; align-items: center; justify-content: center; padding: 0 6px;
}
.filter-toggle .badge.on { display: inline-flex; }

.list-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .list-layout { grid-template-columns: 330px minmax(0, 1fr); }
  .filters { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
  .filter-toggle { display: none; }
}
@media (max-width: 899px) {
  .filters { display: none; }
  .filters.open { display: block; }
}
.fld { margin-bottom: 16px; }
.fld-l { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 900; color: var(--ink-soft); letter-spacing: .04em; }
.fld input[type="search"], .fld input[type="date"], .fld select {
  width: 100%; height: 44px; padding: 0 12px; border-radius: 10px; font-size: 16px;
  border: 1px solid rgba(90, 55, 20, .35); background: #fffdf6;
}
.date-range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; }
.date-range input { min-width: 0; padding: 0 8px; }
.date-range span { font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.tight { margin-top: 8px; }
.chips .chip { min-height: 34px; padding: 2px 12px; font-size: 13px; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 36px; font-weight: 700; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); }
.filters .reset { width: 100%; height: 44px; font-size: 15px; }

.result-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.result-count { font-size: 15px; font-weight: 800; }
.result-count b { font-family: var(--serif); font-size: 26px; margin-right: 2px; }
.active-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.active-tags button {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 10px; border-radius: 999px;
  border: 1px solid rgba(90, 55, 20, .4); background: #fff3cc; font-size: 12.5px; font-weight: 800;
}
.day-head {
  display: flex; align-items: baseline; gap: 10px; margin: 18px 0 8px; padding: 6px 12px; border-radius: 8px;
  background: linear-gradient(90deg, rgba(44, 31, 18, .88), rgba(44, 31, 18, .55)); color: #fff3cc;
  font-family: var(--serif); font-size: 16px; font-weight: 900;
}
.day-head:first-child { margin-top: 0; }
.day-head small { font-family: var(--sans); font-size: 12px; opacity: .8; }
.more-wrap { text-align: center; margin: 18px 0 4px; }
.more-btn { height: 48px; padding: 0 28px; font-size: 16px; }
.results .empty { padding: 32px 16px; }

/* ---------- 地図で探すページ ---------- */
.map-nocoord-note {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; font-size: 13px; color: var(--ink-soft);
  background: rgba(255, 255, 255, .7); border: 1px solid var(--line);
}
.event-map-wrap {
  border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 16px;
}
#mapCanvas { width: 100%; height: 380px; background: #eee6cf; }
@media (min-width: 640px) { #mapCanvas { height: 480px; } }
.koma-pin { background: none; border: none; }
.koma-pin-body {
  display: block; width: 30px; height: 38px;
  filter: drop-shadow(0 3px 5px rgba(60, 35, 10, .5));
}
.koma-pin-body .ic {
  width: 100%; height: 100%;
  stroke: #5a3714; stroke-width: 1.6;
}
.koma-pin-body .ic path { fill: #e6c47a; }
.koma-cluster {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background:
    linear-gradient(rgba(255, 255, 255, .28), rgba(0, 0, 0, .07)),
    linear-gradient(#e6c47a, #cfa04c);
  border: 2px solid rgba(90, 55, 20, .6);
  color: var(--ink); font-weight: 900; font-size: 14px;
  box-shadow: 0 2px 6px rgba(60, 35, 10, .4);
}
.koma-pin-popup { font-family: var(--sans); min-width: 180px; }
.koma-pin-popup b { display: block; font-family: var(--serif); font-size: 14px; margin-bottom: 4px; }
.koma-pin-popup p { margin: 0 0 6px; font-size: 12.5px; color: var(--ink-soft); }
.koma-pin-popup .wood.btn-sm { width: 100%; height: 36px; font-size: 13px; }
.leaflet-popup-content-wrapper { border-radius: 12px; }

/* ---------- 詳細ダイアログ ---------- */
/* ダイアログ表示中は背面（一覧）のスクロール・タッチ・クリックを完全に無効化する */
html.dlg-lock, html.dlg-lock body { overflow: hidden; touch-action: none; }
dialog.detail {
  width: min(560px, calc(100vw - 24px)); max-height: min(88vh, 760px); max-height: min(88svh, 760px); padding: 0; border: none; border-radius: 20px;
  background: linear-gradient(#fffaf0, var(--paper-2)); color: var(--ink);
  box-shadow: 0 24px 60px rgba(20, 10, 0, .5);
  /* ダイアログ自体はスクロールさせず、内側の.dt-scrollだけをスクロールさせることで
     右上の閉じるボタン（.dt-close）が常に同じ位置に固定表示されるようにする */
  overflow: hidden; display: flex; flex-direction: column;
}
/* 上の display:flex はセレクタに[open]が付いていないため、本来ブラウザ標準で
   「dialog:not([open]){display:none}」として閉じた状態を隠すはずの挙動を、
   常にdisplay:flexで上書きしてしまっていた。結果、.close()で閉じた（open属性が
   外れた）後も要素自体は非表示にならず、通常のフローに残ったdisplay:flexの
   ボックスとしてページ内（スクロール位置によってはページ上部など）に表示され
   続けてしまう不具合があったため、閉じている間は明示的にdisplay:noneへ戻す。 */
dialog.detail:not([open]) { display: none; }
.dt-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; }
dialog.detail::backdrop { background: rgba(30, 18, 6, .6); backdrop-filter: blur(2px); }
dialog.detail[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.dt-head { display: flex; gap: 14px; align-items: flex-start; padding: 20px 20px 12px; }
.dt-head-main { flex: 1 1 auto; min-width: 0; }
.dt-head h2 { margin: 6px 0 0; font-family: var(--serif); font-size: 20px; line-height: 1.4; font-weight: 900; overflow-wrap: anywhere; }
.dt-close {
  /* 2026-10-04: 実機iOS Safariで「スクロールしても常に同じ位置に✕を固定表示する」ため
     position:absoluteで.dt-scrollの外側に重ねて浮かせていたところ、✕を狙ってタップしても
     別の要素（バッジ等）がタップ判定されてしまう不具合が実機で再現・確認された。
     ユーザーの了承のもと、「常にスクロール位置に関わらず表示され続ける」挙動は諦め、
     ✕ボタンを.dt-head内の通常のフロー要素（flexアイテム）に変更した。これにより、
     ✕ボタンは他のヘッダー内容と同じ合成レイヤー・同じ描画順で扱われるため、
     momentum scrollする.dt-scrollに重なって浮いていたことに起因する可能性のある
     タップ判定のズレが構造的に起こらなくなる。開いた直後は常に一番上にスクロール
     された状態で表示されるため、✕は開いた直後は必ず見えている。
     （トレードオフ: 本文を下にスクロールすると✕も一緒にスクロールして見えなくなるが、
     その場合は周囲の暗い部分（バックドロップ）をタップすれば閉じられる。） */
  flex: none; width: 40px; height: 40px; border-radius: 999px; padding: 0;
  display: grid; place-items: center; border: 1px solid var(--line); background: rgba(255, 255, 255, .9);
  touch-action: manipulation;
}
/* event-list/e.php（イベント詳細の単独ページ）用の閉じるボタン。
   詳細ポップアップ(.dt-close)と見た目を揃えつつ、.panelの角の装飾(.scroll-corner)と
   位置が被るため、少し内側かつ装飾より手前（z-index）に表示されるようにしている。
   クリックするとイベント一覧へ戻る（SNS等から直接開かれることが多く、戻る履歴が
   無いケースが大半のため、常に一覧ページへのリンクにしている）。 */
.dt-page-close {
  position: absolute; top: 10px; right: 10px; width: 38px; height: 38px; border-radius: 999px; padding: 0;
  display: grid; place-items: center; border: 1px solid var(--line); background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 8px rgba(20, 10, 0, .2); z-index: 2;
}
.dt-body { padding: 0 20px 20px; }
.dt-photo { display: block; width: 100%; max-height: 320px; object-fit: contain; background: rgba(90, 55, 20, .06); border-radius: 14px; border: 1px solid var(--line); margin: 0 0 4px; }

/* 写真スライドショー（1〜3枚）。1枚のみの場合は矢印・ドットが生成されず、単純な表示になる */
.dt-photos { position: relative; overflow: hidden; border-radius: 14px; border: 1px solid var(--line); background: rgba(90, 55, 20, .06); margin: 0 0 4px; touch-action: pan-y; }
.dt-photos-track { display: flex; transition: transform .25s ease; }
.dt-photos-slide { flex: 0 0 100%; min-width: 0; }
.dt-photos-slide img { display: block; width: 100%; max-height: 320px; object-fit: contain; }
.dt-photos-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 999px;
  padding: 0; display: grid; place-items: center; border: 1px solid var(--line); background: rgba(255, 255, 255, .85);
  box-shadow: 0 2px 8px rgba(20, 10, 0, .25);
}
.dt-photos-nav.prev { left: 8px; }
.dt-photos-nav.next { right: 8px; }
.dt-photos-nav.prev .ic { transform: scaleX(-1); }
.dt-photos-dots { position: absolute; left: 0; right: 0; bottom: 8px; display: flex; justify-content: center; gap: 6px; }
.dt-photos-dot {
  width: 8px; height: 8px; padding: 0; border-radius: 999px; border: none; background: rgba(255, 255, 255, .6);
  box-shadow: 0 0 0 1px rgba(20, 10, 0, .25) inset;
}
.dt-photos-dot.is-on { background: var(--gold, #cfa04c); }
.dt-submitted-note { color: #6e46a0; }
.dt-list { margin: 12px 0; display: grid; grid-template-columns: 5.5em 1fr; gap: 8px 10px; font-size: 15px; }
.dt-list dt { font-weight: 900; color: var(--ink-soft); font-size: 13px; padding-top: 2px; }
.dt-list dd { margin: 0; overflow-wrap: anywhere; }
.dt-detail { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .7); border: 1px solid var(--line); white-space: pre-line; font-size: 14.5px; }
.dt-actions { display: grid; gap: 10px; margin-top: 16px; }
.dt-actions .wood { height: 50px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; }
.dt-actions .sub { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.dt-actions .sub .wood { height: 44px; font-size: 14px; }
.dt-actions .disabled { opacity: .5; pointer-events: none; }
.dt-share-label { margin: 14px 0 2px; font-weight: 900; color: var(--ink-soft); }
.share-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.share-row .wood { height: 40px; font-size: 12.5px; padding: 0 6px; gap: 4px; }
.dt-note { margin: 12px 0 0; font-size: 12px; color: var(--ink-soft); }
@media (max-width: 599px) {
  dialog.detail { margin: auto auto 0; width: 100%; max-width: 100%; border-radius: 20px 20px 0 0; max-height: 90vh;
    /* 2026-10-06: iPhoneのSafari／アプリ内ブラウザでは vh がツールバーを畳んだ時の最大高さ基準のため、
       ツールバー表示中は下寄せのポップアップ上端（タグ・タイトル）が上のバーの裏に隠れていた。
       svh（ツールバー表示中の最小高さ基準）で上書きし、常に見える範囲に収める。未対応ブラウザは上の90vhを使う。 */
    max-height: 90svh; }
}

/* ---------- フッター・タブバー・マスコット ---------- */
.site-footer {
  margin-top: 36px; text-align: center; padding: 22px 16px 26px; border-top: 3px solid var(--gold);
  background:
    linear-gradient(rgba(20, 12, 4, .82), rgba(20, 12, 4, .88)),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .12) 0 3px, transparent 3px 46px),
    linear-gradient(#6b431f, #3a2410);
  color: #e8d7ae;
}
.footer-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 16px; }
.footer-tabs a { height: 40px; padding: 0 18px; font-size: 13.5px; display: inline-flex; align-items: center; }
.site-footer p { margin: 4px 0; font-size: 12.5px; }

.tabbar { display: none; }
@media (max-width: 759px) {
  /* タブバーがフッターのボタン（イベント追加など）に重なってタップできなくなるのを防ぐため、
     タブバー分＋少し余分に下余白を確保する */
  body { padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }
  .gnav { display: none; }
  .brand-text b { font-size: 22px; }
  .header-in { min-height: 56px; }
  .brand-logo { height: 40px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(3, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: #fffdf6; border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(40, 22, 6, .18);
    /* ユーザー指示: 一番下までスクロールした時だけ表示する（それ以外は下にスライドして隠す） */
    transform: translateY(100%); transition: transform .25s ease; pointer-events: none;
  }
  .tabbar.is-visible { transform: translateY(0); pointer-events: auto; }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    text-decoration: none; font-size: 11px; font-weight: 800; color: var(--ink-soft);
  }
  .tabbar a .ic { width: 24px; height: 24px; }
  .tabbar a[aria-current="page"] { color: var(--gold); }
  .day { min-height: 32px; padding: 2px; }
  .day-n { font-size: 15px; }
  .cal-dow { padding: 4px 0; }
  .cal-head { margin-bottom: 6px; }
  /* ホーム画面のみ、カレンダーと地図が一画面に収まりやすいよう余白をさらに詰める */
  .home-page .scroll { padding: 16px; }
  .home-wrap { gap: 0; }
  .home-grid { gap: 10px; }
}
@media (max-width: 400px) {
  /* 極小幅（iPhone SEなど）で月送りボタンがカレンダー見出しを圧迫し、
     見出しの数字（改行不可）がはみ出すのを防ぐ */
  .cal-head { gap: 4px; }
  .cal-nav { padding: 0 6px; gap: 2px; font-size: 11px; }
}

.loading, .load-error { padding: 28px 16px; text-align: center; color: var(--ink-soft); }
.load-error { color: var(--red); font-weight: 700; }
