/* ===== Signup screen ===== */

/* box-sizing:border-box は application.css の全体リセットに統合済み */

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

/* .signup-page は min-height:100svh（＝ツールバーが縮んだときの小さい方のビューポート）なので、
   ツールバーが隠れると画面下端に数十pxの隙間が残る。application.css が html に
   淡いピンク×黄色のウォッシュを敷いたため、明示しないとその隙間にウォッシュが覗く。
   新規登録はコーラルのままにしたいので、キャンバス背景もコーラルで塞ぐ。
   ページCSSは yield :head で application.css より後に読まれるので後勝ちする。 */
html {
  background: #f57272;
}

.signup-page {
  min-height: 100svh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f57272;
  align-self: start;
  /* 招待コード欄を足して項目が6つになり縦が足りないので、カード上下の余白は最小限にする */
  padding: 10px 0;
  overflow: hidden;

}

.signup-card {
  width: 92%;
  max-width: 600px;
  /* .signup-page の padding 分を引く。引かないと max-height 内に収まっていても
     カードの下端がビューポートからはみ出して overflow:hidden で切り落とされる */
  max-height: calc(100svh - 20px);
  background: #f7feff;
  border-radius: 24px;
  /* 「新規登録」の上を詰める（32 → 14）。下は 24 残す */
  padding: 14px 24px 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
  text-align: center;
  /* 余白を詰めても足りない極端に低い画面では切り落とさずスクロールさせる
     （hidden のままだと Sign up ボタンに到達できなくなる） */
  overflow-y: auto;
  /* .signup-back の位置基準 */
  position: relative;
}

/* back（左上の ← ）。他画面のヘッダー戻る（.friend-add-back 等）と同じ
   44px タップ領域 ＋ 24px シェブロン。absolute にしてタイトルの上に余白を足さない */
.signup-back {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #0e0e0e;
  text-decoration: none;
  border-radius: 22px;
}

.signup-back:focus-visible {
  outline: 2px solid #ff4a1d;
  outline-offset: 2px;
}

/* title */
.signup-title {
  margin: 0 0 2px;
  font-size: 40px;
  font-weight: 700;
  text-align: center;
}

/* subtitle */
.signup-subtitle {
  margin: 0 0 20px;
  font-size: 25px;
  color: #666;
  text-align: center;
}

.signup-subtitle.is-error {
  font-size: 20px;
  color: #d93025;
  font-weight: 700;
}

/* error list */
.signup-errors {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(176, 0, 32, 0.06);
  border: 1px solid rgba(176, 0, 32, 0.18);
  text-align: left;
}

.signup-errors ul {
  margin: 0;
  padding-left: 18px;
}

.signup-errors li {
  font-size: 12px;
  color: #b00020;
}

/* field */
.signup-field {
  font-size: 30px;
  margin-bottom: 10px;
  text-align: left;
}

.signup-field label {
  display: block;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #0e0e0e;
}

.signup-label-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  /* 注記が長い（パスワードの「6文字以上の英数字（大小文字可）」）と 320px 幅では
     ラベルとの合計が内寸ぎりぎりになる。溢れさせずに注記だけ次の行へ落とす。
     nowrap のままだとカードから横に突き出す（横溢れは画面上では切り落とされて
     見えないので気付けない）。 */
  flex-wrap: wrap;
}

/* input */
.signup-input {
  width: 100%;
  border-radius: 12px;
  border: none;
  padding: 12px 14px;
  font-size: 20px;
  box-shadow: 0 0 0 1px #dde6ec;
  background: #ffffff;
  appearance: none;
  -webkit-appearance: none;
}

.signup-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px #ff4a1d;
}

/* Safari/Chrome 対策 */
.signup-input::-webkit-search-decoration,
.signup-input::-webkit-search-cancel-button,
.signup-input::-webkit-search-results-button,
.signup-input::-webkit-search-results-decoration {
  display: none;
}

/* button */
.signup-button {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 12px 0;
  background: #e86c6c;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  margin-top: 8px;
}

.signup-button:hover {
  opacity: 0.95;
}

/* field note */
.signup-field-note {
  display: block;
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}

/* trigger button (共通) */
.signup-datepicker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px;
  border: none;
  padding: 12px 14px;
  font-size: 20px;
  box-shadow: 0 0 0 1px #dde6ec;
  background: #ffffff;
  color: #0e0e0e;
  cursor: pointer;
  text-align: left;
}

/* ===== wheel picker ===== */

/* overlay */
.wheel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.wheel-overlay.is-open {
  opacity: 1;
}

/* bottom sheet modal */
.wheel-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #f2f2f7;
  border-radius: 16px 16px 0 0;
  z-index: 1001;
  display: none;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.wheel-modal.is-open {
  transform: translateY(0);
}

/* header */
.wheel-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.wheel-modal-header button {
  background: none;
  border: none;
  font-size: 17px;
  cursor: pointer;
  padding: 4px 8px;
}

.wheel-modal-header button:first-child {
  color: #666;
}

.wheel-modal-header button:last-child {
  color: #007aff;
  font-weight: 600;
}

.wheel-modal-header span {
  font-size: 17px;
  font-weight: 600;
  color: #000;
}

/* body: 5行 × 44px */
.wheel-modal-body {
  position: relative;
  display: flex;
  height: calc(44px * 5);
}

/* center highlight */
.wheel-highlight {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(44px * 2);
  height: 44px;
  background: rgba(0, 0, 0, 0.07);
  border-top: 0.5px solid rgba(0, 0, 0, 0.2);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 10;
}

