/* =========================================================
   Wideweb ログイン／新規ID登録／登録完了
   白地・グレーの舞台・STEP表示・大きな入力欄と全幅ボタン。
   落ち着いた認証画面の定石に沿いつつ、色・図・文言は Wideweb 独自。
   ========================================================= */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --stage: #f4f6f8;
  --card: #ffffff;
  --ink: #1c2733;
  --ink-2: #566274;
  --ink-3: #8691a1;
  --line: #dfe4ea;
  --line-strong: #8a95a3;
  --accent: #0a7c86;
  --accent-soft: #e3f3f4;
  --on-accent: #ffffff;
  --danger: #d3312b;
  --ok: #1a8a4f;
  --ok-bg: #e6f7ee;
  --seg-active: #ececee;

  --font-head: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Noto Sans CJK JP", Meiryo, sans-serif;
  --font-body: "IBM Plex Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Noto Sans CJK JP", Meiryo, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1520;
    --stage: #09101a;
    --card: #131d2b;
    --ink: #e8eef6;
    --ink-2: #a8b6c9;
    --ink-3: #7a8aa3;
    --line: #243249;
    --line-strong: #4f617c;
    --accent: #4fc3cc;
    --accent-soft: #12333a;
    --on-accent: #06222a;
    --danger: #ff7d75;
    --ok: #55d08a;
    --ok-bg: #12301f;
    --seg-active: #1b2738;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1520;
  --stage: #09101a;
  --card: #131d2b;
  --ink: #e8eef6;
  --ink-2: #a8b6c9;
  --ink-3: #7a8aa3;
  --line: #243249;
  --line-strong: #4f617c;
  --accent: #4fc3cc;
  --accent-soft: #12333a;
  --on-accent: #06222a;
  --danger: #ff7d75;
  --ok: #55d08a;
  --ok-bg: #12301f;
  --seg-active: #1b2738;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 400 15px/1.75 var(--font-body);
}

[hidden] { display: none !important; }

a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }

button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.container { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }

/* =========================
   ヘッダー・フッター
   ========================= */
.site-header { background: var(--bg); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 84px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-wordmark { font-family: var(--font-head); font-size: 28px; font-weight: 900; letter-spacing: -0.02em; line-height: 1; }

.header-link { font-size: 15px; }

.site-footer {
  padding: 26px 16px 30px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-2);
  font-size: 13px;
  text-align: center;
}
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 0; margin: 0 0 8px; padding: 0; list-style: none; }
.foot-links li + li::before { content: "-"; margin: 0 14px; color: var(--ink-3); }
.site-footer p { margin: 0; }

/* =========================
   ボタン・入力欄（共通）
   ========================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 54px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease, background-color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-block { display: flex; width: 100%; }
.btn-primary { color: var(--on-accent); background: var(--accent); }
.btn-primary:hover { filter: brightness(0.93); }
.btn-primary:active { filter: brightness(0.86); }
.btn-outline { color: var(--accent); background: transparent; border-color: var(--accent); }
.btn-outline:hover { background: var(--accent-soft); }
.btn-plain { color: var(--ink); background: var(--bg); border-color: var(--line); }
.btn-plain:hover { background: var(--stage); }

.field { margin-bottom: 18px; }
.label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: inherit;
  font-size: 16px; /* iOSで入力時に拡大されないよう16px */
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder { color: var(--ink-3); }
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
input.is-invalid { border-color: var(--danger); }
input.is-invalid:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 52px; }
.eye {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 52px;
  height: 54px;
  padding: 0;
  color: var(--ink-2);
  background: none;
  border: 0;
  cursor: pointer;
}
.eye:hover { color: var(--ink); }
.eye svg { width: 22px; height: 22px; }
.eye .eye-off { display: none; }
.eye[aria-pressed="true"] .eye-on { display: none; }
.eye[aria-pressed="true"] .eye-off { display: block; }

.hint { margin: 6px 0 0; color: var(--ink-3); font-size: 13px; line-height: 1.6; }

.field-error { margin: 6px 0 0; color: var(--danger); font-size: 13px; line-height: 1.5; }
.field-error:empty { display: none; }

.note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 22px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.7;
}
.note::before {
  content: "i";
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 50%;
  font: italic 700 11px/1 Georgia, serif;
}

