:root {
  --auth-ok: #7ee2a8;
  --auth-bad: #ff7a8f;
  --auth-hero-w: clamp(340px, 42%, 560px);
  --auth-field-h: 48px;
}

.auth-stage {
  display: flex;
  min-height: 100dvh;
}

.auth-hero {
  position: relative;
  flex: 0 0 var(--auth-hero-w);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-right: 1px solid var(--h3-line);
  background: linear-gradient(165deg, #1b1024 0%, #0d0912 55%, var(--h3-bg) 100%);
}
.auth-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 26%;
}
.auth-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg,
    rgba(var(--h3-dark-rgb), .96) 0%,
    rgba(var(--h3-dark-rgb), .88) 26%,
    rgba(var(--h3-dark-rgb), .42) 62%,
    rgba(var(--h3-dark-rgb), 0) 88%);
}
.auth-hero-body {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 44px 40px;
}
.auth-hero-logo { height: 34px; width: auto; }
.auth-hero-quote {
  margin: 0;
  max-width: 22ch;
  font-size: 1.2rem;
  line-height: 1.35;
  color: var(--h3-text-dim);
  text-wrap: balance;
}
.auth-hero-link {
  font-size: .88rem;
  color: var(--h3-text-dim2);
}
.auth-hero-link:hover { color: var(--h3-primary-text); }

.auth-pane {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px var(--h3-gap);
}
.auth-stage .card {
  width: 100%;
  max-width: 420px;
}

.auth-title {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 700;
  line-height: 1.15;
  text-wrap: balance;
}
.auth-stage .sub {
  margin: 0 0 24px;
  font-size: .95rem;
  color: var(--h3-text-dim);
}
.auth-stage .notice {
  margin: 0 0 18px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: .88rem;
  line-height: 1.45;
}
.auth-stage .notice.ok {
  background: rgba(126, 226, 168, .1);
  border-color: rgba(126, 226, 168, .35);
  color: var(--auth-ok);
}
.auth-stage .notice.bad {
  background: rgba(255, 122, 143, .1);
  border-color: rgba(255, 122, 143, .38);
  color: var(--auth-bad);
}

.auth-stage .toggle {
  position: relative;
  display: flex;
  gap: 4px;
  margin: 0 0 22px;
  padding: 4px;
  border: 1px solid var(--h3-line);
  border-radius: var(--h3-r-pill);
  background: var(--h3-panel);
}
.auth-stage .toggle button {
  position: relative;
  z-index: 1;
  flex: 1;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: var(--h3-r-pill);
  background: none;
  color: var(--h3-text-dim);
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .2s ease;
}
.auth-stage .toggle button:hover { color: var(--h3-text); }
.auth-stage .toggle button.active { color: var(--h3-on-accent); }
.auth-stage .toggle .slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  border-radius: var(--h3-r-pill);
  background: var(--h3-primary);
  box-shadow: var(--h3-glow-accent);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}
.auth-stage .toggle.register .slider { transform: translateX(100%); }

