/* Udeskom auth — centered glass, crimson grain stage */
.theme-auth {
  --auth-red: #F90000;
  --auth-red-deep: #8a0000;
  --auth-red-soft: rgba(249, 0, 0, 0.35);
  --auth-ink: #f5f5f5;
  --auth-muted: rgba(245, 245, 245, 0.62);
  --auth-line: rgba(255, 255, 255, 0.14);
  --auth-sans: "Sora", "Segoe UI", sans-serif;
  margin: 0;
  min-height: 100%;
  background: #0b0b0d !important;
  color: var(--auth-ink);
  font-family: var(--auth-sans);
  -webkit-font-smoothing: antialiased;
}

.auth-stage {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem 5.5rem;
  overflow: hidden;
}

/* —— Moving crimson stage —— */
.auth-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.auth-bg__base {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, #2a0a0a 0%, #0b0b0d 55%),
    linear-gradient(160deg, #120808 0%, #0b0b0d 40%, #160606 100%);
}

.auth-bg__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  will-change: transform;
  mix-blend-mode: screen;
}

.auth-bg__glow--a {
  width: min(78vw, 720px);
  height: min(78vw, 720px);
  left: -10%;
  top: -20%;
  background: radial-gradient(circle, rgba(249, 0, 0, 0.72) 0%, rgba(249, 0, 0, 0) 68%);
  animation: auth-drift-a 16s ease-in-out infinite alternate;
}

.auth-bg__glow--b {
  width: min(62vw, 560px);
  height: min(62vw, 560px);
  right: -6%;
  bottom: -10%;
  background: radial-gradient(circle, rgba(200, 0, 35, 0.62) 0%, rgba(200, 0, 35, 0) 70%);
  animation: auth-drift-b 19s ease-in-out infinite alternate;
}

.auth-bg__glow--c {
  width: min(48vw, 420px);
  height: min(48vw, 420px);
  left: 34%;
  top: 34%;
  background: radial-gradient(circle, rgba(255, 40, 40, 0.42) 0%, rgba(255, 40, 40, 0) 70%);
  animation: auth-drift-c 13s ease-in-out infinite alternate;
}

.auth-bg__car {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(92vw, 1100px);
  height: auto;
  opacity: 0.38;
  filter: saturate(1.15) contrast(1.08) brightness(0.92);
  transform: translate(-50%, -42%) scale(1.06);
  mask-image: radial-gradient(ellipse 55% 50% at 50% 48%, #000 20%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 55% 50% at 50% 48%, #000 20%, transparent 72%);
  animation: auth-car 22s ease-in-out infinite alternate;
}

.auth-bg__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at 50% 42%, rgba(11, 11, 13, 0.08), rgba(11, 11, 13, 0.62) 78%),
    linear-gradient(180deg, rgba(11, 11, 13, 0.2), rgba(11, 11, 13, 0.5));
}

.auth-bg__grain {
  position: absolute;
  inset: -20%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  opacity: 0.38;
  mix-blend-mode: overlay;
  animation: auth-grain 0.9s steps(2) infinite;
}

@keyframes auth-drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(12%, 18%, 0) scale(1.12); }
}

@keyframes auth-drift-b {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-14%, -10%, 0) scale(1.18); }
}

@keyframes auth-drift-c {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-18%, 12%, 0); }
}

@keyframes auth-car {
  from { transform: translate(-50%, -42%) scale(1.06); }
  to { transform: translate(-48%, -44%) scale(1.1); }
}

@keyframes auth-grain {
  0% { transform: translate(0, 0); }
  50% { transform: translate(-1.5%, 1%); }
  100% { transform: translate(1%, -1%); }
}

@keyframes auth-rise {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* —— Chrome bits —— */
.auth-stage__theme.theme-toggle {
  position: absolute;
  top: 1.15rem;
  right: 1.15rem;
  z-index: 3;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--auth-line);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  backdrop-filter: blur(10px);
}

.auth-stage__theme.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.auth-stage__foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1.25rem;
  z-index: 2;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  padding: 0 1rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(245, 245, 245, 0.45);
}

/* —— Glass card —— */
.auth-glass {
  position: relative;
  z-index: 2;
  width: min(420px, 100%);
  padding: 2rem 1.65rem 1.55rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05) 42%, rgba(249, 0, 0, 0.1)),
    rgba(20, 12, 12, 0.28);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(249, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(32px) saturate(160%);
  -webkit-backdrop-filter: blur(32px) saturate(160%);
  animation: auth-rise 0.7s ease-out both;
}

