/* ============================================================
   Sekai — auth.css
   Экран входа: стеклянная карточка по центру, чернильный фон.
============================================================ */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  overflow-y: auto;
  background: transparent;
  opacity: 1;
  transition: opacity 340ms cubic-bezier(0.22, 1, 0.36, 1),
              transform 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-overlay.hidden-auth {
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}

/* Карточка */
.auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 480px;
  padding: 48px 44px 40px;
  background: rgba(12, 17, 36, 0.78);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line-hover);
  border-radius: var(--r-xl);
  box-shadow:
    0 50px 120px rgba(0, 0, 0, 0.7),
    0 0 80px rgba(60, 90, 220, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  display: flex;
  flex-direction: column;
  gap: 28px;
  animation: authCardIn 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.24),
    transparent);
  pointer-events: none;
}

@keyframes authCardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Лого */
.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  margin-bottom: 8px;
}

.auth-logo-mark {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--glass-line-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.auth-logo-name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--text-2);
}

.auth-header {
  text-align: center;
  margin-bottom: 4px;
}

.auth-title {
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.8px;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 10px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-3);
  line-height: 1.6;
  max-width: 340px;
  margin: 0 auto;
}

/* Форма */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-field-label {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-3);
}

.auth-input-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-md);
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}

.auth-input-wrap:focus-within {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.45);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.auth-input-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-4);
  flex-shrink: 0;
  transition: color var(--t);
}

.auth-input-icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.5;
}

.auth-input-wrap:focus-within .auth-input-icon { color: var(--text-2); }

.auth-input {
  flex: 1;
  min-width: 0;
  padding: 17px 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  font-weight: 400;
  letter-spacing: 0.2px;
}

.auth-input::placeholder {
  color: var(--text-4);
  letter-spacing: 0.4px;
}

.auth-input-code {
  font-family: var(--font-mono);
  letter-spacing: 2.5px;
  font-size: 15.5px;
  font-weight: 500;
  text-transform: uppercase;
}

/* Кнопка входа */
.auth-submit {
  width: 100%;
  padding: 16px 20px;
  margin-top: 12px;
  border-radius: var(--r-md);
  background: var(--grad);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: filter var(--t), transform var(--t), box-shadow var(--t);
  box-shadow:
    0 0 36px rgba(79, 125, 255, 0.30),
    0 12px 28px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  position: relative;
  overflow: hidden;
}

.auth-submit:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow:
    0 0 52px rgba(90, 130, 255, 0.45),
    0 14px 32px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.auth-submit:active { transform: scale(0.99); }

.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.auth-submit-arrow {
  font-size: 16px;
  line-height: 1;
  transition: transform var(--t);
}

.auth-submit:hover .auth-submit-arrow { transform: translateX(2px); }

/* Разделитель */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-4);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  margin: 4px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-line);
}

/* Ссылки внизу */
.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-3);
  margin-top: 8px;
}

.auth-link {
  color: var(--text-2);
  font-weight: 500;
  cursor: pointer;
  transition: color var(--t);
  text-decoration: none;
  position: relative;
}

.auth-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--t);
}

.auth-link:hover { color: var(--text); }
.auth-link:hover::after { opacity: 0.5; }

.auth-dot { color: var(--text-4); user-select: none; }

/* Ошибка */
.auth-error {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: rgba(255, 100, 100, 0.06);
  border: 1px solid rgba(255, 100, 100, 0.20);
  color: rgba(255, 170, 170, 0.95);
  font-size: 12.5px;
  line-height: 1.5;
  animation: shake 380ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.auth-error svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
  flex-shrink: 0;
}

/* Футер */
.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 11.5px;
  color: var(--text-4);
  margin-top: 4px;
  user-select: none;
}

.auth-footer-link {
  color: var(--text-4);
  cursor: pointer;
  transition: color var(--t);
}

.auth-footer-link:hover { color: var(--text-2); }

/* Success overlay */
.auth-success {
  position: fixed;
  inset: 0;
  z-index: 5100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 7, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-success.visible {
  opacity: 1;
  pointer-events: auto;
}

.auth-success-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.auth-success-icon {
  width: 80px;
  height: 80px;
  border-radius: 26px;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  box-shadow: 0 0 60px rgba(255, 255, 255, 0.20);
  animation: successPop 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-success-icon svg {
  width: 36px;
  height: 36px;
  stroke-width: 2;
}

.auth-success-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.1px;
}

@media (max-width: 560px) {
  .auth-card {
    padding: 36px 26px 30px;
    border-radius: var(--r-lg);
  }
  .auth-title { font-size: 24px; }
  .auth-overlay { padding: 16px; }
}