/* Auth — split layout, glass form, premium UX */

.page-auth {
  --auth-accent: #5eb8ff;
  --auth-accent-deep: #3d8fd9;
  --auth-violet: #8b7cf8;
  --auth-surface: rgba(14, 18, 28, 0.82);
  --auth-border: rgba(255, 255, 255, 0.08);
  --auth-glow: rgba(94, 184, 255, 0.35);
  background: #05060a;
  background-image: none;
}

.app-shell--auth {
  min-height: 100dvh;
}

.app-main--auth {
  max-width: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: flex;
  min-height: 100dvh;
}

.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-height: 100dvh;
}

@media (min-width: 960px) {
  .auth-page {
    grid-template-columns: minmax(340px, 44%) minmax(0, 1fr);
  }
}

/* —— Brand panel —— */
.auth-brand {
  position: relative;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(2rem, 5vw, 3.5rem);
  overflow: hidden;
  background: #070a12;
}

@media (min-width: 960px) {
  .auth-brand {
    display: flex;
  }
}

.auth-brand__mesh {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 20% 10%, rgba(94, 184, 255, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 60% at 90% 80%, rgba(139, 124, 248, 0.2), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(16, 185, 129, 0.08), transparent 60%);
  animation: auth-mesh-drift 18s ease-in-out infinite alternate;
}

@keyframes auth-mesh-drift {
  0% { opacity: 0.85; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.06) translate(2%, -1%); }
}

.auth-brand__grid {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, black 0%, transparent 85%);
}

.auth-brand__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
}

.auth-brand__orb--1 {
  width: 280px;
  height: 280px;
  top: 12%;
  left: -8%;
  background: rgba(94, 184, 255, 0.25);
}

.auth-brand__orb--2 {
  width: 220px;
  height: 220px;
  bottom: 18%;
  right: 5%;
  background: rgba(139, 124, 248, 0.22);
}

.auth-brand__content {
  position: relative;
  z-index: 1;
}

.auth-brand__logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #f4f8fc;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  margin-bottom: 2.5rem;
}

.auth-brand__mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--auth-accent) 0%, var(--auth-violet) 100%);
  box-shadow: 0 8px 32px var(--auth-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  color: #fff;
}

.auth-brand__headline {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.12;
  color: #f0f6fc;
  max-width: 16ch;
}

.auth-brand__tagline {
  margin: 0 0 2.5rem;
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(235, 245, 255, 0.55);
  max-width: 28ch;
}

.auth-brand__features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-brand__feature {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  font-size: 0.9375rem;
  color: rgba(235, 245, 255, 0.75);
  line-height: 1.45;
}

.auth-brand__feature-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  color: var(--auth-accent);
  background: rgba(94, 184, 255, 0.12);
  border: 1px solid rgba(94, 184, 255, 0.22);
}

.auth-brand__footer {
  position: relative;
  z-index: 1;
  font-size: 0.75rem;
  color: rgba(235, 245, 255, 0.35);
  letter-spacing: 0.02em;
}

/* —— Form panel —— */
.auth-panel {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background:
    radial-gradient(ellipse 100% 80% at 50% -30%, rgba(94, 184, 255, 0.12), transparent 50%),
    #05060a;
}

.auth-panel__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem clamp(1.25rem, 4vw, 2rem);
}

.auth-panel__logo-mobile {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: #f4f8fc;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

@media (min-width: 960px) {
  .auth-panel__logo-mobile {
    visibility: hidden;
    pointer-events: none;
  }
}

.auth-panel__logo-mobile .auth-brand__mark {
  width: 36px;
  height: 36px;
  font-size: 0.9375rem;
}

.auth-steps {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-steps__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(235, 245, 255, 0.35);
}

.auth-steps__item--active {
  color: var(--auth-accent);
}

.auth-steps__item--done {
  color: rgba(235, 245, 255, 0.6);
}

.auth-steps__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.auth-steps__item--active .auth-steps__dot,
.auth-steps__item--done .auth-steps__dot {
  opacity: 1;
  box-shadow: 0 0 12px var(--auth-glow);
}

.auth-steps__sep {
  width: 24px;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.auth-panel__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 clamp(1.25rem, 4vw, 2rem) 2.5rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  animation: auth-card-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes auth-card-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-card__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--auth-accent);
  background: rgba(94, 184, 255, 0.1);
  border: 1px solid rgba(94, 184, 255, 0.2);
  border-radius: 999px;
}

.auth-card__title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.625rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: #f4f8fc;
}

.auth-card__subtitle {
  margin: 0 0 1.75rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: rgba(235, 245, 255, 0.55);
}

.auth-card__subtitle strong {
  color: #e8f4fc;
  font-weight: 600;
}

