.auth-body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  isolation: isolate;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #000000;
  overflow: hidden;
  pointer-events: none;
}

.auth-glow::before {
  content: '';
  position: absolute;
  width: 68%;
  height: 70%;
  left: 16%;
  top: -12%;
  border-radius: 999px;
  background: radial-gradient(
    ellipse at center,
    rgba(217, 195, 171, 0.22) 0%,
    rgba(241, 96, 1, 0.34) 36%,
    rgba(193, 8, 1, 0.2) 64%,
    transparent 82%
  );
  filter: blur(72px);
}

.auth-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.56) 0px,
    rgba(0, 0, 0, 0.56) 14px,
    rgba(241, 96, 1, 0.05) 14px,
    rgba(217, 195, 171, 0.03) 30px
  );
  mask-image: radial-gradient(ellipse 75% 65% at 50% 25%, #000 10%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 25%, #000 10%, transparent 80%);
}

.auth-grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: overlay;
  opacity: 0.26;
}

.auth-top {
  flex-shrink: 0;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
}

.auth-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(180deg, #f16001 0%, #e85002 65%, #c10801 100%);
  color: var(--primary-fg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 0 20px -4px rgba(232, 80, 2, 0.65);
  display: grid;
  place-items: center;
}

.auth-shell {
  flex: 1;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: clamp(16px, 4.5vh, 48px) 20px 40px;
}

.auth-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  width: min(440px, 100%);
  background: var(--surface-elevated);
  border-radius: 20px;
  padding: 28px 26px;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 62%;
  height: 44%;
  background-image:
    radial-gradient(rgba(249, 249, 249, 0.28) 0.65px, transparent 0.65px),
    radial-gradient(ellipse at 92% 8%, rgba(232, 80, 2, 0.2) 0%, transparent 72%);
  background-size: 5px 5px, 100% 100%;
  mask-image: radial-gradient(ellipse 88% 88% at 96% 4%, #000 18%, transparent 76%);
  -webkit-mask-image: radial-gradient(ellipse 88% 88% at 96% 4%, #000 18%, transparent 76%);
  opacity: 0.6;
  pointer-events: none;
  z-index: -1;
}

.auth-eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
}

.auth-card-head h1 {
  margin: 0 0 6px;
  font-size: 23px;
  line-height: 1.2;
  text-wrap: balance;
  transition: opacity 160ms ease, transform 220ms var(--ease-spring);
}

.auth-card-head .muted {
  margin: 0;
  text-wrap: pretty;
  transition: opacity 160ms ease, transform 220ms var(--ease-spring);
}

.auth-card-head.is-swapping h1,
.auth-card-head.is-swapping .muted {
  opacity: 0;
  transform: translateY(4px);
}

/* Concentric radii: outer 13px = inner 9px + 4px padding */
.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.auth-tab-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  bottom: 4px;
  width: calc((100% - 14px) / 2);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 8px -2px rgba(0, 0, 0, 0.45);
  transition: transform 280ms var(--ease-spring);
  pointer-events: none;
  z-index: 0;
}

.auth-tabs[data-active="register"] .auth-tab-indicator {
  transform: translateX(calc(100% + 6px));
}

.auth-tab {
  position: relative;
  z-index: 1;
  min-block-size: 36px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 180ms ease, transform 140ms var(--ease-spring);
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab:active {
  transform: scale(0.96);
}

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

.auth-page-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Smooth interruptible grid-row collapse (Emil Kowalski enter/exit) */
.auth-collapse {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition:
    grid-template-rows 280ms var(--ease-spring),
    opacity 200ms ease,
    margin-top 280ms var(--ease-spring),
    transform 280ms var(--ease-spring);
}

.auth-collapse.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 13px;
  transform: translateY(0);
  pointer-events: auto;
}

#authTabsCollapse.is-open {
  margin-top: 18px;
}

#authTabsCollapse.is-open + .auth-page-form {
  margin-top: 5px;
}

.auth-collapse-inner {
  overflow: hidden;
  min-height: 0;
  padding: 2px;
  margin: -2px;
}

.auth-page-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-page-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.auth-page-field input {
  font-family: inherit;
  font-size: 14px;
  min-block-size: 42px;
  padding: 9px 13px;
  border-radius: var(--radius-inner);
  border: none;
  background: #0a0a0a;
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: box-shadow 160ms ease;
}

.auth-page-field input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--primary), 0 0 0 3px rgba(232, 80, 2, 0.24);
}

.auth-sync-note {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
}

.auth-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(239, 68, 68, 0.14);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.35);
  color: #fca5a5;
  font-size: 12.5px;
}

.auth-success {
  margin: 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(34, 197, 94, 0.12);
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.32);
  color: #bbf7d0;
  font-size: 12.5px;
  line-height: 1.5;
}

.auth-success a {
  display: inline-block;
  margin-top: 6px;
  color: #ffffff;
  font-weight: 600;
  text-decoration: underline;
}

.auth-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.auth-inline-wrap {
  transition: opacity 180ms ease, transform 220ms var(--ease-spring);
}

.auth-inline-wrap.is-hidden {
  opacity: 0;
  transform: translateX(4px);
  pointer-events: none;
}

.auth-inline-link {
  position: relative;
  border: none;
  background: transparent;
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: opacity 150ms ease, transform 140ms var(--ease-spring);
}

.auth-inline-link::after {
  content: '';
  position: absolute;
  inset: -11px -8px;
}

.auth-inline-link:hover {
  text-decoration: underline;
}

.auth-inline-link:active {
  transform: scale(0.96);
}

.auth-legal-links {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}

@media (prefers-reduced-motion: reduce) {
  .auth-tab-indicator,
  .auth-tab,
  .auth-collapse,
  .auth-card-head h1,
  .auth-card-head .muted,
  .auth-inline-wrap,
  .auth-inline-link {
    transition: none;
  }
}

.auth-submit {
  width: 100%;
  min-block-size: 44px;
  margin-top: 15px;
}

#turnstileWrap.is-open {
  margin-top: 15px;
}

.auth-turnstile-box {
  width: 100%;
  min-height: 65px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#backToLoginWrap .auth-submit {
  margin-top: 0;
}

.auth-foot-note {
  margin-top: 18px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.auth-foot-note a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.auth-foot-note a:hover { color: var(--primary); }
