.auth-container {
  max-width: 480px;
  margin: 60px auto;
  padding: 32px;
  background: var(--color-bg-panel);
  border-radius: var(--radius-lg);
}

.auth-title {
  text-align: center;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.auth-subtitle {
  text-align: center;
  color: var(--color-text-dim);
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 12px;
  background: var(--color-bg-hover);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
}

.tab-btn.active {
  border-color: var(--color-primary);
  background: var(--color-bg);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  color: var(--color-text-dim);
  font-size: 14px;
}

.form-group input,
.form-group select {
  padding: 12px;
  background: var(--color-bg-hover);
  border: 1px solid var(--color-bg-hover);
  border-radius: var(--radius-sm);
  color: var(--color-text);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.hint {
  font-size: 12px;
  color: var(--color-text-dim);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.radio-group {
  display: flex;
  gap: 24px;
}

.checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
}

.submit-btn {
  padding: 14px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.submit-btn:hover {
  transform: translateY(-2px);
}

.error-msg {
  color: var(--color-danger);
  font-size: 14px;
  min-height: 20px;
}

/* Скрываем пустое уведомление */
.notification:empty {
  display: none !important;
}

.notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 300px;
  max-width: 500px;
  padding: 20px 40px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--color-primary);
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.5), 0 10px 40px rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  z-index: 3000;
  animation: notificationAppear 0.4s ease;
  backdrop-filter: blur(10px);
}

.notification.success {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.95), rgba(56, 142, 60, 0.95));
  border-color: #4CAF50;
  box-shadow: 0 0 30px rgba(76, 175, 80, 0.6), 0 10px 40px rgba(0, 0, 0, 0.8);
}

.notification.error {
  background: linear-gradient(135deg, rgba(244, 67, 54, 0.95), rgba(211, 47, 47, 0.95));
  border-color: #f44336;
  box-shadow: 0 0 30px rgba(244, 67, 54, 0.6), 0 10px 40px rgba(0, 0, 0, 0.8);
}

.notification.warning {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.95), rgba(255, 160, 0, 0.95));
  border-color: #FFC107;
  color: #000;
  box-shadow: 0 0 30px rgba(255, 193, 7, 0.6), 0 10px 40px rgba(0, 0, 0, 0.8);
}

.notification.info {
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.95), rgba(25, 118, 210, 0.95));
  border-color: #2196F3;
  box-shadow: 0 0 30px rgba(33, 150, 243, 0.6), 0 10px 40px rgba(0, 0, 0, 0.8);
}

@keyframes notificationAppear {
  from {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.notification.hidden {
  display: none !important;
}

.notification.success { background: var(--color-success); }
.notification.error { background: var(--color-danger); }

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--color-bg-hover);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.password-strength {
  margin-top: 4px;
  padding: 4px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}

.strength-bar {
  height: 4px;
  background: var(--color-danger);
  border-radius: 2px;
  transition: all 0.3s;
  width: 0%;
}

.strength-bar.weak { width: 33%; background: var(--color-danger); }
.strength-bar.medium { width: 66%; background: var(--color-warning); }
.strength-bar.strong { width: 100%; background: var(--color-success); }

.strength-text {
  font-size: 12px;
  color: var(--color-text-dim);
}

@media (max-width: 600px) {
  .auth-container {
    margin: 20px;
    padding: 20px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text-dim);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
}

.toggle-password:hover {
  color: var(--color-primary);
}

.form-group {
  position: relative;
}

/* ═══════════════════════════════════════════════════
   ЧЁРНЫЙ ФОН ДЛЯ СТРАНИЦЫ АВТОРИЗАЦИИ
   ═══════════════════════════════════════════════════ */
body {
  background: #000 !important;
  margin: 0;
  padding: 0;
}

html {
  background: #000 !important;
}

/* ═══════════════════════════════════════════════════
   БАННЕР "ИГРА В РАЗРАБОТКЕ"
   ═══════════════════════════════════════════════════ */
.dev-notice {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 152, 0, 0.05) 100%);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 10px;
  padding: 15px;
  margin: 20px auto;
  max-width: 500px;
  text-align: center;
  color: #ffc107;
  font-size: 14px;
}