/* 「ログインできない場合」の折りたたみ */
.help { margin: 18px 0 0; text-align: center; }
.help summary { display: inline-block; color: var(--accent); font-size: 15px; cursor: pointer; list-style: none; }
.help summary::-webkit-details-marker { display: none; }
.help summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.help ul {
  margin: 12px 0 0;
  padding: 14px 16px 14px 32px;
  color: var(--ink-2);
  background: var(--stage);
  border-radius: 4px;
  font-size: 13.5px;
  line-height: 1.8;
  text-align: left;
}

/* テーマ切り替え（カード右下） */
.theme-row { display: flex; justify-content: flex-end; margin-top: 22px; }
.theme-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  color: var(--accent);
  background: none;
  border: 0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.theme-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.theme-link svg { width: 18px; height: 18px; }

/* =========================
   ログイン
   ========================= */
body.is-stage { background: var(--stage); }
body.is-stage .site-header { border-bottom: 0; }

.stage { flex: 1; padding: 56px 0 72px; }

.login-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 520px;
  align-items: center;
  gap: 64px;
}

.aside-title {
  margin: 0 0 14px;
  font-family: var(--font-head);
  font-size: 36px;
  font-weight: 900;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.aside-lead { margin: 0 0 28px; color: var(--ink-2); font-size: 16px; }

.aside-cards { display: grid; gap: 12px; max-width: 420px; }
.aside-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.aside-card .ico {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 10px;
}
.aside-card .ico svg { width: 22px; height: 22px; }
.aside-card b { display: block; font-size: 15px; }
.aside-card span { color: var(--ink-2); font-size: 13px; }

.login-card {
  padding: 52px 52px 34px;
  background: var(--card);
  border: 1px solid var(--line);
}

.card-title {
  margin: 0 0 28px;
  font-family: var(--font-head);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.35;
}

.back {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: -8px 0 8px -8px;
  padding: 0;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.back:hover { background: var(--stage); }
.back svg { width: 22px; height: 22px; }

.who-id {
  margin: 0 0 22px;
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.keep {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 20px 0 0;
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
}
.keep input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }

.or-sep { height: 18px; }

/* =========================
   新規ID登録（STEP）
   ========================= */
.page { flex: 1; padding: 20px 0 80px; }

.page-title {
  margin: 8px 0 28px;
  font-family: var(--font-head);
  font-size: 34px;
  font-weight: 500;
  line-height: 1.4;
}

.stepper {
  display: flex;
  max-width: 980px;
  margin: 0 auto 56px;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.stepper li {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 50px;
  padding: 0 18px;
  color: var(--ink-3);
  background: var(--bg);
  font-size: 15px;
}
.stepper li b { font-weight: 700; }
.stepper li em { font-style: normal; font-size: 13px; }
.stepper li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -8px;
  z-index: 1;
  width: 14px;
  height: 14px;
  background: inherit;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  transform: translateY(-50%) rotate(45deg);
}
.stepper li.is-done { color: var(--ink-2); }
.stepper li.is-current { color: var(--ink); background: var(--seg-active); }
.stepper li:first-child { border-radius: 3px 0 0 3px; }
.stepper li:last-child { border-radius: 0 3px 3px 0; }

.step-grid {
  display: grid;
  grid-template-columns: 250px minmax(0, 610px);
  justify-content: center;
  align-items: start;
  gap: 48px;
}

.step-art { align-self: center; }
.art { display: block; width: 100%; height: auto; }
.art-shadow { fill: color-mix(in srgb, var(--ink) 8%, transparent); }
.art-paper { fill: var(--card); stroke: var(--line-strong); stroke-width: 2; }
.art-soft { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.art-accent { fill: var(--accent); }
.art-line { fill: none; stroke: var(--line-strong); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.art-bar { fill: var(--line); }
.art-check { fill: none; stroke: var(--on-accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.art-text { fill: var(--on-accent); font: 700 22px var(--font-body); }

.step-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 18px;
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
}
.badge {
  padding: 1px 10px;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 999px;
  font: 500 12px/1.7 var(--font-body);
}
.step-lead { margin: 0 0 18px; color: var(--ink); font-size: 16px; }

.rules { margin: 8px 0 0; padding: 0; list-style: none; color: var(--ink-3); font-size: 13px; }
.rules li { display: flex; align-items: center; gap: 6px; }
.rules li::before { content: ""; width: 14px; height: 14px; border: 1.5px solid var(--line-strong); border-radius: 50%; }
.rules li.is-ok { color: var(--ok); }
.rules li.is-ok::before {
  border-color: var(--ok);
  background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3.5 7.2l2.3 2.3 4.7-4.9' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}

.btn-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.btn-row .btn-primary { width: 190px; }

/* 確認ステップ */
.summary { margin: 0 0 26px; padding: 0; border: 1px solid var(--line); border-radius: 4px; }
.summary > div { display: grid; grid-template-columns: 8.5em minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 16px; }
.summary > div + div { border-top: 1px solid var(--line); }
.summary dt { color: var(--ink-2); font-size: 14px; }
.summary dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.link-btn {
  padding: 0;
  color: var(--accent);
  background: none;
  border: 0;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* =========================
   登録完了
   ========================= */
.done-banner {
  width: min(640px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  color: var(--ink);
  background: var(--ok-bg);
  border-radius: 8px;
  font-weight: 700;
}
.done-banner svg { width: 24px; height: 24px; flex-shrink: 0; color: var(--ok); }

.done-hero {
  margin-top: 28px;
  padding: 56px 16px 64px;
  background: var(--accent-soft);
  border-radius: 0 0 50% 50% / 0 0 56px 56px;
  text-align: center;
}
.done-hero h1 { margin: 0 0 22px; font-family: var(--font-head); font-size: 32px; font-weight: 900; line-height: 1.45; }
.done-hero .art { width: 220px; margin: 0 auto; }

.done-body { width: min(640px, calc(100% - 32px)); margin: 36px auto 0; text-align: center; }
.done-body p { margin: 0 0 18px; color: var(--ink-2); }
.done-body .btn-block { margin-top: 28px; }
.done-body .sub-link { display: inline-block; margin-top: 22px; font-weight: 700; }

/* =========================
   レスポンシブ
   ========================= */
@media (max-width: 1000px) {
  .login-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .login-aside { display: none; }
  .login-card { width: min(520px, 100%); margin-inline: auto; }
  .step-grid { grid-template-columns: minmax(0, 610px); gap: 0; }
  .step-art { display: none; }
}

@media (max-width: 560px) {
  .container { width: calc(100% - 32px); }
  .header-inner { height: 64px; }
  .brand-wordmark { font-size: 24px; }
  .stage { padding: 20px 0 40px; }
  .login-card { padding: 32px 22px 22px; border-left: 0; border-right: 0; margin-inline: -16px; width: calc(100% + 32px); }
  .card-title { font-size: 26px; margin-bottom: 22px; }
  .page { padding-bottom: 48px; }
  .page-title { font-size: 26px; margin-bottom: 18px; }
  .stepper { margin-bottom: 32px; }
  .stepper li { padding: 0 10px; gap: 6px; }
  .stepper li em { display: none; }
  .step-title { font-size: 21px; }
  .btn-row { flex-direction: column-reverse; align-items: stretch; }
  .btn-row .btn-primary, .btn-row .btn-plain { width: 100%; }
  .summary > div { grid-template-columns: minmax(0, 1fr) auto; }
  .summary dt { grid-column: 1 / -1; }
  .done-hero h1 { font-size: 24px; }
  .foot-links li + li::before { margin: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- フォーム全体のエラー表示（サーバーからの結果用） ---------- */
.form-alert {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 0 0 20px; padding: 12px 14px;
  border: 1px solid var(--danger); border-radius: 4px;
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--danger); font-size: 14px; line-height: 1.6;
}
.form-alert[hidden] { display: none; }
.form-alert svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.form-alert b { display: block; font-weight: 700; }
.form-alert span { color: var(--ink, inherit); opacity: .85; }

/* ---------- PHP版で追加：お知らせ表示・警告バナー・ボタン型リンク ---------- */
.form-alert.is-ok {
  border-color: var(--ok);
  background: var(--ok-bg);
  color: var(--ok);
}
.done-banner.is-warn { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.done-banner.is-warn svg { color: var(--danger); }
.done-email { color: var(--ink); overflow-wrap: anywhere; }
.inline-form { margin: 0; }
button.sub-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
}
button.sub-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.resend-form { margin-top: 16px; }
