/* ==========================================================
   PWAインストール導線 (トップページ専用 / モバイルのみ)
   - Hero直後・Builder直前に置く独立カード + iOS向け手順ボトムシート
   - 既存クラスは一切上書きしない。すべて .pwa- 接頭辞の新規クラス
   - 表示可否はHTML側のインラインスクリプトが初回paint前に確定する(CLS防止)
   ========================================================== */

/* 既定は非表示。対象環境のみ HTML の hidden 属性が外れて表示される */
.pwa-entry[hidden],
.pwa-sheet[hidden] { display: none !important; }

/* ---------- 導線カード ---------- */
.pwa-entry {
  /* Hero直下に少し間を置く。下側は .tool の padding-top(64px)が受けるため0 */
  margin: 28px auto 0;
  padding: 0 16px;
  max-width: 560px;
}

.pwa-entry-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 14px 14px;
  border: 1.5px dashed var(--c-primary, #e9748f);
  border-radius: var(--radius, 14px);
  background: var(--c-accent-soft, #fff5f7);
  box-shadow: 0 2px 10px rgba(180, 120, 130, 0.08);
}

.pwa-entry-badge {
  position: absolute;
  top: -10px;
  left: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--c-primary, #e9748f);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.6;
}

/* 見出し行: アイコン + テキスト */
.pwa-entry-head {
  display: flex;
  align-items: center;
  gap: 11px;
  /* ×ボタンと重ならないよう右に逃がす */
  padding-right: 32px;
}

.pwa-entry-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: block;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.pwa-entry-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--c-text, #4a3b38);
}

.pwa-entry-lead {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.6;
  letter-spacing: -0.01em;
  color: var(--c-text-sub, #82706a);
}

/* CTA: Heroの主CTAより控えめなセカンダリ表現(塗りは使うが小さめ・低彩度側) */
.pwa-entry-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1.5px solid var(--c-primary, #e9748f);
  border-radius: 999px;
  background: var(--c-white, #fff);
  color: var(--c-primary-dark, #c85471);
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

/* CTAはOSごとに1つだけ出す(data-os は初回paint前に確定) */
.pwa-cta-ios,
.pwa-cta-android { display: none; }
.pwa-entry[data-os="ios"] .pwa-cta-ios { display: inline; }
.pwa-entry[data-os="android"] .pwa-cta-android { display: inline; }

.pwa-entry-cta:hover { background: var(--c-accent, #fdeef2); }
.pwa-entry-cta:active { transform: translateY(1px); }

.pwa-entry-cta-note {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.75;
}

/* 閉じる: CTAとは独立した操作要素。タップターゲット44px確保 */
.pwa-entry-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--c-text-sub, #82706a);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}

.pwa-entry-close:hover { background: rgba(0, 0, 0, 0.05); }

/* ---------- iOS手順ボトムシート ---------- */
.pwa-sheet {
  position: fixed;
  inset: 0;
  z-index: 1100;              /* sticky-cta(250) / download modal(1000) より前面 */
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(40, 25, 30, 0.5);
}

.pwa-sheet-panel {
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  padding: 22px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  border-radius: 18px 18px 0 0;
  background: var(--c-white, #fff);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
}

.pwa-sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 40px;
  margin-bottom: 4px;
}

.pwa-sheet-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: block;
}

.pwa-sheet-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--c-text, #4a3b38);
}

.pwa-sheet-lead {
  margin: 0 0 14px;
  font-size: 0.82rem;
  color: var(--c-text-sub, #82706a);
}

.pwa-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  counter-reset: pwa-step;
}

.pwa-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 12px;
  background: var(--c-accent-soft, #fff5f7);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--c-text, #4a3b38);
}

.pwa-steps li::before {
  counter-increment: pwa-step;
  content: counter(pwa-step);
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--c-primary, #e9748f);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-sheet-note {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--c-accent, #fdeef2);
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--c-text, #4a3b38);
}

.pwa-sheet-sub {
  margin: 8px 0 0;
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--c-text-sub, #82706a);
}

.pwa-sheet-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  color: var(--c-text-sub, #82706a);
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

.pwa-sheet-close:hover { background: rgba(0, 0, 0, 0.09); }

/* キーボード操作時のフォーカスは必ず見えるようにする */
.pwa-entry-cta:focus-visible,
.pwa-entry-close:focus-visible,
.pwa-sheet-close:focus-visible {
  outline: 3px solid var(--c-primary-dark, #c85471);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .pwa-entry-cta:active { transform: none; }
}

/* 320px でも横あふれさせない */
@media (max-width: 359px) {
  .pwa-entry { padding: 0 12px; }
  .pwa-entry-title { font-size: 0.94rem; }
  .pwa-entry-cta { font-size: 0.88rem; }
}
