html:has(body.auth-body) {
  height: 100%;
  overflow: hidden;
}

.auth-body {
  margin: 0;
  height: 100dvh;
  max-height: 100dvh;
  background: #000;
  color: #f5f5f5;
  font-family: var(--ev-font-body, "DM Sans", system-ui, sans-serif);
  overflow: hidden;
}

/* Mobile-first: single column. Desktop split activates at 992px. */
.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  max-height: 100dvh;
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  overflow: hidden;
}

.auth-visual {
  display: none;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  height: 100%;
  min-height: 0;
  min-width: 0;
  width: 100%;
  padding:
    max(3.75rem, calc(2.75rem + env(safe-area-inset-top, 0px)))
    max(1rem, env(safe-area-inset-right, 0px))
    calc(1.75rem + env(safe-area-inset-bottom, 0px))
    max(1rem, env(safe-area-inset-left, 0px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: #000;
  box-sizing: border-box;
}

.auth-panel-card {
  width: 100%;
  max-width: 22.5rem;
  margin: 0 auto;
  padding: 0 0 1.25rem;
  border: none;
  border-radius: 0;
  background: transparent;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Login / short auth screens: vertically center in the viewport */
.auth-panel:not(:has(.auth-register-form)) {
  justify-content: center;
}

.auth-panel:not(:has(.auth-register-form)) .auth-panel-card {
  margin-top: auto;
  margin-bottom: auto;
}

.auth-panel-header {
  margin-bottom: 1.25rem;
  text-align: center;
}

.auth-panel-title {
  margin: 0;
  font-family: var(--ev-font-display, "Syne", system-ui, sans-serif);
  font-size: clamp(1.5rem, 5.5vw, 1.75rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.auth-lang-bar {
  position: fixed;
  top: max(0.85rem, env(safe-area-inset-top, 0px));
  right: max(0.85rem, env(safe-area-inset-right, 0px));
  z-index: 30;
}

.auth-lang-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: min(9.5rem, calc(100vw - 7.5rem));
  padding: 0.35rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.92);
  color: #d4d4d8;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.auth-lang-select-wrap:hover,
.auth-lang-select-wrap:focus-within {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.auth-lang-select-wrap .bi-globe2 {
  flex-shrink: 0;
  font-size: 0.95rem;
  opacity: 0.9;
  pointer-events: none;
}

.auth-lang-select {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0 1rem 0 0;
  border: 0;
  background:
    transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%23a1a1aa' d='M4.5 6.5L8 10l3.5-3.5'/%3E%3C/svg%3E")
    right center / 0.7rem no-repeat;
  color: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  min-width: 4.75rem;
  max-width: 8.5rem;
  width: auto;
  cursor: pointer;
}

.auth-lang-select:focus {
  outline: none;
}

.auth-lang-select option {
  color: #111;
  background: #fff;
}

.auth-panel-brand {
  display: inline-block;
  margin-bottom: 1rem;
}

.auth-panel-logo {
  height: 2.15rem;
  width: auto;
  max-width: min(12.5rem, 70vw);
  object-fit: contain;
}

.auth-panel-sub {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
  color: #a8a8b0;
  line-height: 1.4;
}

.auth-panel-card .form-label {
  color: #a8a8b0;
  font-size: 0.9375rem;
  margin-bottom: 0.35rem;
}

.auth-panel-card .form-control {
  background: #1a1a1a;
  border: 1px solid #363636;
  color: #fff;
  border-radius: 0.75rem;
  min-height: 3rem;
  padding: 0.65rem 0.9rem;
  font-size: 1rem;
  width: 100%;
}

.auth-panel-card:has(.auth-register-form) {
  max-width: 30rem;
}

.auth-panel-card:has(.auth-register-form) .auth-panel-header {
  margin-bottom: 0.85rem;
}

.auth-panel-card:has(.auth-register-form) .auth-panel-title {
  font-size: clamp(1.35rem, 5vw, 1.5rem);
}

.auth-panel-card:has(.auth-register-form) .auth-panel-sub {
  margin-top: 0.25rem;
  font-size: 0.9rem;
}

.auth-register-form .mb-3 {
  margin-bottom: 0.7rem !important;
}

.auth-register-form .mb-4 {
  margin-bottom: 0.85rem !important;
}

.auth-panel-card:has(.auth-register-form) .form-label {
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
}

.auth-panel-card:has(.auth-register-form) .form-control,
.auth-panel-card:has(.auth-register-form) .auth-dob-select,
.auth-panel-card:has(.auth-register-form) .form-select.auth-dob-select,
.auth-panel-card:has(.auth-register-form) .auth-submit {
  min-height: 2.75rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  font-size: 1rem;
}

.auth-panel-card:has(.auth-register-form) .account-type-card {
  padding: 0.75rem 0.65rem;
  gap: 0.15rem;
}

.auth-panel-card:has(.auth-register-form) .account-type-card strong {
  font-size: 0.9375rem;
}

.auth-panel-card:has(.auth-register-form) .account-type-card span {
  font-size: 0.75rem;
  line-height: 1.3;
}

.auth-panel-card:has(.auth-register-form) .auth-dob-label-row {
  margin-bottom: 0.3rem;
}

.auth-panel-card:has(.auth-register-form) .auth-dob-why {
  font-size: 0.68rem;
}

.auth-panel-card:has(.auth-register-form) .auth-submit {
  margin-bottom: 0.65rem !important;
}

.account-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}

.account-type-option {
  position: relative;
  margin: 0;
  cursor: pointer;
  min-width: 0;
}

.account-type-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.account-type-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 100%;
  min-width: 0;
  padding: 0.875rem 0.75rem;
  border: 1px solid #363636;
  border-radius: 0.75rem;
  background: #1a1a1a;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.account-type-card strong {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
}

.account-type-card span {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.account-type-option input:checked + .account-type-card {
  border-color: var(--ev-accent, #ff3f3f);
  background: rgba(255, 63, 63, 0.1);
  box-shadow: 0 0 0 0.15rem rgba(255, 63, 63, 0.12);
}

.account-type-option input:focus-visible + .account-type-card {
  outline: 2px solid var(--ev-accent, #ff3f3f);
  outline-offset: 2px;
}

.auth-dob-label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.4rem;
}

.auth-dob-why {
  border: 0;
  padding: 0;
  background: transparent;
  color: #8ab4f8;
  font-size: 0.72rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.auth-dob-why:hover,
.auth-dob-why:focus-visible {
  color: #fff;
  text-decoration: underline;
}

.auth-dob-why-text {
  margin: 0 0 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #a8a8b0;
  font-size: 0.75rem;
  line-height: 1.4;
}

.auth-dob-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.85fr) minmax(0, 1fr);
  gap: 0.45rem;
}

.auth-panel-card .auth-dob-select,
.auth-panel-card .form-select.auth-dob-select {
  background: #1a1a1a;
  border: 1px solid #363636;
  color: #fff;
  border-radius: 0.75rem;
  min-height: 3rem;
  padding: 0.55rem 0.55rem;
  font-size: 0.9375rem;
  width: 100%;
  min-width: 0;
}

.auth-panel-card .auth-dob-select:focus {
  background: #1a1a1a;
  border-color: #555;
  color: #fff;
  box-shadow: 0 0 0 0.15rem rgba(255, 63, 63, 0.18);
}

.auth-panel-card .form-control::placeholder {
  color: #6b6b73;
}

.auth-panel-card .form-control:focus {
  background: #1a1a1a;
  border-color: #555;
  color: #fff;
  box-shadow: 0 0 0 0.15rem rgba(255, 63, 63, 0.18);
}

.auth-panel-card .form-check-label {
  color: #a8a8b0;
}

.auth-panel-card .form-check-input {
  background-color: #1a1a1a;
  border-color: #555;
}

.auth-panel-card .form-check-input:checked {
  background-color: var(--ev-accent, #ff3f3f);
  border-color: var(--ev-accent, #ff3f3f);
}

.auth-submit {
  background: var(--ev-accent, #ff3f3f);
  border: none;
  font-weight: 600;
  border-radius: 0.75rem;
  min-height: 3rem;
  font-size: 1rem;
}

.auth-submit:hover,
.auth-submit:focus {
  background: #e63636;
}

.auth-link {
  color: #a8a8b0;
  text-decoration: none;
}

.auth-link:hover {
  color: #fff;
}

.auth-alt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 63, 63, 0.55);
  color: var(--ev-accent, #ff3f3f);
  background: transparent;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
}

.auth-alt-btn:hover {
  color: #fff;
  border-color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0;
  color: #6b6b73;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.auth-panel-card .d-flex.justify-content-between {
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}

@keyframes auth-phone-in {
  from {
    opacity: 0;
    transform: translateY(1.5rem) scale(0.96);
  }
  to {
    opacity: 1;
  }
}

@keyframes auth-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-0.45rem);
  }
}

/* Desktop / large tablet split layout */
@media (min-width: 992px) {
  .auth-shell {
    grid-template-columns: minmax(0, 1.15fr) minmax(22rem, 26rem);
    max-width: 72rem;
  }

  .auth-shell:has(.auth-register-form) {
    grid-template-columns: minmax(0, 1fr) minmax(26rem, 32rem);
  }

  .auth-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2.5rem 2rem 3rem 2.5rem;
    overflow: hidden;
    background:
      radial-gradient(ellipse 55% 45% at 30% 20%, rgba(255, 63, 63, 0.18), transparent 60%),
      radial-gradient(ellipse 50% 40% at 70% 75%, rgba(56, 189, 248, 0.12), transparent 55%),
      #000;
  }

  .auth-visual-brand {
    position: absolute;
    top: 1.5rem;
    left: 2rem;
    z-index: 2;
  }

  .auth-visual-logo {
    height: 2.35rem;
    width: auto;
    max-width: 12rem;
    object-fit: contain;
  }

  .auth-visual-copy {
    position: relative;
    z-index: 2;
    max-width: 28rem;
    margin-bottom: 2rem;
  }

  .auth-visual-title {
    margin: 0;
    font-family: var(--ev-font-display, "Syne", system-ui, sans-serif);
    font-size: clamp(1.75rem, 3.2vw, 2.65rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #fff;
  }

  .auth-visual-accent {
    background: linear-gradient(105deg, #ff6b35 0%, #ff3f3f 45%, #f5c842 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  .auth-visual-stage {
    position: relative;
    height: 22rem;
    max-width: 28rem;
    margin-top: 0.5rem;
  }

  .auth-phone {
    position: absolute;
    width: 9.5rem;
    height: 17.5rem;
    border-radius: 1.35rem;
    padding: 0.4rem;
    background: linear-gradient(160deg, #2a2a2e, #121214);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  }

  .auth-phone-screen {
    width: 100%;
    height: 100%;
    border-radius: 1.05rem;
    overflow: hidden;
  }

  .auth-phone-screen--a {
    background:
      linear-gradient(165deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.55)),
      radial-gradient(circle at 40% 30%, #ff6b35, transparent 55%),
      #1a1020;
  }

  .auth-phone-screen--b {
    background:
      linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.6)),
      radial-gradient(circle at 60% 40%, #38bdf8, transparent 50%),
      #0f172a;
  }

  .auth-phone-screen--c {
    background:
      linear-gradient(200deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.65)),
      radial-gradient(circle at 50% 35%, #f5c842, transparent 45%),
      #1c1410;
  }

  .auth-phone--back {
    left: 0.5rem;
    bottom: 1.5rem;
    transform: rotate(-14deg);
    opacity: 0.9;
    animation: auth-phone-in 0.9s ease both;
  }

  .auth-phone--mid {
    left: 6.5rem;
    bottom: 0.75rem;
    transform: rotate(6deg);
    z-index: 1;
    animation: auth-phone-in 0.9s 0.08s ease both;
  }

  .auth-phone--front {
    left: 12.5rem;
    bottom: 2rem;
    transform: rotate(-4deg);
    z-index: 2;
    animation: auth-phone-in 0.9s 0.16s ease both;
  }

  .auth-float {
    position: absolute;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    font-size: 1.15rem;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
    animation: auth-float 3.6s ease-in-out infinite;
  }

  .auth-float--heart {
    top: 2.5rem;
    left: 1rem;
    color: #fff;
    background: linear-gradient(145deg, #ff3f3f, #ff6b35);
  }

  .auth-float--chat {
    top: 1.25rem;
    right: 3.5rem;
    color: #0a0a0b;
    background: #fff;
    animation-delay: 0.6s;
  }

  .auth-float--star {
    bottom: 0.25rem;
    right: 1.5rem;
    color: #0a0a0b;
    background: linear-gradient(145deg, #4ade80, #2dd4bf);
    animation-delay: 1.1s;
  }

  .auth-panel {
    align-items: center;
    justify-content: flex-start;
    padding: 2rem 1.25rem;
    max-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .auth-panel:not(:has(.auth-register-form)) {
    justify-content: center;
  }

  .auth-panel-card {
    max-width: 22.5rem;
    margin-top: auto;
    margin-bottom: auto;
    padding: 1.75rem 1.5rem 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #121212;
  }

  .auth-panel-card:has(.auth-register-form) {
    max-width: 30rem;
    padding: 1.25rem 1.65rem 1.15rem;
  }

  .auth-panel-card:has(.auth-register-form) .auth-panel-header {
    margin-bottom: 0.75rem;
  }

  .auth-panel-card:has(.auth-register-form) .form-control,
  .auth-panel-card:has(.auth-register-form) .auth-dob-select,
  .auth-panel-card:has(.auth-register-form) .form-select.auth-dob-select,
  .auth-panel-card:has(.auth-register-form) .auth-submit {
    min-height: 2.4rem;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    font-size: inherit;
  }

  .auth-panel-card .form-control,
  .auth-submit,
  .auth-alt-btn,
  .auth-panel-card .auth-dob-select {
    min-height: 2.75rem;
    font-size: inherit;
  }

  .auth-lang-bar {
    top: 1.25rem;
    right: 1.25rem;
  }

  .auth-panel-logo {
    height: 2.35rem;
  }

  .auth-panel-sub {
    font-size: 1.05rem;
  }
}

@media (max-width: 420px) {
  .account-type-grid {
    grid-template-columns: 1fr;
  }

  .auth-dob-label-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 380px) {
  .auth-dob-grid {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    padding-inline: 0.875rem;
  }
}