.auth-glass__brand {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.auth-glass__logo {
  display: block;
  height: 42px;
  width: auto;
  opacity: 0.96;
}

/* —— Form —— */
.gate__head {
  margin: 0 0 1.45rem;
  text-align: center;
}

.gate__title {
  margin: 0 0 0.4rem;
  font-size: clamp(1.7rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
}

.gate__lead {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--auth-muted);
}

.gate-form {
  display: grid;
  gap: 0.95rem;
}

.gate-field {
  display: grid;
  gap: 0.4rem;
}

.gate-field > span {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(245, 245, 245, 0.55);
}

.gate-field__control {
  position: relative;
}

.gate-field input {
  width: 100%;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  padding: 0 2.7rem 0 0.95rem;
  outline: none;
  font-family: var(--auth-sans);
  font-size: 0.96rem;
  font-weight: 500;
  color: #fff;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.gate-field input:focus {
  border-color: rgba(249, 0, 0, 0.55);
  background: rgba(0, 0, 0, 0.38);
  box-shadow: 0 0 0 3px rgba(249, 0, 0, 0.16);
}

.gate-field__ico {
  position: absolute;
  top: 50%;
  right: 0.85rem;
  transform: translateY(-50%);
  color: rgba(245, 245, 245, 0.45);
  display: inline-flex;
  pointer-events: none;
}

.gate-field__ico--btn {
  pointer-events: auto;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.gate-field__ico--btn:hover {
  color: #fff;
}

.gate-field__ico--btn svg[hidden],
.gate-field__ico--btn svg.is-off {
  display: none !important;
}

.gate-go {
  margin-top: 0.35rem;
  height: 50px;
  border: 0;
  border-radius: 999px;
  background: var(--auth-red);
  color: #fff;
  font-family: var(--auth-sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(249, 0, 0, 0.28);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.gate-go:hover {
  background: #d60000;
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(249, 0, 0, 0.34);
}

.theme-auth .alert {
  margin: 0 0 0.95rem;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 120, 120, 0.35);
  background: rgba(249, 0, 0, 0.12);
  color: #ffc9c9;
  font-size: 0.88rem;
}

/* —— PWA —— */
.gate-install {
  margin-top: 1.2rem;
}

.gate-install__btn {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  padding: 0.9rem 0 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.gate-install__btn[hidden],
.gate-install__btn.is-off {
  display: none !important;
}

.gate-install__ico {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
}

.gate-install__copy {
  display: grid;
  gap: 0.1rem;
}

.gate-install__copy strong {
  font-size: 0.88rem;
  font-weight: 600;
}

.gate-install__copy span {
  font-size: 0.78rem;
  color: var(--auth-muted);
}

.pwa-guide {
  margin-top: 0.85rem;
  padding: 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.28);
  color: var(--auth-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.pwa-guide.is-open {
  border-color: rgba(249, 0, 0, 0.35);
}

.pwa-guide__title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: #fff;
}

.pwa-guide__lead {
  margin: 0.35rem 0 0.85rem;
  font-size: 0.86rem;
}

.pwa-guide__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.8rem;
}

.pwa-guide__step { margin: 0; }

.pwa-guide__copy {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.pwa-guide__n {
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--auth-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.pwa-guide__copy strong {
  display: block;
  margin: 0 0 0.15rem;
  color: #fff;
  font-size: 0.88rem;
}

.pwa-guide__copy p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--auth-muted);
}

.pwa-guide__shot {
  margin: 0.6rem 0 0 2rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 210px;
}

.pwa-guide__shot img {
  display: block;
  width: 100%;
  height: auto;
}

.pwa-guide__note {
  margin: 0.9rem 0 0;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.78rem;
}

.pwa-guide__note strong {
  color: #fff;
}

.pwa-guide [data-pwa-guide][hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .auth-stage {
    padding: 1.25rem 1rem 4.75rem;
    align-items: flex-end;
  }

  .auth-glass {
    padding: 1.55rem 1.2rem 1.25rem;
    border-radius: 18px;
  }

  .auth-bg__car {
    width: 140%;
    opacity: 0.3;
  }

  .auth-stage__foot {
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
  }

  .pwa-guide__shot {
    margin-left: 0;
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-bg__glow,
  .auth-bg__car,
  .auth-bg__grain,
  .auth-glass {
    animation: none;
  }
}
