/* ============================================================
   LOGIN PAGE — self-contained, fluid layout
   No dependency on css/pages/auth.css.
   - Respects the fixed 80px navbar.
   - Uses small-viewport units so mobile address bars don't
     break sizing.
   - Uses clamp() throughout so padding, type, and the card
     itself rescale fluidly between phones and large screens.
   ============================================================ */

.login-page {
  min-height: 100vh;
  min-height: 100svh;
  /* Navbar is position: fixed; height: 80px. Reserve that space at the
     top so the card can never slide under it. */
  padding:
    calc(80px + clamp(16px, 4vh, 32px))
    clamp(16px, 4vw, 24px)
    clamp(24px, 6vh, 48px);
  /* Single-axis flex column so that `margin: auto` on the card both
     - centers it vertically when there's free space, AND
     - collapses to 0 when the card is taller than the viewport
       (preventing it from drifting up under the navbar). */
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg-primary);
  overflow-x: hidden;
}

/* Subtle decorative background (purely cosmetic, never consumes layout). */
.login-page__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.login-page__glow {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  background-color: var(--accent-primary);
  border-radius: 50%;
  opacity: 0.06;
  filter: blur(120px);
  top: -20%;
  left: -10%;
}

.login-page__glow--alt {
  background-color: var(--accent-secondary);
  opacity: 0.04;
  top: auto;
  left: auto;
  bottom: -25%;
  right: -10%;
  width: 50vmax;
  height: 50vmax;
}

.login-page__pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 2px 2px, var(--border-color) 1px, transparent 0);
  background-size: 36px 36px;
  opacity: 0.25;
}

/* ------------------------------------------------------------
   Card
   ------------------------------------------------------------ */
.login-card {
  position: relative;
  z-index: 1;
  /* `margin: auto` centers the card in any free space inside .login-page;
     when the card is taller than the page, the auto margins collapse and
     it sticks just below the reserved navbar padding. */
  margin: auto;
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: clamp(14px, 2vw, 20px);
  padding: clamp(20px, 3vw, 32px);
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2vh, 20px);
  box-shadow: var(--shadow-md);
}

/* ------------------------------------------------------------
   Split shell — brand aside (desktop) + form card.
   The shell owns the frame; the card sits inside it seamlessly.
   ------------------------------------------------------------ */
.login-shell {
  position: relative;
  z-index: 1;
  margin: auto;
  width: 100%;
  max-width: 940px;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: clamp(16px, 2vw, 24px);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  transition:
    grid-template-columns 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    max-width 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sign up hides the brand aside — it collapses the left column and the form
   expands to a single centered card. The aside fades out to the right
   (and fades back in from the left when returning to Sign in). */
.login-aside {
  animation: login-aside-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-shell:has(.login-card[data-mode="signup"]) .login-aside {
  animation: login-aside-out 0.34s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes login-aside-in {
  from { opacity: 0; transform: translateX(-44px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes login-aside-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(44px); }
}

/* Card becomes the right cell — drop its own frame, let the shell provide it.
   align-self:start keeps the card at its natural height so the tab-swap
   height animation stays accurate; the shell's matching bg fills the rest. */
.login-shell .login-card {
  align-self: start;
  margin: 0;
  max-width: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background-color: transparent;
}

.login-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: clamp(16px, 2.2vh, 22px);
  padding: clamp(28px, 3.4vw, 48px);
  border-right: 1px solid var(--border-color);
  background:
    linear-gradient(
      165deg,
      color-mix(in srgb, var(--accent-primary) 13%, var(--bg-secondary)) 0%,
      var(--bg-secondary) 58%
    );
  overflow: hidden;
  isolation: isolate;
}

/* Quiet dot texture (static — no FX/canvas). */
.login-aside::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 2px 2px, rgba(255, 255, 255, 0.05) 1px, transparent 0);
  background-size: 30px 30px;
  z-index: -1;
}

/* The panel grows to fill the aside height (centered) alongside the form. */
.login-aside__panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(14px, 2vh, 20px);
}

.login-aside__brand img {
  height: 52px;
  width: auto;
  display: block;
}

.login-aside__headline {
  margin: 0;
  font-size: clamp(1.9rem, 1.8vw + 1.3rem, 2.7rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.login-aside__text {
  margin: 0;
  max-width: 42ch;
  font-size: clamp(1rem, 0.4vw + 0.9rem, 1.15rem);
  line-height: 1.6;
  color: var(--text-secondary);
}

.login-aside__list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vh, 22px);
}

