/* ============================================================
   Cocoa ランディングページ — トーク画面スタイル
   ------------------------------------------------------------
   ページ全体がひとつのチャット。
   デスクトップでは中央にスマホ幅のカラムとして収まります。
   ============================================================ */

/* ---------- デザイントークン ---------- */
:root {
  --bg: #0A0608;
  --bg-2: #150C11;

  --surface: rgba(255,255,255,.050);
  --surface-2: rgba(255,255,255,.080);
  --border: rgba(255,255,255,.10);

  --text: #F7F2F4;
  --text-dim: #BCADB4;
  --text-mute: #91828A;

  --accent: #E0416A;
  --accent-2: #FF7BA0;
  --cta-from: #C9184A;   /* 白文字で 4.5:1 以上を確保するため、あえて深め */
  --cta-to: #6E0B28;

  /* z-index スケール（散らかさないため、必ずここから使う） */
  --z-content: 1;
  --z-overlay: 10;
  --z-sticky: 50;
  --z-warning: 60;
  --z-gate: 100;

  /* 見出しは明朝。本文はゴシックのまま（明朝だけだと長文が読みにくい） */
  --font-serif: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", YuMincho,
                "Noto Serif JP", "Songti SC", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP",
               Meiryo, "Yu Gothic", system-ui, sans-serif;

  --app-w: 480px;
}

/* ---------- ベース ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* ⚠ これは承重壁。JS が .cta を hidden で消すため（iOS 分岐）、
   .cta の display を上書きしないと hidden が効かない。 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.75;
  /* デスクトップで余白が寂しくならないよう、うっすら赤い照明を敷く */
  background-image:
    radial-gradient(120% 60% at 50% -10%, rgba(224,65,106,.16), transparent 60%),
    radial-gradient(90% 50% at 50% 110%, rgba(110,11,40,.24), transparent 65%);
  background-attachment: fixed;
}

img { max-width: 100%; height: auto; display: block; }
p { margin: 0; }

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .92em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--cta-from);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ---------- スマホ幅のカラム ---------- */
.app {
  position: relative;
  max-width: var(--app-w);
  margin: 0 auto;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  box-shadow: 0 0 80px rgba(0,0,0,.7);
}

/* ---------- チャットヘッダー ---------- */
.chatbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(10,6,8,.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.chatbar__back { color: var(--text-mute); display: grid; place-items: center; }

.chatbar__avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 18%;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.chatbar__id { min-width: 0; }

.chatbar__name {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: .04em;
}

.chatbar__status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-mute);
}

.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 6px #3ddc84;
}

/* ---------- トーク本体 ---------- */
.chat {
  flex: 1;
  padding: 16px 14px 0;
  /* 下の composer に最後のメッセージが隠れないよう余白を確保 */
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}

/* 日付・区切りのピル */
.divider {
  text-align: center;
  margin: 26px 0 14px;
}
.divider span {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-mute);
  font-size: 11px;
  letter-spacing: .08em;
  padding: 4px 14px;
  border-radius: 999px;
}

/* ---------- メッセージ ---------- */
.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}
.msg--her { justify-content: flex-start; }
.msg--me  { justify-content: flex-end; }

.msg__avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 18%;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.msg__bubble {
  max-width: 78%;
  padding: 9px 14px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.7;
  word-break: break-word;
}
.msg--her .msg__bubble { border-bottom-left-radius: 6px; }
.msg--me  .msg__bubble {
  border-bottom-right-radius: 6px;
  background: linear-gradient(135deg, var(--cta-from), var(--cta-to));
  border-color: rgba(255,255,255,.14);
  color: #fff;
}

/* 続きのメッセージは少しだけ詰める */
.msg--cont { margin-top: -3px; }

/* 画像メッセージ */
.msg--photo .msg__bubble {
  padding: 4px;
  max-width: 70%;
  overflow: hidden;
}
.msg--photo img {
  width: 100%;
  border-radius: 14px;
}

.msg__hint {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 8px;
}

/* カード系（プロフィール / 機能 / 手順） */
.msg__bubble--card {
  max-width: 100%;
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  border-bottom-left-radius: 6px;
  background: var(--bg-2);
}
.card__lead {
  font-size: 13.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* 「入力中…」 */
.typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 13px 15px;
}
.typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-mute);
  animation: typing-bounce 1.3s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .18s; }