.dev-notice p {
  margin: 5px 0;
}

.dev-notice p:first-child {
  font-weight: bold;
}

/* ═══════════════════════════════════════════════════
   АНИМАЦИЯ ТРЯСКИ ФОРМЫ ПРИ ОШИБКЕ
   ═══════════════════════════════════════════════════ */

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
  20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.auth-form.shake {
  animation: shake 0.5s;
}

/* Детекция автозаполнения браузера */
@keyframes onAutofillStart {
  from { /* Пустая анимация */ }
  to { /* Пустая анимация */ }
}

input:-webkit-autofill {
  animation-name: onAutofillStart;
  animation-duration: 0.1s;
}

/* ===== GAME PRELOADER (Экран загрузки игры) ===== */
.game-preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.game-preloader.hidden {
  display: none !important;
}

.game-preloader__content {
  text-align: center;
  width: 80%;
  max-width: 500px;
}

.game-preloader__title {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-primary, #d4af37);
  margin-bottom: 40px;
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
  letter-spacing: 2px;
}

.game-preloader__progress-container {
  margin-bottom: 30px;
}

.game-preloader__progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.game-preloader__progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, 
    var(--color-primary, #d4af37) 0%, 
    #f4d03f 50%, 
    var(--color-primary, #d4af37) 100%);
  border-radius: 4px;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.8);
  position: relative;
}

.game-preloader__progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

.game-preloader__progress-text {
  font-size: 18px;
  color: #fff;
  margin-top: 15px;
  font-weight: 600;
}

