/* ===== デザイントークン（Figmaデザインと対応） ===== */
:root {
  --green: #1aa053;
  --green-dark: #0e7a3d;
  --green-tint: #edf7f0;
  --green-tint-2: #e6f3ea;
  --amber: #fa9e10;
  --text: #1a1a1a;
  --text-2: #6b7280;
  --text-3: #82878f;
  --line: #e8ebe9;
  --bg: #ffffff;
  --shadow-sheet: 0 -4px 16px rgba(0, 0, 0, 0.12);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-fab: 0 3px 10px rgba(0, 0, 0, 0.18);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Noto Sans JP", system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--text);
  background: #e7ece7;
  overflow: hidden;
}

#app { position: relative; height: 100dvh; width: 100%; overflow: hidden; }

/* ===== 地図 ===== */
#map { position: absolute; inset: 0; }

/* ===== ヘッダー ===== */
.header {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  background: var(--bg);
  padding: calc(14px + var(--safe-top)) 20px 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border-radius: 0 0 18px 18px;
}
.header__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.header__title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: .01em; }
.header__sub { margin: 2px 0 12px; font-size: 13px; color: var(--text-2); }

.icon-btn {
  flex: 0 0 auto;
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid #e1e4e2; background: #fff; color: var(--green);
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; }

/* フィルタ行（半径／年齢） */
.filter-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.filter-row__label { flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--text-3); width: 30px; }

/* 半径・年齢セレクタ */
.radius-pills, .age-pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.radius-pills::-webkit-scrollbar, .age-pills::-webkit-scrollbar { display: none; }
.pill--sm { padding: 6px 13px; font-size: 13px; }
.pill {
  flex: 0 0 auto;
  border: 1px solid #d9dcda;
  background: #fff;
  color: #383f4c;
  font: 600 14px/1 inherit;
  padding: 9px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all .15s ease;
}
.pill[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* ===== 中心十字＋「この中心で検索」 ===== */
.center-crosshair {
  position: absolute; left: 50%; top: 50%;
  width: 40px; height: 40px; transform: translate(-50%, -50%);
  z-index: 5; pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(255,255,255,.9));
}
.center-crosshair svg { width: 100%; height: 100%; }
.center-btn {
  position: absolute; left: 50%; transform: translateX(-50%);
  z-index: 15;
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; border: none; border-radius: 22px;
  background: var(--green); color: #fff;
  font: 700 14px/1 inherit; cursor: pointer;
  box-shadow: var(--shadow-fab);
  transition: bottom .25s ease;
}
.center-btn svg { width: 18px; height: 18px; stroke: #fff; }

/* ===== FAB（現在地） ===== */
.fab {
  position: absolute;
  right: 16px;
  z-index: 15;
  width: 52px; height: 52px;
  border: none; border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-fab);
  display: grid; place-items: center;
  cursor: pointer;
  transition: bottom .25s ease;
}
.fab svg { width: 26px; height: 26px; stroke: var(--green); }

