* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0a0a;
  --fg: #eaeaea;
  --muted: #b6b6b6;
  --accent1: #6366f1;
  --accent2: #a855f7;
  --accent3: #ec4899;
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-brd: rgba(255, 255, 255, 0.14);
  --ring: rgba(99, 102, 241, 0.6);
  --error: #f87171;
}

html,
body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial,
    sans-serif;
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
  line-height: 1.5;
}

/* Фоновые слои */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
}

.blob {
  position: absolute;
  width: 80vmax;
  height: 80vmax;
  filter: blur(120px);
  opacity: 0.35;
}

.blob-1 {
  left: -20vmax;
  top: -10vmax;
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.65),
    transparent 60%
  );
}

.blob-2 {
  right: -15vmax;
  top: -5vmax;
  background: radial-gradient(
    circle,
    rgba(168, 85, 247, 0.55),
    transparent 60%
  );
}

.blob-3 {
  left: 10vmax;
  bottom: -20vmax;
  background: radial-gradient(
    circle,
    rgba(236, 72, 153, 0.55),
    transparent 60%
  );
}

/* Тонкая сетка */
.grid {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  pointer-events: none;
  background-image: radial-gradient(
    circle at 1px 1px,
    #fff 1px,
    transparent 1px
  );
  background-size: 24px 24px;
}

.header {
  max-width: 1200px;
  margin: 24px auto 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo {
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
  background: linear-gradient(
    90deg,
    var(--accent1),
    var(--accent2),
    var(--accent3)
  );
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.tagline {
  color: var(--muted);
  font-size: 0.9rem;
}

.nav {
  display: flex;
  gap: 20px;
}

.nav a {
  color: #cfcfcf;
  text-decoration: none;
  font-size: 0.95rem;
  opacity: 0.85;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.nav a:hover {
  opacity: 1;
  color: #fff;
}

.main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 180px);
}

.hero {
  text-align: center;
  padding: 24px;
  width: 100%;
  max-width: 840px;
  margin: auto;
}

.title {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 900;
  letter-spacing: 0.5px;
  background: linear-gradient(
    90deg,
    var(--accent1),
    var(--accent2),
    var(--accent3)
  );
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 40px rgba(168, 85, 247, 0.15);
}

.subtitle {
  margin-top: 12px;
  color: #cfcfcf;
  max-width: 60ch;
  margin-inline: auto;
  font-size: 1.05rem;
}

.card {
  margin: 28px auto 0;
  max-width: 420px;
  padding: 28px 24px;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-brd);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: left;
}

.card.wide {
  max-width: 600px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #fff;
  text-align: center;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 0.9rem;
  color: #d0d0d0;
}

.field input::placeholder {
  color: #9c9c9c;
}

.error {
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 4px;
  display: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  animation: shake 0.5s ease-in-out;
}

.error.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.invalid input {
  border-color: var(--error);
  animation: errorPulse 0.6s ease-in-out;
}

@keyframes errorPulse {
  0%, 100% { 
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--error) 20%, transparent);
  }
  50% { 
    box-shadow: 0 0 0 6px color-mix(in oklab, var(--error) 40%, transparent);
  }
}

.links {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
  text-align: center;
}

.links a {
  color: #cfe2ff;
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.links a:hover {
  opacity: 1;
  color: #fff;
}

.cta {
  display: inline-block;
  margin-top: 26px;
  padding: 12px 22px;
  border-radius: 999px;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent2), var(--accent3));
  transition: transform 0.18s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.cta:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 10px 30px color-mix(in oklab, var(--accent3) 40%, transparent);
}

.loader {
  display: none;
  margin: 0 auto;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid var(--accent1);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.btn {
  margin-top: 4px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  transition: all 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px color-mix(in oklab, var(--accent2) 40%, transparent);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.success-message {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  animation: slideIn 0.4s ease-out;
}

.error-message {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  animation: slideIn 0.4s ease-out;
}

.success-content, .error-content {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 0.95rem;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: #9c9c9c;
  transition: color 0.3s ease;
  pointer-events: none;
}

.field input {
  padding: 14px 16px 14px 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  outline: none;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  width: 100%;
}

.field input:focus {
  border-color: var(--accent1);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 40%, transparent);
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-1px);
}

