/* /reg — вход и регистрация */

.auth-page {
  --auth-radius: 13px;
}

.input-field.input-invalid {
  border-color: rgba(248, 113, 113, 0.9);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.12);
}

.input-field.input-invalid:focus {
  border-color: rgba(248, 180, 180, 0.85);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12);
}

.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.auth-brand-nc {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  line-height: 0;
  animation: auth-nc-breathe 4.2s ease-in-out infinite;
}

@keyframes auth-nc-breathe {
  0%,
  100% {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.1)) drop-shadow(0 0 18px rgba(255, 255, 255, 0.04));
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.16)) drop-shadow(0 0 28px rgba(255, 255, 255, 0.07));
  }
}

.logo-nc-auth-svg {
  display: block;
  width: auto;
  height: 3.25rem;
  margin-inline: auto;
}

.nc-auth-letter {
  fill: none;
  stroke: url(#authNcGrad);
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.75;
}

.auth-brand-panel {
  font-family: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  color: rgba(163, 163, 163, 0.92);
  padding-left: 0.22em;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Плавная смена режима: вход ↔ регистрация (поля логин/пароль на месте) */
.auth-panels {
  position: relative;
  overflow: hidden;
}

.auth-register-only {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s ease;
}

.auth-panels.is-register .auth-register-only {
  opacity: 1;
  pointer-events: auto;
}

.auth-alert-register {
  display: none;
}

.auth-panels.is-register .auth-alert-login {
  display: none;
}

.auth-panels.is-register .auth-alert-register {
  display: block;
}

.auth-alert-register.hidden,
.auth-panels.is-register .auth-alert-register.hidden {
  display: none !important;
}

.auth-tail {
  display: flex;
  flex-direction: column;
}

.auth-login-submit {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  overflow: hidden;
  transition:
    grid-template-rows 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.34s ease,
    margin-top 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-panels.is-register .auth-login-submit {
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: 0;
  pointer-events: none;
}

.auth-login-submit__inner {
  min-height: 0;
  overflow: hidden;
}

.auth-login-submit .btn-chrome {
  margin-top: 0.75rem;
}

.auth-register-extras {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  overflow: hidden;
  transition:
    grid-template-rows 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.34s ease,
    margin-top 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-panels.is-register .auth-register-extras {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 0;
}

.auth-register-extras__inner {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-register-extras .btn-chrome {
  margin-top: 0.75rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-alert {
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--auth-radius);
}

.auth-form .btn-chrome {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.75rem;
  border-radius: var(--auth-radius) !important;
  padding: 0.75rem 1rem !important;
}

.auth-submit-btn {
  position: relative;
  gap: 0.5rem;
}

.auth-submit-btn__loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.auth-submit-btn__spinner {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  animation: auth-submit-spin 0.8s linear infinite;
}

.auth-submit-btn.is-loading .auth-submit-btn__label {
  display: none;
}

.auth-submit-btn.is-loading .auth-submit-btn__loading {
  display: inline-flex;
}

.auth-submit-btn.is-loading,
.auth-submit-btn:disabled {
  cursor: wait;
  opacity: 0.92;
  pointer-events: none;
}

.auth-submit-btn:disabled:not(.is-loading) {
  cursor: not-allowed;
  opacity: 0.55;
  pointer-events: none;
}

@keyframes auth-submit-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Подсказки при фокусе — плавное разворачивание */
.auth-hint-panel {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 0;
  opacity: 0;
  overflow: hidden;
  border-radius: var(--auth-radius);
  border: var(--auth-border);
  border-color: transparent;
  background: rgba(10, 10, 10, 0.94);
  font-family: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  line-height: 1.45;
  color: rgba(212, 212, 212, 0.92);
  box-shadow: none;
  pointer-events: none;
  position: relative;
  z-index: 5;
  transition:
    grid-template-rows 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.34s ease,
    margin-top 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.32s ease,
    box-shadow 0.32s ease;
}

.auth-hint-panel.is-visible {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 0.35rem;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 36px -18px rgba(0, 0, 0, 0.85);
  pointer-events: auto;
}

.auth-hint-panel__inner {
  min-height: 0;
  overflow: hidden;
  padding: 0 0.8rem;
  transition: padding 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-hint-panel.is-visible .auth-hint-panel__inner {
  padding: 0.65rem 0.8rem;
}

/* Ловушки для автозаполнения — браузер цепляется к ним, не к полям регистрации */
.auth-autofill-trap {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.hint-req-list {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.hint-req-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.6875rem;
  line-height: 1.35;
  color: rgba(163, 163, 163, 0.92);
  transition: color 0.22s ease;
}

.hint-req-row.is-met {
  color: rgba(167, 243, 208, 0.95);
}

.hint-req-row.is-fail {
  color: rgba(252, 165, 165, 0.95);
}

.hint-req-mark {
  flex-shrink: 0;
  width: 0.9375rem;
  height: 0.9375rem;
  margin-top: 0.06rem;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color 0.25s ease,
    background 0.25s ease;
}

.hint-req-row.is-met .hint-req-mark {
  border-color: rgba(52, 211, 153, 0.72);
  background: rgba(52, 211, 153, 0.14);
}

.hint-req-row.is-fail .hint-req-mark {
  border-color: rgba(248, 113, 113, 0.72);
  background: rgba(248, 113, 113, 0.12);
}

.hint-req-icon {
  width: 0.55rem;
  height: 0.55rem;
  display: none;
}

.hint-req-row.is-met .hint-req-icon--check {
  display: block;
  color: rgba(110, 231, 183, 0.98);
}

.hint-req-row.is-fail .hint-req-icon--cross {
  display: block;
  color: rgba(252, 165, 165, 0.98);
}

.hint-req-text .hint-muted {
  color: rgba(163, 163, 163, 0.95);
}

.hint-req-row.is-met .hint-req-text .hint-muted {
  color: rgba(134, 239, 172, 0.75);
}

.input-icon-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6b6b6b;
  cursor: pointer;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}

.input-icon-btn:hover {
  color: #e0e0e0;
  background: rgba(255, 255, 255, 0.06);
}

.input-icon-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.25);
  outline-offset: 0;
}

.input-with-icon {
  padding-right: 3rem;
}

/* Пароль без type=password — браузер не предлагает генератор/сохранение */
.input-secret-mask {
  -webkit-text-security: disc;
  text-security: disc;
}

.input-secret-mask.is-revealed {
  -webkit-text-security: none;
  text-security: none;
}

.input-secret__icon-hide.hidden,
.input-secret__icon-show.hidden {
  display: none;
}

/* Совпадение паролей — обводка поля повтора */
#reg-pass2.input-live-match {
  border-color: rgba(52, 211, 153, 0.45) !important;
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.12);
}

#reg-pass2.input-live-mismatch {
  border-color: rgba(248, 113, 113, 0.55) !important;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.1);
}