.login-aside__list li {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: clamp(1rem, 0.4vw + 0.9rem, 1.12rem);
  font-weight: 500;
  color: var(--text-secondary);
}

.login-aside__ico {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 26%, transparent);
}

.login-aside__ico svg {
  width: 20px;
  height: 20px;
}


/* Desktop: the aside carries the branding, so left-align the form header
   and hide the card's duplicate logo for a cleaner, app-like layout. */
@media (min-width: 901px) {
  .login-shell .login-card {
    padding: clamp(28px, 3vw, 40px);
  }
  .login-shell .login-card .login-logo {
    display: none;
  }
  .login-shell .login-header {
    align-items: flex-start;
    text-align: left;
  }

  /* Sign up: collapse the aside column, shrink to a single centered card,
     and restore the card's own logo + centered header (no brand panel). */
  .login-shell:has(.login-card[data-mode="signup"]) {
    grid-template-columns: minmax(0, 0fr) minmax(0, 1fr);
    max-width: 480px;
  }
  .login-shell:has(.login-card[data-mode="signup"]) .login-card .login-logo {
    display: inline-flex;
  }
  .login-shell:has(.login-card[data-mode="signup"]) .login-header {
    align-items: center;
    text-align: center;
  }
  /* When the aside column collapses to 0, keep its content at a fixed width so
     it gets clipped (overflow:hidden) instead of reflowing into a very tall
     thin column — which would otherwise inflate the card's height. */
  .login-shell:has(.login-card[data-mode="signup"]) .login-aside > * {
    width: 360px;
    max-width: 360px;
  }
}

/* Mobile / tablet: collapse to the single, centered form card. */
@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
    max-width: 440px;
  }
  .login-aside {
    display: none;
  }
}

/* ------------------------------------------------------------
   Header
   ------------------------------------------------------------ */
.login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.login-logo {
  display: inline-flex;
  margin-bottom: 4px;
  transition: transform var(--transition-fast);
}

.login-logo:hover {
  transform: scale(1.03);
}

.login-logo img {
  height: clamp(56px, 9vh, 84px);
  width: auto;
  display: block;
}

.login-title {
  font-size: clamp(1.2rem, 2.5vw + 0.4rem, 1.6rem);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.login-subtitle {
  font-size: clamp(0.85rem, 1.5vw + 0.2rem, 0.95rem);
  color: var(--text-secondary);
  margin: 0;
}

/* ------------------------------------------------------------
   Tabs (with sliding indicator)
   ------------------------------------------------------------ */
.login-tabs {
  position: relative;
  display: flex;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 0;
  isolation: isolate;
}

.login-tabs__indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background-color: var(--bg-card);
  border-radius: calc(var(--radius-md) - 4px);
  box-shadow: var(--shadow-sm);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
  pointer-events: none;
}

.login-card[data-mode="signup"] .login-tabs__indicator {
  transform: translateX(100%);
}

.login-tab {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

.login-tab[aria-selected="true"] {
  color: var(--text-primary);
}

.login-tab:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ------------------------------------------------------------
   Inline message (errors / success). Hidden by default.
   ------------------------------------------------------------ */
.login-message {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  border: 1px solid transparent;
  line-height: 1.4;
}

.login-message[hidden] {
  display: none;
}

.login-message--error {
  background-color: rgba(255, 71, 87, 0.10);
  border-color: rgba(255, 71, 87, 0.35);
  color: #ff8a93;
}

.login-message--success {
  background-color: rgba(46, 213, 115, 0.10);
  border-color: rgba(46, 213, 115, 0.35);
  color: #6ee7a0;
}

.login-message__icon {
  flex: 0 0 auto;
  font-weight: 700;
}

.login-message__body {
  flex: 1;
  min-width: 0;
}

.login-referral-banner {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.45;
  color: #9fd4ff;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.login-referral-banner[hidden] {
  display: none;
}

/* ------------------------------------------------------------
   Discord OAuth (official Blurple button)
   ------------------------------------------------------------ */
.login-oauth {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 4px;
}

.login-oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Official Sign in with Google button (light/neutral theme) */
.login-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid #747775;
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: #1f1f1f;
  font-family: 'Roboto', system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.login-google-btn:hover {
  background-color: #f7f8f8;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.2);
  transform: translateY(-1px);
}

.login-google-btn:focus-visible {
  outline: 2px solid #4285f4;
  outline-offset: 2px;
}

.login-google-btn__icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath fill='%23EA4335' d='M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z'/%3E%3Cpath fill='%234285F4' d='M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.56 2.96-2.23 5.48-4.76 7.16l7.73 6.01c4.51-4.16 7.12-10.28 7.12-17.64z'/%3E%3Cpath fill='%23FBBC05' d='M10.53 28.59a14.5 14.5 0 0 1 0-9.18l-7.98-6.19a24.05 24.05 0 0 0 0 21.56l7.98-6.19z'/%3E%3Cpath fill='%2334A853' d='M24 48c6.48 0 11.93-2.13 15.9-5.81l-7.73-6.01c-2.15 1.45-4.92 2.3-8.17 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.login-discord-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 11px 16px;
  border: 0;
  border-radius: var(--radius-md);
  background-color: #5865f2;
  color: #ffffff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.login-discord-btn:hover {
  background-color: #4752c4;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.35);
}

