.hidden {
  display: none !important;
}

.auth-page {
  min-height: 100vh;
  background: var(--bg);
}

.auth-header {
  position: sticky;
  top: 0;
  z-index: 20;
}

.auth-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
}

.auth-brand img {
  border-radius: 9px;
}

.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px 8px 6px;
  margin-right: -6px;
  border-radius: var(--radius-pill);
  color: var(--muted-strong);
  font-size: 0.875rem;
  font-weight: 650;
  letter-spacing: -0.008em;
  transition:
    color var(--transition),
    background var(--transition);
}

.auth-back-link svg {
  opacity: 0.72;
  transition: transform var(--duration-fast) var(--ease-out);
}

.auth-back-link:hover {
  color: var(--text);
  background: rgba(23, 23, 25, 0.04);
}

.auth-back-link:hover svg {
  opacity: 1;
  transform: translateX(-2px);
}

.auth-layout {
  display: grid;
  min-height: calc(100svh - 56px);
}

/* ── Visual panel ── */

.auth-visual {
  position: relative;
  display: none;
  overflow: hidden;
  background: #111114;
}

.auth-visual-photo {
  position: absolute;
  inset: 0;
  margin: 0;
}

.auth-visual-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 42% 24%;
  transform: scale(1.04);
  animation: auth-photo-drift 22s var(--ease-out) infinite alternate;
  will-change: transform;
}

.auth-visual-overlay {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  min-height: 100%;
  padding: clamp(28px, 4vw, 48px);
  background:
    linear-gradient(180deg, rgba(17, 17, 20, 0.06) 0%, rgba(17, 17, 20, 0.2) 38%, rgba(17, 17, 20, 0.94) 100%),
    linear-gradient(90deg, rgba(17, 17, 20, 0.76) 0%, rgba(17, 17, 20, 0.22) 48%, rgba(17, 17, 20, 0) 76%);
}

.auth-visual-copy {
  display: grid;
  gap: clamp(16px, 2.5vw, 24px);
  max-width: 26rem;
}

.auth-visual-copy > .landing-eyebrow {
  animation: auth-rise 0.72s var(--ease-out) 0.04s both;
}

.auth-visual-title {
  margin: 0;
  color: #fff;
  font-size: clamp(1.75rem, 2.8vw, 2.375rem);
  font-weight: 780;
  line-height: 1.06;
  letter-spacing: -0.028em;
  text-wrap: balance;
  animation: auth-rise 0.82s var(--ease-out) 0.1s both;
}

.auth-steps {
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.auth-steps li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(14px);
  transition:
    background var(--transition),
    border-color var(--transition),
    transform var(--duration-fast) var(--ease-out);
  animation: auth-rise 0.82s var(--ease-out) both;
}

.auth-steps li:nth-child(1) {
  animation-delay: 0.16s;
}

.auth-steps li:nth-child(2) {
  animation-delay: 0.22s;
}

.auth-steps li:nth-child(3) {
  animation-delay: 0.28s;
}

.auth-steps li:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.11);
  transform: translateX(3px);
}

.auth-step-num {
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.5;
}

.auth-step-text {
  display: grid;
  gap: 2px;
}

.auth-step-text strong {
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 720;
  letter-spacing: -0.012em;
}

.auth-step-text span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.8125rem;
  line-height: 1.45;
}

/* ── Form panel ── */

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 48px) clamp(18px, 4vw, 40px) clamp(32px, 5vw, 56px);
  background:
    radial-gradient(ellipse 90% 70% at 50% -20%, rgba(10, 132, 255, 0.06), transparent 58%),
    var(--bg);
}

.auth-panel-inner {
  display: grid;
  gap: clamp(20px, 3vw, 28px);
  width: min(100%, 420px);
  animation: auth-enter 0.76s var(--ease-out) both;
}

.auth-panel-intro {
  display: grid;
  gap: 10px;
  animation: auth-rise 0.68s var(--ease-out) 0.06s both;
}

.auth-panel-title {
  margin: 0;
  font-size: clamp(1.625rem, 5.5vw, 2rem);
  font-weight: 780;
  line-height: 1.08;
  letter-spacing: -0.024em;
  text-wrap: balance;
}

.auth-panel-lead {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.auth-card {
  position: relative;
  display: grid;
  gap: 0;
  overflow: hidden;
  border: var(--block-border);
  border-radius: var(--block-radius);
  background: var(--surface);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    var(--shadow-soft),
    0 24px 56px rgba(23, 23, 25, 0.06);
  animation: auth-rise 0.76s var(--ease-out) 0.12s both;
}

.auth-card-head {
  display: grid;
  gap: 12px;
  padding: 22px 22px 0;
}

.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  isolation: isolate;
}