/* ===== ボトムシート（一覧） ===== */
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 12;
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-sheet);
  padding: 10px 16px calc(16px + var(--safe-bottom));
  max-height: 56%;
  display: flex; flex-direction: column;
  transition: transform .25s ease;
}
.sheet__handle { width: 40px; height: 5px; border-radius: 3px; background: #d2d6d4; margin: 0 auto 12px; }
.sheet__head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.sheet__head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.sheet__count { font-size: 14px; color: var(--text-2); }
.sheet__list { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }

/* クラブカード */
.card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: left;
}
.card.is-active { border: 1.5px solid var(--green); background: #f3f9f4; }
.card__thumb {
  flex: 0 0 auto;
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--green);
  display: grid; place-items: center;
}
.card__thumb svg { width: 30px; height: 30px; }
.card__body { flex: 1 1 auto; min-width: 0; }
.card__name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__meta { font-size: 12px; color: var(--text-2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__tags { display: flex; gap: 6px; margin-top: 6px; }
.tag {
  font-size: 11px; font-weight: 600; color: var(--green);
  background: var(--green-tint); padding: 3px 8px; border-radius: 6px;
  white-space: nowrap;
}
.card__chevron { flex: 0 0 auto; color: #b0b5bc; }

/* ===== 詳細パネル ===== */
.detail {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: #fff;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
  visibility: hidden;
}
.detail.is-open { transform: translateY(0); visibility: visible; }

.detail__scroll { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.detail__photo {
  position: relative;
  height: 260px;
  background: linear-gradient(135deg, #26b564, #0e7a3d);
  overflow: hidden;
}
.detail__photo .court { position: absolute; background: rgba(255,255,255,.35); }
.detail__photo .court.net { background: rgba(255,255,255,.6); }
.round-btn {
  position: absolute; top: calc(20px + var(--safe-top));
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; border: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  display: grid; place-items: center; cursor: pointer;
}
.round-btn.back { left: 16px; }
.round-btn.fav { right: 16px; }
.round-btn svg { width: 22px; height: 22px; }

.detail__content {
  position: relative;
  margin-top: -28px;
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 12px 20px 24px;
}
.detail__content .sheet__handle { margin-bottom: 14px; }
.detail__name { margin: 0; font-size: 23px; font-weight: 700; }
.detail__metarow { display: flex; gap: 14px; align-items: center; margin: 10px 0 0; font-size: 14px; }
.detail__dist { color: var(--text-2); font-weight: 500; }
.detail__rate { color: var(--amber); font-weight: 600; }
.detail__chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }

.detail__divider { height: 1px; background: var(--line); margin: 18px 0; }
.info-list { display: flex; flex-direction: column; gap: 16px; }
.info-row { display: flex; gap: 12px; align-items: center; }
.info-row svg { flex: 0 0 auto; width: 22px; height: 22px; stroke: var(--green); }
.info-row__label { font-size: 11px; color: var(--text-3); }
.info-row__value { font-size: 14.5px; font-weight: 500; color: #21242a; margin-top: 2px; }

/* アクションバー */
.action-bar {
  flex: 0 0 auto;
  display: flex; gap: 12px;
  padding: 14px 20px calc(20px + var(--safe-bottom));
  background: #fff;
  box-shadow: 0 -3px 12px rgba(0,0,0,.08);
}
.btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; border-radius: var(--radius-sm);
  font: 700 16px/1 inherit; cursor: pointer; text-decoration: none;
}
.btn svg { width: 20px; height: 20px; }
.btn--primary { background: var(--green); color: #fff; border: none; }
.btn--outline { background: #fff; color: var(--green); border: 1.5px solid var(--green); }
.btn--outline svg { stroke: var(--green); }
.btn--primary svg { stroke: #fff; }

/* ===== 状態表示（ローディング/エラー） ===== */
.toast {
  position: absolute; left: 50%; bottom: 50%; transform: translate(-50%, 50%);
  z-index: 40; background: rgba(26,26,26,.88); color: #fff;
  padding: 12px 18px; border-radius: 12px; font-size: 14px; max-width: 80%;
  text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.is-show { opacity: 1; }
.empty { padding: 24px; text-align: center; color: var(--text-2); font-size: 14px; }

/* ===== ダウンロード（エクスポート）モーダル ===== */
.modal { position: absolute; inset: 0; z-index: 50; display: none; }
.modal.is-open { display: block; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.modal__card {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  background: #fff; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 22px 20px calc(24px + var(--safe-bottom));
  box-shadow: 0 -6px 24px rgba(0,0,0,.18);
}
.modal__title { margin: 0 0 16px; font-size: 18px; font-weight: 700; }
.modal__field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.modal__field select {
  font: 500 15px/1.2 inherit; color: var(--text);
  padding: 12px 14px; border: 1px solid #d9dcda; border-radius: 12px; background: #fff;
}
.modal__count { margin: 12px 0 16px; font-size: 13px; color: var(--text-2); }
.modal__count b { color: var(--green); font-size: 16px; }
.modal__actions { display: flex; gap: 12px; }
.modal__close {
  display: block; width: 100%; margin-top: 14px; padding: 12px;
  border: none; background: none; color: var(--text-2);
  font: 600 14px/1 inherit; cursor: pointer;
}
