.bmw-acc-wrap { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif; max-width: 100%; color: #222; box-sizing: border-box; }
.bmw-acc-wrap *, .bmw-acc-wrap *::before, .bmw-acc-wrap *::after { box-sizing: border-box; }
.bmw-acc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.bmw-acc-cell { display: flex; flex-direction: column; }

/* カード（クリック対象） */
.bmw-acc-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 24px 28px;
  cursor: pointer;
  display: flex;
  gap: 24px;
  align-items: center;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  /* iOS Safari / Androidの<button>デフォルト装飾をリセット */
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  text-decoration: none;
}
.bmw-acc-card:focus { outline: none; }
.bmw-acc-card:focus-visible { outline: 2px solid #1c69d4; outline-offset: 2px; }
.bmw-acc-card:hover { border-color: #b8b8b8; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.bmw-acc-card[aria-expanded="true"] {
  border-color: #e0e0e0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}
.bmw-acc-text { flex: 1 1 auto; min-width: 0; }
.bmw-acc-kicker { font-size: 17px; color: #666; margin: 0 0 10px; }
.bmw-acc-title { font-size: 31px; font-weight: 600; color: #1c69d4; margin: 0 0 12px; line-height: 1.3; letter-spacing: 0.01em; }
.bmw-acc-series { font-size: 16px; color: #888; margin: 0; line-height: 1.5; }
.bmw-acc-thumb {
  flex: 0 0 300px;
  width: 300px;
  aspect-ratio: 3 / 2;
  border-radius: 6px;
  background: #f3f3f3;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #aaa;
  overflow: hidden;
}
.bmw-acc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bmw-acc-chev {
  width: 20px; height: 20px; flex-shrink: 0;
  transition: transform .25s ease;
  color: #999;
}
.bmw-acc-card[aria-expanded="true"] .bmw-acc-chev { transform: rotate(180deg); color: #1c69d4; }

/* パネル（アコーディオン本体） */
.bmw-acc-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-top: none;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}
.bmw-acc-panel-inner { padding: 24px; }
.bmw-acc-models {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.bmw-acc-model {
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 6px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  transition: border-color .2s ease, transform .2s ease;
}
.bmw-acc-model:hover { border-color: #1c69d4; transform: translateY(-2px); }
.bmw-acc-model-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.bmw-acc-model-img {
  flex: 0 0 160px;
  width: 160px;
  aspect-ratio: 3 / 2;
  background: #f0f0f0;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #aaa;
  overflow: hidden;
}
.bmw-acc-model-img img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 6px; box-sizing: border-box; }
.bmw-acc-model-name { font-size: 17px; font-weight: 600; color: #333; margin: 0; }
.bmw-acc-model-catch { font-size: 13px; color: #666; line-height: 1.5; margin: 0; }

/* カード内の幅が狭くなったら縦積みに（2カラム時にサムネが溢れるのを防止） */
@media (max-width: 900px) {
  .bmw-acc-card { flex-direction: column; align-items: stretch; }
  .bmw-acc-thumb { flex: 0 0 auto; width: 100%; }
}

/* スマホ最適化 */
@media (max-width: 600px) {
  .bmw-acc-grid { grid-template-columns: 1fr; gap: 16px; }
  .bmw-acc-card {
    padding: 18px 20px 14px;
    gap: 14px;
    flex-direction: column;
    align-items: stretch;
  }
  .bmw-acc-thumb { flex: 0 0 auto; width: 100%; }
  .bmw-acc-title { font-size: 24px; }
  .bmw-acc-kicker { font-size: 14px; }
  .bmw-acc-series { font-size: 13px; }
  .bmw-acc-panel-inner { padding: 16px; }
  .bmw-acc-models { grid-template-columns: 1fr; gap: 14px; }
  .bmw-acc-model { flex-direction: column; align-items: stretch; padding: 14px; gap: 10px; }
  .bmw-acc-model-img { flex: 0 0 auto; width: 100%; }

  /* SP時の矢印: 大きく＆中央配置で「タップで開く」が一目で分かるように */
  .bmw-acc-chev {
    width: 40px;
    height: 40px;
    align-self: center;
    margin-top: 4px;
    color: #1c69d4;
    stroke-width: 2.5;
  }
  .bmw-acc-chev polyline { stroke-width: 2.8; }
}

/* ===== モーダル ===== */
.bmw-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.bmw-modal-overlay[data-open="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .25s ease, visibility 0s linear 0s;
}
.bmw-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.85) translateY(30px);
  opacity: 0;
  transition: transform .4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity .25s ease;
}
.bmw-modal-overlay[data-open="true"] .bmw-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.bmw-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background .15s ease, transform .15s ease;
  color: #fff;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.bmw-modal-close:hover { background: #1c69d4; transform: scale(1.08); }
.bmw-modal-close:focus-visible { outline: 3px solid #1c69d4; outline-offset: 2px; }
.bmw-modal-close svg { width: 20px; height: 20px; stroke-width: 2.5; }
.bmw-modal-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #f0f0f0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #aaa;
  overflow: hidden;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}
.bmw-modal-img img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 10px; box-sizing: border-box; }
.bmw-modal-body { padding: 28px 32px 32px; }
.bmw-modal-name { font-size: 28px; font-weight: 600; color: #1c69d4; margin: 0 0 8px; line-height: 1.3; }
.bmw-modal-catch { font-size: 15px; color: #555; line-height: 1.6; margin: 0 0 20px; }

/* スクロールヒント — モーダル内容が viewport を超える時のみJSで表示 */
.bmw-modal-scroll-hint {
  display: none; /* JS が overflow を検出した時のみ表示 */
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: #888;
  margin: 4px 0 14px;
  padding: 6px 10px;
  background: #f5f5f5;
  border-radius: 4px;
  text-align: center;
  line-height: 1.4;
}
.bmw-modal-scroll-hint.is-visible { display: flex; }
.bmw-modal-scroll-hint svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  animation: bmw-bounce 1.5s ease-in-out infinite;
}
@keyframes bmw-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(3px); }
}
.bmw-modal-desc { font-size: 14px; color: #444; line-height: 1.8; margin: 0 0 24px; }
.bmw-modal-specs {
  border-top: 1px solid #eee;
  padding-top: 20px;
  margin-bottom: 24px;
}
.bmw-modal-specs-title {
  font-size: 13px;
  font-weight: 600;
  color: #888;
  margin: 0 0 12px;
  letter-spacing: 0.05em;
}
.bmw-modal-specs-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid #eee;
}
.bmw-modal-spec-row {
  display: flex;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
  font-size: 13px;
  gap: 12px;
}
.bmw-modal-spec-label { color: #888; flex: 0 0 90px; }
.bmw-modal-specs-note {
  font-size: 11px;
  color: #888;
  line-height: 1.6;
  margin: 12px 0 0;
  padding-top: 8px;
  white-space: pre-line; /* Excel K列の改行を反映 */
}

/* COMING SOON バッジ (モデル名横のボタン風表示) — LP共通グレー */
.bmw-modal-coming-soon,
.bmw-acc-coming-soon {
  display: inline-block;
  padding: 4px 12px;
  background: #6f6f6f;
  color: #fff;
  border-radius: 4px;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  vertical-align: middle;
  white-space: nowrap;
}
.bmw-modal-coming-soon { margin-left: 10px; }
.bmw-acc-coming-soon { margin-left: 8px; padding: 3px 10px; font-size: 10px; }
.bmw-modal-spec-value { color: #333; font-weight: 500; flex: 1 1 auto; }
.bmw-modal-cta {
  display: inline-block;
  background: #1c69d4;
  color: #fff;
  text-decoration: none;
  padding: 12px 28px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s ease;
}
.bmw-modal-cta:hover { background: #164fa0; }

/* 試乗予約 (メインCTA) — LPと同色の青、中央配置 */
.bmw-modal-booking,
.bmw-modal-booking:link,
.bmw-modal-booking:visited,
.bmw-modal-booking:hover,
.bmw-modal-booking:active,
.bmw-modal-booking:focus {
  text-decoration: none !important;
  text-decoration-line: none !important;
}
.bmw-modal-booking {
  display: block;
  width: fit-content;
  margin: 20px auto 0;
  background: #1d69d4;
  color: #fff;
  padding: 14px 48px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: center;
  transition: background .15s ease, transform .1s;
  border: 0;
  box-shadow: none;
}
.bmw-modal-booking:hover { background: #164fa0; transform: translateY(-1px); color: #fff; }
.bmw-modal-booking:active { transform: translateY(1px); }
.bmw-modal-booking:focus-visible { outline: 3px solid #ffd23f; outline-offset: 2px; }

/* COMING SOON モデルの「問い合わせする」ボタンはグレー */
.bmw-modal-booking.is-coming-soon { background: #6f6f6f; }
.bmw-modal-booking.is-coming-soon:hover { background: #555555; color: #fff; }

@media (max-width: 600px) {
  .bmw-modal-booking {
    display: block;
    width: 100%;
    margin: 16px 0 0;
    padding: 16px;
  }
}

/* モーダル下部の閉じるボタン（SP時のみ表示） */
.bmw-modal-close-bottom {
  display: none;
  width: 100%;
  padding: 14px;
  margin-top: 24px;
  background: rgba(0, 0, 0, 0.75);
  border: 2px solid rgba(0, 0, 0, 0.75);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.bmw-modal-close-bottom:hover { background: #1c69d4; border-color: #1c69d4; }
.bmw-modal-close-bottom:focus-visible { outline: 3px solid #1c69d4; outline-offset: 2px; }

@media (max-width: 600px) {
  .bmw-modal-overlay {
    padding: 0;
    /* iOS Safariのアドレスバー対応（dvhで実際の可視領域に合わせる） */
    height: 100vh;
    height: 100dvh;
  }
  .bmw-modal {
    border-radius: 0;
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    /* iOSのスクロール挙動を安定させる */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* paddingは内側のbodyに移動 — overflow-y:autoコンテナへのpadding-bottomは
       iOSで描画されないことがあるため */
  }
  .bmw-modal-img { border-radius: 0; aspect-ratio: 4 / 3; }
  .bmw-modal-body {
    padding: 20px 20px 32px;
    /* ホームバー・safe-area + 下部の閉じるボタンが隠れない余裕を確保 */
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  }
  .bmw-modal-name { font-size: 22px; }
  .bmw-modal-specs-table { grid-template-columns: 1fr; }

  /* SP時の×ボタン: 画面右上に固定、safe-area対応。
     z-indexを大きめにして、モーダル本体のスクロール内コンテンツに被られないようにする */
  .bmw-modal-close {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.75);
    border: 2px solid #fff;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
    z-index: 10010;
  }
  .bmw-modal-close svg { width: 24px; height: 24px; }

  /* SP時は下部の閉じるボタンも表示 */
  .bmw-modal-close-bottom {
    display: block;
  }
}

/* body-lock: iOS Safariでも確実にスクロールを止めるため position:fixed 方式 */
.bmw-body-lock {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}