.auth-tabs::before {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  z-index: 0;
  width: calc(50% - 4px);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow:
    0 1px 2px rgba(23, 23, 25, 0.06),
    0 4px 14px rgba(23, 23, 25, 0.06);
  transition: transform 0.32s var(--ease-out);
  content: "";
}

.auth-tabs[data-active="register"]::before {
  transform: translateX(100%);
}

html[data-auth-mode="register"] .auth-tabs::before {
  transform: translateX(100%);
}

html[data-auth-mode="register"] .auth-tabs button[data-auth-mode="login"].active {
  color: var(--muted-strong);
}

html[data-auth-mode="register"] .auth-tabs button[data-auth-mode="register"] {
  color: var(--text);
}

html[data-auth-mode="register"] .auth-field:has(#authNameInput) {
  max-height: 88px;
  margin-top: 0;
  opacity: 1;
  overflow: hidden;
  pointer-events: auto;
}

html[data-auth-mode="register"] #authLegal.hidden {
  display: block !important;
}

.auth-tabs button {
  position: relative;
  z-index: 1;
  min-height: 40px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted-strong);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.008em;
  transition: color var(--transition);
}

.auth-tabs button:hover:not(.active) {
  color: var(--text);
}

.auth-tabs button.active {
  color: var(--text);
}

.auth-tabs button:focus-visible {
  outline: 2px solid rgba(10, 132, 255, 0.42);
  outline-offset: 2px;
}

.auth-card-subtitle {
  min-height: 1.35em;
  margin: 0;
  overflow: hidden;
}

.auth-card-subtitle-text {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
  transition:
    opacity 0.22s var(--ease-out),
    transform 0.22s var(--ease-out);
}

.auth-card-subtitle.is-changing .auth-card-subtitle-text {
  opacity: 0;
  transform: translateY(4px);
}

.auth-form {
  display: grid;
  gap: 14px;
  padding: 18px 22px 22px;
}

.auth-field {
  display: grid;
  gap: 7px;
  max-height: 88px;
  overflow: hidden;
  opacity: 1;
  transition:
    max-height 0.32s var(--ease-out),
    opacity 0.24s var(--ease-out),
    margin 0.32s var(--ease-out);
}

.auth-field.hidden {
  max-height: 0;
  margin-top: -14px;
  opacity: 0;
  pointer-events: none;
}

.auth-field > span:first-child {
  color: var(--muted-strong);
  font-size: 0.8125rem;
  font-weight: 680;
  letter-spacing: -0.006em;
}

.auth-input-wrap {
  position: relative;
  display: block;
}

.auth-field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 0 44px 0 14px;
  transition:
    border-color var(--transition),
    background var(--transition),
    box-shadow var(--transition),
    transform var(--duration-fast) var(--ease-out);
}

.auth-field:not(.auth-field-password) input {
  padding-right: 14px;
}

.auth-field input::placeholder {
  color: rgba(23, 23, 25, 0.34);
}

.auth-field input:hover {
  border-color: rgba(23, 23, 25, 0.16);
}

.auth-field input:focus {
  border-color: rgba(10, 132, 255, 0.52);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
  transition:
    color var(--transition),
    background var(--transition),
    transform var(--duration-fast) var(--ease-out);
}

.auth-password-toggle:hover {
  color: var(--text);
  background: rgba(23, 23, 25, 0.05);
}

.auth-password-toggle:active {
  transform: translateY(-50%) scale(0.94);
}

.auth-password-toggle:focus-visible {
  outline: 2px solid rgba(10, 132, 255, 0.42);
  outline-offset: 1px;
}

.auth-form-error {
  min-height: 0;
  margin: -2px 0 0;
  color: #d92d20;
  font-size: 0.8125rem;
  font-weight: 650;
  line-height: 1.45;
  transition:
    opacity 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}

.auth-form-error:not(:empty) {
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(217, 45, 32, 0.07);
}

.auth-form-error.notice:not(:empty) {
  color: var(--accent-dark);
  background: rgba(10, 132, 255, 0.08);
}

.auth-submit {
  width: 100%;
  min-height: 50px;
  margin-top: 2px;
  border: 0;
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--transition),
    opacity var(--transition);
}

.auth-submit:disabled {
  opacity: 0.62;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.auth-submit.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.auth-submit.is-loading::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.65s linear infinite;
  content: "";
}

.auth-secondary {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 700;
  transition:
    background var(--transition),
    transform var(--duration-fast) var(--ease-out);
}

