/* Disable webkit tap highlight on mobile devices */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Allow text selection for specific elements */
input, textarea, [contenteditable] {
  -webkit-user-select: text;
  -khtml-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

:root {
  --bg: #000;
  --card: rgba(10,10,10,0.98);
  --white: #fff;
  --gray: #b0b0b8;
  --border: #fff2;
  --shadow: 0 8px 32px 0 rgba(255,255,255,0.07);
  --radius: 2.2rem;
  --radius-sm: 1.2rem;
  --transition: 0.3s cubic-bezier(.4,0,.2,1);
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--white);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  /* Мобильные улучшения */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Улучшения для мобильных устройств */
* {
  box-sizing: border-box;
}

/* Убираем подсветку тапов */
button, a, .auth-btn {
  /* Уже отключено глобально */
  touch-action: manipulation;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  justify-content: center;
  align-items: center;
}

body::before {
  content: '';
  position: fixed;
  z-index: 0;
  left: 0; top: 0; width: 100vw; height: 100vh;
  pointer-events: none;
  opacity: 0.55;
  background:
    radial-gradient(ellipse 38% 22% at 8% 12%, #00ffb3 0%, transparent 80%), /* верхний левый, вытянутый */
    radial-gradient(ellipse 22% 38% at 92% 18%, #ffb300 0%, transparent 80%), /* верхний правый, вытянутый */
    radial-gradient(ellipse 30% 18% at 12% 88%, #ff6a00 0%, transparent 80%), /* нижний левый, маленький */
    radial-gradient(ellipse 18% 30% at 85% 95%, #00ffb3 0%, transparent 80%), /* нижний правый, маленький */
    radial-gradient(ellipse 25% 12% at 70% 60%, #ffb300 0%, transparent 80%), /* справа, ближе к центру */
    radial-gradient(ellipse 12% 25% at 30% 80%, #ff6a00 0%, transparent 80%); /* слева, ближе к центру */
  filter: blur(54px);
  animation: auth-bg-move 16s ease-in-out infinite alternate;
}

@keyframes auth-bg-move {
  0% {
    background-position:
      8% 12%, 92% 18%, 12% 88%, 85% 95%, 70% 60%, 30% 80%;
  }
  100% {
    background-position:
      12% 18%, 88% 22%, 18% 92%, 80% 85%, 75% 65%, 25% 75%;
  }
}

body > * { position: relative; z-index: 1; }

.auth-container {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  padding: 2.5rem 2.2rem 2.2rem 2.2rem;
  min-width: 320px;
  max-width: 95vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2.5rem;
  transition: min-height 0.5s, height 0.5s;
  overflow: hidden;
}

.auth-form, .register-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.5s, transform 0.5s;
}

.auth-form.hide, .register-form.hide {
  opacity: 0;
  transform: scale(0.97) translateY(30px);
  pointer-events: none;
  position: absolute;
  left: 0; right: 0;
}

.register-form {
  display: none;
}

.register-form.show {
  display: flex;
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  position: static;
}

.auth-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -1px;
  text-align: center;
}

.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.auth-input {
  background: #111;
  color: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  font-size: 1.1rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 12px 0 #0002;
}

.auth-input:focus {
  border-color: var(--white);
  box-shadow: 0 4px 24px 0 #fff1;
}

.auth-input::placeholder {
  color: #b0b0b8;
  opacity: 1;
  font-weight: 400;
}

.auth-btn {
  background: var(--white);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  padding: 1.1rem 2.2rem;
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
  outline: none;
  margin-top: 0.5rem;
}

.auth-btn:hover {
  background: #222;
  color: var(--white);
  box-shadow: 0 12px 32px 0 #fff2;
  transform: translateY(-2px) scale(1.04);
}

.auth-links-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-top: 1.2rem;
  font-size: 1rem;
}

.auth-link {
  color: var(--gray);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-weight: 500;
  transition: color var(--transition);
}

.auth-link:hover {
  color: var(--white);
}

.auth-link-arrow {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  vertical-align: middle;
  margin-left: 0.2em;
  margin-right: -0.1em;
}

.auth-divider {
  width: 1.5px;
  height: 1.2em;
  background: var(--border);
  border-radius: 2px;
  margin: 0 0.7em;
  display: inline-block;
}

.auth-link-registration {
  color: var(--gray);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}

.auth-link-registration:hover {
  color: var(--white);
}

/* Сбросить белый фон автозаполнения браузера */
input.auth-input:-webkit-autofill,
input.auth-input:-webkit-autofill:focus,
input.auth-input:-webkit-autofill:hover,
input.auth-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #111 inset !important;
  box-shadow: 0 0 0 1000px #111 inset !important;
  -webkit-text-fill-color: #fff !important;
  color: #fff !important;
  border: 1.5px solid var(--border);
  transition: background-color 5000s ease-in-out 0s;
}

input.auth-input:-internal-autofill-selected {
  background-color: #111 !important;
  color: #fff !important;
}

.register-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -1px;
  text-align: center;
}

.register-checkbox {
  display: flex;
  align-items: center;
  gap: 0.7em;
  font-size: 1rem;
  color: var(--gray);
  margin-top: 0.2em;
}

.register-checkbox input[type="checkbox"] {
  accent-color: #00ffb3;
  width: 1.1em;
  height: 1.1em;
  border-radius: 0.4em;
  margin: 0;
}

.register-btn {
  background: var(--white);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  padding: 1.1rem 2.2rem;
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
  outline: none;
  margin-top: 0.5rem;
}

.register-btn:hover {
  background: #222;
  color: var(--white);
  box-shadow: 0 12px 32px 0 #fff2;
  transform: translateY(-2px) scale(1.04);
}

.register-links-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-top: 1.2rem;
  font-size: 1rem;
  justify-content: center;
}

.register-link, .register-link-login {
  color: var(--gray);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}

.register-link:hover, .register-link-login:hover {
  color: var(--white);
}

.register-divider {
  width: 1.5px;
  height: 1.2em;
  background: var(--border);
  border-radius: 2px;
  margin: 0 0.7em;
  display: inline-block;
}

/* Кастомный чекбокс для политики */
.custom-checkbox {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.custom-checkbox input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  left: 0;
  top: 0;
}

.custom-check {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  border: 2px solid #fff;
  border-radius: 0.4em;
  background: #101014;
  margin-right: 0.7em;
  vertical-align: middle;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
  box-sizing: border-box;
}

.custom-checkbox input[type="checkbox"]:checked + .custom-check {
  background: #fff;
  border-color: #fff;
}

.custom-check:after {
  content: '';
  position: absolute;
  left: 0.38em;
  top: 0.18em;
  width: 0.28em;
  height: 0.48em;
  border: solid #101014;
  border-width: 0 0.18em 0.18em 0;
  border-radius: 0.05em;
  opacity: 0;
  transform: scale(0.9) rotate(45deg);
  transition: opacity 0.2s, transform 0.2s;
}

.custom-checkbox input[type="checkbox"]:checked + .custom-check:after {
  opacity: 1;
  transform: scale(1) rotate(45deg);
}

.policy-link {
  color: #00ffb3;
  text-decoration: underline;
  transition: color 0.2s;
}

.policy-link:hover {
  color: #fff;
}

/* Стилизация скроллбара */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Статичный фон для мобильных устройств */
@media (max-width: 768px) {
  /* Убираем анимированный фон на мобильных для производительности */
  body::before {
    animation: none !important;
    background:
      radial-gradient(ellipse 38% 22% at 10% 15%, #00ffb3 0%, transparent 80%),
      radial-gradient(ellipse 22% 38% at 90% 20%, #ffb300 0%, transparent 80%),
      radial-gradient(ellipse 30% 18% at 15% 85%, #ff6a00 0%, transparent 80%),
      radial-gradient(ellipse 18% 30% at 85% 90%, #00ffb3 0%, transparent 80%);
    filter: blur(40px);
    opacity: 0.4;
  }
  
  /* Сохраняем оригинальные отступы как на компьютере */
  .auth-container {
    padding: 2.5rem 2.2rem 2.2rem 2.2rem;
    margin: 2.5rem 1rem 1rem 1rem;
    min-width: 320px;
    max-width: 90vw;
    border-radius: var(--radius);
  }
  
  .auth-title, .register-title {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
  }
  
  .auth-input {
    padding: 1rem 1.2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0;
    min-height: auto;
  }
  
  .auth-btn, .register-btn {
    padding: 1.1rem 2.2rem;
    font-size: 1.1rem;
    border-radius: var(--radius);
    min-height: auto;
    margin-top: 0.5rem;
  }
  
  .auth-links-row, .register-links-row {
    margin-top: 1.2rem;
    gap: 1.2rem;
    font-size: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .auth-link, .register-link, .register-link-login {
    padding: 0;
    min-height: auto;
    display: flex;
    align-items: center;
  }
  
  .register-checkbox {
    font-size: 1rem;
    margin-top: 0.2em;
    line-height: 1.4;
  }
  
  .custom-check {
    width: 1.1em;
    height: 1.1em;
    margin-right: 0.7em;
  }
}

/* Средние мобильные экраны */
@media (max-width: 480px) {
  .auth-container {
    padding: 2.5rem 2rem 2rem 2rem;
    margin: 2rem 0.8rem 0.8rem 0.8rem;
    min-width: 280px;
    max-width: 95vw;
  }
  
  .auth-title, .register-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }
  
  .auth-input {
    padding: 1rem 1.2rem;
    font-size: 1.1rem;
    margin-bottom: 0;
    min-height: auto;
  }
  
  .auth-btn, .register-btn {
    padding: 1.1rem 2.2rem;
    font-size: 1.1rem;
    min-height: auto;
    margin-top: 0.5rem;
  }
  
  .auth-links-row, .register-links-row {
    margin-top: 1.2rem;
    gap: 1.2rem;
    font-size: 1rem;
  }
  
  .auth-link, .register-link, .register-link-login {
    padding: 0;
    min-height: auto;
  }
  
  .register-checkbox {
    font-size: 1rem;
    margin-top: 0.2em;
  }
  
  .custom-check {
    width: 1.1em;
    height: 1.1em;
    margin-right: 0.7em;
  }
}

/* Маленькие мобильные экраны */
@media (max-width: 360px) {
  .auth-container {
    padding: 2rem 1.5rem 1.5rem 1.5rem;
    margin: 1.5rem 0.5rem 0.5rem 0.5rem;
    min-width: 260px;
    max-width: 98vw;
  }
  
  .auth-title, .register-title {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
  }
  
  .auth-input {
    padding: 0.9rem 1.1rem;
    font-size: 1rem;
    margin-bottom: 0;
    min-height: auto;
  }
  
  .auth-btn, .register-btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    min-height: auto;
    margin-top: 0.5rem;
  }
  
  .auth-links-row, .register-links-row {
    margin-top: 1.2rem;
    gap: 1rem;
    font-size: 0.95rem;
  }
  
  .auth-link, .register-link, .register-link-login {
    padding: 0;
    min-height: auto;
  }
  
  .register-checkbox {
    font-size: 0.95rem;
    margin-top: 0.2em;
  }
  
  .custom-check {
    width: 1.1em;
    height: 1.1em;
    margin-right: 0.7em;
  }
}

/* Ландшафтная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
  .auth-container {
    margin: 1rem 0.8rem 0.8rem 0.8rem;
    padding: 2rem 2.2rem 2rem 2.2rem;
  }
  
  .auth-title, .register-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }
  
  .auth-input {
    padding: 0.9rem 1.2rem;
    margin-bottom: 0;
    min-height: auto;
  }
  
  .auth-btn, .register-btn {
    padding: 1rem 2rem;
    min-height: auto;
    margin-top: 0.5rem;
  }
  
  .auth-links-row, .register-links-row {
    margin-top: 1rem;
  }
}

/* Улучшения для устройств с высоким DPI */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .auth-input {
    border-width: 1px;
  }
  
  .auth-container {
    border-width: 1px;
  }
}

/* Улучшения для устройств с поддержкой hover */
@media (hover: hover) {
  .auth-btn:hover, .register-btn:hover {
    transform: translateY(-2px) scale(1.02);
  }
  
  .auth-link:hover, .register-link:hover, .register-link-login:hover {
    transform: translateY(-1px);
  }
}

/* Улучшения для устройств без поддержки hover (мобильные) */
@media (hover: none) {
  .auth-btn:active, .register-btn:active {
    transform: scale(0.98);
  }
  
  .auth-link:active, .register-link:active, .register-link-login:active {
    opacity: 0.7;
  }
}

/* Адаптивные стили для модального окна уведомлений */
@media (max-width: 768px) {
  .profile-notification-modal-overlay {
    padding: 1rem;
  }
  
  .profile-notification-modal {
    width: 100%;
    max-width: 90vw;
    margin: 0;
    border-radius: var(--radius-sm);
    padding: 1.5rem;
  }
  
  .profile-notification-modal-header {
    padding: 0 0 1rem 0;
    margin-bottom: 1rem;
  }
  
  .profile-notification-modal-header h3 {
    font-size: 1.3rem;
    margin: 0;
  }
  
  .profile-notification-modal-content {
    margin-bottom: 1.5rem;
  }
  
  .profile-notification-modal-content p {
    font-size: 0.95rem;
    line-height: 1.5;
  }
  
  .profile-notification-modal-buttons {
    gap: 0.8rem;
  }
  
  .profile-notification-ok-btn {
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem;
    min-height: 44px;
  }
  
  .profile-notification-modal-close {
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .profile-notification-modal-overlay {
    padding: 0.5rem;
  }
  
  .profile-notification-modal {
    max-width: 95vw;
    padding: 1.2rem;
  }
  
  .profile-notification-modal-header {
    padding: 0 0 0.8rem 0;
    margin-bottom: 0.8rem;
  }
  
  .profile-notification-modal-header h3 {
    font-size: 1.2rem;
  }
  
  .profile-notification-modal-content {
    margin-bottom: 1.2rem;
  }
  
  .profile-notification-modal-content p {
    font-size: 0.9rem;
  }
  
  .profile-notification-modal-buttons {
    gap: 0.6rem;
  }
  
  .profile-notification-ok-btn {
    padding: 0.7rem 1.2rem;
    font-size: 0.9rem;
    min-height: 40px;
  }
  
  .profile-notification-modal-close {
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
  }
}

@media (max-width: 360px) {
  .profile-notification-modal-overlay {
    padding: 0.3rem;
  }
  
  .profile-notification-modal {
    max-width: 98vw;
    padding: 1rem;
  }
  
  .profile-notification-modal-header {
    padding: 0 0 0.6rem 0;
    margin-bottom: 0.6rem;
  }
  
  .profile-notification-modal-header h3 {
    font-size: 1.1rem;
  }
  
  .profile-notification-modal-content {
    margin-bottom: 1rem;
  }
  
  .profile-notification-modal-content p {
    font-size: 0.85rem;
  }
  
  .profile-notification-modal-buttons {
    gap: 0.5rem;
  }
  
  .profile-notification-ok-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    min-height: 36px;
  }
  
  .profile-notification-modal-close {
    width: 24px;
    height: 24px;
    font-size: 1rem;
  }
} 