/* columns */
.wheel-col {
  flex: 1;
  overflow-y: scroll;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  /* 1行ずつ止めるのは CSS の役目。JS で位置を補正してはいけない
     （補正の smooth スクロールが慣性と取り合って、がくがく動く）。
     選択値は wheel_picker_controller が「スクロール位置 ÷ 44px」で読む。 */
  scroll-snap-type: y mandatory;
  /* 年の列は端まで送れる（1900年/今年）。連鎖させると背後のページが動く */
  overscroll-behavior-y: contain;
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.3) 20%,
    black 40%,
    black 60%,
    rgba(0, 0, 0, 0.3) 80%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.3) 20%,
    black 40%,
    black 60%,
    rgba(0, 0, 0, 0.3) 80%,
    transparent 100%
  );
}

.wheel-col::-webkit-scrollbar {
  display: none;
}

/* spacer: 上下 2行分のパディング */
.wheel-spacer {
  height: calc(44px * 2);
  flex-shrink: 0;
}

/* item */
.wheel-item {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* **center でなければならない。** start にすると上の spacer（44px×2）のぶん
     スナップ位置が 88px ずれ、「スクロール位置 ÷ 44px」で読む選択値が2つ分
     ずれる（理由の詳細は feed.css の .fmap-wheel__item）。 */
  scroll-snap-align: center;
  font-size: 20px;
  color: #000;
  cursor: pointer;
  user-select: none;
}

/* ===== スマホ対応 ===== */
@media (max-width: 600px) {
  .signup-page {
    /* min-height は基底の 100svh のまま。auto に落とすとカードが縮んだ分だけ
       背景の赤が足りなくなり、画面下に白帯が出る */
    align-items: center;
    padding: 6px 0;
  }

  .signup-card {
    width: 92%;
    /* 「新規登録」の上を詰める（40 → 12）。下は 20 残す */
    padding: 12px 16px 20px;
    border-radius: 20px;
    margin: 0;
    min-height: auto;
    max-height: calc(100svh - 12px);
    overflow-y: auto;
  }

  .signup-title {
    font-size: 25px;
  }

  .signup-subtitle {
    font-size: 20px;
    /* タイトル下も詰めてフォーム 6 項目分の高さを稼ぐ */
    margin-bottom: 10px;
  }

  .signup-subtitle.is-error {
    font-size: 15px;
    color: #d93025;
  }

  .signup-field {
    font-size: 18px;
    margin-bottom: 12px;
  }

  .signup-field label {
    font-size: 14px;
  }

  .signup-input {
    font-size: 16px;
    padding: 10px 12px;
  }

  .signup-button {
    font-size: 16px;
    padding: 12px 0;
  }

  .signup-errors li {
    font-size: 11px;
  }

  .signup-field-note {
    font-size: 10px;
  }

  .signup-datepicker-trigger {
    font-size: 16px;
    padding: 10px 12px;
  }
}
/* ===== 確認メール送信後の待機画面（/signup/sent） ===== */

/* 項目が無いぶん上下の余白を戻す（フォーム 6 項目前提の詰めは要らない） */
.signup-card--sent {
  padding: 32px 24px;
}

/* 送信先アドレス。長いアドレスでカードを横に広げない */
.signup-sent__mail {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
  color: #0e0e0e;
  word-break: break-all;
}

.signup-sent__note {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: #666;
}

.signup-sent__status {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(14, 123, 90, 0.08);
  font-size: 13px;
  font-weight: 700;
  color: #0e7b5a;
}

/* button_to が <form> を挟むので、間隔はボタンの margin ではなく外側の gap で作る */
.signup-sent__actions {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.signup-sent__actions form {
  margin: 0;
}

.signup-sent__actions .signup-button {
  margin-top: 0;
}

/* .signup-button は <button> 用。<a> に付けたときに足りない分だけ補う */
.signup-button--link {
  display: block;
  text-decoration: none;
  text-align: center;
  line-height: 1.5;
}

/* 再送信は副アクション。塗りを外すので文字色も指定し直す
   （透明にするだけだと基底の color:#fff が残って読めなくなる） */
.signup-button--ghost {
  background: #ffffff;
  color: #0e0e0e;
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.18);
}

.signup-button--ghost:hover {
  background: #f3f6f8;
  opacity: 1;
}

/* ===== スマホ対応 =====
   上の基底ルールは既存の @media より後に書いてあるぶん、モバイルでも
   そのまま勝つ。打ち消したい値はこの最後のブロックで指定する */
@media (max-width: 600px) {
  .signup-card--sent {
    padding: 28px 16px;
  }

  .signup-sent__mail {
    font-size: 16px;
  }

  .signup-sent__note {
    font-size: 13px;
  }

  .signup-sent__actions {
    margin-top: 24px;
  }
}

/* ===== 送信先アドレスの訂正（/signup/email） ===== */

.signup-sent__foot {
  margin: 18px 0 0;
  text-align: center;
}

.signup-sent__link {
  font-size: 13px;
  color: rgba(0, 0, 0, 0.6);
  text-decoration: underline;
}

.signup-sent__link:hover {
  color: #0e0e0e;
}

/* 文中に置くときだけブロック用の余白を外す */
.signup-sent__mail--inline {
  display: inline-block;
  margin: 4px 0 0;
}

/* .signup-back の位置基準に合わせて、戻る矢印とタイトルが重ならない分だけ空ける */
.signup-card--sent .signup-back + .signup-title {
  margin-top: 8px;
}

/* 「現在の送り先」ブロックと入力欄が詰まるので、フォーム内のときだけ下を空ける */
.signup-card--sent form .signup-sent__note {
  margin-bottom: 22px;
}

/* 「確認メールをお送りしました」を外したので、タイトル直下に来るアドレスに
   その分の余白を持たせる（.signup-title は margin-bottom 2px しかない） */
.signup-sent__mail--lead {
  margin-top: 18px;
}
