/* ============================================================
   Auth screens — liquid glass, 2026 motion
   Tokens from css/style.css. Hover lift only on fine pointer.
   prefers-reduced-motion is handled globally in style.css.
   ============================================================ */

.auth-wrap {
  --auth-rgb: 100, 170, 255;
  --auth-rgb-2: 130, 100, 255;
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px clamp(80px, 12vw, 100px);
  position: relative;
}

.auth-wrap.auth-wrap--violet {
  --auth-rgb: 130, 100, 255;
  --auth-rgb-2: 100, 170, 255;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(calc(var(--glass-blur) + 8px)) saturate(160%);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) + 8px)) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow:
    var(--glass-shadow),
    0 0 0 1px rgba(var(--auth-rgb), 0.08),
    0 24px 80px rgba(var(--auth-rgb), 0.08);
  overflow: hidden;
  animation: auth-card-in 0.62s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-card--wide { max-width: 440px; }

.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(125deg, rgba(255,255,255,0.07) 0%, transparent 42%),
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(var(--auth-rgb), 0.18), transparent 70%);
  animation: auth-sheen 10s ease-in-out infinite alternate;
}

.auth-hero {
  position: relative;
  z-index: 1;
  padding: 34px 28px 24px;
  text-align: center;
  border-bottom: 1px solid var(--glass-border);
  background: linear-gradient(165deg, rgba(var(--auth-rgb), 0.09) 0%, transparent 62%);
}

.auth-hero::after {
  content: '';
  position: absolute;
  width: 220px;
  height: 220px;
  left: 50%;
  top: -90px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(var(--auth-rgb), 0.32) 0%, transparent 68%);
  pointer-events: none;
  animation: auth-hero-glow 7s ease-in-out infinite alternate;
}

.auth-logo {
  position: relative;
  z-index: 1;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(var(--auth-rgb), 0.28), rgba(var(--auth-rgb-2), 0.16));
  border: 1px solid rgba(var(--auth-rgb), 0.35);
  box-shadow:
    0 8px 28px rgba(var(--auth-rgb), 0.22),
    inset 0 1px 0 rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  animation: auth-logo-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-logo .icon {
  width: 26px;
  height: 26px;
}

.auth-logo::after {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px solid rgba(var(--auth-rgb), 0.4);
  animation: auth-ring 2.8s ease-out infinite;
}

.auth-title {
  position: relative;
  z-index: 1;
  font-family: 'Syne', sans-serif;
  font-size: clamp(20px, 4vw, 24px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}

.auth-sub {
  position: relative;
  z-index: 1;
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.auth-name {
  color: var(--text);
  font-weight: 700;
}

.auth-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: #f59e0b;
}

.auth-stay {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.45;
}

.auth-body {
  position: relative;
  z-index: 1;
  padding: 26px 28px 28px;
}

.auth-field { margin-bottom: 14px; }

.auth-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.045);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.22s, box-shadow 0.22s, background 0.22s;
  box-sizing: border-box;
}

.auth-field input:focus {
  border-color: rgba(var(--auth-rgb), 0.55);
  background: rgba(var(--auth-rgb), 0.06);
  box-shadow: 0 0 0 4px rgba(var(--auth-rgb), 0.12);
}

.auth-field input.invalid {
  border-color: rgba(255, 82, 82, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 82, 82, 0.08);
}

.auth-field input::placeholder { color: var(--muted); }

.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 44px; }

.pass-eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  padding: 4px;
  transition: color 0.18s;
  line-height: 1;
}

.pass-eye:hover { color: var(--text); }

.auth-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(var(--auth-rgb), 0.38);
  background: linear-gradient(135deg, rgba(var(--auth-rgb), 0.32), rgba(var(--auth-rgb-2), 0.2));
  color: var(--text);
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.22s, box-shadow 0.22s, transform 0.22s, border-color 0.22s;
}

.auth-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,0.16) 50%, transparent 65%);
  transform: translateX(-130%);
  animation: auth-shimmer 4.8s ease-in-out infinite;
  pointer-events: none;
}

.auth-btn:active { transform: scale(0.985); }

.auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.auth-btn:disabled::after { display: none; }

.auth-links {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 16px;
}

.auth-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.18s;
}

