* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #0f172a;
}

/* ── Фоны ── */
.bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
}

.bg-1 {
  background-image: url('../assets/mainfon.jpg');
  z-index: 1;
}

.bg-2 {
  background-image: url('../assets/mainfon2.jpg');
  z-index: 2;
  opacity: 0;
  transition: opacity 2.5s ease-in-out;
}

.bg-2.visible {
  opacity: 1;
}

/* ── Логотип / заголовок ── */
.logo-area {
  position: fixed;
  top: 5vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  text-align: center;
  pointer-events: none;
  width: 90%;
}

.logo-area h1 {
  font-size: clamp(32px, 10vw, 72px);
  color: #fff;
  text-shadow: 
    0 0 10px #0ea5e9,
    0 0 20px #0ea5e9,
    0 0 40px #0284c7,
    3px 3px 0 #0369a1;
  letter-spacing: 2px;
  animation: titlePulse 3s ease-in-out infinite;
}

.logo-area p {
  color: #e0f2fe;
  font-size: clamp(14px, 4vw, 20px);
  margin-top: 8px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

@keyframes titlePulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.02); filter: brightness(1.1); }
}

/* ── Кнопки авторизации ── */
.auth-buttons {
  position: fixed;
  bottom: 8vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(12px, 3vw, 32px);
  width: 100%;
  padding: 0 20px;
}

.auth-btn {
  width: min(320px, 45vw);
  height: auto;
  aspect-ratio: 500 / 180;
  background: transparent;
  border: none;
  cursor: pointer;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.4));
  transform-origin: top center;
  animation: fallDown 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards,
             sway 2.5s ease-in-out infinite 1.2s;
  transition: transform 0.2s, filter 0.2s;
}

.auth-btn:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 12px 24px rgba(14,165,233,0.5));
}

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

.btn-login {
  background-image: url('../assets/button/button-login.png');
  animation-delay: 0s, 1.2s;
}

.btn-register {
  background-image: url('../assets/button/button-registration.png');
  animation-delay: 0.2s, 1.4s;
}

@keyframes fallDown {
  0% {
    transform: translateY(-120vh) rotate(-12deg);
    opacity: 0;
  }
  60% {
    transform: translateY(20px) rotate(4deg);
    opacity: 1;
  }
  80% {
    transform: translateY(-10px) rotate(-2deg);
  }
  100% {
    transform: translateY(0) rotate(0deg);
  }
}

@keyframes sway {
  0%, 100% { transform: rotate(-1.5deg); }
  50% { transform: rotate(1.5deg); }
}

/* ── Модальные окна ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal {
  width: min(460px, 100%);
  background: linear-gradient(145deg, rgba(14, 165, 233, 0.15), rgba(99, 102, 241, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255,255,255,0.1),
    inset 0 1px 0 rgba(255,255,255,0.1);
  position: relative;
  transform: translateY(30px) scale(0.95);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-title {
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 24px;
  text-shadow: 0 0 20px rgba(14,165,233,0.6);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  color: #bae6fd;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.5);
  color: #fff;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14,165,233,0.2);
}

.form-group input::placeholder {
  color: #64748b;
}

.submit-btn {
  width: 100%;
  padding: 16px;
  margin-top: 8px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(90deg, #0ea5e9, #6366f1);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(14,165,233,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(14,165,233,0.5);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.close-btn:hover {
  background: rgba(239, 68, 68, 0.5);
}

.switch-text {
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  margin-top: 18px;
}

.switch-text a {
  color: #38bdf8;
  cursor: pointer;
  font-weight: 600;
}

.switch-text a:hover {
  text-decoration: underline;
}

.captcha-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0;
  min-height: 78px;
}

/* ── Уведомления ── */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 14px 24px;
  border-radius: 12px;
  color: #fff;
  font-weight: 600;
  z-index: 200;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  max-width: 90%;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success { background: linear-gradient(90deg, #10b981, #059669); }
.toast.error { background: linear-gradient(90deg, #ef4444, #dc2626); }
.toast.info { background: linear-gradient(90deg, #0ea5e9, #0284c7); }

/* ── Адаптив ── */
@media (max-width: 640px) {
  .auth-buttons {
    bottom: 5vh;
    gap: 10px;
  }

  .auth-btn {
    width: min(260px, 44vw);
  }
}

@media (max-width: 400px) {
  .auth-buttons {
    gap: 8px;
  }

  .auth-btn {
    width: min(220px, 44vw);
  }
}

.hidden { display: none !important; }

.verify-hint {
  color: #bae6fd;
  margin-bottom: 16px;
  text-align: center;
}