/* ============================================================================
   Экран авторизации
   ========================================================================== */
.auth-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: safe center;
  z-index: 1;
  overflow-y: auto;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.auth-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
/* Атмосферный фон без дублирования логотипа: мягкие световые пятна */
.auth-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(700px 480px at 30% 20%, rgba(99, 102, 241, 0.16), transparent 65%),
    radial-gradient(620px 420px at 75% 80%, rgba(139, 92, 246, 0.14), transparent 65%),
    radial-gradient(900px 600px at 50% 50%, rgba(20, 24, 50, 0.5), transparent 70%);
}
.auth-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(10, 11, 15, 0.06), rgba(10, 11, 15, 0.3));
}
#threads-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.auth-content {
  position: relative;
  z-index: 2;
  width: min(410px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-card {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-deep);
  /* Полупрозрачная плитка: анимированный фон просматривается (перекрывает .glass) */
  background: rgba(16, 18, 28, 0.08);
  backdrop-filter: blur(1px) saturate(150%);
  -webkit-backdrop-filter: blur(1px) saturate(150%);
}

/* Логотип как цельный баннер в шапке карточки */
.auth-logo-banner {
  position: relative;
  width: 100%;
  aspect-ratio: 824 / 980;
  background: url('../loom-banner2.png') center/contain no-repeat;
  overflow: hidden;
}
.auth-logo-banner::after {
  content: none;
}
.auth-logo { display: none; }
.auth-card-body {

  padding: 22px 26px 22px;
  max-height: 70vh;
  overflow-y: auto;
}

/* Вкладки вход/регистрация */
.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 22px;
}
.auth-tab {
  position: relative;
  z-index: 2;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(11px, 3.6vw, 14px);
  padding: 9px 2px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.25s;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-tab.active { color: #fff; }
.auth-tab-indicator {
  position: absolute;
  z-index: 1;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: linear-gradient(120deg, var(--thread-1), var(--thread-2));
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 14px var(--thread-glow);
  transition: transform 0.32s var(--ease);
}
.auth-tabs[data-mode="register"] .auth-tab-indicator { transform: translateX(100%); }

.field-hint {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 6px;
  line-height: 1.4;
}

.auth-submit {
  width: 100%;
  margin-top: 6px;
  padding: 13px;
  font-size: 15px;
}
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-secure-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.auth-secure-note i { width: 16px; height: 16px; color: var(--secure); flex-shrink: 0; }

@media (max-width: 480px) {
  .auth-card { padding: 22px 18px 18px; }
  .auth-logo { width: 72%; }
}
.auth-logo-banner { max-height: 300px; margin: 10px auto 0; }
.uname-wrap { position: relative; }
.uname-wrap .input { width: 100%; padding-right: 40px; box-sizing: border-box; }
.uname-status { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 17px; }
.uname-status.ok::after { content: '✓'; color: #3ddc84; font-weight: 700; }
.uname-status.busy::after { content: '✕'; color: #ff5c5c; font-weight: 700; }
.uname-status.wait::after { content: '…'; color: #999; }

/* Глазок пароля */
.pw-wrap { position: relative; }
.pw-wrap .input { width: 100%; padding-right: 44px; box-sizing: border-box; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-dim, rgba(255,255,255,0.55)); cursor: pointer; padding: 6px; display: flex; }
.pw-eye i { width: 20px; height: 20px; }
