.tg-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.tg-auth-overlay.is-open {
  display: flex;
}

.tg-auth-modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 28px 24px 24px;
  border-radius: 14px;
  background: #1c2533;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  color: #fff;
  animation: tg-auth-in 0.22s ease;
}

@keyframes tg-auth-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.tg-auth-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8b98a8;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.tg-auth-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.tg-auth-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #2aabee, #229ed9);
  color: #fff;
}

.tg-auth-logo svg {
  width: 36px;
  height: 36px;
}

.tg-auth-title {
  margin: 0 0 10px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
}

.tg-auth-text {
  margin: 0 0 22px;
  text-align: center;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #9aa7b5;
}

.tg-auth-field {
  position: relative;
  margin-bottom: 18px;
}

.tg-auth-field input {
  width: 100%;
  height: 54px;
  padding: 18px 14px 8px;
  border: 1.5px solid #2aabee;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  font-size: 1rem;
  outline: none;
}

.tg-auth-field input:focus {
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.18);
}

.tg-auth-field label {
  position: absolute;
  left: 12px;
  top: 8px;
  font-size: 0.72rem;
  color: #2aabee;
  pointer-events: none;
}

.tg-auth-submit {
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 12px;
  background: #2aabee;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.tg-auth-submit:hover:not(:disabled) {
  background: #229ed9;
}

.tg-auth-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.tg-auth-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #ffb4b4;
  font-size: 0.82rem;
  text-align: center;
}

.tg-auth-wait {
  text-align: center;
  padding: 8px 0 4px;
}

.tg-auth-wait-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(42, 171, 238, 0.2);
  border-top-color: #2aabee;
  animation: tg-auth-spin 0.9s linear infinite;
}

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

.tg-auth-wait h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.tg-auth-wait p {
  margin: 0 0 20px;
  color: #9aa7b5;
  font-size: 0.88rem;
  line-height: 1.45;
}

.tg-auth-wait-ok {
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
}

.tg-auth-step {
  display: none;
}

.tg-auth-step.is-active {
  display: block;
}

@media (max-width: 480px) {
  .tg-auth-overlay {
    align-items: flex-end;
    padding: 12px;
  }

  .tg-auth-modal {
    max-height: calc(100dvh - 24px - env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}