.auth-secondary:hover:not(:disabled) {
  background: #e8eaee;
}

.auth-secondary:active:not(:disabled) {
  transform: scale(0.985);
}

.auth-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-legal {
  margin: 0;
  padding: 0 22px 22px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
  transition: opacity 0.24s var(--ease-out);
}

.auth-legal a {
  color: var(--accent-dark);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(0, 102, 204, 0.35);
  transition: color var(--transition);
}

.auth-legal a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* ── Motion ── */

@keyframes auth-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes auth-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes auth-photo-drift {
  from {
    transform: scale(1.04);
  }

  to {
    transform: scale(1.08) translate3d(-0.6%, -0.4%, 0);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .auth-panel-inner,
  .auth-panel-intro,
  .auth-card,
  .auth-visual-copy > .landing-eyebrow,
  .auth-visual-title,
  .auth-steps li {
    animation: none;
  }

  .auth-visual-photo img {
    animation: none;
    transform: scale(1.04);
  }

  .auth-tabs::before,
  .auth-field,
  .auth-card-subtitle-text,
  .auth-field input {
    transition: none;
  }
}

@media (max-width: 959px) {
  .auth-page {
    background: #111114;
  }

  .auth-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    background: transparent;
    border-bottom: 0;
  }

  /* Immersive header: sits on the photo, no hard cut */
  .auth-header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
      180deg,
      rgba(17, 17, 20, 0.42) 0%,
      rgba(17, 17, 20, 0.14) 62%,
      rgba(17, 17, 20, 0) 100%
    );
    pointer-events: none;
  }

  .auth-brand span {
    color: #fff;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.4);
  }

  .auth-brand img {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  }

  .auth-back-link {
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.4);
  }

  .auth-back-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
  }

  .auth-back-link svg {
    opacity: 0.9;
  }

  .auth-layout {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 100svh;
    min-height: 100dvh;
    padding-top: 0;
    isolation: isolate;
  }

  .auth-visual {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: block;
    min-height: 100svh;
    min-height: 100dvh;
    border-radius: 0;
  }

  .auth-visual-photo img {
    object-position: 62% 26%;
    transform: scale(1.14);
  }

  .auth-visual-overlay {
    align-items: stretch;
    min-height: 100%;
    padding: 0;
    background:
      linear-gradient(
        180deg,
        rgba(17, 17, 20, 0.34) 0%,
        rgba(17, 17, 20, 0.1) 20%,
        rgba(17, 17, 20, 0.52) 46%,
        rgba(17, 17, 20, 0.86) 66%,
        #111114 100%
      ),
      linear-gradient(90deg, rgba(17, 17, 20, 0.4) 0%, rgba(17, 17, 20, 0) 62%);
  }

  .auth-visual-copy {
    display: none;
  }

  .auth-panel {
    position: relative;
    z-index: 1;
    flex: 1;
    align-items: stretch;
    justify-content: flex-end;
    padding:
      clamp(96px, 22vh, 160px)
      clamp(18px, 4vw, 24px)
      max(24px, env(safe-area-inset-bottom))
      clamp(18px, 4vw, 24px);
    background: transparent;
  }

  .auth-panel-inner {
    width: min(100%, 440px);
    margin-inline: auto;
  }

  .auth-panel-intro {
    position: relative;
    gap: 10px;
    margin-bottom: clamp(18px, 3.5vw, 26px);
    padding-left: 2px;
  }

  .auth-panel-intro .landing-eyebrow {
    margin-bottom: 0;
  }

  .auth-panel-title {
    color: #fff;
    font-size: clamp(1.75rem, 7vw, 2.125rem);
    letter-spacing: -0.028em;
    text-shadow: 0 2px 32px rgba(0, 0, 0, 0.45);
  }

  .auth-panel-lead {
    color: rgba(255, 255, 255, 0.82);
    max-width: 32ch;
    font-size: 0.9063rem;
    line-height: 1.5;
    text-shadow: 0 1px 20px rgba(0, 0, 0, 0.4);
  }

  .auth-card {
    position: relative;
    padding-top: 8px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 2px 8px rgba(0, 0, 0, 0.1),
      0 28px 70px rgba(0, 0, 0, 0.42);
  }

  /* Bottom-sheet grabber */
  .auth-card::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 50%;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: rgba(23, 23, 25, 0.16);
    transform: translateX(-50%);
  }

  .auth-card-head {
    gap: 0;
    padding-top: 20px;
  }

  .auth-card-subtitle {
    display: none;
  }
}