.auth-stage .field { margin: 0 0 14px; }
.auth-stage .field-gap { margin-bottom: 22px; }
.auth-stage .field label {
  display: block;
  margin: 0 0 6px;
  font-size: .82rem;
  letter-spacing: .02em;
  color: var(--h3-text-dim2);
}
.auth-stage .box { position: relative; }
.auth-stage .box input {
  width: 100%;
  height: var(--auth-field-h);
  padding: 0 16px 0 46px;
  border: 1px solid var(--h3-line);
  border-radius: var(--h3-r-pill);
  background: var(--h3-panel);
  color: var(--h3-text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color .2s ease, background-color .2s ease;
}
.auth-stage .box.with-action input { padding-right: 48px; }
.auth-stage .box input::placeholder { color: var(--h3-text-dim2); }
.auth-stage .box input:hover { background: var(--h3-panel-2); }
.auth-stage .box input:focus {
  border-color: var(--h3-primary);
  background: var(--h3-panel-2);
}
.auth-stage .box .icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  stroke: var(--h3-text-dim2);
  pointer-events: none;
  transition: stroke .2s ease;
}
.auth-stage .box input:focus + .icon { stroke: var(--h3-primary-text); }
.auth-stage .toggle-pass {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.auth-stage .toggle-pass svg {
  width: 18px;
  height: 18px;
  stroke: var(--h3-text-dim2);
}
.auth-stage .toggle-pass:hover { background: var(--h3-panel-2); }
.auth-stage .toggle-pass:hover svg { stroke: var(--h3-text); }

.auth-stage .lang-switch { display: flex; gap: 8px; }
.auth-stage .lang-opt {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--h3-line);
  border-radius: var(--h3-r-pill);
  background: var(--h3-panel);
  color: var(--h3-text-dim);
  font-family: inherit;
  font-size: .88rem;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.auth-stage .lang-opt:hover { color: var(--h3-text); background: var(--h3-panel-2); }
.auth-stage .lang-opt.active {
  background: var(--h3-primary);
  border-color: transparent;
  color: var(--h3-on-accent);
  font-weight: 600;
}

.auth-stage .reg-only { display: none; }
.auth-stage.register-mode .reg-only { display: block; }

.auth-stage .row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 20px;
  font-size: .85rem;
}
.auth-stage .agree-row { margin: 0 0 18px; font-size: .84rem; }
.auth-stage .checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--h3-text-dim);
  cursor: pointer;
  user-select: none;
}
.auth-stage .checkbox input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  accent-color: var(--h3-primary);
}
.auth-stage .link { color: var(--h3-primary-text); }
.auth-stage .link:hover { text-decoration: underline; }

.auth-submit {
  width: 100%;
  height: var(--auth-field-h);
  font-size: 1rem;
}
.auth-stage .btn-google svg { flex: 0 0 auto; width: 18px; height: 18px; }

.auth-stage .social-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
  font-size: .78rem;
  letter-spacing: .04em;
  color: var(--h3-text-dim2);
}
.auth-stage .social-or::before,
.auth-stage .social-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--h3-line);
}

.auth-stage .err {
  min-height: 1.1rem;
  margin: 10px 0 0;
  font-size: .82rem;
  line-height: 1.4;
  text-align: center;
  color: var(--auth-bad);
}
.auth-stage .link-btn {
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--h3-primary-text);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.auth-stage .foot {
  margin: 22px 0 0;
  text-align: center;
  font-size: .86rem;
  color: var(--h3-text-dim2);
}
.auth-stage .foot a { color: var(--h3-primary-text); }
.auth-stage .foot a:hover { text-decoration: underline; }

.auth-stage .verify-sent { text-align: center; }
.auth-stage .verify-sent p {
  margin: 0 0 18px;
  font-size: .95rem;
  color: var(--h3-text-dim);
}
.auth-stage .verify-sent .sub { margin-bottom: 18px; }

@media (min-width: 640px) {
  .auth-stage .box input { font-size: .92rem; }
}

@media (max-width: 899px) {
  .auth-stage { flex-direction: column; }
  .auth-hero {
    flex: 0 0 auto;
    height: clamp(240px, 34vw, 340px);
    border-right: 0;
    border-bottom: 1px solid var(--h3-line);
  }
  .auth-hero-img { object-position: 50% 14%; }
  .auth-hero-scrim {
    background: linear-gradient(0deg,
      rgba(var(--h3-dark-rgb), .94) 0%,
      rgba(var(--h3-dark-rgb), .7) 34%,
      rgba(var(--h3-dark-rgb), .2) 72%,
      rgba(var(--h3-dark-rgb), 0) 100%);
  }
  .auth-hero-body { gap: 10px; padding: 22px 20px; }
  .auth-hero-quote { max-width: 30ch; font-size: 1.05rem; }
  .auth-pane { padding: 28px var(--h3-gap) calc(32px + env(safe-area-inset-bottom)); }
}

@media (max-width: 559px) {
  .auth-hero-logo { height: 28px; }
  .auth-hero-quote { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-stage .toggle .slider { transition: none; }
}