.auth-links a:hover { color: var(--text); }

.auth-alert {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
  animation: auth-alert-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-alert.err {
  background: rgba(255, 82, 82, 0.1);
  border: 1px solid rgba(255, 82, 82, 0.28);
  color: #ff6b6b;
}

.auth-alert.ok {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.28);
  color: var(--success);
}

.auth-alert ul { margin: 0; padding-left: 18px; width: 100%; }

.auth-success-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.auth-success-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 16px;
  border-radius: 12px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.04);
  transition: background 0.2s, transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  animation: auth-alert-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-success-btn:nth-child(1) { animation-delay: 0.08s; }
.auth-success-btn:nth-child(2) { animation-delay: 0.16s; }
.auth-success-btn:nth-child(3) { animation-delay: 0.24s; }

.auth-card:not(.is-success) .auth-success-btn {
  animation: none;
}

.auth-success-btn.primary {
  background: rgba(var(--auth-rgb), 0.16);
  border-color: rgba(var(--auth-rgb), 0.32);
  color: var(--accent);
  font-weight: 700;
  font-family: 'Syne', sans-serif;
}

.auth-redirect {
  text-align: center;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.auth-redirect span {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.auth-countdown-bar {
  height: 3px;
  border-radius: 99px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  margin-top: 12px;
}

.auth-countdown-bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgb(var(--auth-rgb)), rgb(var(--auth-rgb-2)));
  transform-origin: left center;
  animation: auth-countdown 5s linear forwards;
}

.auth-countdown-bar.is-fast i {
  animation-duration: 2s;
}

.auth-back {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 11px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.03);
  transition: color 0.18s, background 0.18s, border-color 0.18s;
  margin: 16px auto 0;
  width: fit-content;
}

.auth-back:hover {
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border-color: var(--glass-border-h);
}

.tg-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(41, 182, 246, 0.07);
  border: 1px solid rgba(41, 182, 246, 0.18);
  margin-top: 4px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  animation: auth-alert-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tg-hint a {
  color: #29b6f6;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.tg-hint a:hover { text-decoration: underline; }

.pass-strength { margin-top: 6px; }
.pass-strength-bar {
  height: 3px;
  border-radius: 99px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.pass-strength-fill {
  height: 100%;
  border-radius: 99px;
  width: 0;
  transition: width 0.3s, background 0.3s;
}
.pass-strength-label { font-size: 11px; color: var(--muted); margin-top: 3px; }

.pass-match { font-size: 11px; margin-top: 4px; }
.pass-match.ok  { color: #4caf50; }
.pass-match.err { color: #ff5252; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}
.auth-divider span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.auth-mail-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(var(--auth-rgb), 0.06);
  border: 1px solid rgba(var(--auth-rgb), 0.15);
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  animation: auth-alert-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (hover: hover) and (pointer: fine) {
  .auth-btn:hover {
    background: linear-gradient(135deg, rgba(var(--auth-rgb), 0.42), rgba(var(--auth-rgb-2), 0.3));
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(var(--auth-rgb), 0.28);
  }

  .auth-success-btn:hover {
    background: rgba(255,255,255,0.09);
    transform: translateY(-2px);
  }

  .auth-success-btn.primary:hover {
    background: rgba(var(--auth-rgb), 0.24);
    box-shadow: 0 8px 22px rgba(var(--auth-rgb), 0.2);
  }
}

@media (max-width: 460px) {
  .auth-hero { padding: 26px 20px 20px; }
  .auth-body { padding: 20px 20px 24px; }
}

@keyframes auth-card-in {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

@keyframes auth-logo-in {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: none; }
}

@keyframes auth-ring {
  0%   { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(1.42); opacity: 0; }
}

@keyframes auth-hero-glow {
  from { opacity: 0.55; transform: translateX(-50%) scale(1); }
  to   { opacity: 1; transform: translateX(-50%) scale(1.18); }
}

@keyframes auth-sheen {
  from { opacity: 0.7; }
  to   { opacity: 1; }
}

@keyframes auth-shimmer {
  0%, 58% { transform: translateX(-130%); }
  78%, 100% { transform: translateX(130%); }
}

@keyframes auth-alert-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes auth-countdown {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
