@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@400;700;800;900&display=swap');

/* ═══════════════════════════════════════
   ふわふわ かわいいデザインシステム 🌸✨
   ═══════════════════════════════════════ */

:root {
  --pink: #a8eff9;
  --pink-deep: #48bdec;
  --lavender: #b5eafd;
  --lavender-deep: #5c9ff6;
  --sky-top: #c3f7fc;
  --sky-bottom: #e4f8fc;
  --card-bg: rgba(255, 255, 255, 0.72);
  --card-border: rgba(255, 255, 255, 0.6);
  --card-shadow: rgba(72, 184, 236, 0.12);
  --text-primary: #4a2040;
  --text-secondary: #8b6a8e;
  --text-muted: #b89abb;
  --accent: linear-gradient(135deg, #f9a8d4 0%, #c4b5fd 100%);
  --btn-primary: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  --btn-shadow: rgba(139, 92, 246, 0.35);
  --input-border: rgba(196, 181, 253, 0.5);
  --input-focus: rgba(139, 92, 246, 0.25);
  --success-bg: rgba(167, 243, 208, 0.4);
  --success-border: rgba(52, 211, 153, 0.5);
  --success-text: #065f46;
  --font: 'M PLUS Rounded 1c', 'Segoe UI', 'Hiragino Sans', sans-serif;
}

* {
  box-sizing: border-box;
}

/* ── 背景: ふわふわパステルスカイ ── */
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font);
  background:
    radial-gradient(ellipse at 15% 20%, rgba(249, 168, 212, 0.35) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 15%, rgba(196, 181, 253, 0.4) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(252, 228, 236, 0.5) 0%, transparent 50%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 50%, #fdf2f8 100%);
  overflow-x: hidden;
}

/* ── 星のキャンバス ── */
#starCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ── おみくじエフェクトキャンバス ── */
#effectCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ── レイアウト: ログイン・登録 ── */
body[data-page="login"],
body[data-page="regist"] {
  display: grid;
  place-items: center;
  padding: 24px;
}

/* ── ふわふわカード共通 ── */
.auth-shell,
.content-panel {
  position: relative;
  z-index: 1;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow:
    0 8px 32px var(--card-shadow),
    0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: floatIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-shell {
  width: min(440px, 100%);
  padding: 38px;
}

/* ── 見出し ── */
h1 {
  margin: 0;
  line-height: 1.2;
  background: var(--btn-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-shell h1 {
  font-size: 1.8rem;
  font-weight: 900;
}

/* ── テキスト ── */
p {
  color: var(--text-secondary);
  line-height: 1.7;
}

.auth-shell p {
  margin: 10px 0 28px;
}

/* ── ラベル ── */
label {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.92rem;
}

/* ── インプット ── */
input {
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--input-border);
  border-radius: 14px;
  padding: 0 16px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.8);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus {
  border-color: var(--lavender-deep);
  outline: none;
  box-shadow: 0 0 0 4px var(--input-focus);
}

input::placeholder {
  color: var(--text-muted);
}

/* ── ボタン共通 ── */
button {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  padding: 0 20px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.6);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.2);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

/* ── プライマリボタン（ログイン・送信） ── */
#loginButton,
#registSendButton,
#registVerifyButton {
  width: 100%;
  min-height: 52px;
  margin-top: 26px;
  color: #ffffff;
  background: var(--btn-primary);
  box-shadow: 0 8px 28px var(--btn-shadow);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

#loginButton:hover:not(:disabled),
#registSendButton:hover:not(:disabled),
#registVerifyButton:hover:not(:disabled) {
  box-shadow: 0 12px 36px var(--btn-shadow);
}

/* ── メッセージ ── */
.message {
  min-height: 24px;
  margin-top: 16px;
  color: #e11d48;
  font-weight: 700;
  line-height: 1.5;
}