.typing span:nth-child(3) { animation-delay: .36s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

.receipt {
  text-align: right;
  font-size: 11px;
  color: var(--text-mute);
  padding-right: 4px;
  margin: 2px 0 0;
}

/* ---------- プロフィール（facts） ---------- */
.facts { margin: 0; }
.facts > div {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.facts > div:last-child { border-bottom: 0; padding-bottom: 0; }
.facts dt {
  flex: 0 0 76px;
  color: var(--text-mute);
  font-size: 12.5px;
}
.facts dd { margin: 0; color: var(--text); }

/* ---------- 機能リスト ---------- */
.features { list-style: none; margin: 0; padding: 0; }
.features li {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.features li:last-child { border-bottom: 0; padding-bottom: 0; }

.features__icon {
  flex: 0 0 34px;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(224,65,106,.14);
  color: var(--accent-2);
  border: 1px solid rgba(224,65,106,.22);
}

.features h2 { font-size: 14px; line-height: 1.5; margin-bottom: 3px; }
.features p { font-size: 12.5px; line-height: 1.65; color: var(--text-dim); }

/* ---------- 手順リスト ---------- */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; padding: 11px 0; }
.steps li:not(:last-child) { border-bottom: 1px solid var(--border); }

.steps__num {
  flex: 0 0 26px;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--cta-from), var(--cta-to));
}

.steps h2 { font-size: 14px; line-height: 1.5; margin-bottom: 3px; }
.steps p { font-size: 12.5px; line-height: 1.65; color: var(--text-dim); }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 22px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--cta-from), var(--cta-to));
  color: #fff;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .06em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(201,24,74,.34);
}

/* トーク内に置く CTA ブロック */
.cta { display: flex; flex-direction: column; align-items: center; }
.cta--bubble {
  margin: 20px auto 8px;
  max-width: 330px;
  width: 100%;
}

.cta__note {
  font-size: 11.5px;
  color: var(--text-mute);
  margin-top: 8px;
  text-align: center;
}

/* ---------- 画面下に貼りつく「入力欄」＝ CTA ---------- */
.composer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--app-w);
  z-index: var(--z-sticky);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10,6,8,.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}

.composer__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 5px 5px 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
}

.composer__field {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer__send {
  flex: 0 0 38px;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--cta-from), var(--cta-to));
  box-shadow: 0 4px 14px rgba(201,24,74,.4);
}

/* ---------- iOS 案内 / QR ---------- */
.notice {
  margin: 14px auto;
  max-width: 340px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.7;
  text-align: center;
}
.notice strong { color: var(--text); }

.msg--qr .msg__bubble { text-align: center; }
.msg--qr img {
  margin: 10px auto 0;
  border-radius: 10px;
  background: #fff;
  /* QR の静默区（クワイエットゾーン）。規格上は 4 モジュール分必要で、
     この QR は 33 モジュール構成なので約 18px 要る。
     6px では白枠が細すぎて、スマホのカメラが読み取れないことがある。 */
  padding: 16px;
}

/* ---------- 法的表記 ---------- */
.footer__legal {
  margin: 30px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-mute);
}
.footer__legal p + p { margin-top: 7px; }
.footer__age {
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: .06em;
}

/* ---------- 年齢確認 ---------- */
.agegate {
  position: fixed;
  inset: 0;
  z-index: var(--z-gate);
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10,6,8,.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.agegate__box {
  width: 100%;
  max-width: 350px;
  text-align: center;
  padding: 28px 22px;
  border-radius: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
}

.agegate__avatar {
  width: 78px; height: 78px;
  margin: 0 auto 12px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 18%;
  border: 2px solid rgba(224,65,106,.4);
}

.agegate__brand {
  font-family: var(--font-serif);
  font-size: 20px;
  letter-spacing: .16em;
  color: var(--accent-2);
  margin-bottom: 6px;
}

.agegate__title {
  font-family: var(--font-serif);
  font-size: 21px;
  margin-bottom: 12px;
}

.agegate__text {
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--text-dim);
  margin-bottom: 20px;
}

/* 年齢確認の中では CTA の鼓動を止める */
.agegate .btn { animation: none; }

.agegate__no {
  display: inline-block;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-mute);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- 設定未完了の警告 ---------- */
.setup-warning {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-w);
  z-index: var(--z-warning);
  background: #C9184A;
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  padding: 9px 14px;
}

/* ============================================================
   表示アニメーション
   .reveal は JS が付与します。JS が無い環境では最初から
   見えていてほしいので、CSS 側では付けません。
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(10px);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .45s ease, transform .45s ease;
}

/* ---------- 動きを抑えたい人には全部止める ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.is-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .typing span { animation: none; opacity: .6; }
}

/* ---------- デスクトップ ---------- */
@media (min-width: 560px) {
  .msg__bubble { max-width: 74%; }
  .msg--photo .msg__bubble { max-width: 62%; }
}
