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

:root {
  --mobile-bg: #f4f6fb;
  --mobile-card: #ffffff;
  --mobile-primary: #3a5bdb;
  --mobile-primary-strong: #2e4bcc;
  --mobile-text: #1f2937;
  --mobile-muted: #6b7280;
  --mobile-border: #e2e8f3;
  --mobile-input-bg: #f8fafc;
}

body.login-page {
  background-color: #c9d6ff;
  background: linear-gradient(to right, #e2e2e2, #c9d6ff);
  min-height: 100vh;
  font-weight: 500;
}

body.login-page
  :where(
    p,
    a,
    span,
    button,
    label,
    small,
    li,
    dt,
    dd,
    th,
    td,
    legend,
    summary,
    div
  ) {
  font-weight: 500;
}

body.login-page :where(h1, h2, h3, h4, h5, h6, strong, b) {
  font-weight: 600;
}

.login-page .navbar-auth .container-xl {
  min-height: 3.75rem;
  align-items: center;
}

.login-page .navbar-auth .navbar-brand {
  gap: 0.625rem;
}

.login-page-main {
  min-height: calc(100vh - 4.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  padding: 1.5rem 1rem 3rem;
}

.auth-feedback {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: min(92vw, 720px);
  width: max-content;
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #d7dbe8;
  background: rgba(255, 255, 255, 0.94);
  color: #1f2937;
  font-size: 13px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
  z-index: 40;
}

.auth-feedback:empty {
  display: none;
}

.auth-feedback.is-error {
  border-color: #dc8f8f;
  color: #8b1d1d;
}

.auth-feedback.is-success {
  border-color: #8ebc9d;
  color: #14532d;
}

.reset-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.reset-modal.is-hidden {
  display: none;
}

.reset-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.reset-modal-dialog {
  position: relative;
  width: min(94vw, 440px);
  background: #fff;
  border-radius: 16px;
  padding: 22px 20px 18px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.24);
}

.reset-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  cursor: pointer;
}

.reset-modal-dialog h2 {
  font-size: 21px;
  line-height: 1.3;
  margin-bottom: 8px;
  color: #111827;
}

.reset-modal-description {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 14px;
}

.reset-modal-form {
  display: grid;
  gap: 10px;
}

.reset-modal-form label {
  font-size: 12px;
  color: #4b5563;
  font-weight: 600;
}

.reset-modal-form input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  outline: none;
}

.reset-modal-form input:focus {
  border-color: #3a5bdb;
  box-shadow: 0 0 0 3px rgba(58, 91, 219, 0.16);
}

.reset-modal-actions {
  display: flex;
  gap: 8px;
}

.reset-modal-actions button {
  flex: 1;
  border: 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  padding: 11px 10px;
  cursor: pointer;
}

#password-reset-submit {
  background: #2f56db;
  color: #fff;
}

#password-reset-submit:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.reset-modal-status {
  margin-top: 2px;
  min-height: 1.3em;
  font-size: 12px;
  color: #4b5563;
}

.reset-modal-status.is-error {
  color: #b91c1c;
}

.reset-modal-status.is-success {
  color: #14532d;
}
.container {
  background-color: #fff;
  border-radius: 30px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
  width: 768px;
  max-width: 100%;
  min-height: 480px;
}

.container p {
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.3px;
  margin: 20px 0;
}

.container span {
  font-size: 12px;
}

.container a {
  color: #333;
  font-size: 13px;
  text-decoration: none;
  margin: 15px 0 10px;
}

.container button {
  background-color: #512da8;
  color: #fff;
  font-size: 12px;
  padding: 10px 45px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 10px;
  cursor: pointer;
}

.container button.hidden {
  background-color: transparent;
  border-color: #fff;
}

.container button[data-busy="true"] {
  opacity: 0.78;
  cursor: wait;
}

.container button[data-busy="true"]:not(.social-icon-button)::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-top-color: #fff;
  border-radius: 50%;
  animation: login-button-spin 0.8s linear infinite;
  vertical-align: middle;
}