.field.valid input {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

.field.valid ~ .input-icon {
  color: #10b981;
}

.field input:not(:placeholder-shown) {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

.field input:not(:placeholder-shown) ~ .input-icon {
  color: var(--accent2);
}

.toggle-password {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: #9c9c9c;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-password:hover {
  color: var(--accent1);
  background: rgba(255, 255, 255, 0.05);
}

.toggle-password:focus {
  outline: none;
  color: var(--accent1);
  background: rgba(255, 255, 255, 0.1);
}

.field input[type="password"] {
  padding-right: 50px;
}

/* ОКОНЧАТЕЛЬНОЕ СКРЫТИЕ ДЕФОЛТНЫХ ИКОНОК БРАУЗЕРА */
.field input[type="password"] {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
}

/* Internet Explorer / Edge */
.field input[type="password"]::-ms-reveal,
.field input[type="password"]::-ms-clear {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  position: absolute !important;
  left: -9999px !important;
}

/* Chrome / Safari / Edge Chromium */
.field input[type="password"]::-webkit-credentials-auto-fill-button,
.field input[type="password"]::-webkit-strong-password-auto-fill-button,
.field input[type="password"]::-webkit-textfield-decoration-container {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  position: absolute !important;
  left: -9999px !important;
}

/* Firefox */
.field input[type="password"]::-moz-credentials-auto-fill-button {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
}

/* Дополнительные правила для всех браузеров */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear,
input[type="password"]::-webkit-credentials-auto-fill-button,
input[type="password"]::-webkit-strong-password-auto-fill-button,
input[type="password"]::-webkit-textfield-decoration-container,
input[type="password"]::-moz-credentials-auto-fill-button {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  position: absolute !important;
  left: -9999px !important;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  color: #d0d0d0;
  font-size: 0.95rem;
  padding: 8px 0;
}

.checkbox input {
  accent-color: var(--accent2);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checkbox span {
  transition: color 0.2s ease;
}

.checkbox:hover span {
  color: #fff;
}

.footer {
  max-width: 1200px;
  margin: 24px auto 40px;
  padding: 16px 24px 0;
  text-align: center;
  color: #a7a7a7;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Кнопка для загрузки фото */
.photo-upload-section {
  display: flex;
  flex-direction: column; /* превью под полем */
  align-items: flex-start;
  gap: 8px;
}

.photo-upload-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 14px 16px 14px 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 60%;
  max-width: 240px;
}

.photo-upload-btn:hover {
  border-color: var(--accent1);
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-1px);
}

.photo-upload-btn:focus {
  outline: none;
  border-color: var(--accent1);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 40%, transparent);
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-1px);
}

.photo-upload-btn:active {
  transform: translateY(0);
}

.photo-upload-btn svg {
  position: absolute;
  left: 14px;
  color: #9c9c9c;
  transition: color 0.3s ease;
}

.photo-upload-btn:hover svg {
  color: var(--accent1);
}

/* Текст в кнопке (отображаем имя файла) */
.photo-button-text {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Встроенная кнопка удаления внутри поля */
.photo-remove-infield {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 0;
  background: #dc4a4a;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 0;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.photo-remove-infield:hover {
  background: #c73f3f;
}

.photo-remove-infield svg {
  position: absolute;
  inset: 0;
  margin: auto;
  display: block;
  width: 14px;
  height: 14px;
  color: #fff;
  pointer-events: none;
}

.photo-preview-small {
  position: relative;
  width: 160px;
  height: 160px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
}

.photo-preview-small img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* удаляем крестик с превью — больше не используется */


/* Стили для иконок валидации */
/* #valid_first_name, #invalid_first_name, 
#valid_last_name, #invalid_last_name,
#valid_user_pic, #invalid_user_pic,
#valid_email, #invalid_email, 
#valid_phone, #invalid_phone,
#valid_username, #invalid_username,
#valid_password, #invalid_password,
#valid_password_confirm, #invalid_password_confirm {
  display: none;
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  z-index: 10;
}

/* Показываем иконки валидации при валидном состоянии */
/* #first_name:valid ~ #valid_first_name,
#last_name:valid ~ #valid_last_name,
#user_pic:valid ~ #valid_user_pic,
#email:valid ~ #valid_email,
#phone:valid ~ #valid_phone,
#username:valid ~ #valid_username,
#password:valid ~ #valid_password,
#password_confirm:valid ~ #valid_password_confirm {
  display: inline-block;
  color: #10b981;
} */

/* Показываем иконки валидации при невалидном состоянии */
/* #first_name:invalid ~ #invalid_first_name,
#last_name:invalid ~ #invalid_last_name,
#user_pic:invalid ~ #invalid_user_pic,
#email:invalid ~ #invalid_email,
#phone:invalid ~ #invalid_phone,
#username:invalid ~ #invalid_username,
#password:invalid ~ #invalid_password,
#password_confirm:invalid ~ #invalid_password_confirm {
  display: inline-block;
  color: #f87171;
} */

/* Стили для подсказок */
.hint {
  font-size: 0.8rem;
  color: #9c9c9c;
  margin-top: 4px;
  margin-bottom: 8px;
  line-height: 1.3;
}

/* Стили для Font Awesome иконок */
.fa-check {
  color: #10b981;
}

.fa-times {
  color: #f87171;
}

/* Скрываем иконки валидации по умолчанию */
.fa-check, .fa-times {
  display: none;
}

/* Показываем иконки валидации рядом с полями */
.field {
  position: relative;
}

.field .fa-check,
.field .fa-times {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  z-index: 10;
}

/* Стили для полей с иконками валидации */
.field input:valid ~ .fa-check {
  display: inline-block;
}

.field input:invalid ~ .fa-times {
  display: inline-block;
}

/* Скрываем иконки валидации когда поле пустое и не было фокуса */
.field input:not(:focus):not(:placeholder-shown):invalid ~ .fa-times {
  display: none;
}

.field input:not(:focus):not(:placeholder-shown):valid ~ .fa-check {
  display: inline-block;
}

/* Общие стили для сообщений */
.success-message,
.error-message {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 20px;
  border-radius: 12px;
  color: white;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0;
  transform: translateY(0) translateX(100%);
  transition: all 0.3s ease;
}

/* Вход */
.success-message.show,
.error-message.show {
  opacity: 1;
  transform: translateY(0) translateX(0);
}

/* Выход (вверх и исчезает) */
.success-message.hide,
.error-message.hide {
  opacity: 0;
  transform: translateY(-30px) translateX(0);
}

.cookie-warning {
  margin-top: 20px;
  padding: 15px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(14px);
  text-align: center;
}

@media (max-width: 720px) {
  .header {
    flex-direction: column;
    gap: 12px;
  }
  .nav {
    gap: 14px;
  }
}