.auth-card__subtitle--compact {
  margin-bottom: 1.25rem;
}

.auth-card__glass {
  padding: clamp(1.5rem, 4vw, 2rem);
  border-radius: 20px;
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 24px 64px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}

.auth-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.875rem 1rem;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.45;
  background: rgba(255, 69, 58, 0.12);
  border: 1px solid rgba(255, 69, 58, 0.28);
  color: #ffb4ae;
}

.auth-banner i {
  margin-top: 0.125rem;
  flex-shrink: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-field__label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(235, 245, 255, 0.65);
  padding-left: 2px;
}

.auth-field__wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-field__icon {
  position: absolute;
  left: 1rem;
  color: rgba(235, 245, 255, 0.35);
  font-size: 0.9375rem;
  pointer-events: none;
  transition: color 0.2s ease;
}

.auth-field__input {
  width: 100%;
  min-height: 52px;
  padding: 0 1rem 0 2.75rem;
  font: inherit;
  font-size: 1rem;
  color: #f4f8fc;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-field__input:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.auth-field__input:focus {
  outline: none;
  border-color: rgba(94, 184, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(94, 184, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.auth-field__wrap:focus-within .auth-field__icon {
  color: var(--auth-accent);
}

.auth-field__toggle {
  position: absolute;
  right: 0.5rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(235, 245, 255, 0.4);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.auth-field__toggle:hover {
  color: #f4f8fc;
  background: rgba(255, 255, 255, 0.06);
}

.auth-field__hint {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(235, 245, 255, 0.38);
  line-height: 1.4;
}

.auth-field__meter {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 0.25rem;
}

.auth-field__meter-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff453a, #ff9f0a, #30d158);
  transition: width 0.25s ease;
}

.auth-submit {
  position: relative;
  width: 100%;
  min-height: 52px;
  margin-top: 0.5rem;
  padding: 0 1.5rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--auth-accent-deep) 0%, var(--auth-violet) 100%);
  box-shadow: 0 8px 28px rgba(94, 184, 255, 0.28);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.auth-submit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.18) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 36px rgba(94, 184, 255, 0.38);
}

.auth-submit:hover:not(:disabled)::after {
  transform: translateX(100%);
}

.auth-submit:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.auth-submit__inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* hidden 属性は display:inline-flex より優先させる（初期表示で両方出るのを防ぐ） */
.auth-submit__inner[hidden],
.auth-submit [data-submit-loading][hidden] {
  display: none !important;
}

.auth-submit.is-loading [data-submit-label] {
  display: none !important;
}

.auth-submit.is-loading [data-submit-loading] {
  display: inline-flex !important;
}

.auth-panel__footer {
  text-align: center;
  margin-top: 1.75rem;
  font-size: 0.9375rem;
  color: rgba(235, 245, 255, 0.45);
}

.auth-panel__footer a {
  color: var(--auth-accent);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-panel__footer a:hover {
  color: #9ed4ff;
}

.auth-panel__footer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin-top: 1.5rem;
  font-size: 0.875rem;
}

.auth-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: inherit;
  font-weight: 500;
  color: var(--auth-accent);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.auth-link-btn:hover {
  background: rgba(94, 184, 255, 0.1);
  color: #9ed4ff;
}

.auth-verify-email {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  color: rgba(235, 245, 255, 0.75);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  word-break: break-all;
}

.auth-verify-email i {
  color: var(--auth-accent);
  flex-shrink: 0;
}

/* —— OTP —— */
.auth-otp {
  margin: 0.5rem 0 0.25rem;
}

.auth-otp__cells {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(0.375rem, 2vw, 0.625rem);
}

.auth-otp__cell {
  width: 100%;
  aspect-ratio: 1;
  max-height: 64px;
  padding: 0;
  font: inherit;
  font-size: clamp(1.25rem, 5vw, 1.75rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: #f4f8fc;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  caret-color: transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.auth-otp__cell:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.auth-otp__cell:focus {
  outline: none;
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 4px rgba(94, 184, 255, 0.2);
  background: rgba(94, 184, 255, 0.08);
  transform: scale(1.02);
}

.auth-otp__cell--filled {
  border-color: rgba(94, 184, 255, 0.4);
  background: rgba(94, 184, 255, 0.06);
}

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

.auth-otp--fallback .auth-otp__cells {
  display: none;
}

.auth-otp--fallback .auth-otp-fallback {
  display: block !important;
  width: 100%;
  min-height: 52px;
  padding: 0 1rem;
  font: inherit;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #f4f8fc;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
}

.auth-otp-fallback {
  display: none;
}

.auth-otp__hint {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: rgba(235, 245, 255, 0.4);
  text-align: center;
  line-height: 1.45;
}