.container form {
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 0 40px;
  height: 100%;
}

.container input {
  background-color: #eee;
  border: none;
  padding: 10px 15px;
  margin: 8px 0;
  font-size: 13px;
  border-radius: 8px;
  width: 100%;
  outline: none;
}

.helper-text,
.email-preview {
  width: 100%;
  text-align: left;
  font-size: 12px;
  color: #555;
  margin: 2px 0 6px;
}

.email-preview span {
  font-weight: 600;
  word-break: break-all;
  color: #333;
}

.form-container {
  position: absolute;
  top: 0;
  height: 100%;
  transition: all 0.6s ease-in-out;
}

.sign-in {
  left: 0;
  width: 50%;
  z-index: 2;
}

.container.active .sign-in {
  transform: translateX(100%);
}

.sign-up {
  left: 0;
  width: 50%;
  opacity: 0;
  z-index: 1;
}

.container.active .sign-up {
  transform: translateX(100%);
  opacity: 1;
  z-index: 5;
  animation: move 0.6s;
}

@keyframes move {
  0%,
  49.99% {
    opacity: 0;
    z-index: 1;
  }
  50%,
  100% {
    opacity: 1;
    z-index: 5;
  }
}

.social-icon-row {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 20px 0 10px;
}

.social-icon-button {
  position: relative;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d4d9e4;
  background: #fff;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.1);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.container .social-icon-button {
  background: #fff;
  border-color: #d4d9e4;
  font-size: 12px;
  padding: 0;
  font-weight: 400;
  line-height: 1;
  margin: 0;
  letter-spacing: 0;
  text-transform: none;
}

.social-icon-button img {
  width: 22px;
  height: 22px;
  display: block;
  object-fit: contain;
}

.social-icon-button.is-busy {
  opacity: 0.92;
  cursor: wait;
  transform: none;
  border-color: #bfc9df;
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.08);
  background: #f8fafc;
}

.social-icon-button.is-busy img {
  opacity: 1;
}

.social-icon-button:disabled {
  pointer-events: none;
}

.social-icon-button:hover {
  transform: translateY(-1px);
  border-color: #c3cad7;
  box-shadow: 0 8px 16px rgba(17, 24, 39, 0.12);
}

.social-icon-button:focus-visible {
  outline: 3px solid #1a73e8;
  outline-offset: 2px;
}

.toggle-container {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  overflow: hidden;
  transition: all 0.6s ease-in-out;
  border-radius: 150px 0 0 100px;
  z-index: 6;
}

.container.active .toggle-container {
  transform: translateX(-100%);
  border-radius: 0 150px 100px 0;
}

