/* auth.css — ログイン / サインアップ / パスワード再設定で共有する外観
 *
 * 3画面が「同じ1枚の認証カードの中身が入れ替わっている」ように見えることを狙う。
 * 白〜ごく薄いグレーを地に、中央へ半透明ホワイトのガラスカードを浮かべ、
 * 背後にごく淡いブルー／パープルの光だまりを敷いて空気の層をつくる。
 *
 * ※ 各ページの <style> には、そのページ固有のもの（ロゴのサイコロ演出など）だけを残すこと。
 */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Gen Interface JP', 'GenInterfaceJP', 'Inter', 'Noto Sans JP',
               -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', sans-serif;
  background: #fafbfc; color: #1c1c1c;
  min-height: 100vh;
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* 中央背後の光だまり。面としては見せず、空気感だけを足す */
.auth-aura {
  position: fixed; left: 50%; top: 46%; translate: -50% -50%;
  width: min(900px, 130vw); height: 620px; pointer-events: none; z-index: 0;
  background:
    radial-gradient(42% 54% at 44% 40%, rgba(120, 158, 232, .13), transparent 70%),
    radial-gradient(36% 48% at 60% 58%, rgba(150, 140, 220, .10), transparent 72%);
  filter: blur(34px);
}

.wrap {
  position: relative; z-index: 1;
  flex: 1;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 64px 20px 32px;
}
.box { width: 100%; max-width: 420px; }

/* ── 認証カード ─────────────────────────────────────────────────────────
   位置と幅は3画面で共通。中身だけが入れ替わるように見せる。 */
.auth-card {
  padding: 34px 34px 30px;
  border-radius: 28px;
  border: 1px solid rgba(23, 24, 27, .07);
  background: linear-gradient(180deg, rgba(255,255,255,.9) 0%, rgba(255,255,255,.66) 100%);
  backdrop-filter: blur(20px) saturate(1.35);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    0 1px 2px rgba(16,24,40,.04),
    0 18px 44px rgba(16,24,40,.07);
}
@media (max-width: 480px) { .auth-card { padding: 26px 20px 24px; border-radius: 22px; } }

/* ── ブランド領域 → 操作領域 の順に視線を流す ───────────────────────────── */
.logo { position: relative; display: flex; justify-content: center; margin-bottom: 22px; perspective: 420px; }
.logo img { width: 38px; height: 38px; object-fit: contain; }

.heading { text-align: center; margin-bottom: 30px; }
/* ブランドコピー（第一印象）。行間をゆったり取り、落ち着いて見せる */
.heading .t1 {
  font-size: 15px; font-weight: 400; color: #4b4d55; line-height: 2;
  letter-spacing: .01em;
}
/* 認証タイトルはブランドコピーの下位階層。大きくしすぎない */
.heading .t2 {
  font-size: 19px; font-weight: 400; color: #17181b; letter-spacing: -.3px;
  margin-top: 18px;
}
@media (max-width: 480px) { .heading .t1 { font-size: 13px; } .heading .t2 { font-size: 17px; } }

