/* ====== Settings Modal ======
   Стили для модалки «Настройки»: вкладки, секции, слайдеры громкости,
   смена языка/фракции, реферальная ссылка и список рефералов.
   Палитра и шрифты соответствуют .fantasy-modal / .modal-section. */

.modal-spacer {
    height: 60px; /* Укажите нужную высоту отступа */
    width: 100%;  /* Чтобы занимал всю ширину окна */
}

.settings-tabs {
  display: flex;
  gap: 8px;
  margin: 6px 0 14px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  padding: 6px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

.settings-tab {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: #c0a878;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  -webkit-tap-highlight-color: transparent;
}

.settings-tab.active {
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.22), rgba(255, 215, 0, 0.08));
  color: #ffd700;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.35), inset 0 0 8px rgba(255, 215, 0, 0.2);
}

.settings-tab-body {
  min-height: 200px;
}

/* ── Секции ── */
.settings-section {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.settings-section-title {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4), 1px 1px 2px rgba(0, 0, 0, 0.8);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

/* ── Язык ── */
.settings-lang-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-lang-btn {
  flex: 0 0 calc((100% - 20px) / 3);
  padding: 12px;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: #c0a878;
  background: rgba(0, 0, 0, 0.4);
  border: 1.5px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  -webkit-tap-highlight-color: transparent;
}

.settings-lang-btn.active {
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.25), rgba(255, 215, 0, 0.08));
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.7);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.settings-lang-btn:active { transform: scale(0.97); }

/* ── Фракция ── */
.settings-faction-current {
  color: #e8d8b0;
  font-size: 0.95rem;
  margin-bottom: 8px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}