.game-preloader__subtitle {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Подсветка полей с ошибками */
.error-field {
  border-color: var(--color-danger, #f44336) !important;
  box-shadow: 0 0 8px rgba(244, 67, 54, 0.4) !important;
  animation: fieldErrorPulse 0.5s ease;
}

@keyframes fieldErrorPulse {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Список ошибок */
#registerError {
  color: var(--color-danger, #f44336);
  font-size: 14px;
  margin-top: 10px;
  text-align: left;
  line-height: 1.6;
}

#loginError {
  color: var(--color-danger, #f44336);
  font-size: 14px;
  margin-top: 10px;
  text-align: center;
}

/* ═══════════════════════════════════════════════════ */
/* ЗАЩИТА ОТ АВТОЗАПОЛНЕНИЯ БРАУЗЕРА (Anti-Autofill)   */
/* ═══════════════════════════════════════════════════ */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  /* Принудительно задаём цвет фона панели (замените #1a1a2e на ваш цвет фона input) */
  -webkit-box-shadow: 0 0 0 30px #1a1a2e inset !important;
  /* Цвет текста при автозаполнении */
  -webkit-text-fill-color: #e0e0ff !important;
  /* Фикс "ухода в потолок" и изменения размера шрифта */
  font-size: 16px !important;
  line-height: 1.5 !important;
  /* Хак для отключения анимации мигания при автозаполнении */
  transition: background-color 5000s ease-in-out 0s !important;
}

/* Для Firefox */
input:-moz-autofill {
  box-shadow: 0 0 0 30px #1a1a2e inset !important;
  -webkit-text-fill-color: #e0e0ff !important;
}

/* ═══════════════════════════════════════════════════ */
/* ЗАЩИТА ОТ АВТОЗАПОЛНЕНИЯ БРАУЗЕРА (Anti-Autofill)   */
/* ═══════════════════════════════════════════════════ */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  /* Принудительно задаём цвет фона панели (замените #1a1a2e на ваш цвет фона input) */
  -webkit-box-shadow: 0 0 0 30px #1a1a2e inset !important;
  /* Цвет текста при автозаполнении */
  -webkit-text-fill-color: #e0e0ff !important;
  /* Фикс "ухода в потолок" и изменения размера шрифта */
  font-size: 16px !important;
  line-height: 1.5 !important;
  /* Хак для отключения анимации мигания при автозаполнении */
  transition: background-color 5000s ease-in-out 0s !important;
}

/* Для Firefox */
input:-moz-autofill {
  box-shadow: 0 0 0 30px #1a1a2e inset !important;
  -webkit-text-fill-color: #e0e0ff !important;
}

/* ═══ Баннер VLADYKA ═══ */
.game-banner { width: 100%; max-width: 480px; margin: 12px auto 0; border-radius: 12px; overflow: hidden; border: 2px solid #d4af37; box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.game-banner img { width: 100%; height: 220px; object-fit: cover; object-position: center 30%; display: block; }
/* ═══ Карточки классов ═══ */
.class-cards { display: flex; gap: 8px; margin-top: 6px; }
.class-card { flex: 1; background: rgba(20,20,30,.85); border: 2px solid #444; border-radius: 10px; padding: 10px 6px; text-align: center; cursor: pointer; transition: border-color .2s, transform .2s; }
.class-card.selected { border-color: #d4af37; box-shadow: 0 0 12px rgba(212,175,55,.4); transform: translateY(-2px); }
.class-icon { font-size: 26px; }
.class-name { color: #e0c060; font-weight: 700; font-size: 12px; margin: 4px 0; letter-spacing: 1px; }
.class-desc { color: #aaa; font-size: 10px; line-height: 1.35; }
@media (max-width: 480px) { .game-banner img { height: 180px; } .class-desc { font-size: 9px; } }

/* ═══ Карточки фракций ═══ */
.faction-cards { display: flex; gap: 10px; margin-top: 6px; }
.faction-card { flex: 1; background: rgba(20,20,30,.85); border: 2px solid #444; border-radius: 10px; padding: 10px 6px; text-align: center; cursor: pointer; transition: border-color .2s, transform .2s; }
.faction-card.selected { border-color: #d4af37; box-shadow: 0 0 12px rgba(212,175,55,.4); transform: translateY(-2px); }
.faction-card img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: rgba(0,0,0,.3); border: 2px solid #555; }
.faction-card.selected img { border-color: #d4af37; }
.faction-name { color: #e0c060; font-weight: 700; font-size: 11px; margin-top: 6px; letter-spacing: 1px; }

/* ═══ Баннер VLADYKA (поверх canvas) ═══ */
.game-banner { position: relative; z-index: 10; width: calc(100% - 24px); max-width: 480px; margin: 12px auto 0; border-radius: 12px; overflow: hidden; border: 2px solid #d4af37; box-shadow: 0 4px 16px rgba(0,0,0,.6); }
.game-banner img { width: 100%; height: 220px; object-fit: cover; object-position: center 30%; display: block; }
@media (max-width: 480px) { .game-banner img { height: 180px; } }

/* ═══ Баннер вплотную к верху ═══ */
.game-banner { margin: 0 !important; width: 100% !important; max-width: 100% !important; border-radius: 0 !important; border: none !important; box-shadow: none !important; }
.game-banner img { height: 210px; object-position: center 35%; }
@media (max-width: 480px) { .game-banner img { height: 170px; } }

/* ═══ Баннер: верх изображения виден полностью ═══ */
.game-banner img { height: 250px; object-position: center 0%; }
@media (max-width: 480px) { .game-banner img { height: 210px; object-position: center 0%; } }


/* ═══ Баннер: отступ 20px сверху ═══ */
.game-banner { margin-top: 20px !important; }

/* ═══ Рамка входа — вплотную под баннер ═══ */
.auth-container { margin-top: 16px !important; }
.dev-notice { display: none; }

/* ═══════════ ПАКЕТ «ВЕЛИКОЛЕПИЕ» (по книгам) ═══════════ */

/* Ken Burns: баннер дышит (Val Head / Apple) */
.game-banner img { animation: kenBurns 24s ease-in-out infinite alternate; }
@keyframes kenBurns {
  0%   { transform: scale(1) translateY(0); }
  100% { transform: scale(1.08) translateY(-6px); }
}

/* Fade-in-up: рамка всплывает мягко (Val Head) */
.auth-container { animation: fadeUp .7s ease-out both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Заголовок: пульс золотого свечения (Swink, Hodent) */
.auth-title { animation: titleGlow 3s ease-in-out infinite; }
@keyframes titleGlow {
  0%, 100% { text-shadow: 0 0 12px rgba(212, 175, 55, .35); }
  50%      { text-shadow: 0 0 28px rgba(212, 175, 55, .75); }
}

/* Карточки: отклик пальцу (Josh Clark) */
.class-card:active, .faction-card:active { transform: scale(.96); }

/* ═══ Иерархия заголовка (Луптон: один хозяин) ═══ */
.auth-epigraph { font-size: 11px; letter-spacing: 5px; text-transform: uppercase; color: rgba(224, 192, 96, .5); margin-bottom: 10px; }
.auth-title {
  font-size: 30px; letter-spacing: 3px; text-transform: uppercase;
  background: linear-gradient(180deg, #f5d78e 0%, #d4af37 55%, #8a6914 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: titleBreath 3.2s ease-in-out infinite;
}
@keyframes titleBreath {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(212, 175, 55, .35)); }
  50%      { filter: drop-shadow(0 0 18px rgba(212, 175, 55, .75)); }
}
.auth-divider { color: rgba(212, 175, 55, .55); margin: 16px auto 6px; letter-spacing: 10px; font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: '──────'; color: rgba(212, 175, 55, .25); letter-spacing: 0; margin: 0 10px; }
@media (max-width: 480px) { .auth-title { font-size: 24px; } }

/* ═══ Заголовок на одной строке (размер по экрану) ═══ */
.auth-title { white-space: nowrap; font-size: clamp(15px, 6.2vw, 30px); letter-spacing: 2px; }

/* ═══ Заголовок целиком (буква И на месте) ═══ */
.auth-title { white-space: nowrap; font-size: clamp(13px, 5.5vw, 28px); letter-spacing: 1px; }

/* ═══ Тёмный дым-смола под словами ═══ */
.auth-head { position: relative; z-index: 0; }
.auth-head::before {
  content: '';
  position: absolute; left: -12%; right: -12%; top: -16px; bottom: -4px;
  background:
    radial-gradient(42% 65% at 18% 55%, rgba(4, 4, 10, .95), transparent 70%),
    radial-gradient(55% 75% at 55% 40%, rgba(8, 6, 16, .9), transparent 72%),
    radial-gradient(48% 70% at 86% 60%, rgba(5, 5, 12, .95), transparent 70%),
    radial-gradient(30% 45% at 40% 70%, rgba(20, 12, 40, .55), transparent 70%);
  filter: blur(12px);
  border-radius: 50%;
  z-index: -1;
  animation: smokeDrift 8s ease-in-out infinite alternate;
}
@keyframes smokeDrift {
  0%   { transform: translateX(-5%) scaleY(1);    opacity: .85; }
  50%  { transform: translateX(3%)  scaleY(1.18); opacity: 1;   }
  100% { transform: translateX(7%)  scaleY(.92);  opacity: .9;  }
}

/* ═══ Плотная форма (Wroblewski: меньше воздуха) ═══ */
.form-group { margin-bottom: 14px !important; }
.form-group label { margin-bottom: 6px !important; display: block; }
.form-row { gap: 12px !important; margin-bottom: 14px !important; }
.auth-container { padding: 24px 18px !important; }
.form-group input, .form-group select { padding: 12px 14px !important; }
.form-hint, .password-hint { margin-top: 4px !important; font-size: 11px !important; }
.class-cards, .faction-cards { margin-top: 6px !important; margin-bottom: 6px !important; }

/* ═══ Автопоиск друга (Кларк: ясная обратная связь) ═══ */
#ref-friend-search {
  margin-top: 6px; padding: 10px 12px; font-size: 13px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(212,175,55,.25);
  border-radius: 8px; color: #e0c060; width: 100%;
}
#ref-friend-search:focus { border-color: #d4af37; outline: none; }
.ref-results { margin-top: 4px; max-height: 160px; overflow-y: auto; }
.ref-item {
  padding: 8px 12px; background: rgba(25,25,40,.9); border: 1px solid rgba(212,175,55,.2);
  border-radius: 6px; margin-bottom: 3px; cursor: pointer; font-size: 13px;
  display: flex; justify-content: space-between; transition: background .15s;
}
.ref-item:hover { background: rgba(212,175,55,.15); }
.ref-item .nick { color: #e0c060; font-weight: bold; }
.ref-item .code { color: #9aa; font-size: 11px; }
.ref-empty { color: #666; font-size: 12px; padding: 6px; text-align: center; }
