html,
body {
  margin: 0;
  min-height: 100%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  /* NO overflow:hidden — breaks touch targets on iOS Safari */
  overflow-x: hidden;
  background:
    radial-gradient(circle at top right, rgb(195 244 0 / 0.08), transparent 32rem),
    radial-gradient(circle at bottom left, rgb(0 219 233 / 0.06), transparent 28rem),
    #131313;
  color: #e5e2e1;
  font-family: "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.auth-screen::selection {
  background: #c3f400;
  color: #161e00;
}

.auth-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.auth-orb {
  position: absolute;
  border-radius: 9999px;
  filter: blur(120px);
  will-change: transform;
  transform: translateZ(0);
}

.auth-orb-top {
  top: -10%;
  right: -10%;
  width: min(60vw, 52rem);
  height: min(60vw, 52rem);
  background: rgb(195 244 0 / 0.07);
}

.auth-orb-bottom {
  bottom: -12%;
  left: -10%;
  width: min(50vw, 42rem);
  height: min(50vw, 42rem);
  background: rgb(0 219 233 / 0.05);
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  /* On small screens: allow the card to sit naturally, not stretch vertically */
  margin: auto;
}

.auth-card {
  overflow: hidden;
  border: 1px solid rgb(68 73 51 / 0.28);
  border-radius: 12px;
  background: rgb(32 31 31 / 0.4);
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 70px rgb(0 0 0 / 0.45);
}

.auth-header {
  padding: 48px 40px 32px;
  text-align: center;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.auth-brand h1,
.auth-header p,
.auth-tab,
.auth-submit,
.auth-status,
.auth-wordmark span {
  font-family: "Space Grotesk", sans-serif;
}

.auth-brand h1 {
  margin: 0;
  color: #c3f400;
  font-size: 3rem;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.07em;
  text-transform: uppercase;
}

.auth-brand-icon {
  color: #c3f400;
  font-size: 2.35rem;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

.auth-header p {
  margin: 0;
  color: #c4c9ac;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.auth-tabs {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 0 40px;
  margin-bottom: 40px;
}

.auth-tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 0 0 10px;
  color: #c4c9ac;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease;
}

.auth-tab:hover,
.auth-tab:focus-visible {
  color: #e5e2e1;
  outline: none;
}

.auth-tab.is-active {
  color: #ffffff;
  border-bottom-color: #c3f400;
}

.auth-panel {
  padding: 0 40px 48px;
}

.auth-panel[hidden] {
  display: none !important;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.auth-field {
  position: relative;
}

.auth-field input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #444933;
  border-radius: 0;
  background: transparent !important;
  padding: 24px 0 8px;
  color: #e5e2e1;
  font: 500 1rem/1.5 "Inter", sans-serif;
  text-transform: uppercase;
  transition: border-color 180ms ease;
  box-shadow: none;
  outline: none;
}

.auth-field input::placeholder {
  color: transparent;
}

.auth-field input:focus {
  outline: none;
  border-bottom-color: #c3f400;
}

.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus,
.auth-field input:-webkit-autofill:active {
  -webkit-text-fill-color: #e5e2e1 !important;
  transition: background-color 99999s ease-in-out 0s;
  box-shadow: inset 0 0 0 1000px transparent !important;
  /* Fix: Ensure font stays consistent during autofill */
  font-size: 1rem !important;
  font-family: "Inter", sans-serif !important;
  font-weight: 500 !important;
  text-transform: uppercase !important;
  line-height: 1.5 !important;
}

.auth-field input:-webkit-autofill + label {
  transform: translateY(-2px) scale(0.84);
  color: #c3f400;
}

.auth-field label {
  position: absolute;
  top: 2px;
  left: 0;
  color: #c4c9ac;
  pointer-events: none;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transform-origin: left top;
  transition: transform 220ms ease, color 220ms ease;
}

.auth-field input:focus + label,
.auth-field input:not(:placeholder-shown) + label,
.auth-field.has-value label {
  transform: translateY(-2px) scale(0.84);
  color: #c3f400;
}

.auth-actions {
  padding-top: 20px;
}

.auth-submit {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #c3f400 0%, #abd600 100%);
  padding: 16px 20px;
  color: #161e00;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.auth-submit:hover,
.auth-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 20px rgb(195 244 0 / 0.2);
  filter: brightness(1.02);
}

.auth-submit:active {
  transform: scale(0.98);
}

.auth-submit:disabled {
  cursor: progress;
  opacity: 0.72;
}

.auth-help {
  padding-top: 10px;
  text-align: center;
}

.auth-help a {
  color: #c4c9ac;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 180ms ease;
}

.auth-help a:hover,
.auth-help a:focus-visible {
  color: #c3f400;
  outline: none;
}

.auth-status-bar {
  border-top: 1px solid rgb(68 73 51 / 0.12);
  background: rgb(42 42 42 / 0.5);
  padding: 16px 40px;
}

.auth-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  color: rgb(229 226 225 / 0.52);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.auth-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: #c3f400;
  animation: authPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.login-status-error {
  color: #ffb4ab;
}

.login-status-error .auth-status-dot {
  background: #ffb4ab;
}

.auth-wordmark {
  position: fixed;
  right: 48px;
  bottom: 48px;
  z-index: 0;
  display: none;
  pointer-events: none;
  user-select: none;
}

.auth-wordmark span {
  display: block;
  color: rgb(255 255 255 / 0.02);
  font-size: clamp(4.5rem, 10vw, 7.5rem);
  font-weight: 900;
  font-style: italic;
  line-height: 0.92;
  letter-spacing: -0.06em;
  text-transform: uppercase;
}

.auth-wordmark span + span {
  margin-top: -10px;
}

@keyframes authPulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.45;
  }
}

@media (min-width: 1024px) {
  .auth-wordmark {
    display: block;
  }
}

@media (max-width: 640px) {
  body.auth-screen {
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    align-items: flex-start;
  }

  .auth-header {
    padding: 40px 24px 28px;
  }

  .auth-tabs,
  .auth-panel,
  .auth-status-bar {
    padding-left: 24px;
    padding-right: 24px;
  }

  .auth-tabs {
    gap: 20px;
  }

  .auth-panel {
    padding-bottom: 36px;
  }

  .auth-brand h1 {
    font-size: 2.4rem;
  }
}