.settings-faction-current b { color: #ffd700; }

.settings-faction-hint {
  color: #b0a080;
  font-size: 0.82rem;
  line-height: 1.4;
  margin-bottom: 6px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.settings-faction-gold {
  color: #d8cba0;
  font-size: 0.85rem;
  margin-bottom: 12px;
}
.settings-faction-gold b { color: #ffd700; }

/* ── Кнопка действия ── */
.settings-action-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: #2a1a05;
  background: linear-gradient(180deg, #ffe680, #f5c542);
  border: 1.5px solid rgba(255, 215, 0, 0.9);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 12px rgba(255, 215, 0, 0.25);
  -webkit-tap-highlight-color: transparent;
}
.settings-action-btn:active { transform: scale(0.98); }
.settings-action-btn.disabled {
  background: linear-gradient(180deg, #6a5a40, #4a3a28);
  color: #8a7a60;
  border-color: rgba(150, 130, 90, 0.5);
  box-shadow: none;
  cursor: not-allowed;
}

.referral-share-btn {
  background: linear-gradient(180deg, #7fc8ff, #4c9aff);
  border-color: rgba(120, 200, 255, 0.9);
  color: #06203a;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 12px rgba(76, 154, 255, 0.3);
}

/* ── Слайдеры громкости ── */
.settings-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.settings-slider-label {
  flex-shrink: 0;
  width: 64px;
  font-family: 'Cinzel', serif;
  font-size: 0.88rem;
  color: #e8d8b0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}
.settings-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #4c9aff 0%, #4c9aff var(--sv, 50%), rgba(0,0,0,0.5) var(--sv, 50%));
  outline: none;
  cursor: pointer;
}
.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffe680, #f5c542);
  border: 2px solid #ffd700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
  cursor: pointer;
}
.settings-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffe680, #f5c542);
  border: 2px solid #ffd700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
  cursor: pointer;
}
.settings-slider-val {
  flex-shrink: 0;
  width: 42px;
  text-align: right;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: #ffd700;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.settings-audio-hint {
  color: #b0a080;
  font-size: 0.76rem;
  line-height: 1.4;
  margin-top: 4px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* ── Реферальная ссылка ── */
.referral-link-box {
  margin-bottom: 10px;
}
.referral-link-input {
  width: 100%;
  padding: 10px 12px;
  font-family: monospace;
  font-size: 0.78rem;
  color: #ffd700;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 8px;
  box-sizing: border-box;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.referral-actions {
  display: flex;
  gap: 10px;
}
.referral-actions .settings-action-btn { margin-top: 0; }

.referral-hint {
  color: #b0a080;
  font-size: 0.78rem;
  line-height: 1.45;
  margin-top: 12px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* ── Статистика ── */
.referral-stats {
  display: flex;
  gap: 10px;
}
.referral-stat {
  flex: 1;
  text-align: center;
  padding: 12px 6px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  border: 1px solid rgba(255, 215, 0, 0.2);
}
.referral-stat-value {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
  line-height: 1.1;
}
.referral-stat-label {
  font-size: 0.76rem;
  color: #c0a878;
  margin-top: 4px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* ── Список рефералов ── */
.referral-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 4px;
}
.referral-list::-webkit-scrollbar { width: 5px; }
.referral-list::-webkit-scrollbar-thumb { background: rgba(255, 215, 0, 0.4); border-radius: 3px; }

.referral-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 215, 0, 0.18);
  border-radius: 8px;
}
.referral-item-avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3), rgba(255, 215, 0, 0.08));
  border: 1.5px solid rgba(255, 215, 0, 0.5);
  color: #ffd700;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1rem;
}
.referral-item-info { flex: 1; min-width: 0; }
.referral-item-name {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: #e8d8b0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}
.referral-item-status {
  font-size: 0.72rem;
  color: #5fd07a;
  margin-top: 2px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}
.referral-item-earned {
  flex-shrink: 0;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}

/* ── Загрузка/пусто ── */
.settings-loading, .settings-empty {
  color: #c0a878;
  text-align: center;
  font-size: 0.9rem;
  padding: 24px 12px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  line-height: 1.5;
}

/* ── Toast (внутри .fantasy-modal) ── */
.settings-toast {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 200px;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(45, 33, 12, 0.97), rgba(65, 48, 16, 0.97));
  border: 2px solid rgba(255, 215, 0, 0.65);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 22px rgba(255, 215, 0, 0.3);
  color: #ffd700;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  z-index: 50;
  opacity: 0;
  animation: settingsToastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}
.settings-toast.hiding { animation: settingsToastOut 0.35s ease forwards; }
.settings-toast--error {
  background: linear-gradient(135deg, rgba(50, 12, 12, 0.97), rgba(70, 18, 18, 0.97));
  border-color: rgba(255, 107, 107, 0.65);
  color: #ff8585;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 22px rgba(255, 80, 80, 0.3);
}
@keyframes settingsToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(0.92); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes settingsToastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  to   { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(0.96); }
}

/* ── Confirm-оверлей смены фракции ── */
.settings-confirm-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 0.25s ease;
  padding: 20px;
  box-sizing: border-box;
}
.settings-confirm-overlay.show { opacity: 1; }

.settings-confirm-box {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(180deg, #2a1a08, #1a1208);
  border: 2px solid rgba(255, 215, 0, 0.6);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 215, 0, 0.25);
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.settings-confirm-overlay.show .settings-confirm-box { transform: scale(1); }

.settings-confirm-title {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffd700;
  text-align: center;
  margin-bottom: 12px;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}
.settings-confirm-text {
  color: #e8d8b0;
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: center;
  margin-bottom: 16px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}
.settings-confirm-text b { color: #ffd700; }

.settings-faction-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.settings-faction-option {
  padding: 12px;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffd700;
  background: rgba(0, 0, 0, 0.4);
  border: 1.5px solid rgba(255, 215, 0, 0.4);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  -webkit-tap-highlight-color: transparent;
}
.settings-faction-option:active { transform: scale(0.98); }
.settings-faction-option:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.7);
}

.settings-confirm-actions { display: flex; justify-content: center; }
.settings-confirm-cancel {
  padding: 10px 24px;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: #c0a878;
  background: rgba(0, 0, 0, 0.4);
  border: 1.5px solid rgba(150, 130, 90, 0.5);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.settings-confirm-cancel:active { transform: scale(0.97); }