.toggle {
  background-color: #512da8;
  height: 100%;
  background: linear-gradient(to right, #5c6bc0, #512da8);
  color: #fff;
  position: relative;
  left: -100%;
  height: 100%;
  width: 200%;
  transform: translateX(0);
  transition: all 0.6s ease-in-out;
}

.container.active .toggle {
  transform: translateX(50%);
}

.toggle-panel {
  position: absolute;
  width: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 0 30px;
  text-align: center;
  top: 0;
  transform: translateX(0);
  transition: all 0.6s ease-in-out;
}

.toggle-left {
  transform: translateX(-200%);
}

.container.active .toggle-left {
  transform: translateX(0);
}

.toggle-right {
  right: 0;
  transform: translateX(0);
}

.container.active .toggle-right {
  transform: translateX(200%);
}

/* Smartphone layout overrides for stacked flow */
@media (max-width: 768px) {
  /* PCデザインは残しつつスマホでは非表示 */
  .container {
    display: none;
  }

  body.login-page {
    background: var(--mobile-bg);
  }

  .login-page-main {
    display: block;
    min-height: 0;
    padding: 0;
  }

  /* スマホ専用レイアウト: 全画面使うようにベースをリセット */
  .mobile-auth {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 4.5rem);
    background: var(--mobile-bg);
    justify-content: center;
    align-items: center;
    padding: 28px 18px 40px;
    gap: 24px;
  }

  .mobile-card {
    background: var(--mobile-card);
    border-radius: 28px;
    padding: 28px 22px 32px;
    box-shadow: 0 20px 45px rgba(18, 28, 49, 0.08);
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 520px;
  }

  .mobile-card-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
  }

  .mobile-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--mobile-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 14px 24px rgba(58, 91, 219, 0.28);
    font-size: 22px;
  }

  .mobile-card h2 {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--mobile-text);
  }

  .mobile-card-header p {
    font-size: 13px;
    color: var(--mobile-muted);
  }

  .mobile-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .mobile-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--mobile-text);
  }

  .mobile-input {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--mobile-input-bg);
    border: 1px solid var(--mobile-border);
    border-radius: 14px;
    padding: 12px 14px;
    color: #7a8196;
  }

  .mobile-input i {
    font-size: 16px;
    color: #8b95ab;
  }

  .mobile-input input {
    border: none;
    background: transparent;
    width: 100%;
    flex: 1;
    font-size: 14px;
    color: var(--mobile-text);
    outline: none;
  }

  .mobile-input input::placeholder {
    color: #b5bbce;
  }

  .mobile-icon-button {
    border: none;
    background: transparent;
    color: #9aa3b7;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
  }

  .mobile-links {
    text-align: right;
    margin-top: -6px;
  }

  .mobile-links a {
    color: var(--mobile-primary);
    font-weight: 600;
    font-size: 13px;
  }

  .mobile-primary {
    width: 100%;
    background: linear-gradient(
      90deg,
      var(--mobile-primary-strong),
      var(--mobile-primary)
    );
    color: #fff;
    border: none;
    border-radius: 16px;
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 14px 26px rgba(46, 75, 204, 0.32);
    cursor: pointer;
    transition:
      transform 0.15s ease,
      box-shadow 0.15s ease;
  }

  .mobile-primary span {
    margin-left: 6px;
    font-size: 16px;
  }

  .mobile-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(46, 75, 204, 0.4);
  }

  .mobile-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 18px 0 4px;
    color: #9aa3b7;
    font-size: 12px;
  }

  .mobile-divider span {
    flex: 1;
    height: 1px;
    background: var(--mobile-border);
  }

  .mobile-social-icon-row {
    margin: 0;
    gap: 16px;
  }

  .mobile-social-icon-row .social-icon-button {
    width: 50px;
    height: 50px;
  }

  .mobile-check {
    display: flex;
    align-items: flex-start;
    padding: 15px 0px;
    gap: 5px;
    font-size: 11px;
    color: var(--mobile-muted);
    line-height: 1.5;
  }

  .mobile-check label {
    flex: 1;
    margin: 12px 0;
  }

  .mobile-check input {
    width: 15px;
    height: 15px;
    accent-color: var(--mobile-primary);
  }

  .mobile-check a {
    color: var(--mobile-primary);
    font-weight: 600;
    text-decoration: none;
  }

  .mobile-switch {
    text-align: center;
    color: var(--mobile-muted);
    font-size: 13px;
    margin-top: 8px;
  }

  .mobile-switch a {
    color: var(--mobile-primary);
    font-weight: 700;
    text-decoration: none;
  }

  .auth-feedback {
    bottom: 16px;
    width: min(92vw, 540px);
  }
}

/* PC向け: スマホ専用要素を非表示 */
@media (min-width: 769px) {
  .mobile-auth {
    display: none;
  }
}

/* 超小型スマホ (375px以下) 向け調整 */
@media (max-width: 375px) {
  .mobile-auth {
    padding: 20px 14px 30px;
  }
  .mobile-card {
    min-height: 0;
    padding: 22px 16px 24px;
    border-radius: 20px;
  }
  .mobile-input {
    padding: 10px 12px;
  }
  .mobile-primary {
    padding: 12px 14px;
    font-size: 14px;
  }
  .reset-modal-dialog {
    padding: 18px 14px 14px;
  }
}

@keyframes login-button-spin {
  to {
    transform: rotate(360deg);
  }
}