.login-discord-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.login-discord-btn__icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028 14.09 14.09 0 0 0 1.226-1.994.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.login-oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-transform: lowercase;
}

.login-oauth-divider::before,
.login-oauth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border-color);
}

.login-oauth-divider span {
  flex: 0 0 auto;
}

/* ------------------------------------------------------------
   Forms — visibility driven by the card's data-mode.
   ------------------------------------------------------------ */
.login-form {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.6vh, 14px);
  /* Animated by JS when switching tabs. */
  will-change: opacity, transform;
}

.login-card[data-mode="login"]  #form-signup,
.login-card[data-mode="signup"] #form-login {
  display: none;
}

/* Header / footer text snippets swap with the same data-mode. */
.login-card[data-mode="login"]  [data-when="signup"],
.login-card[data-mode="signup"] [data-when="login"] {
  display: none;
}

/* ------------------------------------------------------------
   Tab-swap animation — added/removed by JS.
     - Outgoing form fades + slides DOWN (off the card).
     - Card height transitions between the two form sizes.
     - Incoming form fades + slides UP into place (from below).
   ------------------------------------------------------------ */
@keyframes login-form-leave {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(10px); }
}

@keyframes login-form-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-form.is-leaving {
  animation: login-form-leave 180ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

.login-form.is-entering {
  animation: login-form-enter 220ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.login-card.is-resizing {
  /* JS sets an inline `height` and toggles this class to drive the
     height transition. We animate height (not max-height) because the
     two form sizes are known at swap time. */
  transition: height 240ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.login-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.login-input {
  width: 100%;
  padding: 12px 14px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background-color: var(--bg-secondary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-input--with-toggle {
  padding-right: 68px;
}

.login-toggle-password {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid transparent;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-primary);
  cursor: pointer;
  border-radius: 999px;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.login-toggle-password:hover,
.login-toggle-password:focus-visible {
  background-color: var(--bg-hover);
  border-color: var(--border-light);
  color: var(--accent-secondary);
  outline: none;
}

.login-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Browser autofill — keep the dark surface and light text. */
.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover,
.login-input:-webkit-autofill:focus,
.login-input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-tertiary) inset;
  caret-color: var(--text-primary);
  border: 1px solid var(--border-color);
  transition: background-color 9999s ease 0s;
}

.login-input:-webkit-autofill:focus {
  border-color: var(--accent-primary);
}

/* ------------------------------------------------------------
   Submit button
   ------------------------------------------------------------ */
.login-submit {
  margin-top: 4px;
  width: 100%;
  padding: 12px 16px;
  background-color: var(--accent-primary);
  color: var(--bg-primary);
  border: 0;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast), opacity var(--transition-fast);
}

.login-submit:hover:not(:disabled) {
  background-color: var(--accent-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.login-submit:active:not(:disabled) {
  transform: translateY(0);
}

.login-submit:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ------------------------------------------------------------
   Footer link (tab switch shortcut under the form)
   ------------------------------------------------------------ */
.login-footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.login-footer a {
  color: var(--accent-primary);
  font-weight: 600;
}

.login-footer a:hover {
  color: var(--accent-secondary);
}

.login-footer [hidden] {
  display: none;
}

/* ------------------------------------------------------------
   Password strength meter (signup only)
   ------------------------------------------------------------ */
.login-strength {
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-strength[hidden] {
  display: none;
}

.login-strength__bar {
  flex: 1;
  height: 4px;
  background-color: var(--bg-tertiary);
  border-radius: 999px;
  overflow: hidden;
}

.login-strength__fill {
  height: 100%;
  width: 0%;
  background-color: var(--text-muted);
  border-radius: 999px;
  transition: width 0.25s ease, background-color 0.25s ease;
}

.login-strength__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 60px;
  text-align: right;
}

/* ------------------------------------------------------------
   Verify mode — inline 6-digit code (required after sign-up / sign-in)
   ------------------------------------------------------------ */
.login-card[data-mode="verify"] .login-tabs,
.login-card[data-mode="verify"] .login-oauth,
.login-card[data-mode="verify"] #form-login,
.login-card[data-mode="verify"] #form-signup,
.login-card[data-mode="verify"] .login-footer,
.login-card[data-mode="verify"] [data-when="login"],
.login-card[data-mode="verify"] [data-when="signup"] {
  display: none !important;
}

.login-card[data-mode="login"] [data-when="verify"],
.login-card[data-mode="signup"] [data-when="verify"] {
  display: none;
}

.login-card[data-mode="verify"] [data-when="verify"] {
  display: block;
}

.login-card[data-mode="verify"] .login-title[data-when="verify"],
.login-card[data-mode="verify"] .login-subtitle[data-when="verify"] {
  display: block;
}

.login-verify[hidden] {
  display: none !important;
}

.login-card[data-mode="verify"] .login-verify {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-verify-provider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
}

.login-verify-provider strong {
  color: var(--accent-primary);
  font-size: 1rem;
}

.login-code-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.login-code-inputs input {
  width: 44px;
  height: 52px;
  padding: 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.login-code-inputs input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}

.login-verify-hint {
  text-align: center;
  margin: 0;
}

.login-verify-mail {
  display: block;
  width: 100%;
  padding: 12px 16px;
  text-align: center;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.login-verify-mail:hover {
  border-color: var(--accent-primary);
  background-color: var(--bg-tertiary);
}

.login-verify-resend {
  width: 100%;
  padding: 10px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent-primary);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-verify-resend:hover {
  color: var(--accent-secondary);
}

.login-verify-resend:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   RESPONSIVE — narrow phones
   ============================================================ */
@media (max-width: 480px) {
  .login-card {
    padding: clamp(18px, 5vw, 22px);
    gap: 14px;
  }
}

/* ============================================================
   RESPONSIVE — short viewports (landscape phones, small laptops)
   The card progressively sheds non-essential chrome so the form
   itself remains usable without forcing a scroll.
   ============================================================ */
@media (max-height: 760px) {
  .login-page {
    padding-top: calc(80px + 16px);
    padding-bottom: 16px;
  }
  .login-logo img {
    height: 56px;
  }
  .login-card {
    gap: 14px;
  }
}

@media (max-height: 640px) {
  .login-subtitle {
    display: none;
  }
  .login-logo img {
    height: 48px;
  }
}

@media (max-height: 540px) {
  .login-logo {
    display: none;
  }
  .login-header {
    gap: 0;
  }
  .login-form {
    gap: 10px;
  }
}

/* ------------------------------------------------------------
   Sign-up legal acknowledgments
   ------------------------------------------------------------ */
.login-legal {
  margin: 8px 0 4px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.login-legal-heading {
  margin: 0;
  padding: 12px 16px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

.login-legal-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.login-legal-item:last-child {
  border-bottom: none;
}

.login-legal-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.login-legal-item input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.login-legal-item span {
  display: block;
  min-width: 0;
}

.login-legal-item a {
  color: var(--accent-primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-legal-item a:hover {
  color: var(--text-primary);
}

/* ============================================================
   Honor reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .login-logo,
  .login-tab,
  .login-tabs__indicator,
  .login-input,
  .login-toggle-password,
  .login-submit,
  .login-strength__fill,
  .login-card.is-resizing {
    transition: none !important;
  }

  .login-form.is-leaving,
  .login-form.is-entering,
  .login-aside {
    animation: none !important;
  }

  .login-shell {
    transition: none !important;
  }
}