/* ── 入力欄: ライトガラス型フィールド ────────────────────────────────────── */
.field-label { font-size: 12.5px; color: #62646c; margin-bottom: 8px; }
.input {
  width: 100%; height: 46px; padding: 0 15px;
  border: 1px solid rgba(16, 24, 40, .09); border-radius: 15px;
  font-size: 14px; font-family: inherit; color: #1c1c1c;
  background: rgba(255, 255, 255, .72);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.input::placeholder { color: #c2c4cb; }
.input:hover { border-color: rgba(16, 24, 40, .14); }
/* 強い青枠ではなく、薄いエッジライトと控えめな外周グローで反応させる */
.input:focus {
  background: #fff;
  border-color: rgba(108, 148, 216, .5);
  box-shadow: 0 0 0 3px rgba(108, 148, 216, .13);
}
.input + .input { margin-top: 10px; }
.hint { font-size: 12px; color: #a0a2a9; line-height: 1.7; margin-top: 10px; }

/* ── Primary CTA: 透明感のあるクリアブルーのガラスボタン ────────────────── */
.btn-primary {
  position: relative; overflow: hidden;
  width: 100%; height: 46px; margin-top: 18px;
  border: none; border-radius: 15px;
  color: #fff; text-shadow: 0 1px 2px rgba(24, 52, 100, .28);
  background:
    linear-gradient(180deg, rgba(255,255,255,.3) 0%, rgba(255,255,255,.06) 44%, rgba(255,255,255,0) 62%),
    linear-gradient(168deg, #77a1e6 0%, #4a74c4 44%, #3f66ae 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55),
    inset 0 10px 18px -10px rgba(255,255,255,.5),
    inset 0 -1px 0 rgba(30, 62, 118, .3),
    0 0 0 1px rgba(108, 148, 216, .28),
    0 6px 16px rgba(66, 105, 180, .24);
  font-size: 14px; font-weight: 400; font-family: inherit; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .2s cubic-bezier(.22,.61,.36,1),
              box-shadow .2s cubic-bezier(.22,.61,.36,1), background .2s ease;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  background:
    linear-gradient(180deg, rgba(255,255,255,.38) 0%, rgba(255,255,255,.09) 44%, rgba(255,255,255,0) 62%),
    linear-gradient(168deg, #83abea 0%, #5080d0 44%, #4470b8 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.7),
    inset 0 10px 18px -10px rgba(255,255,255,.62),
    inset 0 -1px 0 rgba(30, 62, 118, .28),
    0 0 0 1px rgba(126, 164, 226, .4),
    0 12px 26px rgba(66, 105, 180, .28);
}
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-primary svg { width: 15px; height: 15px; }
/* 押し込み → 弾性で戻る（1 → .976 → 1.012 → 1） */
.btn-primary.cta-bounce { animation: authBounce .28s cubic-bezier(.22,.61,.36,1); }
.btn-primary:hover.cta-bounce { animation-name: authBounceUp; }
@keyframes authBounce {
  0% { transform: scale(1); } 22% { transform: scale(.976); }
  58% { transform: scale(1.012); } 100% { transform: scale(1); }
}
@keyframes authBounceUp {
  0% { transform: translateY(-2px) scale(1); } 22% { transform: translateY(-1px) scale(.976); }
  58% { transform: translateY(-2px) scale(1.012); } 100% { transform: translateY(-2px) scale(1); }
}
.spinner {
  width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error {
  display: none; margin-top: 14px; padding: 10px 14px;
  background: rgba(220, 38, 38, .06); border: 1px solid rgba(220, 38, 38, .16);
  border-radius: 12px; font-size: 12.5px; color: #b8342a; line-height: 1.6;
}

/* ── 区切り: 極薄のライン ＋ 低コントラストのラベル ─────────────────────── */
.divider {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 24px 0 18px; color: #b0b2b9; font-size: 11.5px; white-space: nowrap;
}
.divider::before, .divider::after {
  content: ''; width: 44px; height: 1px; background: rgba(16, 24, 40, .08);
}

/* ── セカンダリの認証手段。同じ系統のソフトボタンで揃える ───────────────── */
.oauth-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
/* 補助的なもの（パスキー / SSO）は一段軽い見た目にする */
.oauth-grid.two { margin-top: 10px; }
.oauth-btn {
  height: 58px; border-radius: 15px;
  border: 1px solid rgba(16, 24, 40, .07);
  background: rgba(255, 255, 255, .74);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  font-size: 12px; font-weight: 400; color: #4b4d55; cursor: pointer; font-family: inherit;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 2px rgba(16,24,40,.03);
  transition: transform .2s cubic-bezier(.22,.61,.36,1),
              box-shadow .2s cubic-bezier(.22,.61,.36,1),
              border-color .2s ease, background .2s ease;
}
.oauth-btn:hover {
  transform: translateY(-2px); background: #fff;
  border-color: rgba(16, 24, 40, .12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,1), 0 8px 20px rgba(16,24,40,.07);
}
.oauth-btn:active { transform: translateY(0) scale(.985); }
.oauth-btn svg, .oauth-btn img { width: 20px; height: 20px; display: block; }
.oauth-grid.two .oauth-btn { height: 50px; font-size: 11.5px; background: rgba(255,255,255,.55); }
.oauth-grid.two .oauth-btn svg { width: 17px; height: 17px; }
/* 未設定・非対応の認証方法（押すと理由をトーストで案内） */
.oauth-btn.disabled { opacity: .4; }
.oauth-btn.disabled:hover { transform: none; background: rgba(255,255,255,.74); border-color: rgba(16,24,40,.07); box-shadow: none; }

/* ── 分岐リンク・規約 ───────────────────────────────────────────────────── */
.signup {
  text-align: center; margin-top: 22px; padding-top: 20px;
  border-top: 1px solid rgba(16, 24, 40, .06);
  font-size: 12.5px; color: #8b8e96;
}
.signup a { color: #4a6da8; text-decoration: none; margin-left: 4px; transition: color .2s ease; }
.signup a:hover { color: #3f66ae; text-decoration: underline; }
.legal { text-align: center; margin-top: 14px; font-size: 11px; color: #b0b2b9; line-height: 1.9; }
.legal a { color: #8b8e96; text-decoration: underline; cursor: pointer; }
.legal a:hover { color: #4b4d55; }

/* ── 周辺要素は主張を下げる ─────────────────────────────────────────────── */
.foot { position: relative; z-index: 1; display: flex; justify-content: center; padding: 18px; }
.lang {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: #b0b2b9; cursor: default;
}
.lang svg { width: 14px; height: 14px; }
.help {
  position: fixed; left: 18px; bottom: 16px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgba(16, 24, 40, .08); background: rgba(255,255,255,.7); color: #b0b2b9;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; transition: color .2s ease, border-color .2s ease;
}
.help:hover { color: #4b4d55; border-color: rgba(16, 24, 40, .14); }

/* トースト */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: #1c1c1c; color: #fff; font-size: 13px; z-index: 20;
  padding: 10px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 段階の切り替え: 別ページに飛ぶのではなく、カードの中身が差し替わる ──── */
.step { display: none; }
.step.show { display: block; }
/* メールを入れて「続行」した後にだけ出す欄（ログイン=パスワード / サインアップ=氏名など） */
#pw-field, #more-fields { display: none; }
#pw-field.show, #more-fields.show { display: block; }
/* 下から現れる（メール欄が上に詰まり、続きが差し込まれる感覚にする） */
#pw-field.show, #more-fields.show { animation: authStepIn .24s cubic-bezier(.22,.61,.36,1) both; }
@keyframes authStepIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.step.show.enter { animation: authStepIn .26s cubic-bezier(.22,.61,.36,1) both; }
/* 出ていく側は、少しだけ沈んで消える */
.step.leaving { display: block; animation: authStepOut .18s ease-in both; pointer-events: none; }
@keyframes authStepOut {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-6px); }
}

/* ── 確認コード: 6つのセル ───────────────────────────────────────────────── */
.code-cells { display: flex; gap: 8px; justify-content: center; }
.code-cell {
  width: 46px; height: 54px; padding: 0;
  border: 1px solid rgba(16, 24, 40, .09); border-radius: 14px;
  background: rgba(255, 255, 255, .72);
  font-family: inherit; font-size: 22px; font-weight: 400; color: #17181b;
  text-align: center; outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease, transform .2s cubic-bezier(.22,.61,.36,1);
}
@media (max-width: 400px) { .code-cell { width: 40px; height: 48px; font-size: 19px; } }
.code-cell.filled { background: #fff; border-color: rgba(16, 24, 40, .14); }
/* フォーカス中はカーソルではなくセル全体が静かに発光する */
.code-cell:focus {
  background: #fff; transform: translateY(-1px);
  border-color: rgba(108, 148, 216, .55);
  box-shadow: 0 0 0 3px rgba(108, 148, 216, .14), 0 4px 12px rgba(66, 105, 180, .12);
}
/* 自動入力・貼り付けで埋まったときは左から順に軽く浮かび上がる */
@keyframes codePop {
  0%   { opacity: 0; transform: translateY(5px) scale(.96); }
  100% { opacity: 1; transform: none; }
}
.code-cell.pop { animation: codePop .26s cubic-bezier(.22,.61,.36,1) both; }
.code-note { font-size: 12px; color: #a0a2a9; line-height: 1.8; margin-top: 14px; text-align: center; }
.code-note b { display: block; font-weight: 400; color: #4b4d55; }
/* 補助操作はまとめて1つの帯に整列させる */
.code-actions {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(16, 24, 40, .06);
}
.code-link {
  border: none; background: none; padding: 0; cursor: pointer; font-family: inherit;
  font-size: 12px; color: #8b8e96; transition: color .2s ease;
}
.code-link:hover { color: #17181b; }
.code-link:disabled { color: #cfd0d5; cursor: default; }

/* パスワード表示切替（目のアイコン） */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-eye {
  position: absolute; top: 0; right: 0; width: 44px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; padding: 0; cursor: pointer; color: #b0b2b9;
  transition: color .2s ease;
}
.pw-eye:hover { color: #4b4d55; }
.pw-eye svg { width: 17px; height: 17px; display: block; }
/* 既定（パスワード非表示）= 目に斜線 / 表示中 = 開いた目 */
.pw-eye .eye-on { display: none; }
.pw-eye .eye-off { display: block; }
.pw-eye.on .eye-on { display: block; }
.pw-eye.on .eye-off { display: none; }

@media (prefers-reduced-motion: reduce) {
  .btn-primary:hover, .oauth-btn:hover, .code-cell:focus { transform: none; }
  .btn-primary.cta-bounce, .step.show.enter, .step.leaving, .code-cell.pop { animation: none; }
}

/* ── 言語切替（ログイン・サインアップ・再設定で共通）────────────────────────
   フッターの控えめな2択。選択中だけ濃くし、主張はさせない。 */
.lang-opt {
  padding: 0; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: inherit; color: inherit;
  opacity: .55; transition: opacity .18s ease;
}
.lang-opt:hover { opacity: .85; }
.lang-opt.on { opacity: 1; font-weight: 500; }
.lang-sep { opacity: .3; margin: 0 2px; }
