/**
 * モバイル固定CTA
 */

:root {
  --wrap-sticky-cta-height: 68px;
  --wrap-sticky-cta-viewport-gap: 0px;
  --wrap-sticky-cta-z: 99999;
  --wrap-sticky-cta-overlay-z: 100050;
}

.wrap-sticky-cta {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--wrap-sticky-cta-z);
  margin: 0;
  padding: 0;
  pointer-events: none;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.97);
}

/* Chrome スクロール時、バー下に見える隙間を同色で埋める */
.wrap-sticky-cta.is-viewport-pinned::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: var(--wrap-sticky-cta-viewport-gap, 0px);
  background: rgba(255, 255, 255, 0.97);
  pointer-events: none;
}

.wrap-sticky-cta__inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 8px max(8px, env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  pointer-events: auto;
  box-sizing: border-box;
}

.wrap-sticky-cta__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
  padding: 6px 4px;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.02em;
  text-align: center;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease, transform 0.1s ease;
  box-sizing: border-box;
}

.wrap-sticky-cta__btn:active {
  opacity: 0.88;
  transform: scale(0.98);
}

.wrap-sticky-cta__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wrap-sticky-cta__label {
  display: block;
  max-width: 100%;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.wrap-sticky-cta__btn--line {
  position: relative;
  background: #06c755;
  color: #fff;
}

.wrap-sticky-cta__badge {
  position: absolute;
  top: 3px;
  right: 3px;
  padding: 1px 5px;
  font-size: 7px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  color: #06c755;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.wrap-sticky-cta__btn--tel {
  background: #1a1a1a;
  color: #fff;
}

.wrap-sticky-cta__btn--form {
  background: #c9a227;
  color: #1a1a1a;
}

/* --- オーバーレイ表示時：モーダルをスティッキーバーの上に収める --- */

body.has-wrap-sticky-cta.modal-open {
  overflow: hidden;
}

body.has-wrap-sticky-cta.modal-open .modal {
  z-index: var(--wrap-sticky-cta-overlay-z) !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  padding-bottom: calc(var(--wrap-sticky-cta-height) + env(safe-area-inset-bottom, 0px)) !important;
  overflow-x: hidden;
  overflow-y: auto;
}

body.has-wrap-sticky-cta.modal-open .modal-backdrop {
  z-index: calc(var(--wrap-sticky-cta-overlay-z) - 10) !important;
}

body.has-wrap-sticky-cta.modal-open .modal-dialog {
  margin-top: 0.75rem;
  margin-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  max-height: calc(100% - var(--wrap-sticky-cta-height) - env(safe-area-inset-bottom, 0px) - 1rem);
}

body.has-wrap-sticky-cta.modal-open .modal-content {
  max-height: calc(100dvh - var(--wrap-sticky-cta-height) - env(safe-area-inset-bottom, 0px) - 1.5rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.has-wrap-sticky-cta .ppf-gf-dialog.is-open {
  padding-bottom: calc(var(--wrap-sticky-cta-height) + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

body.has-wrap-sticky-cta.ppf-gf-plan-sheet-open .ppf-gf-plan-sheet__panel {
  bottom: calc(var(--wrap-sticky-cta-height) + env(safe-area-inset-bottom, 0px));
}

body.has-wrap-sticky-cta.wrap-sticky-cta-overlay-active [role='dialog'].modal.show {
  padding-bottom: calc(var(--wrap-sticky-cta-height) + env(safe-area-inset-bottom, 0px)) !important;
}
