/* ベースのリセット ─────────────── */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.5;
}

/* レイアウト（モバイル優先）──────────── */
body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 2.5vw, 24px);
}

main {
  width: 100%;
  max-width: clamp(360px, 90vw, 640px);
  background: #fff;
  border: 1px solid #e5e9ef;
  border-radius: clamp(10px, 1.2vw, 12px);
  padding: clamp(16px, 3.5vw, 32px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.04);
}

/* ロゴ見出し ───────────────────── */
h1 {
  margin-bottom: clamp(12px, 2.5vw, 24px);
  text-align: center;
  line-height: 1;
}
h1 img {
  display: inline-block;
  width: clamp(140px, 40vw, 240px); /* 端末幅に応じてロゴが伸縮 */
  height: auto;
}

/* フォーム行 ───────────────────── */
form > div { margin-top: clamp(10px, 2.2vw, 16px); } /* 各行の間隔 */
form > div:first-of-type { margin-top: 0; }

label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: clamp(0.85rem, 1.4vw, 0.95rem);
  font-weight: 500;
}

/* 入力欄共通 */
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: clamp(10px, 1.6vw, 12px) clamp(12px, 2vw, 14px);
  font-size: clamp(1rem, 1.8vw, 1.05rem);
  border: 1px solid #ced4da;
  border-radius: 8px;
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus-visible {
  border-color: #4c9aff;
  box-shadow: 0 0 0 3px rgba(76, 154, 255, 0.25);
  outline: none;
}

/* 送信ボタン */
button[type="submit"] {
  display: inline-block;
  width: 100%;
  margin-top: clamp(18px, 3vw, 28px);
  padding: clamp(12px, 2vw, 14px) clamp(16px, 2.5vw, 18px);
  font-size: clamp(1rem, 1.8vw, 1.0625rem);
  font-weight: 600;
  color: #fff;
  background: #4c9aff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
button:hover { background: #3589f0; }
button:active { transform: translateY(1px); }

/* エラーメッセージ（フォーム下部） */
.error {
  margin-top: clamp(10px, 2vw, 14px);
  color: #d64545;
  font-size: clamp(0.85rem, 1.4vw, 0.95rem);
  text-align: center;
}

/* きわめて狭い画面で角丸・影を控えめに */
@media (max-width: 400px) {
  main { border-radius: 10px; box-shadow: 0 6px 12px rgba(0,0,0,0.03); }
}

/* 縦が低い端末は上寄せでスクロールしやすく */
@media (max-height: 600px) {
  body { align-items: flex-start; }
  main { margin-top: 8px; margin-bottom: 8px; }
}

/* タブレット以上で少しゆったり */
@media (min-width: 768px) { main { max-width: 560px; } }
@media (min-width: 1024px){ main { max-width: 640px; } }

/* 利用者設定配慮 */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  button:active { transform: none; }
}

/* ダークモード（任意） */
@media (prefers-color-scheme: dark) {
  html, body { background: #0f1720; color: #e6e6e6; }
  main { background: #111827; border-color: #1f2937; box-shadow: none; }
  input[type="text"], input[type="password"] {
    background-color: #0b1220;
    border-color: #263244;
    color: #e6e6e6;
  }
  input:focus-visible { box-shadow: 0 0 0 3px rgba(76, 154, 255, 0.35); }
  label { color: #d8dee9; }
  .error { color: #ff7b7b; }
}