/* ── ヘッダー ── */
.app-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px min(5vw, 56px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.brand {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
  background: var(--btn-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#logoutButton {
  border-radius: 12px;
  padding: 8px 20px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--card-border);
  font-size: 0.88rem;
}

/* ── ページシェル ── */
.page-shell {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 80px 24px;
}

/* ── コンテンツパネル ── */
.content-panel {
  padding: 46px;
}

.content-panel h1 {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 900;
}

.content-panel p {
  margin: 18px 0 0;
  font-size: 1.05rem;
}

/* ── ステータス ── */
.status {
  min-height: 24px;
  margin-top: 22px;
  color: var(--text-secondary);
  font-weight: 700;
}

/* ── おみくじセクション ── */
.omikuji {
  display: grid;
  gap: 18px;
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid rgba(196, 181, 253, 0.3);
}

.primary-action {
  width: fit-content;
  min-height: 50px;
  padding: 0 28px;
  color: #ffffff;
  background: var(--btn-primary);
  box-shadow: 0 8px 28px var(--btn-shadow);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  position: relative;
  overflow: hidden;
}

.primary-action::before {
  content: '🔮';
  margin-right: 8px;
}

.primary-action:hover:not(:disabled) {
  box-shadow: 0 12px 36px var(--btn-shadow);
}

/* ── おみくじ結果 ── */
.result {
  min-height: 92px;
  margin: 0;
  padding: 22px;
  border: 2px solid rgba(196, 181, 253, 0.3);
  border-radius: 16px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.5);
  font-weight: 700;
  line-height: 1.9;
  white-space: pre-wrap;
  backdrop-filter: blur(8px);
}

.notice {
  min-height: 24px;
  margin: 0;
  color: var(--text-secondary);
  font-weight: 700;
}

/* ── 登録ページ: ステップ情報 ── */
.hidden {
  display: none !important;
}

.step-info {
  margin: 0 0 8px;
  padding: 14px 18px;
  border-radius: 14px;
  color: #6d28d9;
  background: rgba(196, 181, 253, 0.2);
  border: 1px solid rgba(196, 181, 253, 0.3);
  font-weight: 700;
  line-height: 1.6;
}

/* ── 登録完了ボックス ── */
.success-box {
  margin-top: 18px;
  padding: 30px;
  border: 1px solid var(--success-border);
  border-radius: 16px;
  background: var(--success-bg);
  text-align: center;
  backdrop-filter: blur(8px);
}

.success-title {
  margin: 0;
  color: var(--success-text);
  font-size: 1.2rem;
  font-weight: 800;
}

.success-detail {
  margin: 10px 0 0;
  color: #3f6957;
  font-size: 0.92rem;
  line-height: 1.6;
}

.password-display {
  margin: 16px 0;
  padding: 16px 22px;
  border: 2px dashed var(--lavender-deep);
  border-radius: 14px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.8);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  word-break: break-all;
  user-select: all;
}

.login-link {
  display: inline-block;
  margin-top: 18px;
  padding: 12px 30px;
  border-radius: 14px;
  color: #ffffff;
  background: var(--btn-primary);
  box-shadow: 0 8px 28px var(--btn-shadow);
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.login-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px var(--btn-shadow);
}

/* ── サブリンク ── */
.sub-link {
  margin-top: 22px;
  text-align: center;
}

.sub-link a {
  color: var(--lavender-deep);
  font-weight: 700;
  text-decoration: none;
  transition: color 0.2s;
}

.sub-link a:hover {
  color: var(--pink-deep);
  text-decoration: underline;
}

/* ── おみくじローディング ── */
@keyframes sparkle {

  0%,
  100% {
    opacity: 0.4;
    transform: scale(0.8);
  }

  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

.loading-sparkle {
  display: inline-block;
  animation: sparkle 1.2s ease-in-out infinite;
}

/* ── レスポンシブ ── */
@media (max-width: 640px) {
  .app-header {
    padding: 16px 20px;
  }

  .page-shell {
    padding: 42px 16px;
  }

  .content-panel {
    padding: 30px 22px;
  }

  .primary-action {
    width: 100%;
  }

  .auth-shell {
    padding: 28px 24px;
  }
}