:root {
  color-scheme: dark;
  --login-bg: #000;
  --login-panel: rgba(0, 0, 0, 0.82);
  --login-panel-border: rgba(255, 255, 255, 0.12);
  --login-field: #262626;
  --login-field-border: rgba(255, 255, 255, 0.1);
  --login-text: #fff;
  --login-muted: #a3a3a3;
  --login-accent: #dc2626;
  --login-accent-hover: #b91c1c;
}

/* BUILD: 2026-05-16 LOGIN-MP4-RESTORE
   GIF fallback with restored MP4 background for the login screen. */

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
}

html {
  -webkit-text-size-adjust: 100%;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

body {
  margin: 0;
  background: var(--login-bg);
  color: var(--login-text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.login-page {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 16% 8%, rgba(220, 38, 38, 0.08), transparent 28rem),
    var(--login-bg);
  isolation: isolate;
  overflow: hidden;
}



.login-bg-video {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  background: #020204;
  opacity: 0;
  filter: saturate(1.08) brightness(1.02);
  animation: login-video-in 420ms ease 120ms forwards;
  pointer-events: none;
}

.login-topbar {
  display: none;
}

.login-brand {
  display: none;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--login-accent);
  text-decoration: none;
  font-size: clamp(1.55rem, 7vw, 2.45rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.login-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.login-card {
  width: min(100% - 32px, 390px);
  margin: auto;
  padding: clamp(22px, 5vw, 32px);
  border: 1px solid var(--login-panel-border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.7);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.login-heading {
  margin: 0 0 20px;
}

.login-heading h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.6rem, 7vw, 2.05rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0;
}

.login-heading p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.95rem;
  line-height: 1.45;
}

.login-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.login-mode-switch button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 120ms ease;
}

.login-mode-switch button:hover,
.login-mode-switch button.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.login-mode-switch button:active {
  transform: scale(0.98);
}

.hidden,
[hidden],
.login-form .signup-field[hidden] {
  display: none;
}

.login-form {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.login-form label:not(.login-remember) {
  color: var(--login-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.login-form input[type="text"],
.login-form input[type="email"],
.login-form input[type="password"] {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--login-field-border);
  border-radius: 6px;
  background: var(--login-field);
  color: var(--login-text);
  font-size: 16px;
  line-height: 1.25;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.login-form input::placeholder {
  color: rgba(255, 255, 255, 0.46);
}

.login-form input:focus {
  border-color: rgba(255, 255, 255, 0.54);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.56);
}

.login-form input[aria-invalid="true"] {
  border-color: rgba(248, 113, 113, 0.8);
}

.login-status {
  min-height: 20px;
  margin: 0;
  color: var(--login-muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.login-status.is-error {
  color: #fecaca;
}

.login-status.is-ok {
  color: #bbf7d0;
}

.login-form > button[type="submit"] {
  min-height: 48px;
  margin-top: 2px;
  border: 0;
  border-radius: 6px;
  background: var(--login-accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  transition: background 160ms ease, transform 120ms ease;
}

.login-form > button[type="submit"]:hover {
  background: var(--login-accent-hover);
}

.login-form > button[type="submit"]:active {
  transform: translateY(1px);
}

.login-form > button[type="submit"]:disabled {
  cursor: wait;
  opacity: 0.72;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  color: var(--login-muted);
  font-size: 0.88rem;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--login-muted);
  cursor: pointer;
}

.login-remember input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--login-accent);
}

.login-help {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--login-muted);
  font-weight: 700;
  cursor: pointer;
}

.login-help:hover,
.login-help:focus-visible {
  color: #fff;
  text-decoration: underline;
}

.login-build {
  position: fixed;
  right: 10px;
  bottom: 8px;
  z-index: 5;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
  line-height: 1;
  pointer-events: none;
}

@media (min-width: 860px) {
  .login-page {
    display: grid;
    grid-template-columns: minmax(340px, 25vw) minmax(0, 75vw);
    align-items: center;
    padding: 0;
    background: #020204;
  }

  .login-page::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background: 
      linear-gradient(
        90deg,
        #020204 0%,
        rgba(2, 2, 4, 0.98) 10%,
        rgba(2, 2, 4, 0.86) 22%,
        rgba(2, 2, 4, 0.58) 36%,
        rgba(2, 2, 4, 0.18) 50%,
        rgba(2, 2, 4, 0.04) 66%,
        rgba(2, 2, 4, 0) 100%
      );
  }

  .login-page::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
      radial-gradient(circle at 18% 50%, rgba(255, 255, 255, 0.05), transparent 14rem),
      linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.22));
  }

  .login-card {
    grid-column: 1;
    justify-self: center;
    align-self: center;
    width: min(390px, calc(100% - 42px));
    margin: 0;
    background: rgba(8, 8, 10, 0.58);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 28px 92px rgba(0, 0, 0, 0.54);
  }

  .login-heading h1 {
    font-size: 1.95rem;
  }
}

.login-card {
  animation: login-card-in 420ms cubic-bezier(0.2, 0, 0, 1) both;
}

body.is-login-submitting .login-card {
  transform: translateY(-2px);
  transition: transform 180ms cubic-bezier(0.2, 0, 0, 1), opacity 180ms ease;
}

body.is-login-leaving .login-card {
  opacity: 0;
  transform: translateY(-12px) scale(0.985);
}

body.is-login-leaving::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.08), transparent 18rem),
    rgba(0, 0, 0, 0.44);
  animation: login-route-out 220ms ease both;
}

@keyframes login-card-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes login-route-out {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .login-bg-video {
    display: block;
  }

  .login-page {
    min-height: 100dvh;
    padding: max(22px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom));
  }

  .login-card {
    width: calc(100% - 28px);
    margin: auto;
    padding: 24px 18px;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .login-options {
    align-items: stretch;
    flex-direction: column;
    gap: 2px;
  }

  .login-help {
    align-self: flex-start;
  }

  .login-build {
    left: 14px;
    right: auto;
  }
}

@media (max-width: 480px) {
  .login-card {
    align-self: center;
  }

  .login-heading {
    margin-bottom: 18px;
  }

  .login-form {
    gap: 9px;
  }
}

@media (max-width: 360px) {
  .login-card {
    width: calc(100% - 20px);
    padding: 20px 14px;
  }
}


@keyframes login-video-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