/* Согласие */
.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: 0.15rem;
  cursor: pointer;
  user-select: none;
}

.auth-consent__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-consent__box {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.06rem;
  border-radius: 0.35rem;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  transition:
    border-color 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.2s cubic-bezier(0.34, 1.45, 0.64, 1);
}

.auth-consent:hover .auth-consent__box {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.07);
}

.auth-consent__input:focus-visible + .auth-consent__box {
  outline: 2px solid rgba(255, 255, 255, 0.28);
  outline-offset: 2px;
}

.auth-consent__input:checked + .auth-consent__box {
  border-color: rgba(52, 211, 153, 0.72);
  background: rgba(52, 211, 153, 0.14);
  box-shadow: 0 0 12px -4px rgba(52, 211, 153, 0.45);
  transform: scale(1.04);
}

.auth-consent__check {
  width: 0.6875rem;
  height: 0.6875rem;
  color: rgba(110, 231, 183, 0.98);
  opacity: 0;
  transform: scale(0.45);
  transition:
    opacity 0.2s ease,
    transform 0.28s cubic-bezier(0.34, 1.45, 0.64, 1);
}

.auth-consent__input:checked + .auth-consent__box .auth-consent__check {
  opacity: 1;
  transform: scale(1);
}

.auth-consent__text {
  font-family: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.625rem;
  line-height: 1.5;
  color: rgba(163, 163, 163, 0.92);
  transition: color 0.2s ease;
}

.auth-consent:hover .auth-consent__text {
  color: rgba(212, 212, 212, 0.95);
}

.auth-consent__input:checked ~ .auth-consent__text {
  color: rgba(212, 212, 212, 0.96);
}

.auth-consent.is-invalid .auth-consent__box {
  border-color: rgba(248, 113, 113, 0.72);
  background: rgba(248, 113, 113, 0.1);
  box-shadow: 0 0 10px -4px rgba(248, 113, 113, 0.35);
}

.auth-consent.is-invalid .auth-consent__text {
  color: rgba(252, 165, 165, 0.95);
}

#btn-register-submit:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

@media (prefers-reduced-motion: reduce) {
  .auth-brand-nc {
    animation: none;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.1));
  }

  .auth-panels {
    transition: none;
  }

  .auth-login-submit,
  .auth-register-extras,
  .auth-register-only {
    transition: opacity 0.15s ease;
  }

  .auth-hint-panel {
    transition: opacity 0.15s ease;
  }

  .auth-hint-panel__inner {
    transition: none;
  }
}

.auth-topbar {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 120;
  width: min(28rem, calc(100% - 24px));
  transform: translateX(-50%);
  overflow: visible;
}

.auth-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3rem;
  padding: 0.45rem 0.55rem 0.45rem 0.85rem;
}

.auth-topbar__brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.auth-topbar__brand-main {
  font-family: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--prism-ink, #e8e8ec);
}

.auth-topbar__end {
  position: relative;
  flex-shrink: 0;
  overflow: visible;
}

.auth-lang {
  position: relative;
  z-index: 2;
}

.auth-lang__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.625rem;
  background: rgba(255, 255, 255, 0.04);
  color: #e5e5e5;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.auth-lang__trigger:hover,
.auth-lang.is-open .auth-lang__trigger {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.auth-lang__icon {
  width: 1.15rem;
  height: 1.15rem;
}

.auth-lang__menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 200;
  min-width: 11rem;
  padding: 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.625rem;
  background: rgba(10, 10, 12, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top right;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.24s ease,
    transform 0.24s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s linear 0.24s;
}

.auth-lang.is-open .auth-lang__menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 0.24s ease,
    transform 0.24s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s;
}

.auth-lang__option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: 0.45rem;
  background: transparent;
  color: #e5e5e5;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.auth-lang__option:hover {
  background: rgba(255, 255, 255, 0.06);
}

.auth-lang__option.is-active {
  background: rgba(255, 255, 255, 0.1);
}

.auth-lang__flag {
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}

.auth-i18n-fade-out {
  opacity: 0;
  transition: opacity 0.28s ease;
}

.auth-i18n-fade-in {
  opacity: 1;
  transition: opacity 0.28s ease;
}

@media (prefers-reduced-motion: reduce) {
  .auth-lang__menu,
  .auth-lang.is-open .auth-lang__menu,
  .auth-i18n-fade-out,
  .auth-i18n-fade-in {
    transition: none;
  }
}
